[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1327919763.2288.26.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date: Mon, 30 Jan 2012 11:36:03 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Denis Kirjanov <kirjanov@...il.com>
Cc: Ben Hutchings <ben@...adent.org.uk>,
"Mike ." <mike-bugreport@...mail.com>, 656476@...s.debian.org,
netdev <netdev@...r.kernel.org>
Subject: Re: Sundance network driver (D-Link DFE-580TX) timeouts rendering
interface unusable
Le lundi 30 janvier 2012 à 11:14 +0100, Eric Dumazet a écrit :
> Le lundi 30 janvier 2012 à 12:51 +0300, Denis Kirjanov a écrit :
> > I'll check this out. After kernel.org was cracked I've missed
> > @kernel.org mail account.
>
>
> At first glance, start_tx() is racy against TX completion.
>
> It does :
>
> if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1 &&
> !netif_queue_stopped(dev)) {
> /* do nothing */
> } else {
> netif_stop_queue (dev);
> }
>
> So it can call netif_stop_queue() while TX completion handler did a
> cleanup of all queued packets right before.
>
>
> Note intr_handler() doesnt hold the queue spinlock when it does :
>
> if (netif_queue_stopped(dev) &&
> np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
> /* The ring is no longer full, clear busy flag. */
> netif_wake_queue (dev);
> }
>
So I would try following patch :
drivers/net/ethernet/dlink/sundance.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c
index 28a3a9b..c671a6c 100644
--- a/drivers/net/ethernet/dlink/sundance.c
+++ b/drivers/net/ethernet/dlink/sundance.c
@@ -1099,11 +1099,13 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
tasklet_schedule(&np->tx_tasklet);
/* On some architectures: explicitly flush cache lines here. */
- if (np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 1 &&
- !netif_queue_stopped(dev)) {
- /* do nothing */
- } else {
- netif_stop_queue (dev);
+ if (np->cur_tx - np->dirty_tx >= TX_QUEUE_LEN - 1) {
+ unsigned long flags;
+
+ spin_lock_irqsave(&np->lock, flags);
+ if (np->cur_tx - np->dirty_tx >= TX_QUEUE_LEN - 1)
+ netif_stop_queue(dev);
+ spin_unlock_irqrestore(&np->lock, flags);
}
if (netif_msg_tx_queued(np)) {
printk (KERN_DEBUG
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists