Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _UAPI__LINUX_BPF_H__ |
| 20 | #define _UAPI__LINUX_BPF_H__ |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/bpf_common.h> |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 23 | #define BPF_ALU64 0x07 |
| 24 | #define BPF_DW 0x18 |
| 25 | #define BPF_XADD 0xc0 |
| 26 | #define BPF_MOV 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 27 | #define BPF_ARSH 0xc0 |
| 28 | #define BPF_END 0xd0 |
| 29 | #define BPF_TO_LE 0x00 |
| 30 | #define BPF_TO_BE 0x08 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 31 | #define BPF_FROM_LE BPF_TO_LE |
| 32 | #define BPF_FROM_BE BPF_TO_BE |
| 33 | #define BPF_JNE 0x50 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 34 | #define BPF_JLT 0xa0 |
| 35 | #define BPF_JLE 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 36 | #define BPF_JSGT 0x60 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 37 | #define BPF_JSGE 0x70 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 38 | #define BPF_JSLT 0xc0 |
| 39 | #define BPF_JSLE 0xd0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 40 | #define BPF_CALL 0x80 |
| 41 | #define BPF_EXIT 0x90 |
| 42 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 | BPF_REG_0 = 0, |
| 44 | BPF_REG_1, |
| 45 | BPF_REG_2, |
| 46 | BPF_REG_3, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 47 | BPF_REG_4, |
| 48 | BPF_REG_5, |
| 49 | BPF_REG_6, |
| 50 | BPF_REG_7, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 | BPF_REG_8, |
| 52 | BPF_REG_9, |
| 53 | BPF_REG_10, |
| 54 | __MAX_BPF_REG, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 55 | }; |
| 56 | #define MAX_BPF_REG __MAX_BPF_REG |
| 57 | struct bpf_insn { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 58 | __u8 code; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 59 | __u8 dst_reg : 4; |
| 60 | __u8 src_reg : 4; |
| 61 | __s16 off; |
| 62 | __s32 imm; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 63 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 64 | struct bpf_lpm_trie_key { |
| 65 | __u32 prefixlen; |
| 66 | __u8 data[0]; |
| 67 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 68 | enum bpf_cmd { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 69 | BPF_MAP_CREATE, |
| 70 | BPF_MAP_LOOKUP_ELEM, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 71 | BPF_MAP_UPDATE_ELEM, |
| 72 | BPF_MAP_DELETE_ELEM, |
| 73 | BPF_MAP_GET_NEXT_KEY, |
| 74 | BPF_PROG_LOAD, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 75 | BPF_OBJ_PIN, |
| 76 | BPF_OBJ_GET, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 77 | BPF_PROG_ATTACH, |
| 78 | BPF_PROG_DETACH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 79 | BPF_PROG_TEST_RUN, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 80 | BPF_PROG_GET_NEXT_ID, |
| 81 | BPF_MAP_GET_NEXT_ID, |
| 82 | BPF_PROG_GET_FD_BY_ID, |
| 83 | BPF_MAP_GET_FD_BY_ID, |
| 84 | BPF_OBJ_GET_INFO_BY_FD, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 85 | BPF_PROG_QUERY, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 86 | }; |
| 87 | enum bpf_map_type { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 88 | BPF_MAP_TYPE_UNSPEC, |
| 89 | BPF_MAP_TYPE_HASH, |
| 90 | BPF_MAP_TYPE_ARRAY, |
| 91 | BPF_MAP_TYPE_PROG_ARRAY, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 92 | BPF_MAP_TYPE_PERF_EVENT_ARRAY, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 93 | BPF_MAP_TYPE_PERCPU_HASH, |
| 94 | BPF_MAP_TYPE_PERCPU_ARRAY, |
| 95 | BPF_MAP_TYPE_STACK_TRACE, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 96 | BPF_MAP_TYPE_CGROUP_ARRAY, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 97 | BPF_MAP_TYPE_LRU_HASH, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 98 | BPF_MAP_TYPE_LRU_PERCPU_HASH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 99 | BPF_MAP_TYPE_LPM_TRIE, |
| 100 | BPF_MAP_TYPE_ARRAY_OF_MAPS, |
| 101 | BPF_MAP_TYPE_HASH_OF_MAPS, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 102 | BPF_MAP_TYPE_DEVMAP, |
| 103 | BPF_MAP_TYPE_SOCKMAP, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 104 | BPF_MAP_TYPE_CPUMAP, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 105 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 106 | enum bpf_prog_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 107 | BPF_PROG_TYPE_UNSPEC, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 108 | BPF_PROG_TYPE_SOCKET_FILTER, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 109 | BPF_PROG_TYPE_KPROBE, |
| 110 | BPF_PROG_TYPE_SCHED_CLS, |
| 111 | BPF_PROG_TYPE_SCHED_ACT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 112 | BPF_PROG_TYPE_TRACEPOINT, |
| 113 | BPF_PROG_TYPE_XDP, |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 114 | BPF_PROG_TYPE_PERF_EVENT, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 115 | BPF_PROG_TYPE_CGROUP_SKB, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 116 | BPF_PROG_TYPE_CGROUP_SOCK, |
| 117 | BPF_PROG_TYPE_LWT_IN, |
| 118 | BPF_PROG_TYPE_LWT_OUT, |
| 119 | BPF_PROG_TYPE_LWT_XMIT, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 120 | BPF_PROG_TYPE_SOCK_OPS, |
| 121 | BPF_PROG_TYPE_SK_SKB, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 122 | BPF_PROG_TYPE_CGROUP_DEVICE, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 123 | }; |
| 124 | enum bpf_attach_type { |
| 125 | BPF_CGROUP_INET_INGRESS, |
| 126 | BPF_CGROUP_INET_EGRESS, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 127 | BPF_CGROUP_INET_SOCK_CREATE, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 128 | BPF_CGROUP_SOCK_OPS, |
| 129 | BPF_SK_SKB_STREAM_PARSER, |
| 130 | BPF_SK_SKB_STREAM_VERDICT, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 131 | BPF_CGROUP_DEVICE, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 132 | __MAX_BPF_ATTACH_TYPE |
| 133 | }; |
| 134 | #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 135 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 136 | #define BPF_F_ALLOW_MULTI (1U << 1) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 137 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 138 | #define BPF_PSEUDO_MAP_FD 1 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 139 | #define BPF_ANY 0 |
| 140 | #define BPF_NOEXIST 1 |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 141 | #define BPF_EXIST 2 |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 142 | #define BPF_F_NO_PREALLOC (1U << 0) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 143 | #define BPF_F_NO_COMMON_LRU (1U << 1) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 144 | #define BPF_F_NUMA_NODE (1U << 2) |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 145 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) |
| 146 | #define BPF_OBJ_NAME_LEN 16U |
| 147 | #define BPF_F_RDONLY (1U << 3) |
| 148 | #define BPF_F_WRONLY (1U << 4) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 149 | union bpf_attr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 150 | struct { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 151 | __u32 map_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 152 | __u32 key_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 153 | __u32 value_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 154 | __u32 max_entries; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 155 | __u32 map_flags; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 156 | __u32 inner_map_fd; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 157 | __u32 numa_node; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 158 | char map_name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 159 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 160 | struct { |
| 161 | __u32 map_fd; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 162 | __aligned_u64 key; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 163 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 164 | __aligned_u64 value; |
| 165 | __aligned_u64 next_key; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 166 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 167 | __u64 flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 168 | }; |
| 169 | struct { |
| 170 | __u32 prog_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 171 | __u32 insn_cnt; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 172 | __aligned_u64 insns; |
| 173 | __aligned_u64 license; |
| 174 | __u32 log_level; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 175 | __u32 log_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 176 | __aligned_u64 log_buf; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 177 | __u32 kern_version; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 178 | __u32 prog_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 179 | char prog_name[BPF_OBJ_NAME_LEN]; |
| 180 | __u32 prog_ifindex; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 181 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 182 | struct { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 183 | __aligned_u64 pathname; |
| 184 | __u32 bpf_fd; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 185 | __u32 file_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 186 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 187 | struct { |
| 188 | __u32 target_fd; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 189 | __u32 attach_bpf_fd; |
| 190 | __u32 attach_type; |
| 191 | __u32 attach_flags; |
| 192 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 193 | struct { |
| 194 | __u32 prog_fd; |
| 195 | __u32 retval; |
| 196 | __u32 data_size_in; |
| 197 | __u32 data_size_out; |
| 198 | __aligned_u64 data_in; |
| 199 | __aligned_u64 data_out; |
| 200 | __u32 repeat; |
| 201 | __u32 duration; |
| 202 | } test; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 203 | struct { |
| 204 | union { |
| 205 | __u32 start_id; |
| 206 | __u32 prog_id; |
| 207 | __u32 map_id; |
| 208 | }; |
| 209 | __u32 next_id; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 210 | __u32 open_flags; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 211 | }; |
| 212 | struct { |
| 213 | __u32 bpf_fd; |
| 214 | __u32 info_len; |
| 215 | __aligned_u64 info; |
| 216 | } info; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 217 | struct { |
| 218 | __u32 target_fd; |
| 219 | __u32 attach_type; |
| 220 | __u32 query_flags; |
| 221 | __u32 attach_flags; |
| 222 | __aligned_u64 prog_ids; |
| 223 | __u32 prog_cnt; |
| 224 | } query; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 225 | } __attribute__((aligned(8))); |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 226 | #define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 227 | #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 228 | enum bpf_func_id { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 229 | __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 230 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 231 | #undef __BPF_ENUM_FN |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 232 | #define BPF_F_RECOMPUTE_CSUM (1ULL << 0) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 233 | #define BPF_F_INVALIDATE_HASH (1ULL << 1) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 234 | #define BPF_F_HDR_FIELD_MASK 0xfULL |
| 235 | #define BPF_F_PSEUDO_HDR (1ULL << 4) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 236 | #define BPF_F_MARK_MANGLED_0 (1ULL << 5) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 237 | #define BPF_F_MARK_ENFORCE (1ULL << 6) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 238 | #define BPF_F_INGRESS (1ULL << 0) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 239 | #define BPF_F_TUNINFO_IPV6 (1ULL << 0) |
| 240 | #define BPF_F_SKIP_FIELD_MASK 0xffULL |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 241 | #define BPF_F_USER_STACK (1ULL << 8) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 242 | #define BPF_F_FAST_STACK_CMP (1ULL << 9) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 243 | #define BPF_F_REUSE_STACKID (1ULL << 10) |
| 244 | #define BPF_F_ZERO_CSUM_TX (1ULL << 1) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 245 | #define BPF_F_DONT_FRAGMENT (1ULL << 2) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 246 | #define BPF_F_INDEX_MASK 0xffffffffULL |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 247 | #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 248 | #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 249 | enum bpf_adj_room_mode { |
| 250 | BPF_ADJ_ROOM_NET, |
| 251 | }; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 252 | struct __sk_buff { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 253 | __u32 len; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 254 | __u32 pkt_type; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 255 | __u32 mark; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 256 | __u32 queue_mapping; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 257 | __u32 protocol; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 258 | __u32 vlan_present; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 259 | __u32 vlan_tci; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 260 | __u32 vlan_proto; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 261 | __u32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 262 | __u32 ingress_ifindex; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 263 | __u32 ifindex; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 264 | __u32 tc_index; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 265 | __u32 cb[5]; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 266 | __u32 hash; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 267 | __u32 tc_classid; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 268 | __u32 data; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 269 | __u32 data_end; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 270 | __u32 napi_id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 271 | __u32 family; |
| 272 | __u32 remote_ip4; |
| 273 | __u32 local_ip4; |
| 274 | __u32 remote_ip6[4]; |
| 275 | __u32 local_ip6[4]; |
| 276 | __u32 remote_port; |
| 277 | __u32 local_port; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 278 | __u32 data_meta; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 279 | }; |
| 280 | struct bpf_tunnel_key { |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 281 | __u32 tunnel_id; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 282 | union { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 283 | __u32 remote_ipv4; |
| 284 | __u32 remote_ipv6[4]; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 285 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 286 | __u8 tunnel_tos; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 287 | __u8 tunnel_ttl; |
| 288 | __u16 tunnel_ext; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 289 | __u32 tunnel_label; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 290 | }; |
| 291 | enum bpf_ret_code { |
| 292 | BPF_OK = 0, |
| 293 | BPF_DROP = 2, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 294 | BPF_REDIRECT = 7, |
| 295 | }; |
| 296 | struct bpf_sock { |
| 297 | __u32 bound_dev_if; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 298 | __u32 family; |
| 299 | __u32 type; |
| 300 | __u32 protocol; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 301 | __u32 mark; |
| 302 | __u32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 303 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 304 | #define XDP_PACKET_HEADROOM 256 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 305 | enum xdp_action { |
| 306 | XDP_ABORTED = 0, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 307 | XDP_DROP, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 308 | XDP_PASS, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 309 | XDP_TX, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 310 | XDP_REDIRECT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 311 | }; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 312 | struct xdp_md { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 313 | __u32 data; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 314 | __u32 data_end; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 315 | __u32 data_meta; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 316 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 317 | enum sk_action { |
| 318 | SK_DROP = 0, |
| 319 | SK_PASS, |
| 320 | }; |
| 321 | #define BPF_TAG_SIZE 8 |
| 322 | struct bpf_prog_info { |
| 323 | __u32 type; |
| 324 | __u32 id; |
| 325 | __u8 tag[BPF_TAG_SIZE]; |
| 326 | __u32 jited_prog_len; |
| 327 | __u32 xlated_prog_len; |
| 328 | __aligned_u64 jited_prog_insns; |
| 329 | __aligned_u64 xlated_prog_insns; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 330 | __u64 load_time; |
| 331 | __u32 created_by_uid; |
| 332 | __u32 nr_map_ids; |
| 333 | __aligned_u64 map_ids; |
| 334 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 335 | } __attribute__((aligned(8))); |
| 336 | struct bpf_map_info { |
| 337 | __u32 type; |
| 338 | __u32 id; |
| 339 | __u32 key_size; |
| 340 | __u32 value_size; |
| 341 | __u32 max_entries; |
| 342 | __u32 map_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 343 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 344 | } __attribute__((aligned(8))); |
| 345 | struct bpf_sock_ops { |
| 346 | __u32 op; |
| 347 | union { |
| 348 | __u32 reply; |
| 349 | __u32 replylong[4]; |
| 350 | }; |
| 351 | __u32 family; |
| 352 | __u32 remote_ip4; |
| 353 | __u32 local_ip4; |
| 354 | __u32 remote_ip6[4]; |
| 355 | __u32 local_ip6[4]; |
| 356 | __u32 remote_port; |
| 357 | __u32 local_port; |
| 358 | }; |
| 359 | enum { |
| 360 | BPF_SOCK_OPS_VOID, |
| 361 | BPF_SOCK_OPS_TIMEOUT_INIT, |
| 362 | BPF_SOCK_OPS_RWND_INIT, |
| 363 | BPF_SOCK_OPS_TCP_CONNECT_CB, |
| 364 | BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, |
| 365 | BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, |
| 366 | BPF_SOCK_OPS_NEEDS_ECN, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 367 | BPF_SOCK_OPS_BASE_RTT, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 368 | }; |
| 369 | #define TCP_BPF_IW 1001 |
| 370 | #define TCP_BPF_SNDCWND_CLAMP 1002 |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame^] | 371 | struct bpf_perf_event_value { |
| 372 | __u64 counter; |
| 373 | __u64 enabled; |
| 374 | __u64 running; |
| 375 | }; |
| 376 | #define BPF_DEVCG_ACC_MKNOD (1ULL << 0) |
| 377 | #define BPF_DEVCG_ACC_READ (1ULL << 1) |
| 378 | #define BPF_DEVCG_ACC_WRITE (1ULL << 2) |
| 379 | #define BPF_DEVCG_DEV_BLOCK (1ULL << 0) |
| 380 | #define BPF_DEVCG_DEV_CHAR (1ULL << 1) |
| 381 | struct bpf_cgroup_dev_ctx { |
| 382 | __u32 access_type; |
| 383 | __u32 major; |
| 384 | __u32 minor; |
| 385 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 386 | #endif |