---
name: "rte_sched_port_get_memory_footprint"
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_sched.h"
---

# rte\_sched\_port\_get\_memory\_footprint(3)

Part of [rte\_sched.h(3)](/rte_sched.h/3.md).

## NAME

rte\_sched.h

## SYNOPSIS

`#include <rte_mbuf.h>`\
 `#include <rte_meter.h>`\
 `#include 'rte_red.h'`\
 `#include 'rte_pie.h'`\

### Data Structures

struct **rte\_sched\_subport\_stats**\
 struct **rte\_sched\_queue\_stats**\
 struct **rte\_sched\_port\_params**\

### Macros

\#define **RTE\_SCHED\_QUEUES\_PER\_PIPE**   16\
 \#define **RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE**   4\
 \#define **RTE\_SCHED\_TRAFFIC\_CLASSES\_PER\_PIPE**   (**RTE\_SCHED\_QUEUES\_PER\_PIPE** - **RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE** + 1)\
 \#define **RTE\_SCHED\_TRAFFIC\_CLASS\_BE**   (**RTE\_SCHED\_TRAFFIC\_CLASSES\_PER\_PIPE** - 1)\

### Enumerations

enum **rte\_sched\_cman\_mode** { **RTE\_SCHED\_CMAN\_RED**, **RTE\_SCHED\_CMAN\_PIE** }\

### Functions

struct rte\_sched\_port \* **rte\_sched\_port\_config** (struct **rte\_sched\_port\_params** \*params)\
 void **rte\_sched\_port\_free** (struct rte\_sched\_port \*port)\
 int **rte\_sched\_subport\_pipe\_profile\_add** (struct rte\_sched\_port \*port, uint32\_t subport\_id, struct rte\_sched\_pipe\_params \*params, uint32\_t \*pipe\_profile\_id)\
 int **rte\_sched\_port\_subport\_profile\_add** (struct rte\_sched\_port \*port, struct rte\_sched\_subport\_profile\_params \*profile, uint32\_t \*subport\_profile\_id)\
 int **rte\_sched\_subport\_config** (struct rte\_sched\_port \*port, uint32\_t subport\_id, struct rte\_sched\_subport\_params \*params, uint32\_t subport\_profile\_id)\
 int **rte\_sched\_pipe\_config** (struct rte\_sched\_port \*port, uint32\_t subport\_id, uint32\_t pipe\_id, int32\_t pipe\_profile)\
 uint32\_t **rte\_sched\_port\_get\_memory\_footprint** (struct **rte\_sched\_port\_params** \*port\_params, struct rte\_sched\_subport\_params \*\*subport\_params)\
 int **rte\_sched\_subport\_read\_stats** (struct rte\_sched\_port \*port, uint32\_t subport\_id, struct **rte\_sched\_subport\_stats** \*stats, uint32\_t \*tc\_ov)\
 int **rte\_sched\_queue\_read\_stats** (struct rte\_sched\_port \*port, uint32\_t queue\_id, struct **rte\_sched\_queue\_stats** \*stats, uint16\_t \*qlen)\
 void **rte\_sched\_port\_pkt\_write** (struct rte\_sched\_port \*port, struct **rte\_mbuf** \*pkt, uint32\_t subport, uint32\_t pipe, uint32\_t traffic\_class, uint32\_t queue, enum **rte\_color** color)\
 void **rte\_sched\_port\_pkt\_read\_tree\_path** (struct rte\_sched\_port \*port, const struct **rte\_mbuf** \*pkt, uint32\_t \*subport, uint32\_t \*pipe, uint32\_t \*traffic\_class, uint32\_t \*queue)\
 int **rte\_sched\_port\_enqueue** (struct rte\_sched\_port \*port, struct **rte\_mbuf** \*\*pkts, uint32\_t n\_pkts)\
 int **rte\_sched\_port\_dequeue** (struct rte\_sched\_port \*port, struct **rte\_mbuf** \*\*pkts, uint32\_t n\_pkts)\
 int **rte\_sched\_subport\_tc\_ov\_config** (struct rte\_sched\_port \*port, uint32\_t subport\_id, bool tc\_ov\_enable)\

