Message ID | 20230524174902.369921-1-Raju.Rangoju@amd.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] amd-xgbe: fix the false linkup in xgbe_phy_status | expand |
On Wed, May 24, 2023 at 11:19:02PM +0530, Raju Rangoju wrote: > 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 propogating the mode switch status information to nit: s/propogating/propagating/ It's probably not worth respinning this patch just to fix spelling. But please do consider running checkpatch --codespell > 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> > Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com> The above nit notwithstanding, Reviewed-by: Simon Horman <simon.horman@corigine.com>
Wed, May 24, 2023 at 07:49:02PM CEST, Raju.Rangoju@amd.com wrote: >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 propogating 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> >Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
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);