From: Andrew Lunn <andrew@lunn.ch>
To: Ivan Safonov <insafonov@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jiri Pirko <jiri@resnulli.us>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Lorenzo Bianconi <lorenzo@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: fix register_netdev description
Date: Mon, 7 Oct 2024 00:48:24 +0200 [thread overview]
Message-ID: <a230dbf8-2390-4cbc-9aa6-ef3cd052dcc6@lunn.ch> (raw)
In-Reply-To: <1ebce461-e4eb-4f10-9de8-19240193b262@gmail.com>
On Mon, Oct 07, 2024 at 01:00:19AM +0300, Ivan Safonov wrote:
>
>
> On 10/7/24 00:16, Andrew Lunn wrote:
> > On Sun, Oct 06, 2024 at 08:57:20PM +0300, Ivan Safonov wrote:
> > > register_netdev() does not expands the device name.
> >
> > Please could you explain what makes you think it will not expand the
> > device name.
> >
> > Andrew
>
> It is the register_netdev implementation:
>
> > int register_netdev(struct net_device *dev)
> > {
> > int err;
> >
> > if (rtnl_lock_killable())
> > return -EINTR;
> > err = register_netdevice(dev);
> > rtnl_unlock();
> > return err;
> > }
>
> There is no device name expansion, rtnl lock and register_netdevice call
> only. The register_netdevice expands device name using dev_get_valid_name().
* Take a completed network device structure and add it to the kernel
* interfaces. A %NETDEV_REGISTER message is sent to the netdev notifier
* chain. 0 is returned on success. A negative errno code is returned
* on a failure to set up the device, or if the name is a duplicate.
*
* This is a wrapper around register_netdevice that takes the rtnl semaphore
* and expands the device name if you passed a format string to
* alloc_netdev.
So you are taking this comment to mean the wrapper. Then yes, the
wrapper does not expand the device nice. So please move the text about
expanding the name earlier. It is an important part of registering a
netdev, so should be mentioned.
Andrew
---
pw-bot: cr
prev parent reply other threads:[~2024-10-06 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-06 17:57 [PATCH v2] net: fix register_netdev description Ivan Safonov
2024-10-06 21:16 ` Andrew Lunn
2024-10-06 22:00 ` Ivan Safonov
2024-10-06 22:48 ` Andrew Lunn [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=a230dbf8-2390-4cbc-9aa6-ef3cd052dcc6@lunn.ch \
--to=andrew@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=insafonov@gmail.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).