]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
uapi: update bpf.h and btf.h
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 29 Jan 2020 13:45:53 +0000 (05:45 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 29 Jan 2020 13:45:53 +0000 (05:45 -0800)
Upstream headers from 5.6 pre rc1

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
include/uapi/linux/bpf.h
include/uapi/linux/btf.h

index 3e3f6e8d01cb34bb7fb79c452a183af9aa96d840..2a8701bf7a8cdc21be9aa7ad46188d2aeca75115 100644 (file)
@@ -107,6 +107,10 @@ enum bpf_cmd {
        BPF_MAP_LOOKUP_AND_DELETE_ELEM,
        BPF_MAP_FREEZE,
        BPF_BTF_GET_NEXT_ID,
+       BPF_MAP_LOOKUP_BATCH,
+       BPF_MAP_LOOKUP_AND_DELETE_BATCH,
+       BPF_MAP_UPDATE_BATCH,
+       BPF_MAP_DELETE_BATCH,
 };
 
 enum bpf_map_type {
@@ -136,6 +140,7 @@ enum bpf_map_type {
        BPF_MAP_TYPE_STACK,
        BPF_MAP_TYPE_SK_STORAGE,
        BPF_MAP_TYPE_DEVMAP_HASH,
+       BPF_MAP_TYPE_STRUCT_OPS,
 };
 
 /* Note that tracing related programs such as
@@ -174,6 +179,8 @@ enum bpf_prog_type {
        BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
        BPF_PROG_TYPE_CGROUP_SOCKOPT,
        BPF_PROG_TYPE_TRACING,
+       BPF_PROG_TYPE_STRUCT_OPS,
+       BPF_PROG_TYPE_EXT,
 };
 
 enum bpf_attach_type {
@@ -357,7 +364,12 @@ enum bpf_attach_type {
 /* Enable memory-mapping BPF map */
 #define BPF_F_MMAPABLE         (1U << 10)
 
-/* flags for BPF_PROG_QUERY */
+/* Flags for BPF_PROG_QUERY. */
+
+/* Query effective (directly attached + inherited from ancestor cgroups)
+ * programs that will be executed for events within a cgroup.
+ * attach_flags with this flag are returned only for directly attached programs.
+ */
 #define BPF_F_QUERY_EFFECTIVE  (1U << 0)
 
 enum bpf_stack_build_id_status {
@@ -397,6 +409,10 @@ union bpf_attr {
                __u32   btf_fd;         /* fd pointing to a BTF type data */
                __u32   btf_key_type_id;        /* BTF type_id of the key */
                __u32   btf_value_type_id;      /* BTF type_id of the value */
+               __u32   btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
+                                                  * struct stored as the
+                                                  * map value
+                                                  */
        };
 
        struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -409,6 +425,23 @@ union bpf_attr {
                __u64           flags;
        };
 
+       struct { /* struct used by BPF_MAP_*_BATCH commands */
+               __aligned_u64   in_batch;       /* start batch,
+                                                * NULL to start from beginning
+                                                */
+               __aligned_u64   out_batch;      /* output: next start batch */
+               __aligned_u64   keys;
+               __aligned_u64   values;
+               __u32           count;          /* input/output:
+                                                * input: # of key/value
+                                                * elements
+                                                * output: # of filled elements
+                                                */
+               __u32           map_fd;
+               __u64           elem_flags;
+               __u64           flags;
+       } batch;
+
        struct { /* anonymous struct used by BPF_PROG_LOAD command */
                __u32           prog_type;      /* one of enum bpf_prog_type */
                __u32           insn_cnt;
@@ -2703,7 +2736,8 @@ union bpf_attr {
  *
  * int bpf_send_signal(u32 sig)
  *     Description
- *             Send signal *sig* to the current task.
+ *             Send signal *sig* to the process of the current task.
+ *             The signal may be delivered to any of this process's threads.
  *     Return
  *             0 on success or successfully queued.
  *
@@ -2831,6 +2865,33 @@ union bpf_attr {
  *     Return
  *             On success, the strictly positive length of the string, including
  *             the trailing NUL character. On error, a negative value.
+ *
+ * int bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
+ *     Description
+ *             Send out a tcp-ack. *tp* is the in-kernel struct tcp_sock.
+ *             *rcv_nxt* is the ack_seq to be sent out.
+ *     Return
+ *             0 on success, or a negative error in case of failure.
+ *
+ * int bpf_send_signal_thread(u32 sig)
+ *     Description
+ *             Send signal *sig* to the thread corresponding to the current task.
+ *     Return
+ *             0 on success or successfully queued.
+ *
+ *             **-EBUSY** if work queue under nmi is full.
+ *
+ *             **-EINVAL** if *sig* is invalid.
+ *
+ *             **-EPERM** if no permission to send the *sig*.
+ *
+ *             **-EAGAIN** if bpf program can try again.
+ *
+ * u64 bpf_jiffies64(void)
+ *     Description
+ *             Obtain the 64bit jiffies
+ *     Return
+ *             The 64 bit jiffies
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2948,7 +3009,10 @@ union bpf_attr {
        FN(probe_read_user),            \
        FN(probe_read_kernel),          \
        FN(probe_read_user_str),        \
-       FN(probe_read_kernel_str),
+       FN(probe_read_kernel_str),      \
+       FN(tcp_send_ack),               \
+       FN(send_signal_thread),         \
+       FN(jiffies64),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -3349,7 +3413,7 @@ struct bpf_map_info {
        __u32 map_flags;
        char  name[BPF_OBJ_NAME_LEN];
        __u32 ifindex;
-       __u32 :32;
+       __u32 btf_vmlinux_value_type_id;
        __u64 netns_dev;
        __u64 netns_ino;
        __u32 btf_id;
index 7467223dc672f4bdfcbba293aa720d42f1d9d300..4a42eb481f759dfdf2879ba502c42c4587fe0d50 100644 (file)
@@ -146,6 +146,12 @@ enum {
        BTF_VAR_GLOBAL_EXTERN = 2,
 };
 
+enum btf_func_linkage {
+       BTF_FUNC_STATIC = 0,
+       BTF_FUNC_GLOBAL = 1,
+       BTF_FUNC_EXTERN = 2,
+};
+
 /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe
  * additional information related to the variable such as its linkage.
  */