Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'introduce-and-use-netif_xmit_timeout_ms-helper'

Tariq Toukan says:

====================
Introduce and use netif_xmit_timeout_ms() helper

This is V2, find V1 here:
https://lore.kernel.org/all/1764054776-1308696-1-git-send-email-tariqt@nvidia.com/

This series by Shahar introduces a new helper function
netif_xmit_timeout_ms() to check if a TX queue has timed out and report
the timeout duration.
It also encapsulates the check for whether the TX queue is stopped.

Replace duplicated open-coded timeout check in hns3 driver with the new
helper.

For mlx5e, refine the TX timeout recovery flow to act only on SQs whose
transmit timestamp indicates an actual timeout, as determined by the
helper. This prevents unnecessary channel reopen events caused by
attempting recovery on queues that are merely stopped but not truly
timed out.
====================

Link: https://patch.msgid.link/1768209383-1546791-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+17 -8
+5 -7
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 25 25 #include <net/tcp.h> 26 26 #include <net/vxlan.h> 27 27 #include <net/geneve.h> 28 + #include <net/netdev_queues.h> 28 29 29 30 #include "hnae3.h" 30 31 #include "hns3_enet.h" ··· 2808 2807 2809 2808 /* Find the stopped queue the same way the stack does */ 2810 2809 for (i = 0; i < ndev->num_tx_queues; i++) { 2810 + unsigned int timedout_ms; 2811 2811 struct netdev_queue *q; 2812 - unsigned long trans_start; 2813 2812 2814 2813 q = netdev_get_tx_queue(ndev, i); 2815 - trans_start = READ_ONCE(q->trans_start); 2816 - if (netif_xmit_stopped(q) && 2817 - time_after(jiffies, 2818 - (trans_start + ndev->watchdog_timeo))) { 2814 + timedout_ms = netif_xmit_timeout_ms(q); 2815 + if (timedout_ms) { 2819 2816 #ifdef CONFIG_BQL 2820 2817 struct dql *dql = &q->dql; 2821 2818 ··· 2822 2823 dql->adj_limit, dql->num_completed); 2823 2824 #endif 2824 2825 netdev_info(ndev, "queue state: 0x%lx, delta msecs: %u\n", 2825 - q->state, 2826 - jiffies_to_msecs(jiffies - trans_start)); 2826 + q->state, timedout_ms); 2827 2827 break; 2828 2828 } 2829 2829 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5137 5137 netdev_get_tx_queue(netdev, i); 5138 5138 struct mlx5e_txqsq *sq = priv->txq2sq[i]; 5139 5139 5140 - if (!netif_xmit_stopped(dev_queue)) 5140 + if (!netif_xmit_timeout_ms(dev_queue)) 5141 5141 continue; 5142 5142 5143 5143 if (mlx5e_reporter_tx_timeout(sq))
+11
include/net/netdev_queues.h
··· 310 310 netdev_tx_sent_queue(txq, bytes); 311 311 } 312 312 313 + static inline unsigned int netif_xmit_timeout_ms(struct netdev_queue *txq) 314 + { 315 + unsigned long trans_start = READ_ONCE(txq->trans_start); 316 + 317 + if (netif_xmit_stopped(txq) && 318 + time_after(jiffies, trans_start + txq->dev->watchdog_timeo)) 319 + return jiffies_to_msecs(jiffies - trans_start); 320 + 321 + return 0; 322 + } 323 + 313 324 #define netif_subqueue_maybe_stop(dev, idx, get_desc, stop_thrs, start_thrs) \ 314 325 ({ \ 315 326 struct netdev_queue *_txq; \