Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: adrianox@gmail.com
Cc: alex.aring@gmail.com, stefan@datenfreihafen.org,
	miquel.raynal@bootlin.com, linux-wpan@vger.kernel.org,
	netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH 1/2] ieee802154: register a device type for the wpan netdev
Date: Tue, 08 Sep 2026 18:20:37 +0000	[thread overview]
Message-ID: <178889163770.219967.16467487407776248344@kernel.org> (raw)
In-Reply-To: <20260905212007.304875-1-adrianox@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 0

- [Medium] Commit message mischaracterizes both the pre-patch state and
  the effect of the change in net/ieee802154/core.c.

--

ieee802154: register a device type for the wpan netdev

This adds a wpan_dev_type with only a .name field and assigns it from a
new NETDEV_POST_INIT case in cfg802154_netdev_notifier_call(), replacing
the "TODO NETDEV_DEVTYPE" comment.  It mirrors what cfg80211 does with
wiphy_type in cfg80211_netdev_notifier_call().

> ieee802154: register a device type for the wpan netdev
>
>     The cfg802154 netdev notifier never sets a device type, so wpan
>     interfaces lack a sysfs "type". Mirror cfg80211 by calling
>     SET_NETDEV_DEVTYPE() in a NETDEV_POST_INIT case with a new
>     wpan_dev_type.

[Severity: Medium]
Is the statement "wpan interfaces lack a sysfs 'type'" accurate?  Every
netdev already gets a type file unconditionally from net/core/net-sysfs.c:

    NETDEVICE_SHOW_RO(type, fmt_dec);
    ...
    static struct attribute *net_class_attrs[] __ro_after_init = {
            ...
            &dev_attr_type.attr,

That attribute shows struct net_device::type, which for wpan interfaces is
already 804 (ARPHRD_IEEE802154), so /sys/class/net/<if>/type exists before
this patch.

The macro used here touches a different field:

    #define SET_NETDEV_DEVTYPE(net, devtype)        ((net)->dev.type = (devtype))

and a struct device_type carrying only .name creates no sysfs attribute
file at all.  The one observable effect is in dev_uevent() in
drivers/base/core.c:

    if (dev->type && dev->type->name)
            add_uevent_var(env, "DEVTYPE=%s", dev->type->name);

So the change adds a DEVTYPE=wpan key to the netdev uevent environment
(also visible in /sys/class/net/<if>/uevent), which is what the cfg80211
precedent does with .name = "wlan".

Could the changelog be reworded to describe that effect instead, and also
mention that this is a new userspace-visible uevent key?  udev and
systemd-networkd rules that match on Type= will now see wpan for
interfaces that previously exported no DEVTYPE.

The code change itself looks fine and consistent with
cfg80211_netdev_notifier_call().

> diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
> index c0b8712018a16..c6213412d2914 100644
> --- a/net/ieee802154/core.c
> +++ b/net/ieee802154/core.c
> @@ -272,6 +272,10 @@ void cfg802154_dev_free(struct cfg802154_registered_device *rdev)
>  	kfree(rdev);
>  }
>  
> +static const struct device_type wpan_dev_type = {
> +	.name	= "wpan",
> +};
> +
>  static void
>  cfg802154_update_iface_num(struct cfg802154_registered_device *rdev,
>  			   int iftype, int num)
> @@ -296,7 +300,9 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,
>  	/* TODO WARN_ON unspec type */
>  
>  	switch (state) {
> -		/* TODO NETDEV_DEVTYPE */
> +	case NETDEV_POST_INIT:
> +		SET_NETDEV_DEVTYPE(dev, &wpan_dev_type);
> +		break;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260905212007.304875-1-adrianox%40gmail.com

      parent reply	other threads:[~2026-09-08 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 21:20 [PATCH 1/2] ieee802154: register a device type for the wpan netdev Adriano Cordova
2026-09-05 21:20 ` [PATCH 2/2] ieee802154: warn on unspecific wpan interface type Adriano Cordova
2026-09-07  6:29   ` Miquel Raynal
2026-09-08 18:20   ` netdev-bot+sashiko
2026-09-07  6:29 ` [PATCH 1/2] ieee802154: register a device type for the wpan netdev Miquel Raynal
2026-09-08 18:20 ` netdev-bot+sashiko [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=178889163770.219967.16467487407776248344@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=adrianox@gmail.com \
    --cc=alex.aring@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    /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