1 /* Please avoid adding hacks here - instead add it to mac80211/backports.git */
3 #include <linux/version.h> /* LINUX_VERSION_CODE */
4 #include <linux/types.h>
6 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
8 #define dev_get_iflink(_net_dev) ((_net_dev)->iflink)
10 #endif /* < KERNEL_VERSION(4, 1, 0) */
12 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
14 #include <linux/netdevice.h>
16 #define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
17 BUILD_BUG_ON(upper_priv != NULL); \
18 BUILD_BUG_ON(upper_info != NULL); \
19 netdev_set_master(dev, upper_dev); \
22 #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
24 #include <linux/netdevice.h>
26 #define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\
27 BUILD_BUG_ON(upper_priv != NULL); \
28 BUILD_BUG_ON(upper_info != NULL); \
29 netdev_master_upper_dev_link(dev, upper_dev); \
32 #endif /* < KERNEL_VERSION(4, 5, 0) */
35 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
37 #define IFF_NO_QUEUE 0; dev->tx_queue_len = 0
39 #endif /* < KERNEL_VERSION(4, 3, 0) */
41 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
43 #include <linux/ethtool.h>
45 #define ethtool_link_ksettings batadv_ethtool_link_ksettings
47 struct batadv_ethtool_link_ksettings
{
54 #define __ethtool_get_link_ksettings(__dev, __link_settings) \
55 batadv_ethtool_get_link_ksettings(__dev, __link_settings)
58 batadv_ethtool_get_link_ksettings(struct net_device
*dev
,
59 struct ethtool_link_ksettings
*link_ksettings
)
61 struct ethtool_cmd cmd
;
64 memset(&cmd
, 0, sizeof(cmd
));
65 ret
= __ethtool_get_settings(dev
, &cmd
);
70 link_ksettings
->base
.duplex
= cmd
.duplex
;
71 link_ksettings
->base
.speed
= ethtool_cmd_speed(&cmd
);
76 #endif /* < KERNEL_VERSION(4, 6, 0) */