[v15,11/16] graph: enable create and destroy graph scheduling workqueue

Message ID 20230614155902.1530963-12-zhirun.yan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series graph enhancement for multi-core dispatch |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Yan, Zhirun June 14, 2023, 3:58 p.m. UTC
  This patch enables to create and destroy scheduling workqueue into
common graph operations.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/graph/graph.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/graph/graph.c b/lib/graph/graph.c
index a5320bd94e..0c28d925bc 100644
--- a/lib/graph/graph.c
+++ b/lib/graph/graph.c
@@ -451,6 +451,11 @@  rte_graph_destroy(rte_graph_t id)
 	while (graph != NULL) {
 		tmp = STAILQ_NEXT(graph, next);
 		if (graph->id == id) {
+			/* Destroy the schedule work queue if has */
+			if (rte_graph_worker_model_get(graph->graph) ==
+			    RTE_GRAPH_MODEL_MCORE_DISPATCH)
+				graph_sched_wq_destroy(graph);
+
 			/* Call fini() of the all the nodes in the graph */
 			graph_node_fini(graph);
 			/* Destroy graph fast path memory */
@@ -477,7 +482,6 @@  graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param
 {
 	struct graph_node *graph_node;
 	struct graph *graph;
-	RTE_SET_USED(prm);
 
 	graph_spinlock_lock();
 
@@ -525,6 +529,11 @@  graph_clone(struct graph *parent_graph, const char *name, struct rte_graph_param
 	/* Clone the graph model */
 	graph->graph->model = parent_graph->graph->model;
 
+	/* Create the graph schedule work queue */
+	if (rte_graph_worker_model_get(graph->graph) == RTE_GRAPH_MODEL_MCORE_DISPATCH &&
+	    graph_sched_wq_create(graph, parent_graph, prm))
+		goto graph_mem_destroy;
+
 	/* Call init() of the all the nodes in the graph */
 	if (graph_node_init(graph))
 		goto graph_mem_destroy;