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 port
  • queue β€” 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 port
  • queue β€” 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 port
  • queue β€” The identifier of the RX queue on the given port
  • fname β€” 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 port
  • queue β€” The identifier of the TX queue on the given port
  • fname β€” 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