Subject: Re: [net-next PATCH v12 12/13] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver

From: "Russell King (Oracle)" <[email-masked]>
Date: Mon, 10 Mar 2025 11:05:53 +0000

On Mon, Mar 10, 2025 at 11:57:41AM +0100, Christian Marangi wrote:
> > > +static int an8855_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> > > +			     phy_interface_t interface,
> > > +			     const unsigned long *advertising,
> > > +			     bool permit_pause_to_mac)
> > > +{
> > > +	struct an8855_priv *priv = container_of(pcs, struct an8855_priv, pcs);
> > > +	u32 val;
> > > +	int ret;
> > > +
> > > +	/*                   !!! WELCOME TO HELL !!!                   */
> > > +
> > [... hell ...]
> 
> Will drop :( It was an easter egg for the 300 lines to configure PCS.

That wasn't a request to drop the comment, just that I didn't want to
include all that in my reply.

> > I guess, however, that as you're only using SGMII with in-band, it
> > probably doesn't make much difference, but having similar behaviour
> > in the various drivers helps with ongoing maintenance.
> 
> Do we have some driver that implement the logic of skipping the bulk of
> configuration if the mode doesn't change?

For many, it doesn't matter, but for e.g. xpcs, there may be a reset
of the XPCS when the mode changes, and there's workarounds for the
TXGBE - both of those only happen when the interface mode actually
changes.

Re-reading my .pcs_config() documentation, I really ought to mention
that .pcs_config() will be called for both interface mode changes and
for advertisement changes, and should not disrupt the link when
nothing has changed.

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