From: Shahar Shitrit <shshitrit@nvidia.com>
To: Paolo Abeni <pabeni@redhat.com>, Tariq Toukan <tariqt@nvidia.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>
Cc: Jian Shen <shenjian15@huawei.com>,
Salil Mehta <salil.mehta@huawei.com>,
Jijie Shao <shaojijie@huawei.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Mark Bloch <mbloch@nvidia.com>, Leon Romanovsky <leon@kernel.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org, Gal Pressman <gal@nvidia.com>,
Moshe Shemesh <moshe@nvidia.com>,
Yael Chemla <ychemla@nvidia.com>
Subject: Re: [PATCH net-next 1/3] net: Introduce netif_xmit_time_out_duration() helper
Date: Thu, 27 Nov 2025 15:53:50 +0200 [thread overview]
Message-ID: <076e1623-6344-470a-bdff-d8a594ce17d6@nvidia.com> (raw)
In-Reply-To: <383aed26-aa07-4759-92b9-5448161ba6a4@redhat.com>
On 27/11/2025 12:53, Paolo Abeni wrote:
> On 11/25/25 8:12 AM, Tariq Toukan wrote:
>> From: Shahar Shitrit <shshitrit@nvidia.com>
>>
>> Introduce a new helper function netif_xmit_time_out_duration() to
>> check if a TX queue has timed out and report the timeout duration.
>> This helper consolidates the logic that is duplicated in several
>> locations and also encapsulates the check for whether the TX queue
>> is stopped.
>>
>> As the first user, convert dev_watchdog() to use this helper.
>>
>> Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com>
>> Reviewed-by: Yael Chemla <ychemla@nvidia.com>
>> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
>> ---
>> include/linux/netdevice.h | 15 +++++++++++++++
>> net/sched/sch_generic.c | 7 +++----
>> 2 files changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index e808071dbb7d..3cd73769fcfa 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -3680,6 +3680,21 @@ static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
>> return dev_queue->state & QUEUE_STATE_ANY_XOFF;
>> }
>>
>> +static inline unsigned int
>> +netif_xmit_timeout_ms(struct netdev_queue *txq, unsigned long *trans_start)
>> +{
>> + unsigned long txq_trans_start = READ_ONCE(txq->trans_start);
>> +
>> + if (trans_start)
>> + *trans_start = txq_trans_start;
>
> What about making this argument mandatory?
Since not all callers are interested in this return value, as in the
case of mlx5, it would be nice to allow them pass NULL.>
>> +
>> + if (netif_xmit_stopped(txq) &&
>
> Why restricting to the <queue stopped> case? AFAICS the watchdog is
> intended to additionally catch the scenarios where the rx ring is not
> full but the H/W is stuck for whatever reasons, and this change will not
> catch them anymore.
>
> /P
>
dev_watchdog catches only the cases where tx queue is both full (queue
stopped) and timed out (last transmit timestamp was longer ago than the
watchdog timeout period). We wanted to preserve the same conditions.
By the way, I notice now that the new helper name in the title doesn't
match the one in the code. We will fix.
next prev parent reply other threads:[~2025-11-27 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 7:12 [PATCH net-next 0/3] Introduce and use netif_xmit_timeout_ms() helper Tariq Toukan
2025-11-25 7:12 ` [PATCH net-next 1/3] net: Introduce netif_xmit_time_out_duration() helper Tariq Toukan
2025-11-27 10:53 ` Paolo Abeni
2025-11-27 13:53 ` Shahar Shitrit [this message]
2025-11-28 1:34 ` Jakub Kicinski
2026-01-04 8:39 ` Shahar Shitrit
2025-11-25 7:12 ` [PATCH net-next 2/3] net: hns3: Use netif_xmit_timeout_ms() helper Tariq Toukan
2025-11-25 7:12 ` [PATCH net-next 3/3] net/mlx5e: Refine TX timeout handling to skip non-timed-out SQ Tariq Toukan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=076e1623-6344-470a-bdff-d8a594ce17d6@nvidia.com \
--to=shshitrit@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=salil.mehta@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=tariqt@nvidia.com \
--cc=xiyou.wangcong@gmail.com \
--cc=ychemla@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®