Messages in this thread Patch in this message | | | From | Jijie Shao <> | Subject | [PATCH net 5/6] net: hns3: fix wrong print link down up | Date | Fri, 28 Jul 2023 15:58:39 +0800 |
| |
From: Peiyang Wang <wangpeiyang1@huawei.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@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.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
| |