Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1015916imm; Wed, 19 Sep 2018 10:32:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYpGcdLJ/UbBM7yBzkJ1887+1W4+5hojBpRybnguRr9vfG/JJ2lkLOL4SBaTBbjVlhXLi8m X-Received: by 2002:a63:f344:: with SMTP id t4-v6mr33723736pgj.428.1537378328851; Wed, 19 Sep 2018 10:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378328; cv=none; d=google.com; s=arc-20160816; b=ZVow6iORiyj4JI6KE/Z/8q5Sg+g730EXz3a/uZ8BHjUkoS0tjpQ3ncly4kby88YNsQ exHEoH28HXti5+9mnh+SNb3M5fulWa5UTiQCxRUe8vdeNmtnc6kSE5I1OdECpSM9kVut jiUSqltmCe8ty2LAoXKnM8qf9gSPXvgiCvBd2Do3oGibHqrwgNsQKQ0a7qUrrt90Lmy1 8NtrJz4zk6RcdmxbZ0JHp3fdcpCTHCHZYa7KH8/eqO5JB8EBoePVEnR1/QzuRvoYeykl eB8gJPaME4PTnG12WEz83IndD/Bg68iw/amvzUtJfpSd0kFcPaDCGj0+KxU3d6Rz9seO +qEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=AAWKmJ+koK8h0+vSwDdHK8Lx9KYEqe+lowkV3oSads8=; b=SrbbSwvwDcMX3KchsvuCXH8OCsSFITMPR4mSZka4J+hFiKVwE3xcx9HFX1XzCOx+WC cOrzQFXr+ft0fIuU11ZbozLWQH8nlrihULy+giFvuCmfavfAR6J+Wiz47YIpnqIL2f4u LuKfnDrada2ReI8AaQIZ9hUTyI96U9SHl52spEshUW6OZtE3YDOqGuuWw1KLQq8Awi+e a48/6bnPjTPS0bPTj1R+HEQfLfeBh6gThV06Muygtvvg8gOetOPhfZCUfS/WDQWzMuU7 TnK90X0q1D+wKF67uio3pTgd9sQuI+Xb9muRxfpLKio3u53u1vMTcfuiS8sda8rJlPd/ cUVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14-v6si21953930pgc.368.2018.09.19.10.31.53; Wed, 19 Sep 2018 10:32:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733272AbeISXKZ (ORCPT + 99 others); Wed, 19 Sep 2018 19:10:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12209 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732840AbeISXKY (ORCPT ); Wed, 19 Sep 2018 19:10:24 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5A1E8FDF66F60; Thu, 20 Sep 2018 01:31:23 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 01:31:15 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 08/12] net: hns3: Fix for setting speed for phy failed problem Date: Wed, 19 Sep 2018 18:29:54 +0100 Message-ID: <20180919172958.12992-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180919172958.12992-1-salil.mehta@huawei.com> References: <20180919172958.12992-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang The function of genphy_read_status is that reading phy information from HW and using these information to update SW variable. If user is using ethtool to setting the speed of phy and service task is calling by hclge_get_mac_phy_link, the result of speed setting is uncertain. Because ethtool cmd will modified phydev and hclge_get_mac_phy_link also will modified phydev. Because phy state machine will update phy link periodically, we can just use phydev->link to check the link status. This patch removes function call of genphy_read_status. To ensure accuracy, this patch adds a phy state check. If phy state is not PHY_RUNNING, we consider link is down. Because in some scenarios, phydev->link may be link up, but phy state is not PHY_RUNNING. This is just an intermediate state. In fact, the link is not ready yet. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 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 4f4ded3..8a50688 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2069,7 +2069,7 @@ static int hclge_get_mac_phy_link(struct hclge_dev *hdev) mac_state = hclge_get_mac_link_status(hdev); if (hdev->hw.mac.phydev) { - if (!genphy_read_status(hdev->hw.mac.phydev)) + if (hdev->hw.mac.phydev->state == PHY_RUNNING) link_stat = mac_state & hdev->hw.mac.phydev->link; else -- 2.7.4