Re: [PATCH net-next] net: phy: realtek: check validity of 10GbE link-partner advertisement
From: Andrew Lunn
Date: Fri Oct 04 2024 - 17:17:54 EST
On Fri, Oct 04, 2024 at 04:50:36PM +0100, Daniel Golle wrote:
> Only use link-partner advertisement bits for 10GbE modes if they are
> actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes
> unless both of them are set.
> This prevents misinterpreting the stale 2500M link-partner advertisement
> bit in case a subsequent linkpartner doesn't do any NBase-T
> advertisement at all.
>
> Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> ---
> drivers/net/phy/realtek.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index c4d0d93523ad..d276477cf511 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -927,6 +927,10 @@ static int rtl822x_read_status(struct phy_device *phydev)
> if (lpadv < 0)
> return lpadv;
>
> + if (!(lpadv & MDIO_AN_10GBT_STAT_REMOK) ||
> + !(lpadv & MDIO_AN_10GBT_STAT_LOCOK))
> + lpadv = 0;
> +
> mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising,
> lpadv);
I know lpadv is coming from a vendor register, but does
MDIO_AN_10GBT_STAT_LOCOK and MDIO_AN_10GBT_STAT_REMOK apply if it was
also from the register defined in 802.3? I'm just wondering if this
test should be inside mii_10gbt_stat_mod_linkmode_lpa_t()?
Andrew