From jin@ncs.lbl.gov  Tue Feb 24 10:45:52 2004
Return-Path: <jin@ncs.lbl.gov>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CC31316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Feb 2004 10:45:52 -0800 (PST)
Received: from ncs.lbl.gov (ncs.lbl.gov [131.243.2.30])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BCE1043D1D
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Feb 2004 10:45:52 -0800 (PST)
	(envelope-from jin@ncs.lbl.gov)
Received: from ncs.lbl.gov (localhost [127.0.0.1])
	by ncs.lbl.gov (8.12.10/8.12.10) with ESMTP id i1OIjrp2003177
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Feb 2004 10:45:53 -0800 (PST)
	(envelope-from jin@ncs.lbl.gov)
Received: (from jin@localhost)
	by ncs.lbl.gov (8.12.10/8.12.10/Submit) id i1OIjqLM003176;
	Tue, 24 Feb 2004 10:45:53 -0800 (PST)
	(envelope-from jin)
Message-Id: <200402241845.i1OIjqLM003176@ncs.lbl.gov>
Date: Tue, 24 Feb 2004 10:45:53 -0800 (PST)
From: Jin Guojun (DSD staff) <jin@ncs.lbl.gov>
Reply-To: j_guojun@lbl.gov
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sk driver panics on boot with SK-9844 dual port NIC (V1.0 fiber)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         63313
>Category:       i386
>Synopsis:       sk driver panics on boot with SK-9844 dual port NIC (V1.0 fiber)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 24 10:50:16 PST 2004
>Closed-Date:    Fri Nov 26 19:46:59 GMT 2004
>Last-Modified:  Thu Mar 24 02:50:06 GMT 2005
>Originator:     Jin Guojun (DSD staff)
>Release:        FreeBSD 5.2.1-RC2 i386
>Organization:
>Environment:
System: FreeBSD 5.2.1-RC2 #3: Mon Feb 23 16:33:41 PST 2004 root@netlion.lbl.gov:/usr/src/sys/i386/compile/MinMax i386


	FreeBSD 5.2-R and 5.2.1-RC2
	SuperMirco (E7500) + Xeon 2.0 MHz and other Intel PIII / P4
	+ SK 9844 dual port fiber (V1.0) NIC
	(very possible having trouble with 9843 v1.0 but have not tested yet)
>Description:
	Installation CD will not able to boot due to ealier stage panic.
	Installing from floppies is Ok, but will not be able to boot
	after installation due to the same problem.
	Remove SK NIC from system, installation will succeed; but it is
	impossible to put SK NIC back into the system because it will
	cause boot panic.
	Panic message was like
		"SKC: PHY not present ..."

	If looks like that new SK driver works with SK v2.0 NICs (copper),
	but not the older GigE NICs (v 1.0).

>How-To-Repeat:
	Start with above configuration at Environment section.
	Try boot from a 5.2-X CD.
>Fix:

	It is hard to provide trace message since it panics in the ealier
	boot stage. It does not create coredump. The developer may know
	what is the problem.
	If we want to keep older SK NIC to work, this needs to be fixed
	and tested in the SK driver.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->bz-i386 
Responsible-Changed-By: bz 
Responsible-Changed-When: Tue Nov 23 09:50:24 GMT 2004 
Responsible-Changed-Why:  
I'll handle this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63313 
Responsible-Changed-From-To: bz-i386->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Tue Nov 23 10:03:58 GMT 2004 
Responsible-Changed-Why:  
editor's error 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63313 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: Jin Guojun <j_guojun@lbl.gov>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: i386/63313: sk driver panics on boot with SK-9844 dual port NIC
 (V1.0 fiber)
Date: Tue, 23 Nov 2004 10:29:40 +0000 (UTC)

 Could you please test if you still get a panic when booting 5.3?
 The PHY will not be detected but it shouldn't panic. If we get
 there I'll have a patch for you.

