Skip to content

Commit dc362e2

Browse files
RajuRangojudavem330
authored andcommitted
amd-xgbe: fix the false linkup in xgbe_phy_status
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>
1 parent 8a0d57d commit dc362e2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ static enum xgbe_mode xgbe_phy_status_aneg(struct xgbe_prv_data *pdata)
13291329
return pdata->phy_if.phy_impl.an_outcome(pdata);
13301330
}
13311331

1332-
static void xgbe_phy_status_result(struct xgbe_prv_data *pdata)
1332+
static bool xgbe_phy_status_result(struct xgbe_prv_data *pdata)
13331333
{
13341334
struct ethtool_link_ksettings *lks = &pdata->phy.lks;
13351335
enum xgbe_mode mode;
@@ -1367,8 +1367,13 @@ static void xgbe_phy_status_result(struct xgbe_prv_data *pdata)
13671367

13681368
pdata->phy.duplex = DUPLEX_FULL;
13691369

1370-
if (xgbe_set_mode(pdata, mode) && pdata->an_again)
1370+
if (!xgbe_set_mode(pdata, mode))
1371+
return false;
1372+
1373+
if (pdata->an_again)
13711374
xgbe_phy_reconfig_aneg(pdata);
1375+
1376+
return true;
13721377
}
13731378

13741379
static void xgbe_phy_status(struct xgbe_prv_data *pdata)
@@ -1398,7 +1403,8 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata)
13981403
return;
13991404
}
14001405

1401-
xgbe_phy_status_result(pdata);
1406+
if (xgbe_phy_status_result(pdata))
1407+
return;
14021408

14031409
if (test_bit(XGBE_LINK_INIT, &pdata->dev_state))
14041410
clear_bit(XGBE_LINK_INIT, &pdata->dev_state);

0 commit comments

Comments
 (0)