Skip to content

Commit

Permalink
amd-xgbe: fix the false linkup in xgbe_phy_status
Browse files Browse the repository at this point in the history
[ Upstream commit dc362e2 ]

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: e57f7a3 ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
RajuRangoju authored and gregkh committed Jun 9, 2023
1 parent d615070 commit 7164961
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,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;
Expand Down Expand Up @@ -1347,8 +1347,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)
if (!xgbe_set_mode(pdata, mode))
return false;

if (pdata->an_again)
xgbe_phy_reconfig_aneg(pdata);

return true;
}

static void xgbe_phy_status(struct xgbe_prv_data *pdata)
Expand Down Expand Up @@ -1378,7 +1383,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);
Expand Down

0 comments on commit 7164961

Please sign in to comment.