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