Skip to content

Commit 37adf10

Browse files
committed
net: cleanup init_dummy_netdev_core()
init_dummy_netdev_core() used to cater to net_devices which did not come from alloc_netdev_mqs(). Since that's no longer supported remove the init logic which duplicates alloc_netdev_mqs(). While at it rename back to init_dummy_netdev(). Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f835bda commit 37adf10

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

net/core/dev.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10736,26 +10736,20 @@ int register_netdevice(struct net_device *dev)
1073610736
EXPORT_SYMBOL(register_netdevice);
1073710737

1073810738
/* Initialize the core of a dummy net device.
10739-
* This is useful if you are calling this function after alloc_netdev(),
10740-
* since it does not memset the net_device fields.
10739+
* The setup steps dummy netdevs need which normal netdevs get by going
10740+
* through register_netdevice().
1074110741
*/
10742-
static void init_dummy_netdev_core(struct net_device *dev)
10742+
static void init_dummy_netdev(struct net_device *dev)
1074310743
{
1074410744
/* make sure we BUG if trying to hit standard
1074510745
* register/unregister code path
1074610746
*/
1074710747
dev->reg_state = NETREG_DUMMY;
1074810748

10749-
/* NAPI wants this */
10750-
INIT_LIST_HEAD(&dev->napi_list);
10751-
1075210749
/* a dummy interface is started by default */
1075310750
set_bit(__LINK_STATE_PRESENT, &dev->state);
1075410751
set_bit(__LINK_STATE_START, &dev->state);
1075510752

10756-
/* napi_busy_loop stats accounting wants this */
10757-
dev_net_set(dev, &init_net);
10758-
1075910753
/* Note : We dont allocate pcpu_refcnt for dummy devices,
1076010754
* because users of this 'device' dont need to change
1076110755
* its refcount.
@@ -11440,7 +11434,7 @@ EXPORT_SYMBOL(free_netdev);
1144011434
struct net_device *alloc_netdev_dummy(int sizeof_priv)
1144111435
{
1144211436
return alloc_netdev(sizeof_priv, "dummy#", NET_NAME_UNKNOWN,
11443-
init_dummy_netdev_core);
11437+
init_dummy_netdev);
1144411438
}
1144511439
EXPORT_SYMBOL_GPL(alloc_netdev_dummy);
1144611440

0 commit comments

Comments
 (0)