| 484 | } |
| 485 | |
| 486 | int |
| 487 | rte_graph_destroy(rte_graph_t id) |
| 488 | { |
| 489 | struct graph *graph, *tmp; |
| 490 | int rc = -ENOENT; |
| 491 | |
| 492 | graph_spinlock_lock(); |
| 493 | |
| 494 | graph = STAILQ_FIRST(&graph_list); |
| 495 | while (graph != NULL) { |
| 496 | tmp = STAILQ_NEXT(graph, next); |
| 497 | if (graph->id == id) { |
| 498 | /* Destroy the schedule work queue if has */ |
| 499 | if (rte_graph_worker_model_get(graph->graph) == |
| 500 | RTE_GRAPH_MODEL_MCORE_DISPATCH) |
| 501 | graph_sched_wq_destroy(graph); |
| 502 | |
| 503 | /* Call fini() of the all the nodes in the graph */ |
| 504 | graph_node_fini(graph); |
| 505 | /* Destroy graph fast path memory */ |
| 506 | rc = graph_fp_mem_destroy(graph); |
| 507 | if (rc) |
| 508 | SET_ERR_JMP(rc, done, "Graph %s destroy failed", |
| 509 | graph->name); |
| 510 | |
| 511 | graph_cleanup(graph); |
| 512 | STAILQ_REMOVE(&graph_list, graph, graph, next); |
| 513 | free(graph); |
| 514 | goto done; |
| 515 | } |
| 516 | graph = tmp; |
| 517 | } |
| 518 | done: |
| 519 | graph_spinlock_unlock(); |
| 520 | return rc; |
| 521 | } |
| 522 | |
| 523 | static rte_graph_t |
| 524 | graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param *prm) |