NetBSD Problem Report #47542

From msaitoh@execsw.org  Fri Feb  8 03:53:51 2013
Return-Path: <msaitoh@execsw.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 08B8F63EBEB
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  8 Feb 2013 03:53:51 +0000 (UTC)
Message-Id: <20130208035348.B8B2543985D@vslock.execsw.org>
Date: Fri,  8 Feb 2013 12:53:48 +0900 (JST)
From: msaitoh@execsw.org
Reply-To: msaitoh@execsw.org
To: gnats-bugs@gnats.NetBSD.org
Subject: PHY access method for 82580(I340) and I350 (wm(4)) is incorrect.
X-Send-Pr-Version: 3.95

>Number:         47542
>Category:       kern
>Synopsis:       PHY access method for 82580(I340) and I350 (wm(4)) is incorrect.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    msaitoh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 08 03:55:00 +0000 2013
>Closed-Date:    Wed Feb 20 05:16:00 +0000 2013
>Last-Modified:  Wed Jun 19 07:55:01 +0000 2013
>Originator:     SAITOH Masanobu
>Release:        NetBSD 6.0
>Organization:
>Environment:
6.0 and -current
Architecture: i386
Machine: i386
>Description:
	  PHY access method for 82580(I340) and I350 (wm(4)) is incorrect.
	 For those devices, read/write fuctions for i80003 are used now.
	 We MUST use 82580 specific read/write function.

	  Currently, wm on I350 is not stable. It sometimes stucks.
	 For TX side, the MAC layer send packets to MII layer and the
	 TX complete interrupts occur correctly, but PHY doesn't send
	 packets. For RX side, PHY don't catch packets.

	  I can't see this problem on I340. I suspect that it has
	 a bug and the frequency is lower than I350.

	  I obserbed that some MII registers were changing incorrectly.
>How-To-Repeat:
	Use I350 in 6.0 or -current. And wait for 5 or 10 minutes.
>Fix:
	I made a patch. I'll commit it in near future.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->msaitoh
Responsible-Changed-By: msaitoh@NetBSD.org
Responsible-Changed-When: Fri, 08 Feb 2013 04:06:04 +0000
Responsible-Changed-Why:
mine.


From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/47542: PHY access method for 82580(I340) and I350 (wm(4))
 is incorrect.
Date: Fri, 8 Feb 2013 09:52:11 +0100

 On Fri, Feb 08, 2013 at 03:55:01AM +0000, msaitoh@execsw.org wrote:
 > 	  PHY access method for 82580(I340) and I350 (wm(4)) is incorrect.
 > 	 For those devices, read/write fuctions for i80003 are used now.
 > 	 We MUST use 82580 specific read/write function.
 > 
 > 	  Currently, wm on I350 is not stable. It sometimes stucks.
 > 	 For TX side, the MAC layer send packets to MII layer and the
 > 	 TX complete interrupts occur correctly, but PHY don't send
 > 	 packets. For RX side, PHY don't catch packets.

 Hum,
 I have a system with:
 wm0 at pci7 dev 0 function 0: I350 Gigabit Network Connection (rev. 0x01)
 wm0: interrupting at ioapic0 pin 16
 wm0: PCI-Express bus
 wm0: 65536 word (16 address bits) SPI EEPROM
 wm0: Ethernet address 00:25:90:2d:e2:34
 ukphy0 at wm0 phy 1: OUI 0x00aa00, model 0x003b, rev. 1
 wm1 at pci7 dev 0 function 1: I350 Gigabit Network Connection (rev. 0x01)
 wm1: interrupting at ioapic0 pin 17
 wm1: PCI-Express bus
 wm1: 256 word (8 address bits) SPI EEPROM
 wm1: Ethernet address 00:25:90:2d:e2:35
 ukphy1 at wm1 phy 1: OUI 0x00aa00, model 0x003b, rev. 1
 wm2 at pci7 dev 0 function 2: I350 Gigabit Network Connection (rev. 0x01)
 wm2: interrupting at ioapic0 pin 18
 wm2: PCI-Express bus
 wm2: 256 word (8 address bits) SPI EEPROM
 wm2: Ethernet address 00:25:90:2d:e2:36
 ukphy2 at wm2 phy 1: OUI 0x00aa00, model 0x003b, rev. 1
 wm3 at pci7 dev 0 function 3: I350 Gigabit Network Connection (rev. 0x01)
 wm3: interrupting at ioapic0 pin 19
 wm3: PCI-Express bus
 wm3: 256 word (8 address bits) SPI EEPROM
 wm3: Ethernet address 00:25:90:2d:e2:37

 All 4 interfaces used in an agr(4). This is a file server, and I didn't
 notice any networking issue ...

 -- 
 Manuel Bouyer <bouyer@antioche.eu.org>
      NetBSD: 26 ans d'experience feront toujours la difference
 --

