]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/net/vxlan.c
vxlan: implement get_link_ksettings ethtool method
[mirror_ubuntu-jammy-kernel.git] / drivers / net / vxlan.c
index 8869154fad8895194a3a101f93119890a930c542..bf04bc2e68c2f96523dd8c30c746fcd28934a150 100644 (file)
@@ -793,8 +793,7 @@ static int vxlan_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)
        return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr));
 }
 
-static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan,
-                                        const u8 *mac, __u16 state,
+static struct vxlan_fdb *vxlan_fdb_alloc(const u8 *mac, __u16 state,
                                         __be32 src_vni, __u16 ndm_flags)
 {
        struct vxlan_fdb *f;
@@ -835,7 +834,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
                return -ENOSPC;
 
        netdev_dbg(vxlan->dev, "add %pM -> %pIS\n", mac, ip);
-       f = vxlan_fdb_alloc(vxlan, mac, state, src_vni, ndm_flags);
+       f = vxlan_fdb_alloc(mac, state, src_vni, ndm_flags);
        if (!f)
                return -ENOMEM;
 
@@ -3176,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,