rte_port.h(3)
π rte_port.h(3) π
okay bestie, gather round, because this is rte_port.h(3) β a library functions manual page, and it's lowkey iconic. No cap. π«Ά
β¨ NAME β¨
rte_port.h β bestie this header is literally called RTE Port and it's the moment. π
π SYNOPSIS π
#include <stdint.h>
#include <rte_mbuf.h>
π Data Structures
the entire friend group, assembled:
struct rte_port_in_statsstruct rte_port_in_opsstruct rte_port_out_statsstruct rte_port_out_ops
π Macros
#define RTE_PORT_IN_BURST_SIZE_MAX 64#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset)#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset)#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset)#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset)#define RTE_MBUF_METADATA_UINT8(mbuf, offset)#define RTE_MBUF_METADATA_UINT16(mbuf, offset)#define RTE_MBUF_METADATA_UINT32(mbuf, offset)#define RTE_MBUF_METADATA_UINT64(mbuf, offset)
π Typedefs
the whole cast, in order, exactly as written:
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 π¦
<h2>RTE Port</h2>
so this tool is part of the DPDK Packet Framework tool suite, and what it does is chef's kiss: it gives you a standard interface so you can implement all the different types of packet ports. one interface, many ports, main character energy fr fr. π
Definition in file rte_port.h.
πΈ Macro Definition Documentation πΈ
#define RTE_MBUF_METADATA_UINT8_PTR( mbuf, offset)
Value:
(&((uint8_t *)(mbuf))[offset])
these macros let you access metadata that lives in the mbuf headroom, just beyond the end of the mbuf data structure that a port hands back to you. π
Definition at line 23 of file rte_port.h.
#define RTE_MBUF_METADATA_UINT16_PTR( mbuf, offset)
Value:
((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
still the same vibe: macros for 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)
Value:
((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
yep, same deal bestie β metadata, mbuf headroom, just beyond the end of the mbuf data structure a port returns. π
Definition at line 27 of file rte_port.h.
#define RTE_MBUF_METADATA_UINT64_PTR( mbuf, offset)
Value:
((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
the 64-bit one, and it is also for 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)
Value:
(*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
note the dereference bestie, we're getting the value now β and yep, it's for 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)
Value:
(*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
same energy, uint16_t edition. metadata, 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)
Value:
(*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
still serving the exact same purpose: 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)
Value:
(*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
last of the metadata squad, and no surprises: metadata 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
this is the maximum number of packets you can read from any input port in a single burst. and bestie β it Cannot be changed. periodt. not negotiable, not editable, it is what it is. π
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 β the glow-up where the input port is born. π§
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 β releasing your fave back into the wild. π¦
Parameters
- port β handle to input port instance
Returns
0on 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 β the receive moment, incoming packets go brrr. β¨
Parameters
- port β handle to input port instance
- pkts β burst of input packets
- n_pkts β number of packets in the input burst
Returns
0on 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 β receipts, but for your input port. π
Parameters
- port β handle to output port instance
- stats β handle to
port_instats struct to copy data - clear β flag indicating that stats should be cleared after read
Returns
- error code or
0on 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 β same birth energy but outgoing. π
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 β bye bestie, thanks for the packets. π«Ά
Parameters
- port β handle to output port instance
Returns
0on 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 β one packet, one moment, one slay. π
Parameters
- port β handle to output port instance
- pkt β input packet
Returns
0on 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 β the group-chat version of TX. π
Parameters
- port β handle to output port instance
- pkts β burst of input packets specified as array of up to
64pointers tostruct rte_mbuf - pkts_mask β 64-bit bitmask specifying which packets in the input burst are valid. When
pkts_maskbit n is set, then element n ofpktsarray is pointing to a valid packet. Otherwise, element n ofpktsarray will not be accessed.
Returns
0on 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 β drain it, clear it, refresh. πΏ
Parameters
- port β handle to output port instance
Returns
0on 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 β the read receipts, but for output. π
Parameters
- port β handle to output port instance
- stats β handle to
port_outstats struct to copy data - clear β flag indicating that stats should be cleared after read
Returns
- error code or
0on success.
Definition at line 208 of file rte_port.h.
π Author π
generated automatically by Doxygen for DPDK, straight from the source code. the docs wrote themselves, honestly. iconic behaviour. β¨
and that's the whole page bestie!! this lil' write-up is from DPDK, Version 25.11.3. stay hydrated, read your docs, and go implement some packet ports. mwah. ππ¦β¨
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms