Skip to contentSkip to conversation

net: add the ifindex for trace_net_dev_xmit_timeout

PATCH In review Tonghao Zhang 3 participants 5 messages Oct 21, 2025 – Oct 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: add the ifindex for trace_net_dev_xmit_timeout

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

268.148239: net_dev_xmit_timeout: dev=eth0 ifindex=6 driver=virtio_net queue=10 274.292271: net_dev_xmit_timeout: dev=eth0 ifindex=6 driver=virtio_net queue=10 277.876231: net_dev_xmit_timeout: dev=eth1 ifindex=7 driver=virtio_net queue=10 279.924230: net_dev_xmit_timeout: dev=eth2 ifindex=8 driver=virtio_net queue=10 279.924233: net_dev_xmit_timeout: dev=eth0 ifindex=6 driver=virtio_net queue=10 282.996224: net_dev_xmit_timeout: dev=eth1 ifindex=7 driver=virtio_net queue=10

Cc Eran Ben Elisha <[email protected]>
Cc Jiri Pirko <[email protected]>
Cc Cong Wang <[email protected]>
---
 include/trace/events/net.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/trace/events/net.h +5 -2
index d55162c12f90..49f9fce69dd7 100644
@@ -107,16 +107,19 @@ TRACE_EVENT(net_dev_xmit_timeout,
 		__string(	name,		dev->name	)
 		__string(	driver,		netdev_drivername(dev))
 		__field(	int,		queue_index	)
+		__field(	int,		ifindex		)
 	),
 
 	TP_fast_assign(
 		__assign_str(name);
 		__assign_str(driver);
 		__entry->queue_index = queue_index;
+		__entry->ifindex = dev->ifindex;
 	),
 
-	TP_printk("dev=%s driver=%s queue=%d",
-		__get_str(name), __get_str(driver), __entry->queue_index)
+	TP_printk("dev=%s ifindex=%d driver=%s queue=%d",
+		__get_str(name), __entry->ifindex,
+		__get_str(driver), __entry->queue_index)
 );
 
 DECLARE_EVENT_CLASS(net_dev_template,
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · On Tue, 21 Oct 2025 17:19:00 +0800 Tonghao Zhang wrote:

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

Why do you think that ifindex is more accurate than the name? Neither is unique with netns..

Signature · 1 line
pw-bot: cr
#2 lore raw
Quoted 9 lines · Jakub Kicinski
Quoted 1 line · On Tue, 21 Oct 2025 17:19:00 +0800 Tonghao Zhang wrote:

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

Why do you think that ifindex is more accurate than the name? Neither is unique with netns..

I thought ifindex was globally unique, but in fact, different namespaces may have the same ifindex value. What about adding the ns.inum inode ?

Quoted 4 lines
Signature · 1 line
pw-bot: cr
#3 lore raw
Quoted 8 lines · Tonghao Zhang
Quoted 7 lines · Jakub Kicinski
Quoted 1 line · On Tue, 21 Oct 2025 17:19:00 +0800 Tonghao Zhang wrote:

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

Why do you think that ifindex is more accurate than the name? Neither is unique with netns..

I thought ifindex was globally unique, but in fact, different namespaces may have the same ifindex value. What about adding the ns.inum inode ?

The netns cookie is probably better. See this thread:

https://lore.kernel.org/netdev/[email protected]/

You can also retrieve it by attaching a BPF program to the tracepoint.

#4 lore raw
Quoted 10 lines · Ido Schimmel
Quoted 5 lines · Tonghao Zhang
Quoted 5 lines · Jakub Kicinski
Quoted 1 line · On Tue, 21 Oct 2025 17:19:00 +0800 Tonghao Zhang wrote:

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

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Why do you think that ifindex is more accurate than the name? Neither is unique with netns..

I thought ifindex was globally unique, but in fact, different namespaces may have the same ifindex value. What about adding the ns.inum inode ?

The netns cookie is probably better. See this thread:

https://lore.kernel.org/netdev/[email protected]/

That's a good idea, it's helpful to me.

Quoted 3 lines

You can also retrieve it by attaching a BPF program to the tracepoint.