Skip to content

Commit 7ffbe3f

Browse files
jmbergdavem330
authored andcommitted
net: introduce NETDEV_POST_INIT notifier
For various purposes including a wireless extensions bugfix, we need to hook into the netdev creation before before netdev_register_kobject(). This will also ease doing the dev type assignment that Marcel was working on for cfg80211 drivers w/o touching them all. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 225794f commit 7ffbe3f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/linux/notifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ static inline int notifier_to_errno(int ret)
201201
#define NETDEV_PRE_UP 0x000D
202202
#define NETDEV_BONDING_OLDTYPE 0x000E
203203
#define NETDEV_BONDING_NEWTYPE 0x000F
204+
#define NETDEV_POST_INIT 0x0010
204205

205206
#define SYS_DOWN 0x0001 /* Notify of system down */
206207
#define SYS_RESTART SYS_DOWN

net/core/dev.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4836,6 +4836,12 @@ int register_netdevice(struct net_device *dev)
48364836
dev->features |= NETIF_F_GSO;
48374837

48384838
netdev_initialize_kobject(dev);
4839+
4840+
ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
4841+
ret = notifier_to_errno(ret);
4842+
if (ret)
4843+
goto err_uninit;
4844+
48394845
ret = netdev_register_kobject(dev);
48404846
if (ret)
48414847
goto err_uninit;

0 commit comments

Comments
 (0)