Re: [PATCH net-next] net: phy: populate host_interfaces when attaching PHY

From: Russell King (Oracle)
Date: Wed Oct 09 2024 - 05:01:46 EST


On Wed, Oct 09, 2024 at 02:57:03AM +0100, Daniel Golle wrote:
> Use bitmask of interfaces supported by the MAC for the PHY to choose
> from if the declared interface mode is among those using a single pair
> of SerDes lanes.
> This will allow 2500Base-T PHYs to switch to SGMII on most hosts, which
> results in half-duplex being supported in case the MAC supports that.
> Without this change, 2500Base-T PHYs will always operate in 2500Base-X
> mode with rate-matching, which is not only wasteful in terms of energy
> consumption, but also limits the supported interface modes to
> full-duplex only.

We've had a similar patch before, and it's been NAK'd. The problem is
that supplying the host_interfaces for built-in PHYs means that the
hardware strapping for the PHY interface mode becomes useless, as does
the DT property specifying it - and thus we may end up selecting a
mode that both the MAC and PHY support, but the hardware design
doesn't (e.g. signals aren't connected, signal speed to fast.)

For example, take a board designed to use RXAUI and the host supports
10GBASE-R. The first problem is, RXAUI is not listed in the SFP
interface list because it's not usable over a SFP cage. So, the
host_interfaces excludes that, and thus the PHY thinks that's not
supported. It looks at the mask and sees only 10GBASE-R, and
decides to use that instead with rate matching. The MAC doesn't have
support for flow control, and thus can't use rate matching.

Not only have the electrical charateristics been violated by selecting
a faster interface than the hardware was designed for, but we now have
rate matching being used when it shouldn't be.

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