Module Name:    src
Committed By:   snj
Date:           Thu Mar 26 17:36:03 UTC 2009

Modified Files:
        src/sys/dev/ic [netbsd-5]: rtl8169.c rtl81x9reg.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #597):
        sys/dev/ic/rtl8169.c: revision 1.106
        sys/dev/ic/rtl81x9reg.h: revision 1.33
Add support for a 8168C/8111C revision
 - also disable jumbo frame on this adapter following the FreeBSD driver
 - merge redundant call to aprint_error_dev


To generate a diff of this commit:
cvs rdiff -u -r1.105.4.1 -r1.105.4.2 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/dev/ic/rtl81x9reg.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.1 src/sys/dev/ic/rtl8169.c:1.105.4.2
--- src/sys/dev/ic/rtl8169.c:1.105.4.1	Tue Mar 24 20:38:38 2009
+++ src/sys/dev/ic/rtl8169.c	Thu Mar 26 17:36:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.105.4.1 2009/03/24 20:38:38 snj Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.105.4.2 2009/03/26 17:36:03 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.1 2009/03/24 20:38:38 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.105.4.2 2009/03/26 17:36:03 snj Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -523,22 +523,17 @@
 	if (memcmp((char *)&eh->ether_dhost, (char *)&dst, ETHER_ADDR_LEN) ||
 	    memcmp((char *)&eh->ether_shost, (char *)&src, ETHER_ADDR_LEN) ||
 	    ntohs(eh->ether_type) != ETHERTYPE_IP) {
-		aprint_error_dev(sc->sc_dev, "WARNING, DMA FAILURE!\n");
-		aprint_error_dev(sc->sc_dev, "expected TX data: %s",
-		    ether_sprintf(dst));
-		aprint_error("/%s/0x%x\n", ether_sprintf(src), ETHERTYPE_IP);
-		aprint_error_dev(sc->sc_dev, "received RX data: %s",
-		    ether_sprintf(eh->ether_dhost));
-		aprint_error("/%s/0x%x\n", ether_sprintf(eh->ether_shost),
-		    ntohs(eh->ether_type));
-		aprint_error_dev(sc->sc_dev,
+		aprint_error_dev(sc->sc_dev, "WARNING, DMA FAILURE!\n"
+		    "expected TX data: %s/%s/0x%x\n"
+		    "received RX data: %s/%s/0x%x\n"
 		    "You may have a defective 32-bit NIC plugged "
-		    "into a 64-bit PCI slot.\n");
-		aprint_error_dev(sc->sc_dev,
+		    "into a 64-bit PCI slot.\n"
 		    "Please re-install the NIC in a 32-bit slot "
-		    "for proper operation.\n");
-		aprint_error_dev(sc->sc_dev,
-		    "Read the re(4) man page for more details.\n");
+		    "for proper operation.\n"
+		    "Read the re(4) man page for more details.\n" ,
+		    ether_sprintf(dst),  ether_sprintf(src), ETHERTYPE_IP,
+		    ether_sprintf(eh->ether_dhost),
+		    ether_sprintf(eh->ether_shost), ntohs(eh->ether_type));
 		error = EIO;
 	}
 
@@ -605,6 +600,7 @@
 			sc->sc_rev = 23;
 			break;
 		case RTK_HWREV_8168C:
+		case RTK_HWREV_8168C_SPIN2:
 			sc->sc_rev = 24;
 			break;
 		case RTK_HWREV_8102E:
@@ -1864,9 +1860,14 @@
 	case SIOCSIFMTU:
 		/*
 		 * According to FreeBSD, 8102E/8102EL use a different DMA
-		 * descriptor format. Disable jumbo frames for those parts.
+		 * descriptor format. 8168C/8111C requires touching additional
+		 * magic registers. Depending on MAC revisions some controllers
+		 * need to disable checksum offload.
+		 *
+		 * Disable jumbo frames for those parts.
 		 */
-		if (sc->sc_rev == 25 && ifr->ifr_mtu > ETHERMTU) {
+		if ((sc->sc_rev == 24 || sc->sc_rev == 25) &&
+		    ifr->ifr_mtu > ETHERMTU) {
 			error = EINVAL;
 			break;
 		}

Index: src/sys/dev/ic/rtl81x9reg.h
diff -u src/sys/dev/ic/rtl81x9reg.h:1.32 src/sys/dev/ic/rtl81x9reg.h:1.32.4.1
--- src/sys/dev/ic/rtl81x9reg.h:1.32	Sat Aug 23 14:27:45 2008
+++ src/sys/dev/ic/rtl81x9reg.h	Thu Mar 26 17:36:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl81x9reg.h,v 1.32 2008/08/23 14:27:45 tnn Exp $	*/
+/*	$NetBSD: rtl81x9reg.h,v 1.32.4.1 2009/03/26 17:36:03 snj Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998
@@ -166,6 +166,7 @@
 #define RTK_HWREV_8168_SPIN3	0x38400000
 #define RTK_HWREV_8100E_SPIN2	0x38800000
 #define RTK_HWREV_8168C		0x3C000000
+#define RTK_HWREV_8168C_SPIN2	0x3C400000
 #define RTK_HWREV_8139		0x60000000
 #define RTK_HWREV_8139A		0x70000000
 #define RTK_HWREV_8139AG	0x70800000

Reply via email to