Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp178678ybc; Mon, 18 Nov 2019 22:52:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwHHeTz0ddOUnAB8QTsxsxJO/FwmNz5xlsFbymNjUfdkvrnTMcy2Gxi1tQ0dLgBZZumkZnl X-Received: by 2002:a17:906:24d4:: with SMTP id f20mr33893695ejb.182.1574146373377; Mon, 18 Nov 2019 22:52:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574146373; cv=none; d=google.com; s=arc-20160816; b=kK7QyuBda3sCyaIy9Zx55mP2GFjoxNF+YWew8jmvZe5kY15ToEF9P1ElLUWhTu2hSl Z9fagSfxSSbMCyqdW0jvP6vaA8z562n1n83++E+F6phA3JyHHmbXGOAIge0EPtq7gYb3 xBkOUjrgH3WC5y40AGdjt1Ix3SjX3veAjPdtIKL5XWa7xVSTngaiSS+NlhAfyTNS5vkx GyCxe0E/PQRttJjjxFOF83EI4CDU9nMcAat0lsAzb2AzIhhN0eqbcStlye8joQ5GnApl sHoH6oita3ftCYepkgePM863X1ZP9L+z80EE54QMMwd+YPHchjTXhVjRmrgYBwz2TUbE 3K/Q== 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=Oz/l3sFClLQ6+lVwXp1aR2JQeLdCbESuM2a6adDnPxE=; b=rN2b3RB43/xbBeDcMT0mEvmuP/7deUiI88pHsL4zecfTWxvh1hapk3bXZcJERRID8E o+gL3CJjHbI7cvm9V1q5HIyZBZ+QRJsuO9KEUftzozVNCb6PS7MyZgP6yNEzTWovmFY3 XnCisrNhP0wVBxEUQvcmtwux/PVOi+YFH+r+8Z+5tiPkkQNxkjzb83TJNDyXSTmG+i0U 0hoWQoZH8mD525NQmpPWDpVgS8De/jhDB/48kjCLsu54f6MI9GQ1SW/dB9TXzueVOhCN vs8lvi45D6PxQPAqiKUFl4ZlbWUiSRH5THJUZfRs7CkHahHO301Hbvf+NxG+qLdIL0aF hkLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCQYShrt; 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 n2si12461802ejy.60.2019.11.18.22.52.29; Mon, 18 Nov 2019 22:52:53 -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=jCQYShrt; 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 S1731695AbfKSFux (ORCPT + 99 others); Tue, 19 Nov 2019 00:50:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:48068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730300AbfKSFuu (ORCPT ); Tue, 19 Nov 2019 00:50:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9B3B4214D9; Tue, 19 Nov 2019 05:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142650; bh=Fqy9Df9VV1p/fXocuqWjl0pJ6+pzlHmrrdfJKPeH+lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCQYShrtaKMFPdcUukprgBJM6k2//mbac7gafhEsKv3feTphRR7rj+cH7GwdVXwYs 9v2WYERadfwHFLSxmF7VK98u8j+rCfzNP8OGid+nrYa2Y0WvWdNnkF7i2188BVD5Nk SCJfpVJwDalL6+cw0CF3xtRn9OHbZMGsTs0ZNXcY= 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.14 153/239] net: hns3: Fix for setting speed for phy failed problem Date: Tue, 19 Nov 2019 06:19:13 +0100 Message-Id: <20191119051332.842670211@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Fuyun Liang [ Upstream commit fd8133148eb6a733f9cfdaecd4d99f378e21d582 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 86523e8993cb9..3bb6181ff0548 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2179,7 +2179,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 -- 2.20.1