Subject: Re: kern/34517 (re(4) drops all traffic in promiscuous mode)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 11/27/2006 09:35:02
The following reply was made to PR kern/34517; it has been noted by GNATS.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org, gson@gson.org, tsutsui@ceres.dti.ne.jp
Subject: Re: kern/34517 (re(4) drops all traffic in promiscuous mode)
Date: Mon, 27 Nov 2006 18:32:56 +0900

 gson@gson.org wrote:
 
 >  I tried a kernel built from yesterday's -current sources.  It now
 >  works better but still not well: packets are still dropped, but now
 >  only for the first few seconds after tcpdump is started.  After that,
 >  traffic starts flowing again.
 
 In re_init(), mii_mediachg() is called and it seems to take
 a few seconds till PHY is settled.
 (you could see it by link LEDs)
 
 I'm not sure if such mii_mediachg() is always required on
 initialization, but how about the attached patch?
 (values in rgephy.c are taken from Realtek's driver)
 ---
 Izumi Tsutsui
 
 
 Index: dev/ic/rtl8169.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ic/rtl8169.c,v
 retrieving revision 1.71
 diff -u -u -r1.71 rtl8169.c
 --- dev/ic/rtl8169.c	25 Nov 2006 02:42:18 -0000	1.71
 +++ dev/ic/rtl8169.c	27 Nov 2006 09:14:48 -0000
 @@ -1955,8 +1955,6 @@
  	if (sc->re_testmode)
  		return 0;
  
 -	mii_mediachg(&sc->mii);
 -
  	CSR_WRITE_1(sc, RTK_CFG1, RTK_CFG1_DRVLOAD | RTK_CFG1_FULLDUPLEX);
  
  	ifp->if_flags |= IFF_RUNNING;
 Index: dev/mii/rgephy.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/mii/rgephy.c,v
 retrieving revision 1.12
 diff -u -u -r1.12 rgephy.c
 --- dev/mii/rgephy.c	16 Nov 2006 21:24:07 -0000	1.12
 +++ dev/mii/rgephy.c	27 Nov 2006 09:14:48 -0000
 @@ -551,10 +551,8 @@
  	/* Reset capabilities */
  	/* Step1: write our capability */
  	PHY_WRITE(sc, 0x04,0x01e1); /* 10/100 capability */
 -	PHY_WRITE(sc, 0x09,0x0200); /* 1000 capability */
 +	PHY_WRITE(sc, 0x09,0x0300); /* 1000 capability */
  
 -#ifdef jrs_notyet
  	/* Step2: Restart NWay */
  	PHY_WRITE(sc, 0x00, 0x1200); // NWay enable and Restart NWay
 -#endif
  }