Re: bge driver autoneg failure and system-wide stalls

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 25 Nov 2005 16:22:28 +0300
On Fri, Nov 25, 2005 at 01:20:41PM +1100, Emil Mikulic wrote:
E> I have a network port with bad wiring in the walls - a cable tester
E> shows only wires 1,2,3 and 6 are actually connected.
E> 
E> My solution is to patch directly into the switch, in which case the bge
E> driver works just fine.  However, the bad wiring exposes two problems
E> with the bge driver in 7-CURRENT.  From memory, I think these turned up
E> in the 5.x line because I wasn't seeing either issue in 4.x
E> 
E> The first problem is that, once ifconfig'd to an IP address, there will
E> be periodic system-wide stalls.  They generally last a little under a
E> second and are incredibly annoying and can cause keypresses to be lost
E> at the console.
E> 
E> I instrumented the kernel and, as far as I can tell, once ifconfig'd,
E> the following will happen in brgphy (mii module):
E> 
E> Every second there is a call to brgphy_service() with cmd=MII_TICK.
E> Every five seconds, this function will call brgphy_mii_phy_auto().
E> This function calls brgphy_loop().
E> 
E> In brgphy_loop(), there is a #if 0'd bit of code that device_printf()'s
E> how many times it looped.  I enabled it.
E> 
E> Sometimes it reports zero loops - when this happens there is no stall.
E> On a very pronounced stall, there will be between 3000-7000 loops.
E> 
E> (i.e. the stalls appear a bit random because they only get a chance to
E> happen once every five seconds, and sometimes brgphy_loop() doesn't
E> result in a noticeable stall)
E> 
E> The other problem is that bge will never negotiate a working link speed.
E> ifconfig will always return "status: no carrier"
E> 
E> If I force the media to 10baseT/UTP or 100baseTX (either mediaopt
E> full-duplex or not), it will issue a couple more MII_TICKs then stop,
E> ifconfig will return "status: active", there will be no more stalls,
E> and, most importantly, the network connection will actually work.
E> 
E> Is this fixable and actually worth fixing?

Please try out the attached patch.

-- 
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE

Received on Fri Nov 25 2005 - 12:23:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC