[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb8b2333-cde2-4ec4-9382-f3a563954d06@lunn.ch>
Date: Fri, 8 Mar 2024 14:56:30 +0100
From: Andrew Lunn <andrew@...n.ch>
To: "Sagar Dhoot (QUIC)" <quic_sdhoot@...cinc.com>
Cc: "mkubecek@...e.cz" <mkubecek@...e.cz>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"Nagarjuna Chaganti (QUIC)" <quic_nchagant@...cinc.com>,
"Priya Tripathi (QUIC)" <quic_ppriyatr@...cinc.com>
Subject: Re: Ethtool query: Reset advertised speed modes if speed value is
not passed in "set_link_ksettings"
On Fri, Mar 08, 2024 at 06:33:00AM +0000, Sagar Dhoot (QUIC) wrote:
> Hi Andrew,
>
> Thanks for the quick response. Maybe I have put up a confusing scenario.
>
> Let me rephrase with autoneg on.
>
> 1. "ethtool eth_interface"
> 2. "ethtool -s eth_interface speed 25000 autoneg on"
phylib will ignore speed if autoneg is on
https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/phy.c#L1044
It only copies speed/duplex when autoneg is off.
if (autoneg == AUTONEG_DISABLE) {
phydev->speed = speed;
phydev->duplex = duplex;
}
When configuring the PHY:
https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/phy_device.c#L2234
if (AUTONEG_ENABLE != phydev->autoneg)
return genphy_setup_forced(phydev);
So we only force the PHY when autoneg is off, and it is
genphy_setup_forced() which uses this speed/duplex.
If you are trying to influence the link mode while autoneg is
enabled, you should be using advertise N
advertise N
Sets the speed and duplex advertised by autonegotiation.
The argument is a hexadecimal value using one or a combina‐
tion of the following values:
0x001 10baseT Half
0x002 10baseT Full
0x100000000000000000000000 10baseT1L Full
0x8000000000000000000000000 10baseT1S Full
0x10000000000000000000000000 10baseT1S Half
0x20000000000000000000000000 10baseT1S_P2MP Half
0x004 100baseT Half
0x008 100baseT Full
I think the hexadecimal part is out of date and you can now also use
symbolic names.
Another thing to think about. What does the speed here actually mean:
> 2. "ethtool -s eth_interface speed 25000 autoneg on"
phylib assumes it is the baseT speed:
ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
However, what does 25000 mean? We currently don't have a
25000BaseT. So how do you decide which of the following to select:
ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31,
ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32,
ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33,
This is where advertise N is much better, an actual linkmode, not just
a speed.
Andrew
Powered by blists - more mailing lists