30 #define CNE_GRAPH_BURST_SIZE 256
31 #define CNE_GRAPH_NAMESIZE 64
32 #define CNE_NODE_NAMESIZE 64
33 #define CNE_GRAPH_OFF_INVALID UINT32_MAX
34 #define CNE_NODE_ID_INVALID UINT32_MAX
35 #define CNE_EDGE_ID_INVALID UINT16_MAX
36 #define CNE_GRAPH_ID_INVALID UINT16_MAX
37 #define CNE_GRAPH_FENCE 0xdeadbeef12345678ULL
45 #if CNE_GRAPH_BURST_SIZE == 1
46 #define CNE_GRAPH_BURST_SIZE_LOG2 0
47 #elif CNE_GRAPH_BURST_SIZE == 2
48 #define CNE_GRAPH_BURST_SIZE_LOG2 1
49 #elif CNE_GRAPH_BURST_SIZE == 4
50 #define CNE_GRAPH_BURST_SIZE_LOG2 2
51 #elif CNE_GRAPH_BURST_SIZE == 8
52 #define CNE_GRAPH_BURST_SIZE_LOG2 3
53 #elif CNE_GRAPH_BURST_SIZE == 16
54 #define CNE_GRAPH_BURST_SIZE_LOG2 4
55 #elif CNE_GRAPH_BURST_SIZE == 32
56 #define CNE_GRAPH_BURST_SIZE_LOG2 5
57 #elif CNE_GRAPH_BURST_SIZE == 64
58 #define CNE_GRAPH_BURST_SIZE_LOG2 6
59 #elif CNE_GRAPH_BURST_SIZE == 128
60 #define CNE_GRAPH_BURST_SIZE_LOG2 7
61 #elif CNE_GRAPH_BURST_SIZE == 256
62 #define CNE_GRAPH_BURST_SIZE_LOG2 8
64 #error "Unsupported burst size"
70 struct cne_graph_cluster_stats;
94 typedef uint16_t (*
cne_node_process_t)(
struct cne_graph *graph,
struct cne_node *node,
void **objs,
128 typedef void (*
cne_node_fini_t)(
const struct cne_graph *graph,
struct cne_node *node);
183 } __cne_cache_aligned;
250 int (*header)(FILE *f,
const char *name);
251 int (*body)(FILE *f,
char *node_name,
char **adj_names,
cne_edge_t nb_edges,
253 int (*trailer)(FILE *f);
254 } cne_graph_export_t;
329 #define cne_graph_foreach_node(count, off, graph, node) \
330 for (count = 0, off = graph->nodes_start, node = CNE_PTR_ADD(graph, off); \
331 count < graph->nb_nodes; off = node->next, node = CNE_PTR_ADD(graph, off), count++)
371 const char *node_name);
383 CNDP_API
struct cne_graph_cluster_stats *
440 #define CNE_NODE_SOURCE_F (1ULL << 0)
441 #define CNE_NODE_INPUT_F (1ULL << 1)
442 #define CNE_NODE_MASK_F (CNE_NODE_SOURCE_F | CNE_NODE_INPUT_F)
468 #define CNE_NODE_REGISTER(node) \
469 CNE_INIT(cne_node_register_##node) \
471 node.parent_id = CNE_NODE_ID_INVALID; \
472 node.id = __cne_node_register(&node); \
#define __cne_always_inline
CNDP_API cne_edge_t cne_node_edge_update(cne_node_t id, cne_edge_t from, const char **next_nodes, uint16_t nb_edges)
CNDP_API void cne_graph_obj_dump(FILE *f, struct cne_graph *graph, bool all)
CNDP_API void cne_graph_cluster_stats_get(struct cne_graph_cluster_stats *stat, bool skip_cb)
CNDP_API void cne_graph_cluster_stats_reset(struct cne_graph_cluster_stats *stat)
CNDP_API cne_node_t cne_node_from_name(const char *name)
CNDP_API void cne_node_list_dump(FILE *f)
uint16_t(* cne_node_process_t)(struct cne_graph *graph, struct cne_node *node, void **objs, uint16_t nb_objs)
static __cne_always_inline int cne_node_is_invalid(cne_node_t id)
CNDP_API void cne_graph_dump(FILE *f, cne_graph_t id)
int(* cne_graph_cluster_stats_cb_t)(bool is_first, bool is_last, const struct cne_graph_cluster_node_stats *stats)
CNDP_API cne_edge_t cne_node_edge_shrink(cne_node_t id, cne_edge_t size)
CNDP_API struct cne_node * cne_graph_node_get(cne_graph_t graph_id, cne_node_t node_id)
CNDP_API void cne_node_dump(FILE *f, cne_node_t id)
int(* cne_node_init_t)(const struct cne_graph *graph, struct cne_node *node)
CNDP_API int cne_graph_export(const char *name, FILE *f)
CNDP_API cne_graph_t cne_graph_max_count(void)
CNDP_API int cne_graph_destroy(cne_graph_t id)
CNDP_API cne_graph_t cne_graph_create(const char *name, const char **patterns)
CNDP_API struct cne_graph * cne_graph_lookup(const char *name)
CNDP_API int cne_graph_export_cb(const char *name, FILE *f, cne_graph_export_t *exp)
static __cne_always_inline int cne_graph_is_invalid(cne_graph_t id)
CNDP_API cne_node_t cne_node_max_count(void)
static __cne_always_inline int cne_graph_has_stats_feature(void)
CNDP_API void cne_graph_cluster_stats_destroy(struct cne_graph_cluster_stats *stat)
CNDP_API struct cne_node * cne_graph_node_get_by_name(const char *graph, const char *name)
CNDP_API cne_graph_t cne_graph_from_name(const char *name)
#define CNE_GRAPH_ID_INVALID
CNDP_API cne_edge_t cne_node_edge_count(cne_node_t id)
CNDP_API struct cne_graph_cluster_stats * cne_graph_cluster_stats_create(const struct cne_graph_cluster_stats_param *prm)
cne_node_t __cne_node_register(const struct cne_node_register *node)
CNDP_API char * cne_graph_id_to_name(cne_graph_t id)
static __cne_always_inline int cne_edge_is_invalid(cne_edge_t id)
CNDP_API struct cne_node * cne_graph_get_node_by_name(const struct cne_graph *graph, const char *node_name)
#define CNE_NODE_ID_INVALID
CNDP_API char * cne_node_id_to_name(cne_node_t id)
CNDP_API int cne_graph_stats_node_count(struct cne_graph_cluster_stats *stat)
#define CNE_NODE_NAMESIZE
CNDP_API void cne_graph_list_dump(FILE *f)
CNDP_API cne_node_t cne_node_clone(cne_node_t id, const char *name)
#define CNE_EDGE_ID_INVALID
void(* cne_node_fini_t)(const struct cne_graph *graph, struct cne_node *node)
CNDP_API cne_node_t cne_node_edge_get(cne_node_t id, char *next_nodes[])
char name[CNE_NODE_NAMESIZE]
const char ** graph_patterns
uint16_t nb_graph_patterns
cne_graph_cluster_stats_cb_t fn
const char * next_nodes[]
cne_node_process_t process
char name[CNE_NODE_NAMESIZE]