backports: add alloc_netdev_dummy and free_netdev
PATCH 1/1 backports: add alloc_netdev_dummy and free_netdev
From: Miri Korenblit <[email protected]>
Signed-off-by Miri Korenblit <[email protected]>
Signed-off-by Johannes Berg <[email protected]>
--- backport/backport-include/linux/netdevice.h | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+)
backport/backport-include/linux/netdevice.h +29 -0
@@ -212,4 +212,33 @@ static inline bool napi_is_scheduled(struct napi_struct *n) }#endif /* < 6.7.0 */ +#if LINUX_VERSION_IS_LESS (6 ,10 ,0 ) +static inline struct net_device *alloc_netdev_dummy (int sizeof_priv) +{ +struct net_device *dev; + + dev =kzalloc (sizeof (*dev) + +ALIGN (sizeof (struct net_device ),NETDEV_ALIGN ) + + sizeof_priv, +GFP_KERNEL ); + +if (!dev) +return NULL ; + +init_dummy_netdev (dev); +return dev; +} + +static inline void LINUX_BACKPORT (free_netdev )(struct net_device *dev) +{ +if (dev->reg_state ==NETREG_DUMMY ) { +kfree (dev); +return ; + } + +free_netdev (dev); +} +#define free_netdev LINUX_BACKPORT(free_netdev) +#endif /* 6.10.0 */ +#endif /* __BACKPORT_NETDEVICE_H */
Signature · 1 line
2.45.2