Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Tonghao Zhang <tonghao@bamaicloud.com>
Cc: netdev@vger.kernel.org, Eran Ben Elisha <eranbe@mellanox.com>,
	Jiri Pirko <jiri@mellanox.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next v2] net: add net cookie for trace_net_dev_xmit_timeout
Date: Sun, 26 Oct 2025 17:13:39 +0200	[thread overview]
Message-ID: <aP46o8SvNCOICTxP@shredder> (raw)
In-Reply-To: <20251024121853.94199-1-tonghao@bamaicloud.com>

On Fri, Oct 24, 2025 at 08:18:53PM +0800, Tonghao Zhang wrote:
> In a multi-network card or container environment, provide more information.

I suggest explaining that this is needed in order to differentiate
between trace events relating to net devices that exist in different
network namespaces and share the same name.

> 
> [002] ..s1.  1838.311662: net_dev_xmit_timeout: dev=eth0 driver=virtio_net queue=10 net_cookie=3
> [007] ..s1.  1839.335650: net_dev_xmit_timeout: dev=eth4 driver=virtio_net queue=10 net_cookie=4100
> [007] ..s1.  1844.455659: net_dev_xmit_timeout: dev=eth0 driver=virtio_net queue=10 net_cookie=3
> [007] ..s1.  1845.479663: net_dev_xmit_timeout: dev=eth4 driver=virtio_net queue=10 net_cookie=4100
> [002] ..s1.  1850.087647: net_dev_xmit_timeout: dev=eth0 driver=virtio_net queue=10 net_cookie=3
> 
> Cc: Eran Ben Elisha <eranbe@mellanox.com>
> Cc: Jiri Pirko <jiri@mellanox.com>
> Cc: Cong Wang <xiyou.wangcong@gmail.com>
> Cc: Ido Schimmel <idosch@idosch.org>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Tonghao Zhang <tonghao@bamaicloud.com>
> ---
> v2: use net cookie instead of ifindex.
> ---
>  include/trace/events/net.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
> index d55162c12f90..8d064bf1ae7f 100644
> --- a/include/trace/events/net.h
> +++ b/include/trace/events/net.h
> @@ -107,16 +107,20 @@ TRACE_EVENT(net_dev_xmit_timeout,
>  		__string(	name,		dev->name	)
>  		__string(	driver,		netdev_drivername(dev))
>  		__field(	int,		queue_index	)
> +		__field(	u64,		net_cookie	)

Seems a bit random to only patch one trace event in this file. There are
other events that also print the net device name. I suggest patching
them as well.

>  	),
>  
>  	TP_fast_assign(
>  		__assign_str(name);
>  		__assign_str(driver);
>  		__entry->queue_index = queue_index;
> +		__entry->net_cookie = dev_net(dev)->net_cookie;
>  	),
>  
> -	TP_printk("dev=%s driver=%s queue=%d",
> -		__get_str(name), __get_str(driver), __entry->queue_index)
> +	TP_printk("dev=%s driver=%s queue=%d net_cookie=%llu",
> +		__get_str(name), __get_str(driver),
> +		__entry->queue_index,
> +		__entry->net_cookie)
>  );
>  
>  DECLARE_EVENT_CLASS(net_dev_template,
> -- 
> 2.34.1
> 

      reply	other threads:[~2025-10-26 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 12:18 [PATCH net-next v2] net: add net cookie for trace_net_dev_xmit_timeout Tonghao Zhang
2025-10-26 15:13 ` Ido Schimmel [this message]

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=aP46o8SvNCOICTxP@shredder \
    --to=idosch@idosch.org \
    --cc=eranbe@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tonghao@bamaicloud.com \
    --cc=xiyou.wangcong@gmail.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