From patchwork Fri Jul 28 07:58:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijie Shao X-Patchwork-Id: 13331384 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE9F210944 for ; Fri, 28 Jul 2023 08:02:13 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE4E33C0C; Fri, 28 Jul 2023 01:01:53 -0700 (PDT) Received: from kwepemm600007.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RC0Pk5Hv0ztRcF; Fri, 28 Jul 2023 15:58:34 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 28 Jul 2023 16:01:50 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , Subject: [PATCH net 5/6] net: hns3: fix wrong print link down up Date: Fri, 28 Jul 2023 15:58:39 +0800 Message-ID: <20230728075840.4022760-6-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230728075840.4022760-1-shaojijie@huawei.com> References: <20230728075840.4022760-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Peiyang Wang 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 Signed-off-by: Jijie Shao --- 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);