mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
net: Introduce netif_xmit_timeout_ms() helper
Introduce a new helper function netif_xmit_timeout_ms() to check if a TX queue is stopped and has timed out and report the timeout duration. This makes the timeout logic reusable, and will be used in several places in subsequent patches. Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com> Reviewed-by: Yael Chemla <ychemla@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1768209383-1546791-2-git-send-email-tariqt@nvidia.com Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
cc75d43783
commit
cfbc8b6bab
|
|
@ -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; \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user