[PATCH v4 net-next 07/14] net: enetc: make enetc_set_rss_key() reusable

Vladimir Oltean vladimir.oltean at nxp.com
Mon Mar 17 09:26:17 PDT 2025


On Tue, Mar 11, 2025 at 01:38:23PM +0800, Wei Fang wrote:
> Since the offset of the RSS key registers of i.MX95 ENETC is different
> from that of LS1028A, so add enetc_get_rss_key_base() to get the base
> offset for the different chips, so that enetc_set_rss_key() can be
> reused for this trivial.

for this trivial... ? task?

> 
> Signed-off-by: Wei Fang <wei.fang at nxp.com>
> ---
>  drivers/net/ethernet/freescale/enetc/enetc.h  |  2 +-
>  .../net/ethernet/freescale/enetc/enetc4_pf.c  | 11 +----------
>  .../ethernet/freescale/enetc/enetc_ethtool.c  | 19 ++++++++++++++-----
>  .../net/ethernet/freescale/enetc/enetc_pf.c   |  2 +-
>  4 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index a98ed059a83f..f991e1aae85c 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> @@ -583,22 +583,13 @@ static void enetc4_set_trx_frame_size(struct enetc_pf *pf)
>  	enetc4_pf_reset_tc_msdu(&si->hw);
>  }
>  
> -static void enetc4_set_rss_key(struct enetc_hw *hw, const u8 *bytes)
> -{
> -	int i;
> -
> -	for (i = 0; i < ENETC_RSSHASH_KEY_SIZE / 4; i++)
> -		enetc_port_wr(hw, ENETC4_PRSSKR(i), ((u32 *)bytes)[i]);
> -}
> -
>  static void enetc4_set_default_rss_key(struct enetc_pf *pf)
>  {
>  	u8 hash_key[ENETC_RSSHASH_KEY_SIZE] = {0};
> -	struct enetc_hw *hw = &pf->si->hw;
>  
>  	/* set up hash key */
>  	get_random_bytes(hash_key, ENETC_RSSHASH_KEY_SIZE);
> -	enetc4_set_rss_key(hw, hash_key);
> +	enetc_set_rss_key(pf->si, hash_key);
>  }

The entire enetc4_set_default_rss_key() seems reusable as
enetc_set_default_rss_key(). enetc_configure_port() has the same logic.

>  
>  static void enetc4_enable_trx(struct enetc_pf *pf)



More information about the linux-arm-kernel mailing list