---
name: "rte_pie_rt_data_init"
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_pie.h"
---

# rte\_pie\_rt\_data\_init(3)

Part of [rte\_pie.h(3)](/rte_pie.h/3.md).

## NAME

rte\_pie.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <rte_random.h>`\
 `#include <rte_debug.h>`\
 `#include <rte_cycles.h>`\

### Data Structures

struct **rte\_pie\_params**\
 struct **rte\_pie\_config**\
 struct **rte\_pie**\

### Macros

\#define **RTE\_DQ\_THRESHOLD**   16384\
 \#define **RTE\_DQ\_WEIGHT**   0.25\
 \#define **RTE\_ALPHA**   0.125\
 \#define **RTE\_BETA**   1.25\
 \#define **RTE\_RAND\_MAX**   ~0LLU\

### Functions

int **rte\_pie\_rt\_data\_init** (struct **rte\_pie** \*pie)\
 Initialises run-time data.  int **rte\_pie\_config\_init** (struct **rte\_pie\_config** \*pie\_cfg, const uint16\_t qdelay\_ref, const uint16\_t dp\_update\_interval, const uint16\_t max\_burst, const uint16\_t tailq\_th)\
 Configures a single PIE configuration parameter structure.  static int **rte\_pie\_enqueue\_empty** (const struct **rte\_pie\_config** \*pie\_cfg, struct **rte\_pie** \*pie, uint32\_t pkt\_len)\
 Decides packet enqueue when queue is empty.  static void **\_calc\_drop\_probability** (const struct **rte\_pie\_config** \*pie\_cfg, struct **rte\_pie** \*pie, uint64\_t time)\
 make a decision to drop or enqueue a packet based on probability criteria  static int **\_rte\_pie\_drop** (const struct **rte\_pie\_config** \*pie\_cfg, struct **rte\_pie** \*pie)\
 make a decision to drop or enqueue a packet based on probability criteria  static int **rte\_pie\_enqueue\_nonempty** (const struct **rte\_pie\_config** \*pie\_cfg, struct **rte\_pie** \*pie, uint32\_t pkt\_len, const uint64\_t time)\
 Decides if new packet should be enqueued or dropped for non-empty queue.  static int **rte\_pie\_enqueue** (const struct **rte\_pie\_config** \*pie\_cfg, struct **rte\_pie** \*pie, const unsigned int qlen, uint32\_t pkt\_len, const uint64\_t time)\
 Decides if new packet should be enqueued or dropped Updates run time data and gives verdict whether to enqueue or drop the packet.  static void **rte\_pie\_dequeue** (struct **rte\_pie** \*pie, uint32\_t pkt\_len, uint64\_t time)\
 PIE rate estimation method Called on each packet departure.

## Detailed Description

Proportional Integral controller Enhanced (PIE)

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

## Macro Definition Documentation

### #define RTE\_DQ\_THRESHOLD 16384

Queue length threshold (2^14) to start measurement cycle (bytes)

Definition at line **25** of file **rte\_pie.h**.

### #define RTE\_DQ\_WEIGHT 0.25

Weight (RTE\_DQ\_THRESHOLD/2^16) to compute dequeue rate

Definition at line **26** of file **rte\_pie.h**.

### #define RTE\_ALPHA 0.125

Weights in drop probability calculations

Definition at line **27** of file **rte\_pie.h**.

### #define RTE\_BETA 1.25

Weights in drop probability calculations

Definition at line **28** of file **rte\_pie.h**.

### #define RTE\_RAND\_MAX ~0LLU

Max value of the random number

Definition at line **29** of file **rte\_pie.h**.

## Function Documentation

### int rte\_pie\_rt\_data\_init (struct rte\_pie \* pie)

Initialises run-time data.

**Parameters**

*pie* \[in,out\] data pointer to PIE runtime data

**Returns**

Operation status

**Return values**

*0* success \
 *!0* error

### int rte\_pie\_config\_init (struct rte\_pie\_config \* pie\_cfg, const uint16\_t qdelay\_ref, const uint16\_t dp\_update\_interval, const uint16\_t max\_burst, const uint16\_t tailq\_th)

Configures a single PIE configuration parameter structure.

**Parameters**

