add support for BPF_PROG_TEST_RUN command to libbpf.a
Showing the changes to tools/include/uapi/linux (1 of 3 files). Show all
Unified · Split
| @@ -81,6 +81,7 @@ enum bpf_cmd { · 80 unmodified lines | |||
| 81 | BPF_OBJ_GET, | 81 | BPF_OBJ_GET, |
| 82 | BPF_PROG_ATTACH, | 82 | BPF_PROG_ATTACH, |
| 83 | BPF_PROG_DETACH, | 83 | BPF_PROG_DETACH, |
| 84 | BPF_PROG_TEST_RUN, | ||
| 84 | }; | 85 | }; |
| 85 | 86 | ||
| 86 | enum bpf_map_type { | 87 | enum bpf_map_type { |
| @@ -189,6 +190,17 @@ union bpf_attr { · 102 unmodified lines | |||
| 189 | __u32 attach_type; | 190 | __u32 attach_type; |
| 190 | __u32 attach_flags; | 191 | __u32 attach_flags; |
| 191 | }; | 192 | }; |
| 193 | |||
| 194 | struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */ | ||
| 195 | __u32 prog_fd; | ||
| 196 | __u32 retval; | ||
| 197 | __u32 data_size_in; | ||
| 198 | __u32 data_size_out; | ||
| 199 | __aligned_u64 data_in; | ||
| 200 | __aligned_u64 data_out; | ||
| 201 | __u32 repeat; | ||
| 202 | __u32 duration; | ||
| 203 | } test; | ||
| 192 | } __attribute__((aligned(8))); | 204 | } __attribute__((aligned(8))); |
| 193 | 205 | ||
| 194 | /* BPF helper function descriptions: | 206 | /* BPF helper function descriptions: |
| @@ -459,6 +471,18 @@ union bpf_attr { · 264 unmodified lines | |||
| 459 | * Return: | 471 | * Return: |
| 460 | * > 0 length of the string including the trailing NUL on success | 472 | * > 0 length of the string including the trailing NUL on success |
| 461 | * < 0 error | 473 | * < 0 error |
| 474 | * | ||
| 475 | * u64 bpf_bpf_get_socket_cookie(skb) | ||
| 476 | * Get the cookie for the socket stored inside sk_buff. | ||
| 477 | * @skb: pointer to skb | ||
| 478 | * Return: 8 Bytes non-decreasing number on success or 0 if the socket | ||
| 479 | * field is missing inside sk_buff | ||
| 480 | * | ||
| 481 | * u32 bpf_get_socket_uid(skb) | ||
| 482 | * Get the owner uid of the socket stored inside sk_buff. | ||
| 483 | * @skb: pointer to skb | ||
| 484 | * Return: uid of the socket owner on success or 0 if the socket pointer | ||
| 485 | * inside sk_buff is NULL | ||
| 462 | */ | 486 | */ |
| 463 | #define __BPF_FUNC_MAPPER(FN) \ | 487 | #define __BPF_FUNC_MAPPER(FN) \ |
| 464 | FN(unspec), \ | 488 | FN(unspec), \ |