Subject: Re: Get MAC supported link modes for SFP port

From: Russell King - ARM Linux admin <[email-masked]>
Date: Thu, 26 Nov 2020 15:45:53 +0000

On Thu, Nov 26, 2020 at 05:37:22PM +0200, Baruch Siach wrote:
> Hi netdev list,
> 
> I am trying to retrieve all MAC supported link modes
> (ETHTOOL_LINK_MODE_*) for network interfaces with SFP port. The
> 'supported' bit mask that ETHTOOL_GLINKSETTINGS provides in
> link_mode_masks[] changes to match the SFP module that happens to be
> plugged in. When no SFP module is plugged, the bit mask looks
> meaningless.
> 
> I understand that ETHTOOL_LINK_MODE_* bits are meant to describe PHY
> level capabilities. So I would settle for a MAC level "supported rates"
> list.
> 
> Is there anything like that?

No, because there's a problem: the link modes that the MAC supports
is not a particularly certain thing. When there's no module inserted,
we don't know what interface mode may be in operation, and the
interface mode has a big handle in determining which link modes can
be supported.

For example, if it's operating as 1000BASE-X or 10GBASE-R, then we're
pretty limited to a single link mode if there's nothing else present.
If it's in SGMII, then 10/100/1000 speeds are possible but there's
no link mode to describe that - no PHY, therefore there's no copper
and therefore BASE-T is meaningless.

The ethtool link modes are, in reality, _media_ link modes. If there
is no media or socket that defines the media, there are no link modes.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!