On 6/9/26 2:42 PM, Matteo Perin via dev wrote:
> This commit adds the peer_ifindex to the interface status column for
> Linux veth devices, allowing applications like OVN to programmatically
> discover veth pairs without requiring additional system calls or manual
> configuration.
> 
> The implementation leverages the existing ethtool infrastructure:
> - Uses ETHTOOL_GDRVINFO to identify veth devices and get n_stats
> - Queries ETH_SS_STATS string set to get statistic names
> - Dynamically allocates buffer based on n_stats
> - Uses ETHTOOL_GSTATS to retrieve veth statistics
> - Finds peer_ifindex by name in the statistics array
> 
> The ifindex value is cached to avoid scalability issues with a
> considerable amount of ports.
> The cached peer_ifindex is then properly invalidated when the
> corresponding veth device is removed.
> This ensures that, when veth pairs are deleted and recreated with
> the same name, the new peer_ifindex is correctly detected and reported.
> 
> A test that create veth pairs across network namespaces, verifies
> peer_ifindex reporting, and validates correct detection of ifindex
> changes when pairs are recreated was added as well.
> 
> Signed-off-by: Matteo Perin <[email protected]>
> ---
>  lib/netdev-linux-private.h |  1 +
>  lib/netdev-linux.c         | 52 ++++++++++++++++++++++++++++++++++++++
>  tests/system-interface.at  | 48 +++++++++++++++++++++++++++++++++++
>  vswitchd/vswitch.xml       | 13 ++++++++++
>  4 files changed, 114 insertions(+)

I guess, I have one small comment for this one after all - we should
add a NEWS entry for the new user-visible functionality.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to