[patch] drivers/net/3c59x: notice carrier a little sooner

2006-01-12 Thread Dan Williams
Hi,

This patch attempts to notice carrier 'on' state a little sooner.  Since
the carrier watchdog only fires in really, really long intervals (like,
60s in most cases), it takes up to 60s to notice that a cable has been
plugged/unplugged.  This patch fires the carrier watchdog if (1) the
carrier is off, and (2) packets have been successfully received.

Signed-off-by: Dan Williams [EMAIL PROTECTED]

--- a/drivers/net/3c59x.c   2006-01-12 12:58:46.0 -0500
+++ a/drivers/net/3c59x.c   2006-01-12 13:11:19.0 -0500
@@ -2574,6 +2574,7 @@
void __iomem *ioaddr = vp-ioaddr;
int i;
short rx_status;
+   unsigned long old_packets = vp-stats.rx_packets;
 
if (vortex_debug  5)
printk(KERN_DEBUG vortex_rx(): status %4.4x, rx_status 
%4.4x.\n,
@@ -2635,6 +2636,13 @@
issue_and_wait(dev, RxDiscard);
}
 
+   /* If we're successfully receiving packets but the carrier
+* isn't on, run the media check because we're probably
+* negotiated by now.
+*/
+   if ((vp-stats.rx_packets  old_packets)  !netif_carrier_ok (dev))
+   mod_timer(vp-timer, RUN_AT((1*HZ)/10));
+
return 0;
 }
 
@@ -2646,6 +2654,7 @@
void __iomem *ioaddr = vp-ioaddr;
int rx_status;
int rx_work_limit = vp-dirty_rx + RX_RING_SIZE - vp-cur_rx;
+   unsigned long old_packets = vp-stats.rx_packets;
 
if (vortex_debug  5)
printk(KERN_DEBUG boomerang_rx(): status %4.4x\n, 
ioread16(ioaddr+EL3_STATUS));
@@ -2733,6 +2742,14 @@
vp-rx_ring[entry].status = 0;  /* Clear complete bit. */
iowrite16(UpUnstall, ioaddr + EL3_CMD);
}
+
+   /* If we're successfully receiving packets but the carrier
+* isn't on, run the media check because we're probably
+* negotiated by now.
+*/
+   if ((vp-stats.rx_packets  old_packets)  !netif_carrier_ok (dev))
+   mod_timer(vp-timer, RUN_AT((1*HZ)/10));
+
return 0;
 }
 


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] drivers/net/3c59x: notice carrier a little sooner

2006-01-12 Thread Steffen Klassert
Did you give the patch a try?

Actually I have no possibility to test, but
I think that netif_carrier_{on,off} still does not
work proper. The timer function does just nothing
if vp-medialock is set.

Steffen


On Thu, Jan 12, 2006 at 01:29:23PM -0500, Dan Williams wrote:
 Hi,
 
 This patch attempts to notice carrier 'on' state a little sooner.  Since
 the carrier watchdog only fires in really, really long intervals (like,
 60s in most cases), it takes up to 60s to notice that a cable has been
 plugged/unplugged.  This patch fires the carrier watchdog if (1) the
 carrier is off, and (2) packets have been successfully received.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] drivers/net/3c59x: notice carrier a little sooner

2006-01-12 Thread Dan Williams
On Thu, 2006-01-12 at 20:57 +0100, Steffen Klassert wrote:
 Did you give the patch a try?
 
 Actually I have no possibility to test, but
 I think that netif_carrier_{on,off} still does not
 work proper. The timer function does just nothing
 if vp-medialock is set.
 
Worked for me with 3c905 card in a Dell Latitude C610.  I just cp'd the
code into the vortex, so maybe vortex is different than boomerang.
Anyway, shouldn't the timer be run a bit later after the *_rx()
function?

Dan

 Steffen
 
 
 On Thu, Jan 12, 2006 at 01:29:23PM -0500, Dan Williams wrote:
  Hi,
  
  This patch attempts to notice carrier 'on' state a little sooner.  Since
  the carrier watchdog only fires in really, really long intervals (like,
  60s in most cases), it takes up to 60s to notice that a cable has been
  plugged/unplugged.  This patch fires the carrier watchdog if (1) the
  carrier is off, and (2) packets have been successfully received.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] drivers/net/3c59x: notice carrier a little sooner

2006-01-12 Thread Steffen Klassert
On Thu, Jan 12, 2006 at 03:02:25PM -0500, Dan Williams wrote:
 On Thu, 2006-01-12 at 20:57 +0100, Steffen Klassert wrote:
  Did you give the patch a try?
  
  Actually I have no possibility to test, but
  I think that netif_carrier_{on,off} still does not
  work proper. The timer function does just nothing
  if vp-medialock is set.
  
 Worked for me with 3c905 card in a Dell Latitude C610.  I just cp'd the
 code into the vortex, so maybe vortex is different than boomerang.
 Anyway, shouldn't the timer be run a bit later after the *_rx()
 function?
 
 Dan

Of course the timer function should run in both cases.
If it works with the boomerang then it should work with vortex too.
I just remember that I had some problems with netif_carrier_ok()
when I tried to use ethtool_op_get_link about a year ago.
Perhaps I'm not up to date and it works in default case. 
I think a problem should appear at least
if one forces a certain media type. 
I still have a patch in queue to improve usage of netif_carrier_{on,off} 
but I had no possibility to test yet, so I did not send.

Steffen
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] drivers/net/3c59x: notice carrier a little sooner

2006-01-12 Thread Dan Williams
On Thu, 12 Jan 2006, Steffen Klassert wrote:

 On Thu, Jan 12, 2006 at 03:02:25PM -0500, Dan Williams wrote:
  On Thu, 2006-01-12 at 20:57 +0100, Steffen Klassert wrote:
   Did you give the patch a try?
   
   Actually I have no possibility to test, but
   I think that netif_carrier_{on,off} still does not
   work proper. The timer function does just nothing
   if vp-medialock is set.
   
  Worked for me with 3c905 card in a Dell Latitude C610.  I just cp'd the
  code into the vortex, so maybe vortex is different than boomerang.
  Anyway, shouldn't the timer be run a bit later after the *_rx()
  function?
  
  Dan
 
 Of course the timer function should run in both cases.
 If it works with the boomerang then it should work with vortex too.
 I just remember that I had some problems with netif_carrier_ok()
 when I tried to use ethtool_op_get_link about a year ago.
 Perhaps I'm not up to date and it works in default case. 
 I think a problem should appear at least
 if one forces a certain media type. 
 I still have a patch in queue to improve usage of netif_carrier_{on,off} 
 but I had no possibility to test yet, so I did not send.

I'd be happy to test it out if you'd like.

Dan
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html