NetBSD Problem Report #44072

From www@NetBSD.org  Tue Nov  9 15:03:22 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id A8FDD63BA61
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  9 Nov 2010 15:03:22 +0000 (UTC)
Message-Id: <20101109150322.45CFC63BA50@www.NetBSD.org>
Date: Tue,  9 Nov 2010 15:03:22 +0000 (UTC)
From: jym@baaz.fr
Reply-To: jym@baaz.fr
To: gnats-bugs@NetBSD.org
Subject: misread of ethernet addresses on intel quadport gigabit (82576)
X-Send-Pr-Version: www-1.0

>Number:         44072
>Category:       kern
>Synopsis:       misread of ethernet addresses on intel quadport gigabit (82576)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    msaitoh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 09 15:05:00 +0000 2010
>Closed-Date:    Wed Jan 26 00:52:56 +0000 2011
>Last-Modified:  Wed Jun 19 07:55:00 +0000 2013
>Originator:     Jean-Yves Moulin
>Release:        NetBSD-5.99.39
>Organization:
Eileo
>Environment:
NetBSD republique.eileo-local.org 5.99.39 NetBSD 5.99.39 (REPU) #3: Thu Nov  4 17:44:55 CET 2010  jym@republique.eileo-local.org:/usr/obj/sys/arch/amd64/compile/REPU amd64

>Description:
Hardware is: Dell poweredge R210 with intel quad-port gigabit (i82576 pci-e) bought from Dell.

The i82576 is recognized correctly but only two ports are working: wm0 and wm2. Ethernet addresses are correctly read for these two ports.

wm1 and wm3 are not working because of ethernet address set to 'ff:ff:ff:ff:ff:ff' (broadcast).

Everything else is working (ifconfig, media negotiation...etc), 

The problem come from packets on wm1 and wm3: they are sent with this bogus ethernet address.


>How-To-Repeat:
Boot NetBSD with intel quad-port gigabit i82576. Try to use port 1 or 3 (wm1 or wm3).
>Fix:
Force the driver to increment address read from previous port (same eeprom). This is already done for some card. And this is done by FreeBSD driver too.

FreeBSD driver explain this (for 82575/82576):
 *  Reads the device MAC address from the EEPROM and stores the value.
 *  Since devices with two ports use the same EEPROM, we increment the
 *  last bit in the MAC address for the second port.


On NetBSD, in /usr/src/sys/dev/pci/if_wm.c: the alternate mac address offset is stored in EEPROM_ALT_MAC_ADDR_PTR. Driver read at (offset + sc->sc_funcid).

But the offset in EEPROM_ALT_MAC_ADDR_PTR in this card seems to be bad. It shows 0x3d0 on my card. And there is no Ethernet address in (offset + sc->sc_funcid). Nor in offset.

Using the following patch solve the problem. But it's based on my card offset data.


-- /usr/src/sys/dev/pci/if_wm.c.1.215    2010-11-09 15:41:31.000000000 +0100
+++ /usr/src/sys/dev/pci/if_wm.c        2010-11-09 15:47:30.000000000 +0100
@@ -4755,6 +4755,13 @@
                                do_invert = 1;
                                goto do_read;
                        }
+                       /* 82576 show offset but there is no data */
+                       if(sc->sc_type == WM_T_82576 && offset == 0x3d0) {
+                               /* reset the offset to LAN0 */
+                               offset = EEPROM_OFF_MACADDR;
+                               do_invert = 1;
+                               goto do_read;
+                       }

                        switch (sc->sc_funcid) {
                        case 1:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->msaitoh
Responsible-Changed-By: msaitoh@NetBSD.org
Responsible-Changed-When: Tue, 25 Jan 2011 07:34:54 +0000
Responsible-Changed-Why:
mine.


From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44072 CVS commit: src/sys/dev/pci
Date: Wed, 26 Jan 2011 00:25:34 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Wed Jan 26 00:25:34 UTC 2011

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

 Log Message:
 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.

 Remove extra Warning for newer cards.


 To generate a diff of this commit:
 cvs rdiff -u -r1.217 -r1.218 src/sys/dev/pci/if_wm.c

 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, 26 Jan 2011 00:52:56 +0000
State-Changed-Why:
Fixed in -current. Thanks.


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44072 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.