5 #ifndef _CNE_GRAPH_WORKER_H_
6 #define _CNE_GRAPH_WORKER_H_
43 } __cne_cache_aligned;
57 uint32_t realloc_count;
63 #define CNE_NODE_CTX_SZ 16
64 uint8_t ctx[CNE_NODE_CTX_SZ] __cne_cache_aligned;
68 uint64_t total_cycles;
82 } __cne_cache_aligned;
96 void __cne_node_stream_alloc(
struct cne_graph *graph,
struct cne_node *node);
112 void __cne_node_stream_alloc_size(
struct cne_graph *graph,
struct cne_node *node,
129 uint32_t head = graph->head;
130 struct cne_node *node;
150 while (
likely(head != graph->tail)) {
151 node =
CNE_PTR_ADD(graph, cir_start[(int32_t)head++]);
158 rc = node->process(graph, node, objs, node->idx);
159 node->total_cycles +=
cne_rdtsc() - start;
161 node->total_objs += rc;
163 node->process(graph, node, objs, node->idx);
165 head =
likely((int32_t)head > 0) ? head & mask : head;
183 __cne_node_enqueue_tail_update(
struct cne_graph *graph,
struct cne_node *node)
188 graph->cir_start[tail++] = node->off;
189 graph->tail = tail & graph->cir_mask;
210 __cne_node_enqueue_prologue(
struct cne_graph *graph,
struct cne_node *node,
const uint16_t idx,
211 const uint16_t space)
215 __cne_node_enqueue_tail_update(graph, node);
217 if (
unlikely(node->size < (idx + space)))
218 __cne_node_stream_alloc_size(graph, node, node->size + space);
235 __cne_node_next_node_get(
struct cne_node *node,
cne_edge_t next)
237 CNE_ASSERT(next < node->nb_edges);
239 node = node->nodes[next];
263 const uint16_t idx = node->idx;
265 if (
unlikely(node->size < (idx + nb_objs)))
266 __cne_node_stream_alloc(graph, node);
268 memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
269 node->idx = idx + nb_objs;
287 const uint16_t idx = node->idx;
289 __cne_node_enqueue_prologue(graph, node, idx, nb_objs);
291 memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
292 node->idx = idx + nb_objs;
314 node = __cne_node_next_node_get(node, next);
315 const uint16_t idx = node->idx;
317 __cne_node_enqueue_prologue(graph, node, idx, nb_objs);
319 memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
320 node->idx = idx + nb_objs;
339 node = __cne_node_next_node_get(node, next);
340 uint16_t idx = node->idx;
342 __cne_node_enqueue_prologue(graph, node, idx, 1);
344 node->objs[idx++] = obj;
368 node = __cne_node_next_node_get(node, next);
369 uint16_t idx = node->idx;
371 __cne_node_enqueue_prologue(graph, node, idx, 2);
373 node->objs[idx++] = obj0;
374 node->objs[idx++] = obj1;
400 void *obj1,
void *obj2,
void *obj3)
402 node = __cne_node_next_node_get(node, next);
403 uint16_t idx = node->idx;
405 __cne_node_enqueue_prologue(graph, node, idx, 4);
407 node->objs[idx++] = obj0;
408 node->objs[idx++] = obj1;
409 node->objs[idx++] = obj2;
410 node->objs[idx++] = obj3;
432 void **objs, uint16_t nb_objs)
436 for (i = 0; i < nb_objs; i++)
459 static inline void **
463 node = __cne_node_next_node_get(node, next);
464 const uint16_t idx = node->idx;
465 uint16_t free_space = node->size - idx;
468 __cne_node_stream_alloc_size(graph, node, node->size + nb_objs);
470 return &node->objs[idx];
496 node = __cne_node_next_node_get(node, next);
499 __cne_node_enqueue_tail_update(graph, node);
521 struct cne_node *dst = __cne_node_next_node_get(src, next);
523 CNE_DEBUG(
"Src %-16s', Dst '%-16s' next %d\n", src->name, dst->name, next);
526 if (
likely(dst->idx == 0)) {
527 void **dobjs = dst->objs;
528 uint16_t dsz = dst->size;
530 dst->objs = src->objs;
531 dst->size = src->size;
536 __cne_node_enqueue_tail_update(graph, dst);
#define CNE_PTR_ADD(ptr, x)
#define __cne_cache_min_aligned
#define __cne_always_inline
static uint64_t cne_rdtsc(void)
uint16_t(* cne_node_process_t)(struct cne_graph *graph, struct cne_node *node, void **objs, uint16_t nb_objs)
static __cne_always_inline int cne_graph_has_stats_feature(void)
#define CNE_NODE_NAMESIZE
#define CNE_GRAPH_NAMESIZE
static void cne_node_add_objects_to_source(struct cne_graph *graph, struct cne_node *node, void **objs, uint16_t nb_objs)
static void cne_node_enqueue_x4(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, void *obj0, void *obj1, void *obj2, void *obj3)
static void cne_node_next_stream_move(struct cne_graph *graph, struct cne_node *src, cne_edge_t next)
static void cne_node_enqueue(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, void **objs, uint16_t nb_objs)
static void cne_node_enqueue_x2(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, void *obj0, void *obj1)
static void ** cne_node_next_stream_get(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, uint16_t nb_objs)
static void cne_node_add_objects_to_input(struct cne_graph *graph, struct cne_node *node, void **objs, uint16_t nb_objs)
static void cne_graph_walk(struct cne_graph *graph)
static void cne_node_enqueue_x1(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, void *obj)
static void cne_node_next_stream_put(struct cne_graph *graph, struct cne_node *node, cne_edge_t next, uint16_t idx)
static void cne_node_enqueue_next(struct cne_graph *graph, struct cne_node *node, cne_edge_t *nexts, void **objs, uint16_t nb_objs)
static void cne_prefetch0(const volatile void *p)