1 /* Please avoid adding hacks here - instead add it to mac80211/backports.git */
3 #undef CONFIG_MODULE_STRIPPED
5 #include <linux/version.h> /* LINUX_VERSION_CODE */
6 #include <linux/types.h>
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
10 #define dev_get_iflink(_net_dev) ((_net_dev)->iflink)
12 #endif /* < KERNEL_VERSION(4, 1, 0) */
14 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
16 #include <linux/netdevice.h>
18 #define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
19 BUILD_BUG_ON(upper_priv != NULL); \
20 BUILD_BUG_ON(upper_info != NULL); \
21 netdev_set_master(dev, upper_dev); \
24 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
26 #include <linux/netdevice.h>
28 #define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
29 BUILD_BUG_ON(upper_priv != NULL); \
30 BUILD_BUG_ON(upper_info != NULL); \
31 netdev_master_upper_dev_link(dev, upper_dev); \
34 #endif /* < KERNEL_VERSION(4, 5, 0) */
37 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
39 #define IFF_NO_QUEUE 0; dev->tx_queue_len = 0
41 #endif /* < KERNEL_VERSION(4, 3, 0) */
43 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
45 #include <linux/ethtool.h>
47 #define ethtool_link_ksettings batadv_ethtool_link_ksettings
49 struct batadv_ethtool_link_ksettings
{
56 #define __ethtool_get_link_ksettings(__dev, __link_settings) \
57 batadv_ethtool_get_link_ksettings(__dev, __link_settings)
60 batadv_ethtool_get_link_ksettings(struct net_device
*dev
,
61 struct ethtool_link_ksettings
*link_ksettings
)
63 struct ethtool_cmd cmd
;
66 memset(&cmd
, 0, sizeof(cmd
));
67 ret
= __ethtool_get_settings(dev
, &cmd
);
72 link_ksettings
->base
.duplex
= cmd
.duplex
;
73 link_ksettings
->base
.speed
= ethtool_cmd_speed(&cmd
);
78 #endif /* < KERNEL_VERSION(4, 6, 0) */
80 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
82 #define netif_trans_update batadv_netif_trans_update
83 static inline void batadv_netif_trans_update(struct net_device
*dev
)
85 dev
->trans_start
= jiffies
;
88 #endif /* < KERNEL_VERSION(4, 7, 0) */