DPDK 25.07.0
Data Structures | Macros | Typedefs | Functions
rte_node_mbuf_dynfield.h File Reference
#include <rte_common.h>
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>

Go to the source code of this file.

Data Structures

struct  rte_node_mbuf_overload_fields
 
struct  rte_node_mbuf_dynfield
 

Macros

#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE   (0)
 
#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE   (8)
 
#define RTE_NODE_MBUF_DYNFIELD_SIZE    (RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE + RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE)
 

Typedefs

typedef struct rte_node_mbuf_overload_fields rte_node_mbuf_overload_fields_t
 
typedef struct rte_node_mbuf_dynfield rte_node_mbuf_dynfield_t
 

Functions

static __rte_experimental __rte_always_inline rte_node_mbuf_dynfield_trte_node_mbuf_dynfield_get (struct rte_mbuf *m, const int offset)
 
static __rte_experimental __rte_always_inline rte_node_mbuf_overload_fields_trte_node_mbuf_overload_fields_get (struct rte_mbuf *m, const int offset)
 
__rte_experimental int rte_node_mbuf_dynfield_register (void)
 

Detailed Description

Warning
EXPERIMENTAL: this API may change without prior notice.

Defines rte_node specific mbuf dynamic field region [rte_node_mbuf_dynfield_t] which can be used by both DPDK built-in and out-of-tree nodes for storing per-mbuf fields for graph walk.

Definition in file rte_node_mbuf_dynfield.h.

Macro Definition Documentation

◆ RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE

#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE   (0)

Size of persistent mbuf fields

Definition at line 29 of file rte_node_mbuf_dynfield.h.

◆ RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE

#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE   (8)

Size of overloadable mbuf fields

Definition at line 34 of file rte_node_mbuf_dynfield.h.

◆ RTE_NODE_MBUF_DYNFIELD_SIZE

Size of node mbuf dynamic field

Definition at line 38 of file rte_node_mbuf_dynfield.h.

Typedef Documentation

◆ rte_node_mbuf_overload_fields_t

Node mbuf overloadable data.

Out-of-tree nodes can repurpose overloadable fields via rte_node_mbuf_overload_fields_get(mbuf). Overloadable fields are not preserved and typically can be used with-in two adjacent nodes in the graph.

◆ rte_node_mbuf_dynfield_t

rte_node specific mbuf dynamic field structure [rte_node_mbuf_dynfield_t]

It holds two types of fields:

  1. Persistent fields: Fields which are preserved across nodes during graph walk.
    • Eg: rx/tx interface etc
  2. Overloadable fields: Fields which can be repurposed by two adjacent nodes.

Function Documentation

◆ rte_node_mbuf_dynfield_get()

static __rte_experimental __rte_always_inline rte_node_mbuf_dynfield_t * rte_node_mbuf_dynfield_get ( struct rte_mbuf m,
const int  offset 
)
static

For a given mbuf and dynamic offset, return pointer to rte_node_mbuf_dynfield_t *

Parameters
mMbuf
offsetDynamic offset returned by rte_node_mbuf_dynfield_register()
Returns
Pointer to node specific mbuf dynamic field structure

Definition at line 107 of file rte_node_mbuf_dynfield.h.

◆ rte_node_mbuf_overload_fields_get()

static __rte_experimental __rte_always_inline rte_node_mbuf_overload_fields_t * rte_node_mbuf_overload_fields_get ( struct rte_mbuf m,
const int  offset 
)
static

For a given mbuf and dynamic offset, return pointer to overloadable fields. Nodes can typecast returned pointer to reuse for their own purpose.

Parameters
mMbuf
offsetDynamic offset returned by rte_node_mbuf_dynfield_register()
Returns
Pointer to node mbuf overloadable fields

Definition at line 125 of file rte_node_mbuf_dynfield.h.

◆ rte_node_mbuf_dynfield_register()

__rte_experimental int rte_node_mbuf_dynfield_register ( void  )

Register rte_node specific common mbuf dynamic field region. Can be called in rte_node_register()->init() function to save offset in node->ctx

In process() function, node->ctx can be passed to

  • rte_node_mbuf_dynfield_get(mbuf, offset)
  • rte_node_mbuf_overload_fields_get(mbuf, offset)

Can be called multiple times by any number of nodes in init() function.

  • Very first call registers dynamic field and returns offset.
  • Subsequent calls return same offset.
Returns
<0 on error: rte_errno set to one of:
  • ENOMEM - no memory >=0 on success: dynamic field offset