* [PATCH] (4/4) acenic - don't spin forever in hard_start_xmit
@ 2004-09-20 17:47 Stephen Hemminger
2004-09-20 18:46 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2004-09-20 17:47 UTC (permalink / raw)
To: Jes Sorensen, Jeff Garzik; +Cc: netdev
If driver is stuck due to ring full and hardware or link error, don't spin
forever in the hard_start_xmit routine.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c
--- a/drivers/net/acenic.c 2004-09-20 10:47:22 -07:00
+++ b/drivers/net/acenic.c 2004-09-20 10:47:22 -07:00
@@ -2499,6 +2499,7 @@
struct ace_regs __iomem *regs = ap->regs;
struct tx_desc *desc;
u32 idx, flagsize;
+ unsigned long maxjiff = jiffies + 3*HZ;
restart:
idx = ap->tx_prd;
@@ -2602,7 +2603,7 @@
}
dev->trans_start = jiffies;
- return 0;
+ return NETDEV_TX_OK;
overflow:
/*
@@ -2621,8 +2622,15 @@
* Alternative is to return with 1 not throttling queue. In this
* case loop becomes longer, no more useful effects.
*/
- barrier();
- goto restart;
+ if (time_before(jiffies, maxjiff)) {
+ barrier();
+ cpu_relax();
+ goto restart;
+ }
+
+ /* The ring is stuck full. */
+ printk(KERN_WARNING "%s: Transmit ring stuck full\n", dev->name);
+ return NETDEV_TX_BUSY;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] (4/4) acenic - don't spin forever in hard_start_xmit
2004-09-20 17:47 [PATCH] (4/4) acenic - don't spin forever in hard_start_xmit Stephen Hemminger
@ 2004-09-20 18:46 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-09-20 18:46 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: jes, jgarzik, netdev
On Mon, 20 Sep 2004 10:47:24 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:
> + /* The ring is stuck full. */
> + printk(KERN_WARNING "%s: Transmit ring stuck full\n", dev->name);
> + return NETDEV_TX_BUSY;
OK, but only because it's a long timeout and the kernel log
gets a reasonable message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-20 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-20 17:47 [PATCH] (4/4) acenic - don't spin forever in hard_start_xmit Stephen Hemminger
2004-09-20 18:46 ` David S. Miller
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).