From e87cf5d85e606832243638b62a54f90c7949e88d Mon Sep 17 00:00:00 2001 From: Cristian Dumitrescu Date: Thu, 1 Oct 2020 11:19:58 +0100 Subject: [PATCH] pipeline: add SWX pipeline flush Flush the packets currently buffered by the SWX pipeline output ports. Signed-off-by: Cristian Dumitrescu --- 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 b1e0ab65f6..b415ecd237 100644 --- a/lib/librte_pipeline/rte_pipeline_version.map +++ b/lib/librte_pipeline/rte_pipeline_version.map @@ -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; diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index da69bab493..8b7ff56f6f 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 a1534b043b..7b131b0de6 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.20.1