From patchwork Thu May 24 12:02:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 17385 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id CFD698282A; Thu, 24 May 2018 15:59:24 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=79.140.42.25; helo=mail.mail.packetmixer.de; envelope-from=sw@simonwunderlich.de; receiver= Received: from mail.mail.packetmixer.de (packetmixer.de [79.140.42.25]) by open-mesh.org (Postfix) with ESMTPS id DF53880604 for ; Thu, 24 May 2018 14:03:06 +0200 (CEST) Received: from kero.packetmixer.de (p200300C593E5F600A0617AF7D322DA00.dip0.t-ipconnect.de [IPv6:2003:c5:93e5:f600:a061:7af7:d322:da00]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mail.packetmixer.de (Postfix) with ESMTPSA id 857646201E; Thu, 24 May 2018 14:03:06 +0200 (CEST) From: Simon Wunderlich To: davem@davemloft.net Date: Thu, 24 May 2018 14:02:59 +0200 Message-Id: <20180524120300.15829-8-sw@simonwunderlich.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180524120300.15829-1-sw@simonwunderlich.de> References: <20180524120300.15829-1-sw@simonwunderlich.de> Subject: [B.A.T.M.A.N.] [PATCH 7/8] batman-adv: disable ethtool link speed detection when auto negotiation off X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Marek Lindner Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" From: Marek Lindner 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. The "default throughput" setting exported via sysfs still allows to configure the batman-adv throughput for the interface, thus disabling the measurements. Signed-off-by: Marek Lindner Acked-by: Antonio Quartulli Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/bat_v_elp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index 28687493599f..71c20c1d4002 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -127,7 +127,20 @@ 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(); - if (ret == 0) { + + /* 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) { /* link characteristics might change over time */ if (link_settings.base.duplex == DUPLEX_FULL) hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;