From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Stanislav Fomichev <sdf@fomichev.me>, netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Subject: Re: [PATCH net-next v2 3/8] net: s/dev_get_mac_address/netif_get_mac_address/
Date: Mon, 30 Jun 2025 17:00:57 -0400 [thread overview]
Message-ID: <6862fb095090_183f832945b@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20250630164222.712558-4-sdf@fomichev.me>
Stanislav Fomichev wrote:
> Commit cc34acd577f1 ("docs: net: document new locking reality")
> introduced netif_ vs dev_ function semantics: the former expects locked
> netdev, the latter takes care of the locking. We don't strictly
> follow this semantics on either side, but there are more dev_xxx handlers
> now that don't fit. Rename them to netif_xxx where appropriate.
>
> netif_get_mac_address is used only by tun/tap, so move it into
> NETDEV_INTERNAL namespace.
>
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
> ---
> drivers/net/tap.c | 6 ++++--
> drivers/net/tun.c | 4 +++-
> include/linux/netdevice.h | 2 +-
> net/core/dev.c | 4 ++--
> net/core/dev_ioctl.c | 3 ++-
> net/core/net-sysfs.c | 2 +-
> 6 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/tap.c b/drivers/net/tap.c
> index bdf0788d8e66..4c85770c809b 100644
> --- a/drivers/net/tap.c
> +++ b/drivers/net/tap.c
> @@ -28,6 +28,8 @@
>
> #include "tun_vnet.h"
>
> +MODULE_IMPORT_NS("NETDEV_INTERNAL");
> +
> #define TAP_IFFEATURES (IFF_VNET_HDR | IFF_MULTI_QUEUE)
>
> static struct proto tap_proto = {
> @@ -1000,8 +1002,8 @@ static long tap_ioctl(struct file *file, unsigned int cmd,
> return -ENOLINK;
> }
> ret = 0;
> - dev_get_mac_address((struct sockaddr *)&ss, dev_net(tap->dev),
> - tap->dev->name);
> + netif_get_mac_address((struct sockaddr *)&ss, dev_net(tap->dev),
> + tap->dev->name);
> if (copy_to_user(&ifr->ifr_name, tap->dev->name, IFNAMSIZ) ||
> copy_to_user(&ifr->ifr_hwaddr, &ss, sizeof(ifr->ifr_hwaddr)))
> ret = -EFAULT;
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index f8c5e2fd04df..4509ae68decf 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -85,6 +85,8 @@
>
> #include "tun_vnet.h"
>
> +MODULE_IMPORT_NS("NETDEV_INTERNAL");
> +
Thanks for giving this a go. Now that you've implemented it, does the
risk (of overlooking callers, mainly) indeed seem acceptable?
Documentation/core-api/symbol-namespaces.rst says
It is advisable to add the MODULE_IMPORT_NS() statement close to other module
metadata definitions like MODULE_AUTHOR() or MODULE_LICENSE().
No need to respin just for this from me. Something to consider,
especially if anything else comes up.
Just curious, did you use the modpost and make nsdeps, or was it
sufficient to find the callers with tools like cscope and grep?
next prev parent reply other threads:[~2025-06-30 21:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 16:42 [PATCH net-next v2 0/8] net: maintain netif vs dev prefix semantics Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 1/8] net: s/dev_get_stats/netif_get_stats/ Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 2/8] net: s/dev_get_port_parent_id/netif_get_port_parent_id/ Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 3/8] net: s/dev_get_mac_address/netif_get_mac_address/ Stanislav Fomichev
2025-06-30 21:00 ` Willem de Bruijn [this message]
2025-06-30 23:19 ` Stanislav Fomichev
2025-07-01 18:59 ` Willem de Bruijn
2025-07-02 15:33 ` Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 4/8] net: s/dev_pre_changeaddr_notify/netif_pre_changeaddr_notify/ Stanislav Fomichev
2025-07-02 6:54 ` kernel test robot
2025-07-02 22:21 ` kernel test robot
2025-06-30 16:42 ` [PATCH net-next v2 5/8] net: s/__dev_set_mtu/__netif_set_mtu/ Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 6/8] net: s/dev_get_flags/netif_get_flags/ Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 7/8] net: s/dev_set_threaded/netif_set_threaded/ Stanislav Fomichev
2025-06-30 16:42 ` [PATCH net-next v2 8/8] net: s/dev_close_many/netif_close_many/ Stanislav Fomichev
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=6862fb095090_183f832945b@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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