From: "Jin Guojun [VFFS]" <jin@george.lbl.gov>
To: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: i386/63313: sk driver panics on boot with SK-9844 dual port NIC
 (V1.0 fiber)
Date: Wed, 24 Nov 2004 10:18:49 -0800

 Bjoern A. Zeeb wrote:
 
 >Could you please test if you still get a panic when booting 5.3?
 >The PHY will not be detected but it shouldn't panic. If we get
 >there I'll have a patch for you.
 >  
 >
 There is no more panic under 5.3, and sk driver says: "no PHY detected".
 
 Will the patch for old SK adapter be merged into future release ?
 
 -- 
 ------------ Jin Guojun ----------- v --- jin@george.lbl.gov ---
 Distributed Systems Department		http://www.dsd.lbl.gov/~jin
 Lawrence Berkeley National Laboratory,	Berkeley, CA 94720
 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: "Jin Guojun [VFFS]" <jin@george.lbl.gov>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: i386/63313: sk driver panics on boot with SK-9844 dual port NIC
 (V1.0 fiber)
Date: Wed, 24 Nov 2004 18:54:03 +0000 (UTC)

 On Wed, 24 Nov 2004, Jin Guojun [VFFS] wrote:
 
 > There is no more panic under 5.3, and sk driver says: "no PHY detected".
 >
 > Will the patch for old SK adapter be merged into future release ?
 
 Yes, after some testing.
 
 Could you please try the patch further down to src/sys/dev/mii/mii.c ?
 With this the PHY should be detected again.
 
 
 For sk(4) to work correctly you will also need if_sk.c and
 if_skreg.h from HEAD.
 
 If you are running RELENG_5/5.3R you may get them
 with for example the following commands and then copy them over
 the files in your local tree in src/sys/pci/.
 If you are running with an up-to-date HEAD you will only need
 the patch for mii.c.
 
 fetch -o if_sk.c-1.92 \
 'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/pci/if_sk.c?rev=1.92&content-type=text/plain'
 fetch -o if_skreg.h-1.24 \
 'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/pci/if_skreg.h?rev=1.24&content-type=text/plain'
 
 
 Index: mii.c
 ===================================================================
 RCS file: /local/mirror/FreeBSD/r/ncvs/src/sys/dev/mii/mii.c,v
 retrieving revision 1.20
 diff -u -p -r1.20 mii.c
 --- mii.c	15 Aug 2004 06:24:40 -0000	1.20
 +++ mii.c	23 Nov 2004 08:46:30 -0000
 @@ -125,7 +125,7 @@ miibus_probe(dev)
  	 	 */
  		bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
  		if (bmsr == 0 || bmsr == 0xffff ||
 -		    (bmsr & BMSR_MEDIAMASK) == 0) {
 +		    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
  			/* Assume no PHY at this address. */
  			continue;
  		}
 @@ -316,7 +316,7 @@ mii_phy_probe(dev, child, ifmedia_upd, i
  	for (i = 0; i < MII_NPHY; i++) {
  		bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
                  if (bmsr == 0 || bmsr == 0xffff ||
 -                    (bmsr & BMSR_MEDIAMASK) == 0) {
 +                    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
                          /* Assume no PHY at this address. */
                          continue;
                  } else
 

From: "Jin Guojun [VFFS]" <jin@george.lbl.gov>
To: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: i386/63313: sk driver panics on boot with SK-9844 dual port NIC
 (V1.0 fiber)
Date: Wed, 24 Nov 2004 15:52:01 -0800

 Just patched mii.c without new if_sk*, the old SK NIC works well.
 
 I also fetched if_sk.c-192 and if_skreg.h-1.24. I see changes and compiled
 a new kernel, but have not installed and tested new kernel yet.
 
 Shall I see some strange behavor by using if_sk code coming with 5.3-R
 on these old SK NICs? or is  the new if_sk code for resolving different 
 issue?
 
 Thanks,
 
     -Jin Guojun
 
 Bjoern A. Zeeb wrote:
 
 >On Wed, 24 Nov 2004, Jin Guojun [VFFS] wrote:
 >
 >  
 >
 >>There is no more panic under 5.3, and sk driver says: "no PHY detected".
 >>
 >>Will the patch for old SK adapter be merged into future release ?
 >>    
 >>
 >
 >Yes, after some testing.
 >
 >Could you please try the patch further down to src/sys/dev/mii/mii.c ?
 >With this the PHY should be detected again.
 >
 >
 >For sk(4) to work correctly you will also need if_sk.c and
 >if_skreg.h from HEAD.
 >
 >If you are running RELENG_5/5.3R you may get them
 >with for example the following commands and then copy them over
 >the files in your local tree in src/sys/pci/.
 >If you are running with an up-to-date HEAD you will only need
 >the patch for mii.c.
 >
 >fetch -o if_sk.c-1.92 \
 >'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/pci/if_sk.c?rev=1.92&content-type=text/plain'
 >fetch -o if_skreg.h-1.24 \
 >'http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sys/pci/if_skreg.h?rev=1.24&content-type=text/plain'
 >
 >
 >Index: mii.c
 >===================================================================
 >RCS file: /local/mirror/FreeBSD/r/ncvs/src/sys/dev/mii/mii.c,v
 >retrieving revision 1.20
 >diff -u -p -r1.20 mii.c
 >--- mii.c	15 Aug 2004 06:24:40 -0000	1.20
 >+++ mii.c	23 Nov 2004 08:46:30 -0000
 >@@ -125,7 +125,7 @@ miibus_probe(dev)
 > 	 	 */
 > 		bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
 > 		if (bmsr == 0 || bmsr == 0xffff ||
 >-		    (bmsr & BMSR_MEDIAMASK) == 0) {
 >+		    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
 > 			/* Assume no PHY at this address. */
 > 			continue;
 > 		}
 >@@ -316,7 +316,7 @@ mii_phy_probe(dev, child, ifmedia_upd, i
 > 	for (i = 0; i < MII_NPHY; i++) {
 > 		bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
 >                 if (bmsr == 0 || bmsr == 0xffff ||
 >-                    (bmsr & BMSR_MEDIAMASK) == 0) {
 >+                    (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
 >                         /* Assume no PHY at this address. */
 >                         continue;
 >                 } else
 >  
 >
 
State-Changed-From-To: open->feedback 
State-Changed-By: bz 
State-Changed-When: Thu Nov 25 06:37:44 GMT 2004 
State-Changed-Why:  
>  Just patched mii.c without new if_sk*, the old SK NIC works well. 

great. so the actual problem is solved and I my close the PR ? 

>  Shall I see some strange behavor by using if_sk code coming with 5.3-R 
>  on these old SK NICs? or is  the new if_sk code for resolving different 
>  issue? 

depending on usage you may see slow transfers or "hangs", watchdog 
timeouts or other "weird" behavior. 
See http://sources.zabbadoz.net/freebsd/if_sk.html for more information. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63313 
State-Changed-From-To: feedback->closed 
State-Changed-By: bz 
State-Changed-When: Fri Nov 26 19:45:37 GMT 2004 
State-Changed-Why:  
The patch got committed to HEAD. 
Many thanks for testing. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63313 

From: Craig Leres <leres@ee.lbl.gov>
To: freebsd-gnats-submit@FreeBSD.org
Cc: j_guojun@lbl.gov
Subject: Re: i386/63313: sk driver panics on boot with SK-9844 dual port NIC (V1.0 fiber)
Date: Wed, 23 Mar 2005 18:42:41 -0800

 I just built a test system using 5.3-RELEASE and was able to get a
 Syskonnect SK-9844 (a dual SX) card working after applying the
 patch to dev/mii/mii.c.
 
 In my view this PR could be closed.
 
 		Craig
>Unformatted:
