Subject: Re: [PATCH RFC net-next 4/4] net: mvpp2: add EEE implementation

From: Simon Horman <[email-masked]>
Date: Fri, 9 Jun 2023 16:03:41 +0200

On Fri, Jun 09, 2023 at 10:11:31AM +0100, Russell King (Oracle) wrote:
> Add EEE support for mvpp2, using phylink's EEE implementation, which
> means we just need to implement the two methods for LPI control, and
> with the initial configuration. Only the GMAC is supported, so only
> 100M, 1G and 2.5G speeds.
> 
> Disabling LPI requires clearing a single bit. Enabling LPI needs a full
> configuration of several values, as the timer values are dependent on
> the MAC operating speed.
> 
> Signed-off-by: Russell King (Oracle) <[email-masked]>

...

> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index adc953611913..a06c455b7180 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -5716,6 +5716,31 @@ static int mvpp2_ethtool_set_rxfh_context(struct net_device *dev,
>  
>  	return mvpp22_port_rss_ctx_indir_set(port, *rss_context, indir);
>  }
> +
> +static int mvpp2_ethtool_get_eee(struct net_device *dev,
> +				 struct ethtool_eee *eee)
> +{
> +	struct mvpp2_port *port = netdev_priv(dev);
> +
> +	if (!port->phylink)
> +		return -ENOTSUPP;

Hi Russell,

perhaps EOPNOTSUPP is more appropriate here.

> +
> +	return phylink_ethtool_get_eee(port->phylink, eee);
> +}
> +
> +static int mvpp2_ethtool_set_eee(struct net_device *dev,
> +				 struct ethtool_eee *eee)
> +{
> +	struct mvpp2_port *port = netdev_priv(dev);
> +
> +	if (!port->phylink)
> +		return -ENOTSUPP;

And here.

> +
> +	if (eee->tx_lpi_timer > 255)
> +		eee->tx_lpi_timer = 255;
> +
> +	return phylink_ethtool_set_eee(port->phylink, eee);
> +}
>  /* Device ops */
>  
>  static const struct net_device_ops mvpp2_netdev_ops = {

...