net: un-export init_dummy_netdev()
Subsystems (2)
Jakub Kicinski
maintainerPATCH 1/2 net: un-export init_dummy_netdev()
There are no in-tree module callers of init_dummy_netdev(), AFAICT.
--- net/core/dev.c | 1 - 1 file changed, 1 deletion(-)
net/core/dev.c +0 -1
@@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev)memset (dev,0 ,sizeof (struct net_device ));init_dummy_netdev_core (dev); } -EXPORT_SYMBOL_GPL (init_dummy_netdev);/** * register_netdev - register a network device
Signature · 1 line
2.47.1
Jakub Kicinski
maintainerPATCH 2/2 net: initialize netdev->lock on dummy devices
Make sure netdev->lock is always valid, even on dummy netdevs.
Apparently it's legal to call mutex_destroy() on an uninitialized mutex (and we do that in free_netdev()), but it doesn't seem right. Plus we'll soon want to take netdev->lock on more paths which dummy netdevs may reach.
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
@@ -10756,6 +10756,8 @@ static void init_dummy_netdev_core(struct net_device *dev)/* napi_busy_loop stats accounting wants this */ dev_net_set (dev, &init_net); +mutex_init (&dev->lock); +/* Note : We dont allocate pcpu_refcnt for dummy devices, * because users of this 'device' dont need to change * its refcount.
Signature · 1 line
2.47.1
Re: [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices
Quoted 6 lines · Jakub Kicinski
Make sure
netdev->lockis always valid, even on dummy netdevs.Apparently it's legal to call
mutex_destroy()on an uninitialized mutex (and we do that infree_netdev()), but it doesn't seem right. Plus we'll soon want to takenetdev->lockon more paths which dummy netdevs may reach.
I assume here that dummy does not call alloc_netdev_mqs() or one of it wrappers? That is how the lock seems to get initialised for real MAC drivers. Are there other bits of initialisation in that function which dummy is missing? Should we really be refactoring alloc_netdev_mqs() to expose an initialisation helper for everything which is not related queues?
Andrew
Jakub Kicinski
maintainerRe: [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices
Quoted 10 lines · On Sat, 11 Jan 2025 19:58:40 +0100 Andrew Lunn wrote:
Quoted 6 lines · Jakub Kicinski
Make sure
netdev->lockis always valid, even on dummy netdevs.Apparently it's legal to call
mutex_destroy()on an uninitialized mutex (and we do that infree_netdev()), but it doesn't seem right. Plus we'll soon want to takenetdev->lockon more paths which dummy netdevs may reach.I assume here that dummy does not call
alloc_netdev_mqs()or one of it wrappers?
Yes, we have both dummies which go thru alloc and static ones.
Quoted 5 lines
That is how the lock seems to get initialised for real MAC drivers. Are there other bits of initialisation in that function which dummy is missing? Should we really be refactoring
alloc_netdev_mqs()to expose an initialisation helper for everything which is not related queues?
You make a good point. Let me do the opposite, we only have two callers of init_dummy_netdev(). Instead of unexporting it let me delete it completely and make the two callers allocate the netdevs with alloc_netdev_mqs().
Signature · 1 line
pw-bot: cr
Quoted 21 lines · Jakub Kicinski
There are no in-tree module callers of
init_dummy_netdev(), AFAICT.Signed-off-by Jakub Kicinski <[email protected]>--- net/core/dev.c | 1 - 1 file changed, 1 deletion(-)net/core/dev.c +0
-2@@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev)memset (dev,0 ,sizeof (struct net_device ));init_dummy_netdev_core (dev); } -EXPORT_SYMBOL_GPL (init_dummy_netdev);/** * register_netdev - register a network device --
Quoted 3 lines
2.47.1
I can see that "net/xfrm/xfrm_input.c" and "net/mptcp/protocol.c" are invoking init_dummy_netdev() in the init routines.
Signature · 2 lines
Regards, Kalesh AP
My bad, missed the V2 of the series. Please ignore my comment.
Quoted 32 lines · Kalesh Anakkur Purayil
Quoted 21 lines · Jakub Kicinski
There are no in-tree module callers of
init_dummy_netdev(), AFAICT.Signed-off-by Jakub Kicinski <[email protected]>--- net/core/dev.c | 1 - 1 file changed, 1 deletion(-)net/core/dev.c +0
-2@@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev)memset (dev,0 ,sizeof (struct net_device ));init_dummy_netdev_core (dev); } -EXPORT_SYMBOL_GPL (init_dummy_netdev);/** * register_netdev - register a network device -- Quoted 3 lines
2.47.1
I can see that "
net/xfrm/xfrm_input.c" and "net/mptcp/protocol.c" are invokinginit_dummy_netdev()in the init routines.--
Regards,
Kalesh AP
Signature · 2 lines
Regards, Kalesh AP
Quoted 19 lines · Kalesh Anakkur Purayil
Quoted 18 lines · Jakub Kicinski
There are no in-tree module callers of
init_dummy_netdev(), AFAICT.Signed-off-by Jakub Kicinski <[email protected]>--- net/core/dev.c | 1 - 1 file changed, 1 deletion(-)net/core/dev.c +0
-1@@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev)memset (dev,0 ,sizeof (struct net_device ));init_dummy_netdev_core (dev); } -EXPORT_SYMBOL_GPL (init_dummy_netdev);
Quoted 8 lines
Quoted 6 lines
net/core/dev.c +0
-1/** * register_netdev - register a network device -- 2.47.1
I can see that "
net/xfrm/xfrm_input.c" and "net/mptcp/protocol.c" are invokinginit_dummy_netdev()in the init routines.
I thought that initially. And then i checked that they can only be built in. You only need exports for modules.
Andrew
Quoted 30 lines · Andrew Lunn
Quoted 19 lines · Kalesh Anakkur Purayil
Quoted 18 lines · Jakub Kicinski
There are no in-tree module callers of
init_dummy_netdev(), AFAICT.Signed-off-by Jakub Kicinski <[email protected]>--- net/core/dev.c | 1 - 1 file changed, 1 deletion(-)net/core/dev.c +0
-1@@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev)memset (dev,0 ,sizeof (struct net_device ));init_dummy_netdev_core (dev); } -EXPORT_SYMBOL_GPL (init_dummy_netdev);Quoted 8 lines
Quoted 6 lines
net/core/dev.c +0
-1/** * register_netdev - register a network device -- 2.47.1
I can see that "
net/xfrm/xfrm_input.c" and "net/mptcp/protocol.c" are invokinginit_dummy_netdev()in the init routines.
Quoted 2 lines
I thought that initially. And then i checked that they can only be built in. You only need exports for modules.
Got it, thank you Andrew for the clarification.
Quoted 2 lines
Andrew
Signature · 2 lines
Regards, Kalesh AP