diff options
author | wpaul <wpaul@FreeBSD.org> | 2001-05-31 22:08:45 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2001-05-31 22:08:45 +0000 |
commit | 359f5df65b846b710828608144821d955a9b3ec1 (patch) | |
tree | 92856a2d00fcaa3608f7a714779eb91b1693cf3e /sys/pci/if_xl.c | |
parent | 726d973cb09fcd3da9c89b486c18f19be9a3bbf4 (diff) | |
download | FreeBSD-src-359f5df65b846b710828608144821d955a9b3ec1.zip FreeBSD-src-359f5df65b846b710828608144821d955a9b3ec1.tar.gz |
Close PR #27742: allow the xl driver to receive VLAN tagged frames by
setting the 'max packet size' register in window 3. This only
works for cards based on the cyclone or newer chipsets (i.e. it
won't work with the original 3c905/boomerang cards).
There is a trick which will work with the boomerang, which is to turn
on the 'large packets ok' bit in the MAC control register, however this
lets the chip accept any frame up to 4K in length, which is larger than
the mbuf cluster buffers we use to receive frames. If somebody sends us
such a frame and the chip DMAs it to us, it could write past the end
of the cluster buffer and clobber something.
PR: kern/27742
Diffstat (limited to 'sys/pci/if_xl.c')
-rw-r--r-- | sys/pci/if_xl.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index ff990ec..8cb2ef5 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -610,7 +610,8 @@ static void xl_miibus_statchg(dev) /* Set ASIC's duplex mode to match the PHY. */ XL_SEL_WIN(3); if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - CSR_WRITE_1(sc, XL_W3_MAC_CTRL, XL_MACCTRL_DUPLEX); + CSR_WRITE_1(sc, XL_W3_MAC_CTRL, + (CSR_READ_1(sc, XL_W3_MAC_CTRL) | XL_MACCTRL_DUPLEX)); else CSR_WRITE_1(sc, XL_W3_MAC_CTRL, (CSR_READ_1(sc, XL_W3_MAC_CTRL) & ~XL_MACCTRL_DUPLEX)); @@ -993,7 +994,8 @@ static void xl_setmode(sc, media) IFM_SUBTYPE(media) == IFM_100_FX) { printf("full duplex\n"); XL_SEL_WIN(3); - CSR_WRITE_1(sc, XL_W3_MAC_CTRL, XL_MACCTRL_DUPLEX); + CSR_WRITE_1(sc, XL_W3_MAC_CTRL, + (CSR_READ_1(sc, XL_W3_MAC_CTRL) | XL_MACCTRL_DUPLEX)); } else { printf("half duplex\n"); XL_SEL_WIN(3); @@ -2651,6 +2653,16 @@ static void xl_init(xsc) else CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_COAX_STOP); + /* + * Allow reception of large packets to make + * people who use 802.1q VLANs happy. + */ + CSR_WRITE_1(sc, XL_W3_MAC_CTRL, + (CSR_READ_1(sc, XL_W3_MAC_CTRL) | XL_MACCTRL_LARGE_PACK)); + + /* increase packet size to allow reception of 802.1q or ISL packets */ + if (sc->xl_type == XL_TYPE_905B) + CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE, XL_PACKET_SIZE); /* Clear out the stats counters. */ CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_DISABLE); sc->xl_stats_no_timeout = 1; |