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 007F6A0032; Thu, 1 Sep 2022 10:23:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCBFA40684; Thu, 1 Sep 2022 10:23:12 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2060.outbound.protection.outlook.com [40.107.100.60]) by mails.dpdk.org (Postfix) with ESMTP id 3968740395 for ; Thu, 1 Sep 2022 10:23:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2sP6K7/Mieq4zIIIvOcWS+OaRx9eyrIwMRaxjvR5BqGB4NlBEae3ezJ+j+7EmGZFKXPozdzzjjtLZClDttx3y+RfzobsLGkIwukpwLBHn2zEa1Zyx/W888OIYR/WUTFkfiUG3lIkg4f7YbT+M4jo5gY8TdIWgYSWtNLs6uyc61jEb3zBSN1zc6puf8O0xHhTk98UGTDmf8Pj2yVMUwHyx2DMzS/6VXs5sOgiAasJGVwKw0I2JxT3GSxZ9qj2kLfZP8XgvA0X5qxMcFTkDrtw75D1/6IiHTsOHM+qBqiic0V8SawFsaAJbAjqNsFWwI/Nx5q40Z5nHIWl92PnERwmg== 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=0s1quiIozm/H+0Wydh/CCCXOnM3jF5UCiaRAGVbBvTc=; b=E771GjfmTIX7kLrieKBdeOxRwxRKP9yNyySC7EXUw9tYFWzzLEzcqkn1l1KcDPbP79G5sUDyg2AUX38zYddyz9nADwQB5dQLDrM8FT5cKFwYxHNG9KZ0rsZbQ0/6610fASUY/jw71/hqCmczyYolmGT/YS9GYyjy2ae5SeEKSZ63DjdToWTVFQjTUFaybz/8p9/hX62GtvWWcBtwzHMRVdK1gro544gZW65625Cy6qcKOjZsFqKnTzNReqIvviliRV2XUVXCoaAUNlmkvQlsypx3mZ3Im4oczVsHapzrdq3DEqORNpx72TdFgIaS2TmURGOaP/rwGOr+ZdXbqU6MLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=0s1quiIozm/H+0Wydh/CCCXOnM3jF5UCiaRAGVbBvTc=; b=T75+FYkgvIbqQlaruUz2Dx/uuszevQ25HQbysTwIY875XScvLgkLgjHFwMe6TNmN+9XQt0JM06VIsxcCL4deca5vopiE3QmBZRmDnqTxJ6BGA4bZaJo9wAHJ0n6++XPEHYkiiV/SOOjgATRePII06JrgealQF88QDSFDtUK/x2wsmb7YliZoSyEDANzWgOoLoenEqE8K9ltgwZJ3godH+satGOaHt2BzMmOfpSiyQZ6Via9LYZ6qFZZhbLsFp9tTtrM1DTlzjHpJ7044NYaPmE84dVkQPQOF0z96ITvGsys3fscYIrY/KP80Hf0q/gf/I6kuWJUrmGqX0VnD7OQEqA== Received: from CY5PR22CA0058.namprd22.prod.outlook.com (2603:10b6:930:1d::9) by MN0PR12MB5859.namprd12.prod.outlook.com (2603:10b6:208:37a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Thu, 1 Sep 2022 08:23:09 +0000 Received: from CY4PEPF0000B8EB.namprd05.prod.outlook.com (2603:10b6:930:1d:cafe::6e) by CY5PR22CA0058.outlook.office365.com (2603:10b6:930:1d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12 via Frontend Transport; Thu, 1 Sep 2022 08:23:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by CY4PEPF0000B8EB.mail.protection.outlook.com (10.167.241.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5588.7 via Frontend Transport; Thu, 1 Sep 2022 08:23:09 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Thu, 1 Sep 2022 08:23:08 +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.29; Thu, 1 Sep 2022 01:23:06 -0700 From: Gerry Gribbon To: CC: , , Ori Kam Subject: [PATCH] regexdev: add match mode command line parameter Date: Thu, 1 Sep 2022 08:22:37 +0000 Message-ID: <20220901082237.2434549-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: 371d0d53-966f-45e7-fd0d-08da8bf33405 X-MS-TrafficTypeDiagnostic: MN0PR12MB5859:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +EePqVwIn9cU6iiERITznSHFEdISeUJnrmdqxHOBNazha9QcCOXQDJcUSbgvNxETAkoKBwjQoTueuBkoPSy+VfF2UdF2PYJP5nRDr5mnodauSg2syp+84u+kX+hVtxA25IpFw+cdZUEPHL6u8B+UVORKQQ7bfc1OgCpCEJTIaNlIfIxb2J2nwQ13KbcIvYDD94q2+RERacZuEVxlw+/U16T1+zw7x4GTDGbbKteTyphestHiioBGB584m0xP43xWlrO3ZlDJGvwF1+ZkVGqnU4J9Cq7wQt2nTOW3hQ5g0y+nUOzdzMunRcp9V9UY2FJoI24kwaycVTo/0DoBFcc1yu5JMGOXPfRiaWMeHt8RN8kGpQYOhiN9wmGNEm3f+NBRjw2oE67rzcvHsrxzTH9L7xqx7sYdUUw+PHnu5GvAgrw6sobOH2VJprCVrSPUayOkdWxfKpes2h06aJxhqA10VujSPbUZXDxNXe1TiXiHDH2cwT7mxfgFV2Gw9l1v+nADGDra0ZdnCycqpzUspGCc7gHX2xvJp8+jOHEXRwQwq5zN+Uw5PQxwwstI4u2AT2MbsUEZ55SjWqPvduteMOLO9pqIvvVt5wYUWSzLvDN4l+wXHDi8vQM/XOMgXFGMC0eSuT2++sp6tk8oYUqgOGHFWL9ANjq2nnRcaoY+SRhWFc7Bng2EFDmM6FVym3TXQlY/1OM4VyGyy9QA32Z6JevhQ4d9n/lkn/6d9osMZ8yzIlRKGUKGRHsl8EvvVmr2gNPsTSguMq6PtlZsA1m2f3av9LSERysK4yeMrw0o5/xvoA+z9ZnnM2WsJY8s6kH/7G+z X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(396003)(376002)(136003)(346002)(36840700001)(46966006)(40470700004)(81166007)(2906002)(86362001)(70206006)(70586007)(8676002)(4326008)(40460700003)(2616005)(316002)(6916009)(54906003)(356005)(6286002)(186003)(16526019)(5660300002)(1076003)(83380400001)(336012)(7696005)(426003)(47076005)(82310400005)(8936002)(478600001)(82740400003)(26005)(40480700001)(41300700001)(36860700001)(107886003)(55016003)(36756003)(6666004)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 08:23:09.1217 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 371d0d53-966f-45e7-fd0d-08da8bf33405 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000B8EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5859 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Allows application to specify match mode to be used. Signed-off-by: Gerry Gribbon Acked-by: Ori Kam --- app/test-regex/main.c | 38 ++++++++++++++++++++++-- doc/guides/tools/testregex.rst | 3 ++ drivers/regex/mlx5/mlx5_regex_fastpath.c | 8 +++-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 351c36a879..29e0bc391d 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -25,6 +25,7 @@ #define MBUF_CACHE_SIZE 256 #define MBUF_SIZE (1 << 8) #define START_BURST_SIZE 32u +#define MAX_MATCH_MODE 2 enum app_args { ARG_HELP, @@ -36,6 +37,7 @@ enum app_args { ARG_NUM_OF_QPS, ARG_NUM_OF_LCORES, ARG_NUM_OF_MBUF_SEGS, + ARG_NUM_OF_MATCH_MODE, }; struct job_ctx { @@ -72,6 +74,7 @@ struct regex_conf { long data_len; long job_len; uint32_t nb_segs; + uint32_t match_mode; }; static void @@ -85,14 +88,17 @@ usage(const char *prog_name) " --nb_iter N: number of iteration to run\n" " --nb_qps N: number of queues to use\n" " --nb_lcores N: number of lcores to use\n" - " --nb_segs N: number of mbuf segments\n", + " --nb_segs N: number of mbuf segments\n" + " --match_mode N: match mode: 0 - None (default)," + " 1 - Highest Priority, 2 - Stop On Any\n", prog_name); } static void args_parse(int argc, char **argv, char *rules_file, char *data_file, uint32_t *nb_jobs, bool *perf_mode, uint32_t *nb_iterations, - uint32_t *nb_qps, uint32_t *nb_lcores, uint32_t *nb_segs) + uint32_t *nb_qps, uint32_t *nb_lcores, uint32_t *nb_segs, + uint32_t *match_mode) { char **argvopt; int opt; @@ -116,6 +122,8 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, { "nb_lcores", 1, 0, ARG_NUM_OF_LCORES}, /* Number of mbuf segments. */ { "nb_segs", 1, 0, ARG_NUM_OF_MBUF_SEGS}, + /* Match mode. */ + { "match_mode", 1, 0, ARG_NUM_OF_MATCH_MODE}, /* End of options */ { 0, 0, 0, 0 } }; @@ -158,6 +166,12 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, case ARG_NUM_OF_MBUF_SEGS: *nb_segs = atoi(optarg); break; + case ARG_NUM_OF_MATCH_MODE: + *match_mode = atoi(optarg); + if (*match_mode > MAX_MATCH_MODE) + rte_exit(EXIT_FAILURE, + "Invalid match mode value\n"); + break; case ARG_HELP: usage(argv[0]); break; @@ -382,6 +396,7 @@ run_regex(void *args) char *data_buf = rgxc->data_buf; long data_len = rgxc->data_len; long job_len = rgxc->job_len; + uint32_t match_mode = rgxc->match_mode; long remainder; long act_job_len = 0; bool last_job = false; @@ -506,6 +521,21 @@ run_regex(void *args) jobs_ctx[i].mbuf = ops[i]->mbuf; ops[i]->user_id = i; ops[i]->group_id0 = 1; + switch (match_mode) { + case 0: + /* Nothing to set in req_flags */ + break; + case 1: + ops[i]->req_flags |= RTE_REGEX_OPS_REQ_MATCH_HIGH_PRIORITY_F; + break; + case 2: + ops[i]->req_flags |= RTE_REGEX_OPS_REQ_STOP_ON_MATCH_F; + break; + default: + rte_exit(EXIT_FAILURE, + "Invalid match mode value\n"); + break; + } pos += act_job_len; actual_jobs++; } @@ -709,6 +739,7 @@ main(int argc, char **argv) long data_len; long job_len; uint32_t nb_lcores = 1, nb_segs = 1; + uint32_t match_mode = 0; struct regex_conf *rgxc; uint32_t i; struct qps_per_lcore *qps_per_lcore; @@ -722,7 +753,7 @@ main(int argc, char **argv) if (argc > 1) args_parse(argc, argv, rules_file, data_file, &nb_jobs, &perf_mode, &nb_iterations, &nb_qps, - &nb_lcores, &nb_segs); + &nb_lcores, &nb_segs, &match_mode); if (nb_qps == 0) rte_exit(EXIT_FAILURE, "Number of QPs must be greater than 0\n"); @@ -763,6 +794,7 @@ main(int argc, char **argv) .data_buf = data_buf, .data_len = data_len, .job_len = job_len, + .match_mode = match_mode, }; rte_eal_remote_launch(run_regex, &rgxc[i], qps_per_lcore[i].lcore_id); diff --git a/doc/guides/tools/testregex.rst b/doc/guides/tools/testregex.rst index cdb1ffd6ee..17175854e6 100644 --- a/doc/guides/tools/testregex.rst +++ b/doc/guides/tools/testregex.rst @@ -71,6 +71,9 @@ Application Options ``--nb_segs N`` number of mbuf segment +``--match_mode N`` + match mode: 0 - None (default), 1 - Highest Priority, 2 - Stop on Any + ``--help`` print application options diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c index 9a2db7e43f..86edfacee3 100644 --- a/drivers/regex/mlx5/mlx5_regex_fastpath.c +++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c @@ -125,8 +125,12 @@ __prep_one(struct mlx5_regex_priv *priv, struct mlx5_regex_hw_qp *qp_obj, op->group_id2 : 0; uint16_t group3 = op->req_flags & RTE_REGEX_OPS_REQ_GROUP_ID3_VALID_F ? op->group_id3 : 0; - uint8_t control = op->req_flags & - RTE_REGEX_OPS_REQ_MATCH_HIGH_PRIORITY_F ? 1 : 0; + uint8_t control = 0x0; + + if (op->req_flags & RTE_REGEX_OPS_REQ_MATCH_HIGH_PRIORITY_F) + control = 0x1; + else if (op->req_flags & RTE_REGEX_OPS_REQ_STOP_ON_MATCH_F) + control = 0x2; /* For backward compatibility. */ if (!(op->req_flags & (RTE_REGEX_OPS_REQ_GROUP_ID0_VALID_F | -- 2.25.1