Subject: Re: [PATCH RFC net-next 3/6] net: dsa: sja1105: use .mac_select_pcs() interface

From: "Russell King (Oracle)" <[email-masked]>
Date: Fri, 25 Feb 2022 10:57:40 +0000

On Fri, Feb 25, 2022 at 12:39:13PM +0200, Vladimir Oltean wrote:
> On Thu, Feb 24, 2022 at 04:15:26PM +0000, Russell King (Oracle) wrote:
> > Convert the PCS selection to use mac_select_pcs, which allows the PCS
> > to perform any validation it needs, and removes the need to set the PCS
> > in the mac_config() callback, delving into the higher DSA levels to do
> > so.
> > 
> > Signed-off-by: Russell King (Oracle) <[email-masked]>
> > ---
> 
> Reviewed-by: Vladimir Oltean <[email-masked]>

Thanks.

> > -	.phylink_mac_config	= sja1105_mac_config,
> 
> Deleting sja1105_mac_config() here is safe not because
> phylink_mac_config() stops calling pl->mac_ops->mac_config(), but
> because dsa_port_phylink_mac_config() first checks whether
> ds->ops->phylink_mac_config is implemented, and that is purely an
> artefact of providing a phylib-style ds->ops->adjust_link, right?

Yes and no.

We already have a several DSA drivers that have NULL phylink_mac_config
and that don't provide an adjust_link function. Even if adjust_link was
eventually killed off, the test in dsa_port_phylink_mac_config() would
still be necessary unless all these DSA drivers are updated with a stub
function for it.

Consequently, I view phylink_mac_config in DSA as entirely optional and
that optionality is already very much a part of the DSA interface, even
though that is not the case with the corresponding phylink_mac_ops
.mac_config method.

Moreover, this optionality is a common theme in DSA switch operations
methods.

> Maybe it's worth mentioning.

Given that .phylink_mac_config is already established as being optional
in DSA, does the addition of one more instance need to be explicitly
mentioned?

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