lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1768209383-1546791-2-git-send-email-tariqt@nvidia.com>
Date: Mon, 12 Jan 2026 11:16:21 +0200
From: Tariq Toukan <tariqt@...dia.com>
To: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David
 S. Miller" <davem@...emloft.net>
CC: Jian Shen <shenjian15@...wei.com>, Salil Mehta <salil.mehta@...wei.com>,
	Jijie Shao <shaojijie@...wei.com>, Saeed Mahameed <saeedm@...dia.com>, "Tariq
 Toukan" <tariqt@...dia.com>, Mark Bloch <mbloch@...dia.com>, Leon Romanovsky
	<leon@...nel.org>, <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-rdma@...r.kernel.org>, Gal Pressman <gal@...dia.com>, Moshe Shemesh
	<moshe@...dia.com>, Shahar Shitrit <shshitrit@...dia.com>, Yael Chemla
	<ychemla@...dia.com>, Jamal Hadi Salim <jhs@...atatu.com>
Subject: [PATCH net-next V2 1/3] net: Introduce netif_xmit_timeout_ms() helper

From: Shahar Shitrit <shshitrit@...dia.com>

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@...dia.com>
Reviewed-by: Yael Chemla <ychemla@...dia.com>
Signed-off-by: Tariq Toukan <tariqt@...dia.com>
---
 include/net/netdev_queues.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

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;				\
-- 
2.31.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