Re: [RFC net-next v2 2/6] ethtool: Add loopback GET/SET netlink implementation
From: Maxime Chevallier
Date: Mon Mar 09 2026 - 03:37:10 EST
Hi Björn,
On 08/03/2026 13:40, Björn Töpel wrote:
> Add the kernel-side ETHTOOL_MSG_LOOPBACK_GET,
> ETHTOOL_MSG_LOOPBACK_SET, and ETHTOOL_MSG_LOOPBACK_NTF handlers using
> the standard ethnl_request_ops infrastructure.
>
> GET collects loopback entries from per-component helpers via
> loopback_get_entries(). SET parses the nested entry attributes,
> dispatches each to loopback_set_one(), and only sends a notification
> when the state is changed.
>
> No components are wired yet.
>
> Signed-off-by: Björn Töpel <bjorn@xxxxxxxxxx>
At a first glance, what I see is that you're using the GET ->doit method
to retrieve an array of loopback entries. The pefered approach in that
case is to use the GET ->dumpit command instead, issueing a netlink DUMP
request to list all available loopback entities on a given netdev.
If you want some reference on that, take a look at the phy.c + the
'perphy' helpers in net/ethtool/netlink.c
The idea is that you can pass a netdev ifindex in the header of the DUMP
request, which you can use to dump all loopbacks the passed netdev.
You can also check the ethtool code itself, you'll see that when you use
the "ethtool --show-phys eth0" command for example, it issues a DUMP
request to the kernel.
I'll continue the review w.r.t the actual content of the messages :)
Maxime