Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3808748pxb; Mon, 1 Mar 2021 21:59:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsJO//VqExgtnUZBwGl/4RQybLBHg90hVfuVlLwunDRxeBs8IK7vDX6rbpA6ausgM53EZh X-Received: by 2002:a17:906:3899:: with SMTP id q25mr19157408ejd.157.1614664778408; Mon, 01 Mar 2021 21:59:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614664778; cv=none; d=google.com; s=arc-20160816; b=LWO0Bz/uGj++NmBt5GojXuW9CdW0x3YTs2uYaLF6eDk0OtaCjd0f3lwxLPxnC88p3D kPFu0BvcQoj0vfPgiQDB5C/iQrUO2CAtrRDq72Y0MFVDEYq0fPfj5yb9bFtWJTChaNC1 bt/NlbLRXQKN5ZZABJ1qc/sSEwjjFadW83G4EaXT8g/n0fJZw0jelBLCons7aEqafSeI S++tagcWPU03uoQ43lFUUKaPTtm/NrG7n9ssTyKEsEP/KZcrjc1TJ+EJv7RnwqShkGcq CYyG1oLuIh+fMf/C27jRKj1if08Z06CV9wpQpyMo0ZiubRpqD7XfUxGgQIo3REBa2uLQ 2IMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GNMbKCWj3xc81a6GnvcUroh2EtTc0wPvjo7x9WflrXo=; b=lnmqmRDAL6hqTNgr4mnleJFkHem+QyynkhxoiB55HTyNDiF+HnPbiCzUuj0uvOGvqI BBz98oZ0F2SF4Nr46ZNb1J+Eyjnhq3Djv/BjZDyE/7JbJCzoNNgbhVcc3RJWQ2dbr2Zt hvZvB8VYGrkqlSQBykzrU93oWR6AxgImMeuXN8ZSQPBeIsK4tdmkDXcjX28QFu3AnBzq 6/svGoNF3OlWDkPrWv8oWpHWbANiCnK+X4rWo8AXfMAqS/ZnQvFD2eUEH3CBTQVtI2iW hq7s98d6lcHuJDmOcKFoWDxS2e6H0fTXBiZ1vgF4vygDYpWCQZvCEuvbIitLHNkF9jwB sHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="STIZgFG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd8si4906452ejc.78.2021.03.01.21.59.15; Mon, 01 Mar 2021 21:59:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="STIZgFG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376964AbhCBAow (ORCPT + 99 others); Mon, 1 Mar 2021 19:44:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:51300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240407AbhCASiz (ORCPT ); Mon, 1 Mar 2021 13:38:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 33DF364EC4; Mon, 1 Mar 2021 16:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616712; bh=7K2zvyjv9akWKPPWIj37tFc4FXRluvg3aDLLjLHuAbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=STIZgFG/uUjHXDvKoGtrkjG1nmg3LQnf5kUH6+GVwOKk0vbCCZkGsoH3fW2R5NwMd uxweNTSy54kLJouGQD/vDz/VmiBaZ9Rjs/qWthO7EIHQqp/c+M+2qlz3mdIQCV+6yg 9COOm+oP3hDe21Alb6afRaUJYGDocVSDn0y1MkEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudheesh Mavila , Shyam Sundar S K , Tom Lendacky , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 070/247] net: amd-xgbe: Reset link when the link never comes back Date: Mon, 1 Mar 2021 17:11:30 +0100 Message-Id: <20210301161035.112391119@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shyam Sundar S K [ Upstream commit 84fe68eb67f9499309cffd97c1ba269de125ff14 ] Normally, auto negotiation and reconnect should be automatically done by the hardware. But there seems to be an issue where auto negotiation has to be restarted manually. This happens because of link training and so even though still connected to the partner the link never "comes back". This needs an auto-negotiation restart. Also, a change in xgbe-mdio is needed to get ethtool to recognize the link down and get the link change message. This change is only required in a backplane connection mode. Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules") Co-developed-by: Sudheesh Mavila Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c index 4d5506d928973..156a0bc8ab01d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c @@ -1345,7 +1345,7 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata) &an_restart); if (an_restart) { xgbe_phy_config_aneg(pdata); - return; + goto adjust_link; } if (pdata->phy.link) { diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 828d12bf523fe..1a617d6d2bf86 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -2595,6 +2595,14 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) if (reg & MDIO_STAT1_LSTATUS) return 1; + if (pdata->phy.autoneg == AUTONEG_ENABLE && + phy_data->port_mode == XGBE_PORT_MODE_BACKPLANE) { + if (!test_bit(XGBE_LINK_INIT, &pdata->dev_state)) { + netif_carrier_off(pdata->netdev); + *an_restart = 1; + } + } + /* No link, attempt a receiver reset cycle */ if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) { phy_data->rrc_count = 0; -- 2.27.0