voidrte_bpf_destroy(structrte_bpf*bpf)
De-allocate all memory used by this eBPF execution context.
Parametersbpf BPF handle to destroy.
structrte_bpf*rte_bpf_load(conststructrte_bpf_prm*prm)
Create a new eBPF execution context and load given BPF code into it.
Parametersprm Parameters used to create and initialise the BPF execution context.
Returns
BPF handle that is used in future BPF operations, or NULL on error, with error code set in rte_errno.
Possible rte_errno errors include:
• EINVAL - invalid parameter passed to function
• ENOMEM - can't reserve enough memory
structrte_bpf*rte_bpf_elf_load(conststructrte_bpf_prm*prm,constchar*fname,constchar*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.
Parametersprm 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.
Returns
BPF handle that is used in future BPF operations, or NULL on error, with error code set in rte_errno.
Possible rte_errno errors include:
• EINVAL - invalid parameter passed to function
• ENOMEM - can't reserve enough memory
uint64_trte_bpf_exec(conststructrte_bpf*bpf,void*ctx)
Execute given BPF bytecode.
Parametersbpf handle for the BPF code to execute.
ctx pointer to input context.
Returns
BPF execution return value.
uint32_trte_bpf_exec_burst(conststructrte_bpf*bpf,void*ctx[],uint64_trc[],uint32_tnum)
Execute given BPF bytecode over a set of input contexts.
Parametersbpf 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[]).
Returns
number of successfully processed inputs.
intrte_bpf_get_jit(conststructrte_bpf*bpf,structrte_bpf_jit*jit)
Provide information about natively compiled code for given BPF handle.
Parametersbpf handle for the BPF code.
jit pointer to the rte_bpf_jit structure to be filled with related data.
Returns
• -EINVAL if the parameters are invalid.
• Zero if operation completed successfully.
voidrte_bpf_dump(FILE*f,conststructebpf_insn*buf,uint32_tlen)
Dump epf instructions to a file.
Parametersf A pointer to a file for output
buf A pointer to BPF instructions
len Number of BPF instructions to dump.
structrte_bpf_prm*rte_bpf_convert(conststructbpf_program*prog)
Convert a Classic BPF program from libpcap into a DPDK BPF code.
Parametersprog Classic BPF program from pcap_compile().
Returns
Pointer to BPF program (allocated with rte_malloc) that is used in future BPF operations, or NULL on
error, with error code set in rte_errno. Possible rte_errno errors include:
• EINVAL - invalid parameter passed to function
• ENOMEM - can't reserve enough memory
• ENOTSUP - operation not supported