Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jun 2006 19:33:05 +0200 (CEST)
From:      Ulrich Spoerlein <uspoerlein@gmail.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Mike Silbersack <silby@silby.com>
Subject:   kern/99216: [PATCH] make bfe(4) always detect LINK_DOWN events
Message-ID:  <200606201733.k5KHX5Fd002353@roadrunner.q.local>
Resent-Message-ID: <200606202100.k5KL0iSv097708@freefall.freebsd.org>

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

>Number:         99216
>Category:       kern
>Synopsis:       [PATCH] make bfe(4) always detect LINK_DOWN events
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 20 21:00:43 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spoerlein
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
>Description:
I investigated a bug/missing feature in the bfe(4) driver, which makes
it not see any LINK DOWN events unless you happen to invoke ifconfig.

This was tested by me and Ben Kaduk with an BCM4401, card=0x81271028 chip=0x440114e4;
Jean-Marc Zucconi, BCM4401, card=0x80a81043 chip=0x440114e4;
Mikko Työläjärvi, card=0x018d1028 chip=0x170c14e4

NB: Some variants of the chip work correctly even without the patch, though
no regression for these was found by
Lars Engels, BCM4401, card=0x108217c0 chip=0x440114e4
>How-To-Repeat:
1. Plug in ethernet cable
2. Watch dmesg/syslogd for the LINK UP message
3. Remove the cable
4. No LINK DOWN message. Only after you issue 'ifconfig'
>Fix:

--- if_bfe.c.orig	Wed Jun  7 21:34:49 2006
+++ if_bfe.c	Wed Jun  7 21:37:07 2006
@@ -1552,17 +1552,21 @@ bfe_tick(void *xsc)
 	mii = device_get_softc(sc->bfe_miibus);
 
 	bfe_stats_update(sc);
-	sc->bfe_stat_ch = timeout(bfe_tick, sc, hz);
 
-	if(sc->bfe_link) {
-		BFE_UNLOCK(sc);
-		return;
+	if (sc->bfe_miibus != NULL)
+		mii_tick(mii);
+
+	if (!sc->bfe_link) {
+		if (mii->mii_media_status & IFM_ACTIVE)
+			sc->bfe_link++;
+	} else {
+		mii_pollstat(mii);
+
+		if (!(mii->mii_media_status & IFM_ACTIVE))
+			sc->bfe_link = 0;
 	}
 
-	mii_tick(mii);
-	if (!sc->bfe_link && mii->mii_media_status & IFM_ACTIVE &&
-			IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
-		sc->bfe_link++;
+	sc->bfe_stat_ch = timeout(bfe_tick, sc, hz);
 
 	BFE_UNLOCK(sc);
 }
>Release-Note:
>Audit-Trail:
>Unformatted:



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