Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1016662imm; Wed, 19 Sep 2018 10:32:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY0rRSyHZJb6jfrMpZZqMANyCMvLA/LomPEDJ8ya30Qvv0agntCrf1BKBVHuhSiVWpMefcs X-Received: by 2002:a17:902:c3:: with SMTP id a61-v6mr34747823pla.279.1537378372501; Wed, 19 Sep 2018 10:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378372; cv=none; d=google.com; s=arc-20160816; b=YWIeKujcowJzdtVqaX2Sua/cQd4pklM58DBUo5NqVvnJgySCXQy2O77cigUg1W81JY RQ6T1XKJd/w95OKOta4aTqwRdcoAKDbrrLk/DPXLs8RDXuzZUduD7bu1gjRQ6aZ/lKxp jnROcBryM+vEXuOuUGbLVF5MImyU8jAtYReu9TevbgnUhTAjUOYbYbjyddsyEdl4hGLw OyGQJQduNhnjTVy5Ua2XxitEiDgAvYJpMxiz2H33pgcrPXPrXu3nzVNUG5tCbD6YQOEr DBQYqUTWCZqr1J4Pg0x3VsC24zP1ZWKUhZKBWnUHBjyzzRcMYE2wY169jrOUgPaQ7fi7 ROzw== 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 y4-v6si21188056pgh.225.2018.09.19.10.32.37; Wed, 19 Sep 2018 10:32:52 -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 S1733231AbeISXKT (ORCPT + 99 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 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: 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(+) 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; -- 2.7.4