Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp175810imd; Wed, 31 Oct 2018 16:50:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5fF5q1SP0u9fX5Q3VsJPSXiLF+SSm9FmDknbYFlITkehnknysN4zsySiepXpPYIUtgQWB6e X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr5437760pld.253.1541029847531; Wed, 31 Oct 2018 16:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029847; cv=none; d=google.com; s=arc-20160816; b=eO5pcrFasbAIHNnEYIqiMzD624fFS2iHqWf3kBExQ+FGMS1DUWc0eAMH4u0AVqGz3S TbNXdoSxI4Mv/9TagzZNugAsTKHefnrqVF+1X6mq+Q4GS11+MAJhySWX1FlPaZ1As7Uf ibC+BYP4JlBUhuKcqGtqO9iAbbIClL9PC2S+H2pkvKjgK6Qd32MQPZUFIXBu4fA09xcl ghUtWFWw/BPsza/shMsmsneeQ1feVQBaQAod0igi9N1cvM9Kx9n88wD2e63fDIyuvkaO L3cZqh8KSJTug3JpI7u5BfPFyhpqCeba+ebTrqGabSX0ZrwRygnT5iOS0lTgCG7A/LT7 ajUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Bc3+VLVUmEX1hcq6ctUt4brAdyXU7PGAym+ZNhmZFtg=; b=EoBnCUjS+7O6ul543Sevp0S3cO+rtH1gYpCL6hM3xMVcGZpK8X5jcjG9GBg+nA2DZ5 zluclesV2yxPSaueg7qUsavG1eYhqRFeADKs2OVz0wl0l3NilpyP+BNa8F3I3zYrtJyl QO/avUmmiaQkd0WEMjuGH5PUYbGJzwErpBeU/Uz3eWhAmmdjC7h6ZiBSFnRnhAna0iu8 zl5oGoqhMbW3pZRVEEyK/smr/EKFvo7hjFvmvGNCVRcg8jTTdN50sOjLtPIQLiymBQc1 ZwDG42/6jRdWxMStxViMD73ZWAq564B7fiFi/Ct5Bg1bWBpLbDZjTPbVMUMi+mlLYXg+ rGvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xq9K0vBp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e32-v6si2119610pgl.129.2018.10.31.16.50.32; Wed, 31 Oct 2018 16:50:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=xq9K0vBp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728280AbeKAIGn (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:53798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728257AbeKAIGm (ORCPT ); Thu, 1 Nov 2018 04:06:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 795F920838; Wed, 31 Oct 2018 23:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027192; bh=TTjCUnPJDGuhmRb2xYi40FY4zM+khh+9KWaT41NpfP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xq9K0vBpLpwym8xjXy14TM29Q34lm8IzNbYoWxRK4lm5r+Z5B2uqYOyKr5CnNsb2g gl/CTdetmHXfgi9LjoNpav8x9KZJAjzkNm5mOMrN0YDeEe43qXFvU/Aeiq/glhHVPL SDsxc44IkvGF3K51Wz1hZm38+x66HhXU3qX1dKRI= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Peng Li , Fuyun Liang , Salil Mehta , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 055/146] net: hns3: Check hdev state when getting link status Date: Wed, 31 Oct 2018 19:04:10 -0400 Message-Id: <20181031230541.28822-55-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li [ Upstream commit 582d37bbb613b8ad86bf82845d3a74a02a5a0fa1 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 023910abc831..0c64089c914f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2362,6 +2362,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 9c0091f2addf..d78064bb718a 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.17.1