net: add the ifindex for trace_net_dev_xmit_timeout
Subsystems (3)
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
--- include/trace/events/net.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
include/trace/events/net.h +5 -2
@@ -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
Jakub Kicinski
maintainerQuoted 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
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
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.
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:
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.