---
name: "rte_graph_worker_common.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_graph_worker_common.h"
---

# rte\_graph\_worker\_common.h(3)

## NAME

rte\_graph\_worker\_common.h

## SYNOPSIS

`#include <assert.h>`\
 `#include <stdalign.h>`\
 `#include <stddef.h>`\
 `#include <rte_common.h>`\
 `#include <rte_cycles.h>`\
 `#include <rte_prefetch.h>`\
 `#include <rte_memcpy.h>`\
 `#include <rte_memory.h>`\
 `#include 'rte_graph.h'`\

### Data Structures

struct **rte\_node::\_\_rte\_cache\_aligned**\

### Macros

\#define **RTE\_GRAPH\_MODEL\_RTC**   0\
 \#define **RTE\_GRAPH\_MODEL\_MCORE\_DISPATCH**   1\
 \#define **RTE\_GRAPH\_MODEL\_DEFAULT**   **RTE\_GRAPH\_MODEL\_RTC**\

### Functions

static void **rte\_node\_enqueue** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, void \*\*objs, uint16\_t nb\_objs)\
 static void **rte\_node\_enqueue\_x1** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, void \*obj)\
 static void **rte\_node\_enqueue\_x2** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, void \*obj0, void \*obj1)\
 static void **rte\_node\_enqueue\_x4** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, void \*obj0, void \*obj1, void \*obj2, void \*obj3)\
 static void **rte\_node\_enqueue\_next** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** \*nexts, void \*\*objs, uint16\_t nb\_objs)\
 static void \*\* **rte\_node\_next\_stream\_get** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, uint16\_t nb\_objs)\
 static void **rte\_node\_next\_stream\_put** (struct rte\_graph \*graph, struct rte\_node \*node, **rte\_edge\_t** next, uint16\_t idx)\
 static void **rte\_node\_next\_stream\_move** (struct rte\_graph \*graph, struct rte\_node \*src, **rte\_edge\_t** next)\
 bool **rte\_graph\_model\_is\_valid** (uint8\_t model)\
 int **rte\_graph\_worker\_model\_set** (uint8\_t model)\
 uint8\_t **rte\_graph\_worker\_model\_get** (struct rte\_graph \*graph)\
 static **\_\_rte\_always\_inline** uint8\_t **rte\_graph\_worker\_model\_no\_check\_get** (struct rte\_graph \*graph)\
 static \_\_rte\_experimental void **rte\_node\_xstat\_increment** (struct rte\_node \*node, uint16\_t xstat\_id, uint64\_t value)\

## Detailed Description

This API allows a worker thread to walk over a graph and nodes to create, process, enqueue and move streams of objects to the next nodes.

Definition in file **rte\_graph\_worker\_common.h**.

## Macro Definition Documentation

### #define RTE\_GRAPH\_MODEL\_RTC 0

Graph worker models Run-To-Completion model. It is the default model.

Definition at line **33** of file **rte\_graph\_worker\_common.h**.

### #define RTE\_GRAPH\_MODEL\_MCORE\_DISPATCH 1

Dispatch model to support cross-core dispatching within core affinity.

Definition at line **35** of file **rte\_graph\_worker\_common.h**.

### #define RTE\_GRAPH\_MODEL\_DEFAULT RTE\_GRAPH\_MODEL\_RTC

Default graph model.

Definition at line **36** of file **rte\_graph\_worker\_common.h**.

## Function Documentation

### static void rte\_node\_enqueue (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, void \*\* objs, uint16\_t nb\_objs)` [inline]`, ` [static]`

Enqueue the objs to next node for further processing and set the next node to pending state in the circular buffer.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index to enqueue objs. \
 *objs* Objs to enqueue. \
 *nb\_objs* Number of objs to enqueue.

Definition at line **307** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_enqueue\_x1 (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, void \* obj)` [inline]`, ` [static]`

Enqueue only one obj to next node for further processing and set the next node to pending state in the circular buffer.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index to enqueue objs. \
 *obj* Obj to enqueue.

Definition at line **333** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_enqueue\_x2 (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, void \* obj0, void \* obj1)` [inline]`, ` [static]`

Enqueue only two objs to next node for further processing and set the next node to pending state in the circular buffer. Same as rte\_node\_enqueue\_x1 but enqueue two objs.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index to enqueue objs. \
 *obj0* Obj to enqueue. \
 *obj1* Obj to enqueue.

