• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ALU64 0x07
24 #define BPF_DW 0x18
25 #define BPF_XADD 0xc0
26 #define BPF_MOV 0xb0
27 #define BPF_ARSH 0xc0
28 #define BPF_END 0xd0
29 #define BPF_TO_LE 0x00
30 #define BPF_TO_BE 0x08
31 #define BPF_FROM_LE BPF_TO_LE
32 #define BPF_FROM_BE BPF_TO_BE
33 #define BPF_JNE 0x50
34 #define BPF_JLT 0xa0
35 #define BPF_JLE 0xb0
36 #define BPF_JSGT 0x60
37 #define BPF_JSGE 0x70
38 #define BPF_JSLT 0xc0
39 #define BPF_JSLE 0xd0
40 #define BPF_CALL 0x80
41 #define BPF_EXIT 0x90
42 enum {
43   BPF_REG_0 = 0,
44   BPF_REG_1,
45   BPF_REG_2,
46   BPF_REG_3,
47   BPF_REG_4,
48   BPF_REG_5,
49   BPF_REG_6,
50   BPF_REG_7,
51   BPF_REG_8,
52   BPF_REG_9,
53   BPF_REG_10,
54   __MAX_BPF_REG,
55 };
56 #define MAX_BPF_REG __MAX_BPF_REG
57 struct bpf_insn {
58   __u8 code;
59   __u8 dst_reg : 4;
60   __u8 src_reg : 4;
61   __s16 off;
62   __s32 imm;
63 };
64 struct bpf_lpm_trie_key {
65   __u32 prefixlen;
66   __u8 data[0];
67 };
68 struct bpf_cgroup_storage_key {
69   __u64 cgroup_inode_id;
70   __u32 attach_type;
71 };
72 enum bpf_cmd {
73   BPF_MAP_CREATE,
74   BPF_MAP_LOOKUP_ELEM,
75   BPF_MAP_UPDATE_ELEM,
76   BPF_MAP_DELETE_ELEM,
77   BPF_MAP_GET_NEXT_KEY,
78   BPF_PROG_LOAD,
79   BPF_OBJ_PIN,
80   BPF_OBJ_GET,
81   BPF_PROG_ATTACH,
82   BPF_PROG_DETACH,
83   BPF_PROG_TEST_RUN,
84   BPF_PROG_GET_NEXT_ID,
85   BPF_MAP_GET_NEXT_ID,
86   BPF_PROG_GET_FD_BY_ID,
87   BPF_MAP_GET_FD_BY_ID,
88   BPF_OBJ_GET_INFO_BY_FD,
89   BPF_PROG_QUERY,
90   BPF_RAW_TRACEPOINT_OPEN,
91   BPF_BTF_LOAD,
92   BPF_BTF_GET_FD_BY_ID,
93   BPF_TASK_FD_QUERY,
94   BPF_MAP_LOOKUP_AND_DELETE_ELEM,
95 };
96 enum bpf_map_type {
97   BPF_MAP_TYPE_UNSPEC,
98   BPF_MAP_TYPE_HASH,
99   BPF_MAP_TYPE_ARRAY,
100   BPF_MAP_TYPE_PROG_ARRAY,
101   BPF_MAP_TYPE_PERF_EVENT_ARRAY,
102   BPF_MAP_TYPE_PERCPU_HASH,
103   BPF_MAP_TYPE_PERCPU_ARRAY,
104   BPF_MAP_TYPE_STACK_TRACE,
105   BPF_MAP_TYPE_CGROUP_ARRAY,
106   BPF_MAP_TYPE_LRU_HASH,
107   BPF_MAP_TYPE_LRU_PERCPU_HASH,
108   BPF_MAP_TYPE_LPM_TRIE,
109   BPF_MAP_TYPE_ARRAY_OF_MAPS,
110   BPF_MAP_TYPE_HASH_OF_MAPS,
111   BPF_MAP_TYPE_DEVMAP,
112   BPF_MAP_TYPE_SOCKMAP,
113   BPF_MAP_TYPE_CPUMAP,
114   BPF_MAP_TYPE_XSKMAP,
115   BPF_MAP_TYPE_SOCKHASH,
116   BPF_MAP_TYPE_CGROUP_STORAGE,
117   BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
118   BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
119   BPF_MAP_TYPE_QUEUE,
120   BPF_MAP_TYPE_STACK,
121 };
122 enum bpf_prog_type {
123   BPF_PROG_TYPE_UNSPEC,
124   BPF_PROG_TYPE_SOCKET_FILTER,
125   BPF_PROG_TYPE_KPROBE,
126   BPF_PROG_TYPE_SCHED_CLS,
127   BPF_PROG_TYPE_SCHED_ACT,
128   BPF_PROG_TYPE_TRACEPOINT,
129   BPF_PROG_TYPE_XDP,
130   BPF_PROG_TYPE_PERF_EVENT,
131   BPF_PROG_TYPE_CGROUP_SKB,
132   BPF_PROG_TYPE_CGROUP_SOCK,
133   BPF_PROG_TYPE_LWT_IN,
134   BPF_PROG_TYPE_LWT_OUT,
135   BPF_PROG_TYPE_LWT_XMIT,
136   BPF_PROG_TYPE_SOCK_OPS,
137   BPF_PROG_TYPE_SK_SKB,
138   BPF_PROG_TYPE_CGROUP_DEVICE,
139   BPF_PROG_TYPE_SK_MSG,
140   BPF_PROG_TYPE_RAW_TRACEPOINT,
141   BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
142   BPF_PROG_TYPE_LWT_SEG6LOCAL,
143   BPF_PROG_TYPE_LIRC_MODE2,
144   BPF_PROG_TYPE_SK_REUSEPORT,
145   BPF_PROG_TYPE_FLOW_DISSECTOR,
146 };
147 enum bpf_attach_type {
148   BPF_CGROUP_INET_INGRESS,
149   BPF_CGROUP_INET_EGRESS,
150   BPF_CGROUP_INET_SOCK_CREATE,
151   BPF_CGROUP_SOCK_OPS,
152   BPF_SK_SKB_STREAM_PARSER,
153   BPF_SK_SKB_STREAM_VERDICT,
154   BPF_CGROUP_DEVICE,
155   BPF_SK_MSG_VERDICT,
156   BPF_CGROUP_INET4_BIND,
157   BPF_CGROUP_INET6_BIND,
158   BPF_CGROUP_INET4_CONNECT,
159   BPF_CGROUP_INET6_CONNECT,
160   BPF_CGROUP_INET4_POST_BIND,
161   BPF_CGROUP_INET6_POST_BIND,
162   BPF_CGROUP_UDP4_SENDMSG,
163   BPF_CGROUP_UDP6_SENDMSG,
164   BPF_LIRC_MODE2,
165   BPF_FLOW_DISSECTOR,
166   __MAX_BPF_ATTACH_TYPE
167 };
168 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
169 #define BPF_F_ALLOW_OVERRIDE (1U << 0)
170 #define BPF_F_ALLOW_MULTI (1U << 1)
171 #define BPF_F_STRICT_ALIGNMENT (1U << 0)
172 #define BPF_F_ANY_ALIGNMENT (1U << 1)
173 #define BPF_PSEUDO_MAP_FD 1
174 #define BPF_PSEUDO_CALL 1
175 #define BPF_ANY 0
176 #define BPF_NOEXIST 1
177 #define BPF_EXIST 2
178 #define BPF_F_NO_PREALLOC (1U << 0)
179 #define BPF_F_NO_COMMON_LRU (1U << 1)
180 #define BPF_F_NUMA_NODE (1U << 2)
181 #define BPF_OBJ_NAME_LEN 16U
182 #define BPF_F_RDONLY (1U << 3)
183 #define BPF_F_WRONLY (1U << 4)
184 #define BPF_F_STACK_BUILD_ID (1U << 5)
185 #define BPF_F_ZERO_SEED (1U << 6)
186 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
187 enum bpf_stack_build_id_status {
188   BPF_STACK_BUILD_ID_EMPTY = 0,
189   BPF_STACK_BUILD_ID_VALID = 1,
190   BPF_STACK_BUILD_ID_IP = 2,
191 };
192 #define BPF_BUILD_ID_SIZE 20
193 struct bpf_stack_build_id {
194   __s32 status;
195   unsigned char build_id[BPF_BUILD_ID_SIZE];
196   union {
197     __u64 offset;
198     __u64 ip;
199   };
200 };
201 union bpf_attr {
202   struct {
203     __u32 map_type;
204     __u32 key_size;
205     __u32 value_size;
206     __u32 max_entries;
207     __u32 map_flags;
208     __u32 inner_map_fd;
209     __u32 numa_node;
210     char map_name[BPF_OBJ_NAME_LEN];
211     __u32 map_ifindex;
212     __u32 btf_fd;
213     __u32 btf_key_type_id;
214     __u32 btf_value_type_id;
215   };
216   struct {
217     __u32 map_fd;
218     __aligned_u64 key;
219     union {
220       __aligned_u64 value;
221       __aligned_u64 next_key;
222     };
223     __u64 flags;
224   };
225   struct {
226     __u32 prog_type;
227     __u32 insn_cnt;
228     __aligned_u64 insns;
229     __aligned_u64 license;
230     __u32 log_level;
231     __u32 log_size;
232     __aligned_u64 log_buf;
233     __u32 kern_version;
234     __u32 prog_flags;
235     char prog_name[BPF_OBJ_NAME_LEN];
236     __u32 prog_ifindex;
237     __u32 expected_attach_type;
238     __u32 prog_btf_fd;
239     __u32 func_info_rec_size;
240     __aligned_u64 func_info;
241     __u32 func_info_cnt;
242     __u32 line_info_rec_size;
243     __aligned_u64 line_info;
244     __u32 line_info_cnt;
245   };
246   struct {
247     __aligned_u64 pathname;
248     __u32 bpf_fd;
249     __u32 file_flags;
250   };
251   struct {
252     __u32 target_fd;
253     __u32 attach_bpf_fd;
254     __u32 attach_type;
255     __u32 attach_flags;
256   };
257   struct {
258     __u32 prog_fd;
259     __u32 retval;
260     __u32 data_size_in;
261     __u32 data_size_out;
262     __aligned_u64 data_in;
263     __aligned_u64 data_out;
264     __u32 repeat;
265     __u32 duration;
266   } test;
267   struct {
268     union {
269       __u32 start_id;
270       __u32 prog_id;
271       __u32 map_id;
272       __u32 btf_id;
273     };
274     __u32 next_id;
275     __u32 open_flags;
276   };
277   struct {
278     __u32 bpf_fd;
279     __u32 info_len;
280     __aligned_u64 info;
281   } info;
282   struct {
283     __u32 target_fd;
284     __u32 attach_type;
285     __u32 query_flags;
286     __u32 attach_flags;
287     __aligned_u64 prog_ids;
288     __u32 prog_cnt;
289   } query;
290   struct {
291     __u64 name;
292     __u32 prog_fd;
293   } raw_tracepoint;
294   struct {
295     __aligned_u64 btf;
296     __aligned_u64 btf_log_buf;
297     __u32 btf_size;
298     __u32 btf_log_size;
299     __u32 btf_log_level;
300   };
301   struct {
302     __u32 pid;
303     __u32 fd;
304     __u32 flags;
305     __u32 buf_len;
306     __aligned_u64 buf;
307     __u32 prog_id;
308     __u32 fd_type;
309     __u64 probe_offset;
310     __u64 probe_addr;
311   } task_fd_query;
312 } __attribute__((aligned(8)));
313 #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), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel),
314 #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
315 enum bpf_func_id {
316   __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
317 };
318 #undef __BPF_ENUM_FN
319 #define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
320 #define BPF_F_INVALIDATE_HASH (1ULL << 1)
321 #define BPF_F_HDR_FIELD_MASK 0xfULL
322 #define BPF_F_PSEUDO_HDR (1ULL << 4)
323 #define BPF_F_MARK_MANGLED_0 (1ULL << 5)
324 #define BPF_F_MARK_ENFORCE (1ULL << 6)
325 #define BPF_F_INGRESS (1ULL << 0)
326 #define BPF_F_TUNINFO_IPV6 (1ULL << 0)
327 #define BPF_F_SKIP_FIELD_MASK 0xffULL
328 #define BPF_F_USER_STACK (1ULL << 8)
329 #define BPF_F_FAST_STACK_CMP (1ULL << 9)
330 #define BPF_F_REUSE_STACKID (1ULL << 10)
331 #define BPF_F_USER_BUILD_ID (1ULL << 11)
332 #define BPF_F_ZERO_CSUM_TX (1ULL << 1)
333 #define BPF_F_DONT_FRAGMENT (1ULL << 2)
334 #define BPF_F_SEQ_NUMBER (1ULL << 3)
335 #define BPF_F_INDEX_MASK 0xffffffffULL
336 #define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
337 #define BPF_F_CTXLEN_MASK (0xfffffULL << 32)
338 #define BPF_F_CURRENT_NETNS (- 1L)
339 enum bpf_adj_room_mode {
340   BPF_ADJ_ROOM_NET,
341 };
342 enum bpf_hdr_start_off {
343   BPF_HDR_START_MAC,
344   BPF_HDR_START_NET,
345 };
346 enum bpf_lwt_encap_mode {
347   BPF_LWT_ENCAP_SEG6,
348   BPF_LWT_ENCAP_SEG6_INLINE
349 };
350 #define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \
351 } __attribute__((aligned(8)))
352 struct __sk_buff {
353   __u32 len;
354   __u32 pkt_type;
355   __u32 mark;
356   __u32 queue_mapping;
357   __u32 protocol;
358   __u32 vlan_present;
359   __u32 vlan_tci;
360   __u32 vlan_proto;
361   __u32 priority;
362   __u32 ingress_ifindex;
363   __u32 ifindex;
364   __u32 tc_index;
365   __u32 cb[5];
366   __u32 hash;
367   __u32 tc_classid;
368   __u32 data;
369   __u32 data_end;
370   __u32 napi_id;
371   __u32 family;
372   __u32 remote_ip4;
373   __u32 local_ip4;
374   __u32 remote_ip6[4];
375   __u32 local_ip6[4];
376   __u32 remote_port;
377   __u32 local_port;
378   __u32 data_meta;
379   __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
380   __u64 tstamp;
381   __u32 wire_len;
382 };
383 struct bpf_tunnel_key {
384   __u32 tunnel_id;
385   union {
386     __u32 remote_ipv4;
387     __u32 remote_ipv6[4];
388   };
389   __u8 tunnel_tos;
390   __u8 tunnel_ttl;
391   __u16 tunnel_ext;
392   __u32 tunnel_label;
393 };
394 struct bpf_xfrm_state {
395   __u32 reqid;
396   __u32 spi;
397   __u16 family;
398   __u16 ext;
399   union {
400     __u32 remote_ipv4;
401     __u32 remote_ipv6[4];
402   };
403 };
404 enum bpf_ret_code {
405   BPF_OK = 0,
406   BPF_DROP = 2,
407   BPF_REDIRECT = 7,
408 };
409 struct bpf_sock {
410   __u32 bound_dev_if;
411   __u32 family;
412   __u32 type;
413   __u32 protocol;
414   __u32 mark;
415   __u32 priority;
416   __u32 src_ip4;
417   __u32 src_ip6[4];
418   __u32 src_port;
419 };
420 struct bpf_sock_tuple {
421   union {
422     struct {
423       __be32 saddr;
424       __be32 daddr;
425       __be16 sport;
426       __be16 dport;
427     } ipv4;
428     struct {
429       __be32 saddr[4];
430       __be32 daddr[4];
431       __be16 sport;
432       __be16 dport;
433     } ipv6;
434   };
435 };
436 #define XDP_PACKET_HEADROOM 256
437 enum xdp_action {
438   XDP_ABORTED = 0,
439   XDP_DROP,
440   XDP_PASS,
441   XDP_TX,
442   XDP_REDIRECT,
443 };
444 struct xdp_md {
445   __u32 data;
446   __u32 data_end;
447   __u32 data_meta;
448   __u32 ingress_ifindex;
449   __u32 rx_queue_index;
450 };
451 enum sk_action {
452   SK_DROP = 0,
453   SK_PASS,
454 };
455 struct sk_msg_md {
456   __bpf_md_ptr(void *, data);
457   __bpf_md_ptr(void *, data_end);
458   __u32 family;
459   __u32 remote_ip4;
460   __u32 local_ip4;
461   __u32 remote_ip6[4];
462   __u32 local_ip6[4];
463   __u32 remote_port;
464   __u32 local_port;
465   __u32 size;
466 };
467 struct sk_reuseport_md {
468   __bpf_md_ptr(void *, data);
469   __bpf_md_ptr(void *, data_end);
470   __u32 len;
471   __u32 eth_protocol;
472   __u32 ip_protocol;
473   __u32 bind_inany;
474   __u32 hash;
475 };
476 #define BPF_TAG_SIZE 8
477 struct bpf_prog_info {
478   __u32 type;
479   __u32 id;
480   __u8 tag[BPF_TAG_SIZE];
481   __u32 jited_prog_len;
482   __u32 xlated_prog_len;
483   __aligned_u64 jited_prog_insns;
484   __aligned_u64 xlated_prog_insns;
485   __u64 load_time;
486   __u32 created_by_uid;
487   __u32 nr_map_ids;
488   __aligned_u64 map_ids;
489   char name[BPF_OBJ_NAME_LEN];
490   __u32 ifindex;
491   __u32 gpl_compatible : 1;
492   __u64 netns_dev;
493   __u64 netns_ino;
494   __u32 nr_jited_ksyms;
495   __u32 nr_jited_func_lens;
496   __aligned_u64 jited_ksyms;
497   __aligned_u64 jited_func_lens;
498   __u32 btf_id;
499   __u32 func_info_rec_size;
500   __aligned_u64 func_info;
501   __u32 nr_func_info;
502   __u32 nr_line_info;
503   __aligned_u64 line_info;
504   __aligned_u64 jited_line_info;
505   __u32 nr_jited_line_info;
506   __u32 line_info_rec_size;
507   __u32 jited_line_info_rec_size;
508   __u32 nr_prog_tags;
509   __aligned_u64 prog_tags;
510 } __attribute__((aligned(8)));
511 struct bpf_map_info {
512   __u32 type;
513   __u32 id;
514   __u32 key_size;
515   __u32 value_size;
516   __u32 max_entries;
517   __u32 map_flags;
518   char name[BPF_OBJ_NAME_LEN];
519   __u32 ifindex;
520   __u32 : 32;
521   __u64 netns_dev;
522   __u64 netns_ino;
523   __u32 btf_id;
524   __u32 btf_key_type_id;
525   __u32 btf_value_type_id;
526 } __attribute__((aligned(8)));
527 struct bpf_btf_info {
528   __aligned_u64 btf;
529   __u32 btf_size;
530   __u32 id;
531 } __attribute__((aligned(8)));
532 struct bpf_sock_addr {
533   __u32 user_family;
534   __u32 user_ip4;
535   __u32 user_ip6[4];
536   __u32 user_port;
537   __u32 family;
538   __u32 type;
539   __u32 protocol;
540   __u32 msg_src_ip4;
541   __u32 msg_src_ip6[4];
542 };
543 struct bpf_sock_ops {
544   __u32 op;
545   union {
546     __u32 args[4];
547     __u32 reply;
548     __u32 replylong[4];
549   };
550   __u32 family;
551   __u32 remote_ip4;
552   __u32 local_ip4;
553   __u32 remote_ip6[4];
554   __u32 local_ip6[4];
555   __u32 remote_port;
556   __u32 local_port;
557   __u32 is_fullsock;
558   __u32 snd_cwnd;
559   __u32 srtt_us;
560   __u32 bpf_sock_ops_cb_flags;
561   __u32 state;
562   __u32 rtt_min;
563   __u32 snd_ssthresh;
564   __u32 rcv_nxt;
565   __u32 snd_nxt;
566   __u32 snd_una;
567   __u32 mss_cache;
568   __u32 ecn_flags;
569   __u32 rate_delivered;
570   __u32 rate_interval_us;
571   __u32 packets_out;
572   __u32 retrans_out;
573   __u32 total_retrans;
574   __u32 segs_in;
575   __u32 data_segs_in;
576   __u32 segs_out;
577   __u32 data_segs_out;
578   __u32 lost_out;
579   __u32 sacked_out;
580   __u32 sk_txhash;
581   __u64 bytes_received;
582   __u64 bytes_acked;
583 };
584 #define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0)
585 #define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1)
586 #define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2)
587 #define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7
588 enum {
589   BPF_SOCK_OPS_VOID,
590   BPF_SOCK_OPS_TIMEOUT_INIT,
591   BPF_SOCK_OPS_RWND_INIT,
592   BPF_SOCK_OPS_TCP_CONNECT_CB,
593   BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB,
594   BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB,
595   BPF_SOCK_OPS_NEEDS_ECN,
596   BPF_SOCK_OPS_BASE_RTT,
597   BPF_SOCK_OPS_RTO_CB,
598   BPF_SOCK_OPS_RETRANS_CB,
599   BPF_SOCK_OPS_STATE_CB,
600   BPF_SOCK_OPS_TCP_LISTEN_CB,
601 };
602 enum {
603   BPF_TCP_ESTABLISHED = 1,
604   BPF_TCP_SYN_SENT,
605   BPF_TCP_SYN_RECV,
606   BPF_TCP_FIN_WAIT1,
607   BPF_TCP_FIN_WAIT2,
608   BPF_TCP_TIME_WAIT,
609   BPF_TCP_CLOSE,
610   BPF_TCP_CLOSE_WAIT,
611   BPF_TCP_LAST_ACK,
612   BPF_TCP_LISTEN,
613   BPF_TCP_CLOSING,
614   BPF_TCP_NEW_SYN_RECV,
615   BPF_TCP_MAX_STATES
616 };
617 #define TCP_BPF_IW 1001
618 #define TCP_BPF_SNDCWND_CLAMP 1002
619 struct bpf_perf_event_value {
620   __u64 counter;
621   __u64 enabled;
622   __u64 running;
623 };
624 #define BPF_DEVCG_ACC_MKNOD (1ULL << 0)
625 #define BPF_DEVCG_ACC_READ (1ULL << 1)
626 #define BPF_DEVCG_ACC_WRITE (1ULL << 2)
627 #define BPF_DEVCG_DEV_BLOCK (1ULL << 0)
628 #define BPF_DEVCG_DEV_CHAR (1ULL << 1)
629 struct bpf_cgroup_dev_ctx {
630   __u32 access_type;
631   __u32 major;
632   __u32 minor;
633 };
634 struct bpf_raw_tracepoint_args {
635   __u64 args[0];
636 };
637 #define BPF_FIB_LOOKUP_DIRECT BIT(0)
638 #define BPF_FIB_LOOKUP_OUTPUT BIT(1)
639 enum {
640   BPF_FIB_LKUP_RET_SUCCESS,
641   BPF_FIB_LKUP_RET_BLACKHOLE,
642   BPF_FIB_LKUP_RET_UNREACHABLE,
643   BPF_FIB_LKUP_RET_PROHIBIT,
644   BPF_FIB_LKUP_RET_NOT_FWDED,
645   BPF_FIB_LKUP_RET_FWD_DISABLED,
646   BPF_FIB_LKUP_RET_UNSUPP_LWT,
647   BPF_FIB_LKUP_RET_NO_NEIGH,
648   BPF_FIB_LKUP_RET_FRAG_NEEDED,
649 };
650 struct bpf_fib_lookup {
651   __u8 family;
652   __u8 l4_protocol;
653   __be16 sport;
654   __be16 dport;
655   __u16 tot_len;
656   __u32 ifindex;
657   union {
658     __u8 tos;
659     __be32 flowinfo;
660     __u32 rt_metric;
661   };
662   union {
663     __be32 ipv4_src;
664     __u32 ipv6_src[4];
665   };
666   union {
667     __be32 ipv4_dst;
668     __u32 ipv6_dst[4];
669   };
670   __be16 h_vlan_proto;
671   __be16 h_vlan_TCI;
672   __u8 smac[6];
673   __u8 dmac[6];
674 };
675 enum bpf_task_fd_type {
676   BPF_FD_TYPE_RAW_TRACEPOINT,
677   BPF_FD_TYPE_TRACEPOINT,
678   BPF_FD_TYPE_KPROBE,
679   BPF_FD_TYPE_KRETPROBE,
680   BPF_FD_TYPE_UPROBE,
681   BPF_FD_TYPE_URETPROBE,
682 };
683 struct bpf_flow_keys {
684   __u16 nhoff;
685   __u16 thoff;
686   __u16 addr_proto;
687   __u8 is_frag;
688   __u8 is_first_frag;
689   __u8 is_encap;
690   __u8 ip_proto;
691   __be16 n_proto;
692   __be16 sport;
693   __be16 dport;
694   union {
695     struct {
696       __be32 ipv4_src;
697       __be32 ipv4_dst;
698     };
699     struct {
700       __u32 ipv6_src[4];
701       __u32 ipv6_dst[4];
702     };
703   };
704 };
705 struct bpf_func_info {
706   __u32 insn_off;
707   __u32 type_id;
708 };
709 #define BPF_LINE_INFO_LINE_NUM(line_col) ((line_col) >> 10)
710 #define BPF_LINE_INFO_LINE_COL(line_col) ((line_col) & 0x3ff)
711 struct bpf_line_info {
712   __u32 insn_off;
713   __u32 file_name_off;
714   __u32 line_off;
715   __u32 line_col;
716 };
717 #endif
718