]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: hns: Fix loopback test failed at copper ports
authorYonglong Liu <liuyonglong@huawei.com>
Fri, 31 May 2019 08:59:50 +0000 (16:59 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838824
[ Upstream commit 2e1f164861e500f4e068a9d909bbd3fcc7841483 ]

When doing a loopback test at copper ports, the serdes loopback
and the phy loopback will fail, because of the adjust link had
not finished, and phy not ready.

Adds sleep between adjust link and test process to fix it.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c

index e2710ff48fb0fb284f19b2acd4b7aaaca33adb86..1fa0cd527ead3d5fe4783f8bfc4d412355e6028c 100644 (file)
@@ -339,6 +339,7 @@ static int __lb_setup(struct net_device *ndev,
 static int __lb_up(struct net_device *ndev,
                   enum hnae_loop loop_mode)
 {
+#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300
        struct hns_nic_priv *priv = netdev_priv(ndev);
        struct hnae_handle *h = priv->ae_handle;
        int speed, duplex;
@@ -365,6 +366,9 @@ static int __lb_up(struct net_device *ndev,
 
        h->dev->ops->adjust_link(h, speed, duplex);
 
+       /* wait adjust link done and phy ready */
+       msleep(NIC_LB_TEST_WAIT_PHY_LINK_TIME);
+
        return 0;
 }