5 #ifndef _CNE_GRAPH_PRIVATE_H_
6 #define _CNE_GRAPH_PRIVATE_H_
16 #define GRAPH_LOG(level, ...) \
17 cne_log(CNE_LOG_##level, __func__, __LINE__, \
18 CNE_FMT("GRAPH: " CNE_FMT_HEAD(__VA_ARGS__, ) "\n", CNE_FMT_TAIL(__VA_ARGS__, )))
20 #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__)
21 #define graph_info(...) GRAPH_LOG(INFO, __VA_ARGS__)
22 #define graph_dbg(...) GRAPH_LOG(DEBUG, __VA_ARGS__)
24 #define ID_CHECK(id, id_max) \
26 if ((id) >= (id_max)) { \
32 #define SET_ERR_JMP(err, where, fmt, ...) \
34 graph_err(fmt, ##__VA_ARGS__); \
45 STAILQ_ENTRY(node) next;
63 STAILQ_ENTRY(graph_node) next;
66 struct graph_node *adjacency_list[];
75 STAILQ_ENTRY(graph) next;
79 struct cne_graph *graph;
85 STAILQ_HEAD(gnode_list, graph_node) node_list;
90 STAILQ_HEAD(node_head, node);
100 struct node_head *node_list_head_get(
void);
113 struct node *node_from_name(
const char *name);
117 STAILQ_HEAD(graph_head, graph);
127 struct graph_head *graph_list_head_get(
void);
136 void graph_spinlock_lock(
void);
143 void graph_spinlock_unlock(
void);
162 int graph_bfs(
struct graph *graph,
struct graph_node *start);
176 int graph_has_isolated_node(
struct graph *graph);
190 int graph_node_has_edge_to_src_node(
struct graph *graph);
204 int graph_node_has_loop_edge(
struct graph *graph);
217 cne_node_t graph_src_nodes_count(
struct graph *graph);
230 cne_node_t graph_nodes_count(
struct graph *graph);
240 void graph_mark_nodes_as_not_visited(
struct graph *graph);
257 int graph_fp_mem_create(
struct graph *graph);
271 int graph_fp_mem_destroy(
struct graph *graph);
288 struct cne_node *graph_node_id_to_ptr(
const struct cne_graph *graph,
cne_node_t id);
303 struct cne_node *graph_node_name_to_ptr(
const struct cne_graph *graph,
const char *node_name);
317 void graph_dump(FILE *f,
struct graph *g);
331 void node_dump(FILE *f,
struct node *n,
bool hdr);
uint16_t(* cne_node_process_t)(struct cne_graph *graph, struct cne_node *node, void **objs, uint16_t nb_objs)
int(* cne_node_init_t)(const struct cne_graph *graph, struct cne_node *node)
#define CNE_NODE_NAMESIZE
#define CNE_GRAPH_NAMESIZE
void(* cne_node_fini_t)(const struct cne_graph *graph, struct cne_node *node)