[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250305-afabre-traits-010-rfc2-v1-19-d0ecfb869797@cloudflare.com>
Date: Wed, 05 Mar 2025 15:32:16 +0100
From: arthur@...hurfabre.com
To: netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: jakub@...udflare.com, hawk@...nel.org, yan@...udflare.com,
jbrandeburg@...udflare.com, thoiland@...hat.com, lbiancon@...hat.com,
Arthur Fabre <afabre@...udflare.com>
Subject: [PATCH RFC bpf-next 19/20] trait: Sync linux/bpf.h to tools/ for
trait registration
From: Arthur Fabre <afabre@...udflare.com>
Now that traits are required to be registered, the benchmarks and
selftests will need to register them.
Signed-off-by: Arthur Fabre <afabre@...udflare.com>
---
tools/include/uapi/linux/bpf.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index bb37897c039398dd3568cd007586d9b088ddeb32..748ab5a1cbe0d29d890b874aacfc4ee66b082058 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -906,6 +906,21 @@ union bpf_iter_link_info {
* A new file descriptor (a nonnegative integer), or -1 if an
* error occurred (in which case, *errno* is set appropriately).
*
+ * BPF_REGISTER_TRAIT
+ * Description
+ * Register a trait. Docs to make bpf_doc.py not error out.
+ * Return
+ * Registered trait key.
+ *
+ * BPF_UNREGISTER_TRAIT
+ * Description
+ * Unregister a trait. Needed so services registering traits
+ * can restart.
+ * But what happens if a trait is currently being used?
+ * And to in flight packets?
+ * Return
+ * -1 if an error occurred.
+ *
* NOTES
* eBPF objects (maps and programs) can be shared between processes.
*
@@ -961,6 +976,8 @@ enum bpf_cmd {
BPF_LINK_DETACH,
BPF_PROG_BIND_MAP,
BPF_TOKEN_CREATE,
+ BPF_REGISTER_TRAIT,
+ BPF_UNREGISTER_TRAIT,
__MAX_BPF_CMD,
};
@@ -1841,6 +1858,15 @@ union bpf_attr {
__u32 bpffs_fd;
} token_create;
+ struct { /* struct used by BPF_REGISTER_TRAIT command */
+ char name[BPF_OBJ_NAME_LEN];
+ __u32 flags;
+ } register_trait;
+
+ struct { /* struct used by BPF_UNREGISTER_TRAIT command */
+ __u64 trait;
+ } unregister_trait;
+
} __attribute__((aligned(8)));
/* The description below is an attempt at providing documentation to eBPF
--
2.43.0
Powered by blists - more mailing lists