batman-adv: Add B.A.T.M.A.N. V support 177/head
authorSven Eckelmann <sven@narfation.org>
Thu, 11 Feb 2016 22:08:20 +0000 (23:08 +0100)
committerSven Eckelmann <sven@narfation.org>
Thu, 21 Apr 2016 13:48:53 +0000 (15:48 +0200)
Signed-off-by: Sven Eckelmann <sven@narfation.org>
batman-adv/Config.in
batman-adv/Makefile
batman-adv/files/compat-hacks.h

index 86fc795..48092e7 100644 (file)
@@ -24,3 +24,7 @@ config KMOD_BATMAN_ADV_NC
        depends on PACKAGE_kmod-batman-adv
        default n
 
+config KMOD_BATMAN_ADV_BATMAN_V
+       bool "enable batman v routing algorithm"
+       depends on PACKAGE_kmod-batman-adv
+       default n
index c071d7c..20664e1 100644 (file)
@@ -54,6 +54,7 @@ PKG_EXTRA_KCONFIG:= \
        CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \
        CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \
        CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \
+       CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_KMOD_BATMAN_ADV_BATMAN_V),y,n) \
 
 PKG_EXTRA_CFLAGS:= \
        $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
index e95b64d..5126fc2 100644 (file)
 #define IFF_NO_QUEUE   0; dev->tx_queue_len = 0
 
 #endif /* < KERNEL_VERSION(4, 3, 0) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+
+#include <linux/ethtool.h>
+
+#define ethtool_link_ksettings batadv_ethtool_link_ksettings
+
+struct batadv_ethtool_link_ksettings {
+       struct {
+               __u32   speed;
+               __u8    duplex;
+       } base;
+};
+
+#define __ethtool_get_link_ksettings(__dev, __link_settings) \
+       batadv_ethtool_get_link_ksettings(__dev, __link_settings)
+
+static inline int
+batadv_ethtool_get_link_ksettings(struct net_device *dev,
+                                 struct ethtool_link_ksettings *link_ksettings)
+{
+       struct ethtool_cmd cmd;
+       int ret;
+
+       memset(&cmd, 0, sizeof(cmd));
+       ret = __ethtool_get_settings(dev, &cmd);
+
+       if (ret != 0)
+               return ret;
+
+       link_ksettings->base.duplex = cmd.duplex;
+       link_ksettings->base.speed = ethtool_cmd_speed(&cmd);
+
+       return 0;
+}
+
+#endif /* < KERNEL_VERSION(4, 6, 0) */