]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: ethtool: cable-test: Target the command to the requested PHY
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Thu, 21 Dec 2023 18:00:44 +0000 (19:00 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Jan 2024 18:38:57 +0000 (18:38 +0000)
Cable testing is a PHY-specific command. Instead of targeting the command
towards dev->phydev, use the request to pick the targeted PHY.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ethtool/cabletest.c

index 06a151165c31ce59928d4a4769b5fce2749c53c7..6b00d0800f2382f8fc8986ec86f44520a701d8f0 100644 (file)
@@ -69,7 +69,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
                return ret;
 
        dev = req_info.dev;
-       if (!dev->phydev) {
+       if (!req_info.phydev) {
                ret = -EOPNOTSUPP;
                goto out_dev_put;
        }
@@ -85,12 +85,12 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
        if (ret < 0)
                goto out_rtnl;
 
-       ret = ops->start_cable_test(dev->phydev, info->extack);
+       ret = ops->start_cable_test(req_info.phydev, info->extack);
 
        ethnl_ops_complete(dev);
 
        if (!ret)
-               ethnl_cable_test_started(dev->phydev,
+               ethnl_cable_test_started(req_info.phydev,
                                         ETHTOOL_MSG_CABLE_TEST_NTF);
 
 out_rtnl:
@@ -321,7 +321,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
                return ret;
 
        dev = req_info.dev;
-       if (!dev->phydev) {
+       if (!req_info.phydev) {
                ret = -EOPNOTSUPP;
                goto out_dev_put;
        }
@@ -342,12 +342,12 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
        if (ret < 0)
                goto out_rtnl;
 
-       ret = ops->start_cable_test_tdr(dev->phydev, info->extack, &cfg);
+       ret = ops->start_cable_test_tdr(req_info.phydev, info->extack, &cfg);
 
        ethnl_ops_complete(dev);
 
        if (!ret)
-               ethnl_cable_test_started(dev->phydev,
+               ethnl_cable_test_started(req_info.phydev,
                                         ETHTOOL_MSG_CABLE_TEST_TDR_NTF);
 
 out_rtnl: