]> git.droids-corp.org - dpdk.git/commitdiff
pipeline: add drop port for each pipeline
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>
Sat, 27 Nov 2021 00:02:54 +0000 (00:02 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 13 Feb 2022 21:30:47 +0000 (22:30 +0100)
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
examples/pipeline/examples/fib.cli
examples/pipeline/examples/learner.cli
examples/pipeline/examples/selector.cli
examples/pipeline/examples/varbit.cli
examples/pipeline/examples/vxlan.cli
examples/pipeline/examples/vxlan_pcap.cli
lib/pipeline/rte_swx_pipeline.c

index 83b460caf6d423c8b19896f7ce644a5e1d2a8ba5..c32349e5f0cab6aadddd14a6043c486f9a67c5e3 100644 (file)
@@ -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);
        }
index b20aed3cf6660021f463e698042e3a358849a0fa..93ab2b08f8e1422c361b9c129154a1fc1704d5c8 100644 (file)
@@ -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
 
index af7792624ff0d3e49c72dcfe494a0c843dec3f6a..688ce34f346c2245650143c0989b353e2827df26 100644 (file)
@@ -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
 
index 36f3ead541ad54009ff4efc2bfc7ae707793e07d..123782c57be90fbfdec3c0a222b8daa508e6efc5 100644 (file)
@@ -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
 
index 0589e32c15fd3b9d5279972abb6281abb77579a2..9caeb9ca2646c792eb0f67aff11adb4020c859de 100644 (file)
@@ -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
 
index a3bde6a9f981a16118a37703a6d83992bd747b46..444f3f7bd8d88ca426a81944b1b86580363a7382 100644 (file)
@@ -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
index c03dc9303debc11baefdbdffcfb6f649af09a8dd..83fca8d0d9c6031cfa5be2bf8590f6b709f6bde7 100644 (file)
@@ -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
index dd914fd935f5064be7737414777a9ba14233982a..c332d44bd13b1e2a337e9da189b6f54349d5ad28 100644 (file)
@@ -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;