5 #ifndef _RTE_GRAPH_WORKER_COMMON_H_ 6 #define _RTE_GRAPH_WORKER_COMMON_H_ 19 #include <rte_compat.h> 34 #define RTE_GRAPH_MODEL_RTC 0 35 #define RTE_GRAPH_MODEL_MCORE_DISPATCH 1 37 #define RTE_GRAPH_MODEL_DEFAULT RTE_GRAPH_MODEL_RTC 44 SLIST_HEAD(rte_graph_rq_head, rte_graph); 67 struct rte_graph_rq_head rq_head;
69 unsigned int lcore_id;
74 SLIST_ENTRY(rte_graph) next;
81 uint64_t nb_pkt_captured;
83 uint64_t nb_pkt_to_capture;
100 uint32_t realloc_count;
112 unsigned int lcore_id;
113 uint64_t total_sched_objs;
114 uint64_t total_sched_fail;
118 #define RTE_NODE_CTX_SZ 16 123 uint64_t total_cycles;
124 uint64_t total_calls;
134 uint64_t process_u64;
152 void __rte_node_stream_alloc(
struct rte_graph *graph,
struct rte_node *node);
169 void __rte_node_stream_alloc_size(
struct rte_graph *graph,
170 struct rte_node *node, uint16_t req_size);
185 __rte_node_process(
struct rte_graph *graph,
struct rte_node *node)
197 rc = node->process(graph, node, objs, node->idx);
198 node->total_cycles += rte_rdtsc() - start;
200 node->total_objs += rc;
202 node->process(graph, node, objs, node->idx);
218 __rte_node_enqueue_tail_update(
struct rte_graph *graph,
struct rte_node *node)
223 graph->cir_start[tail++] = node->off;
224 graph->tail = tail & graph->cir_mask;
245 __rte_node_enqueue_prologue(
struct rte_graph *graph,
struct rte_node *node,
246 const uint16_t idx,
const uint16_t space)
251 __rte_node_enqueue_tail_update(graph, node);
253 if (
unlikely(node->size < (idx + space)))
254 __rte_node_stream_alloc_size(graph, node, node->size + space);
271 __rte_node_next_node_get(
struct rte_node *node,
rte_edge_t next)
273 RTE_ASSERT(next < node->nb_edges);
275 node = node->nodes[next];
299 rte_edge_t next,
void **objs, uint16_t nb_objs)
301 node = __rte_node_next_node_get(node, next);
302 const uint16_t idx = node->idx;
304 __rte_node_enqueue_prologue(graph, node, idx, nb_objs);
306 rte_memcpy(&node->objs[idx], objs, nb_objs *
sizeof(
void *));
307 node->idx = idx + nb_objs;
328 node = __rte_node_next_node_get(node, next);
329 uint16_t idx = node->idx;
331 __rte_node_enqueue_prologue(graph, node, idx, 1);
333 node->objs[idx++] = obj;
358 node = __rte_node_next_node_get(node, next);
359 uint16_t idx = node->idx;
361 __rte_node_enqueue_prologue(graph, node, idx, 2);
363 node->objs[idx++] = obj0;
364 node->objs[idx++] = obj1;
391 rte_edge_t next,
void *obj0,
void *obj1,
void *obj2,
394 node = __rte_node_next_node_get(node, next);
395 uint16_t idx = node->idx;
397 __rte_node_enqueue_prologue(graph, node, idx, 4);
399 node->objs[idx++] = obj0;
400 node->objs[idx++] = obj1;
401 node->objs[idx++] = obj2;
402 node->objs[idx++] = obj3;
425 rte_edge_t *nexts,
void **objs, uint16_t nb_objs)
429 for (i = 0; i < nb_objs; i++)
453 static inline void **
457 node = __rte_node_next_node_get(node, next);
458 const uint16_t idx = node->idx;
459 uint16_t free_space = node->size - idx;
462 __rte_node_stream_alloc_size(graph, node, node->size + nb_objs);
464 return &node->objs[idx];
491 node = __rte_node_next_node_get(node, next);
493 __rte_node_enqueue_tail_update(graph, node);
517 struct rte_node *dst = __rte_node_next_node_get(src, next);
520 if (
likely(dst->idx == 0)) {
521 void **dobjs = dst->objs;
522 uint16_t dsz = dst->size;
523 dst->objs = src->objs;
524 dst->size = src->size;
528 __rte_node_enqueue_tail_update(graph, dst);
#define __rte_always_inline
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)
__rte_experimental uint8_t rte_graph_worker_model_get(struct rte_graph *graph)
#define __rte_cache_min_aligned
static __rte_experimental void rte_node_enqueue_x1(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj)
#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_move(struct rte_graph *graph, struct rte_node *src, rte_edge_t next)
char name[RTE_MEMPOOL_NAMESIZE]
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 __rte_experimental void rte_node_enqueue_x2(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, void *obj0, void *obj1)
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)
__rte_experimental bool rte_graph_model_is_valid(uint8_t model)
#define __rte_cache_aligned
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)
static __rte_experimental __rte_always_inline uint8_t rte_graph_worker_model_no_check_get(struct rte_graph *graph)
static void * rte_memcpy(void *dst, const void *src, size_t n)
__rte_experimental int rte_graph_worker_model_set(uint8_t model)
static __rte_experimental void rte_node_next_stream_put(struct rte_graph *graph, struct rte_node *node, rte_edge_t next, uint16_t idx)
static void rte_prefetch0(const volatile void *p)