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 2C35FA0093 for ; Fri, 18 Mar 2022 16:41:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08C404068A; Fri, 18 Mar 2022 16:41:24 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2053.outbound.protection.outlook.com [40.107.243.53]) by mails.dpdk.org (Postfix) with ESMTP id 391194068A for ; Fri, 18 Mar 2022 16:41:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G6OhIYYMcKz9w82zdjMPMX+vgJtMuoZVSIkgsR8f4HbB0+/ASagi/cRJE46Je59UBVwAFJwKNPLujVJvng7mT0SRW+Ln9yxmH8aZ/9k0Vai2ulyUP1EKDkiz8MDJYlEVl9mE0fThdxImdkl4L5YI89YTJ49cf5NpMUZzlPCv9K1B1dtZRbR6WEKosw4mtb8fb3Pl7zbtbT86zueahSKgAZeSnxumlMIdEFiQf/y+BvoZDY0qmmGlc3OxylJUXli3kMCOjIO8WxuYgdQZeBruKrn/eIirl8Pyk62xcUIkIiB7YCbLwMBN9on3YUUqW7Uq6LfAh4U3rYcgyFVc6PH4tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N5e+aMpkxncg/sZ5mrX331vg6LEkK5OFQ9+nSZdGSNA=; b=nOk7XQ/BFMwQlj7pOLEsE013yddwDhD042lDv2Ln4gBVXPj/MRFBJ4Ps0DsiyUdkDygw47SEO6jRQscfpD15fOMGiQx+fbS447xoyo4fWgYj/9XI5GA/OHzjp6NGGxn2RufyYV32rxETwpzQcjA2aq4R2k+6JC3thNhEKI7TGdpDIRuy3HxDGUgkJd8thYKuHui3P/To0Fi6DGregwRaFCMSa5B7h4xHqzNARBXTwNsP+HnfoemTRILR26jc0q8cif4cOkabrHAAea6nn//O5d3Ndsl0VbvrgFsBF++jrMZMAJgBS/1X5B2egQtKgRFtP22nLY5zW2va9Sz8ydGBSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N5e+aMpkxncg/sZ5mrX331vg6LEkK5OFQ9+nSZdGSNA=; b=OwlyN6a1A2yB2HSXVkZnkf0YP5MUNp1dEE9Yt09zAlDyWOovZJ6OKiiNRou2Zp4loaUzOPxQxLdGvtVvQstX8InhuCXz22oIZg//XAxpoJNluk2nD54uBZtxi+j4Fc4KwwfIMeEIJK1AkXp48esT4aQXKAV7GQcPqjGSdtr89bSyTL02e544GWt7HP5nCNCyd2SVchfm6Whagvr+jOl46zP0/GllPcbP7Nfpk8Xr2djDt5SRMQljQCMpH0Ed9VlKt3rVF9t8bJGzR6CsaPSMErcWvRxuxbiwzBDd7clkKLxXLpusBKk4r01nIeb0iZOc8FA813haba1FeRBucrdxew== Received: from DM5PR05CA0004.namprd05.prod.outlook.com (2603:10b6:3:d4::14) by BL0PR12MB4738.namprd12.prod.outlook.com (2603:10b6:208:8e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Fri, 18 Mar 2022 15:41:20 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:3:d4:cafe::74) by DM5PR05CA0004.outlook.office365.com (2603:10b6:3:d4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.8 via Frontend Transport; Fri, 18 Mar 2022 15:41:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT033.mail.protection.outlook.com (10.13.172.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5081.14 via Frontend Transport; Fri, 18 Mar 2022 15:41:19 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 18 Mar 2022 15:41:19 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 18 Mar 2022 08:41:17 -0700 From: Gerry Gribbon To: CC: , Ori Kam Subject: [PATCH 20.11] app/regex: fix number of matches Date: Fri, 18 Mar 2022 15:40:57 +0000 Message-ID: <20220318154057.1743789-1-ggribbon@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22eb3254-ae0c-4833-5aa1-08da08f5bf73 X-MS-TrafficTypeDiagnostic: BL0PR12MB4738:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0y9uFzbr+uOeKNFnam0VDNuSw0pygW54ltp8HCoDosfSvHxlCCBleXX+dfQ4m5ig+w09JnNMxcF83UYItiLHURxEAYg9J55gNOuukw4+fWNoA7eAet6ZERgucQpJJ3r9L8d4mNmMRtJyJlCrI3Ovod2xco6PkBEDyymrvW+pEaU+ApuMUi3Ic0xfb0pstTslfUJwoDcORib1TG5mpaR6KbVtAVSSSxn8bOnGtOKwAeaAxiw57K+w98yg1J2cJU8ijvvmTvCnsDHm0+F12URL6LrEs3sdTg0HaXmXSI9zja7k4NGMc8gn+OXY/EEjSLVOszh2BXG+ZCahljmS7XcSl4hRNVSLw/y6ZJ0m5yneyTT2TNMs3y1fVDolFupKscWrLl/eE2X9YI23FEi+qUefyOzJDmSyV3gTH3uMbDzVh7T+TZhh2FXlNBLsLg0ik9wQafeHj207jQbP60b23nBC9cJuAXxxUA+H7DxE16xRTeRkXbjzJvJcnyLbQ60Tvv9Q1hv5vNO2klpTBzFmcPW6YTz6ivhDnnT8Hx1F8OS6XXQkfhzcse3sPki/OJ16J3fkiQRe5FIkq0CdKko5AoDW6zSmOCF++TpGLEltnq3cjHMqMO8Z0QatCMIlR5XKJnYvhEnB2VPq4b1MVJECdKIedSiNuTqGFLj/8VwfGCTddBN7UJEiZ+6eFw+uD0Iyikq3QJf3F0bY6uqQ5E9gIGgMPQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(356005)(81166007)(36756003)(2906002)(36860700001)(40460700003)(47076005)(5660300002)(8936002)(55016003)(508600001)(316002)(426003)(336012)(83380400001)(82310400004)(6286002)(70206006)(70586007)(6666004)(16526019)(26005)(186003)(1076003)(7696005)(4326008)(107886003)(86362001)(54906003)(6916009)(2616005)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2022 15:41:19.7270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22eb3254-ae0c-4833-5aa1-08da08f5bf73 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4738 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 [ 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") Cc: stable@dpdk.org Signed-off-by: Gerry Gribbon Acked-by: Ori Kam --- app/test-regex/main.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 6a8eb07ae8..c78f6f36dd 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -254,8 +254,12 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs, char *buf = NULL; long buf_len; long job_len; + long remainder; + long act_job_len = 0; + bool last_job = false; uint32_t actual_jobs = 0; uint32_t i; + uint32_t job_id; struct rte_regex_ops **ops; uint16_t dev_id = 0; uint16_t qp_id = 0; @@ -325,12 +329,25 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs, } /* Assign each mbuf with the data to handle. */ + remainder = buf_len % nb_jobs; + for (i = 0; (pos < buf_len) && (i < nb_jobs) ; i++) { - long act_job_len = RTE_MIN(job_len, buf_len - pos); + act_job_len = RTE_MIN(job_len, buf_len - pos); + + if (i == (nb_jobs - 1)) { + last_job = true; + act_job_len += remainder; + } + rte_pktmbuf_attach_extbuf(ops[i]->mbuf, &buf[pos], 0, act_job_len, &shinfo); jobs_ctx[i].mbuf = ops[i]->mbuf; - 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; ops[i]->user_id = i; ops[i]->group_id0 = 1; @@ -342,6 +359,8 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs, for (i = 0; i < nb_iterations; i++) { total_enqueue = 0; total_dequeue = 0; + for (job_id = 0; job_id < actual_jobs; job_id++) + ops[job_id]->user_id = job_id; while (total_dequeue < actual_jobs) { struct rte_regex_ops **cur_ops_to_enqueue = ops + total_enqueue; @@ -360,10 +379,11 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs, } end = clock(); time = ((double)end - start) / CLOCKS_PER_SEC; - printf("Job len = %ld Bytes\n", job_len); + printf("Job len = %ld Bytes Last Job=%ld Bytes\n", job_len, + act_job_len); printf("Time = %lf sec\n", time); printf("Perf = %lf Gbps\n", - (((double)actual_jobs * job_len * nb_iterations * 8) / time) / + (((double)buf_len * nb_iterations * 8) / time) / 1000000000.0); if (!perf_mode) { @@ -390,9 +410,10 @@ run_regex(struct rte_mempool *mbuf_mp, uint32_t nb_jobs, total_matches += nb_matches; match = 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", + (int)(ops[d_ind % actual_jobs]->user_id + * job_len), + match->len, match->rule_id); match++; } } -- 2.25.1