## Detailed Description

RTE Hierarchical Scheduler

The hierarchical scheduler prioritizes the transmission of packets from different users and traffic classes according to the Service Level Agreements (SLAs) defined for the current network node.

The scheduler supports thousands of packet queues grouped under a 5-level hierarchy:

- 1\.

  Port:

- •

  Typical usage: output Ethernet port;

- •

  Multiple ports are scheduled in round robin order with equal priority;

- 2\.

  Subport:

- •

  Typical usage: group of users;

- •

  Traffic shaping using the token bucket algorithm (one bucket per subport);

- •

  Upper limit enforced per traffic class at subport level;

- •

  Lower priority traffic classes able to reuse subport bandwidth currently unused by higher priority traffic classes of the same subport;

- •

  When any subport traffic class is oversubscribed (configuration time event), the usage of subport member pipes with high demand for that traffic class pipes is truncated to a dynamically adjusted value with no impact to low demand pipes;

- 3\.

  Pipe:

- •

  Typical usage: individual user/subscriber;

- •

  Traffic shaping using the token bucket algorithm (one bucket per pipe);

- 4\.

  Traffic class:

- •

  Traffic classes of the same pipe handled in strict priority order;

- •

  Upper limit enforced per traffic class at the pipe level;

- •

  Lower priority traffic classes able to reuse pipe bandwidth currently unused by higher priority traffic classes of the same pipe;

- 5\.

  Queue:

- •

  Typical usage: queue hosting packets from one or multiple connections of same traffic class belonging to the same user;

- •

  Weighted Round Robin (WRR) is used to service the queues within same pipe lowest priority traffic class (best-effort).

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

## Macro Definition Documentation

### #define RTE\_SCHED\_QUEUES\_PER\_PIPE 16

Congestion Management Maximum number of queues per pipe. Note that the multiple queues (power of 2) can only be assigned to lowest priority (best-effort) traffic class. Other higher priority traffic classes can only have one queue. Can not change.

**See also**

struct **rte\_sched\_port\_params**

Definition at line **73** of file **rte\_sched.h**.

### #define RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE 4

Number of WRR queues for best-effort traffic class per pipe.

**See also**

struct rte\_sched\_pipe\_params

Definition at line **79** of file **rte\_sched.h**.

### #define RTE\_SCHED\_TRAFFIC\_CLASSES\_PER\_PIPE (RTE\_SCHED\_QUEUES\_PER\_PIPE - RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE + 1)

Number of traffic classes per pipe (as well as subport).

**See also**

struct rte\_sched\_subport\_params

struct rte\_sched\_pipe\_params

Definition at line **85** of file **rte\_sched.h**.

### #define RTE\_SCHED\_TRAFFIC\_CLASS\_BE (RTE\_SCHED\_TRAFFIC\_CLASSES\_PER\_PIPE - 1)

Best-effort traffic class ID Can not change.

Definition at line **91** of file **rte\_sched.h**.

## Enumeration Type Documentation

### enum rte\_sched\_cman\_mode

Congestion Management (CMAN) mode

This is used for controlling the admission of packets into a packet queue or group of packet queues on congestion.

The *Random Early Detection (RED)* algorithm works by proactively dropping more and more input packets as the queue occupancy builds up. When the queue is full or almost full, RED effectively works as *tail drop*. The *Weighted RED* algorithm uses a separate set of RED thresholds for each packet color.

Similar to RED, Proportional Integral Controller Enhanced (PIE) randomly drops a packet at the onset of the congestion and tries to control the latency around the target value. The congestion detection, however, is based on the queueing latency instead of the queue length like RED. For more information, refer RFC8033.

**Enumerator**

- *RTE\_SCHED\_CMAN\_RED*

  *Random Early Detection (RED)*

- *RTE\_SCHED\_CMAN\_PIE*

  *Proportional Integral Controller Enhanced (PIE)*

*Definition at line* **126** *of file* **rte\_sched.h***.*

## Function Documentation

### struct rte\_sched\_port \* rte\_sched\_port\_config (struct rte\_sched\_port\_params \* params)

*Hierarchical scheduler port configuration*

