]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/net-hns-fix-loopback-test-failed-at-copper-ports.patch
fixes for 4.4
[thirdparty/kernel/stable-queue.git] / queue-4.19 / net-hns-fix-loopback-test-failed-at-copper-ports.patch
1 From 6d1a02f4a105145f49604afa4b38dcd83183b1ed Mon Sep 17 00:00:00 2001
2 From: Yonglong Liu <liuyonglong@huawei.com>
3 Date: Fri, 31 May 2019 16:59:50 +0800
4 Subject: net: hns: Fix loopback test failed at copper ports
5
6 [ Upstream commit 2e1f164861e500f4e068a9d909bbd3fcc7841483 ]
7
8 When doing a loopback test at copper ports, the serdes loopback
9 and the phy loopback will fail, because of the adjust link had
10 not finished, and phy not ready.
11
12 Adds sleep between adjust link and test process to fix it.
13
14 Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 Signed-off-by: Sasha Levin <sashal@kernel.org>
17 ---
18 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 4 ++++
19 1 file changed, 4 insertions(+)
20
21 diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
22 index e2710ff48fb0..1fa0cd527ead 100644
23 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
24 +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
25 @@ -339,6 +339,7 @@ static int __lb_setup(struct net_device *ndev,
26 static int __lb_up(struct net_device *ndev,
27 enum hnae_loop loop_mode)
28 {
29 +#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300
30 struct hns_nic_priv *priv = netdev_priv(ndev);
31 struct hnae_handle *h = priv->ae_handle;
32 int speed, duplex;
33 @@ -365,6 +366,9 @@ static int __lb_up(struct net_device *ndev,
34
35 h->dev->ops->adjust_link(h, speed, duplex);
36
37 + /* wait adjust link done and phy ready */
38 + msleep(NIC_LB_TEST_WAIT_PHY_LINK_TIME);
39 +
40 return 0;
41 }
42
43 --
44 2.20.1
45