]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bpf: Emit struct bpf_xdp_sock type in vmlinux BTF
authorAmery Hung <ameryhung@gmail.com>
Thu, 25 Sep 2025 17:00:12 +0000 (10:00 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 25 Sep 2025 21:29:46 +0000 (14:29 -0700)
Similar to other BPF UAPI struct, force emit BTF of struct bpf_xdp_sock
so that it is defined in vmlinux.h.

In a later patch, a selftest will use vmlinux.h to get the definition of
struct bpf_xdp_sock instead of bpf.h.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250925170013.1752561-1-ameryhung@gmail.com
net/core/filter.c

index b20d59bb19b8c18b10bed1daecbde9a1c2003d73..2af0a5f1d7489c19945ffb62330afb6efd574552 100644 (file)
@@ -7439,6 +7439,8 @@ u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type,
                                      offsetof(struct xdp_sock, FIELD)); \
        } while (0)
 
+       BTF_TYPE_EMIT(struct bpf_xdp_sock);
+
        switch (si->off) {
        case offsetof(struct bpf_xdp_sock, queue_id):
                BPF_XDP_SOCK_GET(queue_id);