[PATCH net-next v2 0/5] net: phylink: fix PCS without autoneg

Maxime Chevallier maxime.chevallier at bootlin.com
Mon Jan 13 08:22:55 PST 2025


Hello Russell,

On Mon, 13 Jan 2025 09:22:15 +0000
"Russell King (Oracle)" <linux at armlinux.org.uk> wrote:

> Hi,
> 
> Eric Woudstra reported that a PCS attached using 2500base-X does not
> see link when phylink is using in-band mode, but autoneg is disabled,
> despite there being a valid 2500base-X signal being received. We have
> these settings:
> 
> 	act_link_an_mode = MLO_AN_INBAND
> 	pcs_neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED
> 
> Eric diagnosed it to phylink_decode_c37_word() setting state->link
> false because the full-duplex bit isn't set in the non-existent link
> partner advertisement word (which doesn't exist because in-band
> autoneg is disabled!)
> 
> The test in phylink_mii_c22_pcs_decode_state() is supposed to catch
> this state, but since we converted PCS to use neg_mode, testing the
> Autoneg in the local advertisement is no longer sufficient - we need
> to be looking at the neg_mode, which currently isn't provided.
> 
> We need to provide this via the .pcs_get_state() method, and this
> will require modifying all PCS implementations to add the extra
> argument to this method.
> 
> Patch 1 uses the PCS neg_mode in phylink_mac_pcs_get_state() to correct
> the now obsolute usage of the Autoneg bit in the advertisement.
> 
> Patch 2 passes neg_mode into the .pcs_get_state() method, and updates
> all users.
> 
> Patch 3 adds neg_mode as an argument to the various clause 22 state
> decoder functions in phylink, modifying drivers to pass the neg_mode
> through.
> 
> Patch 4 makes use of phylink_mii_c22_pcs_decode_state() rather than
> using the Autoneg bit in the advertising field.
> 
> Patch 5 may be required for Eric's case - it ensures that we report
> the correct state for interface types that we support only one set
> of modes for when autoneg is disabled.
> 
> Changes in v2:
> - Add test for NULL pcs in patch 1
> 
> I haven't added Eric's t-b because I used a different fix in patch 1.

I stumbled on that issue last friday as well, with a MCBin and a
device I'm working on, using 1000BaseX with autoneg disabled. I didn't
get time to investigate back then, but reading this series it was
definitely that exact problem I was facing.

I missed your V1 and I just tested that V2, the problem is gone :)
Thanks !

The code LGTM to the best of my knowledge, so

Reviewed-by: Maxime Chevallier <maxime.chevallier at bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier at bootlin.com>

Thanks,

Maxime



More information about the Linux-mediatek mailing list