Re: [PATCH] net: phy: phy_ethtool_ksettings_set: Allow any supported speed

From: Maxime Chevallier
Date: Tue Dec 03 2024 - 11:42:22 EST


Hi Andrew,

On Tue, 3 Dec 2024 15:21:27 +0000
"Russell King (Oracle)" <linux@xxxxxxxxxxxxxxx> wrote:

> On Tue, Dec 03, 2024 at 03:45:09PM +0100, Andrew Lunn wrote:
> > On Tue, Dec 03, 2024 at 02:05:07PM +0000, Dennis Ostermann wrote:
> > > Hi,
> > >
> > > according to IEE 802.3-2022, ch. 125.2.4.3, Auto-Negotiation is optional for 2.5GBASE-T1
> > >
> > > > 125.2.4.3 Auto-Negotiation, type single differential-pair media
> > > > Auto-Negotiation (Clause 98) may be used by 2.5GBASE-T1 and 5GBASE-T1 devices to detect the
> > > > abilities (modes of operation) supported by the device at the other end of a link segment, determine common
> > > > abilities, and configure for joint operation. Auto-Negotiation is performed upon link startup through the use
> > > > of half-duplex differential Manchester encoding.
> > > > The use of Clause 98 Auto-Negotiation is optional for 2.5GBASE-T1 and 5GBASE-T1 PHYs
> > >
> > > So, purposed change could make sense for T1 PHYs.
> >
> > The proposed change it too liberal. We need the PHY to say it supports
> > 2.5GBASE-T1, not 2.5GBASE-T. We can then allow 2.5GBASE-T1 to not use
> > autoneg, but 2.5GBASE-T has to use autoneg.
>
> I'm wondering whether we should add:
>
> __ETHTOOL_DECLARE_LINK_MODE_MASK(requires_an);
>
> to struct phy_device, and have phylib populate that by default with all
> base-T link modes > 1G (which would be the default case as it is now.)
> Then, PHY drivers can change this bitmap as they need for their device.
> After the PHY features have been discovered, this should then get
> AND-ed with the supported bitmap.

If the standards says that BaseT4 >1G needs aneg, and that we can't
have it for baseT1, couldn't we just have some lookup table for each
mode indicating if they need or support aneg ? I'm thinking about
something similar as the big table in net/ethtool/common.c where we
have the linkmode - speed - duplex - lanes mapping :

https://elixir.bootlin.com/linux/v6.12.1/source/net/ethtool/common.c#L270

maybe looking it up for each config operation would be too expensive ?
or it maybe isn't flexible enough in case we have to deal with
phy-pecific quirks...

Maxime