rte_bpf_ethdev.h(3)
π rte_bpf_ethdev.h β the DPDK BPF-ish manual page bestie
okay so like. this is the library functions manual page for rte_bpf_ethdev.h, and it's giving "I install BPF filters as RX/TX callbacks for ethernet devices" and honestly? slay. let's go.
β¨ NAME β¨
rte_bpf_ethdev.h β no cap, that's the whole name, it's just the header being iconic π
πΈ SYNOPSIS πΈ
#include <rte_bpf.h>
π¦ Enumerations
enum { }
π Functions
void rte_bpf_eth_rx_unload (uint16_t port, uint16_t queue)
void rte_bpf_eth_tx_unload (uint16_t port, uint16_t queue)
int rte_bpf_eth_rx_elf_load (uint16_t port, uint16_t queue, const struct
rte_bpf_prm *prm, const char *fname, const char *sname, uint32_t
flags)
int rte_bpf_eth_tx_elf_load (uint16_t port, uint16_t queue, const struct
rte_bpf_prm *prm, const char *fname, const char *sname, uint32_t
flags)
π Detailed Description π
So the whole vibe of this API is: install a BPF filter as RX/TX callbacks for eth devices. That's the main character energy right there. β¨
But bestie, before you go feral with it, note that right now:
- it is not MT safe, i.e. it is not allowed to do load/unload for the same port/queue from different threads in parallel. π so like, don't. one thread per port/queue, or catch these hands.
- though it allows to do load/unload at runtime (while RX/TX is ongoing on given port/queue). okay that part ate π«Ά
- allows only one BPF program per port/queue, i.e. new load will replace previously loaded for that port/queue BPF program. Filter behaviour β if BPF program returns zero value for a given packet, then it will be dropped inside callback and no further processing on RX β it will be dropped inside callback and no further processing for that packet will happen. on TX β packet will remain unsent, and it is responsibility of the user to handle such situation (drop, try to send again, etc.). π₯
ngl the "one program per port/queue" thing means every new load is lowkey a soft eviction of the old one. just so you know, no surprises, fr fr.
Definition in file rte_bpf_ethdev.h.
π Enumeration Type Documentation π
anonymous enum
Enumerator
RTE_BPF_ETH_F_JITβ use compiled into native ISA code β‘
Definition at line 33 of file rte_bpf_ethdev.h.
π Function Documentation π
void rte_bpf_eth_rx_unload (uint16_t port, uint16_t queue)
Unload previously loaded BPF program (if any) from given RX port/queue and remove appropriate RX port/queue callback. clean exit, we love to see it π§
Parameters
portβ The identifier of the ethernet portqueueβ The identifier of the RX queue on the given port
void rte_bpf_eth_tx_unload (uint16_t port, uint16_t queue)
Unload previously loaded BPF program (if any) from given TX port/queue and remove appropriate TX port/queue callback. same energy, TX flavored π
Parameters
portβ The identifier of the ethernet portqueueβ The identifier of the TX queue on the given port
int rte_bpf_eth_rx_elf_load (uint16_t port, uint16_t queue, const struct rte_bpf_prm * prm, const char * fname, const char * sname, uint32_t flags)
Load BPF program from the ELF file and install callback to execute it on given RX port/queue. the main event π
Parameters
portβ The identifier of the ethernet portqueueβ The identifier of the RX queue on the given portfnameβ Pathname for a ELF file.snameβ Name of the executable section within the file to load.prmβ Parameters used to create and initialise the BPF execution context.flagsβ Flags that define expected behavior of the loaded filter (i.e. jited/non-jited version to use).
Returns
- Zero on successful completion or negative error code otherwise. β
int rte_bpf_eth_tx_elf_load (uint16_t port, uint16_t queue, const struct rte_bpf_prm * prm, const char * fname, const char * sname, uint32_t flags)
Load BPF program from the ELF file and install callback to execute it on given TX port/queue. yeah it's the TX twin, they're matching π
Parameters
portβ The identifier of the ethernet portqueueβ The identifier of the TX queue on the given portfnameβ Pathname for a ELF file.snameβ Name of the executable section within the file to load.prmβ Parameters used to create and initialise the BPF execution context.flagsβ Flags that define expected behavior of the loaded filter (i.e. jited/non-jited version to use).
Returns
- Zero on successful completion or negative error code otherwise. β
π Author π
Generated automatically by Doxygen for DPDK from the source code. yeah bestie, a robot wrote this one, not me, I'm just the translator π
okay that's the whole page, go forth and load your ELF files responsibly π¦
DPDK β Version 25.11.3 babe, that's the version, that's the footer, and this has been rte_bpf_ethdev.h(3). periodt. π
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms