From: Peiyang Wang <wangpeiyang1@xxxxxxxxxx> 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@xxxxxxxxxx> Signed-off-by: Jijie Shao <shaojijie@xxxxxxxxxx> --- 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