diff options
| author | Paolo Abeni <pabeni@redhat.com> | 2026-01-15 11:55:09 +0100 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-01-15 11:55:09 +0100 |
| commit | 8138fc46d9a44c0a3457028b9912cfd4406b35d1 (patch) | |
| tree | ed1615a88ed950c48bee6c64beb394b0f035a5e2 /include | |
| parent | cc75d43783f74fe0a1c288aba9e6ac55f1444977 (diff) | |
| parent | b0ba734516d201c217b23bf39782792b5404fb1c (diff) | |
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>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/netdev_queues.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index cd00e0406cf4..b55d3b9cb9c2 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -310,6 +310,17 @@ static inline void netif_subqueue_sent(const struct net_device *dev, netdev_tx_sent_queue(txq, bytes); } +static inline unsigned int netif_xmit_timeout_ms(struct netdev_queue *txq) +{ + unsigned long trans_start = READ_ONCE(txq->trans_start); + + if (netif_xmit_stopped(txq) && + time_after(jiffies, trans_start + txq->dev->watchdog_timeo)) + return jiffies_to_msecs(jiffies - trans_start); + + return 0; +} + #define netif_subqueue_maybe_stop(dev, idx, get_desc, stop_thrs, start_thrs) \ ({ \ struct netdev_queue *_txq; \ |
