Re: [PATCH net-next v15 02/15] net: ethtool: Introduce ETHTOOL_LINK_MEDIUM_* values

Andrew Lunn
2025-11-11T03:38:07Z

On Thu, Nov 06, 2025 at 10:47:27AM +0100, Maxime Chevallier wrote:
> In an effort to have a better representation of Ethernet ports,
> introduce enumeration values representing the various ethernet Mediums.
>
> This is part of the 802.3 naming convention, for example :
>
> 1000 Base T 4
> | | | |
> | | | \_ pairs (4)
> | | \___ Medium (T == Twisted Copper Pairs)
> | \_______ Baseband transmission
> \____________ Speed
>
> Other example :
>
> 10000 Base K X 4
> | | \_ lanes (4)
> | \___ encoding (BaseX is 8b/10b while BaseR is 66b/64b)
> \_____ Medium (K is backplane ethernet)
>
> In the case of representing a physical port, only the medium and number
> of pairs should be relevant. One exception would be 1000BaseX, which is
> currently also used as a medium in what appears to be any of
> 1000BaseSX, 1000BaseCX and 1000BaseLX. This was reflected in the mediums
> associated with the 1000BaseX linkmode.
>
> These mediums are set in the net/ethtool/common.c lookup table that
> maintains a list of all linkmodes with their number of lanes, medium,
> encoding, speed and duplex.
>
> One notable exception to this is 100M BaseT Ethernet. 100BaseTX is a
> 2-lanes protocol but it will also work on 4-lanes cables, so the lookup
> table contains 2 sets of lane numbers, indicating the min number of lanes
> for a protocol to work and the "nominal" number of lanes as well.
>
> Another set of exceptions are linkmodes such 100000baseLR4_ER4, where
> the same link mode seems to represent 100GBaseLR4 and 100GBaseER4. The
> macro __DEFINE_LINK_MODE_PARAMS_MEDIUMS is here used to populate the
> .mediums bitfield with all appropriate mediums.
>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Andrew