---
name: "rte_bpf_ethdev.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_bpf_ethdev.h"
---

# rte\_bpf\_ethdev.h(3)

## NAME

rte\_bpf\_ethdev.h

## SYNOPSIS

`#include <rte_bpf.h>`\

### 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

API to install BPF filter as RX/TX callbacks for eth devices. 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.

- •

  though it allows to do load/unload at runtime (while RX/TX is ongoing on given port/queue).

- •

  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.).

Definition in 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.

**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.

**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.

**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.

**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.
