[<prev] [next>] [day] [month] [year] [list]
Message-ID: <89dd313f-e135-4369-8818-f5259c0879b8@redhat.com>
Date: Tue, 8 Oct 2024 12:41:25 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Daniel Golle <daniel@...rotopia.org>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next] net: phy: realtek: check validity of 10GbE
link-partner advertisement
Hi,
On 10/5/24 00:06, Daniel Golle wrote:
> On Fri, Oct 04, 2024 at 11:17:28PM +0200, Andrew Lunn wrote:
>> On Fri, Oct 04, 2024 at 04:50:36PM +0100, Daniel Golle wrote:
>>> 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()?
>
> Yes, it does apply and I thought the same, but as
> mii_10gbt_stat_mod_linkmode_lpa_t is used in various places without
> checking those two bits we may break other PHYs which may not use
> them (and apparently this is mostly a problem on RealTek PHYs where
> all the other bits in the register persist in case of a non-NBase-T-
> capable subsequent link-partner after initially being connected to
> an NBase-T-capable one).
>
> Maybe we could introduce a new function
> mii_10gbt_stat_mod_linkmode_lpa_validate_t()
> which calls mii_10gbt_stat_mod_linkmode_lpa_t() but checks LOCOK and
> REMOK as a precondition?
I think this last option would be preferable.
Thanks,
Paolo
Powered by blists - more mailing lists