5#ifndef _RTE_GRAPH_WORKER_H_
6#define _RTE_GRAPH_WORKER_H_
19#include <rte_compat.h>
62 uint32_t realloc_count;
68#define RTE_NODE_CTX_SZ 16
73 uint64_t total_cycles;
102void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
119void __rte_node_stream_alloc_size(
struct rte_graph *graph,
120 struct rte_node *node, uint16_t req_size);
137 uint32_t head = graph->head;
138 struct rte_node *node;
158 while (
likely(head != graph->tail)) {
159 node = (
struct rte_node *)
RTE_PTR_ADD(graph, cir_start[(int32_t)head++]);
166 rc = node->process(graph, node, objs, node->idx);
167 node->total_cycles += rte_rdtsc() - start;
169 node->total_objs += rc;
171 node->process(graph, node, objs, node->idx);
174 head =
likely((int32_t)head > 0) ? head & mask : head;
192__rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
197 graph->cir_start[tail++] = node->off;
198 graph->tail = tail & graph->cir_mask;
219__rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
220 const uint16_t idx,
const uint16_t space)
225 __rte_node_enqueue_tail_update(graph, node);
227 if (
unlikely(node->size < (idx + space)))
228 __rte_node_stream_alloc_size(graph, node, node->size + space);
245__rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
247 RTE_ASSERT(next < node->nb_edges);
249 node = node->nodes[next];
273 rte_edge_t next,
void **objs, uint16_t nb_objs)
275 node = __rte_node_next_node_get(node, next);
276 const uint16_t idx = node->idx;
278 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
280 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
281 node->idx = idx + nb_objs;
302 node = __rte_node_next_node_get(node, next);
303 uint16_t idx = node->idx;
305 __rte_node_enqueue_prologue(graph, node, idx, 1);
307 node->objs[idx++] = obj;
332 node = __rte_node_next_node_get(node, next);
333 uint16_t idx = node->idx;
335 __rte_node_enqueue_prologue(graph, node, idx, 2);
337 node->objs[idx++] = obj0;
338 node->objs[idx++] = obj1;
365 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
368 node = __rte_node_next_node_get(node, next);
369 uint16_t idx = node->idx;
371 __rte_node_enqueue_prologue(graph, node, idx, 4);
373 node->objs[idx++] = obj0;
374 node->objs[idx++] = obj1;
375 node->objs[idx++] = obj2;
376 node->objs[idx++] = obj3;
399 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
403 for (i = 0; i < nb_objs; i++)
431 node = __rte_node_next_node_get(node, next);
432 const uint16_t idx = node->idx;
433 uint16_t free_space = node->size - idx;
436 __rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
438 return &node->objs[idx];
465 node = __rte_node_next_node_get(node, next);
467 __rte_node_enqueue_tail_update(graph, node);
491 struct rte_node *dst = __rte_node_next_node_get(src, next);
494 if (
likely(dst->idx == 0)) {
495 void **dobjs = dst->objs;
496 uint16_t dsz = dst->size;
497 dst->objs = src->objs;
498 dst->size = src->size;
502 __rte_node_enqueue_tail_update(graph, dst);
#define __rte_cache_min_aligned
#define __rte_cache_aligned
#define RTE_PTR_ADD(ptr, x)
#define __rte_always_inline
uint16_t(* rte_node_process_t)(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs)
#define RTE_NODE_NAMESIZE
#define RTE_GRAPH_NAMESIZE
static __rte_always_inline int rte_graph_has_stats_feature(void)
static __rte_experimental void rte_node_enqueue_next(struct rte_graph *graph, struct rte_node *node, rte_edge_t *nexts, void **objs, uint16_t nb_objs)
static __rte_experimental void ** rte_node_next_stream_get(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t nb_objs)
static __rte_experimental 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 __rte_experimental void rte_node_enqueue_x1(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj)
static __rte_experimental void rte_graph_walk(struct rte_graph *graph)
static __rte_experimental void rte_node_next_stream_put(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t idx)
static __rte_experimental void rte_node_enqueue_x2(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj0, void *obj1)
static __rte_experimental void rte_node_enqueue(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void **objs, uint16_t nb_objs)
static __rte_experimental void rte_node_next_stream_move(struct rte_graph *graph, struct rte_node *src, rte_edge_t next)
static void * rte_memcpy(void *dst, const void *src, size_t n)
static void rte_prefetch0(const volatile void *p)