1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 * Copyright 2017 Mellanox Technologies, Ltd
8 #include <tap_autoconf.h>
10 /* Do not #include <linux/bpf.h> since eBPF must compile on different
11 * distros which may include partial definitions for eBPF (while the
12 * kernel itself may support eBPF). Instead define here all that is needed
15 /* BPF_MAP_UPDATE_ELEM command flags */
16 #define BPF_ANY 0 /* create a new element or update an existing */
18 /* BPF architecture instruction struct */
24 __s32 imm; /* immediate value */
27 /* BPF program types */
30 BPF_PROG_TYPE_SOCKET_FILTER,
32 BPF_PROG_TYPE_SCHED_CLS,
33 BPF_PROG_TYPE_SCHED_ACT,
36 /* BPF commands types */
52 /* union of anonymous structs used with TAP BPF commands */
54 /* BPF_MAP_CREATE command */
64 /* BPF_MAP_UPDATE_ELEM, BPF_MAP_DELETE_ELEM commands */
70 __aligned_u64 next_key;
75 /* BPF_PROG_LOAD command */
80 __aligned_u64 license;
83 __aligned_u64 log_buf;
90 # if defined(__i386__)
92 # elif defined(__x86_64__)
94 # elif defined(__arm__)
96 # elif defined(__aarch64__)
98 # elif defined(__sparc__)
100 # elif defined(__s390__)
101 # define __NR_bpf 351
102 # elif defined(__powerpc__)
103 # define __NR_bpf 361
105 # error __NR_bpf not defined
114 static int bpf_load(enum bpf_prog_type type, const struct bpf_insn *insns,
115 size_t insns_cnt, const char *license);
117 #endif /* __TAP_BPF_H__ */