From mm@mail.vx.sk  Thu Apr 24 14:25:40 2008
Return-Path: <mm@mail.vx.sk>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 422411065673
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Apr 2008 14:25:40 +0000 (UTC)
	(envelope-from mm@mail.vx.sk)
Received: from mail.vx.sk (neo.vx.sk [213.239.219.9])
	by mx1.freebsd.org (Postfix) with ESMTP id 21BFF8FC14
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Apr 2008 14:25:39 +0000 (UTC)
	(envelope-from mm@mail.vx.sk)
Received: from localhost (localhost [127.0.0.1])
	by mail.vx.sk (Postfix) with ESMTP id 96A2F11425
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Apr 2008 16:25:38 +0200 (CEST)
Received: from mail.vx.sk ([127.0.0.1])
	by localhost (mail.vx.sk [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id G8xf2rgYDClD for <FreeBSD-gnats-submit@freebsd.org>;
	Thu, 24 Apr 2008 16:25:36 +0200 (CEST)
Received: by mail.vx.sk (Postfix, from userid 1001)
	id 9DE781147C; Thu, 24 Apr 2008 16:25:36 +0200 (CEST)
Message-Id: <20080424142536.9DE781147C@mail.vx.sk>
Date: Thu, 24 Apr 2008 16:25:36 +0200 (CEST)
From: Martin Matuska <mm@FreeBSD.org>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: re(4) unsupported hardware revision
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         123053
>Category:       kern
>Synopsis:       [re][patch] re(4) unsupported hardware revision (8168/8111b)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 24 14:30:00 UTC 2008
>Closed-Date:    Wed Jan 14 15:03:18 UTC 2009
>Last-Modified:  Mon Feb  9 01:40:04 UTC 2009
>Originator:     Martin Matuska
>Release:        FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD 7.0-STABLE Thu Apr 24 13:03:06 CEST 2008 amd64
>Description:
re(4) reports an unknown revision for the onboard nic on ASUS M3A78EMH-HDMI

dmesg:
re0: <RealTek 8168/8111B PCIe Gigabit Ethernet> port 0xe800-0xe8ff mem 0xfbfff000-0xfbffffff,0xfaff0000-0xfaffffff irq 18 at device 0.0 on pci3
re0: Unknown H/W revision: 3c000000

pciconv -lv:
re0@pci0:3:0:0: class=0x020000 card=0x82c61043 chip=0x816810ec rev=0x02 hdr=0x00
    vendor     = 'Realtek Semiconductor'
    device     = 'RTL8168/8111 PCI-E Gigabit Ethernet NIC'
    class      = network
    subclass   = ethernet
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Apr 24 14:39:41 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Martin Matuska <mm@FreeBSD.org>
To: bug-followup@FreeBSD.org, mm@FreeBSD.org
Cc:  
Subject: Re: kern/123053: [re] re(4) unsupported hardware revision
Date: Thu, 24 Apr 2008 17:39:54 +0200

 This seems to be another 8168, I am successfully running the following patch=
 :
 
 Index: src/sys/dev/re/if_re.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v
 retrieving revision 1.95.2.18
 diff -u -r1.95.2.18 if_re.c
 --- src/sys/dev/re/if_re.c=0922 Apr 2008 06:14:56 -0000=091.95.2.18
 +++ src/sys/dev/re/if_re.c=0924 Apr 2008 15:33:36 -0000
 @@ -184,6 +184,8 @@
   =09=09"RealTek 8168/8111B PCIe Gigabit Ethernet" },
   =09{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168_SPIN3,
   =09=09"RealTek 8168/8111B PCIe Gigabit Ethernet" },
 +=09{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168_SPIN4,
 +=09=09"RealTek 8168/8111B PCIe Gigabit Ethernet" },
   =09{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169,
   =09=09"RealTek 8169 Gigabit Ethernet" },
   =09{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169S,
 @@ -225,6 +227,7 @@
   =09{ RL_HWREV_8101E, RL_8169, "8101E"},
   =09{ RL_HWREV_8168_SPIN2, RL_8169, "8168"},
   =09{ RL_HWREV_8168_SPIN3, RL_8169, "8168"},
 +=09{ RL_HWREV_8168_SPIN4, RL_8169, "8168"},
   =09{ 0, 0, NULL }
   };
 
 @@ -697,6 +700,7 @@
   =09case RL_HWREV_8168_SPIN1:
   =09case RL_HWREV_8168_SPIN2:
   =09case RL_HWREV_8168_SPIN3:
 +=09case RL_HWREV_8168_SPIN4:
   =09=09CSR_WRITE_4(sc, RL_MAR0, bswap32(hashes[1]));
   =09=09CSR_WRITE_4(sc, RL_MAR4, bswap32(hashes[0]));
   =09=09break;
 @@ -1305,6 +1309,7 @@
   =09=09=09case RL_HWREV_8169_8110SC:
   =09=09=09case RL_HWREV_8168_SPIN2:
   =09=09=09case RL_HWREV_8168_SPIN3:
 +=09=09=09case RL_HWREV_8168_SPIN4:
   =09=09=09=09re_gmii_writereg(dev, 1, 0x1f, 0);
   =09=09=09=09re_gmii_writereg(dev, 1, 0x0e, 0);
   =09=09=09=09break;
 Index: src/sys/pci/if_rlreg.h
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/sys/pci/if_rlreg.h,v
 retrieving revision 1.67.2.7
 diff -u -r1.67.2.7 if_rlreg.h
 --- src/sys/pci/if_rlreg.h=0922 Apr 2008 06:13:05 -0000=091.67.2.7
 +++ src/sys/pci/if_rlreg.h=0924 Apr 2008 15:33:36 -0000
 @@ -161,6 +161,7 @@
   #define RL_HWREV_8101E=09=090x34000000
   #define RL_HWREV_8168_SPIN2=090x38000000
   #define RL_HWREV_8168_SPIN3=090x38400000
 +#define RL_HWREV_8168_SPIN4=090x3c000000
   #define RL_HWREV_8139=09=090x60000000
   #define RL_HWREV_8139A=09=090x70000000
   #define RL_HWREV_8139AG=09=090x70800000
 

From: linimon@lonesome.com (Mark Linimon)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/123053: [re] re(4) unsupported hardware revision
Date: Fri, 25 Apr 2008 05:17:45 -0500

 ----- Forwarded message from Eric F Crist <ecrist@secure-computing.net> -----
 
 From: Eric F Crist <ecrist@secure-computing.net>
 To: linimon@FreeBSD.org
 Subject: kern/123053
 Cc: freebsd-drivers@freebsd.org
 
 Andrey,
 
 I've applied the patch to a 7.0-RELEASE-p1 source tree and rebooted my  
 system.  The card comes UP ok, but shows the following when connected  
 to a 100BaseT/ Full Duplex switch port:
 
 re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
 	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
 	ether 00:1f:c6:52:7b:80
 	media: Ethernet autoselect (10baseT/UTP <half-duplex>)
 	status: active
 
 Once I've assigned an IP to the interface, however, it comes up  
 correctly and seems to function just fine.  Is there any load testing  
 I should perform for you folks?
 
 re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu  
 1500
 	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
 	ether 00:1f:c6:52:7b:80
 	inet 10.0.0.38 netmask 0xffff0000 broadcast 10.0.255.255
 	media: Ethernet autoselect (100baseTX <full-duplex>)
 	status: active
 
 -----
 Eric F Crist
 Secure Computing Networks
 
 ----- End forwarded message -----

From: Eric F Crist <ecrist@secure-computing.net>
To: pyunyh@gmail.com
Cc: linimon@FreeBSD.org,
 freebsd-drivers@FreeBSD.org,
 bug-followup@freebsd.org
Subject: Re: kern/123053
Date: Fri, 25 Apr 2008 07:29:01 -0500

 On Apr 24, 2008, at 7:25 PM, Pyun YongHyeon wrote:
 
 > By chance, are you referring to kern/123053?
 
 That's what the subject of the email says...
 
 I've run some benchmarks, and they seemed to go pretty badly.  After  
 running a few, I realized that I still had two network interfaces up,  
 (em0, and the testing re0), I did an ifconfig em0 down, and was unable  
 to connect in or out from the remaining re0.  Perhaps this code isn't  
 all the way complete.
 
 Eric
 
 -----
 Eric F Crist
 Secure Computing Networks
 
 
Responsible-Changed-From-To: freebsd-net->rpaulo 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Thu May 22 08:53:48 UTC 2008 
Responsible-Changed-Why:  

reassign to rpaulo who has a similar ticket with a similar patch assigned. 
Rui: Can you please bring this ticket with kern/123123 in line? 
Either of one can be closed IMHO as the patches are very close to each other. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123053 
Responsible-Changed-From-To: rpaulo->yongari 
Responsible-Changed-By: rpaulo 
Responsible-Changed-When: Mon Jul 7 11:49:45 UTC 2008 
Responsible-Changed-Why:  
Pyun committed a new version of the re driver. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123053 
State-Changed-From-To: open->feedback 
State-Changed-By: rpaulo 
State-Changed-When: Mon Jul 7 11:50:43 UTC 2008 
State-Changed-Why:  
Please test the new re driver. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123053 
State-Changed-From-To: feedback->patched 
State-Changed-By: yongari 
State-Changed-When: Wed Dec 17 07:27:24 UTC 2008 
State-Changed-Why:  
Fix for waking up controller committed to HEAD(SVN r186210). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123053 
State-Changed-From-To: patched->closed 
State-Changed-By: mm 
State-Changed-When: Wed Jan 14 15:03:17 UTC 2009 
State-Changed-Why:  
Fixed now. Closed by submitter. 

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

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

 Author: yongari
 Date: Mon Feb  9 01:30:14 2009
 New Revision: 188358
 URL: http://svn.freebsd.org/changeset/base/188358
 
 Log:
   MFC r186210:
     For RTL8168C SPIN2 controllers, make sure to take the controller
     out of sleep mode prior to accessing to PHY. This should fix device
     attach failure seen on these controllers. Also enable the sleep
     mode when device is put into sleep state.
   
     PR:	kern/123123, kern/123053
 
 Modified:
   stable/7/sys/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
   stable/7/sys/dev/cxgb/   (props changed)
   stable/7/sys/dev/re/if_re.c
   stable/7/sys/pci/if_rlreg.h
 
 Modified: stable/7/sys/dev/re/if_re.c
 ==============================================================================
 --- stable/7/sys/dev/re/if_re.c	Mon Feb  9 01:26:31 2009	(r188357)
 +++ stable/7/sys/dev/re/if_re.c	Mon Feb  9 01:30:14 2009	(r188358)
 @@ -1262,8 +1262,13 @@ re_attach(device_t dev)
  		sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE |
  		    RL_FLAG_MACSTAT;
  		break;
 -	case RL_HWREV_8168C:
  	case RL_HWREV_8168C_SPIN2:
 +		sc->rl_flags |= RL_FLAG_MACSLEEP;
 +		/* FALLTHROUGH */
 +	case RL_HWREV_8168C:
 +		if ((hwrev & 0x00700000) == 0x00200000)
 +			sc->rl_flags |= RL_FLAG_MACSLEEP;
 +		/* FALLTHROUGH */
  	case RL_HWREV_8168CP:
  	case RL_HWREV_8168D:
  		sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE |
 @@ -1351,6 +1356,16 @@ re_attach(device_t dev)
  		goto fail;
  	}
  
 +	/* Take controller out of deep sleep mode. */
 +	if ((sc->rl_flags & RL_FLAG_MACSLEEP) != 0) {
 +		if ((CSR_READ_1(sc, RL_MACDBG) & 0x80) == 0x80)
 +			CSR_WRITE_1(sc, RL_GPIO,
 +			    CSR_READ_1(sc, RL_GPIO) | 0x01);
 +		else
 +			CSR_WRITE_1(sc, RL_GPIO,
 +			    CSR_READ_1(sc, RL_GPIO) & ~0x01);
 +	}
 +
  	/* Take PHY out of power down mode. */
  	if ((sc->rl_flags & RL_FLAG_PHYWAKE) != 0) {
  		re_gmii_writereg(dev, 1, 0x1f, 0);
 @@ -2963,6 +2978,12 @@ re_resume(device_t dev)
  	RL_LOCK(sc);
  
  	ifp = sc->rl_ifp;
 +	/* Take controller out of sleep mode. */
 +	if ((sc->rl_flags & RL_FLAG_MACSLEEP) != 0) {
 +		if ((CSR_READ_1(sc, RL_MACDBG) & 0x80) == 0x80)
 +			CSR_WRITE_1(sc, RL_GPIO,
 +			    CSR_READ_1(sc, RL_GPIO) | 0x01);
 +	}
  
  	/* reinitialize interface if necessary */
  	if (ifp->if_flags & IFF_UP)
 @@ -3018,6 +3039,12 @@ re_setwol(struct rl_softc *sc)
  		return;
  
  	ifp = sc->rl_ifp;
 +	/* Put controller into sleep mode. */
 +	if ((sc->rl_flags & RL_FLAG_MACSLEEP) != 0) {
 +		if ((CSR_READ_1(sc, RL_MACDBG) & 0x80) == 0x80)
 +			CSR_WRITE_1(sc, RL_GPIO,
 +			    CSR_READ_1(sc, RL_GPIO) & ~0x01);
 +	}
  	if ((ifp->if_capenable & IFCAP_WOL) != 0 &&
  	    (sc->rl_flags & RL_FLAG_WOLRXENB) != 0)
  		CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB);
 
 Modified: stable/7/sys/pci/if_rlreg.h
 ==============================================================================
 --- stable/7/sys/pci/if_rlreg.h	Mon Feb  9 01:26:31 2009	(r188357)
 +++ stable/7/sys/pci/if_rlreg.h	Mon Feb  9 01:30:14 2009	(r188358)
 @@ -131,6 +131,8 @@
  #define RL_TBI_ANAR		0x0068
  #define RL_TBI_LPAR		0x006A
  #define RL_GMEDIASTAT		0x006C	/* 8 bits */
 +#define RL_MACDBG		0x006D	/* 8 bits, 8168C SPIN2 only */
 +#define RL_GPIO			0x006E	/* 8 bits, 8168C SPIN2 only */
  #define RL_MAXRXPKTLEN		0x00DA	/* 16 bits, chip multiplies by 8 */
  #define RL_GTXSTART		0x0038	/* 8 bits */
  
 @@ -861,6 +863,7 @@ struct rl_softc {
  #define	RL_FLAG_PHY8169		0x0400
  #define	RL_FLAG_PHY8110S	0x0800
  #define	RL_FLAG_WOLRXENB	0x1000
 +#define	RL_FLAG_MACSLEEP	0x2000
  #define	RL_FLAG_LINK		0x8000
  };
  
 _______________________________________________
 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"
 
>Unformatted:
