5#ifndef _RTE_GRAPH_WORKER_COMMON_H_
6#define _RTE_GRAPH_WORKER_COMMON_H_
33#define RTE_GRAPH_MODEL_RTC 0
34#define RTE_GRAPH_MODEL_MCORE_DISPATCH 1
36#define RTE_GRAPH_MODEL_DEFAULT RTE_GRAPH_MODEL_RTC
43SLIST_HEAD(rte_graph_rq_head, rte_graph);
64 alignas(RTE_CACHE_LINE_SIZE)
struct rte_graph_rq_head *rq;
66 struct rte_graph_rq_head rq_head;
68 unsigned int lcore_id;
73 SLIST_ENTRY(rte_graph) next;
80 uint64_t nb_pkt_captured;
82 uint64_t nb_pkt_to_capture;
99 uint32_t realloc_count;
110 unsigned int lcore_id;
111 uint64_t total_sched_objs;
112 uint64_t total_sched_fail;
122#define RTE_NODE_CTX_SZ 16
124 uint8_t ctx[RTE_NODE_CTX_SZ];
125 __extension__
struct {
142 uint64_t process_u64;
148static_assert(
offsetof(
struct rte_node, nodes) -
offsetof(
struct rte_node, ctx)
163void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
179void __rte_node_stream_alloc_size(
struct rte_graph *graph,
180 struct rte_node *node, uint16_t req_size);
195__rte_node_process(
struct rte_graph *graph,
struct rte_node *node)
207 rc = node->process(graph, node, objs, node->idx);
208 node->total_cycles += rte_rdtsc() - start;
210 node->total_objs += rc;
212 node->process(graph, node, objs, node->idx);
228__rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
233 graph->cir_start[tail++] = node->off;
234 graph->tail = tail & graph->cir_mask;
255__rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
256 const uint16_t idx,
const uint16_t space)
261 __rte_node_enqueue_tail_update(graph, node);
263 if (
unlikely(node->size < (idx + space)))
264 __rte_node_stream_alloc_size(graph, node, node->size + space);
281__rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
283 RTE_ASSERT(next < node->nb_edges);
285 node = node->nodes[next];
308 rte_edge_t next,
void **objs, uint16_t nb_objs)
310 node = __rte_node_next_node_get(node, next);
311 const uint16_t idx = node->idx;
313 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
315 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
316 node->idx = idx + nb_objs;
336 node = __rte_node_next_node_get(node, next);
337 uint16_t idx = node->idx;
339 __rte_node_enqueue_prologue(graph, node, idx, 1);
341 node->objs[idx++] = obj;
365 node = __rte_node_next_node_get(node, next);
366 uint16_t idx = node->idx;
368 __rte_node_enqueue_prologue(graph, node, idx, 2);
370 node->objs[idx++] = obj0;
371 node->objs[idx++] = obj1;
397 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
400 node = __rte_node_next_node_get(node, next);
401 uint16_t idx = node->idx;
403 __rte_node_enqueue_prologue(graph, node, idx, 4);
405 node->objs[idx++] = obj0;
406 node->objs[idx++] = obj1;
407 node->objs[idx++] = obj2;
408 node->objs[idx++] = obj3;
430 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
434 for (i = 0; i < nb_objs; i++)
461 node = __rte_node_next_node_get(node, next);
462 const uint16_t idx = node->idx;
463 uint16_t free_space = node->size - idx;
466 __rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
468 return &node->objs[idx];
494 node = __rte_node_next_node_get(node, next);
496 __rte_node_enqueue_tail_update(graph, node);
519 struct rte_node *dst = __rte_node_next_node_get(src, next);
522 if (
likely(dst->idx == 0)) {
523 void **dobjs = dst->objs;
524 uint16_t dsz = dst->size;
525 dst->objs = src->objs;
526 dst->size = src->size;
530 __rte_node_enqueue_tail_update(graph, dst);
609 uint64_t *xstat = (uint64_t *)
RTE_PTR_ADD(node, node->xstat_off);
610 xstat[xstat_id] += value;
#define RTE_CACHE_LINE_MIN_SIZE
#define offsetof(TYPE, MEMBER)
#define RTE_PTR_ADD(ptr, x)
#define __rte_cache_aligned
#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_PCAP_FILE_SZ
#define RTE_GRAPH_NAMESIZE
static __rte_always_inline int rte_graph_has_stats_feature(void)
static __rte_always_inline uint8_t rte_graph_worker_model_no_check_get(struct rte_graph *graph)
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)
bool rte_graph_model_is_valid(uint8_t model)
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_enqueue(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void **objs, uint16_t nb_objs)
static void rte_node_next_stream_move(struct rte_graph *graph, struct rte_node *src, rte_edge_t next)
int rte_graph_worker_model_set(uint8_t model)
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_enqueue_x1(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj)
static __rte_experimental void rte_node_xstat_increment(struct rte_node *node, uint16_t xstat_id, uint64_t value)
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_enqueue_x2(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj0, void *obj1)
uint8_t rte_graph_worker_model_get(struct rte_graph *graph)
static void * rte_memcpy(void *dst, const void *src, size_t n)
static void rte_prefetch0(const volatile void *p)
char name[RTE_MEMPOOL_NAMESIZE]
rte_node_process_t process