From d211177315c27d4b38e0b458b1d9f0b818de82bd Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 26 Jan 2016 14:29:50 +0000 Subject: [PATCH] Add more network related macros and functions to the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies --- .../linuxkpi/common/include/linux/netdevice.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 1d50ac19a62..d79cdf2aa51 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -58,6 +58,9 @@ extern struct net init_net; #define dev_get_by_index(n, idx) ifnet_byindex_ref((idx)) #define dev_hold(d) if_ref((d)) #define dev_put(d) if_rele((d)) +#define dev_net(d) (&init_net) + +#define net_eq(a,b) ((a) == (b)) #define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) #define netif_oper_up(dev) !!((dev)->if_flags & IFF_UP) @@ -69,6 +72,12 @@ netdev_priv(const struct net_device *dev) return (dev->if_softc); } +static inline struct net_device * +netdev_notifier_info_to_dev(void *ifp) +{ + return (ifp); +} + int register_netdevice_notifier(struct notifier_block *); int register_inetaddr_notifier(struct notifier_block *); int unregister_netdevice_notifier(struct notifier_block *); @@ -93,6 +102,12 @@ dev_mc_delete(struct net_device *dev, void *addr, int alen, int all) return -if_delmulti(dev, (struct sockaddr *)&sdl); } +static inline int +dev_mc_del(struct net_device *dev, void *addr) +{ + return (dev_mc_delete(dev, addr, 6, 0)); +} + static inline int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly) { -- 2.45.2