ieee802154: avoid deprecated .ndo_do_ioctl callback
Subsystems (4)
PATCH v3 1/2 ieee802154: avoid deprecated .ndo_do_ioctl callback
From: Arnd Bergmann <[email protected]>
The ieee802154 socket implementation is the last remaining caller of the netdevice ioctl callback. In order to completely remove this, add a custom pointer to the existing wpan_dev specific operations structure. Since that structure is currently only used to wrap the 'create' header operation, adjust the naming slightly to make this more generic.
It would be a good idea to adjust the calling conventions and split the get/set operations into separate functions, but that can be a follow-up cleanup. For the moment, I kept the actual changes to a minimum to avoid regressions.
---
I found this one in my stack of old patches. It's been a while since v2, but the patch is still valid.
--- include/net/cfg802154.h | 9 +++++---- net/ieee802154/socket.c | 5 +++-- net/mac802154/iface.c | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-)
include/net/cfg802154.h +5 -4
@@ -458,15 +458,16 @@ struct ieee802154_llsec_device_key {u32 frame_counter; }; -struct wpan_dev_header_ops { +struct wpan_dev_ops {/* TODO create callback currently assumes ieee802154_mac_cb inside * skb->cb. This should be changed to give these information as * parameter. */ -int (*create)(struct sk_buff *skb,struct net_device *dev, +int (*header_create)(struct sk_buff *skb,struct net_device *dev,const struct ieee802154_addr *daddr,const struct ieee802154_addr *saddr,unsigned int len); +int (*ioctl)(struct net_device *dev,struct ifreq *ifr,int cmd); };struct wpan_dev {
@@ -477,7 +478,7 @@ struct wpan_dev {struct list_head list;struct net_device *netdev; -const struct wpan_dev_header_ops *header_ops; +const struct wpan_dev_ops *ops;/* lowpan interface, set when the wpan_dev belongs to one lowpan_dev */ struct net_device *lowpan_dev;
@@ -523,7 +524,7 @@ wpan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, {struct wpan_dev *wpan_dev = dev->ieee802154_ptr; -return wpan_dev->header_ops->create (skb, dev, daddr, saddr, len); +return wpan_dev->ops->header_create (skb, dev, daddr, saddr, len); }#endif
net/ieee802154/socket.c +3 -2
@@ -139,8 +139,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,if (!dev)return -ENODEV ; -if (dev->type ==ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) - ret = dev->netdev_ops->ndo_do_ioctl (dev, &ifr, cmd); +if (dev->type ==ARPHRD_IEEE802154 && dev->ieee802154_ptr && + dev->ieee802154_ptr->ops) + ret = dev->ieee802154_ptr->ops->ioctl (dev, &ifr, cmd);if (!ret &&put_user_ifreq (&ifr, arg)) ret = -EFAULT ;
net/mac802154/iface.c +4 -4
@@ -406,8 +406,9 @@ static int ieee802154_header_create(struct sk_buff *skb,return hlen; } -static const struct wpan_dev_header_ops ieee802154_header_ops = { - .create = ieee802154_header_create, +static const struct wpan_dev_ops ieee802154_ops = { + .header_create = ieee802154_header_create, + .ioctl = mac802154_wpan_ioctl, };/* This header create functionality assumes a 8 byte array for
@@ -497,7 +498,6 @@ static const struct net_device_ops mac802154_wpan_ops = { .ndo_open = mac802154_wpan_open, .ndo_stop = mac802154_slave_close, .ndo_start_xmit = ieee802154_subif_start_xmit, - .ndo_do_ioctl = mac802154_wpan_ioctl, .ndo_set_mac_address = mac802154_wpan_mac_addr, };
@@ -583,7 +583,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, sdata->dev->netdev_ops = &mac802154_wpan_ops; sdata->dev->ml_priv = &mac802154_mlme_wpan; sdata->iface_default_filtering =IEEE802154_FILTERING_4_FRAME_FIELDS ; - wpan_dev->header_ops = &ieee802154_header_ops; + wpan_dev->ops = &ieee802154_ops;mutex_init (&sdata->sec_mtx);
Signature · 1 line
2.53.0
PATCH v3 2/2 net: remove ndo_do_ioctl handler
From: Arnd Bergmann <[email protected]>
All of the references to the callback pointer are gone, so remove the pointer itself before we grow new references to it.
--- Documentation/networking/netdevices.rst | 7 ------- include/linux/netdevice.h | 7 ------- 2 files changed, 14 deletions(-)
Documentation/networking/netdevices.rst +0 -7
@@ -222,13 +222,6 @@ ndo_stop: Context: process Note: netif_running() is guaranteed false -ndo_do_ioctl: - Synchronization: rtnl_lock() semaphore. - - This is only called by network subsystems internally, - not by user space calling ioctl as it was in before - linux-5.14. - ndo_siocbond: Synchronization: rtnl_lock() semaphore. In addition, netdev instance lock if the driver implements queue management or shaper API.
include/linux/netdevice.h +0 -7
@@ -1154,11 +1154,6 @@ struct netdev_net_notifier {* int (*ndo_validate_addr)(struct net_device *dev); * Test if Media Access Control address is valid for the device. * -* int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); -* Old-style ioctl entry point. This is used internally by the -* ieee802154 subsystem but is no longer called by the device -* ioctl handler. -* * int (*ndo_siocbond)(struct net_device *dev, struct ifreq *ifr, int cmd); * Used by the bonding driver for its device specific ioctls: * SIOCBONDENSLAVE, SIOCBONDRELEASE, SIOCBONDSETHWADDR, SIOCBONDCHANGEACTIVE,
@@ -1480,8 +1475,6 @@ struct net_device_ops {int (*ndo_set_mac_address)(struct net_device *dev,void *addr);int (*ndo_validate_addr)(struct net_device *dev); -int (*ndo_do_ioctl)(struct net_device *dev, -struct ifreq *ifr,int cmd);int (*ndo_eth_ioctl)(struct net_device *dev,struct ifreq *ifr,int cmd); int (*ndo_siocbond)(struct net_device *dev,
Signature · 1 line
2.53.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 15 Sep 2026 23:14:03 +0200 you wrote:
From: Arnd Bergmann <[email protected]>
The ieee802154 socket implementation is the last remaining caller of the netdevice ioctl callback. In order to completely remove this, add a custom pointer to the existing
wpan_devspecific operations structure. Since that structure is currently only used to wrap the 'create' header operation, adjust the naming slightly to make this more generic.[...]
Here is the summary with links:
- [1/2,net-next,v3] ieee802154: avoid deprecated .ndo_do_ioctl callback
https://git.kernel.org/netdev/net-next/c/52fb7cca01e1 - [2/2,net-next,v3] net: remove ndo_do_ioctl handler https://git.kernel.org/netdev/net-next/c/d98a52ae914e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html