**Parameters**

*params Port scheduler configuration parameter structure*

**Returns**

*Handle to port scheduler instance upon success or NULL otherwise.*

### void rte\_sched\_port\_free (struct rte\_sched\_port \* port)

*Hierarchical scheduler port free*

**Parameters**

*port Handle to port scheduler instance. If port is NULL, no operation is performed.*

### int rte\_sched\_subport\_pipe\_profile\_add (struct rte\_sched\_port \* port, uint32\_t subport\_id, struct rte\_sched\_pipe\_params \* params, uint32\_t \* pipe\_profile\_id)

*Hierarchical scheduler pipe profile add*

**Parameters**

*port Handle to port scheduler instance* \
 *subport\_id Subport ID* \
 *params Pipe profile parameters* \
 *pipe\_profile\_id Set to valid profile id when profile is added successfully.*

**Returns**

*0 upon success, error code otherwise*

### int rte\_sched\_port\_subport\_profile\_add (struct rte\_sched\_port \* port, struct rte\_sched\_subport\_profile\_params \* profile, uint32\_t \* subport\_profile\_id)

*Hierarchical scheduler subport bandwidth profile add Note that this function is safe to use in runtime for adding new subport bandwidth profile as it doesn't have any impact on hierarchical structure of the scheduler.*

**Parameters**

*port Handle to port scheduler instance* \
 *profile Subport bandwidth profile* \
 *subport\_profile\_id Subport profile id*

**Returns**

*0 upon success, error code otherwise*

### int rte\_sched\_subport\_config (struct rte\_sched\_port \* port, uint32\_t subport\_id, struct rte\_sched\_subport\_params \* params, uint32\_t subport\_profile\_id)

*Hierarchical scheduler subport configuration Note that this function is safe to use at runtime to configure subport bandwidth profile.*

**Parameters**

*port Handle to port scheduler instance* \
 *subport\_id Subport ID* \
 *params Subport configuration parameters. Must be non-NULL for first invocation (i.e initialization) for a given subport. Ignored (recommended value is NULL) for all subsequent invocation on the same subport.* \
 *subport\_profile\_id ID of subport bandwidth profile*

**Returns**

*0 upon success, error code otherwise*

### int rte\_sched\_pipe\_config (struct rte\_sched\_port \* port, uint32\_t subport\_id, uint32\_t pipe\_id, int32\_t pipe\_profile)

*Hierarchical scheduler pipe configuration*

**Parameters**

*port Handle to port scheduler instance* \
 *subport\_id Subport ID* \
 *pipe\_id Pipe ID within subport* \
 *pipe\_profile ID of subport-level pre-configured pipe profile*

**Returns**

*0 upon success, error code otherwise*

### uint32\_t rte\_sched\_port\_get\_memory\_footprint (struct rte\_sched\_port\_params \* port\_params, struct rte\_sched\_subport\_params \*\* subport\_params)

*Hierarchical scheduler memory footprint size per port*

**Parameters**

*port\_params Port scheduler configuration parameter structure* \
 *subport\_params Array of subport parameter structures*

**Returns**

*Memory footprint size in bytes upon success, 0 otherwise*

### int rte\_sched\_subport\_read\_stats (struct rte\_sched\_port \* port, uint32\_t subport\_id, struct rte\_sched\_subport\_stats \* stats, uint32\_t \* tc\_ov)

*Hierarchical scheduler subport statistics read*

**Parameters**

*port Handle to port scheduler instance* \
 *subport\_id Subport ID* \
 *stats Pointer to pre-allocated subport statistics structure where the statistics counters should be stored* \
 *tc\_ov Pointer to pre-allocated RTE\_SCHED\_TRAFFIC\_CLASSES\_PER\_PIPE-entry array where the oversubscription status for each of the subport traffic classes should be stored.*

**Returns**

*0 upon success, error code otherwise*

### int rte\_sched\_queue\_read\_stats (struct rte\_sched\_port \* port, uint32\_t queue\_id, struct rte\_sched\_queue\_stats \* stats, uint16\_t \* qlen)

*Hierarchical scheduler queue statistics read*

