netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC net-next] net: phylink: always do a major config when attaching a SFP PHY
@ 2025-01-14 13:49 Russell King (Oracle)
  2025-01-15 23:19 ` Russell King (Oracle)
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2025-01-14 13:49 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Eric Woudstra, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev

Background: https://lore.kernel.org/r/20250107123615.161095-1-ericwouds@gmail.com

Since adding negotiation of in-band capabilities, it is no longer
sufficient to just look at the MLO_AN_xxx mode and PHY interface to
decide whether to do a major configuration, since the result now
depends on the capabilities of the attaching PHY.

Always trigger a major configuration in this case.

Reported-by: Eric Woudstra <ericwouds@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
This follows on from https://lore.kernel.org/r/Z4TbR93B-X8A8iHe@shell.armlinux.org.uk "net: phylink: fix PCS without autoneg"

 drivers/net/phy/phylink.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index ff0efb52189f..7d64182cf802 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -3412,12 +3412,11 @@ static phy_interface_t phylink_choose_sfp_interface(struct phylink *pl,
 	return interface;
 }
 
-static void phylink_sfp_set_config(struct phylink *pl,
-				   unsigned long *supported,
-				   struct phylink_link_state *state)
+static void phylink_sfp_set_config(struct phylink *pl, unsigned long *supported,
+				   struct phylink_link_state *state,
+				   bool changed)
 {
 	u8 mode = MLO_AN_INBAND;
-	bool changed = false;
 
 	phylink_dbg(pl, "requesting link mode %s/%s with support %*pb\n",
 		    phylink_an_mode_str(mode), phy_modes(state->interface),
@@ -3494,7 +3493,7 @@ static int phylink_sfp_config_phy(struct phylink *pl, struct phy_device *phy)
 
 	pl->link_port = pl->sfp_port;
 
-	phylink_sfp_set_config(pl, support, &config);
+	phylink_sfp_set_config(pl, support, &config, true);
 
 	return 0;
 }
@@ -3569,7 +3568,7 @@ static int phylink_sfp_config_optical(struct phylink *pl)
 
 	pl->link_port = pl->sfp_port;
 
-	phylink_sfp_set_config(pl, pl->sfp_support, &config);
+	phylink_sfp_set_config(pl, pl->sfp_support, &config, false);
 
 	return 0;
 }
-- 
2.30.2


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

* Re: [PATCH RFC net-next] net: phylink: always do a major config when attaching a SFP PHY
  2025-01-14 13:49 [PATCH RFC net-next] net: phylink: always do a major config when attaching a SFP PHY Russell King (Oracle)
@ 2025-01-15 23:19 ` Russell King (Oracle)
  2025-01-16 18:46   ` Eric Woudstra
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2025-01-15 23:19 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Eric Woudstra, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev

Hi Eric,

I'd like to get a tested-by from you before sending this for merging,
as this should fix your reported issue.

Thanks.

On Tue, Jan 14, 2025 at 01:49:23PM +0000, Russell King (Oracle) wrote:
> Background: https://lore.kernel.org/r/20250107123615.161095-1-ericwouds@gmail.com
> 
> Since adding negotiation of in-band capabilities, it is no longer
> sufficient to just look at the MLO_AN_xxx mode and PHY interface to
> decide whether to do a major configuration, since the result now
> depends on the capabilities of the attaching PHY.
> 
> Always trigger a major configuration in this case.
> 
> Reported-by: Eric Woudstra <ericwouds@gmail.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> This follows on from https://lore.kernel.org/r/Z4TbR93B-X8A8iHe@shell.armlinux.org.uk "net: phylink: fix PCS without autoneg"
> 
>  drivers/net/phy/phylink.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index ff0efb52189f..7d64182cf802 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -3412,12 +3412,11 @@ static phy_interface_t phylink_choose_sfp_interface(struct phylink *pl,
>  	return interface;
>  }
>  
> -static void phylink_sfp_set_config(struct phylink *pl,
> -				   unsigned long *supported,
> -				   struct phylink_link_state *state)
> +static void phylink_sfp_set_config(struct phylink *pl, unsigned long *supported,
> +				   struct phylink_link_state *state,
> +				   bool changed)
>  {
>  	u8 mode = MLO_AN_INBAND;
> -	bool changed = false;
>  
>  	phylink_dbg(pl, "requesting link mode %s/%s with support %*pb\n",
>  		    phylink_an_mode_str(mode), phy_modes(state->interface),
> @@ -3494,7 +3493,7 @@ static int phylink_sfp_config_phy(struct phylink *pl, struct phy_device *phy)
>  
>  	pl->link_port = pl->sfp_port;
>  
> -	phylink_sfp_set_config(pl, support, &config);
> +	phylink_sfp_set_config(pl, support, &config, true);
>  
>  	return 0;
>  }
> @@ -3569,7 +3568,7 @@ static int phylink_sfp_config_optical(struct phylink *pl)
>  
>  	pl->link_port = pl->sfp_port;
>  
> -	phylink_sfp_set_config(pl, pl->sfp_support, &config);
> +	phylink_sfp_set_config(pl, pl->sfp_support, &config, false);
>  
>  	return 0;
>  }
> -- 
> 2.30.2
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH RFC net-next] net: phylink: always do a major config when attaching a SFP PHY
  2025-01-15 23:19 ` Russell King (Oracle)
