29 #include <rte_compat.h>
35 #define RTE_GRAPH_NAMESIZE 64
36 #define RTE_NODE_NAMESIZE 64
37 #define RTE_GRAPH_OFF_INVALID UINT32_MAX
38 #define RTE_NODE_ID_INVALID UINT32_MAX
39 #define RTE_EDGE_ID_INVALID UINT16_MAX
40 #define RTE_GRAPH_ID_INVALID UINT16_MAX
41 #define RTE_GRAPH_FENCE 0xdeadbeef12345678ULL
43 typedef uint32_t rte_graph_off_t;
44 typedef uint32_t rte_node_t;
45 typedef uint16_t rte_edge_t;
46 typedef uint16_t rte_graph_t;
49 #if RTE_GRAPH_BURST_SIZE == 1
50 #define RTE_GRAPH_BURST_SIZE_LOG2 0
51 #elif RTE_GRAPH_BURST_SIZE == 2
52 #define RTE_GRAPH_BURST_SIZE_LOG2 1
53 #elif RTE_GRAPH_BURST_SIZE == 4
54 #define RTE_GRAPH_BURST_SIZE_LOG2 2
55 #elif RTE_GRAPH_BURST_SIZE == 8
56 #define RTE_GRAPH_BURST_SIZE_LOG2 3
57 #elif RTE_GRAPH_BURST_SIZE == 16
58 #define RTE_GRAPH_BURST_SIZE_LOG2 4
59 #elif RTE_GRAPH_BURST_SIZE == 32
60 #define RTE_GRAPH_BURST_SIZE_LOG2 5
61 #elif RTE_GRAPH_BURST_SIZE == 64
62 #define RTE_GRAPH_BURST_SIZE_LOG2 6
63 #elif RTE_GRAPH_BURST_SIZE == 128
64 #define RTE_GRAPH_BURST_SIZE_LOG2 7
65 #elif RTE_GRAPH_BURST_SIZE == 256
66 #define RTE_GRAPH_BURST_SIZE_LOG2 8
68 #error "Unsupported burst size"
74 struct rte_graph_cluster_stats;
99 struct rte_node *node,
void **objs,
119 struct rte_node *node);
135 struct rte_node *node);
342 #define rte_graph_foreach_node(count, off, graph, node) \
343 for (count = 0, off = graph->nodes_start, \
344 node = RTE_PTR_ADD(graph, off); \
345 count < graph->nb_nodes; \
346 off = node->next, node = RTE_PTR_ADD(graph, off), count++)
429 #define RTE_NODE_SOURCE_F (1ULL << 0)
430 rte_node_process_t process;
431 rte_node_init_t init;
432 rte_node_fini_t fini;
434 rte_node_t parent_id;
436 const char *next_nodes[];
464 #define RTE_NODE_REGISTER(node) \
465 RTE_INIT(rte_node_register_##node) \
467 node.parent_id = RTE_NODE_ID_INVALID; \
468 node.id = __rte_node_register(&node); \
657 #ifdef RTE_LIBRTE_GRAPH_STATS
658 return RTE_LIBRTE_GRAPH_STATS;
#define __rte_always_inline
__rte_experimental rte_node_t rte_node_clone(rte_node_t id, const char *name)
const char * next_nodes[]
__rte_experimental struct rte_graph_cluster_stats * rte_graph_cluster_stats_create(const struct rte_graph_cluster_stats_param *prm)
__rte_experimental rte_node_t rte_node_from_name(const char *name)
#define RTE_NODE_NAMESIZE
__rte_experimental void rte_graph_cluster_stats_destroy(struct rte_graph_cluster_stats *stat)
char name[RTE_NODE_NAMESIZE]
static __rte_always_inline int rte_graph_has_stats_feature(void)
__rte_experimental rte_node_t rte_node_edge_get(rte_node_t id, char *next_nodes[])
__rte_experimental rte_node_t __rte_node_register(const struct rte_node_register *node)
__rte_experimental int rte_graph_destroy(rte_graph_t id)
__rte_experimental char * rte_node_id_to_name(rte_node_t id)
uint16_t(* rte_node_process_t)(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs)
__rte_experimental char * rte_graph_id_to_name(rte_graph_t id)
__rte_experimental rte_node_t rte_node_max_count(void)
__rte_experimental struct rte_node * rte_graph_node_get_by_name(const char *graph, const char *name)
static __rte_always_inline int rte_node_is_invalid(rte_node_t id)
#define RTE_GRAPH_ID_INVALID
__rte_experimental rte_edge_t rte_node_edge_update(rte_node_t id, rte_edge_t from, const char **next_nodes, uint16_t nb_edges)
void(* rte_node_fini_t)(const struct rte_graph *graph, struct rte_node *node)
uint16_t nb_graph_patterns
uint16_t nb_node_patterns
__rte_experimental void rte_graph_list_dump(FILE *f)
__rte_experimental void rte_node_list_dump(FILE *f)
int(* rte_graph_cluster_stats_cb_t)(bool is_first, bool is_last, void *cookie, const struct rte_graph_cluster_node_stats *stats)
__rte_experimental struct rte_node * rte_graph_node_get(rte_graph_t graph_id, rte_node_t node_id)
int(* rte_node_init_t)(const struct rte_graph *graph, struct rte_node *node)
__rte_experimental void rte_node_dump(FILE *f, rte_node_t id)
const char ** graph_patterns
__rte_experimental void rte_graph_cluster_stats_reset(struct rte_graph_cluster_stats *stat)
__rte_experimental rte_graph_t rte_graph_max_count(void)
__rte_experimental rte_graph_t rte_graph_create(const char *name, struct rte_graph_param *prm)
char name[RTE_NODE_NAMESIZE]
rte_graph_cluster_stats_cb_t fn
static __rte_always_inline int rte_edge_is_invalid(rte_edge_t id)
__rte_experimental rte_edge_t rte_node_edge_shrink(rte_node_t id, rte_edge_t size)
__rte_experimental rte_graph_t rte_graph_from_name(const char *name)
#define __rte_cache_aligned
__rte_experimental struct rte_graph * rte_graph_lookup(const char *name)
__rte_experimental void rte_graph_obj_dump(FILE *f, struct rte_graph *graph, bool all)
__rte_experimental void rte_graph_dump(FILE *f, rte_graph_t id)
__rte_experimental void rte_graph_cluster_stats_get(struct rte_graph_cluster_stats *stat, bool skip_cb)
static __rte_always_inline int rte_graph_is_invalid(rte_graph_t id)
__rte_experimental rte_edge_t rte_node_edge_count(rte_node_t id)
#define RTE_NODE_ID_INVALID
const char ** node_patterns
__rte_experimental int rte_graph_export(const char *name, FILE *f)
#define RTE_EDGE_ID_INVALID