From nobody@FreeBSD.org  Wed Jun 22 07:47:11 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46FD91065799
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 22 Jun 2011 07:47:11 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 371298FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 22 Jun 2011 07:47:11 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5M7lAcV028282
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 22 Jun 2011 07:47:10 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p5M7lADn028281;
	Wed, 22 Jun 2011 07:47:10 GMT
	(envelope-from nobody)
Message-Id: <201106220747.p5M7lADn028281@red.freebsd.org>
Date: Wed, 22 Jun 2011 07:47:10 GMT
From: Jason Chang <jsc@ntu.edu.tw>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bce driver shows "no carrier" on IBM blade (HS22 with BCM5709)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158156
>Category:       kern
>Synopsis:       [bce] bce driver shows "no carrier" on IBM blade (HS22 with BCM5709)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-net
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 22 07:50:10 UTC 2011
>Closed-Date:    Tue Aug 23 14:52:07 UTC 2011
>Last-Modified:  Tue Aug 23 14:52:07 UTC 2011
>Originator:     Jason Chang
>Release:        8.2-STABLE
>Organization:
National Taiwan University
>Environment:
FreeBSD 8.2-STABLE Jun 20 amd64
>Description:
My server is an IBM blade system. The model of server is HS22, network device relate info:
bce0: <Broadcom NetXtreme II BCM5709 1000Base-SX (C0)> mem 0xfa000000-0xfbffffff irq 30 at device 0.0 on pci16
miibus0: <MII bus> on bce0
brgphy0: <BCM5709S 1000/2500baseSX PHY> PHY 2 on miibus0
brgphy0:  1000baseSX-FDX, auto
The network switch is built-in in blade and model is BNT Layer 2-7 GbE Switch. In fact, it is a nortel alteon Layer 7 switch.

After making world/kernel to the latest 8.2-STABLE source, the network device no longer works. Command ifconfig always shows "no carrier". 

>How-To-Repeat:
Update kernel source to 2011/05/22 and after.
/stable/8/sys/dev/mii/mii_physubr.c
(Revision 222159)

>Fix:
revert
/stable/8/sys/dev/mii/mii_physubr.c
from Revision 222159 to Revision 217674


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jun 23 18:13:10 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Marius Strobl <marius@alchemy.franken.de>
To: bug-followup@FreeBSD.org, jsc@ntu.edu.tw
Cc:  
Subject: Re: kern/158156: [bce] bce driver shows "no carrier" on IBM blade (HS22 with BCM5709)
Date: Mon, 8 Aug 2011 10:30:27 +0200

 --7LkOrbQMr4cezO2T
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Could you please test whether the attached patch fixes this?
 
 --7LkOrbQMr4cezO2T
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="mii_physubr_reset_default_may_power_down.diff"
 
 Index: mii_physubr.c
 ===================================================================
 --- mii_physubr.c	(revision 224216)
 +++ mii_physubr.c	(working copy)
 @@ -273,8 +273,8 @@ mii_phy_reset(struct mii_softc *sc)
  		DELAY(1000);
  	}
  
 -	/* NB: a PHY may default to isolation. */
 -	reg &= ~BMCR_ISO;
 +	/* NB: a PHY may default to being powered down and isolated. */
 +	reg &= ~(BMCR_PDOWN | BMCR_ISO);
  	if ((sc->mii_flags & MIIF_NOISOLATE) == 0 &&
  	    ((ife == NULL && sc->mii_inst != 0) ||
  	    (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)))
 
 --7LkOrbQMr4cezO2T--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/158156: commit references a PR
