Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: add net cookie for trace_net_dev_xmit_timeout
@ 2025-10-24 12:18 Tonghao Zhang
  2025-10-26 15:13 ` Ido Schimmel
  0 siblings, 1 reply; 2+ messages in thread
From: Tonghao Zhang @ 2025-10-24 12:18 UTC (permalink / raw)
  To: netdev
  Cc: Tonghao Zhang, Eran Ben Elisha, Jiri Pirko, Cong Wang,
	Ido Schimmel, Jakub Kicinski

In a multi-network card or container environment, provide more information.

[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	)
 	),
 
 	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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2] net: add net cookie for trace_net_dev_xmit_timeout
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Ido Schimmel @ 2025-10-26 15:13 UTC (permalink / raw)
  To: Tonghao Zhang
  Cc: netdev, Eran Ben Elisha, Jiri Pirko, Cong Wang, Jakub Kicinski

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-26 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox