Module Name:    src
Committed By:   jdc
Date:           Sun May 22 11:19:23 UTC 2011

Modified Files:
        src/sys/dev/ic: gem.c

Log Message:
Fix corrupted packet problem on 100Mb/s half duplex links.
We need to set "echo disable" on the internal phy too, not just on the
external phy.
Tested on:
  SUNW,Sun-Blade-2000
  gem0 at pci0 dev 5 function 1: Sun Microsystems ERI Ethernet (rev. 0x01)
  ukphy0 at gem0 phy 1: OUI 0x0006b8, model 0x000c, rev. 1

Setting pointed out by bad@.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/ic/gem.c

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/gem.c
diff -u src/sys/dev/ic/gem.c:1.96 src/sys/dev/ic/gem.c:1.97
--- src/sys/dev/ic/gem.c:1.96	Sat Nov 13 13:52:01 2010
+++ src/sys/dev/ic/gem.c	Sun May 22 11:19:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.96 2010/11/13 13:52:01 uebayasi Exp $ */
+/*	$NetBSD: gem.c,v 1.97 2011/05/22 11:19:23 jdc Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.96 2010/11/13 13:52:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.97 2011/05/22 11:19:23 jdc Exp $");
 
 #include "opt_inet.h"
 
@@ -2443,14 +2443,6 @@
 	sc->sc_mif_config = bus_space_read_4(t, mac, GEM_MIF_CONFIG);
 	if ((sc->sc_flags &(GEM_SERDES | GEM_SERIAL)) == 0) {
 		if ((sc->sc_mif_config & GEM_MIF_CONFIG_MDI1) != 0) {
-			/* External MII needs echo disable if half duplex. */
-			if ((IFM_OPTIONS(sc->sc_mii.mii_media_active) &
-			    IFM_FDX) != 0)
-				/* turn on full duplex LED */
-				v |= GEM_MAC_XIF_FDPLX_LED;
-			else
-				/* half duplex -- disable echo */
-				v |= GEM_MAC_XIF_ECHO_DISABL;
 			if (gigabit)
 				v |= GEM_MAC_XIF_GMII_MODE;
 			else
@@ -2458,6 +2450,13 @@
 		} else
 			/* Internal MII needs buf enable */
 			v |= GEM_MAC_XIF_MII_BUF_ENA;
+		/* MII needs echo disable if half duplex. */
+		if ((IFM_OPTIONS(sc->sc_mii.mii_media_active) & IFM_FDX) != 0)
+			/* turn on full duplex LED */
+			v |= GEM_MAC_XIF_FDPLX_LED;
+		else
+			/* half duplex -- disable echo */
+			v |= GEM_MAC_XIF_ECHO_DISABL;
 	} else {
 		if ((IFM_OPTIONS(sc->sc_mii.mii_media_active) & IFM_FDX) != 0)
 			v |= GEM_MAC_XIF_FDPLX_LED;

Reply via email to