]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net: hns3: fix a phy loopback fail issue
authorYonglong Liu <liuyonglong@huawei.com>
Tue, 5 Jan 2021 03:37:26 +0000 (11:37 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 19 Feb 2021 15:44:10 +0000 (16:44 +0100)
BugLink: https://bugs.launchpad.net/bugs/1913487
[ Upstream commit f04bbcbf1e38d192e94bbfa126731a52332c40b1 ]

When phy driver does not implement the set_loopback interface,
phy loopback test will return -EOPNOTSUPP, and the loopback test
will fail. So when phy driver does not implement the set_loopback
interface, don't do phy loopback test.

Fixes: c9765a89d142 ("net: hns3: add phy selftest function")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index f8eb9b99e6fb4bc29db17b3a4590f64530a17105..51b7b3c3dbad3ed00b83e377dac8ea47c6698949 100644 (file)
@@ -749,7 +749,8 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
                handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK;
                handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK;
 
-               if (hdev->hw.mac.phydev) {
+               if (hdev->hw.mac.phydev && hdev->hw.mac.phydev->drv &&
+                   hdev->hw.mac.phydev->drv->set_loopback) {
                        count += 1;
                        handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK;
                }