diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-05-27 06:37:22 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-05-27 06:37:22 +0000 |
commit | 34d74a9d6bb530296d624bb77b86a589bf0e2bf2 (patch) | |
tree | b67f511b3cfed08098832e7bf4728334c3ea5e79 /sys/dev/ic | |
parent | edd1433996c3f9d42fc69de296f4cdcba515b6e3 (diff) |
- fix reception of VLAN sized frames on 82558 and up
- add support for reception of VLAN sized frames on 82557
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/fxp.c | 40 | ||||
-rw-r--r-- | sys/dev/ic/fxpvar.h | 3 |
2 files changed, 27 insertions, 16 deletions
diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 0bcfaf9bc74..f7fd55c2dc0 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.70 2005/05/13 00:09:59 brad Exp $ */ +/* $OpenBSD: fxp.c,v 1.71 2005/05/27 06:37:21 brad Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -457,11 +457,7 @@ fxp_attach_common(sc, intrstr) IFQ_SET_MAXLEN(&ifp->if_snd, FXP_NTXCB - 1); IFQ_SET_READY(&ifp->if_snd); - /* - * Only 82558 and newer cards have a bit to ignore oversized frames. - */ - if (sc->not_82557) - ifp->if_capabilities = IFCAP_VLAN_MTU; + ifp->if_capabilities = IFCAP_VLAN_MTU; printf(": %s, address %s\n", intrstr, ether_sprintf(sc->sc_arpcom.ac_enaddr)); @@ -1212,7 +1208,7 @@ fxp_init(xsc) struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *txp; bus_dmamap_t rxmap; - int i, prm, allm, s, bufs; + int i, prm, save_bf, lrxen, allm, s, bufs; s = splimp(); @@ -1239,6 +1235,20 @@ fxp_init(xsc) /* Once through to set flags */ fxp_mc_setup(sc, 0); + /* + * In order to support receiving 802.1Q VLAN frames, we have to + * enable "save bad frames", since they are 4 bytes larger than + * the normal Ethernet maximum frame length. On i82558 and later, + * we have a better mechanism for this. + */ + save_bf = 0; + lrxen = 0; + + if (sc->sc_revision >= FXP_REV_82558_A4) + lrxen = 1; + else + save_bf = 1; + /* * Initialize base of dump-stats buffer. */ @@ -1274,7 +1284,7 @@ fxp_init(xsc) cbp->late_scb = 0; /* (don't) defer SCB update */ cbp->tno_int = 0; /* (disable) tx not okay interrupt */ cbp->ci_int = 1; /* interrupt on CU idle */ - cbp->save_bf = prm; /* save bad frames */ + cbp->save_bf = save_bf ? 1 : prm; /* save bad frames */ cbp->disc_short_rx = !prm; /* discard short packets */ cbp->underrun_retry = 1; /* retry mode (1) on DMA underrun */ cbp->mediatype = !sc->phy_10Mbps_only; /* interface mode */ @@ -1290,7 +1300,7 @@ fxp_init(xsc) cbp->stripping = !prm; /* truncate rx packet to byte count */ cbp->padding = 1; /* (do) pad short tx packets */ cbp->rcv_crc_xfer = 0; /* (don't) xfer CRC to host */ - cbp->long_rx = sc->not_82557; /* (enable) long packets */ + cbp->long_rx = lrxen; /* (enable) long packets */ cbp->force_fdx = 0; /* (don't) force full duplex */ cbp->fdx_pin_en = 1; /* (enable) FDX# pin */ cbp->multi_ia = 0; /* (don't) accept multiple IAs */ @@ -1304,17 +1314,19 @@ fxp_init(xsc) if (prm) { cbp->promiscuous |= 1; /* promiscuous mode */ - cbp->ctrl1 |= 0x80; /* save bad frames */ cbp->ctrl2 &= ~0x01; /* save short packets */ cbp->stripping &= ~0x01; /* don't truncate rx packets */ - } - else { + } else { cbp->promiscuous &= ~1; /* no promiscuous mode */ - cbp->ctrl1 &= ~0x80; /* discard bad frames */ cbp->ctrl2 |= 0x01; /* discard short packets */ cbp->stripping |= 0x01; /* truncate rx packets */ } + if (prm || save_bf) + cbp->ctrl1 |= 0x80; /* save bad frames */ + else + cbp->ctrl1 &= ~0x80; /* discard bad frames */ + if (sc->sc_flags & FXPF_MWI_ENABLE) cbp->ctrl0 |= 0x01; /* enable PCI MWI command */ @@ -1323,7 +1335,7 @@ fxp_init(xsc) else cbp->mediatype &= ~0x01; - if(sc->not_82557) /* long packets */ + if(lrxen) /* long packets */ cbp->stripping |= 0x08; else cbp->stripping &= ~0x08; diff --git a/sys/dev/ic/fxpvar.h b/sys/dev/ic/fxpvar.h index 935660a5a7e..f2792c9c2a5 100644 --- a/sys/dev/ic/fxpvar.h +++ b/sys/dev/ic/fxpvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fxpvar.h,v 1.22 2005/01/15 18:48:12 brad Exp $ */ +/* $OpenBSD: fxpvar.h,v 1.23 2005/05/27 06:37:21 brad Exp $ */ /* $NetBSD: if_fxpvar.h,v 1.1 1997/06/05 02:01:58 thorpej Exp $ */ /* @@ -115,7 +115,6 @@ struct fxp_softc { int phy_primary_device; /* device type of primary PHY */ int phy_10Mbps_only; /* PHY is 10Mbps-only device */ int eeprom_size; /* size of serial EEPROM */ - int not_82557; /* yes if we are 82558/82559 */ int rx_bufs; /* how many rx buffers allocated? */ void *sc_sdhook; /* shutdownhook */ void *sc_powerhook; /* powerhook */ |