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 3B64CA0032; Thu, 1 Sep 2022 10:17:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F72F427F1; Thu, 1 Sep 2022 10:17:47 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.51]) by mails.dpdk.org (Postfix) with ESMTP id 3379141155 for ; Thu, 1 Sep 2022 10:17:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n1KS3ZT8pnnP4JDVzrvf4yaJkm24X4ZjHVeQYKXz2pFcVrVihc9b09V4Tpjbn0snJGxCR5Q79yuq7kmeexQjHwQdX9TYp8tlg5rwfi1fMBmZ19ES8nm2I1Q1kP4L8Pz//WV4uZ2T7DVyq5uDABxo/9gKwQG+oVNbjQPkzhhoQ3zYCH/JzPveVbJZrijOhrOT5duAgQ5D9Hg9yLc16JcO2Lf1wmrlGUwLJkciDv2zfxtgMbPIlyYxBW+vlUrGXSN7CsxSsI30Rd2JQbOXVDonc0ZdaSHuPTtKr0ANUIdQOPGbcY7ZJ2mcETOTcRQ8I6MsQgVrRIsB4AbOhOkfRkebig== 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=dWv4qqML73uIG5efsD1wkPV3FgcGGxhJAfhHWBIhEcaaVwJ7c1AwInxFGBSWDOerwAmDlcSExsSo6qmu35U5z8XZ6xGPCXRIsPfGGFvW3NePj76ECNu9neoojwJlKJvzGKk2L94G+dI858QqLyJr7pGp3+hmYJCBB+CZp6USmKbpr+iX3RgPyTEqVZNLsTnULlEcTIfg7RNX/CHwJnMD4wxLXNYopWOCv/GJBgWd9C4ZJOMpOPM7/sfAxXfozgiCZ3aud4u6kQLrlOHPMH/ECdcxa5ZcDcl0AJFfkNPqsv1sky/0P5oNbuu+qPYXQ/R4EiebXf6EDqUM3b2W7fr3Dg== 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=IPO0aUOH1WKtXFywa16u3ChGm8mz3S24W5TFDhPbUwWfqT9BGAmrMXRw2F8sPO87B/tHfhO30i/XcAlhQ4dAHNz06dsJbrJ9TWStz+vGqCgzQagVXLUZHcXhN+xbchHmi8SMdkJbucDHyn0Cxh2pIlkgPFVKWCG5WQ6VWY31/99uksYMgmccIrTmiDlu6hUNC/SMg6JdbTBdgZHTB5Dt4X2H8kzmya0JDHczl6GpKSXFdCN9n4+NX2uT8ADXtbFO5BuvzzmEMgASU/FacGMppKf7QGtD9nogsjxIhg4TG9RFFjrGc/MTLV8XkZkOPUB4Q6UTU30B25SRhU4Tb8k8pw== Received: from CY5PR15CA0137.namprd15.prod.outlook.com (2603:10b6:930:68::17) by DS0PR12MB7632.namprd12.prod.outlook.com (2603:10b6:8:11f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 1 Sep 2022 08:17:41 +0000 Received: from CY4PEPF0000B8ED.namprd05.prod.outlook.com (2603:10b6:930:68:cafe::2a) by CY5PR15CA0137.outlook.office365.com (2603:10b6:930:68::17) 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:41 +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:41 +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:40 +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:39 -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:55 +0000 Message-ID: <20220901081655.2434317-2-ggribbon@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901081655.2434317-1-ggribbon@nvidia.com> References: <20220901081655.2434317-1-ggribbon@nvidia.com> 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: 76c40535-4ac7-40f9-2565-08da8bf27098 X-MS-TrafficTypeDiagnostic: DS0PR12MB7632:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: igjelRFOIqRRCvU4MdaS4ogvtoKf2g3VErBbgIzRaZCE2D7wiVnQ04UjB74BnYxmhLQLSfZWttZICrxRTHo+pi3p35GXPeRCZDt2ddOxc8WXjSFyU2QWjcvNRWKa8N5eFSSvfvMF69Mdyw6UJxTa5DWhFOZ8yrsoDvgb3KLqcVPX6lDAERVM1CsjURSqWBKjkq3xmI/P1Gl0HFvROpfM3X1fZ7g+TVxnTlTKPXmJEBNDgMXKPqTeH3kYfBkGwD1q0p3VJrl9J6ejSwcjfhwWExV8jb4YdbR2jUxNrvHfEBiDLIvORTeKVZKp4y3rW9Uwj24JWpRGg1k6DUoq4xGJ4gaK/gOfI+KYUKTYGvCQtF3ViCOKtx8C5MVzJOcpaSsVIB61kmDRrHyU42TrCfKm6lOX2wE9nfCvt0E9upjmQKjIuCtw78t/Au5WpCiYem7EXEvqviWe8SpcHH+WpQdYWSu2loezR+/UsSDc4cMShEGiLE0Pl5yT5C7mIbn5sz41KH2HV3J6P7ToFhAJwni4eWg7EbDAfXU1uKQv3yZIgAstGPL8aaiNIphVd+eehkuSIdpTNWswwDNwpRhcdixmftL8remDpEGTkLKuoHsDZ+XXbPK5LqkGTUwxvfL+6pkJylWLU6FSj3AOIogjY1MDa1Kj/StJPzd7afXOSn50y9flPN+/cOisCh2eiU+YkFhBCJc/D7Mq1fzAMTW9/9a8/Prou2ilF0r9IgpbFzYxJq6b4uJfI7t3PRx3h0fL9Dwy5U3XosNwViGBYwvFm1GGFQ1L/dQhyp68WHMlNp0kHt0= 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)(396003)(136003)(376002)(39860400002)(346002)(46966006)(36840700001)(40470700004)(82310400005)(316002)(6916009)(36756003)(54906003)(478600001)(70206006)(70586007)(8676002)(82740400003)(4326008)(356005)(40460700003)(8936002)(40480700001)(81166007)(55016003)(83380400001)(5660300002)(41300700001)(36860700001)(186003)(86362001)(26005)(7696005)(107886003)(2906002)(2616005)(1076003)(6666004)(426003)(6286002)(47076005)(16526019)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 08:17:41.2462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76c40535-4ac7-40f9-2565-08da8bf27098 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: DS0PR12MB7632 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