Skip to content

Commit 8c46fcd

Browse files
Marek Lindnersimonwunderlich
authored andcommitted
batman-adv: disable ethtool link speed detection when auto negotiation off
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 <[email protected]> Acked-by: Antonio Quartulli <[email protected]> Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent 6bf9e4d commit 8c46fcd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

net/batman-adv/bat_v_elp.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,20 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
127127
rtnl_lock();
128128
ret = __ethtool_get_link_ksettings(hard_iface->net_dev, &link_settings);
129129
rtnl_unlock();
130-
if (ret == 0) {
130+
131+
/* Virtual interface drivers such as tun / tap interfaces, VLAN, etc
132+
* tend to initialize the interface throughput with some value for the
133+
* sake of having a throughput number to export via ethtool. This
134+
* exported throughput leaves batman-adv to conclude the interface
135+
* throughput is genuine (reflecting reality), thus no measurements
136+
* are necessary.
137+
*
138+
* Based on the observation that those interface types also tend to set
139+
* the link auto-negotiation to 'off', batman-adv shall check this
140+
* setting to differentiate between genuine link throughput information
141+
* and placeholders installed by virtual interfaces.
142+
*/
143+
if (ret == 0 && link_settings.base.autoneg == AUTONEG_ENABLE) {
131144
/* link characteristics might change over time */
132145
if (link_settings.base.duplex == DUPLEX_FULL)
133146
hard_iface->bat_v.flags |= BATADV_FULL_DUPLEX;

0 commit comments

Comments
 (0)