From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA3F8A0032 for ; Wed, 16 Mar 2022 16:15:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E503C41152; Wed, 16 Mar 2022 16:15:57 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 5233A41152 for ; Wed, 16 Mar 2022 16:15:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647443755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hcgaDPbBMJs+ydYWTVkTysPNA0Xwq9ahX4kU1MSRhhs=; b=fnnzciWQoTMML41PznAFalCmyT7Jq824B8mm0hNDOU/+YERxJaH4ywYM0PbVoWH7hS2YWv d3Hh/4oNC9XXs/7HSS6568Vlk4kGU9I2CAqAX9p+CM3VnZyINlrGmiGhZo0jxzgTl6SP3q Mi74SklR76QZwzVz0olaNJUUgEg8Q7U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-417-TqWvPIl9M06Pmu-aU6oAmQ-1; Wed, 16 Mar 2022 11:15:52 -0400 X-MC-Unique: TqWvPIl9M06Pmu-aU6oAmQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 170FE8039D6; Wed, 16 Mar 2022 15:15:52 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C26A401053; Wed, 16 Mar 2022 15:15:50 +0000 (UTC) From: Kevin Traynor To: Gerry Gribbon Cc: Ori Kam , dpdk stable 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 Message-Id: <20220316151524.1242199-12-ktraynor@redhat.com> In-Reply-To: <20220316151524.1242199-1-ktraynor@redhat.com> References: <20220316151524.1242199-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 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 Acked-by: Ori Kam --- 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)