Subject: Re: [PATCH net-next 06/10] net: phylink: allow MAC driver to validate eee params

From: "Russell King (Oracle)" <[email-masked]>
Date: Tue, 10 Dec 2024 09:58:40 +0000

On Tue, Dec 10, 2024 at 04:21:51AM +0100, Andrew Lunn wrote:
> > +/**
> > + * mac_validate_tx_lpi() - validate the LPI parameters in EEE
> > + * @config: a pointer to a &struct phylink_config.
> > + * @e: EEE configuration to be validated.
> > + *
> > + * Validate the LPI configuration parameters in @e, returning an appropriate
> > + * error. This will be called prior to any changes being made, and must not
> > + * make any changes to existing configuration. Returns zero on success.
> 
> Maybe suggest -EOPNOTSUPP? We might then get more uniform error codes
> from MAC drivers?

-EOPNOTSUPP would be appropriate if the driver doesn't support EEE at
all. Other errors are more appropriate when validating the value of
the parameters (e.g. tx_lpi_timer.)

However, we probably need to have a discussion about the best way to
handle tx_lpi_timer values that the hardware can't deal with. Should we
handle it with a hrtimer? If so, we probably need mac_enable_tx_lpi() to
return an error code, so that the core knows that the hardware can't
cope with the value at a particular speed, and needs to switch to a
software timer (I'm not currently sure how complex that would be to
implement, but I think stmmac takes this approach.)

That could make mac_validate_tx_lpi() redundant, but then I have a
stack of DSA patches that could use this callback to indicate that
EEE is not supported.

I don't have all the answers for this, so I was hoping to kick off a
discussion in the RFC patchset before submitting something that could
be merged, but that didn't happen.

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