]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpf/helpers: Introduce bpf_dynptr_copy kfunc
authorMykyta Yatsenko <yatsenko@meta.com>
Wed, 26 Feb 2025 18:32:00 +0000 (18:32 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 15 Mar 2025 18:48:16 +0000 (11:48 -0700)
commitdaec295a70941c556708c59e1f970a24d8194d89
treebb16ba1f0d92b2684d15de0f40d30936cdfcf4dc
parent09206af69c5238909af208b3f46a4aa7997ac0e1
bpf/helpers: Introduce bpf_dynptr_copy kfunc

Introducing bpf_dynptr_copy kfunc allowing copying data from one dynptr to
another. This functionality is useful in scenarios such as capturing XDP
data to a ring buffer.
The implementation consists of 4 branches:
  * A fast branch for contiguous buffer capacity in both source and
destination dynptrs
  * 3 branches utilizing __bpf_dynptr_read and __bpf_dynptr_write to copy
data to/from non-contiguous buffer

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250226183201.332713-3-mykyta.yatsenko5@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c