diff options
author | 2025-04-09 18:42:46 -0700 | |
---|---|---|
committer | 2025-04-14 14:29:54 -0700 | |
commit | 097f171f98289cf737437599c40b0d1e81266e9e (patch) | |
tree | 4f3079aa81f9ec85cfa42b8b0b4bf694446d180a /net/core/dev.c | |
parent | udp: properly deal with xfrm encap and ADDRFORM (diff) | |
download | wireguard-linux-097f171f98289cf737437599c40b0d1e81266e9e.tar.xz wireguard-linux-097f171f98289cf737437599c40b0d1e81266e9e.zip |
net: convert dev->rtnl_link_state to a bool
netdevice reg_state was split into two 16 bit enums back in 2010
in commit a2835763e130 ("rtnetlink: handle rtnl_link netlink
notifications manually"). Since the split the fields have been
moved apart, and last year we converted reg_state to a normal
u8 in commit 4d42b37def70 ("net: convert dev->reg_state to u8").
rtnl_link_state being a 16 bitfield makes no sense. Convert it
to a single bool, it seems very unlikely after 15 years that
we'll need more values in it.
We could drop dev->rtnl_link_ops from the conditions but feels
like having it there more clearly points at the reason for this
hack.
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250410014246.780885-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d0563ddff6ca..03d20a98f8b7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -11110,8 +11110,7 @@ int register_netdevice(struct net_device *dev) * Prevent userspace races by waiting until the network * device is fully setup before sending notifications. */ - if (!dev->rtnl_link_ops || - dev->rtnl_link_state == RTNL_LINK_INITIALIZED) + if (!(dev->rtnl_link_ops && dev->rtnl_link_initializing)) rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U, GFP_KERNEL, 0, NULL); out: @@ -12025,8 +12024,7 @@ void unregister_netdevice_many_notify(struct list_head *head, */ call_netdevice_notifiers(NETDEV_UNREGISTER, dev); - if (!dev->rtnl_link_ops || - dev->rtnl_link_state == RTNL_LINK_INITIALIZED) + if (!(dev->rtnl_link_ops && dev->rtnl_link_initializing)) skb = rtmsg_ifinfo_build_skb(RTM_DELLINK, dev, ~0U, 0, GFP_KERNEL, NULL, 0, portid, nlh); |