From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7C9CDA04B5;
	Thu, 10 Sep 2020 17:33:16 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id D376F1C229;
	Thu, 10 Sep 2020 17:27:38 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id E4A1D1C19B
 for <dev@dpdk.org>; Thu, 10 Sep 2020 17:27:13 +0200 (CEST)
IronPort-SDR: WJo2mbdeuJy1Vz498oyN2O8lknFZW+QNgzp1dfTWEbg3Geq8waN9Ye476y6QneEIpnkmjA4Bou
 MZxtJZf1+xfg==
X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="155956190"
X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="155956190"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 10 Sep 2020 08:27:13 -0700
IronPort-SDR: Ipp8PaJy5+jN8ixLrrNTfibmJQf+X4OkfZD7Rjeaks+j7sVwdGCw/cvRFIPlA18jMw7VPQ9klL
 pSkI5tNkzHQg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="480932213"
Received: from silpixa00400573.ir.intel.com (HELO
 silpixa00400573.ger.corp.intel.com) ([10.237.223.107])
 by orsmga005.jf.intel.com with ESMTP; 10 Sep 2020 08:27:13 -0700
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Date: Thu, 10 Sep 2020 16:26:34 +0100
Message-Id: <20200910152645.9342-31-cristian.dumitrescu@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200910152645.9342-1-cristian.dumitrescu@intel.com>
References: <20200908201830.74206-2-cristian.dumitrescu@intel.com>
 <20200910152645.9342-1-cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH v4 30/41] pipeline: add SWX pipeline flush
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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
Sender: "dev" <dev-bounces@dpdk.org>

Flush the packets currently buffered by the SWX pipeline output ports.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_pipeline_version.map |  1 +
 lib/librte_pipeline/rte_swx_pipeline.c       | 13 +++++++++++++
 lib/librte_pipeline/rte_swx_pipeline.h       | 12 ++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/lib/librte_pipeline/rte_pipeline_version.map b/lib/librte_pipeline/rte_pipeline_version.map
index bb992fdd0..730e11a0c 100644
--- a/lib/librte_pipeline/rte_pipeline_version.map
+++ b/lib/librte_pipeline/rte_pipeline_version.map
@@ -74,6 +74,7 @@ EXPERIMENTAL {
 	rte_swx_pipeline_build;
 	rte_swx_pipeline_free;
 	rte_swx_pipeline_run;
+	rte_swx_pipeline_flush;
 	rte_swx_pipeline_table_state_get;
 	rte_swx_pipeline_table_state_set;
 	rte_swx_ctl_pipeline_info_get;
diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index da69bab49..8b7ff56f6 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -6951,6 +6951,19 @@ rte_swx_pipeline_run(struct rte_swx_pipeline *p, uint32_t n_instructions)
 		instr_exec(p);
 }
 
+void
+rte_swx_pipeline_flush(struct rte_swx_pipeline *p)
+{
+	uint32_t i;
+
+	for (i = 0; i < p->n_ports_out; i++) {
+		struct port_out_runtime *port = &p->out[i];
+
+		if (port->flush)
+			port->flush(port->obj);
+	}
+}
+
 /*
  * Control.
  */
diff --git a/lib/librte_pipeline/rte_swx_pipeline.h b/lib/librte_pipeline/rte_swx_pipeline.h
index d6c086e27..6da5710af 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.h
+++ b/lib/librte_pipeline/rte_swx_pipeline.h
@@ -656,6 +656,18 @@ void
 rte_swx_pipeline_run(struct rte_swx_pipeline *p,
 		     uint32_t n_instructions);
 
+/**
+ * Pipeline flush
+ *
+ * Flush all output ports of the pipeline.
+ *
+ * @param[in] p
+ *   Pipeline handle.
+ */
+__rte_experimental
+void
+rte_swx_pipeline_flush(struct rte_swx_pipeline *p);
+
 /**
  * Pipeline free
  *
-- 
2.17.1