netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Tenart <atenart@kernel.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: Antoine Tenart <atenart@kernel.org>,
	pabeni@redhat.com, juri.lelli@redhat.com, mhocko@suse.com,
	netdev@vger.kernel.org
Subject: [PATCH net-next 0/3] net: introduce a function to check if a netdev name is in use
Date: Thu,  7 Oct 2021 18:16:49 +0200	[thread overview]
Message-ID: <20211007161652.374597-1-atenart@kernel.org> (raw)

Hello,

This was initially part of an RFC series[1] but has value on its own;
hence the standalone report. (It will also help in not having a series
too large).

From patch 1:

"""
__dev_get_by_name is currently used to either retrieve a net device
reference using its name or to check if a name is already used by a
registered net device (per ns). In the later case there is no need to
return a reference to a net device.

Introduce a new helper, netdev_name_in_use, to check if a name is
currently used by a registered net device without leaking a reference
the corresponding net device. This helper uses netdev_name_node_lookup
instead of __dev_get_by_name as we don't need the extra logic retrieving
a reference to the corresponding net device.
"""

Two uses[2] of __dev_get_by_name weren't converted to this new function,
as they are really looking for a net device, not only checking if a net
device name is in use. While checking one or the other currently has
the same result, that might change if the initial RFC series moves
forward. I'll convert them later depending on the outcome of the initial
series.

Thanks,
Antoine

[1] https://lore.kernel.org/all/20210928125500.167943-1-atenart@kernel.org/
[2] drivers/net/Space.c:130 & drivers/nvme/host/tcp.c:2550

Antoine Tenart (3):
  net: introduce a function to check if a netdev name is in use
  bonding: use the correct function to check for netdev name collision
  ppp: use the correct function to check if a netdev name is in use

 drivers/net/bonding/bond_sysfs.c |  4 ++--
 drivers/net/ppp/ppp_generic.c    |  2 +-
 include/linux/netdevice.h        |  1 +
 net/core/dev.c                   | 14 ++++++++++----
 4 files changed, 14 insertions(+), 7 deletions(-)

-- 
2.31.1


             reply	other threads:[~2021-10-07 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 16:16 Antoine Tenart [this message]
2021-10-07 16:16 ` [PATCH net-next 1/3] net: introduce a function to check if a netdev name is in use Antoine Tenart
2021-10-07 16:16 ` [PATCH net-next 2/3] bonding: use the correct function to check for netdev name collision Antoine Tenart
2021-10-07 16:16 ` [PATCH net-next 3/3] ppp: use the correct function to check if a netdev name is in use Antoine Tenart
2021-10-08 16:30 ` [PATCH net-next 0/3] net: introduce a " patchwork-bot+netdevbpf

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=20211007161652.374597-1-atenart@kernel.org \
    --to=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=juri.lelli@redhat.com \
    --cc=kuba@kernel.org \
    --cc=mhocko@suse.com \
    --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).