patch 'pipeline: fix emit instruction for invalid headers' has been queued to stable release 21.11.2

Kevin Traynor ktraynor at redhat.com
Thu Jun 9 13:35:57 CEST 2022


Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/bf68ce756dcb5287d636a8fbda8d82903d09ab85

Thanks.

Kevin

---
>From bf68ce756dcb5287d636a8fbda8d82903d09ab85 Mon Sep 17 00:00:00 2001
From: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
Date: Wed, 27 Apr 2022 22:56:52 +0100
Subject: [PATCH] pipeline: fix emit instruction for invalid headers

[ upstream commit 775be5b5399da981100f77988b100613ce44a9d5 ]

Fix the emit instruction for the pathological case of all headers to
be emitted being invalid. In this case, the for loop was essentially
skipped and the last emitted header (or an invalid memory location)
getting corrupted by setting its size to 0 through the assignment to
ho->n_bytes right after the for loop.

Fixes: d60dbdc88a3e ("pipeline: create inline functions for emit instruction")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p at intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra at intel.com>
---
 lib/pipeline/rte_swx_pipeline_internal.h | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index fa944c95f2..c8fa978580 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -1821,7 +1821,7 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
 	uint64_t valid_headers = t->valid_headers;
 	uint32_t n_headers_out = t->n_headers_out;
-	struct header_out_runtime *ho = &t->headers_out[n_headers_out - 1];
+	struct header_out_runtime *ho = NULL;
 	uint8_t *ho_ptr = NULL;
-	uint32_t ho_nbytes = 0, first = 1, i;
+	uint32_t ho_nbytes = 0, i;
 
 	for (i = 0; i < n_emit; i++) {
@@ -1835,16 +1835,19 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
 		uint8_t *hi_ptr = t->structs[struct_id];
 
-		if (!MASK64_BIT_GET(valid_headers, header_id))
+		if (!MASK64_BIT_GET(valid_headers, header_id)) {
+			TRACE("[Thread %2u]: emit header %u (invalid)\n",
+			      p->thread_id,
+			      header_id);
+
 			continue;
+		}
 
-		TRACE("[Thread %2u]: emit header %u\n",
+		TRACE("[Thread %2u]: emit header %u (valid)\n",
 		      p->thread_id,
 		      header_id);
 
 		/* Headers. */
-		if (first) {
-			first = 0;
-
-			if (!t->n_headers_out) {
+		if (!ho) {
+			if (!n_headers_out) {
 				ho = &t->headers_out[0];
 
@@ -1859,4 +1862,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
 				continue;
 			} else {
+				ho = &t->headers_out[n_headers_out - 1];
+
 				ho_ptr = ho->ptr;
 				ho_nbytes = ho->n_bytes;
@@ -1880,5 +1885,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
 	}
 
-	ho->n_bytes = ho_nbytes;
+	if (ho)
+		ho->n_bytes = ho_nbytes;
 	t->n_headers_out = n_headers_out;
 }
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-09 12:34:30.013050823 +0100
+++ 0010-pipeline-fix-emit-instruction-for-invalid-headers.patch	2022-06-09 12:34:29.617980422 +0100
@@ -1 +1 @@
-From 775be5b5399da981100f77988b100613ce44a9d5 Mon Sep 17 00:00:00 2001
+From bf68ce756dcb5287d636a8fbda8d82903d09ab85 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 775be5b5399da981100f77988b100613ce44a9d5 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index da3e88bfa8..8d932993fe 100644
+index fa944c95f2..c8fa978580 100644
@@ -26 +27 @@
-@@ -1841,7 +1841,7 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
+@@ -1821,7 +1821,7 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
@@ -36 +37 @@
-@@ -1855,16 +1855,19 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
+@@ -1835,16 +1835,19 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
@@ -62 +63 @@
-@@ -1879,4 +1882,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
+@@ -1859,4 +1862,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
@@ -69 +70 @@
-@@ -1900,5 +1905,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,
+@@ -1880,5 +1885,6 @@ __instr_hdr_emit_many_exec(struct rte_swx_pipeline *p __rte_unused,



More information about the stable mailing list