History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2020-01-22 The following pull-request contains BPF updates for your *net-next* tree. We've added 92 non-merge commits during the last 16 day(s) which contain a total of 320 files changed, 7532 insertions(+), 1448 deletions(-). The main changes are: 1) function by function verification and program extensions from Alexei. 2) massive cleanup of selftests/bpf from Toke and Andrii. 3) batched bpf map operations from Brian and Yonghong. 4) tcp congestion control in bpf from Martin. 5) bulking for non-map xdp_redirect form Toke. 6) bpf_send_signal_thread helper from Yonghong. ====================

David S. Miller committed 6 years ago

Commit 954b3c42 parents c5d19a6 85cc12f320 files · +7532 −1448Browse files

Showing the changes to include/uapi/linux (2 of 320 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/bpf.h +68 −4
  2. include/uapi/linux/btf.h +6 −0
include/uapi/linux/bpf.h+68−4
@@ -107,6 +107,10 @@ enum bpf_cmd { · 106 unmodified lines
107107 BPF_MAP_LOOKUP_AND_DELETE_ELEM,
108108 BPF_MAP_FREEZE,
109109 BPF_BTF_GET_NEXT_ID,
110+ BPF_MAP_LOOKUP_BATCH,
111+ BPF_MAP_LOOKUP_AND_DELETE_BATCH,
112+ BPF_MAP_UPDATE_BATCH,
113+ BPF_MAP_DELETE_BATCH,
110114 };
111115
112116 enum bpf_map_type {
@@ -136,6 +140,7 @@ enum bpf_map_type { · 23 unmodified lines
136140 BPF_MAP_TYPE_STACK,
137141 BPF_MAP_TYPE_SK_STORAGE,
138142 BPF_MAP_TYPE_DEVMAP_HASH,
143+ BPF_MAP_TYPE_STRUCT_OPS,
139144 };
140145
141146 /* Note that tracing related programs such as
@@ -174,6 +179,8 @@ enum bpf_prog_type { · 32 unmodified lines
174179 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
175180 BPF_PROG_TYPE_CGROUP_SOCKOPT,
176181 BPF_PROG_TYPE_TRACING,
182+ BPF_PROG_TYPE_STRUCT_OPS,
183+ BPF_PROG_TYPE_EXT,
177184 };
178185
179186 enum bpf_attach_type {
@@ -357,7 +364,12 @@ enum bpf_attach_type { · 177 unmodified lines
357364 /* Enable memory-mapping BPF map */
358365 #define BPF_F_MMAPABLE (1U << 10)
359366
360−/* flags for BPF_PROG_QUERY */
367+/* Flags for BPF_PROG_QUERY. */
368+
369+/* Query effective (directly attached + inherited from ancestor cgroups)
370+ * programs that will be executed for events within a cgroup.
371+ * attach_flags with this flag are returned only for directly attached programs.
372+ */
361373 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
362374
363375 enum bpf_stack_build_id_status {
@@ -397,6 +409,10 @@ union bpf_attr { · 33 unmodified lines
397409 __u32 btf_fd; /* fd pointing to a BTF type data */
398410 __u32 btf_key_type_id; /* BTF type_id of the key */
399411 __u32 btf_value_type_id; /* BTF type_id of the value */
412+ __u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
413+ * struct stored as the
414+ * map value
415+ */
400416 };
401417
402418 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -409,6 +425,23 @@ union bpf_attr { · 6 unmodified lines
409425 __u64 flags;
410426 };
411427
428+ struct { /* struct used by BPF_MAP_*_BATCH commands */
429+ __aligned_u64 in_batch; /* start batch,
430+ * NULL to start from beginning
431+ */
432+ __aligned_u64 out_batch; /* output: next start batch */
433+ __aligned_u64 keys;
434+ __aligned_u64 values;
435+ __u32 count; /* input/output:
436+ * input: # of key/value
437+ * elements
438+ * output: # of filled elements
439+ */
440+ __u32 map_fd;
441+ __u64 elem_flags;
442+ __u64 flags;
443+ } batch;
444+
412445 struct { /* anonymous struct used by BPF_PROG_LOAD command */
413446 __u32 prog_type; /* one of enum bpf_prog_type */
414447 __u32 insn_cnt;
@@ -2703,7 +2736,8 @@ union bpf_attr { · 2288 unmodified lines
27032736 *
27042737 * int bpf_send_signal(u32 sig)
27052738 * Description
2706− * Send signal *sig* to the current task.
2739+ * Send signal *sig* to the process of the current task.
2740+ * The signal may be delivered to any of this process's threads.
27072741 * Return
27082742 * 0 on success or successfully queued.
27092743 *
@@ -2831,6 +2865,33 @@ union bpf_attr { · 121 unmodified lines
28312865 * Return
28322866 * On success, the strictly positive length of the string, including
28332867 * the trailing NUL character. On error, a negative value.
2868+ *
2869+ * int bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
2870+ * Description
2871+ * Send out a tcp-ack. *tp* is the in-kernel struct tcp_sock.
2872+ * *rcv_nxt* is the ack_seq to be sent out.
2873+ * Return
2874+ * 0 on success, or a negative error in case of failure.
2875+ *
2876+ * int bpf_send_signal_thread(u32 sig)
2877+ * Description
2878+ * Send signal *sig* to the thread corresponding to the current task.
2879+ * Return
2880+ * 0 on success or successfully queued.
2881+ *
2882+ * **-EBUSY** if work queue under nmi is full.
2883+ *
2884+ * **-EINVAL** if *sig* is invalid.
2885+ *
2886+ * **-EPERM** if no permission to send the *sig*.
2887+ *
2888+ * **-EAGAIN** if bpf program can try again.
2889+ *
2890+ * u64 bpf_jiffies64(void)
2891+ * Description
2892+ * Obtain the 64bit jiffies
2893+ * Return
2894+ * The 64 bit jiffies
28342895 */
28352896 #define __BPF_FUNC_MAPPER(FN) \
28362897 FN(unspec), \
@@ -2948,7 +3009,10 @@ union bpf_attr { · 111 unmodified lines
29483009 FN(probe_read_user), \
29493010 FN(probe_read_kernel), \
29503011 FN(probe_read_user_str), \
2951− FN(probe_read_kernel_str),
3012+ FN(probe_read_kernel_str), \
3013+ FN(tcp_send_ack), \
3014+ FN(send_signal_thread), \
3015+ FN(jiffies64),
29523016
29533017 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
29543018 * function eBPF program intends to call
@@ -3349,7 +3413,7 @@ struct bpf_map_info { · 394 unmodified lines
33493413 __u32 map_flags;
33503414 char name[BPF_OBJ_NAME_LEN];
33513415 __u32 ifindex;
3352− __u32 :32;
3416+ __u32 btf_vmlinux_value_type_id;
33533417 __u64 netns_dev;
33543418 __u64 netns_ino;
33553419 __u32 btf_id;
include/uapi/linux/btf.h+6−0
@@ -146,6 +146,12 @@ enum { · 145 unmodified lines
146146 BTF_VAR_GLOBAL_EXTERN = 2,
147147 };
148148
149+enum btf_func_linkage {
150+ BTF_FUNC_STATIC = 0,
151+ BTF_FUNC_GLOBAL = 1,
152+ BTF_FUNC_EXTERN = 2,
153+};
154+
149155 /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe
150156 * additional information related to the variable such as its linkage.
151157 */