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 |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 26 | #define BPF_ATOMIC 0xc0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 27 | #define BPF_XADD 0xc0 |
| 28 | #define BPF_MOV 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 29 | #define BPF_ARSH 0xc0 |
| 30 | #define BPF_END 0xd0 |
| 31 | #define BPF_TO_LE 0x00 |
| 32 | #define BPF_TO_BE 0x08 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 33 | #define BPF_FROM_LE BPF_TO_LE |
| 34 | #define BPF_FROM_BE BPF_TO_BE |
| 35 | #define BPF_JNE 0x50 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 36 | #define BPF_JLT 0xa0 |
| 37 | #define BPF_JLE 0xb0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 38 | #define BPF_JSGT 0x60 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 39 | #define BPF_JSGE 0x70 |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 40 | #define BPF_JSLT 0xc0 |
| 41 | #define BPF_JSLE 0xd0 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 42 | #define BPF_CALL 0x80 |
| 43 | #define BPF_EXIT 0x90 |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 44 | #define BPF_FETCH 0x01 |
| 45 | #define BPF_XCHG (0xe0 | BPF_FETCH) |
| 46 | #define BPF_CMPXCHG (0xf0 | BPF_FETCH) |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 47 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 48 | BPF_REG_0 = 0, |
| 49 | BPF_REG_1, |
| 50 | BPF_REG_2, |
| 51 | BPF_REG_3, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 52 | BPF_REG_4, |
| 53 | BPF_REG_5, |
| 54 | BPF_REG_6, |
| 55 | BPF_REG_7, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 56 | BPF_REG_8, |
| 57 | BPF_REG_9, |
| 58 | BPF_REG_10, |
| 59 | __MAX_BPF_REG, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 60 | }; |
| 61 | #define MAX_BPF_REG __MAX_BPF_REG |
| 62 | struct bpf_insn { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 63 | __u8 code; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 64 | __u8 dst_reg : 4; |
| 65 | __u8 src_reg : 4; |
| 66 | __s16 off; |
| 67 | __s32 imm; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 68 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 69 | struct bpf_lpm_trie_key { |
| 70 | __u32 prefixlen; |
| 71 | __u8 data[0]; |
| 72 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 73 | struct bpf_cgroup_storage_key { |
| 74 | __u64 cgroup_inode_id; |
| 75 | __u32 attach_type; |
| 76 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 77 | union bpf_iter_link_info { |
| 78 | struct { |
| 79 | __u32 map_fd; |
| 80 | } map; |
| 81 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 82 | enum bpf_cmd { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 83 | BPF_MAP_CREATE, |
| 84 | BPF_MAP_LOOKUP_ELEM, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 85 | BPF_MAP_UPDATE_ELEM, |
| 86 | BPF_MAP_DELETE_ELEM, |
| 87 | BPF_MAP_GET_NEXT_KEY, |
| 88 | BPF_PROG_LOAD, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 89 | BPF_OBJ_PIN, |
| 90 | BPF_OBJ_GET, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 91 | BPF_PROG_ATTACH, |
| 92 | BPF_PROG_DETACH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 93 | BPF_PROG_TEST_RUN, |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 94 | BPF_PROG_RUN = BPF_PROG_TEST_RUN, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 95 | BPF_PROG_GET_NEXT_ID, |
| 96 | BPF_MAP_GET_NEXT_ID, |
| 97 | BPF_PROG_GET_FD_BY_ID, |
| 98 | BPF_MAP_GET_FD_BY_ID, |
| 99 | BPF_OBJ_GET_INFO_BY_FD, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 100 | BPF_PROG_QUERY, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 101 | BPF_RAW_TRACEPOINT_OPEN, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 102 | BPF_BTF_LOAD, |
| 103 | BPF_BTF_GET_FD_BY_ID, |
| 104 | BPF_TASK_FD_QUERY, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 105 | BPF_MAP_LOOKUP_AND_DELETE_ELEM, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 106 | BPF_MAP_FREEZE, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 107 | BPF_BTF_GET_NEXT_ID, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 108 | BPF_MAP_LOOKUP_BATCH, |
| 109 | BPF_MAP_LOOKUP_AND_DELETE_BATCH, |
| 110 | BPF_MAP_UPDATE_BATCH, |
| 111 | BPF_MAP_DELETE_BATCH, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 112 | BPF_LINK_CREATE, |
| 113 | BPF_LINK_UPDATE, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 114 | BPF_LINK_GET_FD_BY_ID, |
| 115 | BPF_LINK_GET_NEXT_ID, |
| 116 | BPF_ENABLE_STATS, |
| 117 | BPF_ITER_CREATE, |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 118 | BPF_LINK_DETACH, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 119 | BPF_PROG_BIND_MAP, |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 120 | }; |
| 121 | enum bpf_map_type { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 122 | BPF_MAP_TYPE_UNSPEC, |
| 123 | BPF_MAP_TYPE_HASH, |
| 124 | BPF_MAP_TYPE_ARRAY, |
| 125 | BPF_MAP_TYPE_PROG_ARRAY, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 126 | BPF_MAP_TYPE_PERF_EVENT_ARRAY, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 127 | BPF_MAP_TYPE_PERCPU_HASH, |
| 128 | BPF_MAP_TYPE_PERCPU_ARRAY, |
| 129 | BPF_MAP_TYPE_STACK_TRACE, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 130 | BPF_MAP_TYPE_CGROUP_ARRAY, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 131 | BPF_MAP_TYPE_LRU_HASH, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 132 | BPF_MAP_TYPE_LRU_PERCPU_HASH, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 133 | BPF_MAP_TYPE_LPM_TRIE, |
| 134 | BPF_MAP_TYPE_ARRAY_OF_MAPS, |
| 135 | BPF_MAP_TYPE_HASH_OF_MAPS, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 136 | BPF_MAP_TYPE_DEVMAP, |
| 137 | BPF_MAP_TYPE_SOCKMAP, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 138 | BPF_MAP_TYPE_CPUMAP, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 139 | BPF_MAP_TYPE_XSKMAP, |
| 140 | BPF_MAP_TYPE_SOCKHASH, |
| 141 | BPF_MAP_TYPE_CGROUP_STORAGE, |
| 142 | BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 143 | BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, |
| 144 | BPF_MAP_TYPE_QUEUE, |
| 145 | BPF_MAP_TYPE_STACK, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 146 | BPF_MAP_TYPE_SK_STORAGE, |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 147 | BPF_MAP_TYPE_DEVMAP_HASH, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 148 | BPF_MAP_TYPE_STRUCT_OPS, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 149 | BPF_MAP_TYPE_RINGBUF, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 150 | BPF_MAP_TYPE_INODE_STORAGE, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 151 | BPF_MAP_TYPE_TASK_STORAGE, |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 152 | BPF_MAP_TYPE_BLOOM_FILTER, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 153 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 154 | enum bpf_prog_type { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 155 | BPF_PROG_TYPE_UNSPEC, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 156 | BPF_PROG_TYPE_SOCKET_FILTER, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 157 | BPF_PROG_TYPE_KPROBE, |
| 158 | BPF_PROG_TYPE_SCHED_CLS, |
| 159 | BPF_PROG_TYPE_SCHED_ACT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 160 | BPF_PROG_TYPE_TRACEPOINT, |
| 161 | BPF_PROG_TYPE_XDP, |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 162 | BPF_PROG_TYPE_PERF_EVENT, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 163 | BPF_PROG_TYPE_CGROUP_SKB, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 164 | BPF_PROG_TYPE_CGROUP_SOCK, |
| 165 | BPF_PROG_TYPE_LWT_IN, |
| 166 | BPF_PROG_TYPE_LWT_OUT, |
| 167 | BPF_PROG_TYPE_LWT_XMIT, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 168 | BPF_PROG_TYPE_SOCK_OPS, |
| 169 | BPF_PROG_TYPE_SK_SKB, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 170 | BPF_PROG_TYPE_CGROUP_DEVICE, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 171 | BPF_PROG_TYPE_SK_MSG, |
| 172 | BPF_PROG_TYPE_RAW_TRACEPOINT, |
| 173 | BPF_PROG_TYPE_CGROUP_SOCK_ADDR, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 174 | BPF_PROG_TYPE_LWT_SEG6LOCAL, |
| 175 | BPF_PROG_TYPE_LIRC_MODE2, |
| 176 | BPF_PROG_TYPE_SK_REUSEPORT, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 177 | BPF_PROG_TYPE_FLOW_DISSECTOR, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 178 | BPF_PROG_TYPE_CGROUP_SYSCTL, |
| 179 | BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 180 | BPF_PROG_TYPE_CGROUP_SOCKOPT, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 181 | BPF_PROG_TYPE_TRACING, |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 182 | BPF_PROG_TYPE_STRUCT_OPS, |
| 183 | BPF_PROG_TYPE_EXT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 184 | BPF_PROG_TYPE_LSM, |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 185 | BPF_PROG_TYPE_SK_LOOKUP, |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 186 | BPF_PROG_TYPE_SYSCALL, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 187 | }; |
| 188 | enum bpf_attach_type { |
| 189 | BPF_CGROUP_INET_INGRESS, |
| 190 | BPF_CGROUP_INET_EGRESS, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 191 | BPF_CGROUP_INET_SOCK_CREATE, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 192 | BPF_CGROUP_SOCK_OPS, |
| 193 | BPF_SK_SKB_STREAM_PARSER, |
| 194 | BPF_SK_SKB_STREAM_VERDICT, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 195 | BPF_CGROUP_DEVICE, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 196 | BPF_SK_MSG_VERDICT, |
| 197 | BPF_CGROUP_INET4_BIND, |
| 198 | BPF_CGROUP_INET6_BIND, |
| 199 | BPF_CGROUP_INET4_CONNECT, |
| 200 | BPF_CGROUP_INET6_CONNECT, |
| 201 | BPF_CGROUP_INET4_POST_BIND, |
| 202 | BPF_CGROUP_INET6_POST_BIND, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 203 | BPF_CGROUP_UDP4_SENDMSG, |
| 204 | BPF_CGROUP_UDP6_SENDMSG, |
| 205 | BPF_LIRC_MODE2, |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 206 | BPF_FLOW_DISSECTOR, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 207 | BPF_CGROUP_SYSCTL, |
| 208 | BPF_CGROUP_UDP4_RECVMSG, |
| 209 | BPF_CGROUP_UDP6_RECVMSG, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 210 | BPF_CGROUP_GETSOCKOPT, |
| 211 | BPF_CGROUP_SETSOCKOPT, |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 212 | BPF_TRACE_RAW_TP, |
| 213 | BPF_TRACE_FENTRY, |
| 214 | BPF_TRACE_FEXIT, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 215 | BPF_MODIFY_RETURN, |
| 216 | BPF_LSM_MAC, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 217 | BPF_TRACE_ITER, |
| 218 | BPF_CGROUP_INET4_GETPEERNAME, |
| 219 | BPF_CGROUP_INET6_GETPEERNAME, |
| 220 | BPF_CGROUP_INET4_GETSOCKNAME, |
| 221 | BPF_CGROUP_INET6_GETSOCKNAME, |
| 222 | BPF_XDP_DEVMAP, |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 223 | BPF_CGROUP_INET_SOCK_RELEASE, |
| 224 | BPF_XDP_CPUMAP, |
| 225 | BPF_SK_LOOKUP, |
| 226 | BPF_XDP, |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 227 | BPF_SK_SKB_VERDICT, |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 228 | BPF_SK_REUSEPORT_SELECT, |
| 229 | BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 230 | BPF_PERF_EVENT, |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 231 | BPF_TRACE_KPROBE_MULTI, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 232 | __MAX_BPF_ATTACH_TYPE |
| 233 | }; |
| 234 | #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 235 | enum bpf_link_type { |
| 236 | BPF_LINK_TYPE_UNSPEC = 0, |
| 237 | BPF_LINK_TYPE_RAW_TRACEPOINT = 1, |
| 238 | BPF_LINK_TYPE_TRACING = 2, |
| 239 | BPF_LINK_TYPE_CGROUP = 3, |
| 240 | BPF_LINK_TYPE_ITER = 4, |
| 241 | BPF_LINK_TYPE_NETNS = 5, |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 242 | BPF_LINK_TYPE_XDP = 6, |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 243 | BPF_LINK_TYPE_PERF_EVENT = 7, |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 244 | BPF_LINK_TYPE_KPROBE_MULTI = 8, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 245 | MAX_BPF_LINK_TYPE, |
| 246 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 247 | #define BPF_F_ALLOW_OVERRIDE (1U << 0) |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 248 | #define BPF_F_ALLOW_MULTI (1U << 1) |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 249 | #define BPF_F_REPLACE (1U << 2) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 250 | #define BPF_F_STRICT_ALIGNMENT (1U << 0) |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 251 | #define BPF_F_ANY_ALIGNMENT (1U << 1) |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 252 | #define BPF_F_TEST_RND_HI32 (1U << 2) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 253 | #define BPF_F_TEST_STATE_FREQ (1U << 3) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 254 | #define BPF_F_SLEEPABLE (1U << 4) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 255 | #define BPF_F_XDP_HAS_FRAGS (1U << 5) |
| 256 | #define BPF_F_KPROBE_MULTI_RETURN (1U << 0) |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 257 | #define BPF_PSEUDO_MAP_FD 1 |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 258 | #define BPF_PSEUDO_MAP_IDX 5 |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 259 | #define BPF_PSEUDO_MAP_VALUE 2 |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 260 | #define BPF_PSEUDO_MAP_IDX_VALUE 6 |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 261 | #define BPF_PSEUDO_BTF_ID 3 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 262 | #define BPF_PSEUDO_FUNC 4 |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 263 | #define BPF_PSEUDO_CALL 1 |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 264 | #define BPF_PSEUDO_KFUNC_CALL 2 |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 265 | enum { |
| 266 | BPF_ANY = 0, |
| 267 | BPF_NOEXIST = 1, |
| 268 | BPF_EXIST = 2, |
| 269 | BPF_F_LOCK = 4, |
| 270 | }; |
| 271 | enum { |
| 272 | BPF_F_NO_PREALLOC = (1U << 0), |
| 273 | BPF_F_NO_COMMON_LRU = (1U << 1), |
| 274 | BPF_F_NUMA_NODE = (1U << 2), |
| 275 | BPF_F_RDONLY = (1U << 3), |
| 276 | BPF_F_WRONLY = (1U << 4), |
| 277 | BPF_F_STACK_BUILD_ID = (1U << 5), |
| 278 | BPF_F_ZERO_SEED = (1U << 6), |
| 279 | BPF_F_RDONLY_PROG = (1U << 7), |
| 280 | BPF_F_WRONLY_PROG = (1U << 8), |
| 281 | BPF_F_CLONE = (1U << 9), |
| 282 | BPF_F_MMAPABLE = (1U << 10), |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 283 | BPF_F_PRESERVE_ELEMS = (1U << 11), |
| 284 | BPF_F_INNER_MAP = (1U << 12), |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 285 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 286 | #define BPF_F_QUERY_EFFECTIVE (1U << 0) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 287 | #define BPF_F_TEST_RUN_ON_CPU (1U << 0) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 288 | #define BPF_F_TEST_XDP_LIVE_FRAMES (1U << 1) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 289 | enum bpf_stats_type { |
| 290 | BPF_STATS_RUN_TIME = 0, |
| 291 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 292 | enum bpf_stack_build_id_status { |
| 293 | BPF_STACK_BUILD_ID_EMPTY = 0, |
| 294 | BPF_STACK_BUILD_ID_VALID = 1, |
| 295 | BPF_STACK_BUILD_ID_IP = 2, |
| 296 | }; |
| 297 | #define BPF_BUILD_ID_SIZE 20 |
| 298 | struct bpf_stack_build_id { |
| 299 | __s32 status; |
| 300 | unsigned char build_id[BPF_BUILD_ID_SIZE]; |
| 301 | union { |
| 302 | __u64 offset; |
| 303 | __u64 ip; |
| 304 | }; |
| 305 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 306 | #define BPF_OBJ_NAME_LEN 16U |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 307 | union bpf_attr { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 308 | struct { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 309 | __u32 map_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 310 | __u32 key_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 311 | __u32 value_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 312 | __u32 max_entries; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 313 | __u32 map_flags; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 314 | __u32 inner_map_fd; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 315 | __u32 numa_node; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 316 | char map_name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 317 | __u32 map_ifindex; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 318 | __u32 btf_fd; |
| 319 | __u32 btf_key_type_id; |
| 320 | __u32 btf_value_type_id; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 321 | __u32 btf_vmlinux_value_type_id; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 322 | __u64 map_extra; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 323 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 324 | struct { |
| 325 | __u32 map_fd; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 326 | __aligned_u64 key; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 327 | union { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 328 | __aligned_u64 value; |
| 329 | __aligned_u64 next_key; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 330 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 331 | __u64 flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 332 | }; |
| 333 | struct { |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 334 | __aligned_u64 in_batch; |
| 335 | __aligned_u64 out_batch; |
| 336 | __aligned_u64 keys; |
| 337 | __aligned_u64 values; |
| 338 | __u32 count; |
| 339 | __u32 map_fd; |
| 340 | __u64 elem_flags; |
| 341 | __u64 flags; |
| 342 | } batch; |
| 343 | struct { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 344 | __u32 prog_type; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 345 | __u32 insn_cnt; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 346 | __aligned_u64 insns; |
| 347 | __aligned_u64 license; |
| 348 | __u32 log_level; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 349 | __u32 log_size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 350 | __aligned_u64 log_buf; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 351 | __u32 kern_version; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 352 | __u32 prog_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 353 | char prog_name[BPF_OBJ_NAME_LEN]; |
| 354 | __u32 prog_ifindex; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 355 | __u32 expected_attach_type; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 356 | __u32 prog_btf_fd; |
| 357 | __u32 func_info_rec_size; |
| 358 | __aligned_u64 func_info; |
| 359 | __u32 func_info_cnt; |
| 360 | __u32 line_info_rec_size; |
| 361 | __aligned_u64 line_info; |
| 362 | __u32 line_info_cnt; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 363 | __u32 attach_btf_id; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 364 | union { |
| 365 | __u32 attach_prog_fd; |
| 366 | __u32 attach_btf_obj_fd; |
| 367 | }; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 368 | __u32 core_relo_cnt; |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 369 | __aligned_u64 fd_array; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 370 | __aligned_u64 core_relos; |
| 371 | __u32 core_relo_rec_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 372 | }; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 373 | struct { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 374 | __aligned_u64 pathname; |
| 375 | __u32 bpf_fd; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 376 | __u32 file_flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 377 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 378 | struct { |
| 379 | __u32 target_fd; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 380 | __u32 attach_bpf_fd; |
| 381 | __u32 attach_type; |
| 382 | __u32 attach_flags; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 383 | __u32 replace_bpf_fd; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 384 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 385 | struct { |
| 386 | __u32 prog_fd; |
| 387 | __u32 retval; |
| 388 | __u32 data_size_in; |
| 389 | __u32 data_size_out; |
| 390 | __aligned_u64 data_in; |
| 391 | __aligned_u64 data_out; |
| 392 | __u32 repeat; |
| 393 | __u32 duration; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 394 | __u32 ctx_size_in; |
| 395 | __u32 ctx_size_out; |
| 396 | __aligned_u64 ctx_in; |
| 397 | __aligned_u64 ctx_out; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 398 | __u32 flags; |
| 399 | __u32 cpu; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 400 | __u32 batch_size; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 401 | } test; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 402 | struct { |
| 403 | union { |
| 404 | __u32 start_id; |
| 405 | __u32 prog_id; |
| 406 | __u32 map_id; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 407 | __u32 btf_id; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 408 | __u32 link_id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 409 | }; |
| 410 | __u32 next_id; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 411 | __u32 open_flags; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 412 | }; |
| 413 | struct { |
| 414 | __u32 bpf_fd; |
| 415 | __u32 info_len; |
| 416 | __aligned_u64 info; |
| 417 | } info; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 418 | struct { |
| 419 | __u32 target_fd; |
| 420 | __u32 attach_type; |
| 421 | __u32 query_flags; |
| 422 | __u32 attach_flags; |
| 423 | __aligned_u64 prog_ids; |
| 424 | __u32 prog_cnt; |
| 425 | } query; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 426 | struct { |
| 427 | __u64 name; |
| 428 | __u32 prog_fd; |
| 429 | } raw_tracepoint; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 430 | struct { |
| 431 | __aligned_u64 btf; |
| 432 | __aligned_u64 btf_log_buf; |
| 433 | __u32 btf_size; |
| 434 | __u32 btf_log_size; |
| 435 | __u32 btf_log_level; |
| 436 | }; |
| 437 | struct { |
| 438 | __u32 pid; |
| 439 | __u32 fd; |
| 440 | __u32 flags; |
| 441 | __u32 buf_len; |
| 442 | __aligned_u64 buf; |
| 443 | __u32 prog_id; |
| 444 | __u32 fd_type; |
| 445 | __u64 probe_offset; |
| 446 | __u64 probe_addr; |
| 447 | } task_fd_query; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 448 | struct { |
| 449 | __u32 prog_fd; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 450 | union { |
| 451 | __u32 target_fd; |
| 452 | __u32 target_ifindex; |
| 453 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 454 | __u32 attach_type; |
| 455 | __u32 flags; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 456 | union { |
| 457 | __u32 target_btf_id; |
| 458 | struct { |
| 459 | __aligned_u64 iter_info; |
| 460 | __u32 iter_info_len; |
| 461 | }; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 462 | struct { |
| 463 | __u64 bpf_cookie; |
| 464 | } perf_event; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 465 | struct { |
| 466 | __u32 flags; |
| 467 | __u32 cnt; |
| 468 | __aligned_u64 syms; |
| 469 | __aligned_u64 addrs; |
| 470 | __aligned_u64 cookies; |
| 471 | } kprobe_multi; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 472 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 473 | } link_create; |
| 474 | struct { |
| 475 | __u32 link_fd; |
| 476 | __u32 new_prog_fd; |
| 477 | __u32 flags; |
| 478 | __u32 old_prog_fd; |
| 479 | } link_update; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 480 | struct { |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 481 | __u32 link_fd; |
| 482 | } link_detach; |
| 483 | struct { |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 484 | __u32 type; |
| 485 | } enable_stats; |
| 486 | struct { |
| 487 | __u32 link_fd; |
| 488 | __u32 flags; |
| 489 | } iter_create; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 490 | struct { |
| 491 | __u32 prog_fd; |
| 492 | __u32 map_fd; |
| 493 | __u32 flags; |
| 494 | } prog_bind_map; |
Christopher Ferris | 6a9755d | 2017-01-13 14:09:31 -0800 | [diff] [blame] | 495 | } __attribute__((aligned(8))); |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 496 | #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), FN(ktime_get_boot_ns), FN(seq_printf), FN(seq_write), FN(sk_cgroup_id), FN(sk_ancestor_cgroup_id), FN(ringbuf_output), FN(ringbuf_reserve), FN(ringbuf_submit), FN(ringbuf_discard), FN(ringbuf_query), FN(csum_level), FN(skc_to_tcp6_sock), FN(skc_to_tcp_sock), FN(skc_to_tcp_timewait_sock), FN(skc_to_tcp_request_sock), FN(skc_to_udp6_sock), FN(get_task_stack), FN(load_hdr_opt), FN(store_hdr_opt), FN(reserve_hdr_opt), FN(inode_storage_get), FN(inode_storage_delete), FN(d_path), FN(copy_from_user), FN(snprintf_btf), FN(seq_printf_btf), FN(skb_cgroup_classid), FN(redirect_neigh), FN(per_cpu_ptr), FN(this_cpu_ptr), FN(redirect_peer), FN(task_storage_get), FN(task_storage_delete), FN(get_current_task_btf), FN(bprm_opts_set), FN(ktime_get_coarse_ns), FN(ima_inode_hash), FN(sock_from_file), FN(check_mtu), FN(for_each_map_elem), FN(snprintf), FN(sys_bpf), FN(btf_find_by_name_kind), FN(sys_close), FN(timer_init), FN(timer_set_callback), FN(timer_start), FN(timer_cancel), FN(get_func_ip), FN(get_attach_cookie), FN(task_pt_regs), FN(get_branch_snapshot), FN(trace_vprintk), FN(skc_to_unix_sock), FN(kallsyms_lookup_name), FN(find_vma), FN(loop), FN(strncmp), FN(get_func_arg), FN(get_func_ret), FN(get_func_arg_cnt), FN(get_retval), FN(set_retval), FN(xdp_get_buff_len), FN(xdp_load_bytes), FN(xdp_store_bytes), FN(copy_from_user_task), FN(skb_set_tstamp), FN(ima_file_hash), |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 497 | #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 498 | enum bpf_func_id { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 499 | __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 500 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 501 | #undef __BPF_ENUM_FN |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 502 | enum { |
| 503 | BPF_F_RECOMPUTE_CSUM = (1ULL << 0), |
| 504 | BPF_F_INVALIDATE_HASH = (1ULL << 1), |
| 505 | }; |
| 506 | enum { |
| 507 | BPF_F_HDR_FIELD_MASK = 0xfULL, |
| 508 | }; |
| 509 | enum { |
| 510 | BPF_F_PSEUDO_HDR = (1ULL << 4), |
| 511 | BPF_F_MARK_MANGLED_0 = (1ULL << 5), |
| 512 | BPF_F_MARK_ENFORCE = (1ULL << 6), |
| 513 | }; |
| 514 | enum { |
| 515 | BPF_F_INGRESS = (1ULL << 0), |
| 516 | }; |
| 517 | enum { |
| 518 | BPF_F_TUNINFO_IPV6 = (1ULL << 0), |
| 519 | }; |
| 520 | enum { |
| 521 | BPF_F_SKIP_FIELD_MASK = 0xffULL, |
| 522 | BPF_F_USER_STACK = (1ULL << 8), |
| 523 | BPF_F_FAST_STACK_CMP = (1ULL << 9), |
| 524 | BPF_F_REUSE_STACKID = (1ULL << 10), |
| 525 | BPF_F_USER_BUILD_ID = (1ULL << 11), |
| 526 | }; |
| 527 | enum { |
| 528 | BPF_F_ZERO_CSUM_TX = (1ULL << 1), |
| 529 | BPF_F_DONT_FRAGMENT = (1ULL << 2), |
| 530 | BPF_F_SEQ_NUMBER = (1ULL << 3), |
| 531 | }; |
| 532 | enum { |
| 533 | BPF_F_INDEX_MASK = 0xffffffffULL, |
| 534 | BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK, |
| 535 | BPF_F_CTXLEN_MASK = (0xfffffULL << 32), |
| 536 | }; |
| 537 | enum { |
| 538 | BPF_F_CURRENT_NETNS = (- 1L), |
| 539 | }; |
| 540 | enum { |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 541 | BPF_CSUM_LEVEL_QUERY, |
| 542 | BPF_CSUM_LEVEL_INC, |
| 543 | BPF_CSUM_LEVEL_DEC, |
| 544 | BPF_CSUM_LEVEL_RESET, |
| 545 | }; |
| 546 | enum { |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 547 | BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0), |
| 548 | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1), |
| 549 | BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2), |
| 550 | BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3), |
| 551 | BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4), |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 552 | BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5), |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 553 | BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6), |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 554 | }; |
| 555 | enum { |
| 556 | BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff, |
| 557 | BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56, |
| 558 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 559 | #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] | 560 | enum { |
| 561 | BPF_F_SYSCTL_BASE_NAME = (1ULL << 0), |
| 562 | }; |
| 563 | enum { |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 564 | BPF_LOCAL_STORAGE_GET_F_CREATE = (1ULL << 0), |
| 565 | BPF_SK_STORAGE_GET_F_CREATE = BPF_LOCAL_STORAGE_GET_F_CREATE, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 566 | }; |
| 567 | enum { |
| 568 | BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0), |
| 569 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 570 | enum { |
| 571 | BPF_RB_NO_WAKEUP = (1ULL << 0), |
| 572 | BPF_RB_FORCE_WAKEUP = (1ULL << 1), |
| 573 | }; |
| 574 | enum { |
| 575 | BPF_RB_AVAIL_DATA = 0, |
| 576 | BPF_RB_RING_SIZE = 1, |
| 577 | BPF_RB_CONS_POS = 2, |
| 578 | BPF_RB_PROD_POS = 3, |
| 579 | }; |
| 580 | enum { |
| 581 | BPF_RINGBUF_BUSY_BIT = (1U << 31), |
| 582 | BPF_RINGBUF_DISCARD_BIT = (1U << 30), |
| 583 | BPF_RINGBUF_HDR_SZ = 8, |
| 584 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 585 | enum { |
| 586 | BPF_SK_LOOKUP_F_REPLACE = (1ULL << 0), |
| 587 | BPF_SK_LOOKUP_F_NO_REUSEPORT = (1ULL << 1), |
| 588 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 589 | enum bpf_adj_room_mode { |
| 590 | BPF_ADJ_ROOM_NET, |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 591 | BPF_ADJ_ROOM_MAC, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 592 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 593 | enum bpf_hdr_start_off { |
| 594 | BPF_HDR_START_MAC, |
| 595 | BPF_HDR_START_NET, |
| 596 | }; |
| 597 | enum bpf_lwt_encap_mode { |
| 598 | BPF_LWT_ENCAP_SEG6, |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 599 | BPF_LWT_ENCAP_SEG6_INLINE, |
| 600 | BPF_LWT_ENCAP_IP, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 601 | }; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 602 | enum { |
| 603 | BPF_F_BPRM_SECUREEXEC = (1ULL << 0), |
| 604 | }; |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 605 | enum { |
| 606 | BPF_F_BROADCAST = (1ULL << 3), |
| 607 | BPF_F_EXCLUDE_INGRESS = (1ULL << 4), |
| 608 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 609 | #define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \ |
| 610 | } __attribute__((aligned(8))) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 611 | enum { |
| 612 | BPF_SKB_TSTAMP_UNSPEC, |
| 613 | BPF_SKB_TSTAMP_DELIVERY_MONO, |
| 614 | }; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 615 | struct __sk_buff { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 616 | __u32 len; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 617 | __u32 pkt_type; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 618 | __u32 mark; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 619 | __u32 queue_mapping; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 620 | __u32 protocol; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 621 | __u32 vlan_present; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 622 | __u32 vlan_tci; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 623 | __u32 vlan_proto; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 624 | __u32 priority; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 625 | __u32 ingress_ifindex; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 626 | __u32 ifindex; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 627 | __u32 tc_index; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 628 | __u32 cb[5]; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 629 | __u32 hash; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 630 | __u32 tc_classid; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 631 | __u32 data; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 632 | __u32 data_end; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 633 | __u32 napi_id; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 634 | __u32 family; |
| 635 | __u32 remote_ip4; |
| 636 | __u32 local_ip4; |
| 637 | __u32 remote_ip6[4]; |
| 638 | __u32 local_ip6[4]; |
| 639 | __u32 remote_port; |
| 640 | __u32 local_port; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 641 | __u32 data_meta; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 642 | __bpf_md_ptr(struct bpf_flow_keys *, flow_keys); |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 643 | __u64 tstamp; |
| 644 | __u32 wire_len; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 645 | __u32 gso_segs; |
| 646 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 647 | __u32 gso_size; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 648 | __u8 tstamp_type; |
| 649 | __u32 : 24; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 650 | __u64 hwtstamp; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 651 | }; |
| 652 | struct bpf_tunnel_key { |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 653 | __u32 tunnel_id; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 654 | union { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 655 | __u32 remote_ipv4; |
| 656 | __u32 remote_ipv6[4]; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 657 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 658 | __u8 tunnel_tos; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 659 | __u8 tunnel_ttl; |
| 660 | __u16 tunnel_ext; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 661 | __u32 tunnel_label; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 662 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 663 | struct bpf_xfrm_state { |
| 664 | __u32 reqid; |
| 665 | __u32 spi; |
| 666 | __u16 family; |
| 667 | __u16 ext; |
| 668 | union { |
| 669 | __u32 remote_ipv4; |
| 670 | __u32 remote_ipv6[4]; |
| 671 | }; |
| 672 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 673 | enum bpf_ret_code { |
| 674 | BPF_OK = 0, |
| 675 | BPF_DROP = 2, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 676 | BPF_REDIRECT = 7, |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 677 | BPF_LWT_REROUTE = 128, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 678 | }; |
| 679 | struct bpf_sock { |
| 680 | __u32 bound_dev_if; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 681 | __u32 family; |
| 682 | __u32 type; |
| 683 | __u32 protocol; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 684 | __u32 mark; |
| 685 | __u32 priority; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 686 | __u32 src_ip4; |
| 687 | __u32 src_ip6[4]; |
| 688 | __u32 src_port; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 689 | __be16 dst_port; |
| 690 | __u16 : 16; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 691 | __u32 dst_ip4; |
| 692 | __u32 dst_ip6[4]; |
| 693 | __u32 state; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 694 | __s32 rx_queue_mapping; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 695 | }; |
| 696 | struct bpf_tcp_sock { |
| 697 | __u32 snd_cwnd; |
| 698 | __u32 srtt_us; |
| 699 | __u32 rtt_min; |
| 700 | __u32 snd_ssthresh; |
| 701 | __u32 rcv_nxt; |
| 702 | __u32 snd_nxt; |
| 703 | __u32 snd_una; |
| 704 | __u32 mss_cache; |
| 705 | __u32 ecn_flags; |
| 706 | __u32 rate_delivered; |
| 707 | __u32 rate_interval_us; |
| 708 | __u32 packets_out; |
| 709 | __u32 retrans_out; |
| 710 | __u32 total_retrans; |
| 711 | __u32 segs_in; |
| 712 | __u32 data_segs_in; |
| 713 | __u32 segs_out; |
| 714 | __u32 data_segs_out; |
| 715 | __u32 lost_out; |
| 716 | __u32 sacked_out; |
| 717 | __u64 bytes_received; |
| 718 | __u64 bytes_acked; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 719 | __u32 dsack_dups; |
| 720 | __u32 delivered; |
| 721 | __u32 delivered_ce; |
| 722 | __u32 icsk_retransmits; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 723 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 724 | struct bpf_sock_tuple { |
| 725 | union { |
| 726 | struct { |
| 727 | __be32 saddr; |
| 728 | __be32 daddr; |
| 729 | __be16 sport; |
| 730 | __be16 dport; |
| 731 | } ipv4; |
| 732 | struct { |
| 733 | __be32 saddr[4]; |
| 734 | __be32 daddr[4]; |
| 735 | __be16 sport; |
| 736 | __be16 dport; |
| 737 | } ipv6; |
| 738 | }; |
| 739 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 740 | struct bpf_xdp_sock { |
| 741 | __u32 queue_id; |
| 742 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 743 | #define XDP_PACKET_HEADROOM 256 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 744 | enum xdp_action { |
| 745 | XDP_ABORTED = 0, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 746 | XDP_DROP, |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 747 | XDP_PASS, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 748 | XDP_TX, |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 749 | XDP_REDIRECT, |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 750 | }; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 751 | struct xdp_md { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 752 | __u32 data; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 753 | __u32 data_end; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 754 | __u32 data_meta; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 755 | __u32 ingress_ifindex; |
| 756 | __u32 rx_queue_index; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 757 | __u32 egress_ifindex; |
| 758 | }; |
| 759 | struct bpf_devmap_val { |
| 760 | __u32 ifindex; |
| 761 | union { |
| 762 | int fd; |
| 763 | __u32 id; |
| 764 | } bpf_prog; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 765 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 766 | struct bpf_cpumap_val { |
| 767 | __u32 qsize; |
| 768 | union { |
| 769 | int fd; |
| 770 | __u32 id; |
| 771 | } bpf_prog; |
| 772 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 773 | enum sk_action { |
| 774 | SK_DROP = 0, |
| 775 | SK_PASS, |
| 776 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 777 | struct sk_msg_md { |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 778 | __bpf_md_ptr(void *, data); |
| 779 | __bpf_md_ptr(void *, data_end); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 780 | __u32 family; |
| 781 | __u32 remote_ip4; |
| 782 | __u32 local_ip4; |
| 783 | __u32 remote_ip6[4]; |
| 784 | __u32 local_ip6[4]; |
| 785 | __u32 remote_port; |
| 786 | __u32 local_port; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 787 | __u32 size; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 788 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 789 | }; |
| 790 | struct sk_reuseport_md { |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 791 | __bpf_md_ptr(void *, data); |
| 792 | __bpf_md_ptr(void *, data_end); |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 793 | __u32 len; |
| 794 | __u32 eth_protocol; |
| 795 | __u32 ip_protocol; |
| 796 | __u32 bind_inany; |
| 797 | __u32 hash; |
Christopher Ferris | 3a39c0b | 2021-09-02 00:03:38 +0000 | [diff] [blame] | 798 | __bpf_md_ptr(struct bpf_sock *, sk); |
| 799 | __bpf_md_ptr(struct bpf_sock *, migrating_sk); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 800 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 801 | #define BPF_TAG_SIZE 8 |
| 802 | struct bpf_prog_info { |
| 803 | __u32 type; |
| 804 | __u32 id; |
| 805 | __u8 tag[BPF_TAG_SIZE]; |
| 806 | __u32 jited_prog_len; |
| 807 | __u32 xlated_prog_len; |
| 808 | __aligned_u64 jited_prog_insns; |
| 809 | __aligned_u64 xlated_prog_insns; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 810 | __u64 load_time; |
| 811 | __u32 created_by_uid; |
| 812 | __u32 nr_map_ids; |
| 813 | __aligned_u64 map_ids; |
| 814 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 815 | __u32 ifindex; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 816 | __u32 gpl_compatible : 1; |
Christopher Ferris | fa59a10 | 2019-08-05 12:58:49 -0700 | [diff] [blame] | 817 | __u32 : 31; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 818 | __u64 netns_dev; |
| 819 | __u64 netns_ino; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 820 | __u32 nr_jited_ksyms; |
| 821 | __u32 nr_jited_func_lens; |
| 822 | __aligned_u64 jited_ksyms; |
| 823 | __aligned_u64 jited_func_lens; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 824 | __u32 btf_id; |
| 825 | __u32 func_info_rec_size; |
| 826 | __aligned_u64 func_info; |
| 827 | __u32 nr_func_info; |
| 828 | __u32 nr_line_info; |
| 829 | __aligned_u64 line_info; |
| 830 | __aligned_u64 jited_line_info; |
| 831 | __u32 nr_jited_line_info; |
| 832 | __u32 line_info_rec_size; |
| 833 | __u32 jited_line_info_rec_size; |
| 834 | __u32 nr_prog_tags; |
| 835 | __aligned_u64 prog_tags; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 836 | __u64 run_time_ns; |
| 837 | __u64 run_cnt; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 838 | __u64 recursion_misses; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 839 | __u32 verified_insns; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 840 | } __attribute__((aligned(8))); |
| 841 | struct bpf_map_info { |
| 842 | __u32 type; |
| 843 | __u32 id; |
| 844 | __u32 key_size; |
| 845 | __u32 value_size; |
| 846 | __u32 max_entries; |
| 847 | __u32 map_flags; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 848 | char name[BPF_OBJ_NAME_LEN]; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 849 | __u32 ifindex; |
Christopher Ferris | bb9fcb4 | 2020-04-06 11:38:04 -0700 | [diff] [blame] | 850 | __u32 btf_vmlinux_value_type_id; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 851 | __u64 netns_dev; |
| 852 | __u64 netns_ino; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 853 | __u32 btf_id; |
| 854 | __u32 btf_key_type_id; |
| 855 | __u32 btf_value_type_id; |
Christopher Ferris | a479261 | 2022-01-10 13:51:15 -0800 | [diff] [blame] | 856 | __u32 : 32; |
| 857 | __u64 map_extra; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 858 | } __attribute__((aligned(8))); |
| 859 | struct bpf_btf_info { |
| 860 | __aligned_u64 btf; |
| 861 | __u32 btf_size; |
| 862 | __u32 id; |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 863 | __aligned_u64 name; |
| 864 | __u32 name_len; |
| 865 | __u32 kernel_btf; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 866 | } __attribute__((aligned(8))); |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 867 | struct bpf_link_info { |
| 868 | __u32 type; |
| 869 | __u32 id; |
| 870 | __u32 prog_id; |
| 871 | union { |
| 872 | struct { |
| 873 | __aligned_u64 tp_name; |
| 874 | __u32 tp_name_len; |
| 875 | } raw_tracepoint; |
| 876 | struct { |
| 877 | __u32 attach_type; |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 878 | __u32 target_obj_id; |
| 879 | __u32 target_btf_id; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 880 | } tracing; |
| 881 | struct { |
| 882 | __u64 cgroup_id; |
| 883 | __u32 attach_type; |
| 884 | } cgroup; |
| 885 | struct { |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 886 | __aligned_u64 target_name; |
| 887 | __u32 target_name_len; |
| 888 | union { |
| 889 | struct { |
| 890 | __u32 map_id; |
| 891 | } map; |
| 892 | }; |
| 893 | } iter; |
| 894 | struct { |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 895 | __u32 netns_ino; |
| 896 | __u32 attach_type; |
| 897 | } netns; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 898 | struct { |
| 899 | __u32 ifindex; |
| 900 | } xdp; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 901 | }; |
| 902 | } __attribute__((aligned(8))); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 903 | struct bpf_sock_addr { |
| 904 | __u32 user_family; |
| 905 | __u32 user_ip4; |
| 906 | __u32 user_ip6[4]; |
| 907 | __u32 user_port; |
| 908 | __u32 family; |
| 909 | __u32 type; |
| 910 | __u32 protocol; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 911 | __u32 msg_src_ip4; |
| 912 | __u32 msg_src_ip6[4]; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 913 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 914 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 915 | struct bpf_sock_ops { |
| 916 | __u32 op; |
| 917 | union { |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 918 | __u32 args[4]; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 919 | __u32 reply; |
| 920 | __u32 replylong[4]; |
| 921 | }; |
| 922 | __u32 family; |
| 923 | __u32 remote_ip4; |
| 924 | __u32 local_ip4; |
| 925 | __u32 remote_ip6[4]; |
| 926 | __u32 local_ip6[4]; |
| 927 | __u32 remote_port; |
| 928 | __u32 local_port; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 929 | __u32 is_fullsock; |
| 930 | __u32 snd_cwnd; |
| 931 | __u32 srtt_us; |
| 932 | __u32 bpf_sock_ops_cb_flags; |
| 933 | __u32 state; |
| 934 | __u32 rtt_min; |
| 935 | __u32 snd_ssthresh; |
| 936 | __u32 rcv_nxt; |
| 937 | __u32 snd_nxt; |
| 938 | __u32 snd_una; |
| 939 | __u32 mss_cache; |
| 940 | __u32 ecn_flags; |
| 941 | __u32 rate_delivered; |
| 942 | __u32 rate_interval_us; |
| 943 | __u32 packets_out; |
| 944 | __u32 retrans_out; |
| 945 | __u32 total_retrans; |
| 946 | __u32 segs_in; |
| 947 | __u32 data_segs_in; |
| 948 | __u32 segs_out; |
| 949 | __u32 data_segs_out; |
| 950 | __u32 lost_out; |
| 951 | __u32 sacked_out; |
| 952 | __u32 sk_txhash; |
| 953 | __u64 bytes_received; |
| 954 | __u64 bytes_acked; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 955 | __bpf_md_ptr(struct bpf_sock *, sk); |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 956 | __bpf_md_ptr(void *, skb_data); |
| 957 | __bpf_md_ptr(void *, skb_data_end); |
| 958 | __u32 skb_len; |
| 959 | __u32 skb_tcp_flags; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 960 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 961 | enum { |
| 962 | BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0), |
| 963 | BPF_SOCK_OPS_RETRANS_CB_FLAG = (1 << 1), |
| 964 | BPF_SOCK_OPS_STATE_CB_FLAG = (1 << 2), |
| 965 | BPF_SOCK_OPS_RTT_CB_FLAG = (1 << 3), |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 966 | BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = (1 << 4), |
| 967 | BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = (1 << 5), |
| 968 | BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1 << 6), |
| 969 | BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 970 | }; |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 971 | enum { |
| 972 | BPF_SOCK_OPS_VOID, |
| 973 | BPF_SOCK_OPS_TIMEOUT_INIT, |
| 974 | BPF_SOCK_OPS_RWND_INIT, |
| 975 | BPF_SOCK_OPS_TCP_CONNECT_CB, |
| 976 | BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, |
| 977 | BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, |
| 978 | BPF_SOCK_OPS_NEEDS_ECN, |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 979 | BPF_SOCK_OPS_BASE_RTT, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 980 | BPF_SOCK_OPS_RTO_CB, |
| 981 | BPF_SOCK_OPS_RETRANS_CB, |
| 982 | BPF_SOCK_OPS_STATE_CB, |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 983 | BPF_SOCK_OPS_TCP_LISTEN_CB, |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 984 | BPF_SOCK_OPS_RTT_CB, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 985 | BPF_SOCK_OPS_PARSE_HDR_OPT_CB, |
| 986 | BPF_SOCK_OPS_HDR_OPT_LEN_CB, |
| 987 | BPF_SOCK_OPS_WRITE_HDR_OPT_CB, |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 988 | }; |
| 989 | enum { |
| 990 | BPF_TCP_ESTABLISHED = 1, |
| 991 | BPF_TCP_SYN_SENT, |
| 992 | BPF_TCP_SYN_RECV, |
| 993 | BPF_TCP_FIN_WAIT1, |
| 994 | BPF_TCP_FIN_WAIT2, |
| 995 | BPF_TCP_TIME_WAIT, |
| 996 | BPF_TCP_CLOSE, |
| 997 | BPF_TCP_CLOSE_WAIT, |
| 998 | BPF_TCP_LAST_ACK, |
| 999 | BPF_TCP_LISTEN, |
| 1000 | BPF_TCP_CLOSING, |
| 1001 | BPF_TCP_NEW_SYN_RECV, |
| 1002 | BPF_TCP_MAX_STATES |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 1003 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1004 | enum { |
| 1005 | TCP_BPF_IW = 1001, |
| 1006 | TCP_BPF_SNDCWND_CLAMP = 1002, |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 1007 | TCP_BPF_DELACK_MAX = 1003, |
| 1008 | TCP_BPF_RTO_MIN = 1004, |
| 1009 | TCP_BPF_SYN = 1005, |
| 1010 | TCP_BPF_SYN_IP = 1006, |
| 1011 | TCP_BPF_SYN_MAC = 1007, |
| 1012 | }; |
| 1013 | enum { |
| 1014 | BPF_LOAD_HDR_OPT_TCP_SYN = (1ULL << 0), |
| 1015 | }; |
| 1016 | enum { |
| 1017 | BPF_WRITE_HDR_TCP_CURRENT_MSS = 1, |
| 1018 | BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 2, |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1019 | }; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 1020 | struct bpf_perf_event_value { |
| 1021 | __u64 counter; |
| 1022 | __u64 enabled; |
| 1023 | __u64 running; |
| 1024 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1025 | enum { |
| 1026 | BPF_DEVCG_ACC_MKNOD = (1ULL << 0), |
| 1027 | BPF_DEVCG_ACC_READ = (1ULL << 1), |
| 1028 | BPF_DEVCG_ACC_WRITE = (1ULL << 2), |
| 1029 | }; |
| 1030 | enum { |
| 1031 | BPF_DEVCG_DEV_BLOCK = (1ULL << 0), |
| 1032 | BPF_DEVCG_DEV_CHAR = (1ULL << 1), |
| 1033 | }; |
Christopher Ferris | 934ec94 | 2018-01-31 15:29:16 -0800 | [diff] [blame] | 1034 | struct bpf_cgroup_dev_ctx { |
| 1035 | __u32 access_type; |
| 1036 | __u32 major; |
| 1037 | __u32 minor; |
| 1038 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 1039 | struct bpf_raw_tracepoint_args { |
| 1040 | __u64 args[0]; |
| 1041 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1042 | enum { |
| 1043 | BPF_FIB_LOOKUP_DIRECT = (1U << 0), |
| 1044 | BPF_FIB_LOOKUP_OUTPUT = (1U << 1), |
| 1045 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 1046 | enum { |
| 1047 | BPF_FIB_LKUP_RET_SUCCESS, |
| 1048 | BPF_FIB_LKUP_RET_BLACKHOLE, |
| 1049 | BPF_FIB_LKUP_RET_UNREACHABLE, |
| 1050 | BPF_FIB_LKUP_RET_PROHIBIT, |
| 1051 | BPF_FIB_LKUP_RET_NOT_FWDED, |
| 1052 | BPF_FIB_LKUP_RET_FWD_DISABLED, |
| 1053 | BPF_FIB_LKUP_RET_UNSUPP_LWT, |
| 1054 | BPF_FIB_LKUP_RET_NO_NEIGH, |
| 1055 | BPF_FIB_LKUP_RET_FRAG_NEEDED, |
| 1056 | }; |
| 1057 | struct bpf_fib_lookup { |
| 1058 | __u8 family; |
| 1059 | __u8 l4_protocol; |
| 1060 | __be16 sport; |
| 1061 | __be16 dport; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 1062 | union { |
| 1063 | __u16 tot_len; |
| 1064 | __u16 mtu_result; |
| 1065 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 1066 | __u32 ifindex; |
| 1067 | union { |
| 1068 | __u8 tos; |
| 1069 | __be32 flowinfo; |
| 1070 | __u32 rt_metric; |
| 1071 | }; |
| 1072 | union { |
| 1073 | __be32 ipv4_src; |
| 1074 | __u32 ipv6_src[4]; |
| 1075 | }; |
| 1076 | union { |
| 1077 | __be32 ipv4_dst; |
| 1078 | __u32 ipv6_dst[4]; |
| 1079 | }; |
| 1080 | __be16 h_vlan_proto; |
| 1081 | __be16 h_vlan_TCI; |
| 1082 | __u8 smac[6]; |
| 1083 | __u8 dmac[6]; |
| 1084 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 1085 | struct bpf_redir_neigh { |
| 1086 | __u32 nh_family; |
| 1087 | union { |
| 1088 | __be32 ipv4_nh; |
| 1089 | __u32 ipv6_nh[4]; |
| 1090 | }; |
| 1091 | }; |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 1092 | enum bpf_check_mtu_flags { |
| 1093 | BPF_MTU_CHK_SEGS = (1U << 0), |
| 1094 | }; |
| 1095 | enum bpf_check_mtu_ret { |
| 1096 | BPF_MTU_CHK_RET_SUCCESS, |
| 1097 | BPF_MTU_CHK_RET_FRAG_NEEDED, |
| 1098 | BPF_MTU_CHK_RET_SEGS_TOOBIG, |
| 1099 | }; |
Christopher Ferris | 9ce2884 | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 1100 | enum bpf_task_fd_type { |
| 1101 | BPF_FD_TYPE_RAW_TRACEPOINT, |
| 1102 | BPF_FD_TYPE_TRACEPOINT, |
| 1103 | BPF_FD_TYPE_KPROBE, |
| 1104 | BPF_FD_TYPE_KRETPROBE, |
| 1105 | BPF_FD_TYPE_UPROBE, |
| 1106 | BPF_FD_TYPE_URETPROBE, |
| 1107 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1108 | enum { |
| 1109 | BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0), |
| 1110 | BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1), |
| 1111 | BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2), |
| 1112 | }; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 1113 | struct bpf_flow_keys { |
| 1114 | __u16 nhoff; |
| 1115 | __u16 thoff; |
| 1116 | __u16 addr_proto; |
| 1117 | __u8 is_frag; |
| 1118 | __u8 is_first_frag; |
| 1119 | __u8 is_encap; |
| 1120 | __u8 ip_proto; |
| 1121 | __be16 n_proto; |
| 1122 | __be16 sport; |
| 1123 | __be16 dport; |
| 1124 | union { |
| 1125 | struct { |
| 1126 | __be32 ipv4_src; |
| 1127 | __be32 ipv4_dst; |
| 1128 | }; |
| 1129 | struct { |
| 1130 | __u32 ipv6_src[4]; |
| 1131 | __u32 ipv6_dst[4]; |
| 1132 | }; |
| 1133 | }; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 1134 | __u32 flags; |
| 1135 | __be32 flow_label; |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 1136 | }; |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 1137 | struct bpf_func_info { |
| 1138 | __u32 insn_off; |
| 1139 | __u32 type_id; |
| 1140 | }; |
| 1141 | #define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10) |
| 1142 | #define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff) |
| 1143 | struct bpf_line_info { |
| 1144 | __u32 insn_off; |
| 1145 | __u32 file_name_off; |
| 1146 | __u32 line_off; |
| 1147 | __u32 line_col; |
| 1148 | }; |
Christopher Ferris | 24f97eb | 2019-05-20 12:58:13 -0700 | [diff] [blame] | 1149 | struct bpf_spin_lock { |
| 1150 | __u32 val; |
| 1151 | }; |
Christopher Ferris | 2abfa9e | 2021-11-01 16:26:06 -0700 | [diff] [blame] | 1152 | struct bpf_timer { |
| 1153 | __u64 : 64; |
| 1154 | __u64 : 64; |
| 1155 | } __attribute__((aligned(8))); |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 1156 | struct bpf_sysctl { |
| 1157 | __u32 write; |
| 1158 | __u32 file_pos; |
| 1159 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 1160 | struct bpf_sockopt { |
| 1161 | __bpf_md_ptr(struct bpf_sock *, sk); |
| 1162 | __bpf_md_ptr(void *, optval); |
| 1163 | __bpf_md_ptr(void *, optval_end); |
| 1164 | __s32 level; |
| 1165 | __s32 optname; |
| 1166 | __s32 optlen; |
| 1167 | __s32 retval; |
| 1168 | }; |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 1169 | struct bpf_pidns_info { |
| 1170 | __u32 pid; |
| 1171 | __u32 tgid; |
| 1172 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 1173 | struct bpf_sk_lookup { |
Christopher Ferris | fcc3b4f | 2021-07-01 01:30:21 +0000 | [diff] [blame] | 1174 | union { |
| 1175 | __bpf_md_ptr(struct bpf_sock *, sk); |
| 1176 | __u64 cookie; |
| 1177 | }; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 1178 | __u32 family; |
| 1179 | __u32 protocol; |
| 1180 | __u32 remote_ip4; |
| 1181 | __u32 remote_ip6[4]; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 1182 | __be16 remote_port; |
| 1183 | __u16 : 16; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 1184 | __u32 local_ip4; |
| 1185 | __u32 local_ip6[4]; |
| 1186 | __u32 local_port; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 1187 | __u32 ingress_ifindex; |
Christopher Ferris | 25c18d4 | 2020-10-14 17:42:58 -0700 | [diff] [blame] | 1188 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 1189 | struct btf_ptr { |
| 1190 | void * ptr; |
| 1191 | __u32 type_id; |
| 1192 | __u32 flags; |
| 1193 | }; |
| 1194 | enum { |
| 1195 | BTF_F_COMPACT = (1ULL << 0), |
| 1196 | BTF_F_NONAME = (1ULL << 1), |
| 1197 | BTF_F_PTR_RAW = (1ULL << 2), |
| 1198 | BTF_F_ZERO = (1ULL << 3), |
| 1199 | }; |
Christopher Ferris | 1ed5534 | 2022-03-22 16:06:25 -0700 | [diff] [blame] | 1200 | enum bpf_core_relo_kind { |
| 1201 | BPF_CORE_FIELD_BYTE_OFFSET = 0, |
| 1202 | BPF_CORE_FIELD_BYTE_SIZE = 1, |
| 1203 | BPF_CORE_FIELD_EXISTS = 2, |
| 1204 | BPF_CORE_FIELD_SIGNED = 3, |
| 1205 | BPF_CORE_FIELD_LSHIFT_U64 = 4, |
| 1206 | BPF_CORE_FIELD_RSHIFT_U64 = 5, |
| 1207 | BPF_CORE_TYPE_ID_LOCAL = 6, |
| 1208 | BPF_CORE_TYPE_ID_TARGET = 7, |
| 1209 | BPF_CORE_TYPE_EXISTS = 8, |
| 1210 | BPF_CORE_TYPE_SIZE = 9, |
| 1211 | BPF_CORE_ENUMVAL_EXISTS = 10, |
| 1212 | BPF_CORE_ENUMVAL_VALUE = 11, |
| 1213 | }; |
| 1214 | struct bpf_core_relo { |
| 1215 | __u32 insn_off; |
| 1216 | __u32 type_id; |
| 1217 | __u32 access_str_off; |
| 1218 | enum bpf_core_relo_kind kind; |
| 1219 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 1220 | #endif |