Re: [PATCH net-next v2 2/5] net: rnpgbe: Report link settings through ethtool

From: Andrew Lunn

Date: Tue Nov 17 2026 - 08:22:14 EST


On Tue, Nov 17, 2026 at 10:55:26AM +0800, Yibo Dong wrote:
> On Tue, Nov 17, 2026 at 02:54:45AM +0100, Andrew Lunn wrote:
> > On Tue, Nov 17, 2026 at 09:49:02AM +0800, Yibo Dong wrote:
> > > On Mon, Nov 16, 2026 at 02:18:28PM +0100, Andrew Lunn wrote:
> > > > > link, speed, duplex and mdix are updated asynchronously by
> > > > > the mailbox event handler, outside RTNL. link_lock protects these updates
> > > > > and provides a consistent snapshot in the getter.
> > > >
> > > > O.K, thanks for the explanation.
> > > >
> > > > I removed too much context, so i cannot see here. What about
> > > > lp_advertising? That also comes from the firmware, reported on link up
> > > > when autoneg completes.
> > > >
> > > The firmware manages autonegotiation and reports the negotiated speed
> > > and duplex through mailbox link events. However, the current mailbox
> > > interface does not expose the link partner's advertisement bitmap.
> > >
> > > Therefore, lp_advertising is currently left zero to indicate that this
> > > information is unknown to the driver.
> > >
> > > If reporting lp_advertising is must, we would need to add a new
> > > firmware mailbox command to retrieve the link partner's advertisement,
> > > or add lp_advertising to link-event mbx alongwith link, speed and
> > > duplex.
> >
> > It is not a must, but it is useful.
> >
> > Or you can just throw away your firmware, expose the MDIO bus, and let
> > phylink drive the hardware. Less code, less bugs, more functionality
> > for free.
> The GMAC provides MDIO register access, so exposing an MDIO bus is
> technically possible. However, the firmware currently manages the PHY,
> and its interface does not provide a PHY ownership handover mechanism.
> Introducing host-side PHY management would require coordinated firmware
> and driver changes to avoid independently configuring the same PHY.
>
> In addition, on this SoC, the firmware configures MDI/MDI-X through
> AXI-mapped control registers driving the PHY's pi_force_mdix_en and
> pi_force_mdix_mode inputs. This control path is outside the PHY's MDIO
> register interface.
>
> The firmware also supports link management before the host driver is
> loaded and while the host is shut down, including wake-up handling.
> On OCP platforms, it supports preserving the PHY link across driver
> reloads and host shutdown. These capabilities are already implemented
> in firmware, although driver support for them is not included in this
> series. Any future ownership handover would need to preserve them.
>
> Would it be acceptable for this series to retain the firmware-managed
> PHY design without registering an MDIO bus, and leave lp_advertising
> zero for now? If a mailbox command is added to expose the link partner's
> advertisement, we can populate lp_advertising in a follow-up patch.

You have not implemented anything special, other systems offer the
same features, using phylink. However, it is fine to implement it all
your own, rather than reuse existing software. SoC devices tend to
make use of Linux to do all this, and PCIe devices tend to reinvent
the wheel and do it in firmware. We are happy either way.

Andrew