---
name: "rte_port.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_port.h"
---

# rte\_port.h(3)

## NAME

rte\_port.h

## SYNOPSIS

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

### Data Structures

struct **rte\_port\_in\_stats**\
 struct **rte\_port\_in\_ops**\
 struct **rte\_port\_out\_stats**\
 struct **rte\_port\_out\_ops**\

### Macros

\#define **RTE\_PORT\_IN\_BURST\_SIZE\_MAX**   64\

### Typedefs

**typedef** void \*(\* **rte\_port\_in\_op\_create**) (void \*params, int socket\_id)\
 **typedef** int(\* **rte\_port\_in\_op\_free**) (void \*port)\
 **typedef** int(\* **rte\_port\_in\_op\_rx**) (void \*port, struct **rte\_mbuf** \*\*pkts, uint32\_t n\_pkts)\
 **typedef** int(\* **rte\_port\_in\_op\_stats\_read**) (void \*port, struct **rte\_port\_in\_stats** \*stats, int clear)\
 **typedef** void \*(\* **rte\_port\_out\_op\_create**) (void \*params, int socket\_id)\
 **typedef** int(\* **rte\_port\_out\_op\_free**) (void \*port)\
 **typedef** int(\* **rte\_port\_out\_op\_tx**) (void \*port, struct **rte\_mbuf** \*pkt)\
 **typedef** int(\* **rte\_port\_out\_op\_tx\_bulk**) (void \*port, struct **rte\_mbuf** \*\*pkts, uint64\_t pkts\_mask)\
 **typedef** int(\* **rte\_port\_out\_op\_flush**) (void \*port)\
 **typedef** int(\* **rte\_port\_out\_op\_stats\_read**) (void \*port, struct **rte\_port\_out\_stats** \*stats, int clear)\

## Detailed Description

RTE Port

This tool is part of the DPDK Packet Framework tool suite and provides a standard interface to implement different types of packet ports.

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

## Macro Definition Documentation

### #define RTE\_MBUF\_METADATA\_UINT8\_PTR(mbuf, offset) (&((uint8\_t \*)(mbuf))\[offset\])

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

Definition at line **23** of file **rte\_port.h**.

### #define RTE\_MBUF\_METADATA\_UINT16\_PTR(mbuf, offset) ((uint16\_t \*) RTE\_MBUF\_METADATA\_UINT8\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

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

### #define RTE\_MBUF\_METADATA\_UINT32\_PTR(mbuf, offset) ((uint32\_t \*) RTE\_MBUF\_METADATA\_UINT8\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

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

### #define RTE\_MBUF\_METADATA\_UINT64\_PTR(mbuf, offset) ((uint64\_t \*) RTE\_MBUF\_METADATA\_UINT8\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

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

### #define RTE\_MBUF\_METADATA\_UINT8(mbuf, offset) (\*RTE\_MBUF\_METADATA\_UINT8\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

Definition at line **32** of file **rte\_port.h**.

### #define RTE\_MBUF\_METADATA\_UINT16(mbuf, offset) (\*RTE\_MBUF\_METADATA\_UINT16\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

Definition at line **34** of file **rte\_port.h**.

### #define RTE\_MBUF\_METADATA\_UINT32(mbuf, offset) (\*RTE\_MBUF\_METADATA\_UINT32\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

Definition at line **36** of file **rte\_port.h**.

### #define RTE\_MBUF\_METADATA\_UINT64(mbuf, offset) (\*RTE\_MBUF\_METADATA\_UINT64\_PTR(mbuf, offset))

Macros to allow accessing metadata stored in the mbuf headroom just beyond the end of the mbuf data structure returned by a port

Definition at line **38** of file **rte\_port.h**.

### #define RTE\_PORT\_IN\_BURST\_SIZE\_MAX 64

Maximum number of packets read from any input port in a single burst. Cannot be changed.

Definition at line **47** of file **rte\_port.h**.

## Typedef Documentation

### typedef void \*(\* rte\_port\_in\_op\_create) (void \*params, int socket\_id)

Input port create

**Parameters**

*params* Parameters for input port creation \
 *socket\_id* CPU socket ID (e.g. for memory allocation purpose)

**Returns**

Handle to input port instance

Definition at line **65** of file **rte\_port.h**.

### typedef int(\* rte\_port\_in\_op\_free) (void \*port)

Input port free

**Parameters**

*port* Handle to input port instance

**Returns**

0 on success, error code otherwise

Definition at line **75** of file **rte\_port.h**.

### typedef int(\* rte\_port\_in\_op\_rx) (void \*port, struct rte\_mbuf \*\*pkts, uint32\_t n\_pkts)

Input port packet burst RX

**Parameters**

*port* Handle to input port instance \
 *pkts* Burst of input packets \
 *n\_pkts* Number of packets in the input burst

**Returns**

0 on success, error code otherwise

Definition at line **89** of file **rte\_port.h**.

### typedef int(\* rte\_port\_in\_op\_stats\_read) (void \*port, struct rte\_port\_in\_stats \*stats, int clear)

Input port stats get

**Parameters**

*port* Handle to output port instance \
 *stats* Handle to port\_in stats struct to copy data \
 *clear* Flag indicating that stats should be cleared after read

**Returns**

Error code or 0 on success.

Definition at line **107** of file **rte\_port.h**.

### typedef void \*(\* rte\_port\_out\_op\_create) (void \*params, int socket\_id)

Output port create

**Parameters**

*params* Parameters for output port creation \
 *socket\_id* CPU socket ID (e.g. for memory allocation purpose)

**Returns**

Handle to output port instance

Definition at line **139** of file **rte\_port.h**.

### typedef int(\* rte\_port\_out\_op\_free) (void \*port)

Output port free

**Parameters**

*port* Handle to output port instance

**Returns**

0 on success, error code otherwise

Definition at line **149** of file **rte\_port.h**.

### typedef int(\* rte\_port\_out\_op\_tx) (void \*port, struct rte\_mbuf \*pkt)

Output port single packet TX

**Parameters**

*port* Handle to output port instance \
 *pkt* Input packet

**Returns**

0 on success, error code otherwise

Definition at line **161** of file **rte\_port.h**.

### typedef int(\* rte\_port\_out\_op\_tx\_bulk) (void \*port, struct rte\_mbuf \*\*pkts, uint64\_t pkts\_mask)

Output port packet burst TX

**Parameters**

*port* Handle to output port instance \
 *pkts* Burst of input packets specified as array of up to 64 pointers to struct **rte\_mbuf** \
 *pkts\_mask* 64-bit bitmask specifying which packets in the input burst are valid. When pkts\_mask bit n is set, then element n of pkts array is pointing to a valid packet. Otherwise, element n of pkts array will not be accessed.

**Returns**

0 on success, error code otherwise

Definition at line **180** of file **rte\_port.h**.

### typedef int(\* rte\_port\_out\_op\_flush) (void \*port)

Output port flush

**Parameters**

*port* Handle to output port instance

**Returns**

0 on success, error code otherwise

Definition at line **193** of file **rte\_port.h**.

### typedef int(\* rte\_port\_out\_op\_stats\_read) (void \*port, struct rte\_port\_out\_stats \*stats, int clear)

Output port stats read

**Parameters**

*port* Handle to output port instance \
 *stats* Handle to port\_out stats struct to copy data \
 *clear* Flag indicating that stats should be cleared after read

**Returns**

Error code or 0 on success.

Definition at line **208** of file **rte\_port.h**.

## Author

Generated automatically by Doxygen for DPDK from the source code.
