Lines Matching refs:graph
44 graph_node_add(struct graph *graph, struct node *node) in graph_node_add() argument
50 STAILQ_FOREACH(graph_node, &graph->node_list, next) in graph_node_add()
67 STAILQ_INSERT_TAIL(&graph->node_list, graph_node, next); in graph_node_add()
76 node_to_graph_node(struct graph *graph, struct node *node) in node_to_graph_node() argument
80 STAILQ_FOREACH(graph_node, &graph->node_list, next) in node_to_graph_node()
90 graph_node_edges_add(struct graph *graph) in graph_node_edges_add() argument
97 STAILQ_FOREACH(graph_node, &graph->node_list, next) { in graph_node_edges_add()
104 if (graph_node_add(graph, adjacency)) in graph_node_edges_add()
114 graph_adjacency_list_update(struct graph *graph) in graph_adjacency_list_update() argument
121 STAILQ_FOREACH(graph_node, &graph->node_list, next) { in graph_adjacency_list_update()
128 tmp = node_to_graph_node(graph, adjacency); in graph_adjacency_list_update()
141 expand_pattern_to_node(struct graph *graph, const char *pattern) in expand_pattern_to_node() argument
150 if (graph_node_add(graph, node)) in expand_pattern_to_node()
164 graph_cleanup(struct graph *graph) in graph_cleanup() argument
168 while (!STAILQ_EMPTY(&graph->node_list)) { in graph_cleanup()
169 graph_node = STAILQ_FIRST(&graph->node_list); in graph_cleanup()
170 STAILQ_REMOVE_HEAD(&graph->node_list, next); in graph_cleanup()
176 graph_node_init(struct graph *graph) in graph_node_init() argument
182 STAILQ_FOREACH(graph_node, &graph->node_list, next) { in graph_node_init()
186 graph->graph, in graph_node_init()
187 graph_node_name_to_ptr(graph->graph, name)); in graph_node_init()
200 graph_node_fini(struct graph *graph) in graph_node_fini() argument
204 STAILQ_FOREACH(graph_node, &graph->node_list, next) in graph_node_fini()
207 graph->graph, in graph_node_fini()
208 graph_node_name_to_ptr(graph->graph, in graph_node_fini()
213 graph_mem_fixup_node_ctx(struct rte_graph *graph) in graph_mem_fixup_node_ctx() argument
221 rte_graph_foreach_node(count, off, graph, node) { in graph_mem_fixup_node_ctx()
233 return graph; in graph_mem_fixup_node_ctx()
239 graph_mem_fixup_secondary(struct rte_graph *graph) in graph_mem_fixup_secondary() argument
241 if (graph == NULL || rte_eal_process_type() == RTE_PROC_PRIMARY) in graph_mem_fixup_secondary()
242 return graph; in graph_mem_fixup_secondary()
244 return graph_mem_fixup_node_ctx(graph); in graph_mem_fixup_secondary()
264 struct graph *graph; in rte_graph_create() local
278 STAILQ_FOREACH(graph, &graph_list, next) in rte_graph_create()
279 if (strncmp(name, graph->name, RTE_GRAPH_NAMESIZE) == 0) in rte_graph_create()
284 graph = calloc(1, sizeof(*graph)); in rte_graph_create()
285 if (graph == NULL) in rte_graph_create()
289 STAILQ_INIT(&graph->node_list); in rte_graph_create()
290 if (rte_strscpy(graph->name, name, RTE_GRAPH_NAMESIZE) < 0) in rte_graph_create()
296 if (expand_pattern_to_node(graph, pattern)) in rte_graph_create()
301 if (graph_node_edges_add(graph)) in rte_graph_create()
305 if (graph_adjacency_list_update(graph)) in rte_graph_create()
309 src_node_count = graph_src_nodes_count(graph); in rte_graph_create()
314 if (graph_node_has_edge_to_src_node(graph)) in rte_graph_create()
318 if (graph_node_has_loop_edge(graph)) in rte_graph_create()
322 if (graph_has_isolated_node(graph)) in rte_graph_create()
326 graph->socket = prm->socket_id; in rte_graph_create()
327 graph->src_node_count = src_node_count; in rte_graph_create()
328 graph->node_count = graph_nodes_count(graph); in rte_graph_create()
329 graph->id = graph_id; in rte_graph_create()
332 if (graph_fp_mem_create(graph)) in rte_graph_create()
336 if (graph_node_init(graph)) in rte_graph_create()
341 STAILQ_INSERT_TAIL(&graph_list, graph, next); in rte_graph_create()
344 return graph->id; in rte_graph_create()
347 graph_fp_mem_destroy(graph); in rte_graph_create()
349 graph_cleanup(graph); in rte_graph_create()
351 free(graph); in rte_graph_create()
360 struct graph *graph, *tmp; in rte_graph_destroy() local
365 graph = STAILQ_FIRST(&graph_list); in rte_graph_destroy()
366 while (graph != NULL) { in rte_graph_destroy()
367 tmp = STAILQ_NEXT(graph, next); in rte_graph_destroy()
368 if (graph->id == id) { in rte_graph_destroy()
370 graph_node_fini(graph); in rte_graph_destroy()
372 rc = graph_fp_mem_destroy(graph); in rte_graph_destroy()
375 graph->name); in rte_graph_destroy()
377 graph_cleanup(graph); in rte_graph_destroy()
378 STAILQ_REMOVE(&graph_list, graph, graph, next); in rte_graph_destroy()
379 free(graph); in rte_graph_destroy()
383 graph = tmp; in rte_graph_destroy()
393 struct graph *graph; in rte_graph_from_name() local
395 STAILQ_FOREACH(graph, &graph_list, next) in rte_graph_from_name()
396 if (strncmp(graph->name, name, RTE_GRAPH_NAMESIZE) == 0) in rte_graph_from_name()
397 return graph->id; in rte_graph_from_name()
405 struct graph *graph; in rte_graph_id_to_name() local
408 STAILQ_FOREACH(graph, &graph_list, next) in rte_graph_id_to_name()
409 if (graph->id == id) in rte_graph_id_to_name()
410 return graph->name; in rte_graph_id_to_name()
420 struct graph *graph; in rte_graph_node_get() local
425 STAILQ_FOREACH(graph, &graph_list, next) in rte_graph_node_get()
426 if (graph->id == gid) { in rte_graph_node_get()
427 rte_graph_foreach_node(count, off, graph->graph, in rte_graph_node_get()
442 struct graph *graph; in rte_graph_node_get_by_name() local
446 STAILQ_FOREACH(graph, &graph_list, next) in rte_graph_node_get_by_name()
447 if (!strncmp(graph->name, graph_name, RTE_GRAPH_NAMESIZE)) { in rte_graph_node_get_by_name()
448 rte_graph_foreach_node(count, off, graph->graph, in rte_graph_node_get_by_name()
461 __rte_node_stream_alloc(struct rte_graph *graph, struct rte_node *node) in __rte_node_stream_alloc() argument
469 RTE_CACHE_LINE_SIZE, graph->socket); in __rte_node_stream_alloc()
476 __rte_node_stream_alloc_size(struct rte_graph *graph, struct rte_node *node, in __rte_node_stream_alloc_size() argument
485 RTE_CACHE_LINE_SIZE, graph->socket); in __rte_node_stream_alloc_size()
492 graph_to_dot(FILE *f, struct graph *graph) in graph_to_dot() argument
501 rc = fprintf(f, "Digraph %s {\n\trankdir=LR;\n", graph->name); in graph_to_dot()
505 STAILQ_FOREACH(graph_node, &graph->node_list, next) { in graph_to_dot()
530 struct graph *graph; in rte_graph_export() local
533 STAILQ_FOREACH(graph, &graph_list, next) { in rte_graph_export()
534 if (strncmp(graph->name, name, RTE_GRAPH_NAMESIZE) == 0) { in rte_graph_export()
535 rc = graph_to_dot(f, graph); in rte_graph_export()
546 struct graph *graph; in graph_scan_dump() local
551 STAILQ_FOREACH(graph, &graph_list, next) { in graph_scan_dump()
553 graph_dump(f, graph); in graph_scan_dump()
554 } else if (graph->id == id) { in graph_scan_dump()
555 graph_dump(f, graph); in graph_scan_dump()