From patchwork Wed Sep 19 17:29:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147040 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp987117ljw; Wed, 19 Sep 2018 10:31:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZi53tiJ0KZU3IkOU+wPfkNSH1JZht6Tf6uYdFrweTq8UMGwvTG9J93fnv9HIuncFh84rGM X-Received: by 2002:a62:6711:: with SMTP id b17-v6mr37311827pfc.243.1537378292759; Wed, 19 Sep 2018 10:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378292; cv=none; d=google.com; s=arc-20160816; b=sUIAfzEp68LJY5N8sR09jxh7RLZdMl7zXGYp9g2cO+RxaECgs4TWBRb0yM1gHqs8cb OgcZsaJWKg9yLu1mhKkU1VvlqqlRSQKSCzwHldrr1mLClijNMelhzWEEKq5YbbrOSRzF V1niySbJAx6DfNLVHibyXRafGFzppO7JFuOSvOS31Xd8QDMAp8BirnGTQwqN4miZXwad CcaCiEdGDHa57rREXx/nY6oS2CEHJ7lZKCeDWddetPnmcCIbp2ACStFKUBgDuQEo7DGh WyGnXRMto+ZhpZR9H/nYo+tIPmvJBRXp5eCA7bYSaAQByP8FBUg58CCk40M2qv7w2EFO Hb+g== 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 z1-v6si21622679pln.63.2018.09.19.10.31.32; Wed, 19 Sep 2018 10:31:32 -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 S1733276AbeISXKZ (ORCPT + 32 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 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(-) -- 2.7.4 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