]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Add bpf_list_{front,back} kfunc
authorMartin KaFai Lau <martin.lau@kernel.org>
Tue, 6 May 2025 01:58:54 +0000 (18:58 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 6 May 2025 17:21:05 +0000 (10:21 -0700)
commitfb5b480205bad3936b054b86f7c9d2bd7835caac
tree482f3d6bb805e2681220ab7461ffdc7130ac9240
parent3fab84f00d3274e1fd19054a409a9c804261e4b9
bpf: Add bpf_list_{front,back} kfunc

In the kernel fq qdisc implementation, it only needs to look at
the fields of the first node in a list but does not always
need to remove it from the list. It is more convenient to have
a peek kfunc for the list. It works similar to the bpf_rbtree_first().

This patch adds bpf_list_{front,back} kfunc. The verifier is changed
such that the kfunc returning "struct bpf_list_node *" will be
marked as non-owning. The exception is the KF_ACQUIRE kfunc. The
net effect is only the new bpf_list_{front,back} kfuncs will
have its return pointer marked as non-owning.

Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20250506015857.817950-8-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c
kernel/bpf/verifier.c