blob: 0e9e88352fc1132161e52c963f5baeeec73e843c [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Ferris82d75042015-01-26 10:57:07 -08007#ifndef _UAPI__LINUX_BPF_H__
8#define _UAPI__LINUX_BPF_H__
9#include <linux/types.h>
10#include <linux/bpf_common.h>
Christopher Ferris24f97eb2019-05-20 12:58:13 -070011#define BPF_JMP32 0x06
Christopher Ferris82d75042015-01-26 10:57:07 -080012#define BPF_ALU64 0x07
13#define BPF_DW 0x18
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070014#define BPF_MEMSX 0x80
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070015#define BPF_ATOMIC 0xc0
Christopher Ferris82d75042015-01-26 10:57:07 -080016#define BPF_XADD 0xc0
17#define BPF_MOV 0xb0
Christopher Ferris82d75042015-01-26 10:57:07 -080018#define BPF_ARSH 0xc0
19#define BPF_END 0xd0
20#define BPF_TO_LE 0x00
21#define BPF_TO_BE 0x08
Christopher Ferris82d75042015-01-26 10:57:07 -080022#define BPF_FROM_LE BPF_TO_LE
23#define BPF_FROM_BE BPF_TO_BE
24#define BPF_JNE 0x50
Christopher Ferris1308ad32017-11-14 17:32:13 -080025#define BPF_JLT 0xa0
26#define BPF_JLE 0xb0
Christopher Ferris82d75042015-01-26 10:57:07 -080027#define BPF_JSGT 0x60
Christopher Ferris82d75042015-01-26 10:57:07 -080028#define BPF_JSGE 0x70
Christopher Ferris1308ad32017-11-14 17:32:13 -080029#define BPF_JSLT 0xc0
30#define BPF_JSLE 0xd0
Christopher Ferris7f4c8372024-06-03 14:22:19 -070031#define BPF_JCOND 0xe0
Christopher Ferris82d75042015-01-26 10:57:07 -080032#define BPF_CALL 0x80
33#define BPF_EXIT 0x90
Christopher Ferrisa9750ed2021-05-03 14:02:49 -070034#define BPF_FETCH 0x01
35#define BPF_XCHG (0xe0 | BPF_FETCH)
36#define BPF_CMPXCHG (0xf0 | BPF_FETCH)
Christopher Ferris7f4c8372024-06-03 14:22:19 -070037enum bpf_cond_pseudo_jmp {
38 BPF_MAY_GOTO = 0,
39};
Christopher Ferris82d75042015-01-26 10:57:07 -080040enum {
Tao Baod7db5942015-01-28 10:07:51 -080041 BPF_REG_0 = 0,
42 BPF_REG_1,
43 BPF_REG_2,
44 BPF_REG_3,
Tao Baod7db5942015-01-28 10:07:51 -080045 BPF_REG_4,
46 BPF_REG_5,
47 BPF_REG_6,
48 BPF_REG_7,
Tao Baod7db5942015-01-28 10:07:51 -080049 BPF_REG_8,
50 BPF_REG_9,
51 BPF_REG_10,
52 __MAX_BPF_REG,
Christopher Ferris82d75042015-01-26 10:57:07 -080053};
54#define MAX_BPF_REG __MAX_BPF_REG
55struct bpf_insn {
Tao Baod7db5942015-01-28 10:07:51 -080056 __u8 code;
Tao Baod7db5942015-01-28 10:07:51 -080057 __u8 dst_reg : 4;
58 __u8 src_reg : 4;
59 __s16 off;
60 __s32 imm;
Christopher Ferris82d75042015-01-26 10:57:07 -080061};
Christopher Ferris525ce912017-07-26 13:12:53 -070062struct bpf_lpm_trie_key {
63 __u32 prefixlen;
64 __u8 data[0];
65};
Christopher Ferris7f4c8372024-06-03 14:22:19 -070066struct bpf_lpm_trie_key_hdr {
67 __u32 prefixlen;
68};
69struct bpf_lpm_trie_key_u8 {
70 union {
71 struct bpf_lpm_trie_key_hdr hdr;
72 __u32 prefixlen;
73 };
74 __u8 data[];
75};
Christopher Ferris9ce28842018-10-25 12:11:39 -070076struct bpf_cgroup_storage_key {
77 __u64 cgroup_inode_id;
78 __u32 attach_type;
79};
Christopher Ferris6cd53a52022-12-12 23:39:16 +000080enum bpf_cgroup_iter_order {
81 BPF_CGROUP_ITER_ORDER_UNSPEC = 0,
82 BPF_CGROUP_ITER_SELF_ONLY,
83 BPF_CGROUP_ITER_DESCENDANTS_PRE,
84 BPF_CGROUP_ITER_DESCENDANTS_POST,
85 BPF_CGROUP_ITER_ANCESTORS_UP,
86};
Christopher Ferris25c18d42020-10-14 17:42:58 -070087union bpf_iter_link_info {
88 struct {
89 __u32 map_fd;
90 } map;
Christopher Ferris6cd53a52022-12-12 23:39:16 +000091 struct {
92 enum bpf_cgroup_iter_order order;
93 __u32 cgroup_fd;
94 __u64 cgroup_id;
95 } cgroup;
96 struct {
97 __u32 tid;
98 __u32 pid;
99 __u32 pid_fd;
100 } task;
Christopher Ferris25c18d42020-10-14 17:42:58 -0700101};
Christopher Ferris82d75042015-01-26 10:57:07 -0800102enum bpf_cmd {
Tao Baod7db5942015-01-28 10:07:51 -0800103 BPF_MAP_CREATE,
104 BPF_MAP_LOOKUP_ELEM,
Tao Baod7db5942015-01-28 10:07:51 -0800105 BPF_MAP_UPDATE_ELEM,
106 BPF_MAP_DELETE_ELEM,
107 BPF_MAP_GET_NEXT_KEY,
108 BPF_PROG_LOAD,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800109 BPF_OBJ_PIN,
110 BPF_OBJ_GET,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800111 BPF_PROG_ATTACH,
112 BPF_PROG_DETACH,
Christopher Ferris525ce912017-07-26 13:12:53 -0700113 BPF_PROG_TEST_RUN,
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000114 BPF_PROG_RUN = BPF_PROG_TEST_RUN,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800115 BPF_PROG_GET_NEXT_ID,
116 BPF_MAP_GET_NEXT_ID,
117 BPF_PROG_GET_FD_BY_ID,
118 BPF_MAP_GET_FD_BY_ID,
119 BPF_OBJ_GET_INFO_BY_FD,
Christopher Ferris934ec942018-01-31 15:29:16 -0800120 BPF_PROG_QUERY,
Christopher Ferris76a1d452018-06-27 14:12:29 -0700121 BPF_RAW_TRACEPOINT_OPEN,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700122 BPF_BTF_LOAD,
123 BPF_BTF_GET_FD_BY_ID,
124 BPF_TASK_FD_QUERY,
Christopher Ferris86a48372019-01-10 14:14:59 -0800125 BPF_MAP_LOOKUP_AND_DELETE_ELEM,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700126 BPF_MAP_FREEZE,
Christopher Ferris9584fa42019-12-09 15:36:13 -0800127 BPF_BTF_GET_NEXT_ID,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700128 BPF_MAP_LOOKUP_BATCH,
129 BPF_MAP_LOOKUP_AND_DELETE_BATCH,
130 BPF_MAP_UPDATE_BATCH,
131 BPF_MAP_DELETE_BATCH,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700132 BPF_LINK_CREATE,
133 BPF_LINK_UPDATE,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700134 BPF_LINK_GET_FD_BY_ID,
135 BPF_LINK_GET_NEXT_ID,
136 BPF_ENABLE_STATS,
137 BPF_ITER_CREATE,
Christopher Ferris25c18d42020-10-14 17:42:58 -0700138 BPF_LINK_DETACH,
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800139 BPF_PROG_BIND_MAP,
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700140 BPF_TOKEN_CREATE,
141 __MAX_BPF_CMD,
Christopher Ferris82d75042015-01-26 10:57:07 -0800142};
143enum bpf_map_type {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800144 BPF_MAP_TYPE_UNSPEC,
145 BPF_MAP_TYPE_HASH,
146 BPF_MAP_TYPE_ARRAY,
147 BPF_MAP_TYPE_PROG_ARRAY,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800148 BPF_MAP_TYPE_PERF_EVENT_ARRAY,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700149 BPF_MAP_TYPE_PERCPU_HASH,
150 BPF_MAP_TYPE_PERCPU_ARRAY,
151 BPF_MAP_TYPE_STACK_TRACE,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800152 BPF_MAP_TYPE_CGROUP_ARRAY,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800153 BPF_MAP_TYPE_LRU_HASH,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800154 BPF_MAP_TYPE_LRU_PERCPU_HASH,
Christopher Ferris525ce912017-07-26 13:12:53 -0700155 BPF_MAP_TYPE_LPM_TRIE,
156 BPF_MAP_TYPE_ARRAY_OF_MAPS,
157 BPF_MAP_TYPE_HASH_OF_MAPS,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800158 BPF_MAP_TYPE_DEVMAP,
159 BPF_MAP_TYPE_SOCKMAP,
Christopher Ferris934ec942018-01-31 15:29:16 -0800160 BPF_MAP_TYPE_CPUMAP,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700161 BPF_MAP_TYPE_XSKMAP,
162 BPF_MAP_TYPE_SOCKHASH,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800163 BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
164 BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700165 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
Christopher Ferris0f795212024-01-17 14:17:28 -0800166 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE_DEPRECATED,
167 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE_DEPRECATED,
Christopher Ferris86a48372019-01-10 14:14:59 -0800168 BPF_MAP_TYPE_QUEUE,
169 BPF_MAP_TYPE_STACK,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700170 BPF_MAP_TYPE_SK_STORAGE,
Christopher Ferris9584fa42019-12-09 15:36:13 -0800171 BPF_MAP_TYPE_DEVMAP_HASH,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700172 BPF_MAP_TYPE_STRUCT_OPS,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700173 BPF_MAP_TYPE_RINGBUF,
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800174 BPF_MAP_TYPE_INODE_STORAGE,
Christopher Ferris05667cd2021-02-16 16:01:34 -0800175 BPF_MAP_TYPE_TASK_STORAGE,
Christopher Ferrisa4792612022-01-10 13:51:15 -0800176 BPF_MAP_TYPE_BLOOM_FILTER,
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000177 BPF_MAP_TYPE_USER_RINGBUF,
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800178 BPF_MAP_TYPE_CGRP_STORAGE,
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700179 BPF_MAP_TYPE_ARENA,
180 __MAX_BPF_MAP_TYPE
Christopher Ferris05d08e92016-02-04 13:16:38 -0800181};
Christopher Ferris82d75042015-01-26 10:57:07 -0800182enum bpf_prog_type {
Tao Baod7db5942015-01-28 10:07:51 -0800183 BPF_PROG_TYPE_UNSPEC,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800184 BPF_PROG_TYPE_SOCKET_FILTER,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800185 BPF_PROG_TYPE_KPROBE,
186 BPF_PROG_TYPE_SCHED_CLS,
187 BPF_PROG_TYPE_SCHED_ACT,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800188 BPF_PROG_TYPE_TRACEPOINT,
189 BPF_PROG_TYPE_XDP,
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800190 BPF_PROG_TYPE_PERF_EVENT,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800191 BPF_PROG_TYPE_CGROUP_SKB,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800192 BPF_PROG_TYPE_CGROUP_SOCK,
193 BPF_PROG_TYPE_LWT_IN,
194 BPF_PROG_TYPE_LWT_OUT,
195 BPF_PROG_TYPE_LWT_XMIT,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800196 BPF_PROG_TYPE_SOCK_OPS,
197 BPF_PROG_TYPE_SK_SKB,
Christopher Ferris934ec942018-01-31 15:29:16 -0800198 BPF_PROG_TYPE_CGROUP_DEVICE,
Christopher Ferris76a1d452018-06-27 14:12:29 -0700199 BPF_PROG_TYPE_SK_MSG,
200 BPF_PROG_TYPE_RAW_TRACEPOINT,
201 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700202 BPF_PROG_TYPE_LWT_SEG6LOCAL,
203 BPF_PROG_TYPE_LIRC_MODE2,
204 BPF_PROG_TYPE_SK_REUSEPORT,
Christopher Ferris86a48372019-01-10 14:14:59 -0800205 BPF_PROG_TYPE_FLOW_DISSECTOR,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700206 BPF_PROG_TYPE_CGROUP_SYSCTL,
207 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700208 BPF_PROG_TYPE_CGROUP_SOCKOPT,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800209 BPF_PROG_TYPE_TRACING,
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700210 BPF_PROG_TYPE_STRUCT_OPS,
211 BPF_PROG_TYPE_EXT,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700212 BPF_PROG_TYPE_LSM,
Christopher Ferris25c18d42020-10-14 17:42:58 -0700213 BPF_PROG_TYPE_SK_LOOKUP,
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000214 BPF_PROG_TYPE_SYSCALL,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700215 BPF_PROG_TYPE_NETFILTER,
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700216 __MAX_BPF_PROG_TYPE
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800217};
218enum bpf_attach_type {
219 BPF_CGROUP_INET_INGRESS,
220 BPF_CGROUP_INET_EGRESS,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800221 BPF_CGROUP_INET_SOCK_CREATE,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800222 BPF_CGROUP_SOCK_OPS,
223 BPF_SK_SKB_STREAM_PARSER,
224 BPF_SK_SKB_STREAM_VERDICT,
Christopher Ferris934ec942018-01-31 15:29:16 -0800225 BPF_CGROUP_DEVICE,
Christopher Ferris76a1d452018-06-27 14:12:29 -0700226 BPF_SK_MSG_VERDICT,
227 BPF_CGROUP_INET4_BIND,
228 BPF_CGROUP_INET6_BIND,
229 BPF_CGROUP_INET4_CONNECT,
230 BPF_CGROUP_INET6_CONNECT,
231 BPF_CGROUP_INET4_POST_BIND,
232 BPF_CGROUP_INET6_POST_BIND,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700233 BPF_CGROUP_UDP4_SENDMSG,
234 BPF_CGROUP_UDP6_SENDMSG,
235 BPF_LIRC_MODE2,
Christopher Ferris86a48372019-01-10 14:14:59 -0800236 BPF_FLOW_DISSECTOR,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700237 BPF_CGROUP_SYSCTL,
238 BPF_CGROUP_UDP4_RECVMSG,
239 BPF_CGROUP_UDP6_RECVMSG,
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700240 BPF_CGROUP_GETSOCKOPT,
241 BPF_CGROUP_SETSOCKOPT,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800242 BPF_TRACE_RAW_TP,
243 BPF_TRACE_FENTRY,
244 BPF_TRACE_FEXIT,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700245 BPF_MODIFY_RETURN,
246 BPF_LSM_MAC,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700247 BPF_TRACE_ITER,
248 BPF_CGROUP_INET4_GETPEERNAME,
249 BPF_CGROUP_INET6_GETPEERNAME,
250 BPF_CGROUP_INET4_GETSOCKNAME,
251 BPF_CGROUP_INET6_GETSOCKNAME,
252 BPF_XDP_DEVMAP,
Christopher Ferris25c18d42020-10-14 17:42:58 -0700253 BPF_CGROUP_INET_SOCK_RELEASE,
254 BPF_XDP_CPUMAP,
255 BPF_SK_LOOKUP,
256 BPF_XDP,
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000257 BPF_SK_SKB_VERDICT,
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000258 BPF_SK_REUSEPORT_SELECT,
259 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700260 BPF_PERF_EVENT,
Christopher Ferris10a76e62022-06-08 13:31:52 -0700261 BPF_TRACE_KPROBE_MULTI,
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700262 BPF_LSM_CGROUP,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700263 BPF_STRUCT_OPS,
264 BPF_NETFILTER,
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700265 BPF_TCX_INGRESS,
266 BPF_TCX_EGRESS,
267 BPF_TRACE_UPROBE_MULTI,
Christopher Ferris0f795212024-01-17 14:17:28 -0800268 BPF_CGROUP_UNIX_CONNECT,
269 BPF_CGROUP_UNIX_SENDMSG,
270 BPF_CGROUP_UNIX_RECVMSG,
271 BPF_CGROUP_UNIX_GETPEERNAME,
272 BPF_CGROUP_UNIX_GETSOCKNAME,
273 BPF_NETKIT_PRIMARY,
274 BPF_NETKIT_PEER,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800275 __MAX_BPF_ATTACH_TYPE
276};
277#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700278enum bpf_link_type {
279 BPF_LINK_TYPE_UNSPEC = 0,
280 BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
281 BPF_LINK_TYPE_TRACING = 2,
282 BPF_LINK_TYPE_CGROUP = 3,
283 BPF_LINK_TYPE_ITER = 4,
284 BPF_LINK_TYPE_NETNS = 5,
Christopher Ferris25c18d42020-10-14 17:42:58 -0700285 BPF_LINK_TYPE_XDP = 6,
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700286 BPF_LINK_TYPE_PERF_EVENT = 7,
Christopher Ferris10a76e62022-06-08 13:31:52 -0700287 BPF_LINK_TYPE_KPROBE_MULTI = 8,
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700288 BPF_LINK_TYPE_STRUCT_OPS = 9,
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700289 BPF_LINK_TYPE_NETFILTER = 10,
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700290 BPF_LINK_TYPE_TCX = 11,
291 BPF_LINK_TYPE_UPROBE_MULTI = 12,
Christopher Ferris0f795212024-01-17 14:17:28 -0800292 BPF_LINK_TYPE_NETKIT = 13,
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700293 __MAX_BPF_LINK_TYPE,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700294};
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700295#define MAX_BPF_LINK_TYPE __MAX_BPF_LINK_TYPE
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700296enum bpf_perf_event_type {
297 BPF_PERF_EVENT_UNSPEC = 0,
298 BPF_PERF_EVENT_UPROBE = 1,
299 BPF_PERF_EVENT_URETPROBE = 2,
300 BPF_PERF_EVENT_KPROBE = 3,
301 BPF_PERF_EVENT_KRETPROBE = 4,
302 BPF_PERF_EVENT_TRACEPOINT = 5,
303 BPF_PERF_EVENT_EVENT = 6,
304};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800305#define BPF_F_ALLOW_OVERRIDE (1U << 0)
Christopher Ferris934ec942018-01-31 15:29:16 -0800306#define BPF_F_ALLOW_MULTI (1U << 1)
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700307#define BPF_F_REPLACE (1U << 2)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700308#define BPF_F_BEFORE (1U << 3)
309#define BPF_F_AFTER (1U << 4)
310#define BPF_F_ID (1U << 5)
311#define BPF_F_LINK BPF_F_LINK
Christopher Ferris525ce912017-07-26 13:12:53 -0700312#define BPF_F_STRICT_ALIGNMENT (1U << 0)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800313#define BPF_F_ANY_ALIGNMENT (1U << 1)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700314#define BPF_F_TEST_RND_HI32 (1U << 2)
Christopher Ferris9584fa42019-12-09 15:36:13 -0800315#define BPF_F_TEST_STATE_FREQ (1U << 3)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800316#define BPF_F_SLEEPABLE (1U << 4)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700317#define BPF_F_XDP_HAS_FRAGS (1U << 5)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000318#define BPF_F_XDP_DEV_BOUND_ONLY (1U << 6)
Christopher Ferrisb830ddf2024-03-28 11:48:08 -0700319#define BPF_F_TEST_REG_INVARIANTS (1U << 7)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700320enum {
321 BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
322};
323enum {
324 BPF_F_UPROBE_MULTI_RETURN = (1U << 0)
325};
326#define BPF_F_NETFILTER_IP_DEFRAG (1U << 0)
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800327#define BPF_PSEUDO_MAP_FD 1
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000328#define BPF_PSEUDO_MAP_IDX 5
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700329#define BPF_PSEUDO_MAP_VALUE 2
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000330#define BPF_PSEUDO_MAP_IDX_VALUE 6
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800331#define BPF_PSEUDO_BTF_ID 3
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000332#define BPF_PSEUDO_FUNC 4
Christopher Ferris76a1d452018-06-27 14:12:29 -0700333#define BPF_PSEUDO_CALL 1
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000334#define BPF_PSEUDO_KFUNC_CALL 2
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700335enum bpf_addr_space_cast {
336 BPF_ADDR_SPACE_CAST = 1,
337};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700338enum {
339 BPF_ANY = 0,
340 BPF_NOEXIST = 1,
341 BPF_EXIST = 2,
342 BPF_F_LOCK = 4,
343};
344enum {
345 BPF_F_NO_PREALLOC = (1U << 0),
346 BPF_F_NO_COMMON_LRU = (1U << 1),
347 BPF_F_NUMA_NODE = (1U << 2),
348 BPF_F_RDONLY = (1U << 3),
349 BPF_F_WRONLY = (1U << 4),
350 BPF_F_STACK_BUILD_ID = (1U << 5),
351 BPF_F_ZERO_SEED = (1U << 6),
352 BPF_F_RDONLY_PROG = (1U << 7),
353 BPF_F_WRONLY_PROG = (1U << 8),
354 BPF_F_CLONE = (1U << 9),
355 BPF_F_MMAPABLE = (1U << 10),
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800356 BPF_F_PRESERVE_ELEMS = (1U << 11),
357 BPF_F_INNER_MAP = (1U << 12),
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700358 BPF_F_LINK = (1U << 13),
Christopher Ferris8666d042023-09-06 14:55:31 -0700359 BPF_F_PATH_FD = (1U << 14),
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700360 BPF_F_VTYPE_BTF_OBJ_FD = (1U << 15),
361 BPF_F_TOKEN_FD = (1U << 16),
362 BPF_F_SEGV_ON_FAULT = (1U << 17),
363 BPF_F_NO_USER_CONV = (1U << 18),
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700364};
Christopher Ferrisd842e432019-03-07 10:21:59 -0800365#define BPF_F_QUERY_EFFECTIVE (1U << 0)
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800366#define BPF_F_TEST_RUN_ON_CPU (1U << 0)
Christopher Ferris10a76e62022-06-08 13:31:52 -0700367#define BPF_F_TEST_XDP_LIVE_FRAMES (1U << 1)
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700368enum bpf_stats_type {
369 BPF_STATS_RUN_TIME = 0,
370};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700371enum bpf_stack_build_id_status {
372 BPF_STACK_BUILD_ID_EMPTY = 0,
373 BPF_STACK_BUILD_ID_VALID = 1,
374 BPF_STACK_BUILD_ID_IP = 2,
375};
376#define BPF_BUILD_ID_SIZE 20
377struct bpf_stack_build_id {
378 __s32 status;
379 unsigned char build_id[BPF_BUILD_ID_SIZE];
380 union {
381 __u64 offset;
382 __u64 ip;
383 };
384};
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700385#define BPF_OBJ_NAME_LEN 16U
Christopher Ferris05d08e92016-02-04 13:16:38 -0800386union bpf_attr {
Tao Baod7db5942015-01-28 10:07:51 -0800387 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700388 __u32 map_type;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800389 __u32 key_size;
Tao Baod7db5942015-01-28 10:07:51 -0800390 __u32 value_size;
Tao Baod7db5942015-01-28 10:07:51 -0800391 __u32 max_entries;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700392 __u32 map_flags;
Christopher Ferris525ce912017-07-26 13:12:53 -0700393 __u32 inner_map_fd;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800394 __u32 numa_node;
Christopher Ferris934ec942018-01-31 15:29:16 -0800395 char map_name[BPF_OBJ_NAME_LEN];
Christopher Ferris76a1d452018-06-27 14:12:29 -0700396 __u32 map_ifindex;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700397 __u32 btf_fd;
398 __u32 btf_key_type_id;
399 __u32 btf_value_type_id;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700400 __u32 btf_vmlinux_value_type_id;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800401 __u64 map_extra;
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700402 __s32 value_type_btf_obj_fd;
403 __s32 map_token_fd;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800404 };
Tao Baod7db5942015-01-28 10:07:51 -0800405 struct {
406 __u32 map_fd;
Tao Baod7db5942015-01-28 10:07:51 -0800407 __aligned_u64 key;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800408 union {
Tao Baod7db5942015-01-28 10:07:51 -0800409 __aligned_u64 value;
410 __aligned_u64 next_key;
Tao Baod7db5942015-01-28 10:07:51 -0800411 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800412 __u64 flags;
Tao Baod7db5942015-01-28 10:07:51 -0800413 };
414 struct {
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700415 __aligned_u64 in_batch;
416 __aligned_u64 out_batch;
417 __aligned_u64 keys;
418 __aligned_u64 values;
419 __u32 count;
420 __u32 map_fd;
421 __u64 elem_flags;
422 __u64 flags;
423 } batch;
424 struct {
Tao Baod7db5942015-01-28 10:07:51 -0800425 __u32 prog_type;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800426 __u32 insn_cnt;
Tao Baod7db5942015-01-28 10:07:51 -0800427 __aligned_u64 insns;
428 __aligned_u64 license;
429 __u32 log_level;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800430 __u32 log_size;
Tao Baod7db5942015-01-28 10:07:51 -0800431 __aligned_u64 log_buf;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800432 __u32 kern_version;
Christopher Ferris525ce912017-07-26 13:12:53 -0700433 __u32 prog_flags;
Christopher Ferris934ec942018-01-31 15:29:16 -0800434 char prog_name[BPF_OBJ_NAME_LEN];
435 __u32 prog_ifindex;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700436 __u32 expected_attach_type;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800437 __u32 prog_btf_fd;
438 __u32 func_info_rec_size;
439 __aligned_u64 func_info;
440 __u32 func_info_cnt;
441 __u32 line_info_rec_size;
442 __aligned_u64 line_info;
443 __u32 line_info_cnt;
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800444 __u32 attach_btf_id;
Christopher Ferris05667cd2021-02-16 16:01:34 -0800445 union {
446 __u32 attach_prog_fd;
447 __u32 attach_btf_obj_fd;
448 };
Christopher Ferris1ed55342022-03-22 16:06:25 -0700449 __u32 core_relo_cnt;
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000450 __aligned_u64 fd_array;
Christopher Ferris1ed55342022-03-22 16:06:25 -0700451 __aligned_u64 core_relos;
452 __u32 core_relo_rec_size;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700453 __u32 log_true_size;
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700454 __s32 prog_token_fd;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800455 };
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800456 struct {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800457 __aligned_u64 pathname;
458 __u32 bpf_fd;
Christopher Ferris934ec942018-01-31 15:29:16 -0800459 __u32 file_flags;
Christopher Ferris8666d042023-09-06 14:55:31 -0700460 __s32 path_fd;
Tao Baod7db5942015-01-28 10:07:51 -0800461 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800462 struct {
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700463 union {
464 __u32 target_fd;
465 __u32 target_ifindex;
466 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800467 __u32 attach_bpf_fd;
468 __u32 attach_type;
469 __u32 attach_flags;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -0700470 __u32 replace_bpf_fd;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700471 union {
472 __u32 relative_fd;
473 __u32 relative_id;
474 };
475 __u64 expected_revision;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800476 };
Christopher Ferris525ce912017-07-26 13:12:53 -0700477 struct {
478 __u32 prog_fd;
479 __u32 retval;
480 __u32 data_size_in;
481 __u32 data_size_out;
482 __aligned_u64 data_in;
483 __aligned_u64 data_out;
484 __u32 repeat;
485 __u32 duration;
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700486 __u32 ctx_size_in;
487 __u32 ctx_size_out;
488 __aligned_u64 ctx_in;
489 __aligned_u64 ctx_out;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800490 __u32 flags;
491 __u32 cpu;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700492 __u32 batch_size;
Christopher Ferris525ce912017-07-26 13:12:53 -0700493 } test;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800494 struct {
495 union {
496 __u32 start_id;
497 __u32 prog_id;
498 __u32 map_id;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700499 __u32 btf_id;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700500 __u32 link_id;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800501 };
502 __u32 next_id;
Christopher Ferris934ec942018-01-31 15:29:16 -0800503 __u32 open_flags;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800504 };
505 struct {
506 __u32 bpf_fd;
507 __u32 info_len;
508 __aligned_u64 info;
509 } info;
Christopher Ferris934ec942018-01-31 15:29:16 -0800510 struct {
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700511 union {
512 __u32 target_fd;
513 __u32 target_ifindex;
514 };
Christopher Ferris934ec942018-01-31 15:29:16 -0800515 __u32 attach_type;
516 __u32 query_flags;
517 __u32 attach_flags;
518 __aligned_u64 prog_ids;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700519 union {
520 __u32 prog_cnt;
521 __u32 count;
522 };
523 __u32 : 32;
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700524 __aligned_u64 prog_attach_flags;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700525 __aligned_u64 link_ids;
526 __aligned_u64 link_attach_flags;
527 __u64 revision;
Christopher Ferris934ec942018-01-31 15:29:16 -0800528 } query;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700529 struct {
530 __u64 name;
531 __u32 prog_fd;
532 } raw_tracepoint;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700533 struct {
534 __aligned_u64 btf;
535 __aligned_u64 btf_log_buf;
536 __u32 btf_size;
537 __u32 btf_log_size;
538 __u32 btf_log_level;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700539 __u32 btf_log_true_size;
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700540 __u32 btf_flags;
541 __s32 btf_token_fd;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700542 };
543 struct {
544 __u32 pid;
545 __u32 fd;
546 __u32 flags;
547 __u32 buf_len;
548 __aligned_u64 buf;
549 __u32 prog_id;
550 __u32 fd_type;
551 __u64 probe_offset;
552 __u64 probe_addr;
553 } task_fd_query;
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700554 struct {
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700555 union {
556 __u32 prog_fd;
557 __u32 map_fd;
558 };
Christopher Ferris25c18d42020-10-14 17:42:58 -0700559 union {
560 __u32 target_fd;
561 __u32 target_ifindex;
562 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700563 __u32 attach_type;
564 __u32 flags;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800565 union {
566 __u32 target_btf_id;
567 struct {
568 __aligned_u64 iter_info;
569 __u32 iter_info_len;
570 };
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700571 struct {
572 __u64 bpf_cookie;
573 } perf_event;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700574 struct {
575 __u32 flags;
576 __u32 cnt;
577 __aligned_u64 syms;
578 __aligned_u64 addrs;
579 __aligned_u64 cookies;
580 } kprobe_multi;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700581 struct {
582 __u32 target_btf_id;
583 __u64 cookie;
584 } tracing;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700585 struct {
586 __u32 pf;
587 __u32 hooknum;
588 __s32 priority;
589 __u32 flags;
590 } netfilter;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700591 struct {
592 union {
593 __u32 relative_fd;
594 __u32 relative_id;
595 };
596 __u64 expected_revision;
597 } tcx;
598 struct {
599 __aligned_u64 path;
600 __aligned_u64 offsets;
601 __aligned_u64 ref_ctr_offsets;
602 __aligned_u64 cookies;
603 __u32 cnt;
604 __u32 flags;
605 __u32 pid;
606 } uprobe_multi;
Christopher Ferris0f795212024-01-17 14:17:28 -0800607 struct {
608 union {
609 __u32 relative_fd;
610 __u32 relative_id;
611 };
612 __u64 expected_revision;
613 } netkit;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800614 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700615 } link_create;
616 struct {
617 __u32 link_fd;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700618 union {
619 __u32 new_prog_fd;
620 __u32 new_map_fd;
621 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700622 __u32 flags;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700623 union {
624 __u32 old_prog_fd;
625 __u32 old_map_fd;
626 };
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700627 } link_update;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700628 struct {
Christopher Ferris25c18d42020-10-14 17:42:58 -0700629 __u32 link_fd;
630 } link_detach;
631 struct {
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700632 __u32 type;
633 } enable_stats;
634 struct {
635 __u32 link_fd;
636 __u32 flags;
637 } iter_create;
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800638 struct {
639 __u32 prog_fd;
640 __u32 map_fd;
641 __u32 flags;
642 } prog_bind_map;
Christopher Ferris7f4c8372024-06-03 14:22:19 -0700643 struct {
644 __u32 flags;
645 __u32 bpffs_fd;
646 } token_create;
Christopher Ferris6a9755d2017-01-13 14:09:31 -0800647} __attribute__((aligned(8)));
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800648#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)
649#define __BPF_FUNC_MAPPER_APPLY(name,value,FN) FN(name),
650#define __BPF_FUNC_MAPPER(FN) ___BPF_FUNC_MAPPER(__BPF_FUNC_MAPPER_APPLY, FN)
651#define __BPF_ENUM_FN(x,y) BPF_FUNC_ ##x = y,
Christopher Ferris82d75042015-01-26 10:57:07 -0800652enum bpf_func_id {
Christopher Ferris8b7fdc92023-02-21 13:36:32 -0800653 ___BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800654};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800655#undef __BPF_ENUM_FN
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700656enum {
657 BPF_F_RECOMPUTE_CSUM = (1ULL << 0),
658 BPF_F_INVALIDATE_HASH = (1ULL << 1),
659};
660enum {
661 BPF_F_HDR_FIELD_MASK = 0xfULL,
662};
663enum {
664 BPF_F_PSEUDO_HDR = (1ULL << 4),
665 BPF_F_MARK_MANGLED_0 = (1ULL << 5),
666 BPF_F_MARK_ENFORCE = (1ULL << 6),
667};
668enum {
669 BPF_F_INGRESS = (1ULL << 0),
670};
671enum {
672 BPF_F_TUNINFO_IPV6 = (1ULL << 0),
673};
674enum {
675 BPF_F_SKIP_FIELD_MASK = 0xffULL,
676 BPF_F_USER_STACK = (1ULL << 8),
677 BPF_F_FAST_STACK_CMP = (1ULL << 9),
678 BPF_F_REUSE_STACKID = (1ULL << 10),
679 BPF_F_USER_BUILD_ID = (1ULL << 11),
680};
681enum {
682 BPF_F_ZERO_CSUM_TX = (1ULL << 1),
683 BPF_F_DONT_FRAGMENT = (1ULL << 2),
684 BPF_F_SEQ_NUMBER = (1ULL << 3),
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000685 BPF_F_NO_TUNNEL_KEY = (1ULL << 4),
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700686};
687enum {
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000688 BPF_F_TUNINFO_FLAGS = (1ULL << 4),
689};
690enum {
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700691 BPF_F_INDEX_MASK = 0xffffffffULL,
692 BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK,
693 BPF_F_CTXLEN_MASK = (0xfffffULL << 32),
694};
695enum {
696 BPF_F_CURRENT_NETNS = (- 1L),
697};
698enum {
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700699 BPF_CSUM_LEVEL_QUERY,
700 BPF_CSUM_LEVEL_INC,
701 BPF_CSUM_LEVEL_DEC,
702 BPF_CSUM_LEVEL_RESET,
703};
704enum {
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700705 BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0),
706 BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1),
707 BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2),
708 BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3),
709 BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4),
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700710 BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5),
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000711 BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6),
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000712 BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7),
713 BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8),
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700714};
715enum {
716 BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff,
717 BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56,
718};
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700719#define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64) len & BPF_ADJ_ROOM_ENCAP_L2_MASK) << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700720enum {
721 BPF_F_SYSCTL_BASE_NAME = (1ULL << 0),
722};
723enum {
Christopher Ferris32ff3f82020-12-14 13:10:04 -0800724 BPF_LOCAL_STORAGE_GET_F_CREATE = (1ULL << 0),
725 BPF_SK_STORAGE_GET_F_CREATE = BPF_LOCAL_STORAGE_GET_F_CREATE,
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700726};
727enum {
728 BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0),
729};
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700730enum {
731 BPF_RB_NO_WAKEUP = (1ULL << 0),
732 BPF_RB_FORCE_WAKEUP = (1ULL << 1),
733};
734enum {
735 BPF_RB_AVAIL_DATA = 0,
736 BPF_RB_RING_SIZE = 1,
737 BPF_RB_CONS_POS = 2,
738 BPF_RB_PROD_POS = 3,
739};
740enum {
741 BPF_RINGBUF_BUSY_BIT = (1U << 31),
742 BPF_RINGBUF_DISCARD_BIT = (1U << 30),
743 BPF_RINGBUF_HDR_SZ = 8,
744};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700745enum {
746 BPF_SK_LOOKUP_F_REPLACE = (1ULL << 0),
747 BPF_SK_LOOKUP_F_NO_REUSEPORT = (1ULL << 1),
748};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800749enum bpf_adj_room_mode {
750 BPF_ADJ_ROOM_NET,
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -0700751 BPF_ADJ_ROOM_MAC,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800752};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700753enum bpf_hdr_start_off {
754 BPF_HDR_START_MAC,
755 BPF_HDR_START_NET,
756};
757enum bpf_lwt_encap_mode {
758 BPF_LWT_ENCAP_SEG6,
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700759 BPF_LWT_ENCAP_SEG6_INLINE,
760 BPF_LWT_ENCAP_IP,
Christopher Ferris9ce28842018-10-25 12:11:39 -0700761};
Christopher Ferris05667cd2021-02-16 16:01:34 -0800762enum {
763 BPF_F_BPRM_SECUREEXEC = (1ULL << 0),
764};
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000765enum {
766 BPF_F_BROADCAST = (1ULL << 3),
767 BPF_F_EXCLUDE_INGRESS = (1ULL << 4),
768};
Christopher Ferris86a48372019-01-10 14:14:59 -0800769#define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \
770} __attribute__((aligned(8)))
Christopher Ferris10a76e62022-06-08 13:31:52 -0700771enum {
772 BPF_SKB_TSTAMP_UNSPEC,
773 BPF_SKB_TSTAMP_DELIVERY_MONO,
774};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800775struct __sk_buff {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800776 __u32 len;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800777 __u32 pkt_type;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800778 __u32 mark;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800779 __u32 queue_mapping;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800780 __u32 protocol;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800781 __u32 vlan_present;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800782 __u32 vlan_tci;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800783 __u32 vlan_proto;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800784 __u32 priority;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800785 __u32 ingress_ifindex;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800786 __u32 ifindex;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800787 __u32 tc_index;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800788 __u32 cb[5];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800789 __u32 hash;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800790 __u32 tc_classid;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800791 __u32 data;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800792 __u32 data_end;
Christopher Ferris525ce912017-07-26 13:12:53 -0700793 __u32 napi_id;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800794 __u32 family;
795 __u32 remote_ip4;
796 __u32 local_ip4;
797 __u32 remote_ip6[4];
798 __u32 local_ip6[4];
799 __u32 remote_port;
800 __u32 local_port;
Christopher Ferris934ec942018-01-31 15:29:16 -0800801 __u32 data_meta;
Christopher Ferris86a48372019-01-10 14:14:59 -0800802 __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
Christopher Ferrisd842e432019-03-07 10:21:59 -0800803 __u64 tstamp;
804 __u32 wire_len;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700805 __u32 gso_segs;
806 __bpf_md_ptr(struct bpf_sock *, sk);
Christopher Ferrisaf09c702020-06-01 20:29:29 -0700807 __u32 gso_size;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700808 __u8 tstamp_type;
809 __u32 : 24;
Christopher Ferrisa4792612022-01-10 13:51:15 -0800810 __u64 hwtstamp;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800811};
812struct bpf_tunnel_key {
Christopher Ferris49f525c2016-12-12 14:55:36 -0800813 __u32 tunnel_id;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800814 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700815 __u32 remote_ipv4;
816 __u32 remote_ipv6[4];
Christopher Ferris49f525c2016-12-12 14:55:36 -0800817 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800818 __u8 tunnel_tos;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700819 __u8 tunnel_ttl;
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000820 union {
821 __u16 tunnel_ext;
822 __be16 tunnel_flags;
823 };
Christopher Ferris49f525c2016-12-12 14:55:36 -0800824 __u32 tunnel_label;
Christopher Ferris80ae69d2022-08-02 16:32:21 -0700825 union {
826 __u32 local_ipv4;
827 __u32 local_ipv6[4];
828 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800829};
Christopher Ferris9ce28842018-10-25 12:11:39 -0700830struct bpf_xfrm_state {
831 __u32 reqid;
832 __u32 spi;
833 __u16 family;
834 __u16 ext;
835 union {
836 __u32 remote_ipv4;
837 __u32 remote_ipv6[4];
838 };
839};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800840enum bpf_ret_code {
841 BPF_OK = 0,
842 BPF_DROP = 2,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800843 BPF_REDIRECT = 7,
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700844 BPF_LWT_REROUTE = 128,
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000845 BPF_FLOW_DISSECTOR_CONTINUE = 129,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800846};
847struct bpf_sock {
848 __u32 bound_dev_if;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800849 __u32 family;
850 __u32 type;
851 __u32 protocol;
Christopher Ferris1308ad32017-11-14 17:32:13 -0800852 __u32 mark;
853 __u32 priority;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700854 __u32 src_ip4;
855 __u32 src_ip6[4];
856 __u32 src_port;
Christopher Ferris10a76e62022-06-08 13:31:52 -0700857 __be16 dst_port;
858 __u16 : 16;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700859 __u32 dst_ip4;
860 __u32 dst_ip6[4];
861 __u32 state;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700862 __s32 rx_queue_mapping;
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700863};
864struct bpf_tcp_sock {
865 __u32 snd_cwnd;
866 __u32 srtt_us;
867 __u32 rtt_min;
868 __u32 snd_ssthresh;
869 __u32 rcv_nxt;
870 __u32 snd_nxt;
871 __u32 snd_una;
872 __u32 mss_cache;
873 __u32 ecn_flags;
874 __u32 rate_delivered;
875 __u32 rate_interval_us;
876 __u32 packets_out;
877 __u32 retrans_out;
878 __u32 total_retrans;
879 __u32 segs_in;
880 __u32 data_segs_in;
881 __u32 segs_out;
882 __u32 data_segs_out;
883 __u32 lost_out;
884 __u32 sacked_out;
885 __u64 bytes_received;
886 __u64 bytes_acked;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700887 __u32 dsack_dups;
888 __u32 delivered;
889 __u32 delivered_ce;
890 __u32 icsk_retransmits;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800891};
Christopher Ferris86a48372019-01-10 14:14:59 -0800892struct bpf_sock_tuple {
893 union {
894 struct {
895 __be32 saddr;
896 __be32 daddr;
897 __be16 sport;
898 __be16 dport;
899 } ipv4;
900 struct {
901 __be32 saddr[4];
902 __be32 daddr[4];
903 __be16 sport;
904 __be16 dport;
905 } ipv6;
906 };
907};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700908enum tcx_action_base {
909 TCX_NEXT = - 1,
910 TCX_PASS = 0,
911 TCX_DROP = 2,
912 TCX_REDIRECT = 7,
913};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700914struct bpf_xdp_sock {
915 __u32 queue_id;
916};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800917#define XDP_PACKET_HEADROOM 256
Christopher Ferris49f525c2016-12-12 14:55:36 -0800918enum xdp_action {
919 XDP_ABORTED = 0,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800920 XDP_DROP,
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800921 XDP_PASS,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800922 XDP_TX,
Christopher Ferris1308ad32017-11-14 17:32:13 -0800923 XDP_REDIRECT,
Christopher Ferris49f525c2016-12-12 14:55:36 -0800924};
Christopher Ferris49f525c2016-12-12 14:55:36 -0800925struct xdp_md {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800926 __u32 data;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800927 __u32 data_end;
Christopher Ferris934ec942018-01-31 15:29:16 -0800928 __u32 data_meta;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700929 __u32 ingress_ifindex;
930 __u32 rx_queue_index;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700931 __u32 egress_ifindex;
932};
933struct bpf_devmap_val {
934 __u32 ifindex;
935 union {
936 int fd;
937 __u32 id;
938 } bpf_prog;
Christopher Ferris49f525c2016-12-12 14:55:36 -0800939};
Christopher Ferris25c18d42020-10-14 17:42:58 -0700940struct bpf_cpumap_val {
941 __u32 qsize;
942 union {
943 int fd;
944 __u32 id;
945 } bpf_prog;
946};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800947enum sk_action {
948 SK_DROP = 0,
949 SK_PASS,
950};
Christopher Ferris76a1d452018-06-27 14:12:29 -0700951struct sk_msg_md {
Christopher Ferris86a48372019-01-10 14:14:59 -0800952 __bpf_md_ptr(void *, data);
953 __bpf_md_ptr(void *, data_end);
Christopher Ferris9ce28842018-10-25 12:11:39 -0700954 __u32 family;
955 __u32 remote_ip4;
956 __u32 local_ip4;
957 __u32 remote_ip6[4];
958 __u32 local_ip6[4];
959 __u32 remote_port;
960 __u32 local_port;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800961 __u32 size;
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700962 __bpf_md_ptr(struct bpf_sock *, sk);
Christopher Ferris9ce28842018-10-25 12:11:39 -0700963};
964struct sk_reuseport_md {
Christopher Ferris86a48372019-01-10 14:14:59 -0800965 __bpf_md_ptr(void *, data);
966 __bpf_md_ptr(void *, data_end);
Christopher Ferris9ce28842018-10-25 12:11:39 -0700967 __u32 len;
968 __u32 eth_protocol;
969 __u32 ip_protocol;
970 __u32 bind_inany;
971 __u32 hash;
Christopher Ferris3a39c0b2021-09-02 00:03:38 +0000972 __bpf_md_ptr(struct bpf_sock *, sk);
973 __bpf_md_ptr(struct bpf_sock *, migrating_sk);
Christopher Ferris76a1d452018-06-27 14:12:29 -0700974};
Christopher Ferris1308ad32017-11-14 17:32:13 -0800975#define BPF_TAG_SIZE 8
976struct bpf_prog_info {
977 __u32 type;
978 __u32 id;
979 __u8 tag[BPF_TAG_SIZE];
980 __u32 jited_prog_len;
981 __u32 xlated_prog_len;
982 __aligned_u64 jited_prog_insns;
983 __aligned_u64 xlated_prog_insns;
Christopher Ferris934ec942018-01-31 15:29:16 -0800984 __u64 load_time;
985 __u32 created_by_uid;
986 __u32 nr_map_ids;
987 __aligned_u64 map_ids;
988 char name[BPF_OBJ_NAME_LEN];
Christopher Ferris76a1d452018-06-27 14:12:29 -0700989 __u32 ifindex;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700990 __u32 gpl_compatible : 1;
Christopher Ferrisfa59a102019-08-05 12:58:49 -0700991 __u32 : 31;
Christopher Ferris76a1d452018-06-27 14:12:29 -0700992 __u64 netns_dev;
993 __u64 netns_ino;
Christopher Ferris9ce28842018-10-25 12:11:39 -0700994 __u32 nr_jited_ksyms;
995 __u32 nr_jited_func_lens;
996 __aligned_u64 jited_ksyms;
997 __aligned_u64 jited_func_lens;
Christopher Ferrisd842e432019-03-07 10:21:59 -0800998 __u32 btf_id;
999 __u32 func_info_rec_size;
1000 __aligned_u64 func_info;
1001 __u32 nr_func_info;
1002 __u32 nr_line_info;
1003 __aligned_u64 line_info;
1004 __aligned_u64 jited_line_info;
1005 __u32 nr_jited_line_info;
1006 __u32 line_info_rec_size;
1007 __u32 jited_line_info_rec_size;
1008 __u32 nr_prog_tags;
1009 __aligned_u64 prog_tags;
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001010 __u64 run_time_ns;
1011 __u64 run_cnt;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001012 __u64 recursion_misses;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001013 __u32 verified_insns;
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001014 __u32 attach_btf_obj_id;
1015 __u32 attach_btf_id;
Christopher Ferris1308ad32017-11-14 17:32:13 -08001016} __attribute__((aligned(8)));
1017struct bpf_map_info {
1018 __u32 type;
1019 __u32 id;
1020 __u32 key_size;
1021 __u32 value_size;
1022 __u32 max_entries;
1023 __u32 map_flags;
Christopher Ferris934ec942018-01-31 15:29:16 -08001024 char name[BPF_OBJ_NAME_LEN];
Christopher Ferris76a1d452018-06-27 14:12:29 -07001025 __u32 ifindex;
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -07001026 __u32 btf_vmlinux_value_type_id;
Christopher Ferris76a1d452018-06-27 14:12:29 -07001027 __u64 netns_dev;
1028 __u64 netns_ino;
Christopher Ferris9ce28842018-10-25 12:11:39 -07001029 __u32 btf_id;
1030 __u32 btf_key_type_id;
1031 __u32 btf_value_type_id;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001032 __u32 btf_vmlinux_id;
Christopher Ferrisa4792612022-01-10 13:51:15 -08001033 __u64 map_extra;
Christopher Ferris9ce28842018-10-25 12:11:39 -07001034} __attribute__((aligned(8)));
1035struct bpf_btf_info {
1036 __aligned_u64 btf;
1037 __u32 btf_size;
1038 __u32 id;
Christopher Ferris05667cd2021-02-16 16:01:34 -08001039 __aligned_u64 name;
1040 __u32 name_len;
1041 __u32 kernel_btf;
Christopher Ferris1308ad32017-11-14 17:32:13 -08001042} __attribute__((aligned(8)));
Christopher Ferris8177cdf2020-08-03 11:53:55 -07001043struct bpf_link_info {
1044 __u32 type;
1045 __u32 id;
1046 __u32 prog_id;
1047 union {
1048 struct {
1049 __aligned_u64 tp_name;
1050 __u32 tp_name_len;
1051 } raw_tracepoint;
1052 struct {
1053 __u32 attach_type;
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001054 __u32 target_obj_id;
1055 __u32 target_btf_id;
Christopher Ferris8177cdf2020-08-03 11:53:55 -07001056 } tracing;
1057 struct {
1058 __u64 cgroup_id;
1059 __u32 attach_type;
1060 } cgroup;
1061 struct {
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001062 __aligned_u64 target_name;
1063 __u32 target_name_len;
1064 union {
1065 struct {
1066 __u32 map_id;
1067 } map;
1068 };
Christopher Ferris6cd53a52022-12-12 23:39:16 +00001069 union {
1070 struct {
1071 __u64 cgroup_id;
1072 __u32 order;
1073 } cgroup;
1074 struct {
1075 __u32 tid;
1076 __u32 pid;
1077 } task;
1078 };
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001079 } iter;
1080 struct {
Christopher Ferris8177cdf2020-08-03 11:53:55 -07001081 __u32 netns_ino;
1082 __u32 attach_type;
1083 } netns;
Christopher Ferris25c18d42020-10-14 17:42:58 -07001084 struct {
1085 __u32 ifindex;
1086 } xdp;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001087 struct {
1088 __u32 map_id;
1089 } struct_ops;
1090 struct {
1091 __u32 pf;
1092 __u32 hooknum;
1093 __s32 priority;
1094 __u32 flags;
1095 } netfilter;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001096 struct {
1097 __aligned_u64 addrs;
1098 __u32 count;
1099 __u32 flags;
Christopher Ferris0f795212024-01-17 14:17:28 -08001100 __u64 missed;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001101 __aligned_u64 cookies;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001102 } kprobe_multi;
1103 struct {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001104 __aligned_u64 path;
1105 __aligned_u64 offsets;
1106 __aligned_u64 ref_ctr_offsets;
1107 __aligned_u64 cookies;
1108 __u32 path_size;
1109 __u32 count;
1110 __u32 flags;
1111 __u32 pid;
1112 } uprobe_multi;
1113 struct {
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001114 __u32 type;
1115 __u32 : 32;
1116 union {
1117 struct {
1118 __aligned_u64 file_name;
1119 __u32 name_len;
1120 __u32 offset;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001121 __u64 cookie;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001122 } uprobe;
1123 struct {
1124 __aligned_u64 func_name;
1125 __u32 name_len;
1126 __u32 offset;
1127 __u64 addr;
Christopher Ferris0f795212024-01-17 14:17:28 -08001128 __u64 missed;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001129 __u64 cookie;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001130 } kprobe;
1131 struct {
1132 __aligned_u64 tp_name;
1133 __u32 name_len;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001134 __u32 : 32;
1135 __u64 cookie;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001136 } tracepoint;
1137 struct {
1138 __u64 config;
1139 __u32 type;
Christopher Ferris7f4c8372024-06-03 14:22:19 -07001140 __u32 : 32;
1141 __u64 cookie;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -07001142 } event;
1143 };
1144 } perf_event;
1145 struct {
1146 __u32 ifindex;
1147 __u32 attach_type;
1148 } tcx;
Christopher Ferris0f795212024-01-17 14:17:28 -08001149 struct {
1150 __u32 ifindex;
1151 __u32 attach_type;
1152 } netkit;
Christopher Ferris8177cdf2020-08-03 11:53:55 -07001153 };
1154} __attribute__((aligned(8)));
Christopher Ferris76a1d452018-06-27 14:12:29 -07001155struct bpf_sock_addr {
1156 __u32 user_family;
1157 __u32 user_ip4;
1158 __u32 user_ip6[4];
1159 __u32 user_port;
1160 __u32 family;
1161 __u32 type;
1162 __u32 protocol;
Christopher Ferris9ce28842018-10-25 12:11:39 -07001163 __u32 msg_src_ip4;
1164 __u32 msg_src_ip6[4];
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001165 __bpf_md_ptr(struct bpf_sock *, sk);
Christopher Ferris76a1d452018-06-27 14:12:29 -07001166};
Christopher Ferris1308ad32017-11-14 17:32:13 -08001167struct bpf_sock_ops {
1168 __u32 op;
1169 union {
Christopher Ferris76a1d452018-06-27 14:12:29 -07001170 __u32 args[4];
Christopher Ferris1308ad32017-11-14 17:32:13 -08001171 __u32 reply;
1172 __u32 replylong[4];
1173 };
1174 __u32 family;
1175 __u32 remote_ip4;
1176 __u32 local_ip4;
1177 __u32 remote_ip6[4];
1178 __u32 local_ip6[4];
1179 __u32 remote_port;
1180 __u32 local_port;
Christopher Ferris76a1d452018-06-27 14:12:29 -07001181 __u32 is_fullsock;
1182 __u32 snd_cwnd;
1183 __u32 srtt_us;
1184 __u32 bpf_sock_ops_cb_flags;
1185 __u32 state;
1186 __u32 rtt_min;
1187 __u32 snd_ssthresh;
1188 __u32 rcv_nxt;
1189 __u32 snd_nxt;
1190 __u32 snd_una;
1191 __u32 mss_cache;
1192 __u32 ecn_flags;
1193 __u32 rate_delivered;
1194 __u32 rate_interval_us;
1195 __u32 packets_out;
1196 __u32 retrans_out;
1197 __u32 total_retrans;
1198 __u32 segs_in;
1199 __u32 data_segs_in;
1200 __u32 segs_out;
1201 __u32 data_segs_out;
1202 __u32 lost_out;
1203 __u32 sacked_out;
1204 __u32 sk_txhash;
1205 __u64 bytes_received;
1206 __u64 bytes_acked;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001207 __bpf_md_ptr(struct bpf_sock *, sk);
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001208 __bpf_md_ptr(void *, skb_data);
1209 __bpf_md_ptr(void *, skb_data_end);
1210 __u32 skb_len;
1211 __u32 skb_tcp_flags;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001212 __u64 skb_hwtstamp;
Christopher Ferris1308ad32017-11-14 17:32:13 -08001213};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001214enum {
1215 BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0),
1216 BPF_SOCK_OPS_RETRANS_CB_FLAG = (1 << 1),
1217 BPF_SOCK_OPS_STATE_CB_FLAG = (1 << 2),
1218 BPF_SOCK_OPS_RTT_CB_FLAG = (1 << 3),
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001219 BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = (1 << 4),
1220 BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = (1 << 5),
1221 BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1 << 6),
1222 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F,
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001223};
Christopher Ferris1308ad32017-11-14 17:32:13 -08001224enum {
1225 BPF_SOCK_OPS_VOID,
1226 BPF_SOCK_OPS_TIMEOUT_INIT,
1227 BPF_SOCK_OPS_RWND_INIT,
1228 BPF_SOCK_OPS_TCP_CONNECT_CB,
1229 BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB,
1230 BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB,
1231 BPF_SOCK_OPS_NEEDS_ECN,
Christopher Ferris934ec942018-01-31 15:29:16 -08001232 BPF_SOCK_OPS_BASE_RTT,
Christopher Ferris76a1d452018-06-27 14:12:29 -07001233 BPF_SOCK_OPS_RTO_CB,
1234 BPF_SOCK_OPS_RETRANS_CB,
1235 BPF_SOCK_OPS_STATE_CB,
Christopher Ferris9ce28842018-10-25 12:11:39 -07001236 BPF_SOCK_OPS_TCP_LISTEN_CB,
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001237 BPF_SOCK_OPS_RTT_CB,
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001238 BPF_SOCK_OPS_PARSE_HDR_OPT_CB,
1239 BPF_SOCK_OPS_HDR_OPT_LEN_CB,
1240 BPF_SOCK_OPS_WRITE_HDR_OPT_CB,
Christopher Ferris76a1d452018-06-27 14:12:29 -07001241};
1242enum {
1243 BPF_TCP_ESTABLISHED = 1,
1244 BPF_TCP_SYN_SENT,
1245 BPF_TCP_SYN_RECV,
1246 BPF_TCP_FIN_WAIT1,
1247 BPF_TCP_FIN_WAIT2,
1248 BPF_TCP_TIME_WAIT,
1249 BPF_TCP_CLOSE,
1250 BPF_TCP_CLOSE_WAIT,
1251 BPF_TCP_LAST_ACK,
1252 BPF_TCP_LISTEN,
1253 BPF_TCP_CLOSING,
1254 BPF_TCP_NEW_SYN_RECV,
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001255 BPF_TCP_BOUND_INACTIVE,
Christopher Ferris76a1d452018-06-27 14:12:29 -07001256 BPF_TCP_MAX_STATES
Christopher Ferris1308ad32017-11-14 17:32:13 -08001257};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001258enum {
1259 TCP_BPF_IW = 1001,
1260 TCP_BPF_SNDCWND_CLAMP = 1002,
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001261 TCP_BPF_DELACK_MAX = 1003,
1262 TCP_BPF_RTO_MIN = 1004,
1263 TCP_BPF_SYN = 1005,
1264 TCP_BPF_SYN_IP = 1006,
1265 TCP_BPF_SYN_MAC = 1007,
1266};
1267enum {
1268 BPF_LOAD_HDR_OPT_TCP_SYN = (1ULL << 0),
1269};
1270enum {
1271 BPF_WRITE_HDR_TCP_CURRENT_MSS = 1,
1272 BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 2,
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001273};
Christopher Ferris934ec942018-01-31 15:29:16 -08001274struct bpf_perf_event_value {
1275 __u64 counter;
1276 __u64 enabled;
1277 __u64 running;
1278};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001279enum {
1280 BPF_DEVCG_ACC_MKNOD = (1ULL << 0),
1281 BPF_DEVCG_ACC_READ = (1ULL << 1),
1282 BPF_DEVCG_ACC_WRITE = (1ULL << 2),
1283};
1284enum {
1285 BPF_DEVCG_DEV_BLOCK = (1ULL << 0),
1286 BPF_DEVCG_DEV_CHAR = (1ULL << 1),
1287};
Christopher Ferris934ec942018-01-31 15:29:16 -08001288struct bpf_cgroup_dev_ctx {
1289 __u32 access_type;
1290 __u32 major;
1291 __u32 minor;
1292};
Christopher Ferris76a1d452018-06-27 14:12:29 -07001293struct bpf_raw_tracepoint_args {
1294 __u64 args[0];
1295};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001296enum {
1297 BPF_FIB_LOOKUP_DIRECT = (1U << 0),
1298 BPF_FIB_LOOKUP_OUTPUT = (1U << 1),
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001299 BPF_FIB_LOOKUP_SKIP_NEIGH = (1U << 2),
Christopher Ferris8666d042023-09-06 14:55:31 -07001300 BPF_FIB_LOOKUP_TBID = (1U << 3),
Christopher Ferris0f795212024-01-17 14:17:28 -08001301 BPF_FIB_LOOKUP_SRC = (1U << 4),
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001302};
Christopher Ferris9ce28842018-10-25 12:11:39 -07001303enum {
1304 BPF_FIB_LKUP_RET_SUCCESS,
1305 BPF_FIB_LKUP_RET_BLACKHOLE,
1306 BPF_FIB_LKUP_RET_UNREACHABLE,
1307 BPF_FIB_LKUP_RET_PROHIBIT,
1308 BPF_FIB_LKUP_RET_NOT_FWDED,
1309 BPF_FIB_LKUP_RET_FWD_DISABLED,
1310 BPF_FIB_LKUP_RET_UNSUPP_LWT,
1311 BPF_FIB_LKUP_RET_NO_NEIGH,
1312 BPF_FIB_LKUP_RET_FRAG_NEEDED,
Christopher Ferris0f795212024-01-17 14:17:28 -08001313 BPF_FIB_LKUP_RET_NO_SRC_ADDR,
Christopher Ferris9ce28842018-10-25 12:11:39 -07001314};
1315struct bpf_fib_lookup {
1316 __u8 family;
1317 __u8 l4_protocol;
1318 __be16 sport;
1319 __be16 dport;
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001320 union {
1321 __u16 tot_len;
1322 __u16 mtu_result;
1323 };
Christopher Ferris9ce28842018-10-25 12:11:39 -07001324 __u32 ifindex;
1325 union {
1326 __u8 tos;
1327 __be32 flowinfo;
1328 __u32 rt_metric;
1329 };
1330 union {
1331 __be32 ipv4_src;
1332 __u32 ipv6_src[4];
1333 };
1334 union {
1335 __be32 ipv4_dst;
1336 __u32 ipv6_dst[4];
1337 };
Christopher Ferris8666d042023-09-06 14:55:31 -07001338 union {
1339 struct {
1340 __be16 h_vlan_proto;
1341 __be16 h_vlan_TCI;
1342 };
1343 __u32 tbid;
1344 };
Christopher Ferris9ce28842018-10-25 12:11:39 -07001345 __u8 smac[6];
1346 __u8 dmac[6];
1347};
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001348struct bpf_redir_neigh {
1349 __u32 nh_family;
1350 union {
1351 __be32 ipv4_nh;
1352 __u32 ipv6_nh[4];
1353 };
1354};
Christopher Ferrisa9750ed2021-05-03 14:02:49 -07001355enum bpf_check_mtu_flags {
1356 BPF_MTU_CHK_SEGS = (1U << 0),
1357};
1358enum bpf_check_mtu_ret {
1359 BPF_MTU_CHK_RET_SUCCESS,
1360 BPF_MTU_CHK_RET_FRAG_NEEDED,
1361 BPF_MTU_CHK_RET_SEGS_TOOBIG,
1362};
Christopher Ferris9ce28842018-10-25 12:11:39 -07001363enum bpf_task_fd_type {
1364 BPF_FD_TYPE_RAW_TRACEPOINT,
1365 BPF_FD_TYPE_TRACEPOINT,
1366 BPF_FD_TYPE_KPROBE,
1367 BPF_FD_TYPE_KRETPROBE,
1368 BPF_FD_TYPE_UPROBE,
1369 BPF_FD_TYPE_URETPROBE,
1370};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001371enum {
1372 BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0),
1373 BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1),
1374 BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2),
1375};
Christopher Ferris86a48372019-01-10 14:14:59 -08001376struct bpf_flow_keys {
1377 __u16 nhoff;
1378 __u16 thoff;
1379 __u16 addr_proto;
1380 __u8 is_frag;
1381 __u8 is_first_frag;
1382 __u8 is_encap;
1383 __u8 ip_proto;
1384 __be16 n_proto;
1385 __be16 sport;
1386 __be16 dport;
1387 union {
1388 struct {
1389 __be32 ipv4_src;
1390 __be32 ipv4_dst;
1391 };
1392 struct {
1393 __u32 ipv6_src[4];
1394 __u32 ipv6_dst[4];
1395 };
1396 };
Christopher Ferris9584fa42019-12-09 15:36:13 -08001397 __u32 flags;
1398 __be32 flow_label;
Christopher Ferris86a48372019-01-10 14:14:59 -08001399};
Christopher Ferrisd842e432019-03-07 10:21:59 -08001400struct bpf_func_info {
1401 __u32 insn_off;
1402 __u32 type_id;
1403};
1404#define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10)
1405#define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff)
1406struct bpf_line_info {
1407 __u32 insn_off;
1408 __u32 file_name_off;
1409 __u32 line_off;
1410 __u32 line_col;
1411};
Christopher Ferris24f97eb2019-05-20 12:58:13 -07001412struct bpf_spin_lock {
1413 __u32 val;
1414};
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001415struct bpf_timer {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001416 __u64 __opaque[2];
Christopher Ferris2abfa9e2021-11-01 16:26:06 -07001417} __attribute__((aligned(8)));
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001418struct bpf_dynptr {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001419 __u64 __opaque[2];
Christopher Ferris80ae69d2022-08-02 16:32:21 -07001420} __attribute__((aligned(8)));
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001421struct bpf_list_head {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001422 __u64 __opaque[2];
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001423} __attribute__((aligned(8)));
1424struct bpf_list_node {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001425 __u64 __opaque[3];
Christopher Ferris8b7fdc92023-02-21 13:36:32 -08001426} __attribute__((aligned(8)));
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001427struct bpf_rb_root {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001428 __u64 __opaque[2];
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001429} __attribute__((aligned(8)));
1430struct bpf_rb_node {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001431 __u64 __opaque[4];
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +00001432} __attribute__((aligned(8)));
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001433struct bpf_refcount {
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07001434 __u32 __opaque[1];
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001435} __attribute__((aligned(4)));
Christopher Ferrisaeddbcf2019-07-08 12:45:46 -07001436struct bpf_sysctl {
1437 __u32 write;
1438 __u32 file_pos;
1439};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07001440struct bpf_sockopt {
1441 __bpf_md_ptr(struct bpf_sock *, sk);
1442 __bpf_md_ptr(void *, optval);
1443 __bpf_md_ptr(void *, optval_end);
1444 __s32 level;
1445 __s32 optname;
1446 __s32 optlen;
1447 __s32 retval;
1448};
Christopher Ferrisaf09c702020-06-01 20:29:29 -07001449struct bpf_pidns_info {
1450 __u32 pid;
1451 __u32 tgid;
1452};
Christopher Ferris25c18d42020-10-14 17:42:58 -07001453struct bpf_sk_lookup {
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +00001454 union {
1455 __bpf_md_ptr(struct bpf_sock *, sk);
1456 __u64 cookie;
1457 };
Christopher Ferris25c18d42020-10-14 17:42:58 -07001458 __u32 family;
1459 __u32 protocol;
1460 __u32 remote_ip4;
1461 __u32 remote_ip6[4];
Christopher Ferris10a76e62022-06-08 13:31:52 -07001462 __be16 remote_port;
1463 __u16 : 16;
Christopher Ferris25c18d42020-10-14 17:42:58 -07001464 __u32 local_ip4;
1465 __u32 local_ip6[4];
1466 __u32 local_port;
Christopher Ferris1ed55342022-03-22 16:06:25 -07001467 __u32 ingress_ifindex;
Christopher Ferris25c18d42020-10-14 17:42:58 -07001468};
Christopher Ferris32ff3f82020-12-14 13:10:04 -08001469struct btf_ptr {
1470 void * ptr;
1471 __u32 type_id;
1472 __u32 flags;
1473};
1474enum {
1475 BTF_F_COMPACT = (1ULL << 0),
1476 BTF_F_NONAME = (1ULL << 1),
1477 BTF_F_PTR_RAW = (1ULL << 2),
1478 BTF_F_ZERO = (1ULL << 3),
1479};
Christopher Ferris1ed55342022-03-22 16:06:25 -07001480enum bpf_core_relo_kind {
1481 BPF_CORE_FIELD_BYTE_OFFSET = 0,
1482 BPF_CORE_FIELD_BYTE_SIZE = 1,
1483 BPF_CORE_FIELD_EXISTS = 2,
1484 BPF_CORE_FIELD_SIGNED = 3,
1485 BPF_CORE_FIELD_LSHIFT_U64 = 4,
1486 BPF_CORE_FIELD_RSHIFT_U64 = 5,
1487 BPF_CORE_TYPE_ID_LOCAL = 6,
1488 BPF_CORE_TYPE_ID_TARGET = 7,
1489 BPF_CORE_TYPE_EXISTS = 8,
1490 BPF_CORE_TYPE_SIZE = 9,
1491 BPF_CORE_ENUMVAL_EXISTS = 10,
1492 BPF_CORE_ENUMVAL_VALUE = 11,
Christopher Ferris7447a1c2022-10-04 18:24:44 -07001493 BPF_CORE_TYPE_MATCHES = 12,
Christopher Ferris1ed55342022-03-22 16:06:25 -07001494};
1495struct bpf_core_relo {
1496 __u32 insn_off;
1497 __u32 type_id;
1498 __u32 access_str_off;
1499 enum bpf_core_relo_kind kind;
1500};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001501enum {
1502 BPF_F_TIMER_ABS = (1ULL << 0),
Christopher Ferris0f795212024-01-17 14:17:28 -08001503 BPF_F_TIMER_CPU_PIN = (1ULL << 1),
Christopher Ferris37c3f3c2023-07-10 10:59:05 -07001504};
1505struct bpf_iter_num {
1506 __u64 __opaque[1];
1507} __attribute__((aligned(8)));
Christopher Ferris82d75042015-01-26 10:57:07 -08001508#endif