**Parameters**

*port Handle to port scheduler instance* \
 *queue\_id Queue ID within port scheduler* \
 *stats Pointer to pre-allocated subport statistics structure where the statistics counters should be stored* \
 *qlen Pointer to pre-allocated variable where the current queue length should be stored.*

**Returns**

*0 upon success, error code otherwise*

### void rte\_sched\_port\_pkt\_write (struct rte\_sched\_port \* port, struct rte\_mbuf \* pkt, uint32\_t subport, uint32\_t pipe, uint32\_t traffic\_class, uint32\_t queue, enum rte\_color color)

*Scheduler hierarchy path write to packet descriptor. Typically called by the packet classification stage.*

**Parameters**

*port Handle to port scheduler instance* \
 *pkt Packet descriptor handle* \
 *subport Subport ID* \
 *pipe Pipe ID within subport* \
 *traffic\_class Traffic class ID within pipe (0 .. RTE\_SCHED\_TRAFFIC\_CLASS\_BE)* \
 *queue Queue ID within pipe traffic class, 0 for high priority TCs, and 0 .. (RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE - 1) for best-effort TC* \
 *color Packet color set*

### void rte\_sched\_port\_pkt\_read\_tree\_path (struct rte\_sched\_port \* port, const struct rte\_mbuf \* pkt, uint32\_t \* subport, uint32\_t \* pipe, uint32\_t \* traffic\_class, uint32\_t \* queue)

*Scheduler hierarchy path read from packet descriptor (struct* **rte\_mbuf***). Typically called as part of the hierarchical scheduler enqueue operation. The subport, pipe, traffic class and queue parameters need to be pre-allocated by the caller.*

**Parameters**

*port Handle to port scheduler instance* \
 *pkt Packet descriptor handle* \
 *subport Subport ID* \
 *pipe Pipe ID within subport* \
 *traffic\_class Traffic class ID within pipe (0 .. RTE\_SCHED\_TRAFFIC\_CLASS\_BE)* \
 *queue Queue ID within pipe traffic class, 0 for high priority TCs, and 0 .. (RTE\_SCHED\_BE\_QUEUES\_PER\_PIPE - 1) for best-effort TC*

### int rte\_sched\_port\_enqueue (struct rte\_sched\_port \* port, struct rte\_mbuf \*\* pkts, uint32\_t n\_pkts)

*Hierarchical scheduler port enqueue. Writes up to n\_pkts to port scheduler and returns the number of packets actually written. For each packet, the port scheduler queue to write the packet to is identified by reading the hierarchy path from the packet descriptor; if the queue is full or congested and the packet is not written to the queue, then the packet is automatically dropped without any action required from the caller.*

**Parameters**

*port Handle to port scheduler instance* \
 *pkts Array storing the packet descriptor handles* \
 *n\_pkts Number of packets to enqueue from the pkts array into the port scheduler*

**Returns**

*Number of packets successfully enqueued*

### int rte\_sched\_port\_dequeue (struct rte\_sched\_port \* port, struct rte\_mbuf \*\* pkts, uint32\_t n\_pkts)

*Hierarchical scheduler port dequeue. Reads up to n\_pkts from the port scheduler and stores them in the pkts array and returns the number of packets actually read. The pkts array needs to be pre-allocated by the caller with at least n\_pkts entries.*

**Parameters**

*port Handle to port scheduler instance* \
 *pkts Pre-allocated packet descriptor array where the packets dequeued from the port scheduler should be stored* \
 *n\_pkts Number of packets to dequeue from the port scheduler*

**Returns**

*Number of packets successfully dequeued and placed in the pkts array*

### int rte\_sched\_subport\_tc\_ov\_config (struct rte\_sched\_port \* port, uint32\_t subport\_id, bool tc\_ov\_enable)

*Hierarchical scheduler subport traffic class oversubscription enable/disable. This function should be called at the time of subport initialization.*

**Parameters**

*port Handle to port scheduler instance* \
 *subport\_id Subport ID* \
 *tc\_ov\_enable Boolean flag to enable/disable TC OV*

**Returns**

*0 upon success, error code otherwise*

## Author

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