Commit 8160fb43 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: use an atomic_long_t for queue->trans_timeout

tx_timeout_show() assumed dev_watchdog() would stop all
the queues, to fetch queue->trans_timeout under protection
of the queue->_xmit_lock.

As we want to no longer disrupt transmits, we use an
atomic_long_t instead.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: david decotigny <david.decotigny@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b32563b6
...@@ -592,7 +592,7 @@ struct netdev_queue { ...@@ -592,7 +592,7 @@ struct netdev_queue {
* Number of TX timeouts for this queue * Number of TX timeouts for this queue
* (/sys/class/net/DEV/Q/trans_timeout) * (/sys/class/net/DEV/Q/trans_timeout)
*/ */
unsigned long trans_timeout; atomic_long_t trans_timeout;
/* Subordinate device that the queue has been assigned to */ /* Subordinate device that the queue has been assigned to */
struct net_device *sb_dev; struct net_device *sb_dev;
......
...@@ -1201,11 +1201,7 @@ static const struct sysfs_ops netdev_queue_sysfs_ops = { ...@@ -1201,11 +1201,7 @@ static const struct sysfs_ops netdev_queue_sysfs_ops = {
static ssize_t tx_timeout_show(struct netdev_queue *queue, char *buf) static ssize_t tx_timeout_show(struct netdev_queue *queue, char *buf)
{ {
unsigned long trans_timeout; unsigned long trans_timeout = atomic_long_read(&queue->trans_timeout);
spin_lock_irq(&queue->_xmit_lock);
trans_timeout = queue->trans_timeout;
spin_unlock_irq(&queue->_xmit_lock);
return sprintf(buf, fmt_ulong, trans_timeout); return sprintf(buf, fmt_ulong, trans_timeout);
} }
......
...@@ -467,7 +467,7 @@ static void dev_watchdog(struct timer_list *t) ...@@ -467,7 +467,7 @@ static void dev_watchdog(struct timer_list *t)
time_after(jiffies, (trans_start + time_after(jiffies, (trans_start +
dev->watchdog_timeo))) { dev->watchdog_timeo))) {
some_queue_timedout = 1; some_queue_timedout = 1;
txq->trans_timeout++; atomic_long_inc(&txq->trans_timeout);
break; break;
} }
} }
......
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