From patchwork Wed Sep 19 17:29:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147038 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp987008ljw; Wed, 19 Sep 2018 10:31:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYY8+HrIPa6TrPJe0raUU2MCS2Rzwerg6JtKwJwKqhXILF0AOUDdxzYPIoIMI+axSnHFKj7 X-Received: by 2002:a63:fb07:: with SMTP id o7-v6mr33350834pgh.333.1537378286834; Wed, 19 Sep 2018 10:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378286; cv=none; d=google.com; s=arc-20160816; b=PUua7WtLoSl9ynNf56CJL4mlu+mshMUW6HlGEkojUOJdNrRad1hpX26/I1QHv34hg+ V/iEVjuY4ZjvVxNHA/w3TA1xJmvAspGlZ7YMiwkH3sDn++15P4v2a9xArHu3+eMp6rz5 syvDYDcvUFXtkVWCAcAKc9KTmlThPKfL1VJoU+BIHaYKhHcKrKZKIFuZKu6DWqaWJChT 1garOL+CwvzzSjFDk0GYPEmG0Vwg6sDEzGawA1pGZyT8SE40SUsNwaSuMjOLi656pr6x GgihGylTXc4vHGVs8Tb71BjMxmZ9k+BiPzUn0DKzk7PrJWsBnxhzYu6kggKmKqhfblVI bSAw== 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=8tdCSAaRz5MA6kwPgLgk8ZIs/3yS126vdw+82mXh/Ls=; b=Kwxv2vE7Khaa3i1GN+H073cJkElwLuCIEgK6jDcx0XuWLaFCPg9bPB0Eiq6/xV/7r8 6RmsBQ3+Z/kJXDj35MMG5khw0y+11CK2Jg0TCGiKmWPnNBd5J1dwf+sttQUBJDVxA13L grRwMXXS3R1wtoAwEBCQSEo5BKBheD3nVLWsbfYPbSRnFedZDXguHfHl6baoUbW9J8w9 OCO+gwmw/YxFv/8Slz6GZphYY4sM/DUVzdrGuv9gX1qAPgeLvg6c+j95KJ/LYoL/eCVI wG8KEgVU5wdlTmKnKpy1rLMon1UOxBlXiaTMQb/P5fFQmJ5gI1BS4heAUwaelT+vH2oW yy/g== 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 r194-v6si24302417pfr.100.2018.09.19.10.31.26; Wed, 19 Sep 2018 10:31:26 -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 S1733236AbeISXKT (ORCPT + 32 others); Wed, 19 Sep 2018 19:10:19 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12626 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733197AbeISXKT (ORCPT ); Wed, 19 Sep 2018 19:10:19 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 000FE4EF3643E; Thu, 20 Sep 2018 01:31:18 +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:12 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 07/12] net: hns3: Check hdev state when getting link status Date: Wed, 19 Sep 2018 18:29:53 +0100 Message-ID: <20180919172958.12992-8-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: Peng Li By default, HW link status is up. If hclge_update_link_status is called before net up, driver will print "link up". It is not suitable. hdev state check is needed when getting link status. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware 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 | 3 +++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +++ 2 files changed, 6 insertions(+) -- 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 66b31d1..4f4ded3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2063,6 +2063,9 @@ static int hclge_get_mac_phy_link(struct hclge_dev *hdev) int mac_state; int link_stat; + if (test_bit(HCLGE_STATE_DOWN, &hdev->state)) + return 0; + mac_state = hclge_get_mac_link_status(hdev); if (hdev->hw.mac.phydev) { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 47fc3cd..320043e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -299,6 +299,9 @@ void hclgevf_update_link_status(struct hclgevf_dev *hdev, int link_state) client = handle->client; + link_state = + test_bit(HCLGEVF_STATE_DOWN, &hdev->state) ? 0 : link_state; + if (link_state != hdev->hw.mac.link) { client->ops->link_status_change(handle, !!link_state); hdev->hw.mac.link = link_state;