Skip to contentSkip to conversation

net: stmmac: Update default_an_inband before passing value to phylink_config

PATCH In review KhaiWenTan 3 participants 4 messages Apr 13 – Apr 16

Subsystems (4)
lore
Share & tools
lore

KhaiWenTan

author
#0 lore raw

PATCH v2 1/1 net: stmmac: Update default_an_inband before passing value to phylink_config

get_interfaces() will update both the plat->phy_interfaces and mdio_bus_data->default_an_inband based on reading a SERDES register. As get_interfaces() will be called after default_an_inband had already been read, dwmac-intel regressed as a result with incorrect default_an_inband value in phylink_config.

Therefore, we moved the priv->plat->get_interfaces() to be executed first before assigning mdio_bus_data->default_an_inband to config->default_an_inband to ensure default_an_inband is in correct value.

Fixes d3836052fe09 ("net: stmmac: intel: convert speed_mode_2500() to get_interfaces()")

---
v2:
- update commit message for better understanding (Russell King)
- corrected the blamed commit (Russell King)
v1: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -4
index 13d3cac056be..c92054648a7e 100644
@@ -1345,10 +1345,6 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
 	priv->tx_lpi_clk_stop = priv->plat->flags &
 				STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
 
-	mdio_bus_data = priv->plat->mdio_bus_data;
-	if (mdio_bus_data)
-		config->default_an_inband = mdio_bus_data->default_an_inband;
-
 	/* Get the PHY interface modes (at the PHY end of the link) that
 	 * are supported by the platform.
 	 */
@@ -1356,6 +1352,10 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
 		priv->plat->get_interfaces(priv, priv->plat->bsp_priv,
 					   config->supported_interfaces);
 
+	mdio_bus_data = priv->plat->mdio_bus_data;
+	if (mdio_bus_data)
+		config->default_an_inband = mdio_bus_data->default_an_inband;
+
 	/* Set the platform/firmware specified interface mode if the
 	 * supported interfaces have not already been provided using
 	 * phy_interface as a last resort.
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · KhaiWenTan

get_interfaces() will update both the plat->phy_interfaces and mdio_bus_data->default_an_inband based on reading a SERDES register. As get_interfaces() will be called after default_an_inband had already been read, dwmac-intel regressed as a result with incorrect default_an_inband value in phylink_config.

Quoted 6 lines

Therefore, we moved the priv->plat->get_interfaces() to be executed first before assigning mdio_bus_data->default_an_inband to config->default_an_inband to ensure default_an_inband is in correct value.

Fixes d3836052fe09 ("net: stmmac: intel: convert speed_mode_2500() to get_interfaces()")

Thanks!

I'll note that this will cause a conflict with net-next when that is eventually merged.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
maintainer
#2 lore raw
In reply to KhaiWenTan
Quoted 6 lines · KhaiWenTan

get_interfaces() will update both the plat->phy_interfaces and mdio_bus_data->default_an_inband based on reading a SERDES register. As get_interfaces() will be called after default_an_inband had already been read, dwmac-intel regressed as a result with incorrect default_an_inband value in phylink_config.

Quoted 6 lines

Therefore, we moved the priv->plat->get_interfaces() to be executed first before assigning mdio_bus_data->default_an_inband to config->default_an_inband to ensure default_an_inband is in correct value.

Fixes d3836052fe09 ("net: stmmac: intel: convert speed_mode_2500() to get_interfaces()")

Since Jakub sent the net-next PR and forwarded the trees, this patch does not apply anymore. Please rebase and repost. You can retain Russell's reviewed-by tag.

Thanks,

Paolo

author
#3 lore raw
Quoted 13 lines · Paolo Abeni
Quoted 6 lines · KhaiWenTan

get_interfaces() will update both the plat->phy_interfaces and mdio_bus_data->default_an_inband based on reading a SERDES register. As get_interfaces() will be called after default_an_inband had already been read, dwmac-intel regressed as a result with incorrect default_an_inband value in phylink_config.

Quoted 6 lines

Therefore, we moved the priv->plat->get_interfaces() to be executed first before assigning mdio_bus_data->default_an_inband to config->default_an_inband to ensure default_an_inband is in correct value.

Fixes d3836052fe09 ("net: stmmac: intel: convert speed_mode_2500() to get_interfaces()")
Quoted 7 lines

Since Jakub sent the net-next PR and forwarded the trees, this patch does not apply anymore. Please rebase and repost. You can retain Russell's reviewed-by tag.

Thanks,

Paolo

Thank you Paolo, will be rebasing the patch and update a v3.