Skip to content

Commit 8160fb4

Browse files
edumazetdavem330
authored andcommitted
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: Eric Dumazet <[email protected]> Cc: david decotigny <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b32563b commit 8160fb4

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

include/linux/netdevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ struct netdev_queue {
592592
* Number of TX timeouts for this queue
593593
* (/sys/class/net/DEV/Q/trans_timeout)
594594
*/
595-
unsigned long trans_timeout;
595+
atomic_long_t trans_timeout;
596596

597597
/* Subordinate device that the queue has been assigned to */
598598
struct net_device *sb_dev;

net/core/net-sysfs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,11 +1201,7 @@ static const struct sysfs_ops netdev_queue_sysfs_ops = {
12011201

12021202
static ssize_t tx_timeout_show(struct netdev_queue *queue, char *buf)
12031203
{
1204-
unsigned long trans_timeout;
1205-
1206-
spin_lock_irq(&queue->_xmit_lock);
1207-
trans_timeout = queue->trans_timeout;
1208-
spin_unlock_irq(&queue->_xmit_lock);
1204+
unsigned long trans_timeout = atomic_long_read(&queue->trans_timeout);
12091205

12101206
return sprintf(buf, fmt_ulong, trans_timeout);
12111207
}

net/sched/sch_generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ static void dev_watchdog(struct timer_list *t)
467467
time_after(jiffies, (trans_start +
468468
dev->watchdog_timeo))) {
469469
some_queue_timedout = 1;
470-
txq->trans_timeout++;
470+
atomic_long_inc(&txq->trans_timeout);
471471
break;
472472
}
473473
}

0 commit comments

Comments
 (0)