* [PATCH bpf-next 1/2] selftests/bpf: Use local type for flow_offload_tuple_rhash in xdp_flowtable
2026-04-15 20:00 [PATCH bpf-next 0/2] selftests/bpf: Use local types for kfunc declarations Gregory Bell
@ 2026-04-15 20:00 ` 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
1 sibling, 0 replies; 3+ messages in thread
From: Gregory Bell @ 2026-04-15 20:00 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, davem, kuba, hawk, john.fastabend, sdf, andrii,
martin.lau, eddyz87, memxor, song, yonghong.song, jolsa, shuah,
alan.maguire, Gregory Bell
Define flow_offload_tuple_rhash___local and use it in place of the
forward-declared kernel type for the bpf_xdp_flow_lookup kfunc return
type and tuplehash variable. This is consistent with how
bpf_flowtable_opts___local is already handled in the same file and
avoids relying on a forward declaration of the struct.
Fixes: eeb23b5 ("selftests/bpf: fix compilation failure when CONFIG_NF_FLOW_TABLE=m")
Signed-off-by: Gregory Bell <grbell@redhat.com>
---
tools/testing/selftests/bpf/progs/xdp_flowtable.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/xdp_flowtable.c b/tools/testing/selftests/bpf/progs/xdp_flowtable.c
index 7fdc7b23ee74..e67daa02749d 100644
--- a/tools/testing/selftests/bpf/progs/xdp_flowtable.c
+++ b/tools/testing/selftests/bpf/progs/xdp_flowtable.c
@@ -15,7 +15,10 @@ struct bpf_flowtable_opts___local {
s32 error;
};
-struct flow_offload_tuple_rhash *
+struct flow_offload_tuple_rhash___local {
+};
+
+struct flow_offload_tuple_rhash___local *
bpf_xdp_flow_lookup(struct xdp_md *, struct bpf_fib_lookup *,
struct bpf_flowtable_opts___local *, u32) __ksym;
@@ -67,7 +70,7 @@ int xdp_flowtable_do_lookup(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
struct bpf_flowtable_opts___local opts = {};
- struct flow_offload_tuple_rhash *tuplehash;
+ struct flow_offload_tuple_rhash___local *tuplehash;
struct bpf_fib_lookup tuple = {
.ifindex = ctx->ingress_ifindex,
};
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH bpf-next 2/2] selftests/bpf: Use local type for bpf_fou_encap in test_tunnel_kern
2026-04-15 20:00 [PATCH bpf-next 0/2] selftests/bpf: Use local types for kfunc declarations Gregory Bell
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 ` Gregory Bell
1 sibling, 0 replies; 3+ messages in thread
From: Gregory Bell @ 2026-04-15 20:00 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, davem, kuba, hawk, john.fastabend, sdf, andrii,
martin.lau, eddyz87, memxor, song, yonghong.song, jolsa, shuah,
alan.maguire, Gregory Bell
Replace the forward-declared struct bpf_fou_encap with the existing
bpf_fou_encap___local type in the bpf_skb_set_fou_encap and
bpf_skb_get_fou_encap declarations. This removes the need for
the forward declaration and the explicit casts at each call.
Fixes: d17f9b3 ("selftests/bpf: Fix compilation failure when CONFIG_NET_FOU!=y")
Signed-off-by: Gregory Bell <grbell@redhat.com>
---
tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
index 32127f1cd687..80ed5e8f2b06 100644
--- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
@@ -36,12 +36,10 @@ enum bpf_fou_encap_type___local {
FOU_BPF_ENCAP_GUE___local,
};
-struct bpf_fou_encap;
-
int bpf_skb_set_fou_encap(struct __sk_buff *skb_ctx,
- struct bpf_fou_encap *encap, int type) __ksym;
+ struct bpf_fou_encap___local *encap, int type) __ksym;
int bpf_skb_get_fou_encap(struct __sk_buff *skb_ctx,
- struct bpf_fou_encap *encap) __ksym;
+ struct bpf_fou_encap___local *encap) __ksym;
struct xfrm_state *
bpf_xdp_get_xfrm_state(struct xdp_md *ctx, struct bpf_xfrm_state_opts *opts,
u32 opts__sz) __ksym;
@@ -781,7 +779,7 @@ int ipip_gue_set_tunnel(struct __sk_buff *skb)
encap.sport = 0;
encap.dport = bpf_htons(5555);
- ret = bpf_skb_set_fou_encap(skb, (struct bpf_fou_encap *)&encap,
+ ret = bpf_skb_set_fou_encap(skb, &encap,
bpf_core_enum_value(enum bpf_fou_encap_type___local,
FOU_BPF_ENCAP_GUE___local));
if (ret < 0) {
@@ -820,7 +818,7 @@ int ipip_fou_set_tunnel(struct __sk_buff *skb)
encap.sport = 0;
encap.dport = bpf_htons(5555);
- ret = bpf_skb_set_fou_encap(skb, (struct bpf_fou_encap *)&encap,
+ ret = bpf_skb_set_fou_encap(skb, &encap,
FOU_BPF_ENCAP_FOU___local);
if (ret < 0) {
log_err(ret);
@@ -843,7 +841,7 @@ int ipip_encap_get_tunnel(struct __sk_buff *skb)
return TC_ACT_SHOT;
}
- ret = bpf_skb_get_fou_encap(skb, (struct bpf_fou_encap *)&encap);
+ ret = bpf_skb_get_fou_encap(skb, &encap);
if (ret < 0) {
log_err(ret);
return TC_ACT_SHOT;
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread