]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: net_sched: Add basic bpf qdisc kfuncs
authorAmery Hung <amery.hung@bytedance.com>
Wed, 9 Apr 2025 21:45:59 +0000 (14:45 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 17 Apr 2025 17:54:40 +0000 (10:54 -0700)
commit870c28588afa20d786e2c26e8fcc14e2b9a55616
tree0b04016a3c18d4bd7b463ee3937c7dc8a4f249bb
parentc8240344956e3f0b4e8f1d40ec3435e47040cacb
bpf: net_sched: Add basic bpf qdisc kfuncs

Add basic kfuncs for working on skb in qdisc.

Both bpf_qdisc_skb_drop() and bpf_kfree_skb() can be used to release
a reference to an skb. However, bpf_qdisc_skb_drop() can only be called
in .enqueue where a to_free skb list is available from kernel to defer
the release. bpf_kfree_skb() should be used elsewhere. It is also used
in bpf_obj_free_fields() when cleaning up skb in maps and collections.

bpf_skb_get_hash() returns the flow hash of an skb, which can be used
to build flow-based queueing algorithms.

Finally, allow users to create read-only dynptr via bpf_dynptr_from_skb().

Signed-off-by: Amery Hung <amery.hung@bytedance.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://patch.msgid.link/20250409214606.2000194-4-ameryhung@gmail.com
net/sched/bpf_qdisc.c