public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Raju Rangoju <Raju.Rangoju@amd•com>
To: <netdev@vger•kernel.org>
Cc: <thomas.lendacky@amd•com>, Raju Rangoju <Raju.Rangoju@amd•com>,
	"Sudheesh Mavila" <sudheesh.mavila@amd•com>,
	Simon Horman <simon.horman@corigine•com>,
	Shyam Sundar S K <Shyam-sundar.S-k@amd•com>
Subject: [PATCH v2 net] amd-xgbe: fix the false linkup in xgbe_phy_status
Date: Thu, 25 May 2023 15:47:28 +0530	[thread overview]
Message-ID: <20230525101728.863971-1-Raju.Rangoju@amd.com> (raw)

In the event of a change in XGBE mode, the current auto-negotiation
needs to be reset and the AN cycle needs to be re-triggerred. However,
the current code ignores the return value of xgbe_set_mode(), leading to
false information as the link is declared without checking the status
register.

Fix this by propagating the mode switch status information to
xgbe_phy_status().

Fixes: e57f7a3feaef ("amd-xgbe: Prepare for working with more than one type of phy")
Co-developed-by: Sudheesh Mavila <sudheesh.mavila@amd•com>
Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd•com>
Reviewed-by: Simon Horman <simon.horman@corigine•com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd•com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd•com>
---
Changes since v1:
- Fixed the warning "1 blamed authors not CCed"
- Fixed spelling mistake

 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 33a9574e9e04..9822648747b7 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -1329,7 +1329,7 @@ static enum xgbe_mode xgbe_phy_status_aneg(struct xgbe_prv_data *pdata)
 	return pdata->phy_if.phy_impl.an_outcome(pdata);
 }
 
-static void xgbe_phy_status_result(struct xgbe_prv_data *pdata)
+static bool xgbe_phy_status_result(struct xgbe_prv_data *pdata)
 {
 	struct ethtool_link_ksettings *lks = &pdata->phy.lks;
 	enum xgbe_mode mode;
@@ -1367,8 +1367,13 @@ static void xgbe_phy_status_result(struct xgbe_prv_data *pdata)
 
 	pdata->phy.duplex = DUPLEX_FULL;
 
-	if (xgbe_set_mode(pdata, mode) && pdata->an_again)
-		xgbe_phy_reconfig_aneg(pdata);
+	if (xgbe_set_mode(pdata, mode)) {
+		if (pdata->an_again)
+			xgbe_phy_reconfig_aneg(pdata);
+		return true;
+	}
+
+	return false;
 }
 
 static void xgbe_phy_status(struct xgbe_prv_data *pdata)
@@ -1398,7 +1403,8 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata)
 			return;
 		}
 
-		xgbe_phy_status_result(pdata);
+		if (xgbe_phy_status_result(pdata))
+			return;
 
 		if (test_bit(XGBE_LINK_INIT, &pdata->dev_state))
 			clear_bit(XGBE_LINK_INIT, &pdata->dev_state);
-- 
2.25.1


             reply	other threads:[~2023-05-25 10:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 10:17 Raju Rangoju [this message]
2023-05-25 14:41 ` [PATCH v2 net] amd-xgbe: fix the false linkup in xgbe_phy_status Tom Lendacky
2023-05-25 18:07   ` Raju Rangoju

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=20230525101728.863971-1-Raju.Rangoju@amd.com \
    --to=raju.rangoju@amd$(echo .)com \
    --cc=Shyam-sundar.S-k@amd$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=simon.horman@corigine$(echo .)com \
    --cc=sudheesh.mavila@amd$(echo .)com \
    --cc=thomas.lendacky@amd$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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