Showing the changes to tools/include/uapi (1 of 9242 files). Show all
Unified · Split
| @@ -82,6 +82,11 @@ enum bpf_cmd { · 81 unmodified lines | ||
| 82 | 82 | BPF_PROG_ATTACH, |
| 83 | 83 | BPF_PROG_DETACH, |
| 84 | 84 | BPF_PROG_TEST_RUN, |
| 85 | + BPF_PROG_GET_NEXT_ID, | |
| 86 | + BPF_MAP_GET_NEXT_ID, | |
| 87 | + BPF_PROG_GET_FD_BY_ID, | |
| 88 | + BPF_MAP_GET_FD_BY_ID, | |
| 89 | + BPF_OBJ_GET_INFO_BY_FD, | |
| 85 | 90 | }; |
| 86 | 91 | |
| 87 | 92 | enum bpf_map_type { |
| @@ -115,12 +120,14 @@ enum bpf_prog_type { · 27 unmodified lines | ||
| 115 | 120 | BPF_PROG_TYPE_LWT_IN, |
| 116 | 121 | BPF_PROG_TYPE_LWT_OUT, |
| 117 | 122 | BPF_PROG_TYPE_LWT_XMIT, |
| 123 | + BPF_PROG_TYPE_SOCK_OPS, | |
| 118 | 124 | }; |
| 119 | 125 | |
| 120 | 126 | enum bpf_attach_type { |
| 121 | 127 | BPF_CGROUP_INET_INGRESS, |
| 122 | 128 | BPF_CGROUP_INET_EGRESS, |
| 123 | 129 | BPF_CGROUP_INET_SOCK_CREATE, |
| 130 | + BPF_CGROUP_SOCK_OPS, | |
| 124 | 131 | __MAX_BPF_ATTACH_TYPE |
| 125 | 132 | }; |
| 126 | 133 | |
| @@ -209,6 +216,21 @@ union bpf_attr { · 82 unmodified lines | ||
| 209 | 216 | __u32 repeat; |
| 210 | 217 | __u32 duration; |
| 211 | 218 | } test; |
| 219 | + | |
| 220 | + struct { /* anonymous struct used by BPF_*_GET_*_ID */ | |
| 221 | + union { | |
| 222 | + __u32 start_id; | |
| 223 | + __u32 prog_id; | |
| 224 | + __u32 map_id; | |
| 225 | + }; | |
| 226 | + __u32 next_id; | |
| 227 | + }; | |
| 228 | + | |
| 229 | + struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */ | |
| 230 | + __u32 bpf_fd; | |
| 231 | + __u32 info_len; | |
| 232 | + __aligned_u64 info; | |
| 233 | + } info; | |
| 212 | 234 | } __attribute__((aligned(8))); |
| 213 | 235 | |
| 214 | 236 | /* BPF helper function descriptions: |
| @@ -313,8 +335,11 @@ union bpf_attr { · 98 unmodified lines | ||
| 313 | 335 | * @flags: room for future extensions |
| 314 | 336 | * Return: 0 on success or negative error |
| 315 | 337 | * |
| 316 | − * u64 bpf_perf_event_read(&map, index) | |
| 317 | − * Return: Number events read or error code | |
| 338 | + * u64 bpf_perf_event_read(map, flags) | |
| 339 | + * read perf event counter value | |
| 340 | + * @map: pointer to perf_event_array map | |
| 341 | + * @flags: index of event in the map or bitmask flags | |
| 342 | + * Return: value of perf event counter read or error code | |
| 318 | 343 | * |
| 319 | 344 | * int bpf_redirect(ifindex, flags) |
| 320 | 345 | * redirect to another netdev |
| @@ -328,11 +353,11 @@ union bpf_attr { · 7 unmodified lines | ||
| 328 | 353 | * @skb: pointer to skb |
| 329 | 354 | * Return: realm if != 0 |
| 330 | 355 | * |
| 331 | − * int bpf_perf_event_output(ctx, map, index, data, size) | |
| 356 | + * int bpf_perf_event_output(ctx, map, flags, data, size) | |
| 332 | 357 | * output perf raw sample |
| 333 | 358 | * @ctx: struct pt_regs* |
| 334 | 359 | * @map: pointer to perf_event_array map |
| 335 | − * @index: index of event in the map | |
| 360 | + * @flags: index of event in the map or bitmask flags | |
| 336 | 361 | * @data: data on stack to be output as raw data |
| 337 | 362 | * @size: size of data |
| 338 | 363 | * Return: 0 on success or negative error |
| @@ -490,6 +515,30 @@ union bpf_attr { · 151 unmodified lines | ||
| 490 | 515 | * Get the owner uid of the socket stored inside sk_buff. |
| 491 | 516 | * @skb: pointer to skb |
| 492 | 517 | * Return: uid of the socket owner on success or overflowuid if failed. |
| 518 | + * | |
| 519 | + * u32 bpf_set_hash(skb, hash) | |
| 520 | + * Set full skb->hash. | |
| 521 | + * @skb: pointer to skb | |
| 522 | + * @hash: hash to set | |
| 523 | + * | |
| 524 | + * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen) | |
| 525 | + * Calls setsockopt. Not all opts are available, only those with | |
| 526 | + * integer optvals plus TCP_CONGESTION. | |
| 527 | + * Supported levels: SOL_SOCKET and IPROTO_TCP | |
| 528 | + * @bpf_socket: pointer to bpf_socket | |
| 529 | + * @level: SOL_SOCKET or IPROTO_TCP | |
| 530 | + * @optname: option name | |
| 531 | + * @optval: pointer to option value | |
| 532 | + * @optlen: length of optval in byes | |
| 533 | + * Return: 0 or negative error | |
| 534 | + * | |
| 535 | + * int bpf_skb_adjust_room(skb, len_diff, mode, flags) | |
| 536 | + * Grow or shrink room in sk_buff. | |
| 537 | + * @skb: pointer to skb | |
| 538 | + * @len_diff: (signed) amount of room to grow/shrink | |
| 539 | + * @mode: operation mode (enum bpf_adj_room_mode) | |
| 540 | + * @flags: reserved for future use | |
| 541 | + * Return: 0 on success or negative error code | |
| 493 | 542 | */ |
| 494 | 543 | #define __BPF_FUNC_MAPPER(FN) \ |
| 495 | 544 | FN(unspec), \ |
| @@ -539,7 +588,10 @@ union bpf_attr { · 43 unmodified lines | ||
| 539 | 588 | FN(xdp_adjust_head), \ |
| 540 | 589 | FN(probe_read_str), \ |
| 541 | 590 | FN(get_socket_cookie), \ |
| 542 | − FN(get_socket_uid), | |
| 591 | + FN(get_socket_uid), \ | |
| 592 | + FN(set_hash), \ | |
| 593 | + FN(setsockopt), \ | |
| 594 | + FN(skb_adjust_room), | |
| 543 | 595 | |
| 544 | 596 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 545 | 597 | * function eBPF program intends to call |
| @@ -589,6 +641,11 @@ enum bpf_func_id { · 43 unmodified lines | ||
| 589 | 641 | /* BPF_FUNC_perf_event_output for sk_buff input context. */ |
| 590 | 642 | #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) |
| 591 | 643 | |
| 644 | +/* Mode for BPF_FUNC_skb_adjust_room helper. */ | |
| 645 | +enum bpf_adj_room_mode { | |
| 646 | + BPF_ADJ_ROOM_NET_OPTS, | |
| 647 | +}; | |
| 648 | + | |
| 592 | 649 | /* user accessible mirror of in-kernel sk_buff. |
| 593 | 650 | * new fields can only be added to the end of this structure |
| 594 | 651 | */ |
| @@ -670,4 +727,75 @@ struct xdp_md { · 75 unmodified lines | ||
| 670 | 727 | __u32 data_end; |
| 671 | 728 | }; |
| 672 | 729 | |
| 730 | +#define BPF_TAG_SIZE 8 | |
| 731 | + | |
| 732 | +struct bpf_prog_info { | |
| 733 | + __u32 type; | |
| 734 | + __u32 id; | |
| 735 | + __u8 tag[BPF_TAG_SIZE]; | |
| 736 | + __u32 jited_prog_len; | |
| 737 | + __u32 xlated_prog_len; | |
| 738 | + __aligned_u64 jited_prog_insns; | |
| 739 | + __aligned_u64 xlated_prog_insns; | |
| 740 | +} __attribute__((aligned(8))); | |
| 741 | + | |
| 742 | +struct bpf_map_info { | |
| 743 | + __u32 type; | |
| 744 | + __u32 id; | |
| 745 | + __u32 key_size; | |
| 746 | + __u32 value_size; | |
| 747 | + __u32 max_entries; | |
| 748 | + __u32 map_flags; | |
| 749 | +} __attribute__((aligned(8))); | |
| 750 | + | |
| 751 | +/* User bpf_sock_ops struct to access socket values and specify request ops | |
| 752 | + * and their replies. | |
| 753 | + * New fields can only be added at the end of this structure | |
| 754 | + */ | |
| 755 | +struct bpf_sock_ops { | |
| 756 | + __u32 op; | |
| 757 | + union { | |
| 758 | + __u32 reply; | |
| 759 | + __u32 replylong[4]; | |
| 760 | + }; | |
| 761 | + __u32 family; | |
| 762 | + __u32 remote_ip4; | |
| 763 | + __u32 local_ip4; | |
| 764 | + __u32 remote_ip6[4]; | |
| 765 | + __u32 local_ip6[4]; | |
| 766 | + __u32 remote_port; | |
| 767 | + __u32 local_port; | |
| 768 | +}; | |
| 769 | + | |
| 770 | +/* List of known BPF sock_ops operators. | |
| 771 | + * New entries can only be added at the end | |
| 772 | + */ | |
| 773 | +enum { | |
| 774 | + BPF_SOCK_OPS_VOID, | |
| 775 | + BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or | |
| 776 | + * -1 if default value should be used | |
| 777 | + */ | |
| 778 | + BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized | |
| 779 | + * window (in packets) or -1 if default | |
| 780 | + * value should be used | |
| 781 | + */ | |
| 782 | + BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an | |
| 783 | + * active connection is initialized | |
| 784 | + */ | |
| 785 | + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an | |
| 786 | + * active connection is | |
| 787 | + * established | |
| 788 | + */ | |
| 789 | + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a | |
| 790 | + * passive connection is | |
| 791 | + * established | |
| 792 | + */ | |
| 793 | + BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control | |
| 794 | + * needs ECN | |
| 795 | + */ | |
| 796 | +}; | |
| 797 | + | |
| 798 | +#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */ | |
| 799 | +#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */ | |
| 800 | + | |
| 673 | 801 | #endif /* _UAPI__LINUX_BPF_H__ */ |