diff options
Diffstat (limited to 'tools/include/uapi/linux/bpf.h')
| -rw-r--r-- | tools/include/uapi/linux/bpf.h | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index f9187b41dff6..852dc17ab47a 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
| @@ -103,6 +103,7 @@ enum bpf_cmd { | |||
| 103 | BPF_BTF_LOAD, | 103 | BPF_BTF_LOAD, |
| 104 | BPF_BTF_GET_FD_BY_ID, | 104 | BPF_BTF_GET_FD_BY_ID, |
| 105 | BPF_TASK_FD_QUERY, | 105 | BPF_TASK_FD_QUERY, |
| 106 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, | ||
| 106 | }; | 107 | }; |
| 107 | 108 | ||
| 108 | enum bpf_map_type { | 109 | enum bpf_map_type { |
| @@ -128,6 +129,8 @@ enum bpf_map_type { | |||
| 128 | BPF_MAP_TYPE_CGROUP_STORAGE, | 129 | BPF_MAP_TYPE_CGROUP_STORAGE, |
| 129 | BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, | 130 | BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, |
| 130 | BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, | 131 | BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, |
| 132 | BPF_MAP_TYPE_QUEUE, | ||
| 133 | BPF_MAP_TYPE_STACK, | ||
| 131 | }; | 134 | }; |
| 132 | 135 | ||
| 133 | enum bpf_prog_type { | 136 | enum bpf_prog_type { |
| @@ -462,6 +465,28 @@ union bpf_attr { | |||
| 462 | * Return | 465 | * Return |
| 463 | * 0 on success, or a negative error in case of failure. | 466 | * 0 on success, or a negative error in case of failure. |
| 464 | * | 467 | * |
| 468 | * int bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags) | ||
| 469 | * Description | ||
| 470 | * Push an element *value* in *map*. *flags* is one of: | ||
| 471 | * | ||
| 472 | * **BPF_EXIST** | ||
| 473 | * If the queue/stack is full, the oldest element is removed to | ||
| 474 | * make room for this. | ||
| 475 | * Return | ||
| 476 | * 0 on success, or a negative error in case of failure. | ||
| 477 | * | ||
| 478 | * int bpf_map_pop_elem(struct bpf_map *map, void *value) | ||
| 479 | * Description | ||
| 480 | * Pop an element from *map*. | ||
| 481 | * Return | ||
| 482 | * 0 on success, or a negative error in case of failure. | ||
| 483 | * | ||
| 484 | * int bpf_map_peek_elem(struct bpf_map *map, void *value) | ||
| 485 | * Description | ||
| 486 | * Get an element from *map* without removing it. | ||
| 487 | * Return | ||
| 488 | * 0 on success, or a negative error in case of failure. | ||
| 489 | * | ||
| 465 | * int bpf_probe_read(void *dst, u32 size, const void *src) | 490 | * int bpf_probe_read(void *dst, u32 size, const void *src) |
| 466 | * Description | 491 | * Description |
| 467 | * For tracing programs, safely attempt to read *size* bytes from | 492 | * For tracing programs, safely attempt to read *size* bytes from |
| @@ -1433,7 +1458,7 @@ union bpf_attr { | |||
| 1433 | * Return | 1458 | * Return |
| 1434 | * 0 on success, or a negative error in case of failure. | 1459 | * 0 on success, or a negative error in case of failure. |
| 1435 | * | 1460 | * |
| 1436 | * int bpf_skb_adjust_room(struct sk_buff *skb, u32 len_diff, u32 mode, u64 flags) | 1461 | * int bpf_skb_adjust_room(struct sk_buff *skb, s32 len_diff, u32 mode, u64 flags) |
| 1437 | * Description | 1462 | * Description |
| 1438 | * Grow or shrink the room for data in the packet associated to | 1463 | * Grow or shrink the room for data in the packet associated to |
| 1439 | * *skb* by *len_diff*, and according to the selected *mode*. | 1464 | * *skb* by *len_diff*, and according to the selected *mode*. |
| @@ -2215,6 +2240,23 @@ union bpf_attr { | |||
| 2215 | * pointer that was returned from bpf_sk_lookup_xxx\ (). | 2240 | * pointer that was returned from bpf_sk_lookup_xxx\ (). |
| 2216 | * Return | 2241 | * Return |
| 2217 | * 0 on success, or a negative error in case of failure. | 2242 | * 0 on success, or a negative error in case of failure. |
| 2243 | * | ||
| 2244 | * int bpf_msg_push_data(struct sk_buff *skb, u32 start, u32 len, u64 flags) | ||
| 2245 | * Description | ||
| 2246 | * For socket policies, insert *len* bytes into msg at offset | ||
| 2247 | * *start*. | ||
| 2248 | * | ||
| 2249 | * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a | ||
| 2250 | * *msg* it may want to insert metadata or options into the msg. | ||
| 2251 | * This can later be read and used by any of the lower layer BPF | ||
| 2252 | * hooks. | ||
| 2253 | * | ||
| 2254 | * This helper may fail if under memory pressure (a malloc | ||
| 2255 | * fails) in these cases BPF programs will get an appropriate | ||
| 2256 | * error and BPF programs will need to handle them. | ||
| 2257 | * | ||
| 2258 | * Return | ||
| 2259 | * 0 on success, or a negative error in case of failure. | ||
| 2218 | */ | 2260 | */ |
| 2219 | #define __BPF_FUNC_MAPPER(FN) \ | 2261 | #define __BPF_FUNC_MAPPER(FN) \ |
| 2220 | FN(unspec), \ | 2262 | FN(unspec), \ |
| @@ -2303,7 +2345,11 @@ union bpf_attr { | |||
| 2303 | FN(skb_ancestor_cgroup_id), \ | 2345 | FN(skb_ancestor_cgroup_id), \ |
| 2304 | FN(sk_lookup_tcp), \ | 2346 | FN(sk_lookup_tcp), \ |
| 2305 | FN(sk_lookup_udp), \ | 2347 | FN(sk_lookup_udp), \ |
| 2306 | FN(sk_release), | 2348 | FN(sk_release), \ |
| 2349 | FN(map_push_elem), \ | ||
| 2350 | FN(map_pop_elem), \ | ||
| 2351 | FN(map_peek_elem), \ | ||
| 2352 | FN(msg_push_data), | ||
| 2307 | 2353 | ||
| 2308 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper | 2354 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 2309 | * function eBPF program intends to call | 2355 | * function eBPF program intends to call |
