netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phylink: set phy_state interface when attaching SFP
@ 2023-11-25  4:56 Daniel Golle
  2023-11-25  8:28 ` Russell King (Oracle)
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Golle @ 2023-11-25  4:56 UTC (permalink / raw)
  To: Russell King, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Marek Behún,
	Pali Rohár, netdev, linux-kernel
  Cc: Eric Woudstra, John Crispin

Assume 'usxgmii' being set as initial interface mode in DTS. Now plug
a 2.5GBase-T SFP module with exposed PHY. Currently this results in
a rather bizare situation:

RTL8221B-VB-CG 2.5Gbps PHY (C45) i2c:sfp1-wan:11: rtl822x_c45_get_features: supported=00,00000000,00008000,000080ef
mtk_soc_eth 15100000.ethernet eth2: requesting link mode phy/2500base-x with support 00,00000000,00008000,0000e0ef
mtk_soc_eth 15100000.ethernet eth2: switched to phy/2500base-x link mode   <<< !!!!!!
mtk_soc_eth 15100000.ethernet eth2: major config usxgmii    <<< !!!!!!
mtk_soc_eth 15100000.ethernet eth2: phylink_mac_config: mode=phy/usxgmii/none adv=00,00000000,00000000,00000000 pause=00
mtk_soc_eth 15100000.ethernet eth2: PHY [i2c:sfp1-wan:11] driver [RTL8221B-VB-CG 2.5Gbps PHY (C45)] (irq=POLL)
mtk_soc_eth 15100000.ethernet eth2: phy: 2500base-x setting supported 00,00000000,00008000,0000e0ef advertising 00,00000000,00008000,0000e0ef

Then the link seemingly comes up (but is dead) because no subsequent
call to phylink_major_config actually configured MAC and PCS for
2500base-x mode.

This is because phylink_mac_initial_config() considers
pl->phy_state.interface if in MLO_AN_PHY mode while
phylink_sfp_set_config() only sets pl->link_config.interface.

Also set pl->phy_state.interface in phylink_sfp_set_config().

Fixes: 31eb8907aa5b ("net: phylink: allow attaching phy for SFP modules on 802.3z mode")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/phy/phylink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index aa842634d5c2c..21ef77e4fe720 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -3056,6 +3056,7 @@ static void phylink_sfp_set_config(struct phylink *pl, u8 mode,
 	    pl->link_config.interface != state->interface) {
 		pl->cur_link_an_mode = mode;
 		pl->link_config.interface = state->interface;
+		pl->phy_state.interface = state->interface;
 
 		changed = true;
 
-- 
2.42.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-02  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-25  4:56 [PATCH net] net: phylink: set phy_state interface when attaching SFP Daniel Golle
2023-11-25  8:28 ` Russell King (Oracle)
2023-12-01 18:19   ` Daniel Golle
2023-12-02  9:18     ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).