|
DPDK 25.11.0
|
Go to the source code of this file.
Data Structures | |
| struct | rte_bpf_arg |
| struct | rte_bpf_xsym |
| struct | rte_bpf_prm |
| struct | rte_bpf_jit |
Macros | |
| #define | RTE_BPF_ARG_PTR_TYPE(x) |
Enumerations | |
| enum | rte_bpf_arg_type { RTE_BPF_ARG_UNDEF , RTE_BPF_ARG_RAW , RTE_BPF_ARG_PTR = 0x10 , RTE_BPF_ARG_PTR_MBUF , RTE_BPF_ARG_RESERVED } |
| enum | rte_bpf_xtype { RTE_BPF_XTYPE_FUNC , RTE_BPF_XTYPE_VAR } |
Functions | |
| void | rte_bpf_destroy (struct rte_bpf *bpf) |
| struct rte_bpf * | rte_bpf_load (const struct rte_bpf_prm *prm) __rte_malloc __rte_dealloc(rte_bpf_destroy |
| struct rte_bpf struct rte_bpf * | rte_bpf_elf_load (const struct rte_bpf_prm *prm, const char *fname, const char *sname) __rte_malloc __rte_dealloc(rte_bpf_destroy |
| struct rte_bpf struct rte_bpf uint64_t | rte_bpf_exec (const struct rte_bpf *bpf, void *ctx) |
| uint32_t | rte_bpf_exec_burst (const struct rte_bpf *bpf, void *ctx[], uint64_t rc[], uint32_t num) |
| int | rte_bpf_get_jit (const struct rte_bpf *bpf, struct rte_bpf_jit *jit) |
| void | rte_bpf_dump (FILE *f, const struct ebpf_insn *buf, uint32_t len) |
| struct rte_bpf_prm * | rte_bpf_convert (const struct bpf_program *prog) __rte_malloc __rte_dealloc_free |
RTE BPF support.
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).
Definition in file rte_bpf.h.
| #define RTE_BPF_ARG_PTR_TYPE | ( | x | ) |
determine is argument a pointer
| enum rte_bpf_arg_type |
| enum rte_bpf_xtype |
| void rte_bpf_destroy | ( | struct rte_bpf * | bpf | ) |
De-allocate all memory used by this eBPF execution context.
| bpf | BPF handle to destroy. |
| struct rte_bpf * rte_bpf_load | ( | const struct rte_bpf_prm * | prm | ) |
Create a new eBPF execution context and load given BPF code into it.
| prm | Parameters used to create and initialise the BPF execution context. |
| struct rte_bpf struct rte_bpf * rte_bpf_elf_load | ( | const struct rte_bpf_prm * | prm, |
| const char * | fname, | ||
| const char * | sname ) |
Create a new eBPF execution context and load BPF code from given ELF file into it. Note that if the function will encounter EBPF_PSEUDO_CALL instruction that references external symbol, it will treat is as standard BPF_CALL to the external helper function.
| prm | Parameters used to create and initialise the BPF execution context. |
| fname | Pathname for a ELF file. |
| sname | Name of the executable section within the file to load. |
| struct rte_bpf struct rte_bpf uint64_t rte_bpf_exec | ( | const struct rte_bpf * | bpf, |
| void * | ctx ) |
Execute given BPF bytecode.
| bpf | handle for the BPF code to execute. |
| ctx | pointer to input context. |
| uint32_t rte_bpf_exec_burst | ( | const struct rte_bpf * | bpf, |
| void * | ctx[], | ||
| uint64_t | rc[], | ||
| uint32_t | num ) |
Execute given BPF bytecode over a set of input contexts.
| bpf | handle for the BPF code to execute. |
| ctx | array of pointers to the input contexts. |
| rc | array of return values (one per input). |
| num | number of elements in ctx[] (and rc[]). |
| int rte_bpf_get_jit | ( | const struct rte_bpf * | bpf, |
| struct rte_bpf_jit * | jit ) |
Provide information about natively compiled code for given BPF handle.
| bpf | handle for the BPF code. |
| jit | pointer to the rte_bpf_jit structure to be filled with related data. |
| void rte_bpf_dump | ( | FILE * | f, |
| const struct ebpf_insn * | buf, | ||
| uint32_t | len ) |
Dump epf instructions to a file.
| f | A pointer to a file for output |
| buf | A pointer to BPF instructions |
| len | Number of BPF instructions to dump. |
| struct rte_bpf_prm * rte_bpf_convert | ( | const struct bpf_program * | prog | ) |
Convert a Classic BPF program from libpcap into a DPDK BPF code.
| prog | Classic BPF program from pcap_compile(). |