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 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #define BPF_ALU64 0x07 25 #define BPF_DW 0x18 26 #define BPF_XADD 0xc0 27 #define BPF_MOV 0xb0 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define BPF_ARSH 0xc0 30 #define BPF_END 0xd0 31 #define BPF_TO_LE 0x00 32 #define BPF_TO_BE 0x08 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define BPF_FROM_LE BPF_TO_LE 35 #define BPF_FROM_BE BPF_TO_BE 36 #define BPF_JNE 0x50 37 #define BPF_JSGT 0x60 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define BPF_JSGE 0x70 40 #define BPF_CALL 0x80 41 #define BPF_EXIT 0x90 42 enum { 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 BPF_REG_0 = 0, 45 BPF_REG_1, 46 BPF_REG_2, 47 BPF_REG_3, 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 BPF_REG_4, 50 BPF_REG_5, 51 BPF_REG_6, 52 BPF_REG_7, 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 BPF_REG_8, 55 BPF_REG_9, 56 BPF_REG_10, 57 __MAX_BPF_REG, 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 }; 60 #define MAX_BPF_REG __MAX_BPF_REG 61 struct bpf_insn { 62 __u8 code; 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 __u8 dst_reg : 4; 65 __u8 src_reg : 4; 66 __s16 off; 67 __s32 imm; 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 }; 70 enum bpf_cmd { 71 BPF_MAP_CREATE, 72 BPF_MAP_LOOKUP_ELEM, 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 BPF_MAP_UPDATE_ELEM, 75 BPF_MAP_DELETE_ELEM, 76 BPF_MAP_GET_NEXT_KEY, 77 BPF_PROG_LOAD, 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 BPF_OBJ_PIN, 80 BPF_OBJ_GET, 81 BPF_PROG_ATTACH, 82 BPF_PROG_DETACH, 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 }; 85 enum bpf_map_type { 86 BPF_MAP_TYPE_UNSPEC, 87 BPF_MAP_TYPE_HASH, 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 BPF_MAP_TYPE_ARRAY, 90 BPF_MAP_TYPE_PROG_ARRAY, 91 BPF_MAP_TYPE_PERF_EVENT_ARRAY, 92 BPF_MAP_TYPE_PERCPU_HASH, 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 BPF_MAP_TYPE_PERCPU_ARRAY, 95 BPF_MAP_TYPE_STACK_TRACE, 96 BPF_MAP_TYPE_CGROUP_ARRAY, 97 BPF_MAP_TYPE_LRU_HASH, 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 BPF_MAP_TYPE_LRU_PERCPU_HASH, 100 }; 101 enum bpf_prog_type { 102 BPF_PROG_TYPE_UNSPEC, 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 BPF_PROG_TYPE_SOCKET_FILTER, 105 BPF_PROG_TYPE_KPROBE, 106 BPF_PROG_TYPE_SCHED_CLS, 107 BPF_PROG_TYPE_SCHED_ACT, 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 BPF_PROG_TYPE_TRACEPOINT, 110 BPF_PROG_TYPE_XDP, 111 BPF_PROG_TYPE_PERF_EVENT, 112 BPF_PROG_TYPE_CGROUP_SKB, 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 BPF_PROG_TYPE_CGROUP_SOCK, 115 BPF_PROG_TYPE_LWT_IN, 116 BPF_PROG_TYPE_LWT_OUT, 117 BPF_PROG_TYPE_LWT_XMIT, 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 }; 120 enum bpf_attach_type { 121 BPF_CGROUP_INET_INGRESS, 122 BPF_CGROUP_INET_EGRESS, 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 BPF_CGROUP_INET_SOCK_CREATE, 125 __MAX_BPF_ATTACH_TYPE 126 }; 127 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 #define BPF_F_ALLOW_OVERRIDE (1U << 0) 130 #define BPF_PSEUDO_MAP_FD 1 131 #define BPF_ANY 0 132 #define BPF_NOEXIST 1 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 #define BPF_EXIST 2 135 #define BPF_F_NO_PREALLOC (1U << 0) 136 #define BPF_F_NO_COMMON_LRU (1U << 1) 137 union bpf_attr { 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 struct { 140 __u32 map_type; 141 __u32 key_size; 142 __u32 value_size; 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 __u32 max_entries; 145 __u32 map_flags; 146 }; 147 struct { 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 __u32 map_fd; 150 __aligned_u64 key; 151 union { 152 __aligned_u64 value; 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 __aligned_u64 next_key; 155 }; 156 __u64 flags; 157 }; 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 struct { 160 __u32 prog_type; 161 __u32 insn_cnt; 162 __aligned_u64 insns; 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 __aligned_u64 license; 165 __u32 log_level; 166 __u32 log_size; 167 __aligned_u64 log_buf; 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 __u32 kern_version; 170 }; 171 struct { 172 __aligned_u64 pathname; 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 __u32 bpf_fd; 175 }; 176 struct { 177 __u32 target_fd; 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 __u32 attach_bpf_fd; 180 __u32 attach_type; 181 __u32 attach_flags; 182 }; 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 } __attribute__((aligned(8))); 185 #define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), 186 #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x 187 enum bpf_func_id { 188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 189 __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, 190 }; 191 #undef __BPF_ENUM_FN 192 #define BPF_F_RECOMPUTE_CSUM (1ULL << 0) 193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 194 #define BPF_F_INVALIDATE_HASH (1ULL << 1) 195 #define BPF_F_HDR_FIELD_MASK 0xfULL 196 #define BPF_F_PSEUDO_HDR (1ULL << 4) 197 #define BPF_F_MARK_MANGLED_0 (1ULL << 5) 198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 199 #define BPF_F_INGRESS (1ULL << 0) 200 #define BPF_F_TUNINFO_IPV6 (1ULL << 0) 201 #define BPF_F_SKIP_FIELD_MASK 0xffULL 202 #define BPF_F_USER_STACK (1ULL << 8) 203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 204 #define BPF_F_FAST_STACK_CMP (1ULL << 9) 205 #define BPF_F_REUSE_STACKID (1ULL << 10) 206 #define BPF_F_ZERO_CSUM_TX (1ULL << 1) 207 #define BPF_F_DONT_FRAGMENT (1ULL << 2) 208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 209 #define BPF_F_INDEX_MASK 0xffffffffULL 210 #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK 211 #define BPF_F_CTXLEN_MASK (0xfffffULL << 32) 212 struct __sk_buff { 213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 214 __u32 len; 215 __u32 pkt_type; 216 __u32 mark; 217 __u32 queue_mapping; 218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 219 __u32 protocol; 220 __u32 vlan_present; 221 __u32 vlan_tci; 222 __u32 vlan_proto; 223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 224 __u32 priority; 225 __u32 ingress_ifindex; 226 __u32 ifindex; 227 __u32 tc_index; 228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 229 __u32 cb[5]; 230 __u32 hash; 231 __u32 tc_classid; 232 __u32 data; 233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 234 __u32 data_end; 235 }; 236 struct bpf_tunnel_key { 237 __u32 tunnel_id; 238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 239 union { 240 __u32 remote_ipv4; 241 __u32 remote_ipv6[4]; 242 }; 243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 244 __u8 tunnel_tos; 245 __u8 tunnel_ttl; 246 __u16 tunnel_ext; 247 __u32 tunnel_label; 248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 249 }; 250 enum bpf_ret_code { 251 BPF_OK = 0, 252 BPF_DROP = 2, 253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 254 BPF_REDIRECT = 7, 255 }; 256 struct bpf_sock { 257 __u32 bound_dev_if; 258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 259 __u32 family; 260 __u32 type; 261 __u32 protocol; 262 }; 263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 264 #define XDP_PACKET_HEADROOM 256 265 enum xdp_action { 266 XDP_ABORTED = 0, 267 XDP_DROP, 268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 269 XDP_PASS, 270 XDP_TX, 271 }; 272 struct xdp_md { 273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 274 __u32 data; 275 __u32 data_end; 276 }; 277 #endif 278 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 279