From 4c05fe97d91a5bbce8f789526f05d512664796e6 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 6 Jul 2020 20:04:33 +0200 Subject: [PATCH] batman-adv: Merge bugfixes from 2020.2 * Revert "disable ethtool link speed detection when auto negotiation off" Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 2 +- ...t-disable-ethtool-link-speed-detecti.patch | 76 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 batman-adv/patches/0020-batman-adv-Revert-disable-ethtool-link-speed-detecti.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index a2f4760..828fbde 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=batman-adv PKG_VERSION:=2019.2 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_HASH:=70c3f6a6cf88d2b25681a76768a52ed92d9fe992ba8e358368b6a8088757adc8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/batman-adv/patches/0020-batman-adv-Revert-disable-ethtool-link-speed-detecti.patch b/batman-adv/patches/0020-batman-adv-Revert-disable-ethtool-link-speed-detecti.patch new file mode 100644 index 0000000..0de7d25 --- /dev/null +++ b/batman-adv/patches/0020-batman-adv-Revert-disable-ethtool-link-speed-detecti.patch @@ -0,0 +1,76 @@ +From: Sven Eckelmann +Date: Mon, 25 Nov 2019 10:46:50 +0100 +Subject: batman-adv: Revert "disable ethtool link speed detection when auto negotiation off" + +The commit d60b8fc69ef2 ("batman-adv: disable ethtool link speed detection +when auto negotiation off") disabled the usage of ethtool's link_ksetting +when auto negotation was enabled due to invalid values when used with +tun/tap virtual net_devices. According to the patch, automatic measurements +should be used for these kind of interfaces. + +But there are major flaws with this argumentation: + +* automatic measurements are not implemented +* auto negotiation has nothing to do with the validity of the retrieved + values + +The first point has to be fixed by a longer patch series. The "validity" +part of the second point must be addressed in the same patch series by +dropping the usage of ethtool's link_ksetting (thus always doing automatic +measurements over ethernet). + +Drop the patch again to have more default values for various net_device +types/configurations. The user can still overwrite them using the +batadv_hardif's BATADV_ATTR_THROUGHPUT_OVERRIDE. + +Reported-by: Matthias Schiffer +Signed-off-by: Sven Eckelmann + +Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/6e860b3d5e4147bafcda32bf9b3e769926f232c5 + +diff --git a/compat-include/linux/ethtool.h b/compat-include/linux/ethtool.h +index e1f39c3377febbd650a75206aafa9ae3e807762a..8dcbe02c3decf941e892af70a0a67653b010e65e 100644 +--- a/compat-include/linux/ethtool.h ++++ b/compat-include/linux/ethtool.h +@@ -21,7 +21,6 @@ struct batadv_ethtool_link_ksettings { + struct { + __u32 speed; + __u8 duplex; +- __u8 autoneg; + } base; + }; + +@@ -42,7 +41,6 @@ batadv_ethtool_get_link_ksettings(struct net_device *dev, + return ret; + + link_ksettings->base.duplex = cmd.duplex; +- link_ksettings->base.autoneg = cmd.autoneg; + link_ksettings->base.speed = ethtool_cmd_speed(&cmd); + + return 0; +diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c +index 2614a9caee008539cc489b71dabdc36ac0ae3752..a39af0eefad313101812118181ec0376b21b79bb 100644 +--- a/net/batman-adv/bat_v_elp.c ++++ b/net/batman-adv/bat_v_elp.c +@@ -120,20 +120,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) + rtnl_lock(); + ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings); + rtnl_unlock(); +- +- /* Virtual interface drivers such as tun / tap interfaces, VLAN, etc +- * tend to initialize the interface throughput with some value for the +- * sake of having a throughput number to export via ethtool. This +- * exported throughput leaves batman-adv to conclude the interface +- * throughput is genuine (reflecting reality), thus no measurements +- * are necessary. +- * +- * Based on the observation that those interface types also tend to set +- * the link auto-negotiation to 'off', batman-adv shall check this +- * setting to differentiate between genuine link throughput information +- * and placeholders installed by virtual interfaces. +- */ +- if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) { ++ if (ret == 0) { + /* link characteristics might change over time */ + if (link_settings.base.duplex == DUPLEX_FULL) + hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX; -- 2.30.2