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. ====================
Showing the changes to include/uapi/linux (2 of 320 files). Show all
Unified · Split
| @@ -107,6 +107,10 @@ enum bpf_cmd { · 106 unmodified lines | |||
| 107 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, | 107 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, |
| 108 | BPF_MAP_FREEZE, | 108 | BPF_MAP_FREEZE, |
| 109 | BPF_BTF_GET_NEXT_ID, | 109 | 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, | ||
| 110 | }; | 114 | }; |
| 111 | 115 | ||
| 112 | enum bpf_map_type { | 116 | enum bpf_map_type { |
| @@ -136,6 +140,7 @@ enum bpf_map_type { · 23 unmodified lines | |||
| 136 | BPF_MAP_TYPE_STACK, | 140 | BPF_MAP_TYPE_STACK, |
| 137 | BPF_MAP_TYPE_SK_STORAGE, | 141 | BPF_MAP_TYPE_SK_STORAGE, |
| 138 | BPF_MAP_TYPE_DEVMAP_HASH, | 142 | BPF_MAP_TYPE_DEVMAP_HASH, |
| 143 | BPF_MAP_TYPE_STRUCT_OPS, | ||
| 139 | }; | 144 | }; |
| 140 | 145 | ||
| 141 | /* Note that tracing related programs such as | 146 | /* Note that tracing related programs such as |
| @@ -174,6 +179,8 @@ enum bpf_prog_type { · 32 unmodified lines | |||
| 174 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, | 179 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, |
| 175 | BPF_PROG_TYPE_CGROUP_SOCKOPT, | 180 | BPF_PROG_TYPE_CGROUP_SOCKOPT, |
| 176 | BPF_PROG_TYPE_TRACING, | 181 | BPF_PROG_TYPE_TRACING, |
| 182 | BPF_PROG_TYPE_STRUCT_OPS, | ||
| 183 | BPF_PROG_TYPE_EXT, | ||
| 177 | }; | 184 | }; |
| 178 | 185 | ||
| 179 | enum bpf_attach_type { | 186 | enum bpf_attach_type { |
| @@ -357,7 +364,12 @@ enum bpf_attach_type { · 177 unmodified lines | |||
| 357 | /* Enable memory-mapping BPF map */ | 364 | /* Enable memory-mapping BPF map */ |
| 358 | #define BPF_F_MMAPABLE (1U << 10) | 365 | #define BPF_F_MMAPABLE (1U << 10) |
| 359 | 366 | ||
| 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 | */ | ||
| 361 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) | 373 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) |
| 362 | 374 | ||
| 363 | enum bpf_stack_build_id_status { | 375 | enum bpf_stack_build_id_status { |
| @@ -397,6 +409,10 @@ union bpf_attr { · 33 unmodified lines | |||
| 397 | __u32 btf_fd; /* fd pointing to a BTF type data */ | 409 | __u32 btf_fd; /* fd pointing to a BTF type data */ |
| 398 | __u32 btf_key_type_id; /* BTF type_id of the key */ | 410 | __u32 btf_key_type_id; /* BTF type_id of the key */ |
| 399 | __u32 btf_value_type_id; /* BTF type_id of the value */ | 411 | __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 | */ | ||
| 400 | }; | 416 | }; |
| 401 | 417 | ||
| 402 | struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ | 418 | struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ |
| @@ -409,6 +425,23 @@ union bpf_attr { · 6 unmodified lines | |||
| 409 | __u64 flags; | 425 | __u64 flags; |
| 410 | }; | 426 | }; |
| 411 | 427 | ||
| 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 | |||
| 412 | struct { /* anonymous struct used by BPF_PROG_LOAD command */ | 445 | struct { /* anonymous struct used by BPF_PROG_LOAD command */ |
| 413 | __u32 prog_type; /* one of enum bpf_prog_type */ | 446 | __u32 prog_type; /* one of enum bpf_prog_type */ |
| 414 | __u32 insn_cnt; | 447 | __u32 insn_cnt; |
| @@ -2703,7 +2736,8 @@ union bpf_attr { · 2288 unmodified lines | |||
| 2703 | * | 2736 | * |
| 2704 | * int bpf_send_signal(u32 sig) | 2737 | * int bpf_send_signal(u32 sig) |
| 2705 | * Description | 2738 | * 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. | ||
| 2707 | * Return | 2741 | * Return |
| 2708 | * 0 on success or successfully queued. | 2742 | * 0 on success or successfully queued. |
| 2709 | * | 2743 | * |
| @@ -2831,6 +2865,33 @@ union bpf_attr { · 121 unmodified lines | |||
| 2831 | * Return | 2865 | * Return |
| 2832 | * On success, the strictly positive length of the string, including | 2866 | * On success, the strictly positive length of the string, including |
| 2833 | * the trailing NUL character. On error, a negative value. | 2867 | * 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 | ||
| 2834 | */ | 2895 | */ |
| 2835 | #define __BPF_FUNC_MAPPER(FN) \ | 2896 | #define __BPF_FUNC_MAPPER(FN) \ |
| 2836 | FN(unspec), \ | 2897 | FN(unspec), \ |
| @@ -2948,7 +3009,10 @@ union bpf_attr { · 111 unmodified lines | |||
| 2948 | FN(probe_read_user), \ | 3009 | FN(probe_read_user), \ |
| 2949 | FN(probe_read_kernel), \ | 3010 | FN(probe_read_kernel), \ |
| 2950 | FN(probe_read_user_str), \ | 3011 | 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), | ||
| 2952 | 3016 | ||
| 2953 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 3017 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 2954 | * function eBPF program intends to call | 3018 | * function eBPF program intends to call |
| @@ -3349,7 +3413,7 @@ struct bpf_map_info { · 394 unmodified lines | |||
| 3349 | __u32 map_flags; | 3413 | __u32 map_flags; |
| 3350 | char name[BPF_OBJ_NAME_LEN]; | 3414 | char name[BPF_OBJ_NAME_LEN]; |
| 3351 | __u32 ifindex; | 3415 | __u32 ifindex; |
| 3352 | __u32 :32; | 3416 | __u32 btf_vmlinux_value_type_id; |
| 3353 | __u64 netns_dev; | 3417 | __u64 netns_dev; |
| 3354 | __u64 netns_ino; | 3418 | __u64 netns_ino; |
| 3355 | __u32 btf_id; | 3419 | __u32 btf_id; |
| @@ -146,6 +146,12 @@ enum { · 145 unmodified lines | |||
| 146 | BTF_VAR_GLOBAL_EXTERN = 2, | 146 | BTF_VAR_GLOBAL_EXTERN = 2, |
| 147 | }; | 147 | }; |
| 148 | 148 | ||
| 149 | enum btf_func_linkage { | ||
| 150 | BTF_FUNC_STATIC = 0, | ||
| 151 | BTF_FUNC_GLOBAL = 1, | ||
| 152 | BTF_FUNC_EXTERN = 2, | ||
| 153 | }; | ||
| 154 | |||
| 149 | /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe | 155 | /* BTF_KIND_VAR is followed by a single "struct btf_var" to describe |
| 150 | * additional information related to the variable such as its linkage. | 156 | * additional information related to the variable such as its linkage. |
| 151 | */ | 157 | */ |