From: Greg KH <gregkh@linuxfoundation.org>
To: Til Kaiser <mail@tk154.de>
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
idosch@nvidia.com, petrm@nvidia.com
Subject: Re: [PATCH net-next v2] net: sysfs: also pass network device driver to uevent
Date: Fri, 6 Dec 2024 08:13:30 +0100 [thread overview]
Message-ID: <2024120613-unicycle-abruptly-02d1@gregkh> (raw)
In-Reply-To: <665459ff-9e99-4d22-9aeb-69c34be3db6b@tk154.de>
On Thu, Dec 05, 2024 at 05:28:47PM +0100, Til Kaiser wrote:
> On 19.11.24 02:55, Jakub Kicinski wrote:
> > On Sat, 16 Nov 2024 17:30:30 +0100 Til Kaiser wrote:
> > > Currently, for uevent, the interface name and
> > > index are passed via shell variables.
> > >
> > > This commit also passes the network device
> > > driver as a shell variable to uevent.
> > >
> > > One way to retrieve a network interface's driver
> > > name is to resolve its sysfs device/driver symlink
> > > and then substitute leading directory components.
> > >
> > > You could implement this yourself (e.g., like udev from
> > > systemd does) or with Linux tools by using a combination
> > > of readlink and shell substitution or basename.
> > >
> > > The advantages of passing the driver directly through uevent are:
> > > - Linux distributions don't need to implement additional code
> > > to retrieve the driver when, e.g., interface events happen.
Why does the driver name matter for something like a network device?
I.e. why are network devices "special" here and unlike all other class
devices in the kernel like keyboards, mice, serial ports, etc.?
> > > - There is no need to create additional process forks in shell
> > > scripts for readlink or basename.
"Do it in the kernel and have someone else maintain it for me to make my
life easier in userspace" isn't always the best reason to do something.
Generally if "you can do this in userspace" means "you SHOULD do this in
userspace", it's not a good reason to add it to the kernel.
And note, driver names change! How are you going to handle that?
> > > - If a user wants to check his network interface's driver on the
> > > command line, he can directly read it from the sysfs uevent file.
The symlink in sysfs shows this already, no need to
open/read/parse/close the uevent file.
Also, where did you now document this new user/kernel API that we have
to maintain for 40+ years? And what userspace tool is going to use it?
But really, again, why are network devices so special that they need
this but no other type of device in the kernel does? And what changed
to require this suddenly?
thanks,
greg k-h
prev parent reply other threads:[~2024-12-06 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 18:33 [PATCH net-next] net: uevent: also pass network device driver Til Kaiser
2024-11-15 22:06 ` Jakub Kicinski
2024-11-16 16:30 ` Til Kaiser
2024-11-16 16:30 ` [PATCH net-next v2] net: sysfs: also pass network device driver to uevent Til Kaiser
2024-11-19 1:55 ` Jakub Kicinski
2024-12-05 16:28 ` Til Kaiser
2024-12-06 7:13 ` Greg KH [this message]
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=2024120613-unicycle-abruptly-02d1@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@tk154.de \
--cc=netdev@vger.kernel.org \
--cc=petrm@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