All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Bell <grbell@redhat.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
	kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com,
	sdf@fomichev.me, andrii@kernel.org, martin.lau@linux.dev,
	eddyz87@gmail.com, memxor@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, jolsa@kernel.org, shuah@kernel.org,
	alan.maguire@oracle.com, Gregory Bell <grbell@redhat.com>
Subject: [PATCH bpf-next 0/2] selftests/bpf: Use local types for kfunc declarations
Date: Wed, 15 Apr 2026 16:00:12 -0400	[thread overview]
Message-ID: <cover.1776280396.git.grbell@redhat.com> (raw)

The xdp_flowtable and test_tunnel_kern selftests were previously
rewritten to compile with CONFIG_NF_FLOW_TABLE=m and CONFIG_NET_FOU=m.
While the compilation issues were resolved, the tests fail at
runtime. In test_tunnel_kern.c, struct bpf_fou_encap___local is
defined with the correct fields but the kfunc declarations still
reference the forward-declared struct bpf_fou_encap. Similarly,
xdp_flowtable.c uses a forward-declared struct flow_offload_tuple_rhash
as the return type for bpf_xdp_flow_lookup(). Clang emits these forward
declarations as BTF FWD types, which fail to resolve against the
module-defined STRUCT types at run time:

libbpf: extern (func ksym) 'bpf_xdp_flow_lookup': func_proto [51] incompatible with nf_flow_table [128640]
libbpf: extern (func ksym) 'bpf_skb_get_fou_encap': func_proto [79] incompatible with fou [135045]

This patch updates both selftests to use ___local type suffixes
for kernel struct type, replacing the forward declarations.

struct flow_offload_tuple_rhash___local is defined without fields
because the test only uses the returned pointer for a null check.
This avoids needing to locally define its nested types,
struct rhash_head and struct flow_offload_tuple.

I understand that fixing selftests for specific config options is
generally not a priority, but since these tests were already
rewritten to support these configs, they should work correctly
with them.

Fixes: d17f9b3 ("selftests/bpf: Fix compilation failure when CONFIG_NET_FOU!=y")
Fixes: eeb23b5 ("selftests/bpf: fix compilation failure when CONFIG_NF_FLOW_TABLE=m")

Signed-off-by: Gregory Bell <grbell@redhat.com>

Gregory Bell (2):
  selftests/bpf: Use local type for flow_offload_tuple_rhash in
    xdp_flowtable
  selftests/bpf: Use local type for bpf_fou_encap in test_tunnel_kern

 tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 12 +++++-------
 tools/testing/selftests/bpf/progs/xdp_flowtable.c    |  7 +++++--
 2 files changed, 10 insertions(+), 9 deletions(-)

-- 
2.52.0


             reply	other threads:[~2026-04-15 20:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 20:00 Gregory Bell [this message]
2026-04-15 20:00 ` [PATCH bpf-next 1/2] selftests/bpf: Use local type for flow_offload_tuple_rhash in xdp_flowtable Gregory Bell
2026-04-15 20:00 ` [PATCH bpf-next 2/2] selftests/bpf: Use local type for bpf_fou_encap in test_tunnel_kern Gregory Bell

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=cover.1776280396.git.grbell@redhat.com \
    --to=grbell@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.