| 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 | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 68 | struct bpf_cgroup_storage_key { | 
 | 69 |   __u64 cgroup_inode_id; | 
 | 70 |   __u32 attach_type; | 
 | 71 | }; | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 72 | enum bpf_cmd { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 73 |   BPF_MAP_CREATE, | 
 | 74 |   BPF_MAP_LOOKUP_ELEM, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 75 |   BPF_MAP_UPDATE_ELEM, | 
 | 76 |   BPF_MAP_DELETE_ELEM, | 
 | 77 |   BPF_MAP_GET_NEXT_KEY, | 
 | 78 |   BPF_PROG_LOAD, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 79 |   BPF_OBJ_PIN, | 
 | 80 |   BPF_OBJ_GET, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 81 |   BPF_PROG_ATTACH, | 
 | 82 |   BPF_PROG_DETACH, | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 83 |   BPF_PROG_TEST_RUN, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 84 |   BPF_PROG_GET_NEXT_ID, | 
 | 85 |   BPF_MAP_GET_NEXT_ID, | 
 | 86 |   BPF_PROG_GET_FD_BY_ID, | 
 | 87 |   BPF_MAP_GET_FD_BY_ID, | 
 | 88 |   BPF_OBJ_GET_INFO_BY_FD, | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 89 |   BPF_PROG_QUERY, | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 90 |   BPF_RAW_TRACEPOINT_OPEN, | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 91 |   BPF_BTF_LOAD, | 
 | 92 |   BPF_BTF_GET_FD_BY_ID, | 
 | 93 |   BPF_TASK_FD_QUERY, | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 94 |   BPF_MAP_LOOKUP_AND_DELETE_ELEM, | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 95 | }; | 
 | 96 | enum bpf_map_type { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 97 |   BPF_MAP_TYPE_UNSPEC, | 
 | 98 |   BPF_MAP_TYPE_HASH, | 
 | 99 |   BPF_MAP_TYPE_ARRAY, | 
 | 100 |   BPF_MAP_TYPE_PROG_ARRAY, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 101 |   BPF_MAP_TYPE_PERF_EVENT_ARRAY, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 102 |   BPF_MAP_TYPE_PERCPU_HASH, | 
 | 103 |   BPF_MAP_TYPE_PERCPU_ARRAY, | 
 | 104 |   BPF_MAP_TYPE_STACK_TRACE, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 105 |   BPF_MAP_TYPE_CGROUP_ARRAY, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 106 |   BPF_MAP_TYPE_LRU_HASH, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 107 |   BPF_MAP_TYPE_LRU_PERCPU_HASH, | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 108 |   BPF_MAP_TYPE_LPM_TRIE, | 
 | 109 |   BPF_MAP_TYPE_ARRAY_OF_MAPS, | 
 | 110 |   BPF_MAP_TYPE_HASH_OF_MAPS, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 111 |   BPF_MAP_TYPE_DEVMAP, | 
 | 112 |   BPF_MAP_TYPE_SOCKMAP, | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 113 |   BPF_MAP_TYPE_CPUMAP, | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 114 |   BPF_MAP_TYPE_XSKMAP, | 
 | 115 |   BPF_MAP_TYPE_SOCKHASH, | 
 | 116 |   BPF_MAP_TYPE_CGROUP_STORAGE, | 
 | 117 |   BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 118 |   BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, | 
 | 119 |   BPF_MAP_TYPE_QUEUE, | 
 | 120 |   BPF_MAP_TYPE_STACK, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 121 | }; | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 122 | enum bpf_prog_type { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 123 |   BPF_PROG_TYPE_UNSPEC, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 124 |   BPF_PROG_TYPE_SOCKET_FILTER, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 125 |   BPF_PROG_TYPE_KPROBE, | 
 | 126 |   BPF_PROG_TYPE_SCHED_CLS, | 
 | 127 |   BPF_PROG_TYPE_SCHED_ACT, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 128 |   BPF_PROG_TYPE_TRACEPOINT, | 
 | 129 |   BPF_PROG_TYPE_XDP, | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 130 |   BPF_PROG_TYPE_PERF_EVENT, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 131 |   BPF_PROG_TYPE_CGROUP_SKB, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 132 |   BPF_PROG_TYPE_CGROUP_SOCK, | 
 | 133 |   BPF_PROG_TYPE_LWT_IN, | 
 | 134 |   BPF_PROG_TYPE_LWT_OUT, | 
 | 135 |   BPF_PROG_TYPE_LWT_XMIT, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 136 |   BPF_PROG_TYPE_SOCK_OPS, | 
 | 137 |   BPF_PROG_TYPE_SK_SKB, | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 138 |   BPF_PROG_TYPE_CGROUP_DEVICE, | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 139 |   BPF_PROG_TYPE_SK_MSG, | 
 | 140 |   BPF_PROG_TYPE_RAW_TRACEPOINT, | 
 | 141 |   BPF_PROG_TYPE_CGROUP_SOCK_ADDR, | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 142 |   BPF_PROG_TYPE_LWT_SEG6LOCAL, | 
 | 143 |   BPF_PROG_TYPE_LIRC_MODE2, | 
 | 144 |   BPF_PROG_TYPE_SK_REUSEPORT, | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 145 |   BPF_PROG_TYPE_FLOW_DISSECTOR, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 146 | }; | 
 | 147 | enum bpf_attach_type { | 
 | 148 |   BPF_CGROUP_INET_INGRESS, | 
 | 149 |   BPF_CGROUP_INET_EGRESS, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 150 |   BPF_CGROUP_INET_SOCK_CREATE, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 151 |   BPF_CGROUP_SOCK_OPS, | 
 | 152 |   BPF_SK_SKB_STREAM_PARSER, | 
 | 153 |   BPF_SK_SKB_STREAM_VERDICT, | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 154 |   BPF_CGROUP_DEVICE, | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 155 |   BPF_SK_MSG_VERDICT, | 
 | 156 |   BPF_CGROUP_INET4_BIND, | 
 | 157 |   BPF_CGROUP_INET6_BIND, | 
 | 158 |   BPF_CGROUP_INET4_CONNECT, | 
 | 159 |   BPF_CGROUP_INET6_CONNECT, | 
 | 160 |   BPF_CGROUP_INET4_POST_BIND, | 
 | 161 |   BPF_CGROUP_INET6_POST_BIND, | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 162 |   BPF_CGROUP_UDP4_SENDMSG, | 
 | 163 |   BPF_CGROUP_UDP6_SENDMSG, | 
 | 164 |   BPF_LIRC_MODE2, | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 165 |   BPF_FLOW_DISSECTOR, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 166 |   __MAX_BPF_ATTACH_TYPE | 
 | 167 | }; | 
 | 168 | #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 169 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 170 | #define BPF_F_ALLOW_MULTI (1U << 1) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 171 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 172 | #define BPF_PSEUDO_MAP_FD 1 | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 173 | #define BPF_PSEUDO_CALL 1 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 174 | #define BPF_ANY 0 | 
 | 175 | #define BPF_NOEXIST 1 | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 176 | #define BPF_EXIST 2 | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 177 | #define BPF_F_NO_PREALLOC (1U << 0) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 178 | #define BPF_F_NO_COMMON_LRU (1U << 1) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 179 | #define BPF_F_NUMA_NODE (1U << 2) | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 180 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) | 
 | 181 | #define BPF_OBJ_NAME_LEN 16U | 
 | 182 | #define BPF_F_RDONLY (1U << 3) | 
 | 183 | #define BPF_F_WRONLY (1U << 4) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 184 | #define BPF_F_STACK_BUILD_ID (1U << 5) | 
 | 185 | enum bpf_stack_build_id_status { | 
 | 186 |   BPF_STACK_BUILD_ID_EMPTY = 0, | 
 | 187 |   BPF_STACK_BUILD_ID_VALID = 1, | 
 | 188 |   BPF_STACK_BUILD_ID_IP = 2, | 
 | 189 | }; | 
 | 190 | #define BPF_BUILD_ID_SIZE 20 | 
 | 191 | struct bpf_stack_build_id { | 
 | 192 |   __s32 status; | 
 | 193 |   unsigned char build_id[BPF_BUILD_ID_SIZE]; | 
 | 194 |   union { | 
 | 195 |     __u64 offset; | 
 | 196 |     __u64 ip; | 
 | 197 |   }; | 
 | 198 | }; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 199 | union bpf_attr { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 200 |   struct { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 201 |     __u32 map_type; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 202 |     __u32 key_size; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 203 |     __u32 value_size; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 204 |     __u32 max_entries; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 205 |     __u32 map_flags; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 206 |     __u32 inner_map_fd; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 207 |     __u32 numa_node; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 208 |     char map_name[BPF_OBJ_NAME_LEN]; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 209 |     __u32 map_ifindex; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 210 |     __u32 btf_fd; | 
 | 211 |     __u32 btf_key_type_id; | 
 | 212 |     __u32 btf_value_type_id; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 213 |   }; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 214 |   struct { | 
 | 215 |     __u32 map_fd; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 216 |     __aligned_u64 key; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 217 |     union { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 218 |       __aligned_u64 value; | 
 | 219 |       __aligned_u64 next_key; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 220 |     }; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 221 |     __u64 flags; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 222 |   }; | 
 | 223 |   struct { | 
 | 224 |     __u32 prog_type; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 225 |     __u32 insn_cnt; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 226 |     __aligned_u64 insns; | 
 | 227 |     __aligned_u64 license; | 
 | 228 |     __u32 log_level; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 229 |     __u32 log_size; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 230 |     __aligned_u64 log_buf; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 231 |     __u32 kern_version; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 232 |     __u32 prog_flags; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 233 |     char prog_name[BPF_OBJ_NAME_LEN]; | 
 | 234 |     __u32 prog_ifindex; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 235 |     __u32 expected_attach_type; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 236 |   }; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 237 |   struct { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 238 |     __aligned_u64 pathname; | 
 | 239 |     __u32 bpf_fd; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 240 |     __u32 file_flags; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 241 |   }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 242 |   struct { | 
 | 243 |     __u32 target_fd; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 244 |     __u32 attach_bpf_fd; | 
 | 245 |     __u32 attach_type; | 
 | 246 |     __u32 attach_flags; | 
 | 247 |   }; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 248 |   struct { | 
 | 249 |     __u32 prog_fd; | 
 | 250 |     __u32 retval; | 
 | 251 |     __u32 data_size_in; | 
 | 252 |     __u32 data_size_out; | 
 | 253 |     __aligned_u64 data_in; | 
 | 254 |     __aligned_u64 data_out; | 
 | 255 |     __u32 repeat; | 
 | 256 |     __u32 duration; | 
 | 257 |   } test; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 258 |   struct { | 
 | 259 |     union { | 
 | 260 |       __u32 start_id; | 
 | 261 |       __u32 prog_id; | 
 | 262 |       __u32 map_id; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 263 |       __u32 btf_id; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 264 |     }; | 
 | 265 |     __u32 next_id; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 266 |     __u32 open_flags; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 267 |   }; | 
 | 268 |   struct { | 
 | 269 |     __u32 bpf_fd; | 
 | 270 |     __u32 info_len; | 
 | 271 |     __aligned_u64 info; | 
 | 272 |   } info; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 273 |   struct { | 
 | 274 |     __u32 target_fd; | 
 | 275 |     __u32 attach_type; | 
 | 276 |     __u32 query_flags; | 
 | 277 |     __u32 attach_flags; | 
 | 278 |     __aligned_u64 prog_ids; | 
 | 279 |     __u32 prog_cnt; | 
 | 280 |   } query; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 281 |   struct { | 
 | 282 |     __u64 name; | 
 | 283 |     __u32 prog_fd; | 
 | 284 |   } raw_tracepoint; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 285 |   struct { | 
 | 286 |     __aligned_u64 btf; | 
 | 287 |     __aligned_u64 btf_log_buf; | 
 | 288 |     __u32 btf_size; | 
 | 289 |     __u32 btf_log_size; | 
 | 290 |     __u32 btf_log_level; | 
 | 291 |   }; | 
 | 292 |   struct { | 
 | 293 |     __u32 pid; | 
 | 294 |     __u32 fd; | 
 | 295 |     __u32 flags; | 
 | 296 |     __u32 buf_len; | 
 | 297 |     __aligned_u64 buf; | 
 | 298 |     __u32 prog_id; | 
 | 299 |     __u32 fd_type; | 
 | 300 |     __u64 probe_offset; | 
 | 301 |     __u64 probe_addr; | 
 | 302 |   } task_fd_query; | 
| Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 303 | } __attribute__((aligned(8))); | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 304 | #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), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 305 | #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 306 | enum bpf_func_id { | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 307 |   __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 308 | }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 309 | #undef __BPF_ENUM_FN | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 310 | #define BPF_F_RECOMPUTE_CSUM (1ULL << 0) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 311 | #define BPF_F_INVALIDATE_HASH (1ULL << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 312 | #define BPF_F_HDR_FIELD_MASK 0xfULL | 
 | 313 | #define BPF_F_PSEUDO_HDR (1ULL << 4) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 314 | #define BPF_F_MARK_MANGLED_0 (1ULL << 5) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 315 | #define BPF_F_MARK_ENFORCE (1ULL << 6) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 316 | #define BPF_F_INGRESS (1ULL << 0) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 317 | #define BPF_F_TUNINFO_IPV6 (1ULL << 0) | 
 | 318 | #define BPF_F_SKIP_FIELD_MASK 0xffULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 319 | #define BPF_F_USER_STACK (1ULL << 8) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 320 | #define BPF_F_FAST_STACK_CMP (1ULL << 9) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 321 | #define BPF_F_REUSE_STACKID (1ULL << 10) | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 322 | #define BPF_F_USER_BUILD_ID (1ULL << 11) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 323 | #define BPF_F_ZERO_CSUM_TX (1ULL << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 324 | #define BPF_F_DONT_FRAGMENT (1ULL << 2) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 325 | #define BPF_F_SEQ_NUMBER (1ULL << 3) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 326 | #define BPF_F_INDEX_MASK 0xffffffffULL | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 327 | #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 328 | #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 329 | #define BPF_F_CURRENT_NETNS (- 1L) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 330 | enum bpf_adj_room_mode { | 
 | 331 |   BPF_ADJ_ROOM_NET, | 
 | 332 | }; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 333 | enum bpf_hdr_start_off { | 
 | 334 |   BPF_HDR_START_MAC, | 
 | 335 |   BPF_HDR_START_NET, | 
 | 336 | }; | 
 | 337 | enum bpf_lwt_encap_mode { | 
 | 338 |   BPF_LWT_ENCAP_SEG6, | 
 | 339 |   BPF_LWT_ENCAP_SEG6_INLINE | 
 | 340 | }; | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 341 | #define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \ | 
 | 342 | } __attribute__((aligned(8))) | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 343 | struct __sk_buff { | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 344 |   __u32 len; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 345 |   __u32 pkt_type; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 346 |   __u32 mark; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 347 |   __u32 queue_mapping; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 348 |   __u32 protocol; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 349 |   __u32 vlan_present; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 350 |   __u32 vlan_tci; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 351 |   __u32 vlan_proto; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 352 |   __u32 priority; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 353 |   __u32 ingress_ifindex; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 354 |   __u32 ifindex; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 355 |   __u32 tc_index; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 356 |   __u32 cb[5]; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 357 |   __u32 hash; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 358 |   __u32 tc_classid; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 359 |   __u32 data; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 360 |   __u32 data_end; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 361 |   __u32 napi_id; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 362 |   __u32 family; | 
 | 363 |   __u32 remote_ip4; | 
 | 364 |   __u32 local_ip4; | 
 | 365 |   __u32 remote_ip6[4]; | 
 | 366 |   __u32 local_ip6[4]; | 
 | 367 |   __u32 remote_port; | 
 | 368 |   __u32 local_port; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 369 |   __u32 data_meta; | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 370 |   __bpf_md_ptr(struct bpf_flow_keys *, flow_keys); | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 371 | }; | 
 | 372 | struct bpf_tunnel_key { | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 373 |   __u32 tunnel_id; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 374 |   union { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 375 |     __u32 remote_ipv4; | 
 | 376 |     __u32 remote_ipv6[4]; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 377 |   }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 378 |   __u8 tunnel_tos; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 379 |   __u8 tunnel_ttl; | 
 | 380 |   __u16 tunnel_ext; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 381 |   __u32 tunnel_label; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 382 | }; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 383 | struct bpf_xfrm_state { | 
 | 384 |   __u32 reqid; | 
 | 385 |   __u32 spi; | 
 | 386 |   __u16 family; | 
 | 387 |   __u16 ext; | 
 | 388 |   union { | 
 | 389 |     __u32 remote_ipv4; | 
 | 390 |     __u32 remote_ipv6[4]; | 
 | 391 |   }; | 
 | 392 | }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 393 | enum bpf_ret_code { | 
 | 394 |   BPF_OK = 0, | 
 | 395 |   BPF_DROP = 2, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 396 |   BPF_REDIRECT = 7, | 
 | 397 | }; | 
 | 398 | struct bpf_sock { | 
 | 399 |   __u32 bound_dev_if; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 400 |   __u32 family; | 
 | 401 |   __u32 type; | 
 | 402 |   __u32 protocol; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 403 |   __u32 mark; | 
 | 404 |   __u32 priority; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 405 |   __u32 src_ip4; | 
 | 406 |   __u32 src_ip6[4]; | 
 | 407 |   __u32 src_port; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 408 | }; | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 409 | struct bpf_sock_tuple { | 
 | 410 |   union { | 
 | 411 |     struct { | 
 | 412 |       __be32 saddr; | 
 | 413 |       __be32 daddr; | 
 | 414 |       __be16 sport; | 
 | 415 |       __be16 dport; | 
 | 416 |     } ipv4; | 
 | 417 |     struct { | 
 | 418 |       __be32 saddr[4]; | 
 | 419 |       __be32 daddr[4]; | 
 | 420 |       __be16 sport; | 
 | 421 |       __be16 dport; | 
 | 422 |     } ipv6; | 
 | 423 |   }; | 
 | 424 | }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 425 | #define XDP_PACKET_HEADROOM 256 | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 426 | enum xdp_action { | 
 | 427 |   XDP_ABORTED = 0, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 428 |   XDP_DROP, | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 429 |   XDP_PASS, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 430 |   XDP_TX, | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 431 |   XDP_REDIRECT, | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 432 | }; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 433 | struct xdp_md { | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 434 |   __u32 data; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 435 |   __u32 data_end; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 436 |   __u32 data_meta; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 437 |   __u32 ingress_ifindex; | 
 | 438 |   __u32 rx_queue_index; | 
| Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 439 | }; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 440 | enum sk_action { | 
 | 441 |   SK_DROP = 0, | 
 | 442 |   SK_PASS, | 
 | 443 | }; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 444 | struct sk_msg_md { | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 445 |   __bpf_md_ptr(void *, data); | 
 | 446 |   __bpf_md_ptr(void *, data_end); | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 447 |   __u32 family; | 
 | 448 |   __u32 remote_ip4; | 
 | 449 |   __u32 local_ip4; | 
 | 450 |   __u32 remote_ip6[4]; | 
 | 451 |   __u32 local_ip6[4]; | 
 | 452 |   __u32 remote_port; | 
 | 453 |   __u32 local_port; | 
 | 454 | }; | 
 | 455 | struct sk_reuseport_md { | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 456 |   __bpf_md_ptr(void *, data); | 
 | 457 |   __bpf_md_ptr(void *, data_end); | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 458 |   __u32 len; | 
 | 459 |   __u32 eth_protocol; | 
 | 460 |   __u32 ip_protocol; | 
 | 461 |   __u32 bind_inany; | 
 | 462 |   __u32 hash; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 463 | }; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 464 | #define BPF_TAG_SIZE 8 | 
 | 465 | struct bpf_prog_info { | 
 | 466 |   __u32 type; | 
 | 467 |   __u32 id; | 
 | 468 |   __u8 tag[BPF_TAG_SIZE]; | 
 | 469 |   __u32 jited_prog_len; | 
 | 470 |   __u32 xlated_prog_len; | 
 | 471 |   __aligned_u64 jited_prog_insns; | 
 | 472 |   __aligned_u64 xlated_prog_insns; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 473 |   __u64 load_time; | 
 | 474 |   __u32 created_by_uid; | 
 | 475 |   __u32 nr_map_ids; | 
 | 476 |   __aligned_u64 map_ids; | 
 | 477 |   char name[BPF_OBJ_NAME_LEN]; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 478 |   __u32 ifindex; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 479 |   __u32 gpl_compatible : 1; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 480 |   __u64 netns_dev; | 
 | 481 |   __u64 netns_ino; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 482 |   __u32 nr_jited_ksyms; | 
 | 483 |   __u32 nr_jited_func_lens; | 
 | 484 |   __aligned_u64 jited_ksyms; | 
 | 485 |   __aligned_u64 jited_func_lens; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 486 | } __attribute__((aligned(8))); | 
 | 487 | struct bpf_map_info { | 
 | 488 |   __u32 type; | 
 | 489 |   __u32 id; | 
 | 490 |   __u32 key_size; | 
 | 491 |   __u32 value_size; | 
 | 492 |   __u32 max_entries; | 
 | 493 |   __u32 map_flags; | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 494 |   char name[BPF_OBJ_NAME_LEN]; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 495 |   __u32 ifindex; | 
 | 496 |   __u32 : 32; | 
 | 497 |   __u64 netns_dev; | 
 | 498 |   __u64 netns_ino; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 499 |   __u32 btf_id; | 
 | 500 |   __u32 btf_key_type_id; | 
 | 501 |   __u32 btf_value_type_id; | 
 | 502 | } __attribute__((aligned(8))); | 
 | 503 | struct bpf_btf_info { | 
 | 504 |   __aligned_u64 btf; | 
 | 505 |   __u32 btf_size; | 
 | 506 |   __u32 id; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 507 | } __attribute__((aligned(8))); | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 508 | struct bpf_sock_addr { | 
 | 509 |   __u32 user_family; | 
 | 510 |   __u32 user_ip4; | 
 | 511 |   __u32 user_ip6[4]; | 
 | 512 |   __u32 user_port; | 
 | 513 |   __u32 family; | 
 | 514 |   __u32 type; | 
 | 515 |   __u32 protocol; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 516 |   __u32 msg_src_ip4; | 
 | 517 |   __u32 msg_src_ip6[4]; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 518 | }; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 519 | struct bpf_sock_ops { | 
 | 520 |   __u32 op; | 
 | 521 |   union { | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 522 |     __u32 args[4]; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 523 |     __u32 reply; | 
 | 524 |     __u32 replylong[4]; | 
 | 525 |   }; | 
 | 526 |   __u32 family; | 
 | 527 |   __u32 remote_ip4; | 
 | 528 |   __u32 local_ip4; | 
 | 529 |   __u32 remote_ip6[4]; | 
 | 530 |   __u32 local_ip6[4]; | 
 | 531 |   __u32 remote_port; | 
 | 532 |   __u32 local_port; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 533 |   __u32 is_fullsock; | 
 | 534 |   __u32 snd_cwnd; | 
 | 535 |   __u32 srtt_us; | 
 | 536 |   __u32 bpf_sock_ops_cb_flags; | 
 | 537 |   __u32 state; | 
 | 538 |   __u32 rtt_min; | 
 | 539 |   __u32 snd_ssthresh; | 
 | 540 |   __u32 rcv_nxt; | 
 | 541 |   __u32 snd_nxt; | 
 | 542 |   __u32 snd_una; | 
 | 543 |   __u32 mss_cache; | 
 | 544 |   __u32 ecn_flags; | 
 | 545 |   __u32 rate_delivered; | 
 | 546 |   __u32 rate_interval_us; | 
 | 547 |   __u32 packets_out; | 
 | 548 |   __u32 retrans_out; | 
 | 549 |   __u32 total_retrans; | 
 | 550 |   __u32 segs_in; | 
 | 551 |   __u32 data_segs_in; | 
 | 552 |   __u32 segs_out; | 
 | 553 |   __u32 data_segs_out; | 
 | 554 |   __u32 lost_out; | 
 | 555 |   __u32 sacked_out; | 
 | 556 |   __u32 sk_txhash; | 
 | 557 |   __u64 bytes_received; | 
 | 558 |   __u64 bytes_acked; | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 559 | }; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 560 | #define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0) | 
 | 561 | #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1) | 
 | 562 | #define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2) | 
 | 563 | #define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7 | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 564 | enum { | 
 | 565 |   BPF_SOCK_OPS_VOID, | 
 | 566 |   BPF_SOCK_OPS_TIMEOUT_INIT, | 
 | 567 |   BPF_SOCK_OPS_RWND_INIT, | 
 | 568 |   BPF_SOCK_OPS_TCP_CONNECT_CB, | 
 | 569 |   BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, | 
 | 570 |   BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, | 
 | 571 |   BPF_SOCK_OPS_NEEDS_ECN, | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 572 |   BPF_SOCK_OPS_BASE_RTT, | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 573 |   BPF_SOCK_OPS_RTO_CB, | 
 | 574 |   BPF_SOCK_OPS_RETRANS_CB, | 
 | 575 |   BPF_SOCK_OPS_STATE_CB, | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 576 |   BPF_SOCK_OPS_TCP_LISTEN_CB, | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 577 | }; | 
 | 578 | enum { | 
 | 579 |   BPF_TCP_ESTABLISHED = 1, | 
 | 580 |   BPF_TCP_SYN_SENT, | 
 | 581 |   BPF_TCP_SYN_RECV, | 
 | 582 |   BPF_TCP_FIN_WAIT1, | 
 | 583 |   BPF_TCP_FIN_WAIT2, | 
 | 584 |   BPF_TCP_TIME_WAIT, | 
 | 585 |   BPF_TCP_CLOSE, | 
 | 586 |   BPF_TCP_CLOSE_WAIT, | 
 | 587 |   BPF_TCP_LAST_ACK, | 
 | 588 |   BPF_TCP_LISTEN, | 
 | 589 |   BPF_TCP_CLOSING, | 
 | 590 |   BPF_TCP_NEW_SYN_RECV, | 
 | 591 |   BPF_TCP_MAX_STATES | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 592 | }; | 
 | 593 | #define TCP_BPF_IW 1001 | 
 | 594 | #define TCP_BPF_SNDCWND_CLAMP 1002 | 
| Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 595 | struct bpf_perf_event_value { | 
 | 596 |   __u64 counter; | 
 | 597 |   __u64 enabled; | 
 | 598 |   __u64 running; | 
 | 599 | }; | 
 | 600 | #define BPF_DEVCG_ACC_MKNOD (1ULL << 0) | 
 | 601 | #define BPF_DEVCG_ACC_READ (1ULL << 1) | 
 | 602 | #define BPF_DEVCG_ACC_WRITE (1ULL << 2) | 
 | 603 | #define BPF_DEVCG_DEV_BLOCK (1ULL << 0) | 
 | 604 | #define BPF_DEVCG_DEV_CHAR (1ULL << 1) | 
 | 605 | struct bpf_cgroup_dev_ctx { | 
 | 606 |   __u32 access_type; | 
 | 607 |   __u32 major; | 
 | 608 |   __u32 minor; | 
 | 609 | }; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 610 | struct bpf_raw_tracepoint_args { | 
 | 611 |   __u64 args[0]; | 
 | 612 | }; | 
| Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 613 | #define BPF_FIB_LOOKUP_DIRECT BIT(0) | 
 | 614 | #define BPF_FIB_LOOKUP_OUTPUT BIT(1) | 
 | 615 | enum { | 
 | 616 |   BPF_FIB_LKUP_RET_SUCCESS, | 
 | 617 |   BPF_FIB_LKUP_RET_BLACKHOLE, | 
 | 618 |   BPF_FIB_LKUP_RET_UNREACHABLE, | 
 | 619 |   BPF_FIB_LKUP_RET_PROHIBIT, | 
 | 620 |   BPF_FIB_LKUP_RET_NOT_FWDED, | 
 | 621 |   BPF_FIB_LKUP_RET_FWD_DISABLED, | 
 | 622 |   BPF_FIB_LKUP_RET_UNSUPP_LWT, | 
 | 623 |   BPF_FIB_LKUP_RET_NO_NEIGH, | 
 | 624 |   BPF_FIB_LKUP_RET_FRAG_NEEDED, | 
 | 625 | }; | 
 | 626 | struct bpf_fib_lookup { | 
 | 627 |   __u8 family; | 
 | 628 |   __u8 l4_protocol; | 
 | 629 |   __be16 sport; | 
 | 630 |   __be16 dport; | 
 | 631 |   __u16 tot_len; | 
 | 632 |   __u32 ifindex; | 
 | 633 |   union { | 
 | 634 |     __u8 tos; | 
 | 635 |     __be32 flowinfo; | 
 | 636 |     __u32 rt_metric; | 
 | 637 |   }; | 
 | 638 |   union { | 
 | 639 |     __be32 ipv4_src; | 
 | 640 |     __u32 ipv6_src[4]; | 
 | 641 |   }; | 
 | 642 |   union { | 
 | 643 |     __be32 ipv4_dst; | 
 | 644 |     __u32 ipv6_dst[4]; | 
 | 645 |   }; | 
 | 646 |   __be16 h_vlan_proto; | 
 | 647 |   __be16 h_vlan_TCI; | 
 | 648 |   __u8 smac[6]; | 
 | 649 |   __u8 dmac[6]; | 
 | 650 | }; | 
 | 651 | enum bpf_task_fd_type { | 
 | 652 |   BPF_FD_TYPE_RAW_TRACEPOINT, | 
 | 653 |   BPF_FD_TYPE_TRACEPOINT, | 
 | 654 |   BPF_FD_TYPE_KPROBE, | 
 | 655 |   BPF_FD_TYPE_KRETPROBE, | 
 | 656 |   BPF_FD_TYPE_UPROBE, | 
 | 657 |   BPF_FD_TYPE_URETPROBE, | 
 | 658 | }; | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 659 | struct bpf_flow_keys { | 
 | 660 |   __u16 nhoff; | 
 | 661 |   __u16 thoff; | 
 | 662 |   __u16 addr_proto; | 
 | 663 |   __u8 is_frag; | 
 | 664 |   __u8 is_first_frag; | 
 | 665 |   __u8 is_encap; | 
 | 666 |   __u8 ip_proto; | 
 | 667 |   __be16 n_proto; | 
 | 668 |   __be16 sport; | 
 | 669 |   __be16 dport; | 
 | 670 |   union { | 
 | 671 |     struct { | 
 | 672 |       __be32 ipv4_src; | 
 | 673 |       __be32 ipv4_dst; | 
 | 674 |     }; | 
 | 675 |     struct { | 
 | 676 |       __u32 ipv6_src[4]; | 
 | 677 |       __u32 ipv6_dst[4]; | 
 | 678 |     }; | 
 | 679 |   }; | 
 | 680 | }; | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 681 | #endif |