From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 798BD42CAB;
	Tue, 13 Jun 2023 16:13:33 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 05AE242BFE;
	Tue, 13 Jun 2023 16:12:35 +0200 (CEST)
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by mails.dpdk.org (Postfix) with ESMTP id 7482742D5A
 for <dev@dpdk.org>; Tue, 13 Jun 2023 16:12:33 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1686665553; x=1718201553;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=zKZLeIHr9FeSeOY0Lc9P3dlFxlXVbvZx6tLL2HmUpgQ=;
 b=R1ffutjHp0evQHSGR3iiuF8+w1nus1SYb1sK5KFxyncOA5CJANBK9i/S
 AahmV3nRdK6C3D+RFNuiFPRnZEORLdf7sCfy8/HIKUETE25nkWRKlX/Mc
 e93sSTeUBlqXqth0cBawW/M/B2Tajw5MRqHOirK18GsK1hh6X4L8jSbmD
 T4U4+zaGfcwfF/Fxhkgcm+V036Kfd+JI+xBzzy8GsuDP8BwNnLnDrphuL
 qprY0boPSnRtok/Splt30VhdFGdtMTv1MaZ2liWMPU8Vr3A/OFX4dSfNN
 JmVzunmjgXcoI6tH0JDezKsvafs5DQ5JS6sXP9g/gYQJmwvsReq6PTy9N g==;
X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="355839861"
X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="355839861"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Jun 2023 07:12:32 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="741439410"
X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="741439410"
Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.94])
 by orsmga008.jf.intel.com with ESMTP; 13 Jun 2023 07:12:29 -0700
From: Zhirun Yan <zhirun.yan@intel.com>
To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com,
 ndabilpuram@marvell.com, stephen@networkplumber.org,
 pbhagavatula@marvell.com, jerinjacobk@gmail.com, david.marchand@redhat.com
Cc: cunming.liang@intel.com, haiyue.wang@intel.com,
 mattias.ronnblom@ericsson.com, Zhirun Yan <zhirun.yan@intel.com>
Subject: [PATCH v14 11/16] graph: enable create and destroy graph scheduling
 workqueue
Date: Tue, 13 Jun 2023 22:04:40 +0800
Message-Id: <20230613140445.2155542-12-zhirun.yan@intel.com>
X-Mailer: git-send-email 2.37.2
In-Reply-To: <20230613140445.2155542-1-zhirun.yan@intel.com>
References: <20230613101404.1787790-1-zhirun.yan@intel.com>
 <20230613140445.2155542-1-zhirun.yan@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/graph/graph.c b/lib/graph/graph.c
index 41251e3435..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 */
@@ -524,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;
-- 
2.37.2