From: Masanobu SAITOH <msaitoh@execsw.org>
To: gnats-bugs@NetBSD.org
Cc: Manuel Bouyer <bouyer@antioche.eu.org>, msaitoh@NetBSD.org, 
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, msaitoh@execsw.org
Subject: Re: kern/47542: PHY access method for 82580(I340) and I350 (wm(4))
 is incorrect.
Date: Fri, 08 Feb 2013 19:49:39 +0900

 >   All 4 interfaces used in an agr(4). This is a file server, and I didn't
 >   notice any networking issue ...
 >   
 >   --
 >   Manuel Bouyer <bouyer@antioche.eu.org>
 >        NetBSD: 26 ans d'experience feront toujours la difference
 >   --

  You're lucky :-)

 The smallest patch:

 Index: if_wm.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
 retrieving revision 1.242
 diff -u -r1.242 if_wm.c
 --- if_wm.c	7 Feb 2013 15:38:42 -0000	1.242
 +++ if_wm.c	8 Feb 2013 10:46:41 -0000
 @@ -543,6 +543,8 @@
  static void	wm_gmii_bm_writereg(device_t, int, int, int);
  static int	wm_gmii_hv_readreg(device_t, int, int);
  static void	wm_gmii_hv_writereg(device_t, int, int, int);
 +static int	wm_gmii_82580_readreg(device_t, int, int);
 +static void	wm_gmii_82580_writereg(device_t, int, int, int);
  static int	wm_sgmii_readreg(device_t, int, int);
  static void	wm_sgmii_writereg(device_t, int, int, int);

 @@ -6315,6 +6317,10 @@
  		} else if (sc->sc_type >= WM_T_80003) {
  			sc->sc_mii.mii_readreg = wm_gmii_i80003_readreg;
  			sc->sc_mii.mii_writereg = wm_gmii_i80003_writereg;
 +		} else if (sc->sc_type >= WM_T_82580) {
 +			sc->sc_phytype = WMPHY_82580;
 +			sc->sc_mii.mii_readreg = wm_gmii_82580_readreg;
 +			sc->sc_mii.mii_writereg = wm_gmii_82580_writereg;
  		} else if (sc->sc_type >= WM_T_82544) {
  			sc->sc_mii.mii_readreg = wm_gmii_i82544_readreg;
  			sc->sc_mii.mii_writereg = wm_gmii_i82544_writereg;
 @@ -7018,6 +7024,58 @@
  }

  /*
 + * wm_gmii_82580_readreg:	[mii interface function]
 + *
 + *	Read a PHY register on the 82580 and I350.
 + * This could be handled by the PHY layer if we didn't have to lock the
 + * ressource ...
 + */
 +static int
 +wm_gmii_82580_readreg(device_t self, int phy, int reg)
 +{
 +	struct wm_softc *sc = device_private(self);
 +	int sem;
 +	int rv;
 +
 +	sem = swfwphysem[sc->sc_funcid];
 +	if (wm_get_swfw_semaphore(sc, sem)) {
 +		aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
 +		    __func__);
 +		return 0;
 +	}
 +
 +	rv = wm_gmii_i82544_readreg(self, phy, reg);
 +
 +	wm_put_swfw_semaphore(sc, sem);
 +	return rv;
 +}
 +
 +/*
 + * wm_gmii_82580_writereg:	[mii interface function]
 + *
 + *	Write a PHY register on the 82580 and I350.
 + * This could be handled by the PHY layer if we didn't have to lock the
 + * ressource ...
 + */
 +static void
 +wm_gmii_82580_writereg(device_t self, int phy, int reg, int val)
 +{
 +	struct wm_softc *sc = device_private(self);
 +	int sem;
 +
 +	sem = swfwphysem[sc->sc_funcid];
 +	if (wm_get_swfw_semaphore(sc, sem)) {
 +		aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
 +		    __func__);
 +		return;
 +	}
 +
 +	wm_gmii_i82544_writereg(self, phy, reg, val);
 +
 +	wm_put_swfw_semaphore(sc, sem);
 +}
 +
 +/*
   * wm_gmii_statchg:	[mii interface function]
   *
   *	Callback from MII layer when media changes.
 Index: if_wmvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/pci/if_wmvar.h,v
 retrieving revision 1.13
 diff -u -r1.13 if_wmvar.h
 --- if_wmvar.h	25 May 2012 23:37:38 -0000	1.13
 +++ if_wmvar.h	8 Feb 2013 10:46:41 -0000
 @@ -140,7 +140,8 @@
  	WMPHY_BM,
  	WMPHY_82577,
  	WMPHY_82578,
 -	WMPHY_82579
 +	WMPHY_82579,
 +	WMPHY_82580
  } wm_phy_type;




 -- 
 -----------------------------------------------
                 SAITOH Masanobu (msaitoh@execsw.org
                                  msaitoh@netbsd.org)

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47542 CVS commit: src/sys/dev/pci
Date: Tue, 12 Feb 2013 03:11:43 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Tue Feb 12 03:11:43 UTC 2013

 Modified Files:
 	src/sys/dev/pci: if_wm.c if_wmvar.h

 Log Message:
 Use 82580(and I350) specific PHY read/write functions.
 Fixes PR#47542.


 To generate a diff of this commit:
 cvs rdiff -u -r1.242 -r1.243 src/sys/dev/pci/if_wm.c
 cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_wmvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Julian Coleman" <jdc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47542 CVS commit: [netbsd-6] src/sys/dev/pci
Date: Thu, 14 Feb 2013 22:08:28 +0000

 Module Name:	src
 Committed By:	jdc
 Date:		Thu Feb 14 22:08:28 UTC 2013

 Modified Files:
 	src/sys/dev/pci [netbsd-6]: if_wm.c if_wmvar.h

 Log Message:
 Pull up revisions:
   src/sys/dev/pci/if_wm.c revision 1.243
   src/sys/dev/pci/if_wmvar.h revision 1.14
 (requested by msaitoh in ticket #820).

 Use 82580(and I350) specific PHY read/write functions.
 Fixes PR#47542.


 To generate a diff of this commit:
 cvs rdiff -u -r1.227.2.5 -r1.227.2.6 src/sys/dev/pci/if_wm.c
 cvs rdiff -u -r1.12.10.1 -r1.12.10.2 src/sys/dev/pci/if_wmvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Wed, 20 Feb 2013 05:16:00 +0000
State-Changed-Why:
Fixed both -current and netbsd-6.


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47542 CVS commit: [netbsd-5] src
Date: Wed, 19 Jun 2013 07:50:15 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Wed Jun 19 07:50:15 UTC 2013

 Modified Files:
 	src/share/man/man4 [netbsd-5]: wm.4
 	src/sys/arch/amd64/conf [netbsd-5]: GENERIC XEN3_DOM0
 	src/sys/arch/i386/conf [netbsd-5]: ALL GENERIC INSTALL_FLOPPY XEN2_DOM0
 	src/sys/dev/mii [netbsd-5]: files.mii igphyreg.h inbmphyreg.h miidevs
 	src/sys/dev/pci [netbsd-5]: if_wm.c if_wmreg.h if_wmvar.h pcidevs
 Added Files:
 	src/sys/dev/mii [netbsd-5]: ihphy.c ihphyreg.h

 Log Message:
 Pullup the following revisions via patch, requested by msaitoh in ticket #1850:
 	sys/dev/pci/if_wm.c			1.201, 1.203-1.204,
 						1.207-1.212, 1.215,
 						1.217-1.218, 1.220-1.223,
 						1.228, 1.232-245
 	sys/dev/pci/if_wmreg.h			1.40-1.45, 1.47-1.48
 	sys/dev/pci/if_wmvar.h			1.11-1.13
 	sys/dev/pci/pcidevs			1.1074, 1.1077, 1.1117
 	sys/dev/pci/pcidevs.h			regen
 	sys/dev/pci/pcidevs_data.h		regen
 	sys/dev/mii/igphyreg.h			1.6
 	sys/dev/mii/ihphy.c			1.1-1.2
 	sys/dev/mii/ihphyreg.h			1.1
 	sys/dev/mii/inbmphyreg.h		1.3
 	sys/dev/mii/files.mii			1.47 via patch
 	sys/dev/mii/miidevs			1.97 and 1.100
 	sys/dev/mii/miidevs.h			regen
 	sys/dev/mii/miidevs_data.h		regen
 	sys/arch/i386/conf/ALL			1.280
 	sys/arch/i386/conf/GENERIC		1.1001
 	sys/arch/i386/conf/INSTALL_FLOPPY	1.11
 	sys/arch/i386/conf/XEN2_DOM0		patch
 	sys/arch/amd64/conf/GENERIC		1.293
 	sys/arch/amd64/conf/XEN3_DOM0		1.61
 	share/man/man4/wm.4			1.21-1.24

 Apply almost all fixes and improvements from netbsd-6 except for
 the rev. 1.196's iqdrops' change.

 - Add the detach code.
 - Add code for WOL, ASF, IPMI and Intel AMT. WOL is disabled by default
 - Add Yet another workaround for ICH8.
 - 82576 is dual port, so check the FUNCID and increment the MAC address for
   the 2nd port.
 - Fix the names of 82577L[MC] LAN controllers (for mobile).
 - Fix CTRL_EXT_SWDPIN() and CTRL_EXT_SWDPIO() macros. The bit order of the
   SW definable pin is not 6543 but 3654!!!
 - Rewrite the code to read MAC address from eeprom.
 - Add 82580 support.
 - 82571 quirk. Only 82571 shares port 0 of EEMNGCTL_CFGDONE.
 - The document says that the TDH register must be set after
   TCL.EN is set on 82575 and newer devices.
 - Fix some register names. No functional change.
 - Omit U+00AE "REGISTERED SIGN" in a product name due to its non-ASCII nature.
 - Stop wm(4) from needlessly resetting when you add or delete a vlan(4).
 - Fix MAC address check on 8257[156] and 80003 case. Some cards have non 0xffff
   pointer but those don't use alternative MAC address in reality. So we check
   whether the broadcast bit is set or not like Intel's e1000 driver.
   Fixes PR kern/44072 reported by Jean-Yves Moulin.
 - Add PCH2(and 82579) support. Fixes PR#46487
 - Add yet another 82567V support.
 - Add ICH10+HANKSVILL support.
 - Add support Intel I350 Ethernet.
 - Make vlan and all ip/ip6 checksum offload work for the I350.
 - Fix compile error with  WM_DEBUG.
 - Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.
 - Add WM_DEBUG_NVM. If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
 - Skip 64bit BAR correctly.
 - Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
 - Use 82580(and I350) specific PHY read/write functions. Fixes PR#47542.
 - Style fix. Fix typo in comment. Fix comments. Add comments.


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.19.12.1 src/share/man/man4/wm.4
 cvs rdiff -u -r1.231.4.10 -r1.231.4.11 src/sys/arch/amd64/conf/GENERIC
 cvs rdiff -u -r1.33.4.6 -r1.33.4.7 src/sys/arch/amd64/conf/XEN3_DOM0
 cvs rdiff -u -r1.183.4.9 -r1.183.4.10 src/sys/arch/i386/conf/ALL
 cvs rdiff -u -r1.915.2.13 -r1.915.2.14 src/sys/arch/i386/conf/GENERIC
 cvs rdiff -u -r1.1.16.3 -r1.1.16.4 src/sys/arch/i386/conf/INSTALL_FLOPPY
 cvs rdiff -u -r1.53.2.6 -r1.53.2.7 src/sys/arch/i386/conf/XEN2_DOM0
 cvs rdiff -u -r1.41.20.1 -r1.41.20.2 src/sys/dev/mii/files.mii
 cvs rdiff -u -r1.4.86.1 -r1.4.86.2 src/sys/dev/mii/igphyreg.h
 cvs rdiff -u -r0 -r1.6.2.2 src/sys/dev/mii/ihphy.c
 cvs rdiff -u -r0 -r1.1.32.2 src/sys/dev/mii/ihphyreg.h
 cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/dev/mii/inbmphyreg.h
 cvs rdiff -u -r1.78.4.4 -r1.78.4.5 src/sys/dev/mii/miidevs
 cvs rdiff -u -r1.162.4.17 -r1.162.4.18 src/sys/dev/pci/if_wm.c
 cvs rdiff -u -r1.24.20.6 -r1.24.20.7 src/sys/dev/pci/if_wmreg.h
 cvs rdiff -u -r1.2.46.4 -r1.2.46.5 src/sys/dev/pci/if_wmvar.h
 cvs rdiff -u -r1.962.4.17 -r1.962.4.18 src/sys/dev/pci/pcidevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.