From: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- backport/backport-include/linux/netdevice.h | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h index 7f72c3a8eb98..58b8d0c68ed2 100644 --- a/backport/backport-include/linux/netdevice.h +++ b/backport/backport-include/linux/netdevice.h @@ -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 */ -- 2.45.2