From patchwork Thu Feb 2 16:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 122976 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2EEEA41BAE; Thu, 2 Feb 2023 17:26:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5206843018; Thu, 2 Feb 2023 17:26:09 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by mails.dpdk.org (Postfix) with ESMTP id 10A5842FFC for ; Thu, 2 Feb 2023 17:26:08 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WPe+dFlBQmUJBLa2uwym0jTBpatazKkUlJQG4JO8YN3Pok3Wbt/hJs9WG2yuE24i4dzDj/yP+l0pHn6terRD/Y/kp18M4XcpETSaBettkgZcxG0Hcl+lRKcnjJcSmGApAHdGK06Gjb/WeX8kl1EyHv3OxZMyP4gdOD4CtCKAG8Es/+OUVBynvxjw0Kchl0PX+Ke4tgxl6OqJUc5cgMZ1EWf8HZcBgZuMpTvG6E45cUv9x1K9KZQ7GUP8RLL+5hyGivITlAQ5nVwqfW8gPGQx4qLUoXnWZ/ewZ+nL2OwR/gMvV1Wi4SWqL31KCq1WueNgJBS6xVUaiXVv2phFjH/wAg== 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=6+dAILEV0MIAIyJd/biHr4387MeojNi/feJbLqT903c=; b=NpzWJeKAMbax/xZp3YZrPw6+PMxJCaZ3TvPvjWaTQfTZ9A55MbB9UMRcmQcqQrZ/gYfn55q4PBuxItfE6trfiQ9RpWmdfM5vSVyxI423t2jS0icSRWgWp0leeZzvk3IJnPx8GcNxJbZer2z9cQb6n17HF05HFRDSzbvy87c7aEoVfIcNEODil1jx+iGBDOxNyZhSwVDeuganD6QOF76M8tkx1s1BKdT/RmsW5GTdXe15gWjS2tJSZXeN4bnI+RBedxiQtIAQhB2DhDdBBM9ESOZU0gUoC634s4vHP+SHV2Uz78UrtqaKS1jZMBRs0e1deqWgCo+Cm+Zb3TPQRY5i2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=6+dAILEV0MIAIyJd/biHr4387MeojNi/feJbLqT903c=; b=G9oDOiEeon5SM3IzJpRjzlXdBZ3SREcn5YVRwlQf3URCSC4nLN8zfHmarYfLh5FtI6NGzSMCJYb9WiXfKOBPaLIK9tKhzZZBI95q4g2b/rA5CyrWskHViutrMTkYI2vElNYHdu3MH9MstNVrRY+/P0EH2P3g9yOJFgvwJgqFqoip4LhY2pzemqzO/kb8yjMgPwtuYJaKbG0wmBCx/WuViqqsBK4LNAvHYrkM1pWeOgj+lpfFPKm5DZsUDO2d7yfCwahPw2cOeqSLXUW1l8FPbr1SIsC4P4/nboik92sMfXnnWMYYFzcyoA5VnLMUuB5rI7suoWB2Wvoh8Onjc0PSdw== Received: from DS7PR05CA0107.namprd05.prod.outlook.com (2603:10b6:8:56::25) by MW3PR12MB4363.namprd12.prod.outlook.com (2603:10b6:303:56::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25; Thu, 2 Feb 2023 16:26:06 +0000 Received: from DM6NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::c9) by DS7PR05CA0107.outlook.office365.com (2603:10b6:8:56::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.7 via Frontend Transport; Thu, 2 Feb 2023 16:26:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT078.mail.protection.outlook.com (10.13.173.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 16:26:05 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 08:26:00 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 08:26:00 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36 via Frontend Transport; Thu, 2 Feb 2023 08:25:58 -0800 From: Michael Baum To: CC: Matan Azrad , Akhil Goyal , "Thomas Monjalon" Subject: [PATCH v2 8/8] compress/mlx5: add support for LZ4 algorithm Date: Thu, 2 Feb 2023 18:25:37 +0200 Message-ID: <20230202162537.1067595-9-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230202162537.1067595-1-michaelba@nvidia.com> References: <20230109075838.2508039-1-michaelba@nvidia.com> <20230202162537.1067595-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT078:EE_|MW3PR12MB4363:EE_ X-MS-Office365-Filtering-Correlation-Id: 712ad54c-827e-4bed-61c7-08db053a2f19 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hs2Cj7UoFwAaVi3Vw48hNhaPYfxmr2ynWg8hWjNd9zWcnc8ekllumTPQWDgkZBkTbriLs93TYnl1EBK98RHK00MdqwMusalTIMmiCWkOJ9M+kU7ucBDVhOgstx8pskPuBItgjhuXfrSI1hY42WNfiRZVUIN96SH3/lmkMdct1nwEKcVPxnReEMr+G22lqx0s8ezWnIJ1zybfNpQSdnJE2fDEEpfYJ6dtV7+KWWIvLjSpyGQ1xgLOpPO0rWJzNTwB4jSYXhdm84aHfUStTxkGsyflLGHOLoiKFhKNU8f+BuVwyrn9+1F83hXUFPi2WeedsrqIuuy/dd2U/GOBjSBuNX9OOG2nK7eiGdb2KM5D0DrqTOB6mcsuggH5RS4NVJEKFbhfXyKLPMAwLHUjHoFFSs3PRiyfDsyafZnM7MlRYo7dg04GHDhbWvIrtEqcLvDlnwOEr6WeTTOgsVtNe7785qEWJrN2ysdOIiNV1N9/01PMDoTD681IRhFmo945tuIRmcK2nEooEM8/wSzl5h24tIwvG6KCXPA8TUw6qDiR1yTIrJRj9/5j/Mdj0CMsXpDuJTeSA0rrTGZwA7UVs4/PC3U28QHBLVXUJT9fhpGQxohXduRN3huH2qABum6skSa4hdN3+N4rQiEGiYpj10HNtsic5IbCzISLXqYk9DTA292FP/3ZuOicanS3k9zgkM2FAsyyc+0rj+BTOGi21MdmoA== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199018)(36840700001)(40470700004)(46966006)(83380400001)(82310400005)(426003)(2906002)(336012)(2616005)(40460700003)(6286002)(7696005)(26005)(8936002)(30864003)(36860700001)(316002)(7636003)(36756003)(1076003)(6666004)(186003)(47076005)(5660300002)(82740400003)(86362001)(40480700001)(478600001)(41300700001)(356005)(70206006)(54906003)(55016003)(6916009)(8676002)(70586007)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 16:26:05.7929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 712ad54c-827e-4bed-61c7-08db053a2f19 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4363 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 Add support for decompress LZ4 algorithm for mlx5 PMD. Signed-off-by: Michael Baum --- doc/guides/compressdevs/features/mlx5.ini | 18 ++- doc/guides/compressdevs/mlx5.rst | 49 ++++++- doc/guides/rel_notes/release_23_03.rst | 4 + drivers/compress/mlx5/mlx5_compress.c | 150 ++++++++++++++++++---- 4 files changed, 180 insertions(+), 41 deletions(-) diff --git a/doc/guides/compressdevs/features/mlx5.ini b/doc/guides/compressdevs/features/mlx5.ini index 891ce47936..28b050144a 100644 --- a/doc/guides/compressdevs/features/mlx5.ini +++ b/doc/guides/compressdevs/features/mlx5.ini @@ -4,10 +4,14 @@ ; Supported features of 'MLX5' compression driver. ; [Features] -HW Accelerated = Y -Deflate = Y -Adler32 = Y -Crc32 = Y -Adler32&Crc32 = Y -Fixed = Y -Dynamic = Y +HW Accelerated = Y +Deflate = Y +LZ4 = Y +Adler32 = Y +Crc32 = Y +Adler32&Crc32 = Y +xxHash32 = Y +Fixed = Y +Dynamic = Y +LZ4 Block Checksum = Y +LZ4 Block Independence = Y diff --git a/doc/guides/compressdevs/mlx5.rst b/doc/guides/compressdevs/mlx5.rst index 37839a59e3..c834025732 100644 --- a/doc/guides/compressdevs/mlx5.rst +++ b/doc/guides/compressdevs/mlx5.rst @@ -14,8 +14,8 @@ NVIDIA MLX5 Compress Driver that are now NVIDIA trademarks. The mlx5 compress driver library -(**librte_compress_mlx5**) provides support for **NVIDIA BlueField-2** -families of 25/50/100/200 Gb/s adapters. +(**librte_compress_mlx5**) provides support for **NVIDIA BlueField-2** and +**NVIDIA BlueField-3** families of 25/50/100/200 Gb/s adapters. Design ------ @@ -39,11 +39,27 @@ Features Compress mlx5 PMD has support for: -Compression/Decompression algorithm: +- Compression +- Decompression +- DMA -* DEFLATE. +Algorithms +---------- -NULL algorithm for DMA operations. +NULL algorithm +~~~~~~~~~~~~~~ + +NULL algorithm is the way to perform DMA operations. +It works through either compress or decompress operation. + +Shareable transformation. + +Checksum generation: + +* CRC32, Adler32 and combined checksum. + +DEFLATE algorithm +~~~~~~~~~~~~~~~~~ Huffman code type: @@ -60,11 +76,31 @@ Checksum generation: * CRC32, Adler32 and combined checksum. +LZ4 algorithm +~~~~~~~~~~~~~ + +Support for flags: + +* ``RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM`` +* ``RTE_COMP_LZ4_FLAG_BLOCK_INDEPENDENCE`` + +Window size support: + +1KB, 2KB, 4KB, 8KB, 16KB and 32KB. + +Shareable transformation. + +Checksum generation: + +* xxHash-32 checksum. + Limitations ----------- * Scatter-Gather, SHA and Stateful are not supported. * Non-compressed block is not supported in compress (supported in decompress). +* Compress operation is not supported by BlueField-3. +* LZ4 algorithm is not supported by BlueField-2. Driver options -------------- @@ -75,7 +111,7 @@ for an additional list of options shared with other mlx5 drivers. - ``log-block-size`` parameter [int] Log of the Huffman block size in the Deflate algorithm. - Values from [4-15]; value x means block size is 2^x. + Values from [4-15]; value x means block size is 2\ :sup:`x`. The default value is 15. @@ -83,6 +119,7 @@ Supported NICs -------------- * NVIDIA\ |reg| BlueField-2 SmartNIC +* NVIDIA\ |reg| BlueField-3 SmartNIC Prerequisites ------------- diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index aedc5767ff..3d97a4611d 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -86,6 +86,10 @@ New Features * Added support for ``RTE_COMP_CHECKSUM_XXHASH32``. * Added support for ``lz4`` in test-compress-perf algo options. +* **Updated NVIDIA mlx5 compress PMD.** + + * Added LZ4 algorithm support for decompress operation. + * **Allowed test single compress operation in test-compress-perf.** Enable the application options for testing only compress and only decompress. diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 7841f57b9c..e33b58ab54 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -24,6 +24,7 @@ #define MLX5_COMPRESS_DRIVER_NAME mlx5_compress #define MLX5_COMPRESS_MAX_QPS 1024 #define MLX5_COMP_MAX_WIN_SIZE_CONF 6u +#define MLX5_COMP_NUM_SUP_ALGO 4 struct mlx5_compress_devarg_params { uint32_t log_block_sz; @@ -43,6 +44,7 @@ struct mlx5_compress_priv { struct mlx5_common_device *cdev; /* Backend mlx5 device. */ struct mlx5_uar uar; struct rte_compressdev_config dev_config; + struct rte_compressdev_capabilities caps[MLX5_COMP_NUM_SUP_ALGO]; LIST_HEAD(xform_list, mlx5_compress_xform) xform_list; rte_spinlock_t xform_sl; uint32_t log_block_sz; @@ -70,36 +72,16 @@ static pthread_mutex_t priv_list_lock = PTHREAD_MUTEX_INITIALIZER; int mlx5_compress_logtype; -static const struct rte_compressdev_capabilities mlx5_caps[] = { - { - .algo = RTE_COMP_ALGO_NULL, - .comp_feature_flags = RTE_COMP_FF_ADLER32_CHECKSUM | - RTE_COMP_FF_CRC32_CHECKSUM | - RTE_COMP_FF_CRC32_ADLER32_CHECKSUM | - RTE_COMP_FF_SHAREABLE_PRIV_XFORM, - }, - { - .algo = RTE_COMP_ALGO_DEFLATE, - .comp_feature_flags = RTE_COMP_FF_ADLER32_CHECKSUM | - RTE_COMP_FF_CRC32_CHECKSUM | - RTE_COMP_FF_CRC32_ADLER32_CHECKSUM | - RTE_COMP_FF_SHAREABLE_PRIV_XFORM | - RTE_COMP_FF_HUFFMAN_FIXED | - RTE_COMP_FF_HUFFMAN_DYNAMIC, - .window_size = {.min = 10, .max = 15, .increment = 1}, - }, - RTE_COMP_END_OF_CAPABILITIES_LIST() -}; - static void mlx5_compress_dev_info_get(struct rte_compressdev *dev, struct rte_compressdev_info *info) { - RTE_SET_USED(dev); - if (info != NULL) { + if (dev != NULL && info != NULL) { + struct mlx5_compress_priv *priv = dev->data->dev_private; + info->max_nb_queue_pairs = MLX5_COMPRESS_MAX_QPS; info->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; - info->capabilities = mlx5_caps; + info->capabilities = priv->caps; } } @@ -236,6 +218,8 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, qp_attr.num_of_receive_wqes = 0; qp_attr.num_of_send_wqbbs = RTE_BIT32(log_ops_n); qp_attr.mmo = attr->mmo_compress_qp_en || attr->mmo_dma_qp_en || + attr->decomp_lz4_checksum_en || + attr->decomp_lz4_no_checksum_en || attr->decomp_deflate_v1_en || attr->decomp_deflate_v2_en; ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp, qp_attr.num_of_send_wqbbs * @@ -280,7 +264,11 @@ mlx5_compress_xform_validate(const struct rte_comp_xform *xform, return -ENOTSUP; } else if (!attr->mmo_compress_qp_en && !attr->mmo_compress_sq_en) { - DRV_LOG(ERR, "Not enough capabilities to support compress operation, maybe old FW/OFED version?"); + DRV_LOG(ERR, "Not enough capabilities to support compress operation."); + return -ENOTSUP; + } + if (xform->compress.algo == RTE_COMP_ALGO_LZ4) { + DRV_LOG(ERR, "LZ4 compression is not supported."); return -ENOTSUP; } if (xform->compress.level == RTE_COMP_LEVEL_NONE) { @@ -291,6 +279,10 @@ mlx5_compress_xform_validate(const struct rte_comp_xform *xform, DRV_LOG(ERR, "SHA is not supported."); return -ENOTSUP; } + if (xform->compress.chksum == RTE_COMP_CHECKSUM_XXHASH32) { + DRV_LOG(ERR, "xxHash32 checksum isn't supported in compress operation."); + return -ENOTSUP; + } break; case RTE_COMP_DECOMPRESS: switch (xform->decompress.algo) { @@ -307,6 +299,37 @@ mlx5_compress_xform_validate(const struct rte_comp_xform *xform, DRV_LOG(ERR, "Not enough capabilities to support decompress DEFLATE algorithm, maybe old FW/OFED version?"); return -ENOTSUP; } + if (xform->decompress.chksum == + RTE_COMP_CHECKSUM_XXHASH32) { + DRV_LOG(ERR, "DEFLATE algorithm doesn't support xxHash32 checksum."); + return -ENOTSUP; + } + break; + case RTE_COMP_ALGO_LZ4: + if (!attr->decomp_lz4_no_checksum_en && + !attr->decomp_lz4_checksum_en) { + DRV_LOG(ERR, "Not enough capabilities to support decompress LZ4 algorithm, maybe old FW/OFED version?"); + return -ENOTSUP; + } + if (xform->decompress.lz4.flags & + RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM) { + if (!attr->decomp_lz4_checksum_en) { + DRV_LOG(ERR, "Not enough capabilities to support decompress LZ4 block with checksum param, maybe old FW/OFED version?"); + return -ENOTSUP; + } + } else { + if (!attr->decomp_lz4_no_checksum_en) { + DRV_LOG(ERR, "Not enough capabilities to support decompress LZ4 block without checksum param, maybe old FW/OFED version?"); + return -ENOTSUP; + } + } + if (xform->decompress.chksum != + RTE_COMP_CHECKSUM_XXHASH32 && + xform->decompress.chksum != + RTE_COMP_CHECKSUM_NONE) { + DRV_LOG(ERR, "LZ4 algorithm supports only xxHash32 checksum."); + return -ENOTSUP; + } break; default: DRV_LOG(ERR, "Algorithm %u is not supported.", @@ -383,6 +406,27 @@ mlx5_compress_xform_create(struct rte_compressdev *dev, case RTE_COMP_ALGO_DEFLATE: xfrm->opcode += MLX5_OPC_MOD_MMO_DECOMP << WQE_CSEG_OPC_MOD_OFFSET; + xfrm->gga_ctrl1 += WQE_GGA_DECOMP_DEFLATE << + WQE_GGA_DECOMP_TYPE_OFFSET; + break; + case RTE_COMP_ALGO_LZ4: + xfrm->opcode += MLX5_OPC_MOD_MMO_DECOMP << + WQE_CSEG_OPC_MOD_OFFSET; + xfrm->gga_ctrl1 += WQE_GGA_DECOMP_LZ4 << + WQE_GGA_DECOMP_TYPE_OFFSET; + if (xform->decompress.lz4.flags & + RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM) + xfrm->gga_ctrl1 += + MLX5_GGA_DECOMP_LZ4_BLOCK_WITH_CHECKSUM << + WQE_GGA_DECOMP_PARAMS_OFFSET; + else + xfrm->gga_ctrl1 += + MLX5_GGA_DECOMP_LZ4_BLOCK_WITHOUT_CHECKSUM + << WQE_GGA_DECOMP_PARAMS_OFFSET; + if (xform->decompress.lz4.flags & + RTE_COMP_LZ4_FLAG_BLOCK_INDEPENDENCE) + xfrm->gga_ctrl1 += 1u << + WQE_GGA_DECOMP_BLOCK_INDEPENDENT_OFFSET; break; default: goto err; @@ -390,7 +434,7 @@ mlx5_compress_xform_create(struct rte_compressdev *dev, xfrm->csum_type = xform->decompress.chksum; break; default: - DRV_LOG(ERR, "Algorithm %u is not supported.", xform->type); + DRV_LOG(ERR, "Operation %u is not supported.", xform->type); goto err; } DRV_LOG(DEBUG, "New xform: gga ctrl1 = 0x%08X opcode = 0x%08X csum " @@ -657,6 +701,10 @@ mlx5_compress_dequeue_burst(void *queue_pair, struct rte_comp_op **ops, ((uint64_t)rte_be_to_cpu_32 (opaq[idx].data[crc32_idx + 1]) << 32); break; + case RTE_COMP_CHECKSUM_XXHASH32: + op->output_chksum = (uint64_t)rte_be_to_cpu_32 + (opaq[idx].v2.xxh32); + break; default: break; } @@ -720,6 +768,49 @@ mlx5_compress_handle_devargs(struct mlx5_kvargs_ctrl *mkvlist, return 0; } +static void +mlx5_compress_fill_caps(struct mlx5_compress_priv *priv, + const struct mlx5_hca_attr *attr) +{ + struct rte_compressdev_capabilities caps[] = { + { + .algo = RTE_COMP_ALGO_NULL, + .comp_feature_flags = RTE_COMP_FF_ADLER32_CHECKSUM | + RTE_COMP_FF_CRC32_CHECKSUM | + RTE_COMP_FF_CRC32_ADLER32_CHECKSUM | + RTE_COMP_FF_SHAREABLE_PRIV_XFORM, + }, + { + .algo = RTE_COMP_ALGO_DEFLATE, + .comp_feature_flags = RTE_COMP_FF_ADLER32_CHECKSUM | + RTE_COMP_FF_CRC32_CHECKSUM | + RTE_COMP_FF_CRC32_ADLER32_CHECKSUM | + RTE_COMP_FF_SHAREABLE_PRIV_XFORM | + RTE_COMP_FF_HUFFMAN_FIXED | + RTE_COMP_FF_HUFFMAN_DYNAMIC, + .window_size = {.min = 10, .max = 15, .increment = 1}, + }, + { + .algo = RTE_COMP_ALGO_LZ4, + .comp_feature_flags = RTE_COMP_FF_XXHASH32_CHECKSUM | + RTE_COMP_FF_SHAREABLE_PRIV_XFORM | + RTE_COMP_FF_LZ4_BLOCK_INDEPENDENCE, + .window_size = {.min = 1, .max = 15, .increment = 1}, + }, + RTE_COMP_END_OF_CAPABILITIES_LIST() + }; + priv->caps[0] = caps[0]; + priv->caps[1] = caps[1]; + if (attr->decomp_lz4_checksum_en || attr->decomp_lz4_no_checksum_en) { + priv->caps[2] = caps[2]; + if (attr->decomp_lz4_checksum_en) + priv->caps[2].comp_feature_flags |= + RTE_COMP_FF_LZ4_BLOCK_WITH_CHECKSUM; + priv->caps[3] = caps[3]; + } else + priv->caps[2] = caps[3]; +} + static int mlx5_compress_dev_probe(struct mlx5_common_device *cdev, struct mlx5_kvargs_ctrl *mkvlist) @@ -740,7 +831,8 @@ mlx5_compress_dev_probe(struct mlx5_common_device *cdev, rte_errno = ENOTSUP; return -rte_errno; } - if (!attr->decomp_deflate_v1_en && !attr->decomp_deflate_v2_en && + if (!attr->decomp_lz4_checksum_en && !attr->decomp_lz4_no_checksum_en && + !attr->decomp_deflate_v1_en && !attr->decomp_deflate_v2_en && !attr->mmo_decompress_sq_en && !attr->mmo_compress_qp_en && !attr->mmo_compress_sq_en && !attr->mmo_dma_qp_en && !attr->mmo_dma_sq_en) { @@ -763,7 +855,8 @@ mlx5_compress_dev_probe(struct mlx5_common_device *cdev, compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; priv = compressdev->data->dev_private; priv->log_block_sz = devarg_prms.log_block_sz; - if (attr->decomp_deflate_v2_en) + if (attr->decomp_deflate_v2_en || attr->decomp_lz4_checksum_en || + attr->decomp_lz4_no_checksum_en) crc32_opaq_offset = offsetof(union mlx5_gga_compress_opaque, v2.crc32); else @@ -773,6 +866,7 @@ mlx5_compress_dev_probe(struct mlx5_common_device *cdev, priv->crc32_opaq_offs = crc32_opaq_offset / 4; priv->cdev = cdev; priv->compressdev = compressdev; + mlx5_compress_fill_caps(priv, attr); if (mlx5_devx_uar_prepare(cdev, &priv->uar) != 0) { rte_compressdev_pmd_destroy(priv->compressdev); return -1;