Commit a11ddcf3 authored by Mike Waychison's avatar Mike Waychison Committed by David S. Miller

[TG3]: Fix fiber hw autoneg bounces

We've recently noticed that the autonegotiation cleanup made a while
back (between tg3 3.8 and 3.9) has issues which make the link bounce up
and down.

I've traced it to be caused by the tg3_timer 1 second work noticing that
MAC_STATUS_LNKSTATE_CHANGED was set, which driver would see as the link
going down.

Upon further inspection, it appears that we don't wait long enough
between setting SG_DIG_CTRL and reading the SG_DIG_STATUS for the result.

The following patch (from a quasi recent bk tree) makes this code path
wait up to 200ms for the link to establish.  In my testing, I'm seeing
it take around 20ms for the negotiation to complete.

I haven't had the chance to test how this patch affects the case where
the switch doesn't have autoneg enabled, although I suspect fallback
should work correctly.

Please consider applying, thanks,
Signed-off-by: default avatarMike Waychison <michael.waychison@sun.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 667875c8
......@@ -2159,7 +2159,16 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status)
tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
} else if (mac_status & (MAC_STATUS_PCS_SYNCED |
MAC_STATUS_SIGNAL_DET)) {
int i;
/* Giver time to negotiate (~200ms) */
for (i = 0; i < 40000; i++) {
sg_dig_status = tr32(SG_DIG_STATUS);
if (sg_dig_status & (0x3))
break;
udelay(5);
}
mac_status = tr32(MAC_STATUS);
if ((sg_dig_status & (1 << 1)) &&
(mac_status & MAC_STATUS_PCS_SYNCED)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment