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