[29/40] pipeline: add pipeline flush
diff mbox series

Message ID 20200826151445.51500-30-cristian.dumitrescu@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • Pipeline alignment with the P4 language
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dumitrescu, Cristian Aug. 26, 2020, 3:14 p.m. UTC
Flush the packets currently buffered by the 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(+)

Patch
diff mbox series

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 6963f63a2..64fc187c4 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 fb83a8820..203e394d6 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.h
+++ b/lib/librte_pipeline/rte_swx_pipeline.h
@@ -547,6 +547,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
  *