From nobody@FreeBSD.org  Wed Jan 21 22:35:17 2009
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 B3F081065670
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jan 2009 22:35:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A282D8FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jan 2009 22:35:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n0LMZHmK008255
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jan 2009 22:35:17 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n0LMZHWX008254;
	Wed, 21 Jan 2009 22:35:17 GMT
	(envelope-from nobody)
Message-Id: <200901212235.n0LMZHWX008254@www.freebsd.org>
Date: Wed, 21 Jan 2009 22:35:17 GMT
From: David Ehrmann <david@exitrow.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: vge0 not autonegotiating to 1000baseTX full duplex in 7.1 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         130846
>Category:       kern
>Synopsis:       [vge] vge0 not autonegotiating to 1000baseTX full duplex in 7.1
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 21 22:40:04 UTC 2009
>Closed-Date:    Wed Mar 18 03:47:38 UTC 2009
>Last-Modified:  Wed Mar 18 03:47:38 UTC 2009
>Originator:     David Ehrmann
>Release:        7.1-RELEASE
>Organization:
>Environment:
FreeBSD share2.lan 7.1-RELEASE-p1 FreeBSD 7.1-RELEASE-p1 #5: Tue Jan 13 13:51:30 PST 2009     root@share2.lan:/usr/obj/usr/src/sys/MYKERNEL  i386

>Description:
vge devices won't autonegotiate to gigabit speeds.  When forced to gigabit media with ifconfig vge0 media 1000baseTX, ifconfig reports the status as "no carrier."

This problem is documented here: http://forums.freebsd.org/showthread.php?t=1637

Has been discussed on the mailing list here: http://lists.freebsd.org/pipermail/freebsd-current/2008-April/thread.html#start

And is an open bug in OpenBSD: bug ID 5978
>How-To-Repeat:
Boot a computer with a vge interface.  ifconfig will report 100baseTX, even if the port is connected to a 1000baseT switch.

vge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
        ether 00:40:63:xx:xx:xx
        inet 10.0.0.130 netmask 0xfffffc00 broadcast 10.0.3.255
        media: Ethernet autoselect (100baseTX <full-duplex,flag0,flag1>)
        status: active

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jan 22 00:20:11 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=130846 
Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: yongari 
Responsible-Changed-When: Mon Mar 9 07:13:48 UTC 2009 
Responsible-Changed-Why:  
Grab. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/130846: commit references a PR
Date: Mon,  9 Mar 2009 08:18:01 +0000 (UTC)

 Author: yongari
 Date: Mon Mar  9 08:17:46 2009
 New Revision: 189567
 URL: http://svn.freebsd.org/changeset/base/189567
 
 Log:
   For IP1001 PHYs, read auto-negotiation advertisement register to
   get default next page configuration. While I'm here explicitly set
   IP1000PHY_ANAR_CSMA bit. This bit is read-only and always set
   by hardware so setting it has no effect but it would clear the
   intention. With this change controllers that couldn't establish
   1000baseT link should work.
   
   PR:	kern/130846
 
 Modified:
   head/sys/dev/mii/ip1000phy.c
   head/sys/dev/mii/ip1000phyreg.h
 
 Modified: head/sys/dev/mii/ip1000phy.c
 ==============================================================================
 --- head/sys/dev/mii/ip1000phy.c	Mon Mar  9 08:09:06 2009	(r189566)
 +++ head/sys/dev/mii/ip1000phy.c	Mon Mar  9 08:17:46 2009	(r189567)
 @@ -391,18 +391,24 @@ ip1000phy_status(struct mii_softc *sc)
  }
  
  static int
 -ip1000phy_mii_phy_auto(struct mii_softc *mii)
 +ip1000phy_mii_phy_auto(struct mii_softc *sc)
  {
 +	struct ip1000phy_softc *isc;
  	uint32_t reg;
  
 -	PHY_WRITE(mii, IP1000PHY_MII_ANAR,
 -	    IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
 +	isc = (struct ip1000phy_softc *)sc;
 +	reg = 0;
 +	if (isc->model == MII_MODEL_ICPLUS_IP1001)
 +		reg = PHY_READ(sc, IP1000PHY_MII_ANAR);
 +	reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
  	    IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX |
 -	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE);
 +	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE;
 +	PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA);
 +
  	reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX;
  	reg |= IP1000PHY_1000CR_MASTER;
 -	PHY_WRITE(mii, IP1000PHY_MII_1000CR, reg);
 -	PHY_WRITE(mii, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
 +	PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg);
 +	PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
  	    IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG));
  
  	return (EJUSTRETURN);
 
 Modified: head/sys/dev/mii/ip1000phyreg.h
 ==============================================================================
 --- head/sys/dev/mii/ip1000phyreg.h	Mon Mar  9 08:09:06 2009	(r189566)
 +++ head/sys/dev/mii/ip1000phyreg.h	Mon Mar  9 08:17:46 2009	(r189567)
 @@ -61,6 +61,7 @@
  
  /* Autonegotiation advertisement register */
  #define	IP1000PHY_MII_ANAR		0x04
 +#define	IP1000PHY_ANAR_CSMA		0x0001
  #define	IP1000PHY_ANAR_10T		0x0020
  #define	IP1000PHY_ANAR_10T_FDX		0x0040
  #define	IP1000PHY_ANAR_100TX		0x0080
 _______________________________________________
 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->patched 
