]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - net/ethtool/cabletest.c
tipc: set ub->ifindex for local ipv6 address
[mirror_ubuntu-hirsute-kernel.git] / net / ethtool / cabletest.c
index 7194956aa09ec2e2bf7861a0d7c1ca3571b79325..888f6e101f347f599974b0a0c3c626cb92e5c3d8 100644 (file)
@@ -58,6 +58,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
 {
        struct nlattr *tb[ETHTOOL_A_CABLE_TEST_MAX + 1];
        struct ethnl_req_info req_info = {};
+       const struct ethtool_phy_ops *ops;
        struct net_device *dev;
        int ret;
 
@@ -81,11 +82,17 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
        }
 
        rtnl_lock();
+       ops = ethtool_phy_ops;
+       if (!ops || !ops->start_cable_test) {
+               ret = -EOPNOTSUPP;
+               goto out_rtnl;
+       }
+
        ret = ethnl_ops_begin(dev);
        if (ret < 0)
                goto out_rtnl;
 
-       ret = phy_start_cable_test(dev->phydev, info->extack);
+       ret = ops->start_cable_test(dev->phydev, info->extack);
 
        ethnl_ops_complete(dev);
 
@@ -308,6 +315,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
 {
        struct nlattr *tb[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1];
        struct ethnl_req_info req_info = {};
+       const struct ethtool_phy_ops *ops;
        struct phy_tdr_config cfg;
        struct net_device *dev;
        int ret;
@@ -337,11 +345,17 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
                goto out_dev_put;
 
        rtnl_lock();
+       ops = ethtool_phy_ops;
+       if (!ops || !ops->start_cable_test_tdr) {
+               ret = -EOPNOTSUPP;
+               goto out_rtnl;
+       }
+
        ret = ethnl_ops_begin(dev);
        if (ret < 0)
                goto out_rtnl;
 
-       ret = phy_start_cable_test_tdr(dev->phydev, info->extack, &cfg);
+       ret = ops->start_cable_test_tdr(dev->phydev, info->extack, &cfg);
 
        ethnl_ops_complete(dev);