netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: Tom Lendacky <thomas.lendacky@amd.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Cc: Sudheesh.Mavila@amd.com,
	Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	Sudheesh Mavila <sudheesh.mavila@amd.com>
Subject: [PATCH 3/4] amd-xgbe: Reset link when the link never comes back
Date: Fri, 12 Feb 2021 23:30:09 +0530	[thread overview]
Message-ID: <20210212180010.221129-4-Shyam-sundar.S-k@amd.com> (raw)
In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com>

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 would need a reset to recover.

Also, a change in xgbe-mdio is needed to get ethtool to recognize the
link down and get the link change message.

Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 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 19ee4db0156d..4e97b4869522 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 489f1f86df99..1bb468ac9635 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -2607,6 +2607,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.25.1


  parent reply	other threads:[~2021-02-12 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 18:00 [PATCH 0/4] Bug fixes to amd-xgbe driver Shyam Sundar S K
2021-02-12 18:00 ` [PATCH 1/4] amd-xgbe: Reset the PHY rx data path when mailbox command timeout Shyam Sundar S K
2021-02-12 18:43   ` Tom Lendacky
2021-02-12 18:00 ` [PATCH 2/4] amd-xgbe: Fix NETDEV WATCHDOG transmit queue timeout warning Shyam Sundar S K
2021-02-12 18:48   ` Tom Lendacky
2021-02-12 18:00 ` Shyam Sundar S K [this message]
2021-02-12 19:01   ` [PATCH 3/4] amd-xgbe: Reset link when the link never comes back Tom Lendacky
2021-02-12 18:00 ` [PATCH 4/4] amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Shyam Sundar S K
2021-02-12 18:56   ` Florian Fainelli
2021-02-12 19:05   ` Tom Lendacky
2021-02-12 21:14   ` Heiner Kallweit
2021-02-12 18:57 ` [PATCH 0/4] Bug fixes to amd-xgbe driver Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210212180010.221129-4-Shyam-sundar.S-k@amd.com \
    --to=shyam-sundar.s-k@amd.com \
    --cc=Sudheesh.Mavila@amd.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).