public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Chris J Arges <carges@cloudflare.com>, Joe Damato <joe@dama.to>,
	Jakub Kicinski <kuba@kernel.org>,
	Andy Gospodarek <gospo@broadcom.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Pavan Chebbi <pavan.chebbi@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Shuah Khan <shuah@kernel.org>, Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Petr Machata <petrm@nvidia.com>, David Wei <dw@davidwei.uk>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Carolina Jubran <cjubran@nvidia.com>,
	Nimrod Oren <noren@nvidia.com>, Gal Pressman <gal@nvidia.com>,
	Dimitri Daskalakis <dimitri.daskalakis1@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: Bui Quang Minh <minhquangbui99@gmail.com>,
	Daniel Zahka <daniel.zahka@gmail.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel-team <kernel-team@cloudflare.com>
Subject: Re: [PATCH net-next v4 6/6] selftests: drv-net: xdp: Add rss_hash metadata tests
Date: Tue, 17 Mar 2026 10:49:46 +0100	[thread overview]
Message-ID: <e8f25a5f-940b-4b89-8a88-ef984bd78238@kernel.org> (raw)
In-Reply-To: <20260313223029.454755-7-carges@cloudflare.com>



On 13/03/2026 23.27, Chris J Arges wrote:
> diff --git a/tools/testing/selftests/net/lib/xdp_metadata.bpf.c b/tools/testing/selftests/net/lib/xdp_metadata.bpf.c
> new file mode 100644
> index 000000000000..f71f59215239
> --- /dev/null
> +++ b/tools/testing/selftests/net/lib/xdp_metadata.bpf.c
> @@ -0,0 +1,163 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <stddef.h>
> +#include <linux/bpf.h>
> +#include <linux/in.h>
> +#include <linux/if_ether.h>
> +#include <linux/ip.h>
> +#include <linux/ipv6.h>
> +#include <linux/udp.h>
> +#include <linux/tcp.h>
> +#include <bpf/bpf_endian.h>
> +#include <bpf/bpf_helpers.h>
> +
> +enum {
> +	XDP_PORT = 1,
> +	XDP_PROTO = 4,
> +} xdp_map_setup_keys;
> +
> +struct {
> +	__uint(type, BPF_MAP_TYPE_ARRAY);
> +	__uint(max_entries, 5);
> +	__type(key, __u32);
> +	__type(value, __s32);
> +} map_xdp_setup SEC(".maps");
> +
> +/* RSS hash results: key 0 = hash, key 1 = hash type,
> + * key 2 = packet count, key 3 = error count.
> + */
> +enum {
> +	RSS_KEY_HASH = 0,
> +	RSS_KEY_TYPE = 1,
> +	RSS_KEY_PKT_CNT = 2,
> +	RSS_KEY_ERR_CNT = 3,
> +};
> +
> +struct {
> +	__uint(type, BPF_MAP_TYPE_ARRAY);
> +	__type(key, __u32);
> +	__type(value, __u32);
> +	__uint(max_entries, 4);
> +} map_rss SEC(".maps");
> +
> +/* Mirror of enum xdp_rss_hash_type from include/net/xdp.h.
> + * Needed because the enum is not part of UAPI headers.

It is on purpose that enum is not part of UAPI headers, because BPF
progs (like this) are suppose to handle this via CO-RE.

Asking CO-RE experts (e.g. Cc Andrii), will below enum xdp_rss_hash_type
usage automatically get relocated by libbpf, based on running kernel?
(or do we need some explicit bpf_core_ calls?)

> + */
> +enum xdp_rss_hash_type {
> +	XDP_RSS_L3_IPV4 = 1U << 0,
> +	XDP_RSS_L3_IPV6 = 1U << 1,
> +	XDP_RSS_L3_DYNHDR = 1U << 2,
> +	XDP_RSS_L4 = 1U << 3,
> +	XDP_RSS_L4_TCP = 1U << 4,
> +	XDP_RSS_L4_UDP = 1U << 5,
> +	XDP_RSS_L4_SCTP = 1U << 6,
> +	XDP_RSS_L4_IPSEC = 1U << 7,
> +	XDP_RSS_L4_ICMP = 1U << 8,
> +};

--Jesper

      reply	other threads:[~2026-03-17  9:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 22:27 [PATCH net-next v4 0/6] bnxt_en: Add XDP RSS hash metadata support Chris J Arges
2026-03-13 22:27 ` [PATCH net-next v4 1/6] bnxt_en: use bnxt_xdp_buff for xdp context Chris J Arges
2026-03-14  0:00   ` Joe Damato
2026-03-13 22:27 ` [PATCH net-next v4 2/6] bnxt_en: Implement XDP RSS hash metadata extraction Chris J Arges
2026-03-13 22:27 ` [PATCH net-next v4 3/6] bnxt_en: Move bnxt_rss_ext_op into header Chris J Arges
2026-03-14  0:01   ` Joe Damato
2026-03-13 22:27 ` [PATCH net-next v4 4/6] bnxt_en: Implement XDP RSS hash metadata extraction for V3_CMP Chris J Arges
2026-03-14  0:03   ` Joe Damato
2026-03-13 22:27 ` [PATCH net-next v4 5/6] selftests: net: move common xdp.py functions into lib Chris J Arges
2026-03-17  6:48   ` Mohsin Bashir
2026-03-17 14:32     ` Paolo Abeni
2026-03-13 22:27 ` [PATCH net-next v4 6/6] selftests: drv-net: xdp: Add rss_hash metadata tests Chris J Arges
2026-03-17  9:49   ` Jesper Dangaard Brouer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8f25a5f-940b-4b89-8a88-ef984bd78238@kernel.org \
    --to=hawk@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=carges@cloudflare.com \
    --cc=cjubran@nvidia.com \
    --cc=daniel.zahka@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dimitri.daskalakis1@gmail.com \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=gospo@broadcom.com \
    --cc=horms@kernel.org \
    --cc=joe@dama.to \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=minhquangbui99@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=noren@nvidia.com \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=petrm@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox