Module Name: src
Committed By: snj
Date: Fri May 1 02:07:04 UTC 2009
Modified Files:
src/sys/dev/ic [netbsd-5]: rtl8169.c rtl81x9var.h
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #597):
sys/dev/ic/rtl8169.c: revision 1.110
sys/dev/ic/rtl81x9var.h: revision 1.44
Add and use a new quirk flag to disable JUMBO MTU,
rather than checking sc_rev values.
To generate a diff of this commit:
cvs rdiff -u -r1.105.4.3 -r1.105.4.4 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.41.12.2 -r1.41.12.3 src/sys/dev/ic/rtl81x9var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.105.4.3 src/sys/dev/ic/rtl8169.c:1.105.4.4
--- src/sys/dev/ic/rtl8169.c:1.105.4.3 Fri May 1 02:03:44 2009
+++ src/sys/dev/ic/rtl8169.c Fri May 1 02:07:04 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl8169.c,v 1.105.4.3 2009/05/01 02:03:44 snj Exp $ */
+/* $NetBSD: rtl8169.c,v 1.105.4.4 2009/05/01 02:07:04 snj Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.105.4.3 2009/05/01 02:03:44 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.105.4.4 2009/05/01 02:07:04 snj Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@@ -589,33 +589,52 @@
break;
case RTK_HWREV_8101E:
sc->sc_rev = 11;
+ sc->sc_quirk |= RTKQ_NOJUMBO;
break;
case RTK_HWREV_8168_SPIN1:
sc->sc_rev = 21;
sc->sc_quirk |= RTKQ_DESCV2;
+ /*
+ * From FreeBSD driver:
+ *
+ * These (8168/8111) controllers support jumbo frame
+ * but it seems that enabling it requires touching
+ * additional magic registers. Depending on MAC
+ * revisions some controllers need to disable
+ * checksum offload. So disable jumbo frame until
+ * I have better idea what it really requires to
+ * make it support.
+ * RTL8168C/CP : supports up to 6KB jumbo frame.
+ * RTL8111C/CP : supports up to 9KB jumbo frame.
+ */
+ sc->sc_quirk |= RTKQ_NOJUMBO;
break;
case RTK_HWREV_8168_SPIN2:
sc->sc_rev = 22;
sc->sc_quirk |= RTKQ_DESCV2;
+ sc->sc_quirk |= RTKQ_NOJUMBO; /* see above */
break;
case RTK_HWREV_8168_SPIN3:
sc->sc_rev = 23;
sc->sc_quirk |= RTKQ_DESCV2;
+ sc->sc_quirk |= RTKQ_NOJUMBO; /* see above */
break;
case RTK_HWREV_8168C:
case RTK_HWREV_8168C_SPIN2:
sc->sc_rev = 24;
sc->sc_quirk |= RTKQ_DESCV2;
+ sc->sc_quirk |= RTKQ_NOJUMBO; /* see above */
break;
case RTK_HWREV_8102E:
case RTK_HWREV_8102EL:
sc->sc_rev = 25;
- sc->sc_quirk |= RTKQ_DESCV2;
+ sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOJUMBO;
break;
case RTK_HWREV_8100E:
case RTK_HWREV_8100E_SPIN2:
/* XXX not in the Realtek driver */
sc->sc_rev = 0;
+ sc->sc_quirk |= RTKQ_NOJUMBO;
break;
default:
aprint_normal_dev(sc->sc_dev,
@@ -627,6 +646,8 @@
sc->re_rxlenmask = RE_RDESC_STAT_GFRAGLEN;
sc->re_ldata.re_tx_desc_cnt = RE_TX_DESC_CNT_8169;
} else {
+ sc->sc_quirk |= RTKQ_NOJUMBO;
+
/* Set RX length mask */
sc->re_rxlenmask = RE_RDESC_STAT_FRAGLEN;
sc->re_ldata.re_tx_desc_cnt = RE_TX_DESC_CNT_8139;
@@ -1892,13 +1913,9 @@
switch (command) {
case SIOCSIFMTU:
/*
- * According to FreeBSD, 8102E/8102EL use a different DMA
- * descriptor format. 8168C/8111C requires touching additional
- * magic registers.
- *
- * Disable jumbo frames for those parts.
+ * Disable jumbo frames if it's not supported.
*/
- if ((sc->sc_rev == 24 || sc->sc_rev == 25) &&
+ if ((sc->sc_quirk & RTKQ_NOJUMBO) != 0 &&
ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
break;
Index: src/sys/dev/ic/rtl81x9var.h
diff -u src/sys/dev/ic/rtl81x9var.h:1.41.12.2 src/sys/dev/ic/rtl81x9var.h:1.41.12.3
--- src/sys/dev/ic/rtl81x9var.h:1.41.12.2 Fri May 1 02:03:44 2009
+++ src/sys/dev/ic/rtl81x9var.h Fri May 1 02:07:04 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl81x9var.h,v 1.41.12.2 2009/05/01 02:03:44 snj Exp $ */
+/* $NetBSD: rtl81x9var.h,v 1.41.12.3 2009/05/01 02:07:04 snj Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -190,6 +190,7 @@
#define RTKQ_PCIE 0x00000008 /* PCIe variants */
#define RTKQ_MACLDPS 0x00000010 /* has LDPS register */
#define RTKQ_DESCV2 0x00000020 /* has V2 TX/RX descriptor */
+#define RTKQ_NOJUMBO 0x00000040 /* no jumbo MTU support */
bus_dma_tag_t sc_dmat;