patch 'app/regex: fix number of matches' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Wed Mar 16 16:15:13 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/21/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/4c1cc03bb6c33c08f015f66a41574a325e1f9c70

Thanks.

Kevin

---
>From 4c1cc03bb6c33c08f015f66a41574a325e1f9c70 Mon Sep 17 00:00:00 2001
From: Gerry Gribbon <ggribbon at nvidia.com>
Date: Wed, 9 Mar 2022 23:41:52 +0000
Subject: [PATCH] app/regex: fix number of matches

[ upstream commit c1d1b94eec5855b3934791a10125e9db5f15298a ]

Depending on number of jobs specified on command line, part of the
data buffer may not get searched, resulting in incorrect number of
matches being reported.

Additional change to ensure the "All Matches" summary outputs the
correct match start locations in the supplied data buffer.

Fixes: de06137cb295 ("app/regex: add RegEx test application")

Signed-off-by: Gerry Gribbon <ggribbon at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
 app/test-regex/main.c | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index 8e665df73c..756726f8db 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -386,8 +386,11 @@ run_regex(void *args)
 	long data_len = rgxc->data_len;
 	long job_len = rgxc->job_len;
-
+	long remainder;
+	long act_job_len = 0;
+	bool last_job = false;
 	char *buf = NULL;
 	uint32_t actual_jobs = 0;
 	uint32_t i;
+	uint32_t job_id;
 	uint16_t qp_id;
 	uint16_t dev_id = 0;
@@ -460,7 +463,14 @@ run_regex(void *args)
 		actual_jobs = 0;
 		pos = 0;
+		remainder = data_len % nb_jobs;
+
 		/* Allocate the jobs and assign each job with an mbuf. */
 		for (i = 0; (pos < data_len) && (i < nb_jobs) ; i++) {
-			long act_job_len = RTE_MIN(job_len, data_len - pos);
+			act_job_len = RTE_MIN(job_len, data_len - pos);
+
+			if (i == (nb_jobs - 1)) {
+				last_job = true;
+				act_job_len += remainder;
+			}
 
 			ops[i] = rte_malloc(NULL, sizeof(*ops[0]) +
@@ -482,5 +492,10 @@ run_regex(void *args)
 					rte_pktmbuf_attach_extbuf(ops[i]->mbuf,
 					&buf[pos], 0, act_job_len, &shinfo);
-					ops[i]->mbuf->data_len = job_len;
+
+					if (!last_job)
+						ops[i]->mbuf->data_len = job_len;
+					else
+						ops[i]->mbuf->data_len = act_job_len;
+
 					ops[i]->mbuf->pkt_len = act_job_len;
 				}
@@ -510,4 +525,7 @@ run_regex(void *args)
 			qp->total_enqueue = 0;
 			qp->total_dequeue = 0;
+			/* Re-set user id after dequeue to match data in mbuf. */
+			for (job_id = 0 ; job_id < nb_jobs; job_id++)
+				qp->ops[job_id]->user_id = job_id;
 		}
 		do {
@@ -555,8 +573,8 @@ run_regex(void *args)
 		qp = &qps[qp_id];
 		time = (long double)qp->cycles / rte_get_timer_hz();
-		printf("Core=%u QP=%u Job=%ld Bytes Time=%Lf sec Perf=%Lf "
+		printf("Core=%u QP=%u Job=%ld Bytes Last Job=%ld Bytes Time=%Lf sec Perf=%Lf "
 		       "Gbps\n", rte_lcore_id(), qp_id + qp_id_base,
-		       job_len, time,
-		       (((double)actual_jobs * job_len * nb_iterations * 8)
+		       job_len, act_job_len, time,
+		       (((double)data_len * nb_iterations * 8)
 		       / time) / 1000000000.0);
 	}
@@ -591,8 +609,8 @@ run_regex(void *args)
 			match = qp->ops[d_ind % actual_jobs]->matches;
 			for (i = 0; i < nb_matches; i++) {
-				printf("start = %ld, len = %d, rule = %d\n",
-						match->start_offset +
-						d_ind * job_len,
-						match->len, match->rule_id);
+				printf("start = %d, len = %d, rule = %d\n",
+					match->start_offset +
+					(int)(qp->ops[d_ind % actual_jobs]->user_id * job_len),
+					match->len, match->rule_id);
 				match++;
 			}
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-03-16 15:14:12.430052648 +0000
+++ 0012-app-regex-fix-number-of-matches.patch	2022-03-16 15:14:12.109847607 +0000
@@ -1 +1 @@
-From c1d1b94eec5855b3934791a10125e9db5f15298a Mon Sep 17 00:00:00 2001
+From 4c1cc03bb6c33c08f015f66a41574a325e1f9c70 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c1d1b94eec5855b3934791a10125e9db5f15298a ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index ab8a3e56e7..7c014b2210 100644
+index 8e665df73c..756726f8db 100644
@@ -26 +27 @@
-@@ -383,8 +383,11 @@ run_regex(void *args)
+@@ -386,8 +386,11 @@ run_regex(void *args)
@@ -39 +40 @@
-@@ -457,7 +460,14 @@ run_regex(void *args)
+@@ -460,7 +463,14 @@ run_regex(void *args)
@@ -55 +56 @@
-@@ -479,5 +489,10 @@ run_regex(void *args)
+@@ -482,5 +492,10 @@ run_regex(void *args)
@@ -67 +68 @@
-@@ -507,4 +522,7 @@ run_regex(void *args)
+@@ -510,4 +525,7 @@ run_regex(void *args)
@@ -75 +76 @@
-@@ -552,8 +570,8 @@ run_regex(void *args)
+@@ -555,8 +573,8 @@ run_regex(void *args)
@@ -87 +88 @@
-@@ -588,8 +606,8 @@ run_regex(void *args)
+@@ -591,8 +609,8 @@ run_regex(void *args)



More information about the stable mailing list