diff options
author | David S. Miller <davem@davemloft.net> | 2019-11-13 04:52:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-13 04:52:15 +0100 |
commit | d438945ae565e7959d11951c4227c224de7595e1 (patch) | |
tree | 2107d0d97b31df0ad1a86c830199e309357e243c /drivers | |
parent | net: dsa: Prevent usage of NET_DSA_TAG_8021Q as tagging protocol (diff) | |
parent | bridge: implement get_link_ksettings ethtool method (diff) | |
download | linux-d438945ae565e7959d11951c4227c224de7595e1.tar.xz linux-d438945ae565e7959d11951c4227c224de7595e1.zip |
Merge branch 'Implement-get_link_ksettings-for-VXLAN-and-bridge'
Matthias Schiffer says:
====================
Implement get_link_ksettings for VXLAN and bridge
Mesh routing protocol batman-adv (in particular the new BATMAN_V algorithm)
uses the link speed reported by get_link_ksettings to determine a path
metric for wired links. In the mesh framework Gluon [1], we layer VXLAN
and sometimes bridge interfaces on our Ethernet links.
These patches implement get_link_ksettings for these two interface types.
While this is obviously not accurate for bridges with multiple active
ports, it's much better than having no estimate at all (and in the
particular setup of Gluon, bridges with a single port aren't completely
uncommon).
[1] https://github.com/freifunk-gluon/gluon
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/vxlan.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 11f5776affb1..bf04bc2e68c2 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3175,9 +3175,29 @@ static void vxlan_get_drvinfo(struct net_device *netdev, strlcpy(drvinfo->driver, "vxlan", sizeof(drvinfo->driver)); } +static int vxlan_get_link_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *cmd) +{ + struct vxlan_dev *vxlan = netdev_priv(dev); + struct vxlan_rdst *dst = &vxlan->default_dst; + struct net_device *lowerdev = __dev_get_by_index(vxlan->net, + dst->remote_ifindex); + + if (!lowerdev) { + cmd->base.duplex = DUPLEX_UNKNOWN; + cmd->base.port = PORT_OTHER; + cmd->base.speed = SPEED_UNKNOWN; + + return 0; + } + + return __ethtool_get_link_ksettings(lowerdev, cmd); +} + static const struct ethtool_ops vxlan_ethtool_ops = { - .get_drvinfo = vxlan_get_drvinfo, - .get_link = ethtool_op_get_link, + .get_drvinfo = vxlan_get_drvinfo, + .get_link = ethtool_op_get_link, + .get_link_ksettings = vxlan_get_link_ksettings, }; static struct socket *vxlan_create_sock(struct net *net, bool ipv6, |