Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3483651imu; Sun, 11 Nov 2018 16:08:10 -0800 (PST) X-Google-Smtp-Source: AJdET5c8rh3+fxqbl09M0MfexewSKtbSqiZY6MWXIh1h89YjIhv750p7kb7vFBVl0RCT2rG/L8Pe X-Received: by 2002:a63:e615:: with SMTP id g21mr7116905pgh.290.1541981290834; Sun, 11 Nov 2018 16:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981290; cv=none; d=google.com; s=arc-20160816; b=Hf+1N7Bd4jbWqyTb1JM53d1uNPStfF3d9qlCMFfAnGlwmGNSc7xiByOe2dHCkOQkKt HBe6RXRBS97WgqgOygldvMndixP55iwS2uE1C+Fa/Fh214YXfCXzWqWkiJHo65tbY61w mtdAlhhTWXFbqjeJWmg3skK3g28+ynyCeI0j2kD2oLf7z9j7NBWa2g25OJFyXSHnFGDU 4AyYFnynMBxWmw6uMeFGYnHb0xgiCEZ6A6z3WKKKzM4QeDiP3wyB7Y1RENw02tNEVUu2 OtCvtdHiQ0DX1dMoXrr+YZqd1bQgChcE5ZKFlG7k286nvVM94egDtraxYeAvXRVGP5Li 5Kjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=87uazms/bXCoCzAJXeSGHCIkqq6xJkpFzdcyOkVr5yE=; b=JdQ2WytrfMUgN38J6UbNY30AWWFqCdOUVEFhpbMeCGr4adyTkfgzdMZXOgq2xRDRst xpNA6uYJ3strGV8ScuQ6bSzFgz7wntzwogSGYWoMmB5BH1U9j7SSXo4mgdQh/v13iQb+ Htp6E7WEaac8Lynt29idMZQ9pOuIA39B8xa8qwPFsXjgtb9AXONAUpOonacw7LWQIVbV S3OgJBtRY0HK3AfLDqiCvfNkn2fwkA5zbQ4/+KWmtFQwsSzLJ6dcKdCubxzH0oPMKsEl 7N95jEnCdOr0Zigu3ymnpuf7mTL0K6N6oze1bslQuibRixErVkaL0GO9PFIMaORBl+Y/ eMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=idmuTZrt; 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 g11-v6si13525653pgs.179.2018.11.11.16.07.55; Sun, 11 Nov 2018 16:08:10 -0800 (PST) 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=idmuTZrt; 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 S1732004AbeKLJ6C (ORCPT + 99 others); Mon, 12 Nov 2018 04:58:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:60706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731666AbeKLIRg (ORCPT ); Mon, 12 Nov 2018 03:17:36 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3C70215EA; Sun, 11 Nov 2018 22:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975260; bh=gZNaQE8QlTlaKYsxBjciVnN27KUwT9f1I1B9yK2pEjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idmuTZrtFsEnTW8VZL7o00/2ZcDCKwiSCE5wTAdHVC7kdGrCjX4yrR089xekZ3gYV 5VgomgVUhvCd5KoI27rfj/Q0c+8InQk+3wRzbZe16laKg3qKD2Sc0NFfRL+2Er761b kzh0mRksWM8hJxYzqVX9zcNUKcFd7CMEhA6bCJgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fuyun Liang , Peng Li , Salil Mehta , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 100/361] net: hns3: Check hdev state when getting link status Date: Sun, 11 Nov 2018 14:17:27 -0800 Message-Id: <20181111221633.748887699@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- 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(+) --- 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 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) { --- 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 h 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;