---
name: "rte_pdump_enable_bpf"
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_pdump.h"
---

# rte\_pdump\_enable\_bpf(3)

Part of [rte\_pdump.h(3)](/rte_pdump.h/3.md).

## NAME

rte\_pdump.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <rte_bpf.h>`\

### Data Structures

struct **rte\_pdump\_stats**\

### Functions

int **rte\_pdump\_init** (void)\
 int **rte\_pdump\_uninit** (void)\
 int **rte\_pdump\_enable** (uint16\_t port, uint16\_t queue, uint32\_t flags, struct **rte\_ring** \*ring, struct **rte\_mempool** \*mp, void \*filter)\
 int **rte\_pdump\_enable\_bpf** (uint16\_t port\_id, uint16\_t queue, uint32\_t flags, uint32\_t snaplen, struct **rte\_ring** \*ring, struct **rte\_mempool** \*mp, const struct **rte\_bpf\_prm** \*prm)\
 int **rte\_pdump\_disable** (uint16\_t port, uint16\_t queue, uint32\_t flags)\
 int **rte\_pdump\_enable\_by\_deviceid** (char \*device\_id, uint16\_t queue, uint32\_t flags, struct **rte\_ring** \*ring, struct **rte\_mempool** \*mp, void \*filter)\
 int **rte\_pdump\_enable\_bpf\_by\_deviceid** (const char \*device\_id, uint16\_t queue, uint32\_t flags, uint32\_t snaplen, struct **rte\_ring** \*ring, struct **rte\_mempool** \*mp, const struct **rte\_bpf\_prm** \*filter)\
 int **rte\_pdump\_disable\_by\_deviceid** (char \*device\_id, uint16\_t queue, uint32\_t flags)\
 int **rte\_pdump\_stats** (uint16\_t port\_id, struct **rte\_pdump\_stats** \*stats)\

## Detailed Description

RTE pdump

packet dump library to provide packet capturing support on dpdk.

Definition in file **rte\_pdump.h**.

## Function Documentation

### int rte\_pdump\_init (void)

Initialize packet capturing handling

Register the IPC action for communication with target (primary) process.

**Returns**

0 on success, -1 on error

### int rte\_pdump\_uninit (void)

Un initialize packet capturing handling

Unregister the IPC action for communication with target (primary) process.

**Returns**

0 on success, -1 on error

### int rte\_pdump\_enable (uint16\_t port, uint16\_t queue, uint32\_t flags, struct rte\_ring \* ring, struct rte\_mempool \* mp, void \* filter)

Enables packet capturing on given port and queue.

**Parameters**

*port* port on which packet capturing should be enabled. \
 *queue* queue of a given port on which packet capturing should be enabled. users should pass on value UINT16\_MAX to enable packet capturing on all queues of a given port. \
 *flags* flags specifies RTE\_PDUMP\_FLAG\_RX/RTE\_PDUMP\_FLAG\_TX/RTE\_PDUMP\_FLAG\_RXTX on which packet capturing should be enabled for a given port and queue. \
 *ring* ring on which captured packets will be enqueued for user. \
 *mp* mempool on to which original packets will be mirrored or duplicated. \
 *filter* Unused should be NULL.

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_enable\_bpf (uint16\_t port\_id, uint16\_t queue, uint32\_t flags, uint32\_t snaplen, struct rte\_ring \* ring, struct rte\_mempool \* mp, const struct rte\_bpf\_prm \* prm)

Enables packet capturing on given port and queue with filtering.

**Parameters**

*port\_id* The Ethernet port on which packet capturing should be enabled. \
 *queue* The queue on the Ethernet port which packet capturing should be enabled. Pass UINT16\_MAX to enable packet capturing on all queues of a given port. \
 *flags* Pdump library flags that specify direction and packet format. \
 *snaplen* The upper limit on bytes to copy. Passing UINT32\_MAX means capture all the possible data. \
 *ring* The ring on which captured packets will be enqueued for user. \
 *mp* The mempool on to which original packets will be mirrored or duplicated. \
 *prm* Use BPF program to run to filter packes (can be NULL)

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_disable (uint16\_t port, uint16\_t queue, uint32\_t flags)

Disables packet capturing on given port and queue.

**Parameters**

*port* port on which packet capturing should be disabled. \
 *queue* queue of a given port on which packet capturing should be disabled. users should pass on value UINT16\_MAX to disable packet capturing on all queues of a given port. \
 *flags* flags specifies RTE\_PDUMP\_FLAG\_RX/RTE\_PDUMP\_FLAG\_TX/RTE\_PDUMP\_FLAG\_RXTX on which packet capturing should be enabled for a given port and queue.

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_enable\_by\_deviceid (char \* device\_id, uint16\_t queue, uint32\_t flags, struct rte\_ring \* ring, struct rte\_mempool \* mp, void \* filter)

Enables packet capturing on given device id and queue. device\_id can be name or pci address of device.

**Parameters**

*device\_id* device id on which packet capturing should be enabled. \
 *queue* queue of a given device id on which packet capturing should be enabled. users should pass on value UINT16\_MAX to enable packet capturing on all queues of a given device id. \
 *flags* flags specifies RTE\_PDUMP\_FLAG\_RX/RTE\_PDUMP\_FLAG\_TX/RTE\_PDUMP\_FLAG\_RXTX on which packet capturing should be enabled for a given port and queue. \
 *ring* ring on which captured packets will be enqueued for user. \
 *mp* mempool on to which original packets will be mirrored or duplicated. \
 *filter* unused should be NULL

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_enable\_bpf\_by\_deviceid (const char \* device\_id, uint16\_t queue, uint32\_t flags, uint32\_t snaplen, struct rte\_ring \* ring, struct rte\_mempool \* mp, const struct rte\_bpf\_prm \* filter)

Enables packet capturing on given device id and queue with filtering. device\_id can be name or pci address of device.

**Parameters**

*device\_id* device id on which packet capturing should be enabled. \
 *queue* The queue on the Ethernet port which packet capturing should be enabled. Pass UINT16\_MAX to enable packet capturing on all queues of a given port. \
 *flags* Pdump library flags that specify direction and packet format. \
 *snaplen* The upper limit on bytes to copy. Passing UINT32\_MAX means capture all the possible data. \
 *ring* The ring on which captured packets will be enqueued for user. \
 *mp* The mempool on to which original packets will be mirrored or duplicated. \
 *filter* Use BPF program to run to filter packes (can be NULL)

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_disable\_by\_deviceid (char \* device\_id, uint16\_t queue, uint32\_t flags)

Disables packet capturing on given device\_id and queue. device\_id can be name or pci address of device.

**Parameters**

*device\_id* pci address or name of the device on which packet capturing should be disabled. \
 *queue* queue of a given device on which packet capturing should be disabled. users should pass on value UINT16\_MAX to disable packet capturing on all queues of a given device id. \
 *flags* flags specifies RTE\_PDUMP\_FLAG\_RX/RTE\_PDUMP\_FLAG\_TX/RTE\_PDUMP\_FLAG\_RXTX on which packet capturing should be enabled for a given port and queue.

**Returns**

0 on success, -1 on error, rte\_errno is set accordingly.

### int rte\_pdump\_stats (uint16\_t port\_id, struct rte\_pdump\_stats \* stats)

Retrieve the packet capture statistics for a queue.

**Parameters**

*port\_id* The port identifier of the Ethernet device. \
 *stats* A pointer to structure of type **rte\_pdump\_stats to be filled in.**

**Returns**

**Zero if successful. -1 on error and rte\_errno is set.**

## Author

**Generated automatically by Doxygen for DPDK from the source code.**
