30 #include <rte_compat.h>
36 #define RTE_GRAPH_NAMESIZE 64
37 #define RTE_NODE_NAMESIZE 64
38 #define RTE_GRAPH_OFF_INVALID UINT32_MAX
39 #define RTE_NODE_ID_INVALID UINT32_MAX
40 #define RTE_EDGE_ID_INVALID UINT16_MAX
41 #define RTE_GRAPH_ID_INVALID UINT16_MAX
42 #define RTE_GRAPH_FENCE 0xdeadbeef12345678ULL
44 typedef uint32_t rte_graph_off_t;
45 typedef uint32_t rte_node_t;
46 typedef uint16_t rte_edge_t;
47 typedef uint16_t rte_graph_t;
50 #if RTE_GRAPH_BURST_SIZE == 1
51 #define RTE_GRAPH_BURST_SIZE_LOG2 0
52 #elif RTE_GRAPH_BURST_SIZE == 2
53 #define RTE_GRAPH_BURST_SIZE_LOG2 1
54 #elif RTE_GRAPH_BURST_SIZE == 4
55 #define RTE_GRAPH_BURST_SIZE_LOG2 2
56 #elif RTE_GRAPH_BURST_SIZE == 8
57 #define RTE_GRAPH_BURST_SIZE_LOG2 3
58 #elif RTE_GRAPH_BURST_SIZE == 16
59 #define RTE_GRAPH_BURST_SIZE_LOG2 4
60 #elif RTE_GRAPH_BURST_SIZE == 32
61 #define RTE_GRAPH_BURST_SIZE_LOG2 5
62 #elif RTE_GRAPH_BURST_SIZE == 64
63 #define RTE_GRAPH_BURST_SIZE_LOG2 6
64 #elif RTE_GRAPH_BURST_SIZE == 128
65 #define RTE_GRAPH_BURST_SIZE_LOG2 7
66 #elif RTE_GRAPH_BURST_SIZE == 256
67 #define RTE_GRAPH_BURST_SIZE_LOG2 8
69 #error "Unsupported burst size"
75 struct rte_graph_cluster_stats;
100 struct rte_node *node,
void **objs,
120 struct rte_node *node);
136 struct rte_node *node);
343 #define rte_graph_foreach_node(count, off, graph, node) \
344 for (count = 0, off = graph->nodes_start, \
345 node = RTE_PTR_ADD(graph, off); \
346 count < graph->nb_nodes; \
347 off = node->next, node = RTE_PTR_ADD(graph, off), count++)
430 #define RTE_NODE_SOURCE_F (1ULL << 0)
431 rte_node_process_t process;
432 rte_node_init_t init;
433 rte_node_fini_t fini;
435 rte_node_t parent_id;
437 const char *next_nodes[];
465 #define RTE_NODE_REGISTER(node) \
466 RTE_INIT(rte_node_register_##node) \
468 node.parent_id = RTE_NODE_ID_INVALID; \
469 node.id = __rte_node_register(&node); \
658 #ifdef RTE_LIBRTE_GRAPH_STATS
659 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]
#define __rte_cache_aligned
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)
__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