summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/hisilicon/hns
diff options
context:
space:
mode:
authorYonglong Liu <liuyonglong@huawei.com>2019-05-31 16:59:50 +0800
committerDavid S. Miller <davem@davemloft.net>2019-06-02 13:55:54 -0700
commit2e1f164861e500f4e068a9d909bbd3fcc7841483 (patch)
tree2330daf645fb8f91f0607d8ecbe9b767f3e76538 /drivers/net/ethernet/hisilicon/hns
parent62394708f3e01c9f2be6be74eb6305bae1ed924f (diff)
net: hns: Fix loopback test failed at copper ports
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>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns')
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ethtool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index ce15d2350db9..188c3f6791b5 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -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;
}