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