[V2,4/4] pipeline: add drop port for each pipeline
Checks
Commit Message
An additional output port is now implicitly created for every pipeline
to serve as the packet drop port. Up to now, the drop port had to be
explicitly created for each pipeline.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
---
examples/pipeline/cli.c | 15 +++++++++++----
examples/pipeline/examples/fib.cli | 1 -
examples/pipeline/examples/learner.cli | 1 -
examples/pipeline/examples/selector.cli | 1 -
examples/pipeline/examples/varbit.cli | 1 -
examples/pipeline/examples/vxlan.cli | 1 -
examples/pipeline/examples/vxlan_pcap.cli | 1 -
lib/pipeline/rte_swx_pipeline.c | 11 +++++++++++
8 files changed, 22 insertions(+), 10 deletions(-)
Comments
27/11/2021 01:02, Cristian Dumitrescu:
> An additional output port is now implicitly created for every pipeline
> to serve as the packet drop port. Up to now, the drop port had to be
> explicitly created for each pipeline.
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
Series applied, thanks.
@@ -2551,10 +2551,17 @@ cmd_pipeline_stats(char **tokens,
rte_swx_ctl_pipeline_port_out_stats_read(p->p, i, &stats);
- snprintf(out, out_size, "\tPort %u:"
- " packets %" PRIu64
- " bytes %" PRIu64 "\n",
- i, stats.n_pkts, stats.n_bytes);
+ if (i != info.n_ports_out - 1)
+ snprintf(out, out_size, "\tPort %u:"
+ " packets %" PRIu64
+ " bytes %" PRIu64 "\n",
+ i, stats.n_pkts, stats.n_bytes);
+ else
+ snprintf(out, out_size, "\tDROP:"
+ " packets %" PRIu64
+ " bytes %" PRIu64 "\n",
+ stats.n_pkts, stats.n_bytes);
+
out_size -= strlen(out);
out += strlen(out);
}
@@ -25,7 +25,6 @@ pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32
pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32
pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32
pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/fib.spec
@@ -25,7 +25,6 @@ pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32
pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32
pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32
pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/learner.spec
@@ -19,7 +19,6 @@ pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32
pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32
pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32
pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/selector.spec
@@ -25,7 +25,6 @@ pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32
pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32
pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32
pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/varbit.spec
@@ -19,7 +19,6 @@ pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32
pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32
pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32
pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/vxlan.spec
pipeline PIPELINE0 table vxlan_table add ./examples/pipeline/examples/vxlan_table.txt
@@ -14,7 +14,6 @@ pipeline PIPELINE0 port out 0 sink none
pipeline PIPELINE0 port out 1 sink none
pipeline PIPELINE0 port out 2 sink none
pipeline PIPELINE0 port out 3 sink none
-pipeline PIPELINE0 port out 4 sink none
pipeline PIPELINE0 build ./examples/pipeline/examples/vxlan.spec
pipeline PIPELINE0 table vxlan_table add ./examples/pipeline/examples/vxlan_table.txt
@@ -9199,6 +9199,9 @@ pipeline_compile(struct rte_swx_pipeline *p);
int
rte_swx_pipeline_build(struct rte_swx_pipeline *p)
{
+ struct rte_swx_port_sink_params drop_port_params = {
+ .file_name = NULL,
+ };
int status;
CHECK(p, EINVAL);
@@ -9208,6 +9211,14 @@ rte_swx_pipeline_build(struct rte_swx_pipeline *p)
if (status)
goto error;
+ /* Drop port. */
+ status = rte_swx_pipeline_port_out_config(p,
+ p->n_ports_out,
+ "sink",
+ &drop_port_params);
+ if (status)
+ goto error;
+
status = port_out_build(p);
if (status)
goto error;