patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Gerry Gribbon <ggribbon@nvidia.com>
Cc: Ori Kam <orika@nvidia.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'app/regex: fix number of matches' has been queued to stable release 21.11.1
Date: Wed, 16 Mar 2022 15:15:13 +0000	[thread overview]
Message-ID: <20220316151524.1242199-12-ktraynor@redhat.com> (raw)
In-Reply-To: <20220316151524.1242199-1-ktraynor@redhat.com>

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@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@nvidia.com>
Acked-by: Ori Kam <orika@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@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)


  parent reply	other threads:[~2022-03-16 15:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:15 patch 'net/mlx5: fix VLAN push action validation' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix sample flow action on trusted device' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: forbid multiple ASO actions in a single rule' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix implicit tag insertion with sample action' " Kevin Traynor
2022-03-16 15:15 ` patch 'doc: fix modify field action description for mlx5' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix Tx completion' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix Rx bulk' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/qede: fix maximum Rx packet length' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/af_xdp: fix custom program loading with multiple queues' " Kevin Traynor
2022-03-16 15:15 ` patch 'crypto/ipsec_mb: fix GCM requested digest length' " Kevin Traynor
2022-03-16 15:15 ` patch 'bpf: fix build with some libpcap version on FreeBSD' " Kevin Traynor
2022-03-16 15:15 ` Kevin Traynor [this message]
2022-03-16 15:15 ` patch 'app/testpmd: fix show RSS RETA on Windows' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/testpmd: fix GTP header parsing in checksum engine' " Kevin Traynor
2022-03-16 15:15 ` patch 'app/testpmd: fix flow rule with flex input link' " Kevin Traynor
2022-03-16 15:15 ` patch 'examples/l3fwd: fix buffer overflow in Tx' " Kevin Traynor
2022-03-16 15:15 ` patch 'eal/freebsd: add missing C++ include guards' " Kevin Traynor
2022-03-16 15:15 ` patch 'compressdev: fix missing space in log macro' " Kevin Traynor
2022-03-16 15:15 ` patch 'cryptodev: fix clang C++ include' " Kevin Traynor
2022-03-16 15:15 ` patch 'eventdev: " Kevin Traynor
2022-03-16 15:15 ` patch 'build: suppress rte_crypto_asym_op abi check' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix port matching in sample flow rule' " Kevin Traynor
2022-03-16 15:15 ` patch 'net/mlx5: fix CPU socket ID for Rx queue creation' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220316151524.1242199-12-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=ggribbon@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).