netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way)
@ 2004-12-21  0:12 Peter Chubb
  2004-12-21  0:15 ` David S. Miller
  0 siblings, 1 reply; 19+ messages in thread
From: Peter Chubb @ 2004-12-21  0:12 UTC (permalink / raw)
  To: netdev


Hi,
	I've tracked down the problem I was having with the TG3
driver on the HP 16-way.  If you'll recall, the problem was that the
link was always marked as down, and autonegotiation was failing.



The problem is that the driver gives up before the switch that the NIC
is connected to has finished the negotiation phase.

Here's a simple patch.  I changed the way the loop works too, because
tg3_readphys() sets *val to 0xffffffff if it fails.

Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>

===== drivers/net/tg3.c 1.222 vs edited =====
--- 1.222/drivers/net/tg3.c	2004-11-15 23:53:08 +00:00
+++ edited/drivers/net/tg3.c	2004-12-21 00:00:58 +00:00
@@ -1554,10 +1554,11 @@ static int tg3_setup_copper_phy(struct t
 		}
 	}
 
-	bmsr = 0;
-	for (i = 0; i < 100; i++) {
-		tg3_readphy(tp, MII_BMSR, &bmsr);
+
+	for (i = 0; i < 1000; i++) {
 		tg3_readphy(tp, MII_BMSR, &bmsr);
+		if (tg3_readphy(tp, MII_BMSR, &bmsr))
+			bmsr = 0;
 		if (bmsr & BMSR_LSTATUS)
 			break;
 		udelay(40);

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way)
@ 2004-12-23  0:02 Michael Chan
  2004-12-23  4:31 ` David S. Miller
  2005-05-31 15:38 ` Grant Grundler
  0 siblings, 2 replies; 19+ messages in thread
From: Michael Chan @ 2004-12-23  0:02 UTC (permalink / raw)
  To: David S. Miller, Peter Chubb; +Cc: peterc, netdev

> Because callers are not supposed to depend upon the value 
> being set to anything valid if tg3_readphy() returns an error.
> 
> I thought it should never be returning an error at this spot. 
>  The PHY should always return a valid value within 
> PHY_BUSY_LOOPS.  If MI_COM_BUSY is staying set for such a 
> long time that's a pretty serious problem.
> 
> Taking a peek at the bcm5700 driver by Broadcom, they handle 
> all PHY read timeouts the way your patch does in this one 
> spot, by setting the returned value to zero.  So it seems the 
> device can time out like that in these situations, and your 
> patch is something close to the correct fix.
> 
> Good catch Peter, I'll think some more about this and 
> probably end up using something similar to your second patch.
> 
> Thanks.
> 

David, While the 2nd patch or something similar should be applied, I
think the underlying cause of tg3_readphy() returning error should be
further investigated.

Peter, if you provide more information, such as registers MAC_MI_MODE
(0x454) and MAC_MI_COM (0x44c) after the failure, I can look into it.

Michael

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way)
@ 2004-12-23  8:14 Michael Chan
  0 siblings, 0 replies; 19+ messages in thread
From: Michael Chan @ 2004-12-23  8:14 UTC (permalink / raw)
  To: David S. Miller; +Cc: peterc, netdev


> Would this condition be possible if something, such as ASF, were
> continually polling the PHY in parallel with the driver?

Without proper handshake with ASF, I think it may be possible if ASF is in a very tight loop polling the PHY. The tg3_readphy() poll loop is not very tight so it is possible to continually hit the busy condition if ASF is polling PHY registers. If this is the case, even if tg3_readphy() eventually gets the data, the data will most likely be from a different PHY register (that ASF is trying to read).
 
But I don't think this is an ASF related problem because if it were, the patch would not have fixed it.
 
Michael

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-05-31 19:03 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-21  0:12 TG3 fix for slow switches (Was: TG3 driver failure on HP 16-way) Peter Chubb
2004-12-21  0:15 ` David S. Miller
2004-12-21  1:11   ` Peter Chubb
2004-12-21  6:19     ` David S. Miller
2005-01-06 23:19     ` David S. Miller
2005-01-07  0:17       ` Darren Williams
2005-01-07  3:48         ` David S. Miller
2005-01-07  5:30           ` Darren Williams
2005-01-07  5:28             ` David S. Miller
2005-01-07  9:25               ` Darren Williams
  -- strict thread matches above, loose matches on Subject: below --
2004-12-23  0:02 Michael Chan
2004-12-23  4:31 ` David S. Miller
2005-05-31 15:38 ` Grant Grundler
2005-05-31 17:22   ` Michael Chan
2005-05-31 18:36     ` Grant Grundler
2005-05-31 17:42       ` Michael Chan
2005-05-31 19:03         ` Grant Grundler
2005-05-31 18:22           ` Michael Chan
2004-12-23  8:14 Michael Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).