Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Mar 2006 16:45:12 GMT
From:      "Devon H. O'Dell" <dodell@iXsystems.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/94833: [patch]  Make BGE_FAKE_AUTONEG a system tunable
Message-ID:  <200603221645.k2MGjCOr081173@www.freebsd.org>
Resent-Message-ID: <200603221650.k2MGoGuQ013392@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         94833
>Category:       misc
>Synopsis:       [patch]  Make BGE_FAKE_AUTONEG a system tunable
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 22 16:50:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Devon H. O'Dell
>Release:        6.1-PRERELEASE
>Organization:
iXsystems
>Environment:
FreeBSD maria.fdev.iXsystems.com 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #3: Sat Mar 11 15:33:24 PST 2006     root@maria.fdev.iXsystems.com:/usr/src/sys/amd64/compile/BLADE  amd64
>Description:
As is apparent by the commit logs surrounding BGE_FAKE_AUTONEG, bge(4) is weird,
especially on Intel / IBM blade platforms. This patch makes the BGE_FAKE_AUTONEG a
tunable. This patch allows one to change the behavior of the driver pre-boot.

Originally, this was not useful due to issues with the switch packaged with the 
blade; however, the new switch package for the blade doesn't have the same 
quirkiness factor, so it should be OK.

NOTE: This patch was made for DragonFly BSD by 
Sepherosa Ziehau <sepherosa@gmail.com> -- please credit him for the patch.
>How-To-Repeat:
Boot a SBX82 blade with GENERIC and try to access the network. Fail miserably.
>Fix:
Original patch: http://leaf.dragonflybsd.org/~sephe/bge_fake.diff

Patch against -HEAD: http://www.sitetronics.com/~dodell/bge_fix.patch

-- begin patch --
Index: if_bge.c
===================================================================
RCS file: /opt/df_cvs/src/sys/dev/netif/bge/if_bge.c,v
retrieving revision 1.46
diff -u -p -r1.46 if_bge.c
--- if_bge.c	22 Aug 2005 18:29:52 -0000	1.46
+++ if_bge.c	5 Sep 2005 09:49:52 -0000
@@ -257,6 +257,9 @@ static void	bge_miibus_statchg(device_t)
 
 static void	bge_reset(struct bge_softc *);
 
+static int	bge_fake_autoneg = 0;
+TUNABLE_INT("hw.bge.fake_autoneg", &bge_fake_autoneg);
+
 static device_method_t bge_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		bge_probe),
@@ -2550,13 +2553,13 @@ bge_ifmedia_upd(struct ifnet *ifp)
 			return(EINVAL);
 		switch(IFM_SUBTYPE(ifm->ifm_media)) {
 		case IFM_AUTO:
-#ifndef BGE_FAKE_AUTONEG
 			/*
 			 * The BCM5704 ASIC appears to have a special
 			 * mechanism for programming the autoneg
 			 * advertisement registers in TBI mode.
 			 */
-			if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
+			if (!bge_fake_autoneg &&
+			    sc->bge_asicrev == BGE_ASICREV_BCM5704) {
 				uint32_t sgdig;
 
 				CSR_WRITE_4(sc, BGE_TX_TBI_AUTONEG, 0);
@@ -2569,7 +2572,6 @@ bge_ifmedia_upd(struct ifnet *ifp)
 				DELAY(5);
 				CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig);
 			}
-#endif	/* !BEG_FAKE_AUTONEG */
 			break;
 		case IFM_1000_SX:
 			if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {
-- end patch --


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603221645.k2MGjCOr081173>