5 #ifndef _RTE_GRAPH_WORKER_COMMON_H_ 6 #define _RTE_GRAPH_WORKER_COMMON_H_ 31 #define RTE_GRAPH_MODEL_RTC 0 32 #define RTE_GRAPH_MODEL_MCORE_DISPATCH 1 34 #define RTE_GRAPH_MODEL_DEFAULT RTE_GRAPH_MODEL_RTC 41 SLIST_HEAD(rte_graph_rq_head, rte_graph); 62 alignas(RTE_CACHE_LINE_SIZE)
struct rte_graph_rq_head *rq;
64 struct rte_graph_rq_head rq_head;
66 unsigned int lcore_id;
71 SLIST_ENTRY(rte_graph) next;
78 uint64_t nb_pkt_captured;
80 uint64_t nb_pkt_to_capture;
97 uint32_t realloc_count;
108 unsigned int lcore_id;
109 uint64_t total_sched_objs;
110 uint64_t total_sched_fail;
114 #define RTE_NODE_CTX_SZ 16 115 alignas(RTE_CACHE_LINE_SIZE) uint8_t ctx[RTE_NODE_CTX_SZ];
119 uint64_t total_cycles;
120 uint64_t total_calls;
128 uint64_t process_u64;
145 void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
161 void __rte_node_stream_alloc_size(
struct rte_graph *graph,
162 struct rte_node *node, uint16_t req_size);
177 __rte_node_process(
struct rte_graph *graph,
struct rte_node *node)
189 rc = node->process(graph, node, objs, node->idx);
190 node->total_cycles += rte_rdtsc() - start;
192 node->total_objs += rc;
194 node->process(graph, node, objs, node->idx);
210 __rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
215 graph->cir_start[tail++] = node->off;
216 graph->tail = tail & graph->cir_mask;
237 __rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
238 const uint16_t idx,
const uint16_t space)
243 __rte_node_enqueue_tail_update(graph, node);
245 if (
unlikely(node->size < (idx + space)))
246 __rte_node_stream_alloc_size(graph, node, node->size + space);
263 __rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
265 RTE_ASSERT(next < node->nb_edges);
267 node = node->nodes[next];
290 rte_edge_t next,
void **objs, uint16_t nb_objs)
292 node = __rte_node_next_node_get(node, next);
293 const uint16_t idx = node->idx;
295 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
297 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
298 node->idx = idx + nb_objs;
318 node = __rte_node_next_node_get(node, next);
319 uint16_t idx = node->idx;
321 __rte_node_enqueue_prologue(graph, node, idx, 1);
323 node->objs[idx++] = obj;
347 node = __rte_node_next_node_get(node, next);
348 uint16_t idx = node->idx;
350 __rte_node_enqueue_prologue(graph, node, idx, 2);
352 node->objs[idx++] = obj0;
353 node->objs[idx++] = obj1;
379 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
382 node = __rte_node_next_node_get(node, next);
383 uint16_t idx = node->idx;
385 __rte_node_enqueue_prologue(graph, node, idx, 4);
387 node->objs[idx++] = obj0;
388 node->objs[idx++] = obj1;
389 node->objs[idx++] = obj2;
390 node->objs[idx++] = obj3;
412 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
416 for (i = 0; i < nb_objs; i++)
439 static inline void **
443 node = __rte_node_next_node_get(node, next);
444 const uint16_t idx = node->idx;
445 uint16_t free_space = node->size - idx;
448 __rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
450 return &node->objs[idx];
476 node = __rte_node_next_node_get(node, next);
478 __rte_node_enqueue_tail_update(graph, node);
501 struct rte_node *dst = __rte_node_next_node_get(src, next);
504 if (
likely(dst->idx == 0)) {
505 void **dobjs = dst->objs;
506 uint16_t dsz = dst->size;
507 dst->objs = src->objs;
508 dst->size = src->size;
512 __rte_node_enqueue_tail_update(graph, dst);
#define __rte_always_inline
bool rte_graph_model_is_valid(uint8_t model)
static void rte_node_enqueue(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void **objs, uint16_t nb_objs)
int rte_graph_worker_model_set(uint8_t model)
#define RTE_NODE_NAMESIZE
#define RTE_GRAPH_PCAP_FILE_SZ
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)
uint16_t(* rte_node_process_t)(struct rte_graph *graph, struct rte_node *node, 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)
#define RTE_GRAPH_NAMESIZE
static void ** rte_node_next_stream_get(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t nb_objs)
#define __rte_cache_aligned
char name[RTE_MEMPOOL_NAMESIZE]
static void rte_node_next_stream_move(struct rte_graph *graph, struct rte_node *src, rte_edge_t next)
static void rte_node_enqueue_x2(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj0, void *obj1)
static void rte_node_next_stream_put(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t idx)
#define RTE_CACHE_LINE_MIN_SIZE
static void rte_node_enqueue_next(struct rte_graph *graph, struct rte_node *node, rte_edge_t *nexts, void **objs, uint16_t nb_objs)
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_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)