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 | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 23 | #define BPF_JMP32 0x06 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 24 | #define BPF_ALU64 0x07 |
| 25 | #define BPF_DW 0x18 |
| 26 | #define BPF_XADD 0xc0 |
| 27 | #define BPF_MOV 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 28 | #define BPF_ARSH 0xc0 |
| 29 | #define BPF_END 0xd0 |
| 30 | #define BPF_TO_LE 0x00 |
| 31 | #define BPF_TO_BE 0x08 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 32 | #define BPF_FROM_LE BPF_TO_LE |
| 33 | #define BPF_FROM_BE BPF_TO_BE |
| 34 | #define BPF_JNE 0x50 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 35 | #define BPF_JLT 0xa0 |
| 36 | #define BPF_JLE 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 37 | #define BPF_JSGT 0x60 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 38 | #define BPF_JSGE 0x70 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 39 | #define BPF_JSLT 0xc0 |
| 40 | #define BPF_JSLE 0xd0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 41 | #define BPF_CALL 0x80 |
| 42 | #define BPF_EXIT 0x90 |
| 43 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 44 | BPF_REG_0 = 0, |
| 45 | BPF_REG_1, |
| 46 | BPF_REG_2, |
| 47 | BPF_REG_3, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 48 | BPF_REG_4, |
| 49 | BPF_REG_5, |
| 50 | BPF_REG_6, |
| 51 | BPF_REG_7, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 52 | BPF_REG_8, |
| 53 | BPF_REG_9, |
| 54 | BPF_REG_10, |
| 55 | __MAX_BPF_REG, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 56 | }; |
| 57 | #define MAX_BPF_REG __MAX_BPF_REG |
| 58 | struct bpf_insn { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 59 | __u8 code; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 60 | __u8 dst_reg : 4; |
| 61 | __u8 src_reg : 4; |
| 62 | __s16 off; |
| 63 | __s32 imm; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 64 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 65 | struct bpf_lpm_trie_key { |
| 66 | __u32 prefixlen; |
| 67 | __u8 data[0]; |
| 68 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 69 | struct bpf_cgroup_storage_key { |
| 70 | __u64 cgroup_inode_id; |
| 71 | __u32 attach_type; |
| 72 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 73 | enum bpf_cmd { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 74 | BPF_MAP_CREATE, |
| 75 | BPF_MAP_LOOKUP_ELEM, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 76 | BPF_MAP_UPDATE_ELEM, |
| 77 | BPF_MAP_DELETE_ELEM, |
| 78 | BPF_MAP_GET_NEXT_KEY, |
| 79 | BPF_PROG_LOAD, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 80 | BPF_OBJ_PIN, |
| 81 | BPF_OBJ_GET, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 82 | BPF_PROG_ATTACH, |
| 83 | BPF_PROG_DETACH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 84 | BPF_PROG_TEST_RUN, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 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, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 90 | BPF_PROG_QUERY, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 91 | BPF_RAW_TRACEPOINT_OPEN, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 92 | BPF_BTF_LOAD, |
| 93 | BPF_BTF_GET_FD_BY_ID, |
| 94 | BPF_TASK_FD_QUERY, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 95 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 96 | BPF_MAP_FREEZE, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 97 | BPF_BTF_GET_NEXT_ID, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 98 | BPF_MAP_LOOKUP_BATCH, |
| 99 | BPF_MAP_LOOKUP_AND_DELETE_BATCH, |
| 100 | BPF_MAP_UPDATE_BATCH, |
| 101 | BPF_MAP_DELETE_BATCH, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 102 | BPF_LINK_CREATE, |
| 103 | BPF_LINK_UPDATE, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 104 | }; |
| 105 | enum bpf_map_type { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 106 | BPF_MAP_TYPE_UNSPEC, |
| 107 | BPF_MAP_TYPE_HASH, |
| 108 | BPF_MAP_TYPE_ARRAY, |
| 109 | BPF_MAP_TYPE_PROG_ARRAY, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 110 | BPF_MAP_TYPE_PERF_EVENT_ARRAY, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 111 | BPF_MAP_TYPE_PERCPU_HASH, |
| 112 | BPF_MAP_TYPE_PERCPU_ARRAY, |
| 113 | BPF_MAP_TYPE_STACK_TRACE, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 114 | BPF_MAP_TYPE_CGROUP_ARRAY, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 115 | BPF_MAP_TYPE_LRU_HASH, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 116 | BPF_MAP_TYPE_LRU_PERCPU_HASH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 117 | BPF_MAP_TYPE_LPM_TRIE, |
| 118 | BPF_MAP_TYPE_ARRAY_OF_MAPS, |
| 119 | BPF_MAP_TYPE_HASH_OF_MAPS, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 120 | BPF_MAP_TYPE_DEVMAP, |
| 121 | BPF_MAP_TYPE_SOCKMAP, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 122 | BPF_MAP_TYPE_CPUMAP, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 123 | BPF_MAP_TYPE_XSKMAP, |
| 124 | BPF_MAP_TYPE_SOCKHASH, |
| 125 | BPF_MAP_TYPE_CGROUP_STORAGE, |
| 126 | BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 127 | BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, |
| 128 | BPF_MAP_TYPE_QUEUE, |
| 129 | BPF_MAP_TYPE_STACK, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 130 | BPF_MAP_TYPE_SK_STORAGE, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 131 | BPF_MAP_TYPE_DEVMAP_HASH, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 132 | BPF_MAP_TYPE_STRUCT_OPS, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 133 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 134 | enum bpf_prog_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 135 | BPF_PROG_TYPE_UNSPEC, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 136 | BPF_PROG_TYPE_SOCKET_FILTER, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 137 | BPF_PROG_TYPE_KPROBE, |
| 138 | BPF_PROG_TYPE_SCHED_CLS, |
| 139 | BPF_PROG_TYPE_SCHED_ACT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 140 | BPF_PROG_TYPE_TRACEPOINT, |
| 141 | BPF_PROG_TYPE_XDP, |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 142 | BPF_PROG_TYPE_PERF_EVENT, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 143 | BPF_PROG_TYPE_CGROUP_SKB, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 144 | BPF_PROG_TYPE_CGROUP_SOCK, |
| 145 | BPF_PROG_TYPE_LWT_IN, |
| 146 | BPF_PROG_TYPE_LWT_OUT, |
| 147 | BPF_PROG_TYPE_LWT_XMIT, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 148 | BPF_PROG_TYPE_SOCK_OPS, |
| 149 | BPF_PROG_TYPE_SK_SKB, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 150 | BPF_PROG_TYPE_CGROUP_DEVICE, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 151 | BPF_PROG_TYPE_SK_MSG, |
| 152 | BPF_PROG_TYPE_RAW_TRACEPOINT, |
| 153 | BPF_PROG_TYPE_CGROUP_SOCK_ADDR, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 154 | BPF_PROG_TYPE_LWT_SEG6LOCAL, |
| 155 | BPF_PROG_TYPE_LIRC_MODE2, |
| 156 | BPF_PROG_TYPE_SK_REUSEPORT, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 157 | BPF_PROG_TYPE_FLOW_DISSECTOR, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 158 | BPF_PROG_TYPE_CGROUP_SYSCTL, |
| 159 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 160 | BPF_PROG_TYPE_CGROUP_SOCKOPT, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 161 | BPF_PROG_TYPE_TRACING, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 162 | BPF_PROG_TYPE_STRUCT_OPS, |
| 163 | BPF_PROG_TYPE_EXT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 164 | BPF_PROG_TYPE_LSM, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 165 | }; |
| 166 | enum bpf_attach_type { |
| 167 | BPF_CGROUP_INET_INGRESS, |
| 168 | BPF_CGROUP_INET_EGRESS, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 169 | BPF_CGROUP_INET_SOCK_CREATE, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 170 | BPF_CGROUP_SOCK_OPS, |
| 171 | BPF_SK_SKB_STREAM_PARSER, |
| 172 | BPF_SK_SKB_STREAM_VERDICT, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 173 | BPF_CGROUP_DEVICE, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 174 | BPF_SK_MSG_VERDICT, |
| 175 | BPF_CGROUP_INET4_BIND, |
| 176 | BPF_CGROUP_INET6_BIND, |
| 177 | BPF_CGROUP_INET4_CONNECT, |
| 178 | BPF_CGROUP_INET6_CONNECT, |
| 179 | BPF_CGROUP_INET4_POST_BIND, |
| 180 | BPF_CGROUP_INET6_POST_BIND, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 181 | BPF_CGROUP_UDP4_SENDMSG, |
| 182 | BPF_CGROUP_UDP6_SENDMSG, |
| 183 | BPF_LIRC_MODE2, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 184 | BPF_FLOW_DISSECTOR, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 185 | BPF_CGROUP_SYSCTL, |
| 186 | BPF_CGROUP_UDP4_RECVMSG, |
| 187 | BPF_CGROUP_UDP6_RECVMSG, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 188 | BPF_CGROUP_GETSOCKOPT, |
| 189 | BPF_CGROUP_SETSOCKOPT, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 190 | BPF_TRACE_RAW_TP, |
| 191 | BPF_TRACE_FENTRY, |
| 192 | BPF_TRACE_FEXIT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 193 | BPF_MODIFY_RETURN, |
| 194 | BPF_LSM_MAC, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 195 | __MAX_BPF_ATTACH_TYPE |
| 196 | }; |
| 197 | #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 198 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 199 | #define BPF_F_ALLOW_MULTI (1U << 1) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 200 | #define BPF_F_REPLACE (1U << 2) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 201 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 202 | #define BPF_F_ANY_ALIGNMENT (1U << 1) |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 203 | #define BPF_F_TEST_RND_HI32 (1U << 2) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 204 | #define BPF_F_TEST_STATE_FREQ (1U << 3) |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 205 | #define BPF_PSEUDO_MAP_FD 1 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 206 | #define BPF_PSEUDO_MAP_VALUE 2 |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 207 | #define BPF_PSEUDO_CALL 1 |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 208 | enum { |
| 209 | BPF_ANY = 0, |
| 210 | BPF_NOEXIST = 1, |
| 211 | BPF_EXIST = 2, |
| 212 | BPF_F_LOCK = 4, |
| 213 | }; |
| 214 | enum { |
| 215 | BPF_F_NO_PREALLOC = (1U << 0), |
| 216 | BPF_F_NO_COMMON_LRU = (1U << 1), |
| 217 | BPF_F_NUMA_NODE = (1U << 2), |
| 218 | BPF_F_RDONLY = (1U << 3), |
| 219 | BPF_F_WRONLY = (1U << 4), |
| 220 | BPF_F_STACK_BUILD_ID = (1U << 5), |
| 221 | BPF_F_ZERO_SEED = (1U << 6), |
| 222 | BPF_F_RDONLY_PROG = (1U << 7), |
| 223 | BPF_F_WRONLY_PROG = (1U << 8), |
| 224 | BPF_F_CLONE = (1U << 9), |
| 225 | BPF_F_MMAPABLE = (1U << 10), |
| 226 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 227 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 228 | enum bpf_stack_build_id_status { |
| 229 | BPF_STACK_BUILD_ID_EMPTY = 0, |
| 230 | BPF_STACK_BUILD_ID_VALID = 1, |
| 231 | BPF_STACK_BUILD_ID_IP = 2, |
| 232 | }; |
| 233 | #define BPF_BUILD_ID_SIZE 20 |
| 234 | struct bpf_stack_build_id { |
| 235 | __s32 status; |
| 236 | unsigned char build_id[BPF_BUILD_ID_SIZE]; |
| 237 | union { |
| 238 | __u64 offset; |
| 239 | __u64 ip; |
| 240 | }; |
| 241 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 242 | #define BPF_OBJ_NAME_LEN 16U |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 243 | union bpf_attr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 244 | struct { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 245 | __u32 map_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 246 | __u32 key_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 247 | __u32 value_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 248 | __u32 max_entries; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 249 | __u32 map_flags; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 250 | __u32 inner_map_fd; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 251 | __u32 numa_node; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 252 | char map_name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 253 | __u32 map_ifindex; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 254 | __u32 btf_fd; |
| 255 | __u32 btf_key_type_id; |
| 256 | __u32 btf_value_type_id; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 257 | __u32 btf_vmlinux_value_type_id; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 258 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 259 | struct { |
| 260 | __u32 map_fd; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 261 | __aligned_u64 key; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 262 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 263 | __aligned_u64 value; |
| 264 | __aligned_u64 next_key; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 265 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 266 | __u64 flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 267 | }; |
| 268 | struct { |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 269 | __aligned_u64 in_batch; |
| 270 | __aligned_u64 out_batch; |
| 271 | __aligned_u64 keys; |
| 272 | __aligned_u64 values; |
| 273 | __u32 count; |
| 274 | __u32 map_fd; |
| 275 | __u64 elem_flags; |
| 276 | __u64 flags; |
| 277 | } batch; |
| 278 | struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 279 | __u32 prog_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 280 | __u32 insn_cnt; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 281 | __aligned_u64 insns; |
| 282 | __aligned_u64 license; |
| 283 | __u32 log_level; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 284 | __u32 log_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 285 | __aligned_u64 log_buf; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 286 | __u32 kern_version; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 287 | __u32 prog_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 288 | char prog_name[BPF_OBJ_NAME_LEN]; |
| 289 | __u32 prog_ifindex; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 290 | __u32 expected_attach_type; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 291 | __u32 prog_btf_fd; |
| 292 | __u32 func_info_rec_size; |
| 293 | __aligned_u64 func_info; |
| 294 | __u32 func_info_cnt; |
| 295 | __u32 line_info_rec_size; |
| 296 | __aligned_u64 line_info; |
| 297 | __u32 line_info_cnt; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 298 | __u32 attach_btf_id; |
| 299 | __u32 attach_prog_fd; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 300 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 301 | struct { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 302 | __aligned_u64 pathname; |
| 303 | __u32 bpf_fd; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 304 | __u32 file_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 305 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 306 | struct { |
| 307 | __u32 target_fd; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 308 | __u32 attach_bpf_fd; |
| 309 | __u32 attach_type; |
| 310 | __u32 attach_flags; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 311 | __u32 replace_bpf_fd; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 312 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 313 | struct { |
| 314 | __u32 prog_fd; |
| 315 | __u32 retval; |
| 316 | __u32 data_size_in; |
| 317 | __u32 data_size_out; |
| 318 | __aligned_u64 data_in; |
| 319 | __aligned_u64 data_out; |
| 320 | __u32 repeat; |
| 321 | __u32 duration; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 322 | __u32 ctx_size_in; |
| 323 | __u32 ctx_size_out; |
| 324 | __aligned_u64 ctx_in; |
| 325 | __aligned_u64 ctx_out; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 326 | } test; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 327 | struct { |
| 328 | union { |
| 329 | __u32 start_id; |
| 330 | __u32 prog_id; |
| 331 | __u32 map_id; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 332 | __u32 btf_id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 333 | }; |
| 334 | __u32 next_id; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 335 | __u32 open_flags; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 336 | }; |
| 337 | struct { |
| 338 | __u32 bpf_fd; |
| 339 | __u32 info_len; |
| 340 | __aligned_u64 info; |
| 341 | } info; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 342 | struct { |
| 343 | __u32 target_fd; |
| 344 | __u32 attach_type; |
| 345 | __u32 query_flags; |
| 346 | __u32 attach_flags; |
| 347 | __aligned_u64 prog_ids; |
| 348 | __u32 prog_cnt; |
| 349 | } query; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 350 | struct { |
| 351 | __u64 name; |
| 352 | __u32 prog_fd; |
| 353 | } raw_tracepoint; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 354 | struct { |
| 355 | __aligned_u64 btf; |
| 356 | __aligned_u64 btf_log_buf; |
| 357 | __u32 btf_size; |
| 358 | __u32 btf_log_size; |
| 359 | __u32 btf_log_level; |
| 360 | }; |
| 361 | struct { |
| 362 | __u32 pid; |
| 363 | __u32 fd; |
| 364 | __u32 flags; |
| 365 | __u32 buf_len; |
| 366 | __aligned_u64 buf; |
| 367 | __u32 prog_id; |
| 368 | __u32 fd_type; |
| 369 | __u64 probe_offset; |
| 370 | __u64 probe_addr; |
| 371 | } task_fd_query; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 372 | struct { |
| 373 | __u32 prog_fd; |
| 374 | __u32 target_fd; |
| 375 | __u32 attach_type; |
| 376 | __u32 flags; |
| 377 | } link_create; |
| 378 | struct { |
| 379 | __u32 link_fd; |
| 380 | __u32 new_prog_fd; |
| 381 | __u32 flags; |
| 382 | __u32 old_prog_fd; |
| 383 | } link_update; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 384 | } __attribute__((aligned(8))); |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 385 | #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), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str), FN(tcp_send_ack), FN(send_signal_thread), FN(jiffies64), FN(read_branch_records), FN(get_ns_current_pid_tgid), FN(xdp_output), FN(get_netns_cookie), FN(get_current_ancestor_cgroup_id), FN(sk_assign), |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 386 | #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 387 | enum bpf_func_id { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 388 | __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 389 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 390 | #undef __BPF_ENUM_FN |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 391 | enum { |
| 392 | BPF_F_RECOMPUTE_CSUM = (1ULL << 0), |
| 393 | BPF_F_INVALIDATE_HASH = (1ULL << 1), |
| 394 | }; |
| 395 | enum { |
| 396 | BPF_F_HDR_FIELD_MASK = 0xfULL, |
| 397 | }; |
| 398 | enum { |
| 399 | BPF_F_PSEUDO_HDR = (1ULL << 4), |
| 400 | BPF_F_MARK_MANGLED_0 = (1ULL << 5), |
| 401 | BPF_F_MARK_ENFORCE = (1ULL << 6), |
| 402 | }; |
| 403 | enum { |
| 404 | BPF_F_INGRESS = (1ULL << 0), |
| 405 | }; |
| 406 | enum { |
| 407 | BPF_F_TUNINFO_IPV6 = (1ULL << 0), |
| 408 | }; |
| 409 | enum { |
| 410 | BPF_F_SKIP_FIELD_MASK = 0xffULL, |
| 411 | BPF_F_USER_STACK = (1ULL << 8), |
| 412 | BPF_F_FAST_STACK_CMP = (1ULL << 9), |
| 413 | BPF_F_REUSE_STACKID = (1ULL << 10), |
| 414 | BPF_F_USER_BUILD_ID = (1ULL << 11), |
| 415 | }; |
| 416 | enum { |
| 417 | BPF_F_ZERO_CSUM_TX = (1ULL << 1), |
| 418 | BPF_F_DONT_FRAGMENT = (1ULL << 2), |
| 419 | BPF_F_SEQ_NUMBER = (1ULL << 3), |
| 420 | }; |
| 421 | enum { |
| 422 | BPF_F_INDEX_MASK = 0xffffffffULL, |
| 423 | BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK, |
| 424 | BPF_F_CTXLEN_MASK = (0xfffffULL << 32), |
| 425 | }; |
| 426 | enum { |
| 427 | BPF_F_CURRENT_NETNS = (- 1L), |
| 428 | }; |
| 429 | enum { |
| 430 | BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0), |
| 431 | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1), |
| 432 | BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2), |
| 433 | BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3), |
| 434 | BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4), |
| 435 | }; |
| 436 | enum { |
| 437 | BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff, |
| 438 | BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56, |
| 439 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 440 | #define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64) len & BPF_ADJ_ROOM_ENCAP_L2_MASK) << BPF_ADJ_ROOM_ENCAP_L2_SHIFT) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 441 | enum { |
| 442 | BPF_F_SYSCTL_BASE_NAME = (1ULL << 0), |
| 443 | }; |
| 444 | enum { |
| 445 | BPF_SK_STORAGE_GET_F_CREATE = (1ULL << 0), |
| 446 | }; |
| 447 | enum { |
| 448 | BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0), |
| 449 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 450 | enum bpf_adj_room_mode { |
| 451 | BPF_ADJ_ROOM_NET, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 452 | BPF_ADJ_ROOM_MAC, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 453 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 454 | enum bpf_hdr_start_off { |
| 455 | BPF_HDR_START_MAC, |
| 456 | BPF_HDR_START_NET, |
| 457 | }; |
| 458 | enum bpf_lwt_encap_mode { |
| 459 | BPF_LWT_ENCAP_SEG6, |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 460 | BPF_LWT_ENCAP_SEG6_INLINE, |
| 461 | BPF_LWT_ENCAP_IP, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 462 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 463 | #define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \ |
| 464 | } __attribute__((aligned(8))) |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 465 | struct __sk_buff { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 466 | __u32 len; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 467 | __u32 pkt_type; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 468 | __u32 mark; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 469 | __u32 queue_mapping; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 470 | __u32 protocol; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 471 | __u32 vlan_present; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 472 | __u32 vlan_tci; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 473 | __u32 vlan_proto; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 474 | __u32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 475 | __u32 ingress_ifindex; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 476 | __u32 ifindex; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 477 | __u32 tc_index; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 478 | __u32 cb[5]; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 479 | __u32 hash; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 480 | __u32 tc_classid; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 481 | __u32 data; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 482 | __u32 data_end; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 483 | __u32 napi_id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 484 | __u32 family; |
| 485 | __u32 remote_ip4; |
| 486 | __u32 local_ip4; |
| 487 | __u32 remote_ip6[4]; |
| 488 | __u32 local_ip6[4]; |
| 489 | __u32 remote_port; |
| 490 | __u32 local_port; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 491 | __u32 data_meta; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 492 | __bpf_md_ptr(struct bpf_flow_keys *, flow_keys); |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 493 | __u64 tstamp; |
| 494 | __u32 wire_len; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 495 | __u32 gso_segs; |
| 496 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 497 | __u32 gso_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 498 | }; |
| 499 | struct bpf_tunnel_key { |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 500 | __u32 tunnel_id; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 501 | union { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 502 | __u32 remote_ipv4; |
| 503 | __u32 remote_ipv6[4]; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 504 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 505 | __u8 tunnel_tos; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 506 | __u8 tunnel_ttl; |
| 507 | __u16 tunnel_ext; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 508 | __u32 tunnel_label; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 509 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 510 | struct bpf_xfrm_state { |
| 511 | __u32 reqid; |
| 512 | __u32 spi; |
| 513 | __u16 family; |
| 514 | __u16 ext; |
| 515 | union { |
| 516 | __u32 remote_ipv4; |
| 517 | __u32 remote_ipv6[4]; |
| 518 | }; |
| 519 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 520 | enum bpf_ret_code { |
| 521 | BPF_OK = 0, |
| 522 | BPF_DROP = 2, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 523 | BPF_REDIRECT = 7, |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 524 | BPF_LWT_REROUTE = 128, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 525 | }; |
| 526 | struct bpf_sock { |
| 527 | __u32 bound_dev_if; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 528 | __u32 family; |
| 529 | __u32 type; |
| 530 | __u32 protocol; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 531 | __u32 mark; |
| 532 | __u32 priority; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 533 | __u32 src_ip4; |
| 534 | __u32 src_ip6[4]; |
| 535 | __u32 src_port; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 536 | __u32 dst_port; |
| 537 | __u32 dst_ip4; |
| 538 | __u32 dst_ip6[4]; |
| 539 | __u32 state; |
| 540 | }; |
| 541 | struct bpf_tcp_sock { |
| 542 | __u32 snd_cwnd; |
| 543 | __u32 srtt_us; |
| 544 | __u32 rtt_min; |
| 545 | __u32 snd_ssthresh; |
| 546 | __u32 rcv_nxt; |
| 547 | __u32 snd_nxt; |
| 548 | __u32 snd_una; |
| 549 | __u32 mss_cache; |
| 550 | __u32 ecn_flags; |
| 551 | __u32 rate_delivered; |
| 552 | __u32 rate_interval_us; |
| 553 | __u32 packets_out; |
| 554 | __u32 retrans_out; |
| 555 | __u32 total_retrans; |
| 556 | __u32 segs_in; |
| 557 | __u32 data_segs_in; |
| 558 | __u32 segs_out; |
| 559 | __u32 data_segs_out; |
| 560 | __u32 lost_out; |
| 561 | __u32 sacked_out; |
| 562 | __u64 bytes_received; |
| 563 | __u64 bytes_acked; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 564 | __u32 dsack_dups; |
| 565 | __u32 delivered; |
| 566 | __u32 delivered_ce; |
| 567 | __u32 icsk_retransmits; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 568 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 569 | struct bpf_sock_tuple { |
| 570 | union { |
| 571 | struct { |
| 572 | __be32 saddr; |
| 573 | __be32 daddr; |
| 574 | __be16 sport; |
| 575 | __be16 dport; |
| 576 | } ipv4; |
| 577 | struct { |
| 578 | __be32 saddr[4]; |
| 579 | __be32 daddr[4]; |
| 580 | __be16 sport; |
| 581 | __be16 dport; |
| 582 | } ipv6; |
| 583 | }; |
| 584 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 585 | struct bpf_xdp_sock { |
| 586 | __u32 queue_id; |
| 587 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 588 | #define XDP_PACKET_HEADROOM 256 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 589 | enum xdp_action { |
| 590 | XDP_ABORTED = 0, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 591 | XDP_DROP, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 592 | XDP_PASS, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 593 | XDP_TX, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 594 | XDP_REDIRECT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 595 | }; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 596 | struct xdp_md { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 597 | __u32 data; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 598 | __u32 data_end; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 599 | __u32 data_meta; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 600 | __u32 ingress_ifindex; |
| 601 | __u32 rx_queue_index; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 602 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 603 | enum sk_action { |
| 604 | SK_DROP = 0, |
| 605 | SK_PASS, |
| 606 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 607 | struct sk_msg_md { |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 608 | __bpf_md_ptr(void *, data); |
| 609 | __bpf_md_ptr(void *, data_end); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 610 | __u32 family; |
| 611 | __u32 remote_ip4; |
| 612 | __u32 local_ip4; |
| 613 | __u32 remote_ip6[4]; |
| 614 | __u32 local_ip6[4]; |
| 615 | __u32 remote_port; |
| 616 | __u32 local_port; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 617 | __u32 size; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 618 | }; |
| 619 | struct sk_reuseport_md { |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 620 | __bpf_md_ptr(void *, data); |
| 621 | __bpf_md_ptr(void *, data_end); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 622 | __u32 len; |
| 623 | __u32 eth_protocol; |
| 624 | __u32 ip_protocol; |
| 625 | __u32 bind_inany; |
| 626 | __u32 hash; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 627 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 628 | #define BPF_TAG_SIZE 8 |
| 629 | struct bpf_prog_info { |
| 630 | __u32 type; |
| 631 | __u32 id; |
| 632 | __u8 tag[BPF_TAG_SIZE]; |
| 633 | __u32 jited_prog_len; |
| 634 | __u32 xlated_prog_len; |
| 635 | __aligned_u64 jited_prog_insns; |
| 636 | __aligned_u64 xlated_prog_insns; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 637 | __u64 load_time; |
| 638 | __u32 created_by_uid; |
| 639 | __u32 nr_map_ids; |
| 640 | __aligned_u64 map_ids; |
| 641 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 642 | __u32 ifindex; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 643 | __u32 gpl_compatible : 1; |
Christopher Ferris | fa59a10 | 2019-08-05 12:58:49 -0700 | [diff] [blame] | 644 | __u32 : 31; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 645 | __u64 netns_dev; |
| 646 | __u64 netns_ino; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 647 | __u32 nr_jited_ksyms; |
| 648 | __u32 nr_jited_func_lens; |
| 649 | __aligned_u64 jited_ksyms; |
| 650 | __aligned_u64 jited_func_lens; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 651 | __u32 btf_id; |
| 652 | __u32 func_info_rec_size; |
| 653 | __aligned_u64 func_info; |
| 654 | __u32 nr_func_info; |
| 655 | __u32 nr_line_info; |
| 656 | __aligned_u64 line_info; |
| 657 | __aligned_u64 jited_line_info; |
| 658 | __u32 nr_jited_line_info; |
| 659 | __u32 line_info_rec_size; |
| 660 | __u32 jited_line_info_rec_size; |
| 661 | __u32 nr_prog_tags; |
| 662 | __aligned_u64 prog_tags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 663 | __u64 run_time_ns; |
| 664 | __u64 run_cnt; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 665 | } __attribute__((aligned(8))); |
| 666 | struct bpf_map_info { |
| 667 | __u32 type; |
| 668 | __u32 id; |
| 669 | __u32 key_size; |
| 670 | __u32 value_size; |
| 671 | __u32 max_entries; |
| 672 | __u32 map_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 673 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 674 | __u32 ifindex; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 675 | __u32 btf_vmlinux_value_type_id; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 676 | __u64 netns_dev; |
| 677 | __u64 netns_ino; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 678 | __u32 btf_id; |
| 679 | __u32 btf_key_type_id; |
| 680 | __u32 btf_value_type_id; |
| 681 | } __attribute__((aligned(8))); |
| 682 | struct bpf_btf_info { |
| 683 | __aligned_u64 btf; |
| 684 | __u32 btf_size; |
| 685 | __u32 id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 686 | } __attribute__((aligned(8))); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 687 | struct bpf_sock_addr { |
| 688 | __u32 user_family; |
| 689 | __u32 user_ip4; |
| 690 | __u32 user_ip6[4]; |
| 691 | __u32 user_port; |
| 692 | __u32 family; |
| 693 | __u32 type; |
| 694 | __u32 protocol; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 695 | __u32 msg_src_ip4; |
| 696 | __u32 msg_src_ip6[4]; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 697 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 698 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 699 | struct bpf_sock_ops { |
| 700 | __u32 op; |
| 701 | union { |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 702 | __u32 args[4]; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 703 | __u32 reply; |
| 704 | __u32 replylong[4]; |
| 705 | }; |
| 706 | __u32 family; |
| 707 | __u32 remote_ip4; |
| 708 | __u32 local_ip4; |
| 709 | __u32 remote_ip6[4]; |
| 710 | __u32 local_ip6[4]; |
| 711 | __u32 remote_port; |
| 712 | __u32 local_port; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 713 | __u32 is_fullsock; |
| 714 | __u32 snd_cwnd; |
| 715 | __u32 srtt_us; |
| 716 | __u32 bpf_sock_ops_cb_flags; |
| 717 | __u32 state; |
| 718 | __u32 rtt_min; |
| 719 | __u32 snd_ssthresh; |
| 720 | __u32 rcv_nxt; |
| 721 | __u32 snd_nxt; |
| 722 | __u32 snd_una; |
| 723 | __u32 mss_cache; |
| 724 | __u32 ecn_flags; |
| 725 | __u32 rate_delivered; |
| 726 | __u32 rate_interval_us; |
| 727 | __u32 packets_out; |
| 728 | __u32 retrans_out; |
| 729 | __u32 total_retrans; |
| 730 | __u32 segs_in; |
| 731 | __u32 data_segs_in; |
| 732 | __u32 segs_out; |
| 733 | __u32 data_segs_out; |
| 734 | __u32 lost_out; |
| 735 | __u32 sacked_out; |
| 736 | __u32 sk_txhash; |
| 737 | __u64 bytes_received; |
| 738 | __u64 bytes_acked; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 739 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 740 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 741 | enum { |
| 742 | BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0), |
| 743 | BPF_SOCK_OPS_RETRANS_CB_FLAG = (1 << 1), |
| 744 | BPF_SOCK_OPS_STATE_CB_FLAG = (1 << 2), |
| 745 | BPF_SOCK_OPS_RTT_CB_FLAG = (1 << 3), |
| 746 | BPF_SOCK_OPS_ALL_CB_FLAGS = 0xF, |
| 747 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 748 | enum { |
| 749 | BPF_SOCK_OPS_VOID, |
| 750 | BPF_SOCK_OPS_TIMEOUT_INIT, |
| 751 | BPF_SOCK_OPS_RWND_INIT, |
| 752 | BPF_SOCK_OPS_TCP_CONNECT_CB, |
| 753 | BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, |
| 754 | BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, |
| 755 | BPF_SOCK_OPS_NEEDS_ECN, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 756 | BPF_SOCK_OPS_BASE_RTT, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 757 | BPF_SOCK_OPS_RTO_CB, |
| 758 | BPF_SOCK_OPS_RETRANS_CB, |
| 759 | BPF_SOCK_OPS_STATE_CB, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 760 | BPF_SOCK_OPS_TCP_LISTEN_CB, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 761 | BPF_SOCK_OPS_RTT_CB, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 762 | }; |
| 763 | enum { |
| 764 | BPF_TCP_ESTABLISHED = 1, |
| 765 | BPF_TCP_SYN_SENT, |
| 766 | BPF_TCP_SYN_RECV, |
| 767 | BPF_TCP_FIN_WAIT1, |
| 768 | BPF_TCP_FIN_WAIT2, |
| 769 | BPF_TCP_TIME_WAIT, |
| 770 | BPF_TCP_CLOSE, |
| 771 | BPF_TCP_CLOSE_WAIT, |
| 772 | BPF_TCP_LAST_ACK, |
| 773 | BPF_TCP_LISTEN, |
| 774 | BPF_TCP_CLOSING, |
| 775 | BPF_TCP_NEW_SYN_RECV, |
| 776 | BPF_TCP_MAX_STATES |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 777 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 778 | enum { |
| 779 | TCP_BPF_IW = 1001, |
| 780 | TCP_BPF_SNDCWND_CLAMP = 1002, |
| 781 | }; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 782 | struct bpf_perf_event_value { |
| 783 | __u64 counter; |
| 784 | __u64 enabled; |
| 785 | __u64 running; |
| 786 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 787 | enum { |
| 788 | BPF_DEVCG_ACC_MKNOD = (1ULL << 0), |
| 789 | BPF_DEVCG_ACC_READ = (1ULL << 1), |
| 790 | BPF_DEVCG_ACC_WRITE = (1ULL << 2), |
| 791 | }; |
| 792 | enum { |
| 793 | BPF_DEVCG_DEV_BLOCK = (1ULL << 0), |
| 794 | BPF_DEVCG_DEV_CHAR = (1ULL << 1), |
| 795 | }; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 796 | struct bpf_cgroup_dev_ctx { |
| 797 | __u32 access_type; |
| 798 | __u32 major; |
| 799 | __u32 minor; |
| 800 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 801 | struct bpf_raw_tracepoint_args { |
| 802 | __u64 args[0]; |
| 803 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 804 | enum { |
| 805 | BPF_FIB_LOOKUP_DIRECT = (1U << 0), |
| 806 | BPF_FIB_LOOKUP_OUTPUT = (1U << 1), |
| 807 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 808 | enum { |
| 809 | BPF_FIB_LKUP_RET_SUCCESS, |
| 810 | BPF_FIB_LKUP_RET_BLACKHOLE, |
| 811 | BPF_FIB_LKUP_RET_UNREACHABLE, |
| 812 | BPF_FIB_LKUP_RET_PROHIBIT, |
| 813 | BPF_FIB_LKUP_RET_NOT_FWDED, |
| 814 | BPF_FIB_LKUP_RET_FWD_DISABLED, |
| 815 | BPF_FIB_LKUP_RET_UNSUPP_LWT, |
| 816 | BPF_FIB_LKUP_RET_NO_NEIGH, |
| 817 | BPF_FIB_LKUP_RET_FRAG_NEEDED, |
| 818 | }; |
| 819 | struct bpf_fib_lookup { |
| 820 | __u8 family; |
| 821 | __u8 l4_protocol; |
| 822 | __be16 sport; |
| 823 | __be16 dport; |
| 824 | __u16 tot_len; |
| 825 | __u32 ifindex; |
| 826 | union { |
| 827 | __u8 tos; |
| 828 | __be32 flowinfo; |
| 829 | __u32 rt_metric; |
| 830 | }; |
| 831 | union { |
| 832 | __be32 ipv4_src; |
| 833 | __u32 ipv6_src[4]; |
| 834 | }; |
| 835 | union { |
| 836 | __be32 ipv4_dst; |
| 837 | __u32 ipv6_dst[4]; |
| 838 | }; |
| 839 | __be16 h_vlan_proto; |
| 840 | __be16 h_vlan_TCI; |
| 841 | __u8 smac[6]; |
| 842 | __u8 dmac[6]; |
| 843 | }; |
| 844 | enum bpf_task_fd_type { |
| 845 | BPF_FD_TYPE_RAW_TRACEPOINT, |
| 846 | BPF_FD_TYPE_TRACEPOINT, |
| 847 | BPF_FD_TYPE_KPROBE, |
| 848 | BPF_FD_TYPE_KRETPROBE, |
| 849 | BPF_FD_TYPE_UPROBE, |
| 850 | BPF_FD_TYPE_URETPROBE, |
| 851 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 852 | enum { |
| 853 | BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0), |
| 854 | BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1), |
| 855 | BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2), |
| 856 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 857 | struct bpf_flow_keys { |
| 858 | __u16 nhoff; |
| 859 | __u16 thoff; |
| 860 | __u16 addr_proto; |
| 861 | __u8 is_frag; |
| 862 | __u8 is_first_frag; |
| 863 | __u8 is_encap; |
| 864 | __u8 ip_proto; |
| 865 | __be16 n_proto; |
| 866 | __be16 sport; |
| 867 | __be16 dport; |
| 868 | union { |
| 869 | struct { |
| 870 | __be32 ipv4_src; |
| 871 | __be32 ipv4_dst; |
| 872 | }; |
| 873 | struct { |
| 874 | __u32 ipv6_src[4]; |
| 875 | __u32 ipv6_dst[4]; |
| 876 | }; |
| 877 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 878 | __u32 flags; |
| 879 | __be32 flow_label; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 880 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 881 | struct bpf_func_info { |
| 882 | __u32 insn_off; |
| 883 | __u32 type_id; |
| 884 | }; |
| 885 | #define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10) |
| 886 | #define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff) |
| 887 | struct bpf_line_info { |
| 888 | __u32 insn_off; |
| 889 | __u32 file_name_off; |
| 890 | __u32 line_off; |
| 891 | __u32 line_col; |
| 892 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 893 | struct bpf_spin_lock { |
| 894 | __u32 val; |
| 895 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 896 | struct bpf_sysctl { |
| 897 | __u32 write; |
| 898 | __u32 file_pos; |
| 899 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 900 | struct bpf_sockopt { |
| 901 | __bpf_md_ptr(struct bpf_sock *, sk); |
| 902 | __bpf_md_ptr(void *, optval); |
| 903 | __bpf_md_ptr(void *, optval_end); |
| 904 | __s32 level; |
| 905 | __s32 optname; |
| 906 | __s32 optlen; |
| 907 | __s32 retval; |
| 908 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame^] | 909 | struct bpf_pidns_info { |
| 910 | __u32 pid; |
| 911 | __u32 tgid; |
| 912 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 913 | #endif |