@ 2025-01-16 18:46   ` Eric Woudstra
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Woudstra @ 2025-01-16 18:46 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev



On 1/16/25 12:19 AM, Russell King (Oracle) wrote:
> Hi Eric,
> 
> I'd like to get a tested-by from you before sending this for merging,
> as this should fix your reported issue.

Tested-by: Eric Woudstra <ericwouds@gmail.com>

It works ok, thanks.

The kernel log shows:

[root@bpir3 ~]# dmesg | grep eth1
[    2.515546] mtk_soc_eth 15100000.ethernet eth1: mediatek frame engine at 0xffff800082300000, irq 123
[   41.406446] mtk_soc_eth 15100000.ethernet eth1: configuring for inband/2500base-x link mode
[   41.414819] mtk_soc_eth 15100000.ethernet eth1: major config, requested inband/2500base-x
[   41.422983] mtk_soc_eth 15100000.ethernet eth1: interface 2500base-x inband modes: pcs=01 phy=00
[   41.431936] mtk_soc_eth 15100000.ethernet eth1: major config, active inband/inband,an-disabled/2500base-x
[   41.441523] mtk_soc_eth 15100000.ethernet eth1: phylink_mac_config: mode=inband/2500base-x/none adv=00,00000000,00008000,0000e240 pause=04
[   42.370423] mtk_soc_eth 15100000.ethernet eth1:  interface 2 (mii) rate match none supports 0-3,6-7,13-14
[   42.380034] mtk_soc_eth 15100000.ethernet eth1:  interface 3 (gmii) rate match none supports 0-3,5-7,13-14
[   42.389698] mtk_soc_eth 15100000.ethernet eth1:  interface 4 (sgmii) rate match none supports 0-3,5-7,13-14
[   42.399441] mtk_soc_eth 15100000.ethernet eth1:  interface 22 (1000base-x) rate match none supports 5-7,13-14
[   42.409348] mtk_soc_eth 15100000.ethernet eth1:  interface 23 (2500base-x) rate match none supports 6-7,13-14,47
[   42.744938] mtk_soc_eth 15100000.ethernet eth1: PHY i2c:sfp-1:11 uses interfaces 4,23, validating 4,23
[   42.754256] mtk_soc_eth 15100000.ethernet eth1:  interface 4 (sgmii) rate match none supports 0-3,5-7,13-14
[   42.800352] mtk_soc_eth 15100000.ethernet eth1:  interface 23 (2500base-x) rate match none supports 6-7,13-14,47
[   42.810541] mtk_soc_eth 15100000.ethernet eth1: PHY [i2c:sfp-1:11] driver [RTL8221B-VB-CG 2.5Gbps PHY (C45)] (irq=POLL)
[   42.821312] mtk_soc_eth 15100000.ethernet eth1: phy: 2500base-x setting supported 00,00000000,00008000,000060ef advertising 00,00000000,00008000,000060ef
[   42.835035] mtk_soc_eth 15100000.ethernet eth1: requesting link mode inband/2500base-x with support 00,00000000,00008000,000060ef
[   42.846675] mtk_soc_eth 15100000.ethernet eth1: major config, requested inband/2500base-x
[   42.854847] mtk_soc_eth 15100000.ethernet eth1: interface 2500base-x inband modes: pcs=01 phy=00
[   42.863616] mtk_soc_eth 15100000.ethernet eth1: major config, active phy/outband/2500base-x
[   42.871966] mtk_soc_eth 15100000.ethernet eth1: phylink_mac_config: mode=phy/2500base-x/none adv=00,00000000,00008000,000060ef pause=04
[   43.590342] mtk_soc_eth 15100000.ethernet eth1: phy link down 2500base-x/Unknown/Unknown/none/off
[   43.607350] brlan: port 5(eth1) entered blocking state
[   43.612481] brlan: port 5(eth1) entered disabled state
[   43.617707] mtk_soc_eth 15100000.ethernet eth1: entered allmulticast mode
[   43.624679] mtk_soc_eth 15100000.ethernet eth1: entered promiscuous mode
[   47.700338] mtk_soc_eth 15100000.ethernet eth1: phy link up 2500base-x/2.5Gbps/Full/none/rx/tx
[   47.700357] mtk_soc_eth 15100000.ethernet eth1: Link is Up - 2.5Gbps/Full - flow control rx/tx
[   47.717579] mtk_soc_eth 15100000.ethernet eth1: No phy led trigger registered for speed(2500)
[   47.734637] brlan: port 5(eth1) entered blocking state
[   47.739782] brlan: port 5(eth1) entered forwarding state


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

end of thread, other threads:[~2025-01-16 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 13:49 [PATCH RFC net-next] net: phylink: always do a major config when attaching a SFP PHY Russell King (Oracle)
2025-01-15 23:19 ` Russell King (Oracle)
2025-01-16 18:46   ` Eric Woudstra

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).