bpf.h revision 05d08e9716b5974d6ed08973f44930804890b902
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
42enum {
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
61struct 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};
70enum 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};
82enum bpf_map_type {
83/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84  BPF_MAP_TYPE_UNSPEC,
85  BPF_MAP_TYPE_HASH,
86  BPF_MAP_TYPE_ARRAY,
87  BPF_MAP_TYPE_PROG_ARRAY,
88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89  BPF_MAP_TYPE_PERF_EVENT_ARRAY,
90};
91enum bpf_prog_type {
92  BPF_PROG_TYPE_UNSPEC,
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94  BPF_PROG_TYPE_SOCKET_FILTER,
95  BPF_PROG_TYPE_KPROBE,
96  BPF_PROG_TYPE_SCHED_CLS,
97  BPF_PROG_TYPE_SCHED_ACT,
98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99};
100#define BPF_PSEUDO_MAP_FD 1
101#define BPF_ANY 0
102#define BPF_NOEXIST 1
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104#define BPF_EXIST 2
105union bpf_attr {
106  struct {
107    __u32 map_type;
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109    __u32 key_size;
110    __u32 value_size;
111    __u32 max_entries;
112  };
113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114  struct {
115    __u32 map_fd;
116    __aligned_u64 key;
117    union {
118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119      __aligned_u64 value;
120      __aligned_u64 next_key;
121    };
122    __u64 flags;
123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124  };
125  struct {
126    __u32 prog_type;
127    __u32 insn_cnt;
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129    __aligned_u64 insns;
130    __aligned_u64 license;
131    __u32 log_level;
132    __u32 log_size;
133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134    __aligned_u64 log_buf;
135    __u32 kern_version;
136  };
137  struct {
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139    __aligned_u64 pathname;
140    __u32 bpf_fd;
141  };
142} __attribute__((aligned(8)));
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144enum bpf_func_id {
145  BPF_FUNC_unspec,
146  BPF_FUNC_map_lookup_elem,
147  BPF_FUNC_map_update_elem,
148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149  BPF_FUNC_map_delete_elem,
150  BPF_FUNC_probe_read,
151  BPF_FUNC_ktime_get_ns,
152  BPF_FUNC_trace_printk,
153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154  BPF_FUNC_get_prandom_u32,
155  BPF_FUNC_get_smp_processor_id,
156  BPF_FUNC_skb_store_bytes,
157  BPF_FUNC_l3_csum_replace,
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159  BPF_FUNC_l4_csum_replace,
160  BPF_FUNC_tail_call,
161  BPF_FUNC_clone_redirect,
162  BPF_FUNC_get_current_pid_tgid,
163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164  BPF_FUNC_get_current_uid_gid,
165  BPF_FUNC_get_current_comm,
166  BPF_FUNC_get_cgroup_classid,
167  BPF_FUNC_skb_vlan_push,
168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169  BPF_FUNC_skb_vlan_pop,
170  BPF_FUNC_skb_get_tunnel_key,
171  BPF_FUNC_skb_set_tunnel_key,
172  BPF_FUNC_perf_event_read,
173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174  BPF_FUNC_redirect,
175  BPF_FUNC_get_route_realm,
176  BPF_FUNC_perf_event_output,
177  __BPF_FUNC_MAX_ID,
178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179};
180struct __sk_buff {
181  __u32 len;
182  __u32 pkt_type;
183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184  __u32 mark;
185  __u32 queue_mapping;
186  __u32 protocol;
187  __u32 vlan_present;
188/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189  __u32 vlan_tci;
190  __u32 vlan_proto;
191  __u32 priority;
192  __u32 ingress_ifindex;
193/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194  __u32 ifindex;
195  __u32 tc_index;
196  __u32 cb[5];
197  __u32 hash;
198/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199  __u32 tc_classid;
200};
201struct bpf_tunnel_key {
202  __u32 tunnel_id;
203/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204  __u32 remote_ipv4;
205};
206#endif
207