5 #ifndef _RTE_GRAPH_WORKER_H_
6 #define _RTE_GRAPH_WORKER_H_
60 uint32_t realloc_count;
66 #define RTE_NODE_CTX_SZ 16
71 uint64_t total_cycles;
100 void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
117 void __rte_node_stream_alloc_size(
struct rte_graph *graph,
118 struct rte_node *node, uint16_t req_size);
135 uint32_t head = graph->head;
136 struct rte_node *node;
156 while (
likely(head != graph->tail)) {
157 node =
RTE_PTR_ADD(graph, cir_start[(int32_t)head++]);
164 rc = node->process(graph, node, objs, node->idx);
165 node->total_cycles += rte_rdtsc() - start;
167 node->total_objs += rc;
169 node->process(graph, node, objs, node->idx);
172 head =
likely((int32_t)head > 0) ? head & mask : head;
190 __rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
195 graph->cir_start[tail++] = node->off;
196 graph->tail = tail & graph->cir_mask;
217 __rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
218 const uint16_t idx,
const uint16_t space)
223 __rte_node_enqueue_tail_update(graph, node);
225 if (
unlikely(node->size < (idx + space)))
226 __rte_node_stream_alloc(graph, node);
243 __rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
245 RTE_ASSERT(next < node->nb_edges);
247 node = node->nodes[next];
271 rte_edge_t next,
void **objs, uint16_t nb_objs)
273 node = __rte_node_next_node_get(node, next);
274 const uint16_t idx = node->idx;
276 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
278 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
279 node->idx = idx + nb_objs;
300 node = __rte_node_next_node_get(node, next);
301 uint16_t idx = node->idx;
303 __rte_node_enqueue_prologue(graph, node, idx, 1);
305 node->objs[idx++] = obj;
330 node = __rte_node_next_node_get(node, next);
331 uint16_t idx = node->idx;
333 __rte_node_enqueue_prologue(graph, node, idx, 2);
335 node->objs[idx++] = obj0;
336 node->objs[idx++] = obj1;
363 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
366 node = __rte_node_next_node_get(node, next);
367 uint16_t idx = node->idx;
369 __rte_node_enqueue_prologue(graph, node, idx, 4);
371 node->objs[idx++] = obj0;
372 node->objs[idx++] = obj1;
373 node->objs[idx++] = obj2;
374 node->objs[idx++] = obj3;
397 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
401 for (i = 0; i < nb_objs; i++)
425 static inline void **
429 node = __rte_node_next_node_get(node, next);
430 const uint16_t idx = node->idx;
431 uint16_t free_space = node->size - idx;
434 __rte_node_stream_alloc_size(graph, node, nb_objs);
436 return &node->objs[idx];
463 node = __rte_node_next_node_get(node, next);
465 __rte_node_enqueue_tail_update(graph, node);
489 struct rte_node *dst = __rte_node_next_node_get(src, next);
492 if (
likely(dst->idx == 0)) {
493 void **dobjs = dst->objs;
494 uint16_t dsz = dst->size;
495 dst->objs = src->objs;
496 dst->size = src->size;
500 __rte_node_enqueue_tail_update(graph, dst);
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)
#define __rte_always_inline
static __rte_experimental void rte_node_next_stream_move(struct rte_graph *graph, struct rte_node *src, rte_edge_t next)
#define __rte_cache_min_aligned
static __rte_experimental void rte_node_enqueue_x2(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj0, void *obj1)
#define RTE_NODE_NAMESIZE
static __rte_always_inline int rte_graph_has_stats_feature(void)
uint16_t(* rte_node_process_t)(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs)
#define RTE_GRAPH_NAMESIZE
static __rte_experimental void rte_node_next_stream_put(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t idx)
#define RTE_PTR_ADD(ptr, x)
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_graph_walk(struct rte_graph *graph)
static __rte_experimental void rte_node_enqueue_x1(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj)
#define __rte_cache_aligned
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 void * rte_memcpy(void *dst, const void *src, size_t n)
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 void rte_prefetch0(const volatile void *p)