From: Toke Høiland-Jørgensen <t...@redhat.com>

This updates the bpf.h UAPI header in tools/ to add the bpf chain
call-related definitions.

Signed-off-by: Toke Høiland-Jørgensen <t...@redhat.com>
---
 tools/include/uapi/linux/bpf.h |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 77c6be96d676..b03c23963af8 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -107,6 +107,9 @@ enum bpf_cmd {
        BPF_MAP_LOOKUP_AND_DELETE_ELEM,
        BPF_MAP_FREEZE,
        BPF_BTF_GET_NEXT_ID,
+       BPF_PROG_CHAIN_ADD,
+       BPF_PROG_CHAIN_DEL,
+       BPF_PROG_CHAIN_GET,
 };
 
 enum bpf_map_type {
@@ -288,6 +291,12 @@ enum bpf_attach_type {
 /* The verifier internal test flag. Behavior is undefined */
 #define BPF_F_TEST_STATE_FREQ  (1U << 3)
 
+/* Whether to enable chain call logic at program execution. If set, the program
+ * execution logic will check for and jump to chain call programs configured
+ * with the BPF_PROG_CHAIN_* commands to the bpf syscall.
+ */
+#define BPF_F_CHAIN_CALLS      (1U << 4)
+
 /* When BPF ldimm64's insn[0].src_reg != 0 then this can have
  * two extensions:
  *
@@ -510,6 +519,13 @@ union bpf_attr {
                __u64           probe_offset;   /* output: probe_offset */
                __u64           probe_addr;     /* output: probe_addr */
        } task_fd_query;
+
+       struct { /* anonymous struct used by BPF_PROG_CHAIN_* commands */
+               __u32           prev_prog_fd;
+               __u32           next_prog_fd;
+               __u32           retcode;
+               __u32           next_prog_id;   /* output: prog_id */
+       };
 } __attribute__((aligned(8)));
 
 /* The description below is an attempt at providing documentation to eBPF

Reply via email to