State-Changed-By: yongari 
State-Changed-When: Mon Mar 9 09:03:09 UTC 2009 
State-Changed-Why:  
Submitter confirms ip1000phy(4) in HEAD fixes the issue. 
Thanks for testing! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/130846: commit references a PR
Date: Wed, 18 Mar 2009 03:36:29 +0000 (UTC)

 Author: yongari
 Date: Wed Mar 18 03:36:08 2009
 New Revision: 189954
 URL: http://svn.freebsd.org/changeset/base/189954
 
 Log:
   MFC r189567:
     For IP1001 PHYs, read auto-negotiation advertisement register to
     get default next page configuration. While I'm here explicitly set
     IP1000PHY_ANAR_CSMA bit. This bit is read-only and always set
     by hardware so setting it has no effect but it would clear the
     intention. With this change controllers that couldn't establish
     1000baseT link should work.
   
     PR:	kern/130846
 
 Modified:
   stable/7/sys/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
   stable/7/sys/dev/ath/ath_hal/   (props changed)
   stable/7/sys/dev/cxgb/   (props changed)
   stable/7/sys/dev/mii/ip1000phy.c
   stable/7/sys/dev/mii/ip1000phyreg.h
 
 Modified: stable/7/sys/dev/mii/ip1000phy.c
 ==============================================================================
 --- stable/7/sys/dev/mii/ip1000phy.c	Wed Mar 18 03:33:45 2009	(r189953)
 +++ stable/7/sys/dev/mii/ip1000phy.c	Wed Mar 18 03:36:08 2009	(r189954)
 @@ -391,18 +391,24 @@ ip1000phy_status(struct mii_softc *sc)
  }
  
  static int
 -ip1000phy_mii_phy_auto(struct mii_softc *mii)
 +ip1000phy_mii_phy_auto(struct mii_softc *sc)
  {
 +	struct ip1000phy_softc *isc;
  	uint32_t reg;
  
 -	PHY_WRITE(mii, IP1000PHY_MII_ANAR,
 -	    IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
 +	isc = (struct ip1000phy_softc *)sc;
 +	reg = 0;
 +	if (isc->model == MII_MODEL_ICPLUS_IP1001)
 +		reg = PHY_READ(sc, IP1000PHY_MII_ANAR);
 +	reg |= IP1000PHY_ANAR_10T | IP1000PHY_ANAR_10T_FDX |
  	    IP1000PHY_ANAR_100TX | IP1000PHY_ANAR_100TX_FDX |
 -	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE);
 +	    IP1000PHY_ANAR_PAUSE | IP1000PHY_ANAR_APAUSE;
 +	PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA);
 +
  	reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX;
  	reg |= IP1000PHY_1000CR_MASTER;
 -	PHY_WRITE(mii, IP1000PHY_MII_1000CR, reg);
 -	PHY_WRITE(mii, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
 +	PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg);
 +	PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX |
  	    IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG));
  
  	return (EJUSTRETURN);
 
 Modified: stable/7/sys/dev/mii/ip1000phyreg.h
 ==============================================================================
 --- stable/7/sys/dev/mii/ip1000phyreg.h	Wed Mar 18 03:33:45 2009	(r189953)
 +++ stable/7/sys/dev/mii/ip1000phyreg.h	Wed Mar 18 03:36:08 2009	(r189954)
 @@ -61,6 +61,7 @@
  
  /* Autonegotiation advertisement register */
  #define	IP1000PHY_MII_ANAR		0x04
 +#define	IP1000PHY_ANAR_CSMA		0x0001
  #define	IP1000PHY_ANAR_10T		0x0020
  #define	IP1000PHY_ANAR_10T_FDX		0x0040
  #define	IP1000PHY_ANAR_100TX		0x0080
 _______________________________________________
 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: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Wed Mar 18 03:47:15 UTC 2009 
State-Changed-Why:  
MFC done. 

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