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 613AFA00C4; Tue, 26 Jul 2022 12:48:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 411D140DDD; Tue, 26 Jul 2022 12:48:07 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2080.outbound.protection.outlook.com [40.107.212.80]) by mails.dpdk.org (Postfix) with ESMTP id 20C6440695 for ; Tue, 26 Jul 2022 12:48:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ac2CZ5JqEByjiRCTBxh6tgQngaAAxQ+RjWi4zn9WYq3w+zsEmmItVZ0EVHaI6eUkUDR7KOM53Zn4Iz92k92HHWGqAlNnSxq1pedQCI24mGJf6mfWV8KSjD657rDla3n0MyTxpIgiozVGPt99LvYi1hhyaEL0R8xcFZD8E7xQeth5Wm9eDx8n6bS11nH8wa6Bq/ERs8Q6AO84/iLtA42oeBibCksw6mYwLvaeopIFpL+hSfBqP9wIXX8Cc6IrOPHrEC04GHRn+fVOGNABniU2etnmDvx1kmjpeh9FtSHt+RRdwX9X5lTvQAtP2Yal62PS2ehDwhb6UltyUQ7dSHgdRQ== 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=jSlmWbm+XIkyheViddQx1wKisHJpbffubQ8Mn+xpgFI=; b=cBxvnCfzKdYowlNAVmaFzdDooYeiLWthxZtbWearo63GGcD2wQOpEzZRcsjS41pm0KHI1BXBGUVtZjjYBr84QMnaSG9xGWRY8k9UvSdSxzHKhzkdZ9jmFNE7iwdYdKt9PiYWU2XKmKuqhXfVL1/fTcNBvjEYnE/8+QrUM9t+Th9uehvcLi84PTGk2LmeYiCwwcBOHTF4dpCRvW+ilh52W/EKUVTjBFFtKW2dftfjpHIfhUIzBq9W3sFCSml4A22O1Ehe+KAX4uUdY1+hpG+DCpFNdBuSuFyx3miOF0VZiw13Mq2aZ7oDd3z2vniatdPjWXt3lFBeU1EM0c9jGmUSlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=jSlmWbm+XIkyheViddQx1wKisHJpbffubQ8Mn+xpgFI=; b=jQAAgPmqQGGTdM4QwUFG9S71dZWBQKB7BJ9/shR5wf9ihXIC8IaDEnHcATpVgTb2nHO5ZYo60Opo4BR3XYpUDV6GhIGO+K2pIFoQEQdaX1F67YUM3aFXFIeC5GHn32ANB41lgAmy+4ZcF39j98PVz+asd3iNq+lpbCa+e8gtqc5dLV/D8u2vBMq28M5cWNxMbv+6h8efpDvOKCQwtvJwEk1jTJv7H5ni79pGFDsuykMxy5C2cZuzbw52270OFRchmTrkcIW/U2XjjVuiyrG9n1K2txk+bsEqZ6q3pOTRfbGlPf10xHDcabJtjo5+lOTbnNjFgoHlLHR2xPQNdX94Jg== Received: from BN8PR15CA0031.namprd15.prod.outlook.com (2603:10b6:408:c0::44) by DS7PR12MB6166.namprd12.prod.outlook.com (2603:10b6:8:99::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Tue, 26 Jul 2022 10:48:04 +0000 Received: from BN8NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:408:c0:cafe::c1) by BN8PR15CA0031.outlook.office365.com (2603:10b6:408:c0::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.23 via Frontend Transport; Tue, 26 Jul 2022 10:48:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT031.mail.protection.outlook.com (10.13.177.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5458.17 via Frontend Transport; Tue, 26 Jul 2022 10:48:03 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 26 Jul 2022 10:47:56 +0000 Received: from nvidia.com (10.126.231.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.26; Tue, 26 Jul 2022 03:47:54 -0700 From: Gerry Gribbon To: CC: Ori Kam Subject: [RFC] regexdev: add maximum number of mbuf segments field Date: Tue, 26 Jul 2022 10:47:07 +0000 Message-ID: <20220726104707.639878-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.231.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: dfd1faf3-7bdb-495d-7263-08da6ef4514c X-MS-TrafficTypeDiagnostic: DS7PR12MB6166:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Iwhs2JAdVJUf/uZ3W1sfNccbuLfZS6cPypoPaa29s1Ul1l2A1RJkmQ6WvypTVJUqVR8ZpmiUJ7eDnaDXxYvZXi38b6DI5jK7jhwR5mhesi5ZQgF7F0iW7/4v+Ej2usOtBym6GeEl4PvVYJhifTvntXICcM7u31LsZp+wYScER2xtR5CzAAPBWwT7nnfvZnpWZAGjzDAwTEnMzR3SM9c5bZSjZ8iBDW/adbhJghQRN5D2TleW0pneKpm3f0GlC78ySVs0BovSNI2ZmKM3aitm4n6LOOCYrylrK/kVPt1EmfDQyLCL3VQD5QOQbaGDqGImMSKOHqMc7W+foYGzy18Zuhe5/3ma8lprGDzKgknBZ15UnwtXB8C9RKYe5rBOa5lWF3+zbESvOmt3d5yUfAgvKTlzR+bvSSBrsIjIE4bqkur74fennCg/KEwA++JQy20HWPrTRbjVtbOxY6D6yIfenMAuSm08uwaP2YVgpl5Rpva4g58uh+UipWPGlLgE3i39HXmx00bFYVw1+FFiNVHSSQ9QFCPnH+NOHJJ1G6ccAJefHIt0wlSnJzLKA3fdBkZDca5J/wlG9r5ou01kJmFjeAHX2do1RG0NyvEKIcOaU8qXEKxaAYXcRFLr7g3tgdagJQeJWGzZHsoJYy+sViXOVduZzR0hv87RTBJiMucjwcNELQLyZff8beLb0qox4KqfPBJCMrQb6Mhi2IbD1ggq41DC67/E2AzYMNejIeBgRDloGLGZFjHE817Splv4MhBEtitkZVrw8VvKfE8xfcaMapU30B2Xtth+Pw78tqIutPnsXqGD29UHgN11fgGtgsGu8Q70wKOg9IT4amp3OE96Fg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(39860400002)(376002)(396003)(346002)(46966006)(40470700004)(36840700001)(6916009)(86362001)(2616005)(82310400005)(7696005)(8676002)(2906002)(70586007)(70206006)(41300700001)(4326008)(316002)(6666004)(83380400001)(47076005)(356005)(16526019)(81166007)(40460700003)(186003)(478600001)(26005)(6286002)(426003)(36860700001)(8936002)(36756003)(5660300002)(336012)(40480700001)(107886003)(82740400003)(1076003)(55016003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2022 10:48:03.9667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfd1faf3-7bdb-495d-7263-08da6ef4514c 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6166 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 query maximum number of mbuf segments that can be chained together. Signed-off-by: Gerry Gribbon --- drivers/regex/mlx5/mlx5_regex.h | 1 + drivers/regex/mlx5/mlx5_regex_fastpath.c | 43 ++++++++++++++++++++++++ drivers/regex/mlx5/mlx5_rxp.c | 1 + lib/regexdev/rte_regexdev.h | 2 ++ 4 files changed, 47 insertions(+) diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h index 89495301ac..98fe95b781 100644 --- a/drivers/regex/mlx5/mlx5_regex.h +++ b/drivers/regex/mlx5/mlx5_regex.h @@ -94,4 +94,5 @@ uint16_t mlx5_regexdev_dequeue(struct rte_regexdev *dev, uint16_t qp_id, struct rte_regex_ops **ops, uint16_t nb_ops); uint16_t mlx5_regexdev_enqueue_gga(struct rte_regexdev *dev, uint16_t qp_id, struct rte_regex_ops **ops, uint16_t nb_ops); +uint16_t mlx5_regexdev_max_segs_get(void); #endif /* MLX5_REGEX_H */ diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c index 9a2db7e43f..16f48627e5 100644 --- a/drivers/regex/mlx5/mlx5_regex_fastpath.c +++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c @@ -41,6 +41,39 @@ /* In WQE set mode, the pi should be quarter of the MLX5_REGEX_MAX_WQE_INDEX. */ #define MLX5_REGEX_UMR_QP_PI_IDX(pi, ops) \ (((pi) + (ops)) & (MLX5_REGEX_MAX_WQE_INDEX >> 2)) +#ifdef RTE_LIBRTE_MLX5_DEBUG +#define MLX5_REGEX_DEBUG 0 +#endif +#ifdef HAVE_MLX5_UMR_IMKEY +static uint16_t max_nb_segs = MLX5_REGEX_MAX_KLM_NUM; +#else +static uint16_t max_nb_segs = 1; +#endif + +uint16_t +mlx5_regexdev_max_segs_get(void) +{ + return max_nb_segs; +} + +#ifdef MLX5_REGEX_DEBUG +static inline uint16_t +validate_ops(struct rte_regex_ops **ops, uint16_t nb_ops) +{ + uint16_t nb_left = nb_ops; + struct rte_mbuf *mbuf; + + while (nb_left--) { + mbuf = ops[nb_left]->mbuf; + if ((mbuf->pkt_len > MLX5_RXP_MAX_JOB_LENGTH) || + (mbuf->nb_segs > max_nb_segs)) { + DRV_LOG(ERR, "Failed to validate regex ops"); + return 1; + } + } + return 0; +} +#endif static inline uint32_t qp_size_get(struct mlx5_regex_hw_qp *qp) @@ -375,6 +408,11 @@ mlx5_regexdev_enqueue_gga(struct rte_regexdev *dev, uint16_t qp_id, struct mlx5_regex_hw_qp *qp_obj; size_t hw_qpid, nb_left = nb_ops, nb_desc; +#ifdef MLX5_REGEX_DEBUG + if (validate_ops(ops, nb_ops)) + return 0; +#endif + while ((hw_qpid = ffs(queue->free_qps))) { hw_qpid--; /* ffs returns 1 for bit 0 */ qp_obj = &queue->qps[hw_qpid]; @@ -409,6 +447,11 @@ mlx5_regexdev_enqueue(struct rte_regexdev *dev, uint16_t qp_id, struct mlx5_regex_hw_qp *qp_obj; size_t hw_qpid, job_id, i = 0; +#ifdef MLX5_REGEX_DEBUG + if (validate_ops(ops, nb_ops)) + return 0; +#endif + while ((hw_qpid = ffs(queue->free_qps))) { hw_qpid--; /* ffs returns 1 for bit 0 */ qp_obj = &queue->qps[hw_qpid]; diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c index ed3af15e40..35a4cfb7ac 100644 --- a/drivers/regex/mlx5/mlx5_rxp.c +++ b/drivers/regex/mlx5/mlx5_rxp.c @@ -45,6 +45,7 @@ mlx5_regex_info_get(struct rte_regexdev *dev __rte_unused, RTE_REGEXDEV_CAPA_QUEUE_PAIR_OOS_F; info->rule_flags = 0; info->max_queue_pairs = UINT16_MAX; + info->max_num_mbuf_segs = mlx5_regexdev_max_segs_get(); return 0; } diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h index 3bce8090f6..7d2e1ee1d0 100644 --- a/lib/regexdev/rte_regexdev.h +++ b/lib/regexdev/rte_regexdev.h @@ -622,6 +622,8 @@ struct rte_regexdev_info { /**< Supported compiler rule flags. * @see RTE_REGEX_PCRE_RULE_*, struct rte_regexdev_rule::rule_flags */ + uint16_t max_num_mbuf_segs; + /**< Maximum number of mbuf segments that can be chained together. */ }; /** -- 2.25.1