5 #ifndef _RTE_GRAPH_WORKER_H_ 6 #define _RTE_GRAPH_WORKER_H_ 19 #include <rte_compat.h> 49 uint64_t nb_pkt_captured;
51 uint64_t nb_pkt_to_capture;
68 uint32_t realloc_count;
77 #define RTE_NODE_CTX_SZ 16 82 uint64_t total_cycles;
111 void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
128 void __rte_node_stream_alloc_size(
struct rte_graph *graph,
129 struct rte_node *node, uint16_t req_size);
146 uint32_t head = graph->head;
147 struct rte_node *node;
167 while (
likely(head != graph->tail)) {
168 node = (
struct rte_node *)
RTE_PTR_ADD(graph, cir_start[(int32_t)head++]);
175 rc = node->process(graph, node, objs, node->idx);
176 node->total_cycles += rte_rdtsc() - start;
178 node->total_objs += rc;
180 node->process(graph, node, objs, node->idx);
183 head =
likely((int32_t)head > 0) ? head & mask : head;
201 __rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
206 graph->cir_start[tail++] = node->off;
207 graph->tail = tail & graph->cir_mask;
228 __rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
229 const uint16_t idx,
const uint16_t space)
234 __rte_node_enqueue_tail_update(graph, node);
236 if (
unlikely(node->size < (idx + space)))
237 __rte_node_stream_alloc_size(graph, node, node->size + space);
254 __rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
256 RTE_ASSERT(next < node->nb_edges);
258 node = node->nodes[next];
282 rte_edge_t next,
void **objs, uint16_t nb_objs)
284 node = __rte_node_next_node_get(node, next);
285 const uint16_t idx = node->idx;
287 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
289 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
290 node->idx = idx + nb_objs;
311 node = __rte_node_next_node_get(node, next);
312 uint16_t idx = node->idx;
314 __rte_node_enqueue_prologue(graph, node, idx, 1);
316 node->objs[idx++] = obj;
341 node = __rte_node_next_node_get(node, next);
342 uint16_t idx = node->idx;
344 __rte_node_enqueue_prologue(graph, node, idx, 2);
346 node->objs[idx++] = obj0;
347 node->objs[idx++] = obj1;
374 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
377 node = __rte_node_next_node_get(node, next);
378 uint16_t idx = node->idx;
380 __rte_node_enqueue_prologue(graph, node, idx, 4);
382 node->objs[idx++] = obj0;
383 node->objs[idx++] = obj1;
384 node->objs[idx++] = obj2;
385 node->objs[idx++] = obj3;
408 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
412 for (i = 0; i < nb_objs; i++)
436 static inline void **
440 node = __rte_node_next_node_get(node, next);
441 const uint16_t idx = node->idx;
442 uint16_t free_space = node->size - idx;
445 __rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
447 return &node->objs[idx];
474 node = __rte_node_next_node_get(node, next);
476 __rte_node_enqueue_tail_update(graph, node);
500 struct rte_node *dst = __rte_node_next_node_get(src, next);
503 if (
likely(dst->idx == 0)) {
504 void **dobjs = dst->objs;
505 uint16_t dsz = dst->size;
506 dst->objs = src->objs;
507 dst->size = src->size;
511 __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
#define RTE_GRAPH_PCAP_FILE_SZ
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)