aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2001-05-31 22:08:45 +0000
committerBill Paul <wpaul@FreeBSD.org>2001-05-31 22:08:45 +0000
commit7d1b125b9321e4e5f001c69c9559d290350fe472 (patch)
tree890b0e799dc2b9cf9281c7d8e1a965861869f2d4 /sys
parentcf7e5998d72b5fe01c47667f4f94b873123658ff (diff)
downloadsrc-7d1b125b9321e4e5f001c69c9559d290350fe472.tar.gz
src-7d1b125b9321e4e5f001c69c9559d290350fe472.zip
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
Notes
Notes: svn path=/head/; revision=77548
Diffstat (limited to 'sys')
-rw-r--r--sys/pci/if_xl.c16
-rw-r--r--sys/pci/if_xlreg.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index ff990ec9f9d6..8cb2ef5107a3 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;
diff --git a/sys/pci/if_xlreg.h b/sys/pci/if_xlreg.h
index cd7554db9107..bd4ca77d4abc 100644
--- a/sys/pci/if_xlreg.h
+++ b/sys/pci/if_xlreg.h
@@ -81,7 +81,7 @@
#define XL_CAPS_100MBPS 0x1000
#define XL_CAPS_PWRMGMT 0x2000
-#define XL_PACKET_SIZE 1536
+#define XL_PACKET_SIZE 1540
/*
* Register layouts.
@@ -256,6 +256,7 @@
* Window 3 (fifo management)
*/
#define XL_W3_INTERNAL_CFG 0x00
+#define XL_W3_MAXPKTSIZE 0x04 /* 3c905B only */
#define XL_W3_RESET_OPT 0x08
#define XL_W3_FREE_TX 0x0C
#define XL_W3_FREE_RX 0x0A