pipeline: add SWX pipeline flush
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>
Thu, 1 Oct 2020 10:19:58 +0000 (11:19 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 1 Oct 2020 16:43:08 +0000 (18:43 +0200)
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
lib/librte_pipeline/rte_swx_pipeline.c
lib/librte_pipeline/rte_swx_pipeline.h

index b1e0ab6..b415ecd 100644 (file)
@@ -77,6 +77,7 @@ EXPERIMENTAL {
        rte_swx_pipeline_extern_object_config;
        rte_swx_pipeline_extern_type_member_func_register;
        rte_swx_pipeline_extern_type_register;
+       rte_swx_pipeline_flush;
        rte_swx_pipeline_free;
        rte_swx_pipeline_instructions_config;
        rte_swx_pipeline_packet_header_register;
index da69bab..8b7ff56 100644 (file)
@@ -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.
  */
index a1534b0..7b131b0 100644 (file)
@@ -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
  *