*pie\_cfg* \[in,out\] config pointer to a PIE configuration parameter structure \
 *qdelay\_ref* \[in\] latency target(milliseconds) \
 *dp\_update\_interval* \[in\] update interval for drop probability (milliseconds) \
 *max\_burst* \[in\] maximum burst allowance (milliseconds) \
 *tailq\_th* \[in\] tail drop threshold for the queue (number of packets)

**Returns**

Operation status

**Return values**

*0* success \
 *!0* error

### static int rte\_pie\_enqueue\_empty (const struct rte\_pie\_config \* pie\_cfg, struct rte\_pie \* pie, uint32\_t pkt\_len)` [static]`

Decides packet enqueue when queue is empty. Note: packet is never dropped in this particular case.

**Parameters**

*pie\_cfg* \[in\] config pointer to a PIE configuration parameter structure \
 *pie* \[in, out\] data pointer to PIE runtime data \
 *pkt\_len* \[in\] packet length in bytes

**Returns**

Operation status

**Return values**

*0* enqueue the packet \
 *!0* drop the packet

If the queue has been idle for a while, turn off PIE and Reset counters

Definition at line **116** of file **rte\_pie.h**.

### static void \_calc\_drop\_probability (const struct rte\_pie\_config \* pie\_cfg, struct rte\_pie \* pie, uint64\_t time)` [static]`

make a decision to drop or enqueue a packet based on probability criteria

**Parameters**

*pie\_cfg* \[in\] config pointer to a PIE configuration parameter structure \
 *pie* \[in, out\] data pointer to PIE runtime data \
 *time* \[in\] current time (measured in cpu cycles)

Definition at line **147** of file **rte\_pie.h**.

### static int \_rte\_pie\_drop (const struct rte\_pie\_config \* pie\_cfg, struct rte\_pie \* pie)` [inline]`, ` [static]`

make a decision to drop or enqueue a packet based on probability criteria

**Parameters**

*pie\_cfg* \[in\] config pointer to a PIE configuration parameter structure \
 *pie* \[in, out\] data pointer to PIE runtime data

**Returns**

operation status

**Return values**

*0* enqueue the packet \
 *1* drop the packet

Definition at line **210** of file **rte\_pie.h**.

### static int rte\_pie\_enqueue\_nonempty (const struct rte\_pie\_config \* pie\_cfg, struct rte\_pie \* pie, uint32\_t pkt\_len, const uint64\_t time)` [inline]`, ` [static]`

Decides if new packet should be enqueued or dropped for non-empty queue.

**Parameters**

*pie\_cfg* \[in\] config pointer to a PIE configuration parameter structure \
 *pie* \[in,out\] data pointer to PIE runtime data \
 *pkt\_len* \[in\] packet length in bytes \
 *time* \[in\] current time (measured in cpu cycles)

**Returns**

Operation status

**Return values**

*0* enqueue the packet \
 *1* drop the packet based on max threshold criterion \
 *2* drop the packet based on mark probability criterion

Definition at line **258** of file **rte\_pie.h**.

### static int rte\_pie\_enqueue (const struct rte\_pie\_config \* pie\_cfg, struct rte\_pie \* pie, const unsigned int qlen, uint32\_t pkt\_len, const uint64\_t time)` [inline]`, ` [static]`

Decides if new packet should be enqueued or dropped Updates run time data and gives verdict whether to enqueue or drop the packet.

**Parameters**

*pie\_cfg* \[in\] config pointer to a PIE configuration parameter structure \
 *pie* \[in,out\] data pointer to PIE runtime data \
 *qlen* \[in\] queue length \
 *pkt\_len* \[in\] packet length in bytes \
 *time* \[in\] current time stamp (measured in cpu cycles)

**Returns**

Operation status

**Return values**

*0* enqueue the packet \
 *1* drop the packet based on drop probability criteria

Definition at line **325** of file **rte\_pie.h**.

### static void rte\_pie\_dequeue (struct rte\_pie \* pie, uint32\_t pkt\_len, uint64\_t time)` [inline]`, ` [static]`

PIE rate estimation method Called on each packet departure.

**Parameters**

*pie* \[in\] data pointer to PIE runtime data \
 *pkt\_len* \[in\] packet length in bytes \
 *time* \[in\] current time stamp in cpu cycles

Definition at line **349** of file **rte\_pie.h**.

## Author

Generated automatically by Doxygen for DPDK from the source code.