Date: Fri, 19 Aug 2011 19:13:11 +0000 (UTC)

 Author: marius
 Date: Fri Aug 19 19:12:58 2011
 New Revision: 225014
 URL: http://svn.freebsd.org/changeset/base/225014
 
 Log:
   r221812 reveals that at least some Broadcom PHYs default to being not only
   isolated but also powered down after a reset and while they just work fine
   [sic] when both is the case they don't if they are only deisolate but still
   powered down. So in order to put PHYs in an overall normal operation mode
   for the common case, ensure in mii_phy_reset() that they are not powered
   down after a reset. Unfortunately, this only helps in case of BCM5421,
   while BCM5709S apparently only work when they remain isolated and powered
   down after a reset. So don't call mii_phy_reset() in brgphy_reset() and
   implement the reset locally leaving the problematic bits alone. Effectively
   this bypasses r221812 for brgphy(4).
   Thanks to Justin Hibbits for doing a binary search in order to identify
   the problematic commit.
   
   PR:		157405, 158156
   Reviewed by:	yongari (mii_phy_reset() part)
   Approved by:	re (kib)
   MFC after:	3 days
 
 Modified:
   head/sys/dev/mii/brgphy.c
   head/sys/dev/mii/mii_physubr.c
 
 Modified: head/sys/dev/mii/brgphy.c
 ==============================================================================
 --- head/sys/dev/mii/brgphy.c	Fri Aug 19 15:21:13 2011	(r225013)
 +++ head/sys/dev/mii/brgphy.c	Fri Aug 19 19:12:58 2011	(r225014)
 @@ -876,10 +876,22 @@ brgphy_reset(struct mii_softc *sc)
  	struct bge_softc *bge_sc = NULL;
  	struct bce_softc *bce_sc = NULL;
  	struct ifnet *ifp;
 -	int val;
 +	int i, val;
  
 -	/* Perform a standard PHY reset. */
 -	mii_phy_reset(sc);
 +	/*
 +	 * Perform a reset.  Note that at least some Broadcom PHYs default to
 +	 * being powered down as well as isolated after a reset but don't work
 +	 * if one or both of these bits are cleared.  However, they just work
 +	 * fine if both bits remain set, so we don't use mii_phy_reset() here.
 +	 */
 +	PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET);
 +
 +	/* Wait 100ms for it to complete. */
 +	for (i = 0; i < 100; i++) {
 +		if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0)
 +			break;
 +		DELAY(1000);
 +	}
  
  	/* Handle any PHY specific procedures following the reset. */
  	switch (sc->mii_mpd_oui) {
 
 Modified: head/sys/dev/mii/mii_physubr.c
 ==============================================================================
 --- head/sys/dev/mii/mii_physubr.c	Fri Aug 19 15:21:13 2011	(r225013)
 +++ head/sys/dev/mii/mii_physubr.c	Fri Aug 19 19:12:58 2011	(r225014)
 @@ -273,8 +273,8 @@ mii_phy_reset(struct mii_softc *sc)
  		DELAY(1000);
  	}
  
 -	/* NB: a PHY may default to isolation. */
 -	reg &= ~BMCR_ISO;
 +	/* NB: a PHY may default to being powered down and/or isolated. */
 +	reg &= ~(BMCR_PDOWN | BMCR_ISO);
  	if ((sc->mii_flags & MIIF_NOISOLATE) == 0 &&
  	    ((ife == NULL && sc->mii_inst != 0) ||
  	    (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/158156: commit references a PR
Date: Tue, 23 Aug 2011 14:33:22 +0000 (UTC)

 Author: marius
 Date: Tue Aug 23 14:32:53 2011
 New Revision: 225116
 URL: http://svn.freebsd.org/changeset/base/225116
 
 Log:
   MFC: r225014
   
   r221812 (MFC'ed to stable/8 in r222159) reveals that at least some Broadcom
   PHYs default to being not only isolated but also powered down after a reset
   and while they just work fine [sic] when both is the case they don't if they
   are only deisolate but still powered down. So in order to put PHYs in an
   overall normal operation mode for the common case, ensure in mii_phy_reset()
   that they are not powered down after a reset. Unfortunately, this only helps
   in case of BCM5421, while BCM5709S apparently only work when they remain
   isolated and powered down after a reset. So don't call mii_phy_reset() in
   brgphy_reset() and implement the reset locally leaving the problematic bits
   alone. Effectively this bypasses r221812 for brgphy(4).
   Thanks to Justin Hibbits for doing a binary search in order to identify
   the problematic commit.
   
   PR:		157405, 158156
   Reviewed by:	yongari (mii_phy_reset() part)
 
 Modified:
   stable/8/sys/dev/mii/brgphy.c
   stable/8/sys/dev/mii/mii_physubr.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/mii/brgphy.c
 ==============================================================================
 --- stable/8/sys/dev/mii/brgphy.c	Tue Aug 23 14:01:04 2011	(r225115)
 +++ stable/8/sys/dev/mii/brgphy.c	Tue Aug 23 14:32:53 2011	(r225116)
 @@ -913,10 +913,22 @@ brgphy_reset(struct mii_softc *sc)
  	struct bge_softc *bge_sc = NULL;
  	struct bce_softc *bce_sc = NULL;
  	struct ifnet *ifp;
 -	int val;
 +	int i, val;
  
 -	/* Perform a standard PHY reset. */
 -	mii_phy_reset(sc);
 +	/*
 +	 * Perform a reset.  Note that at least some Broadcom PHYs default to
 +	 * being powered down as well as isolated after a reset but don't work
 +	 * if one or both of these bits are cleared.  However, they just work
 +	 * fine if both bits remain set, so we don't use mii_phy_reset() here.
 +	 */
 +	PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET);
 +
 +	/* Wait 100ms for it to complete. */
 +	for (i = 0; i < 100; i++) {
 +		if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0)
 +			break;
 +		DELAY(1000);
 +	}
  
  	/* Handle any PHY specific procedures following the reset. */
  	switch (bsc->mii_oui) {
 
 Modified: stable/8/sys/dev/mii/mii_physubr.c
 ==============================================================================
 --- stable/8/sys/dev/mii/mii_physubr.c	Tue Aug 23 14:01:04 2011	(r225115)
 +++ stable/8/sys/dev/mii/mii_physubr.c	Tue Aug 23 14:32:53 2011	(r225116)
 @@ -276,8 +276,8 @@ mii_phy_reset(struct mii_softc *sc)
  		DELAY(1000);
  	}
  
 -	/* NB: a PHY may default to isolation. */
 -	reg &= ~BMCR_ISO;
 +	/* NB: a PHY may default to being powered down and/or isolated. */
 +	reg &= ~(BMCR_PDOWN | BMCR_ISO);
  	if ((sc->mii_flags & MIIF_NOISOLATE) == 0 &&
  	    ((ife == NULL && sc->mii_inst != 0) ||
  	    (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/158156: commit references a PR
Date: Tue, 23 Aug 2011 14:33:28 +0000 (UTC)

 Author: marius
 Date: Tue Aug 23 14:32:59 2011
 New Revision: 225117
 URL: http://svn.freebsd.org/changeset/base/225117
 
 Log:
   MFC: r225014
   
   r221812 (MFC'ed to stable/7 in r222160) reveals that at least some Broadcom
   PHYs default to being not only isolated but also powered down after a reset
   and while they just work fine [sic] when both is the case they don't if they
   are only deisolate but still powered down. So in order to put PHYs in an
   overall normal operation mode for the common case, ensure in mii_phy_reset()
   that they are not powered down after a reset. Unfortunately, this only helps
   in case of BCM5421, while BCM5709S apparently only work when they remain
   isolated and powered down after a reset. So don't call mii_phy_reset() in
   brgphy_reset() and implement the reset locally leaving the problematic bits
   alone. Effectively this bypasses r221812 for brgphy(4).
   Thanks to Justin Hibbits for doing a binary search in order to identify
   the problematic commit.
   
   PR:		157405, 158156
   Reviewed by:	yongari (mii_phy_reset() part)
 
 Modified:
   stable/7/sys/dev/mii/brgphy.c
   stable/7/sys/dev/mii/mii_physubr.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/mii/brgphy.c
 ==============================================================================
 --- stable/7/sys/dev/mii/brgphy.c	Tue Aug 23 14:32:53 2011	(r225116)
 +++ stable/7/sys/dev/mii/brgphy.c	Tue Aug 23 14:32:59 2011	(r225117)
 @@ -913,10 +913,22 @@ brgphy_reset(struct mii_softc *sc)
  	struct bge_softc *bge_sc = NULL;
  	struct bce_softc *bce_sc = NULL;
  	struct ifnet *ifp;
 -	int val;
 +	int i, val;
  
 -	/* Perform a standard PHY reset. */
 -	mii_phy_reset(sc);
 +	/*
 +	 * Perform a reset.  Note that at least some Broadcom PHYs default to
 +	 * being powered down as well as isolated after a reset but don't work
 +	 * if one or both of these bits are cleared.  However, they just work
 +	 * fine if both bits remain set, so we don't use mii_phy_reset() here.
 +	 */
 +	PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET);
 +
 +	/* Wait 100ms for it to complete. */
 +	for (i = 0; i < 100; i++) {
 +		if ((PHY_READ(sc, BRGPHY_MII_BMCR) & BRGPHY_BMCR_RESET) == 0)
 +			break;
 +		DELAY(1000);
 +	}
  
  	/* Handle any PHY specific procedures following the reset. */
  	switch (bsc->mii_oui) {
 
 Modified: stable/7/sys/dev/mii/mii_physubr.c
 ==============================================================================
 --- stable/7/sys/dev/mii/mii_physubr.c	Tue Aug 23 14:32:53 2011	(r225116)
 +++ stable/7/sys/dev/mii/mii_physubr.c	Tue Aug 23 14:32:59 2011	(r225117)
 @@ -276,8 +276,8 @@ mii_phy_reset(struct mii_softc *sc)
  		DELAY(1000);
  	}
  
 -	/* NB: a PHY may default to isolation. */
 -	reg &= ~BMCR_ISO;
 +	/* NB: a PHY may default to being powered down and/or isolated. */
 +	reg &= ~(BMCR_PDOWN | BMCR_ISO);
  	if ((sc->mii_flags & MIIF_NOISOLATE) == 0 &&
  	    ((ife == NULL && sc->mii_inst != 0) ||
  	    (ife != NULL && IFM_INST(ife->ifm_media) != sc->mii_inst)))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: marius 
State-Changed-When: Tue Aug 23 14:51:51 UTC 2011 
State-Changed-Why:  
close 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158156 
>Unformatted:
