[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <474201b2-d98c-f3ab-aed9-b008bb188d0b@redhat.com>
Date: Wed, 12 Apr 2023 13:16:53 +0200
From: Jesper Dangaard Brouer <jbrouer@...hat.com>
To: Simon Horman <simon.horman@...igine.com>
Cc: brouer@...hat.com, bpf@...r.kernel.org,
Stanislav Fomichev <sdf@...gle.com>,
Toke Høiland-Jørgensen
<toke@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, martin.lau@...nel.org,
ast@...nel.org, daniel@...earbox.net, alexandr.lobakin@...el.com,
larysa.zaremba@...el.com, xdp-hints@...-project.net,
anthony.l.nguyen@...el.com, yoong.siang.song@...el.com,
boon.leong.ong@...el.com, intel-wired-lan@...ts.osuosl.org,
pabeni@...hat.com, jesse.brandeburg@...el.com, kuba@...nel.org,
edumazet@...gle.com, john.fastabend@...il.com, hawk@...nel.org,
davem@...emloft.net, tariqt@...dia.com, saeedm@...dia.com,
leon@...nel.org, linux-rdma@...r.kernel.org
Subject: Re: [PATCH bpf V7 3/7] xdp: rss hash types representation
On 10/04/2023 17.04, Simon Horman wrote:
> On Sat, Apr 08, 2023 at 09:24:51PM +0200, Jesper Dangaard Brouer wrote:
>> The RSS hash type specifies what portion of packet data NIC hardware used
>> when calculating RSS hash value. The RSS types are focused on Internet
>> traffic protocols at OSI layers L3 and L4. L2 (e.g. ARP) often get hash
>> value zero and no RSS type. For L3 focused on IPv4 vs. IPv6, and L4
>> primarily TCP vs UDP, but some hardware supports SCTP.
>>
>> Hardware RSS types are differently encoded for each hardware NIC. Most
>> hardware represent RSS hash type as a number. Determining L3 vs L4 often
>> requires a mapping table as there often isn't a pattern or sorting
>> according to ISO layer.
>>
>> The patch introduce a XDP RSS hash type (enum xdp_rss_hash_type) that
>> contain combinations to be used by drivers, which gets build up with bits
>> from enum xdp_rss_type_bits. Both enum xdp_rss_type_bits and
>> xdp_rss_hash_type get exposed to BPF via BTF, and it is up to the
>> BPF-programmer to match using these defines.
>>
>> This proposal change the kfunc API bpf_xdp_metadata_rx_hash() adding
>> a pointer value argument for provide the RSS hash type.
>>
>> Change function signature for all xmo_rx_hash calls in drivers to make it
>> compile. The RSS type implementations for each driver comes as separate
>> patches.
>>
>> Fixes: 3d76a4d3d4e5 ("bpf: XDP metadata RX kfuncs")
>> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
>> Acked-by: Toke Høiland-Jørgensen <toke@...hat.com>
>> Acked-by: Stanislav Fomichev <sdf@...gle.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +
>> drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 3 +
>> drivers/net/veth.c | 3 +
>> include/linux/netdevice.h | 3 +
>> include/net/xdp.h | 45 ++++++++++++++++++++++
>> net/core/xdp.c | 10 ++++-
>> 6 files changed, 62 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> index 4b5e459b6d49..73d10aa4c503 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
>> @@ -681,7 +681,8 @@ int mlx4_en_xdp_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp)
>> return 0;
>> }
>>
>> -int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash)
>> +int mlx4_en_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
>> + enum xdp_rss_hash_type *rss_type)
>> {
>> struct mlx4_en_xdp_buff *_ctx = (void *)ctx;
>>
>
> Hi Jesper,
>
> I think you also need to update the declaration of mlx4_en_xdp_rx_hash()
> in mlx4_en.h.
>
Thanks a lot for spotting this. fixed in V8.
--Jesper
Powered by blists - more mailing lists