From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Björn Töpel" <bjorn@kernel.org>,
netdev@vger.kernel.org, "Donald Hunter" <donald.hunter@gmail.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Andrew Lunn" <andrew+netdev@lunn.ch>
Cc: Andrew Lunn <andrew@lunn.ch>,
Michael Chan <michael.chan@broadcom.com>,
Hariprasad Kelam <hkelam@marvell.com>,
Ido Schimmel <idosch@nvidia.com>,
Danielle Ratson <danieller@nvidia.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
Russell King <linux@armlinux.org.uk>
Subject: Re: [RFC net-next v2 2/6] ethtool: Add loopback GET/SET netlink implementation
Date: Mon, 9 Mar 2026 17:14:04 +0100 [thread overview]
Message-ID: <ee7febab-7005-487f-b42e-365757f7032b@bootlin.com> (raw)
In-Reply-To: <87y0k1njid.fsf@all.your.base.are.belong.to.us>
On 09/03/2026 15:51, Björn Töpel wrote:
> Björn Töpel <bjorn@kernel.org> writes:
>
>> Maxime Chevallier <maxime.chevallier@bootlin.com> writes:
>>
>>> 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@kernel.org>
>>>
>>> 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.
>>
>> Ah, got it! Thanks!
>
> Thanks for pointing this out! I like how using this can get rid of the
> fixed size array in struct ethtool_loopback_cfg, which had a bad smell
> to me.
>
> Thinking out loud -- Now, using a similar scheme for loopback requires
> some thought around the sub-iterator: Loopback has "multiple"
> sub-iterator: (component, [id], name)... or needs scheme to deal with
> one sub-iter, and loopback can share a lot of code with the
> perphy-functions.
yeah, at some point in the past I played around with the idea of more
generic ethnl helpers for filtered DUMP requests :
https://lore.kernel.org/netdev/20250324104012.367366-1-maxime.chevallier@bootlin.com/
At that time, the PHY usecase was the main user so I ended-up ditching
that in favor of the more specific perphy helpers we have today, after
discussing the matter with Jakub.
Now that we're seeing more and more ethnl DUMP commands that can take a
netdev ifindex in the request, maybe some of that code above can be useful
for you and we can resurect this approach ?
Maxime
>
>
> Björn
next prev parent reply other threads:[~2026-03-09 16:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-08 12:40 [RFC net-next v2 0/6] ethtool: Generic loopback support Björn Töpel
2026-03-08 12:40 ` [RFC net-next v2 1/6] ethtool: Add loopback netlink UAPI definitions Björn Töpel
2026-03-09 14:16 ` Maxime Chevallier
2026-03-09 14:59 ` Björn Töpel
2026-03-09 16:45 ` Andrew Lunn
2026-03-10 10:23 ` Maxime Chevallier
2026-03-10 13:56 ` Andrew Lunn
2026-03-08 12:40 ` [RFC net-next v2 2/6] ethtool: Add loopback GET/SET netlink implementation Björn Töpel
2026-03-09 7:34 ` Maxime Chevallier
2026-03-09 8:21 ` Björn Töpel
2026-03-09 14:51 ` Björn Töpel
2026-03-09 16:14 ` Maxime Chevallier [this message]
2026-03-08 12:40 ` [RFC net-next v2 3/6] ethtool: add CMIS loopback helpers for module loopback control Björn Töpel
2026-03-08 12:40 ` [RFC net-next v2 4/6] selftests: drv-net: Add loopback driver test Björn Töpel
2026-03-08 12:40 ` [RFC net-next v2 5/6] netdevsim: Add module EEPROM simulation via debugfs Björn Töpel
2026-03-08 12:40 ` [RFC net-next v2 6/6] selftests: drv-net: Add CMIS loopback netdevsim test Björn Töpel
2026-03-09 13:49 ` [RFC net-next v2 0/6] ethtool: Generic loopback support Naveen Mamindlapalli
2026-03-09 14:55 ` Björn Töpel
2026-03-10 7:35 ` Naveen Mamindlapalli
2026-03-10 14:00 ` Andrew Lunn
2026-03-11 5:59 ` Naveen Mamindlapalli
2026-03-11 12:32 ` Andrew Lunn
2026-03-11 16:52 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee7febab-7005-487f-b42e-365757f7032b@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=bjorn@kernel.org \
--cc=danieller@nvidia.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=hkelam@marvell.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox