1 |
From f181ddf6292d6b6e482f7379fc4962f402e0afb3 Mon Sep 17 00:00:00 2001 |
2 |
From: Peng Li <lipeng321@huawei.com> |
3 |
Date: Wed, 19 Sep 2018 18:29:53 +0100 |
4 |
Subject: [PATCH 054/145] net: hns3: Check hdev state when getting link status |
5 |
|
6 |
[ Upstream commit 582d37bbb613b8ad86bf82845d3a74a02a5a0fa1 ] |
7 |
|
8 |
By default, HW link status is up. If hclge_update_link_status is called |
9 |
before net up, driver will print "link up". It is not suitable. hdev |
10 |
state check is needed when getting link status. |
11 |
|
12 |
Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") |
13 |
Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") |
14 |
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com> |
15 |
Signed-off-by: Peng Li <lipeng321@huawei.com> |
16 |
Signed-off-by: Salil Mehta <salil.mehta@huawei.com> |
17 |
Signed-off-by: David S. Miller <davem@davemloft.net> |
18 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
19 |
--- |
20 |
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ |
21 |
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +++ |
22 |
2 files changed, 6 insertions(+) |
23 |
|
24 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
25 |
index 023910abc831..0c64089c914f 100644 |
26 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
27 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
28 |
@@ -2362,6 +2362,9 @@ static int hclge_get_mac_phy_link(struct hclge_dev *hdev) |
29 |
int mac_state; |
30 |
int link_stat; |
31 |
|
32 |
+ if (test_bit(HCLGE_STATE_DOWN, &hdev->state)) |
33 |
+ return 0; |
34 |
+ |
35 |
mac_state = hclge_get_mac_link_status(hdev); |
36 |
|
37 |
if (hdev->hw.mac.phydev) { |
38 |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
39 |
index 9c0091f2addf..d78064bb718a 100644 |
40 |
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
41 |
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
42 |
@@ -299,6 +299,9 @@ void hclgevf_update_link_status(struct hclgevf_dev *hdev, int link_state) |
43 |
|
44 |
client = handle->client; |
45 |
|
46 |
+ link_state = |
47 |
+ test_bit(HCLGEVF_STATE_DOWN, &hdev->state) ? 0 : link_state; |
48 |
+ |
49 |
if (link_state != hdev->hw.mac.link) { |
50 |
client->ops->link_status_change(handle, !!link_state); |
51 |
hdev->hw.mac.link = link_state; |
52 |
-- |
53 |
2.19.1 |
54 |
|