numam-dpdk/lib/librte_bpf/bpf_impl.h
Konstantin Ananyev 94972f35a0 bpf: add BPF loading and execution framework
librte_bpf provides a framework to load and execute eBPF bytecode
inside user-space dpdk based applications.
It supports basic set of features from eBPF spec
(https://www.kernel.org/doc/Documentation/networking/filter.txt).

Not currently supported features:
 - JIT
 - cBPF
 - tail-pointer call
 - eBPF MAP
 - skb
 - function calls for 32-bit apps
 - mbuf pointer as input parameter for 32-bit apps

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-12 00:35:15 +02:00

42 lines
677 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Intel Corporation
*/
#ifndef _BPF_H_
#define _BPF_H_
#include <rte_bpf.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_BPF_STACK_SIZE 0x200
struct rte_bpf {
struct rte_bpf_prm prm;
struct rte_bpf_jit jit;
size_t sz;
uint32_t stack_sz;
};
extern int bpf_validate(struct rte_bpf *bpf);
extern int bpf_jit(struct rte_bpf *bpf);
#ifdef RTE_ARCH_X86_64
extern int bpf_jit_x86(struct rte_bpf *);
#endif
extern int rte_bpf_logtype;
#define RTE_BPF_LOG(lvl, fmt, args...) \
rte_log(RTE_LOG_## lvl, rte_bpf_logtype, fmt, ##args)
#ifdef __cplusplus
}
#endif
#endif /* _BPF_H_ */