[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230728075840.4022760-6-shaojijie@huawei.com>
Date: Fri, 28 Jul 2023 15:58:39 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: <yisen.zhuang@...wei.com>, <salil.mehta@...wei.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>
CC: <shenjian15@...wei.com>, <wangjie125@...wei.com>,
<liuyonglong@...wei.com>, <wangpeiyang1@...wei.com>, <shaojijie@...wei.com>,
<netdev@...r.kernel.org>, <stable@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH net 5/6] net: hns3: fix wrong print link down up
From: Peiyang Wang <wangpeiyang1@...wei.com>
This patch will fix a wrong print "device link down/up". Consider a case
that set autoneg to off with same speed and duplex configuration. The link
is always up while the phy state is set to PHY_UP and set back to
PHY_RUNNING later. It will print link down when the phy state is not
PHY_RUNNING. To avoid that, the condition should include PHY_UP.
Signed-off-by: Peiyang Wang <wangpeiyang1@...wei.com>
Signed-off-by: Jijie Shao <shaojijie@...wei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index a940e35aef29..1723d0fa49ee 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -3089,7 +3089,8 @@ static int hclge_get_mac_phy_link(struct hclge_dev *hdev, int *link_status)
if (test_bit(HCLGE_STATE_DOWN, &hdev->state))
return 0;
- if (phydev && (phydev->state != PHY_RUNNING || !phydev->link))
+ if (phydev && ((phydev->state != PHY_UP &&
+ phydev->state != PHY_RUNNING) || !phydev->link))
return 0;
return hclge_get_mac_link_status(hdev, link_status);
--
2.30.0
Powered by blists - more mailing lists