* [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout
@ 2025-10-21 9:19 Tonghao Zhang
2025-10-22 0:10 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Tonghao Zhang @ 2025-10-21 9:19 UTC (permalink / raw)
To: netdev; +Cc: Tonghao Zhang, Eran Ben Elisha, Jiri Pirko, Cong Wang
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 <eranbe@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Tonghao Zhang <tonghao@bamaicloud.com>
---
include/trace/events/net.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/trace/events/net.h b/include/trace/events/net.h
index d55162c12f90..49f9fce69dd7 100644
--- a/include/trace/events/net.h
+++ b/include/trace/events/net.h
@@ -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,
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout
2025-10-21 9:19 [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout Tonghao Zhang
@ 2025-10-22 0:10 ` Jakub Kicinski
2025-10-22 8:31 ` Tonghao Zhang
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-10-22 0:10 UTC (permalink / raw)
To: Tonghao Zhang; +Cc: netdev, Eran Ben Elisha, Jiri Pirko, Cong Wang
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..
--
pw-bot: cr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout
2025-10-22 0:10 ` Jakub Kicinski
@ 2025-10-22 8:31 ` Tonghao Zhang
2025-10-22 10:45 ` Ido Schimmel
0 siblings, 1 reply; 5+ messages in thread
From: Tonghao Zhang @ 2025-10-22 8:31 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, Eran Ben Elisha, Jiri Pirko, Cong Wang
> On Oct 22, 2025, at 08:10, Jakub Kicinski <kuba@kernel.org> wrote:
>
> 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 ?
> --
> pw-bot: cr
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout
2025-10-22 8:31 ` Tonghao Zhang
@ 2025-10-22 10:45 ` Ido Schimmel
2025-10-22 13:23 ` Tonghao Zhang
0 siblings, 1 reply; 5+ messages in thread
From: Ido Schimmel @ 2025-10-22 10:45 UTC (permalink / raw)
To: Tonghao Zhang
Cc: Jakub Kicinski, netdev, Eran Ben Elisha, Jiri Pirko, Cong Wang
On Wed, Oct 22, 2025 at 04:31:34PM +0800, Tonghao Zhang wrote:
> > On Oct 22, 2025, at 08:10, Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > 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/c28ded3224734ca62187ed9a41f7ab39ceecb610.camel@fejes.dev/
You can also retrieve it by attaching a BPF program to the tracepoint.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout
2025-10-22 10:45 ` Ido Schimmel
@ 2025-10-22 13:23 ` Tonghao Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Tonghao Zhang @ 2025-10-22 13:23 UTC (permalink / raw)
To: Ido Schimmel
Cc: Jakub Kicinski, netdev, Eran Ben Elisha, Jiri Pirko, Cong Wang
> On Oct 22, 2025, at 18:45, Ido Schimmel <idosch@idosch.org> wrote:
>
> On Wed, Oct 22, 2025 at 04:31:34PM +0800, Tonghao Zhang wrote:
>>> On Oct 22, 2025, at 08:10, Jakub Kicinski <kuba@kernel.org> wrote:
>>>
>>> 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/c28ded3224734ca62187ed9a41f7ab39ceecb610.camel@fejes.dev/
That's a good idea, it's helpful to me.
>
> You can also retrieve it by attaching a BPF program to the tracepoint.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-22 13:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 9:19 [PATCH net-next] net: add the ifindex for trace_net_dev_xmit_timeout Tonghao Zhang
2025-10-22 0:10 ` Jakub Kicinski
2025-10-22 8:31 ` Tonghao Zhang
2025-10-22 10:45 ` Ido Schimmel
2025-10-22 13:23 ` Tonghao Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).