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 57B27A0032; Thu, 1 Sep 2022 10:17:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9CAA40684; Thu, 1 Sep 2022 10:17:25 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by mails.dpdk.org (Postfix) with ESMTP id A2F7C40395 for ; Thu, 1 Sep 2022 10:17:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ToTnuGKgwu69JdnOe/GQ8w3FlhuK8HKLK5a2rSFIHg8bER2zQN2VKMYYc8kGuX/gTbSSk6+vTvd0XWv2en/drlhcxwCrJDZgq8k0ZwgP4F77yjYL6DTl1GBH92pZCycAMbcYdLv/88QzyssX+GC3bKZ3KGy60RvHT000aOlSF+bGhfZ5kemR8wTrd8paBkvwStipp1ErB215NM6Wt6CD0mjrY7cXmdjPOhVBGl6Z9lf6591mF6jvG4Lpc6cz7yV4sgNI4RQ4YqMgTOpLD9fnaaEgXFk6Jb895pJKFS4f6etlBG3RbkU0s+/RtlN5FLryTV5Ziy3xVoy/idCSVgmfRQ== 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=SaT1rQupraeyuBtWOzd2x5+1mgLOzvUsvkfjzZM6y/I=; b=L73iP1AuDp/aGSHNMO/WGLEpN+JtMDh+A4ZTuI0rrGbi+j1z93Gcl/2NjDgUQIZzVcxO/bNhCu8rjdzhhrnPjERSrLVYh4tyVmkd6S+kCxkToxjaNicppFMLns7s48wZVDE9CG2wCKebWFcA2MneJjT9pUwEfQgCtcLHvmhDMDRs0yJIiWKkPltdQ1QG6IGUm70EwPuISe9ccc3fkCouo9Cn0j0otfqPSADc1su9DcsQ9aA+teLcXi5Dwmx5ptZ1PRdaJZWeiQHntEwQalCw5bcyi32CzFN9EUKbbYXOqdPQOWxzjZ6h1rmLNolAg0O+CICIvaolBD1nOmJ9i3mDsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=SaT1rQupraeyuBtWOzd2x5+1mgLOzvUsvkfjzZM6y/I=; b=NOI9jZ6E0Epzc6ASnKN2AnYDFvJJo4aUKDbuENO90DZI6CyoeMLvQn/XnZ878ZoxDYyxYgo8EkNAQey+AhXLgA/2WXxtR5cvo8cSMFeZms3jb5V8OhT+swxmc4O74Sr9a4yL93KDyc0SU4CaurevcVFcu3Kq9QOtAdxJN+8Lhsqwm6PEX4EdJ0YzamY9vg6w6Mth6gtD8D4ZyIm/PNFccKhVz+P24LlrAkI4E/lwnPkwlgbI1L4p9kRe+qIWVZTlNKsuPgAjWb07RzEQtcgAk0Mf8ZhTm5W/ooXdjUl0PpVcTxEY4X+cDnwH/3PEqoQYoEe6KEGhMF4PFM4PPHJTlg== Received: from CY5PR15CA0138.namprd15.prod.outlook.com (2603:10b6:930:68::20) by SN7PR12MB7347.namprd12.prod.outlook.com (2603:10b6:806:29a::15) 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:17:22 +0000 Received: from CY4PEPF0000B8ED.namprd05.prod.outlook.com (2603:10b6:930:68:cafe::7a) by CY5PR15CA0138.outlook.office365.com (2603:10b6:930:68::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14 via Frontend Transport; Thu, 1 Sep 2022 08:17:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by CY4PEPF0000B8ED.mail.protection.outlook.com (10.167.241.9) 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:17:22 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Thu, 1 Sep 2022 08:17:21 +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:17:20 -0700 From: Gerry Gribbon To: CC: , Ori Kam Subject: [PATCH] regexdev: add maximum number of mbuf segments field Date: Thu, 1 Sep 2022 08:16:54 +0000 Message-ID: <20220901081655.2434317-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: bd9e2713-940f-436d-c823-08da8bf26549 X-MS-TrafficTypeDiagnostic: SN7PR12MB7347:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nj1s/PykO3fFDn+XE5ertcxKHKC8k22QoD/VbVjIyyKl35FyBozbvW8l2I4wY3U/8IgHXzYhs/fyVRLkOg9XdLGr3sNyhkhetXg0DRcOhYDdvp/bYNuQXsIMjhPA3vq4OT4QKtLF0TJrp8EFkJxo/a8fwpeO8pNjoDxyJYUKc5348CMaw34ybLXNyiEVO3X5ZP3EcRRh1MeW4j9LQccsEiR2b19C3p3lU8ZH5/AnriaMhkoIru3RUcMyzxTTZZEeacWUlouzZIbauAO7hXiJqoAR5zDx3IXg+HVoqP5Os4fMpzUn3fhP+hgg3jd1zDi3zxa6cjeLRyYLnu3VgPfA2Ac1pPLghZB3VEoIY/fhF0N/c2mjNU1lrwpLPG8WaL7l8UQT8YTCJF2FKr2CbKe6o8SEsUmoedFic/vuKzr4BNC9TEapk3LT4WuoNWqqF0g0xFdlCMfpV50BFRos8ETwKuS2icginYedwT6ZrBqh8iYmJLLBCa713Zz9iX0weousfzcLV5nMO/9Zh/4SQr3boXBdt+vJT/tRIK3SlMm2uHicAktctK5H8BWCQfPvWTKAuhwPTiAI9Wi6pl9sWQhwvj+tm4MUuu3Meb8A4NjYy0XPCNFYQY8v93V9KEpnLIJL5jH753B6NhJBeMgR/2hXpit1SkI6zjZa8OaOTk1jMplDLIWLG0ZutM8qqBm2SsVaiWY7Pf62H99rkg2mNv7it5RsmrmboycpZ8dMenCheLdYuWH7qWYfurMCwZJfZaS3hlYSjJ7gD7T/tjFLmH0eMmbBXlRoqF63QWogDXkB6os= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(136003)(376002)(396003)(346002)(40470700004)(46966006)(36840700001)(8936002)(36860700001)(5660300002)(70586007)(4326008)(8676002)(81166007)(70206006)(83380400001)(82740400003)(36756003)(2906002)(41300700001)(40480700001)(55016003)(336012)(107886003)(86362001)(6666004)(186003)(356005)(1076003)(6286002)(16526019)(2616005)(426003)(40460700003)(82310400005)(47076005)(26005)(54906003)(6916009)(478600001)(316002)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 08:17:22.2777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd9e2713-940f-436d-c823-08da8bf26549 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000B8ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7347 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 Acked-by: Ori Kam --- 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..131d44f474 100644 --- a/lib/regexdev/rte_regexdev.h +++ b/lib/regexdev/rte_regexdev.h @@ -612,6 +612,8 @@ struct rte_regexdev_info { /**< Maximum payload size for a pattern match request or scan. * @see RTE_REGEXDEV_CFG_CROSS_BUFFER_SCAN_F */ + uint16_t max_num_mbuf_segs; + /**< Maximum number of mbuf segments that can be chained together. */ uint32_t max_rules_per_group; /**< Maximum rules supported per group by this device. */ uint16_t max_groups; -- 2.25.1