net: introduce NETDEV_POST_INIT notifier
Subsystems (2)
PATCH 1/2 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.
---
I decided that it doesn't make a lot of sense to be after ndo_init but before the other name/... checks.
include/linux/notifier.h | 1 + net/core/dev.c | 5 +++++ 2 files changed, 6 insertions(+)
include/linux/notifier.h +1 -0
@@ -201,6 +201,7 @@ static inline int notifier_to_errno(int#define NETDEV_PRE_UP 0x000D#define NETDEV_BONDING_OLDTYPE 0x000E#define NETDEV_BONDING_NEWTYPE 0x000F +#define NETDEV_POST_INIT 0x0010#define SYS_DOWN 0x0001/* Notify of system down */ #define SYS_RESTART SYS_DOWN
net/core/dev.c +5 -0
@@ -4785,6 +4785,11 @@ int register_netdevice(struct net_deviceif (dev->features &NETIF_F_SG ) dev->features |=NETIF_F_GSO ; + ret =call_netdevice_notifiers (NETDEV_POST_INIT , dev); + ret =notifier_to_errno (ret); +if (ret) + goto err_uninit; +netdev_initialize_kobject (dev); ret =netdev_register_kobject (dev);if (ret)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Johannes Berg
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 <[email protected]>---
I decided that it doesn't make a lot of sense to be afterndo_initbut before the other name/... checks.
Ignore this patch please, I have something better. Marcel, feel free to pick this up once you continue working on your devtype thing.
johannes