[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d697584-d860-4ee2-a2de-cbfca81600b2@davidwei.uk>
Date: Tue, 18 Jun 2024 17:46:33 -0700
From: David Wei <dw@...idwei.uk>
To: edward.cree@....com, linux-net-drivers@....com, davem@...emloft.net,
kuba@...nel.org, edumazet@...gle.com, pabeni@...hat.com
Cc: Edward Cree <ecree.xilinx@...il.com>, netdev@...r.kernel.org,
habetsm.xilinx@...il.com, sudheer.mogilappagari@...el.com,
jdamato@...tly.com, mw@...ihalf.com, linux@...linux.org.uk,
sgoutham@...vell.com, gakula@...vell.com, sbhatta@...vell.com,
hkelam@...vell.com, saeedm@...dia.com, leon@...nel.org,
jacob.e.keller@...el.com, andrew@...n.ch, ahmed.zaki@...el.com
Subject: Re: [PATCH v5 net-next 3/7] net: ethtool: record custom RSS contexts
in the XArray
On 2024-06-18 15:44, edward.cree@....com wrote:
> From: Edward Cree <ecree.xilinx@...il.com>
>
> Since drivers are still choosing the context IDs, we have to force the
> XArray to use the ID they've chosen rather than picking one ourselves,
> and handle the case where they give us an ID that's already in use.
>
> Signed-off-by: Edward Cree <ecree.xilinx@...il.com>
> ---
> include/linux/ethtool.h | 14 ++++++++
> net/ethtool/ioctl.c | 74 ++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 87 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index a68b83a6d61f..5bef46fdcb94 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -199,6 +199,17 @@ static inline u8 *ethtool_rxfh_context_key(struct ethtool_rxfh_context *ctx)
> return (u8 *)(ethtool_rxfh_context_indir(ctx) + ctx->indir_size);
> }
>
> +static inline size_t ethtool_rxfh_context_size(u32 indir_size, u32 key_size,
> + u16 priv_size)
> +{
> + size_t indir_bytes = array_size(indir_size, sizeof(u32));
> + size_t flex_len;
> +
> + flex_len = size_add(size_add(indir_bytes, key_size),
> + ALIGN(priv_size, sizeof(u32)));
> + return struct_size((struct ethtool_rxfh_context *)0, data, flex_len);
ctx->data is [ priv | indir_tbl | key ] but only priv and indir_tbl are
aligned to sizeof(u32). Why does key not need to be aligned? Is it
guaranteed to be 40 bytes?
bnxt has key_size = HW_HASH_KEY_SIZE = 40
mlx5 has key_size = mlx5e_rss_params_hash::toeplitz_hash_key = u8[40]
Powered by blists - more mailing lists