summaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorJoanne Koong <joannelkoong@gmail.com>2023-03-01 07:49:51 -0800
committerAlexei Starovoitov <ast@kernel.org>2023-03-01 09:55:24 -0800
commit05421aecd4ed65da0dc17b0c3c13779ef334e9e5 (patch)
tree4c1ab9ebfeaa8c17c0e8ac8b7ef63c9ae29dbdc6 /tools/include
parentb5964b968ac64c2ec2debee7518499113b27c34e (diff)
downloadlinux-stable-05421aecd4ed65da0dc17b0c3c13779ef334e9e5.tar.gz
linux-stable-05421aecd4ed65da0dc17b0c3c13779ef334e9e5.tar.bz2
linux-stable-05421aecd4ed65da0dc17b0c3c13779ef334e9e5.zip
bpf: Add xdp dynptrs
Add xdp dynptrs, which are dynptrs whose underlying pointer points to a xdp_buff. The dynptr acts on xdp data. xdp dynptrs have two main benefits. One is that they allow operations on sizes that are not statically known at compile-time (eg variable-sized accesses). Another is that parsing the packet data through dynptrs (instead of through direct access of xdp->data and xdp->data_end) can be more ergonomic and less brittle (eg does not need manual if checking for being within bounds of data_end). For reads and writes on the dynptr, this includes reading/writing from/to and across fragments. Data slices through the bpf_dynptr_data API are not supported; instead bpf_dynptr_slice() and bpf_dynptr_slice_rdwr() should be used. For examples of how xdp dynptrs can be used, please see the attached selftests. Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Link: https://lore.kernel.org/r/20230301154953.641654-9-joannelkoong@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index d0351d30e551..faa304c926cf 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -5344,7 +5344,7 @@ union bpf_attr {
* *len* must be a statically known value. The returned data slice
* is invalidated whenever the dynptr is invalidated.
*
- * skb type dynptrs may not use bpf_dynptr_data. They should
+ * skb and xdp type dynptrs may not use bpf_dynptr_data. They should
* instead use bpf_dynptr_slice and bpf_dynptr_slice_rdwr.
* Return
* Pointer to the underlying dynptr data, NULL if the dynptr is