DPDK  24.07.0
Data Structures | Macros | Typedefs
rte_port.h File Reference
#include <stdint.h>
#include <rte_mbuf.h>

Go to the source code of this file.

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
 
#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset)   (&((uint8_t *)(mbuf))[offset])
 
#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset)   ((uint16_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset)   ((uint32_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset)   ((uint64_t *) RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT8(mbuf, offset)   (*RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT16(mbuf, offset)   (*RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT32(mbuf, offset)   (*RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset))
 
#define RTE_MBUF_METADATA_UINT64(mbuf, offset)   (*RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset))
 

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

◆ RTE_MBUF_METADATA_UINT8_PTR

#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 27 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT16_PTR

#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 29 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT32_PTR

#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 31 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT64_PTR

#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 33 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT8

#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 36 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT16

#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 38 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT32

#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 40 of file rte_port.h.

◆ RTE_MBUF_METADATA_UINT64

#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 42 of file rte_port.h.

◆ RTE_PORT_IN_BURST_SIZE_MAX

#define RTE_PORT_IN_BURST_SIZE_MAX   64

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

Examples:
examples/ip_pipeline/pipeline.c.

Definition at line 51 of file rte_port.h.

Typedef Documentation

◆ rte_port_in_op_create

typedef void*(* rte_port_in_op_create) (void *params, int socket_id)

Input port create

Parameters
paramsParameters for input port creation
socket_idCPU socket ID (e.g. for memory allocation purpose)
Returns
Handle to input port instance

Definition at line 69 of file rte_port.h.

◆ rte_port_in_op_free

typedef int(* rte_port_in_op_free) (void *port)

Input port free

Parameters
portHandle to input port instance
Returns
0 on success, error code otherwise

Definition at line 79 of file rte_port.h.

◆ rte_port_in_op_rx

typedef int(* rte_port_in_op_rx) (void *port, struct rte_mbuf **pkts, uint32_t n_pkts)

Input port packet burst RX

Parameters
portHandle to input port instance
pktsBurst of input packets
n_pktsNumber of packets in the input burst
Returns
0 on success, error code otherwise

Definition at line 93 of file rte_port.h.

◆ rte_port_in_op_stats_read

typedef int(* rte_port_in_op_stats_read) (void *port, struct rte_port_in_stats *stats, int clear)

Input port stats get

Parameters
portHandle to output port instance
statsHandle to port_in stats struct to copy data
clearFlag indicating that stats should be cleared after read
Returns
Error code or 0 on success.

Definition at line 111 of file rte_port.h.

◆ rte_port_out_op_create

typedef void*(* rte_port_out_op_create) (void *params, int socket_id)

Output port create

Parameters
paramsParameters for output port creation
socket_idCPU socket ID (e.g. for memory allocation purpose)
Returns
Handle to output port instance

Definition at line 143 of file rte_port.h.

◆ rte_port_out_op_free

typedef int(* rte_port_out_op_free) (void *port)

Output port free

Parameters
portHandle to output port instance
Returns
0 on success, error code otherwise

Definition at line 153 of file rte_port.h.

◆ rte_port_out_op_tx

typedef int(* rte_port_out_op_tx) (void *port, struct rte_mbuf *pkt)

Output port single packet TX

Parameters
portHandle to output port instance
pktInput packet
Returns
0 on success, error code otherwise

Definition at line 165 of file rte_port.h.

◆ rte_port_out_op_tx_bulk

typedef int(* rte_port_out_op_tx_bulk) (void *port, struct rte_mbuf **pkts, uint64_t pkts_mask)

Output port packet burst TX

Parameters
portHandle to output port instance
pktsBurst of input packets specified as array of up to 64 pointers to struct rte_mbuf
pkts_mask64-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 184 of file rte_port.h.

◆ rte_port_out_op_flush

typedef int(* rte_port_out_op_flush) (void *port)

Output port flush

Parameters
portHandle to output port instance
Returns
0 on success, error code otherwise

Definition at line 197 of file rte_port.h.

◆ rte_port_out_op_stats_read

typedef int(* rte_port_out_op_stats_read) (void *port, struct rte_port_out_stats *stats, int clear)

Output port stats read

Parameters
portHandle to output port instance
statsHandle to port_out stats struct to copy data
clearFlag indicating that stats should be cleared after read
Returns
Error code or 0 on success.

Definition at line 212 of file rte_port.h.