Repository : ssh://git@open-mesh.org/openwrt-feed-devel
On branch : master
commit 8844c09fe40ed094e9738ce9114632b6db5f2d67 Author: Marek Lindner mareklindner@neomailbox.ch Date: Thu May 5 03:12:45 2016 +0800
batman-adv-devel: import mac80211-compat changes
Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
8844c09fe40ed094e9738ce9114632b6db5f2d67 batman-adv-devel/Makefile | 45 +++++++++----- batman-adv-devel/files/compat-hacks.h | 76 +++++++++++++++++++++++ batman-adv-devel/files/etc/config/batman-adv | 1 - batman-adv-devel/files/lib/netifd/proto/batadv.sh | 1 - 4 files changed, 105 insertions(+), 18 deletions(-)
diff --git a/batman-adv-devel/Makefile b/batman-adv-devel/Makefile index 892f71e..c413ecb 100644 --- a/batman-adv-devel/Makefile +++ b/batman-adv-devel/Makefile @@ -17,6 +17,7 @@ PKG_BATMAN_DIR:=batman-adv-$(PKG_BATMAN_SHORTREV)
PKG_SOURCE_URL:=https://git.open-mesh.org/snapshot/ PKG_SOURCE:=$(PKG_BATMAN_FNAME) +PKG_LICENSE:=GPL-2.0
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_BATMAN_DIR)
@@ -27,9 +28,7 @@ define KernelPackage/batman-adv-devel URL:=https://www.open-mesh.org/ MAINTAINER:=Marek Lindner mareklindner@neomailbox.ch SUBMENU:=Network Support - DEPENDS:=+KMOD_BATMAN_ADV_DEVEL_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c - KCONFIG:=\ - CONFIG_AVERAGE=y + DEPENDS:=+KMOD_BATMAN_ADV_DEVEL_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +kmod-cfg80211 TITLE:=B.A.T.M.A.N. Adv devel FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) @@ -49,32 +48,46 @@ define Package/kmod-batman-adv-devel/conffiles /etc/config/batman-adv endef
-MAKE_BATMAN_ADV_ARGS += \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - KERNELPATH="$(LINUX_DIR)" \ - ARCH="$(LINUX_KARCH)" \ - PATH="$(TARGET_PATH)" \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - PWD="$(PKG_BUILD_DIR)" \ - LINUX_VERSION="$(LINUX_VERSION)" \ +PKG_EXTRA_KCONFIG:= \ + CONFIG_BATMAN_ADV=m \ CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_DEBUG_LOG),y,n) \ CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_BLA),y,n) \ CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_DAT),y,n) \ CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_MCAST),y,n) \ CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_NC),y,n) \ CONFIG_BATMAN_ADV_BATMAN_V=$(if $(CONFIG_KMOD_BATMAN_ADV_DEVEL_BATMAN_V),y,n) \ - REVISION="$(PKG_BATMAN_SHORTREV)" all + +PKG_EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ + +NOSTDINC_FLAGS = \ + -I$(PKG_BUILD_DIR)/net/batman-adv \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -include backport/backport.h \ + -include $(PKG_BUILD_DIR)/compat-hacks.h + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \ + $(PKG_EXTRA_KCONFIG) \ + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + modules +endef
define Build/Prepare $(call Build/Prepare/Default) + $(CP) ./files/compat-hacks.h $(PKG_BUILD_DIR)/ $(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a#undef CONFIG_MODULE_STRIPPED' \ $(PKG_BUILD_DIR)/net/batman-adv/main.h endef
-define Build/Compile - $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS) -endef - define Build/Clean rm -rf $(BUILD_DIR)/$(PKG_NAME)/ endef diff --git a/batman-adv-devel/files/compat-hacks.h b/batman-adv-devel/files/compat-hacks.h new file mode 100644 index 0000000..5126fc2 --- /dev/null +++ b/batman-adv-devel/files/compat-hacks.h @@ -0,0 +1,76 @@ +/* Please avoid adding hacks here - instead add it to mac80211/backports.git */ + +#include <linux/version.h> /* LINUX_VERSION_CODE */ +#include <linux/types.h> + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) + +#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) + +#endif /* < KERNEL_VERSION(4, 1, 0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) + +#include <linux/netdevice.h> + +#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\ + BUILD_BUG_ON(upper_priv != NULL); \ + BUILD_BUG_ON(upper_info != NULL); \ + netdev_set_master(dev, upper_dev); \ +}) + +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) + +#include <linux/netdevice.h> + +#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\ + BUILD_BUG_ON(upper_priv != NULL); \ + BUILD_BUG_ON(upper_info != NULL); \ + netdev_master_upper_dev_link(dev, upper_dev); \ +}) + +#endif /* < KERNEL_VERSION(4, 5, 0) */ + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) + +#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) */ diff --git a/batman-adv-devel/files/etc/config/batman-adv b/batman-adv-devel/files/etc/config/batman-adv index be97065..f38855e 100644 --- a/batman-adv-devel/files/etc/config/batman-adv +++ b/batman-adv-devel/files/etc/config/batman-adv @@ -16,7 +16,6 @@ config 'mesh' 'bat0' option 'network_coding' option 'hop_penalty' option 'isolation_mark' - option 'routing_algo'
# yet another batX instance # config 'mesh' 'bat5' diff --git a/batman-adv-devel/files/lib/netifd/proto/batadv.sh b/batman-adv-devel/files/lib/netifd/proto/batadv.sh index cbdb019..1e0c9d0 100644 --- a/batman-adv-devel/files/lib/netifd/proto/batadv.sh +++ b/batman-adv-devel/files/lib/netifd/proto/batadv.sh @@ -19,7 +19,6 @@ proto_batadv_setup() { [ -n "$routing_algo" ] || routing_algo="BATMAN_IV" echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
- uci get batman_adv.$mesh.routing_algo echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" proto_init_update "$iface" 1 proto_send_update "$config"