Subject: Re: [PATCH net-next v4 4/9] net: ethernet: ixgbe: Convert EEE to use linkmodes

From: Simon Horman <[email-masked]>
Date: Tue, 20 Feb 2024 12:06:43 +0000

On Sun, Feb 18, 2024 at 11:07:01AM -0600, Andrew Lunn wrote:
> Convert the tables to make use of ETHTOOL link mode bits, rather than
> the old u32 SUPPORTED speeds. Make use of the linkmode helps to set
> bits and compare linkmodes. As a result, the _u32 members of keee are
> no longer used, a step towards removing them.
> 
> Signed-off-by: Andrew Lunn <[email-masked]>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 48 ++++++++++++------------
>  1 file changed, 25 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

...

> @@ -3436,28 +3437,29 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata)
>  	if (rc)
>  		return rc;
>  
> -	edata->lp_advertised_u32 = 0;
>  	for (i = 0; i < ARRAY_SIZE(ixgbe_lp_map); ++i) {
>  		if (info[0] & ixgbe_lp_map[i].lp_advertised)
> -			edata->lp_advertised_u32 |= ixgbe_lp_map[i].mac_speed;
> +			linkmode_set_bit(ixgbe_lp_map[i].link_mode,
> +					 edata->lp_advertised);
>  	}
>  
> -	edata->supported_u32 = 0;
>  	for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) {
>  		if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed)
> -			edata->supported_u32 |= ixgbe_ls_map[i].supported;
> +			linkmode_set_bit(ixgbe_lp_map[i].link_mode,
> +					 edata->lp_advertised);

Hi Andrew,

should this be edata->supported rather than edata->lp_advertised?

>  	}
>  
> -	edata->advertised_u32 = 0;
>  	for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) {
>  		if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed)
> -			edata->advertised_u32 |= ixgbe_ls_map[i].supported;
> +			linkmode_set_bit(ixgbe_lp_map[i].link_mode,
> +					 edata->advertised);
>  	}
>  
> -	edata->eee_enabled = !!edata->advertised_u32;
> +	edata->eee_enabled = !linkmode_empty(edata->advertised);
>  	edata->tx_lpi_enabled = edata->eee_enabled;
> -	if (edata->advertised_u32 & edata->lp_advertised_u32)
> -		edata->eee_active = true;
> +
> +	linkmode_and(common, edata->advertised, edata->lp_advertised);
> +	edata->eee_active = !linkmode_empty(common);
>  
>  	return 0;
>  }

...