Definition at line **362** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_enqueue\_x4 (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, void \* obj0, void \* obj1, void \* obj2, void \* obj3)` [inline]`, ` [static]`

Enqueue only four objs to next node for further processing and set the next node to pending state in the circular buffer. Same as rte\_node\_enqueue\_x1 but enqueue four objs.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index to enqueue objs. \
 *obj0* 1st obj to enqueue. \
 *obj1* 2nd obj to enqueue. \
 *obj2* 3rd obj to enqueue. \
 *obj3* 4th obj to enqueue.

Definition at line **396** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_enqueue\_next (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t \* nexts, void \*\* objs, uint16\_t nb\_objs)` [inline]`, ` [static]`

Enqueue objs to multiple next nodes for further processing and set the next nodes to pending state in the circular buffer. objs\[i\] will be enqueued to nexts\[i\].

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *nexts* List of relative next node indices to enqueue objs. \
 *objs* List of objs to enqueue. \
 *nb\_objs* Number of objs to enqueue.

Definition at line **429** of file **rte\_graph\_worker\_common.h**.

### static void \*\* rte\_node\_next\_stream\_get (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, uint16\_t nb\_objs)` [inline]`, ` [static]`

Get the stream of next node to enqueue the objs. Once done with the updating the objs, needs to call rte\_node\_next\_stream\_put to put the next node to pending state.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index to get stream. \
 *nb\_objs* Requested free size of the next stream.

**Returns**

Valid next stream on success.

**See also**

**rte\_node\_next\_stream\_put()**.

Definition at line **458** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_next\_stream\_put (struct rte\_graph \* graph, struct rte\_node \* node, rte\_edge\_t next, uint16\_t idx)` [inline]`, ` [static]`

Put the next stream to pending state in the circular buffer for further processing. Should be invoked after **rte\_node\_next\_stream\_get()**.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *node* Current node pointer. \
 *next* Relative next node index.. \
 *idx* Number of objs updated in the stream after getting the stream using rte\_node\_next\_stream\_get.

**See also**

**rte\_node\_next\_stream\_get()**.

Definition at line **488** of file **rte\_graph\_worker\_common.h**.

### static void rte\_node\_next\_stream\_move (struct rte\_graph \* graph, struct rte\_node \* src, rte\_edge\_t next)` [inline]`, ` [static]`

Home run scenario, Enqueue all the objs of current node to next node in optimized way by swapping the streams of both nodes. Performs good when next node is already not in pending state. If next node is already in pending state then normal enqueue will be used.

**Parameters**

*graph* Graph pointer returned from **rte\_graph\_lookup()**. \
 *src* Current node pointer. \
 *next* Relative next node index.

Definition at line **516** of file **rte\_graph\_worker\_common.h**.

### bool rte\_graph\_model\_is\_valid (uint8\_t model)

Test the validity of model.

**Parameters**

*model* Model to check.

**Returns**

True if graph model is valid, false otherwise.

### int rte\_graph\_worker\_model\_set (uint8\_t model)

**Note**

This function does not perform any locking, and is only safe to call before graph running. It will set all graphs the same model.

**Parameters**

*model* Name of the graph worker model.

**Returns**

0 on success, -1 otherwise.

### uint8\_t rte\_graph\_worker\_model\_get (struct rte\_graph \* graph)

Get the graph worker model

**Note**

All graph will use the same model and this function will get model from the first one. Used for slow path.

**Parameters**

*graph* Graph pointer.

**Returns**

Graph worker model on success.

### static \_\_rte\_always\_inline uint8\_t rte\_graph\_worker\_model\_no\_check\_get (struct rte\_graph \* graph)` [static]`

Get the graph worker model without check

**Note**

All graph will use the same model and this function will get model from the first one. Used for fast path.

**Parameters**

*graph* Graph pointer.

**Returns**

Graph worker model on success.

Definition at line **587** of file **rte\_graph\_worker\_common.h**.

### static \_\_rte\_experimental void rte\_node\_xstat\_increment (struct rte\_node \* node, uint16\_t xstat\_id, uint64\_t value)` [inline]`, ` [static]`

Increment Node xstat count.

Increment the count of an xstat for a given node.

**Parameters**

*node* Pointer to the node. \
 *xstat\_id* xstat ID. \
 *value* Value to increment.

Definition at line **606** of file **rte\_graph\_worker\_common.h**.

## Author

Generated automatically by Doxygen for DPDK from the source code.
