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 5016BA0C41; Thu, 30 Sep 2021 07:45:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F59F41145; Thu, 30 Sep 2021 07:45:23 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by mails.dpdk.org (Postfix) with ESMTP id CC025410FA for ; Thu, 30 Sep 2021 07:45:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cSp++tqmv9eIlZRILUmv3HRQ6GlTdgMDv5w4aOxsAOcf4Y4QxIBCKJQMMVHRPg2QmqGHiviR0xNLAihz8f2Yp/A1PBTLZDARXT6GJV25xWUwoXiyRFrWNV4UAZvAVutL6vVUsqN6LEL9l3znMBa+pxTuHqmqyE5tNt8ImNNRaMEYHT8Y7wnAKelFj0lwmrfxuRZk8DmYwPr8zFbxC3Q+RyiK0nxCQe2Jva8Puooj8yB2Bu+RcnBVPrRxgN0B1RfUaFybXM51m8ti1gkOEKVyyH5TpOu3deWB+Lt+TzdTOp1nA59W2Fhm4n8Mo1Ob6KuS4c0EES51fdqosogWUSvaow== 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; bh=RiYHv+HV0dZ/CNej3wrfO6f38NTGvUZZ9wqcf5cGNMU=; b=hNtgJsgobUqKJQOY7CrIB3DB4S3wuXaiYQ/4W7Coh/u2dK+8yANBZTAxWXdfin7PXUZaVON7hdheBPQlypyWlCxi4A7rseURz/TNRB2Y1Dr123oD8iZodCxCvRwHjrviWl+o74/KofSdYT9qS0OMnAdlNh/ReMf8vMfacehePiW0vzX9XQav4MOJRqalhrVpwRns6GL3AzsW8js01h0KeYQcF6EFaY7tq3OGLVxIDAbFojK0/q36UieVHNOkG3+RtwciAwAOtVfEcFSOxH6x+QMy/dkabzZndIv8hkiNVH2/fPkNknUDcdSEjdowh4UsLYmsRDzh5d8PmfXmav5oRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=RiYHv+HV0dZ/CNej3wrfO6f38NTGvUZZ9wqcf5cGNMU=; b=IXNMHhbakQANoeyaGXKfjJtbfS62bB0iii7rz6d4eeYgC1sv/i3piv1LeI848PBPeg7xVs4XWtLbTkU+5lYbi/ALlUfRqBao/7HXSW9J2gxbzm6pZs1/2UvVDCu3O5oVy1ar60TpZ5+6SETn7KMsJ/wuPK7bD9LUAvCtlpn63PsnuZZyl23qBWIWhGgga1y96Mac/LWsjNuubrXvs+ppvV2rUjuIsXE02DWBJKWhdR0d0tG9XwTAX14hBSewXAygTPORq9mLgtKzP1p9SQFwK5npBxhptFrPWQIvHH9b7X0RUK6IpR4oaIgd43cLUeMc069VFav7XQM82oxnRG1Y2A== Received: from CO2PR06CA0061.namprd06.prod.outlook.com (2603:10b6:104:3::19) by MWHPR12MB1199.namprd12.prod.outlook.com (2603:10b6:300:10::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Thu, 30 Sep 2021 05:45:02 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:104:3:cafe::7b) by CO2PR06CA0061.outlook.office365.com (2603:10b6:104:3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Thu, 30 Sep 2021 05:45:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4566.14 via Frontend Transport; Thu, 30 Sep 2021 05:45:02 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 30 Sep 2021 05:44:59 +0000 From: Raja Zidane To: Date: Thu, 30 Sep 2021 05:44:38 +0000 Message-ID: <20210930054438.5960-6-rzidane@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210930054438.5960-1-rzidane@nvidia.com> References: <20210928121650.40181-1-rzidane@nvidia.com> <20210930054438.5960-1-rzidane@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b535c710-4a2a-4846-0d85-08d983d57279 X-MS-TrafficTypeDiagnostic: MWHPR12MB1199: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HFAxJ1CsFke+ixtkT0HOoZqUrgUanc86oAAFUln5Yslg8GMQ/mEwKknuvfnF6QbeTEQ2/ik+U4RUv+S19+BZ2urLVWd2IOEenoM2DDxh246UoppANFB1zYfhLMIU5FjEl+CRJns+Q2uv8HiblHDXmVzncVjaftaK9dzLHQowEQUC/STr3gz8P5mnnCFUNcMSgtFQMBfbD8boVeNBE9xbiuMFBfMBl3CqsktpRGQvUDc8Jz0td+uyhNfcoE782TrsnOyhRdnK31b6jqOne4nrNvI09NR3gI3iLQ9uJqM28LsQTkgngbxWpM7JahZeWkvBtumdIvWblkRyt4JfN9X9itEhqN3Jg/cfyI8Pw3nOh1CAMY3wFoR/QAa2xEvt54JenwMzLaqh0TYLVoxTo8tSm2kuRIei33Eco0dElEiLxN00EW/QuKA4pRitJNyWh+eTX2MBQMJWN4muovKvQSUwKFY6VMdhZb4CUt4sxj5fB7b2bN0vI8FkZVjhMgaJUi3AmMTybhRV0N2zF08w+lrIqz3d2xu1opxWVURdhiwX0baXabxdYuruiG9KWUmYSY4wvfdFbPzwyKiSyx7Fdl1GcRIA0Oe2VNjujdGJjrvIqzPOASxOeTGdUz6MX0+hmCoNuZ0HerKuhJF4UB6ZvamFqIUY6aZoYIV68rad6UUhZyquaRIAW+UpekyIvESpYNtKyB5Y9sBwojhMK1ePh7yrjw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(47076005)(1076003)(6286002)(316002)(336012)(8676002)(36860700001)(8936002)(70586007)(7696005)(2616005)(70206006)(83380400001)(5660300002)(26005)(2906002)(508600001)(82310400003)(86362001)(7636003)(6666004)(426003)(186003)(16526019)(36756003)(356005)(55016002)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 05:45:02.0425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b535c710-4a2a-4846-0d85-08d983d57279 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1199 Subject: [dpdk-dev] [PATCH V5 5/5] compress/mlx5: allow partial transformations support 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 Sender: "dev" Currently compress, decompress and dma are allowed only when all 3 capabilities are on. A case where the user wants decompress offload, if decompress capability is on but one of compress, dma is off, is not allowed. Split compress/decompress/dma support check to allow partial transformations. Signed-off-by: Raja Zidane Acked-by: Matan Azrad --- drivers/compress/mlx5/mlx5_compress.c | 61 ++++++++++++++++++++------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 5c5aa87a18..e94e8fb0c6 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -291,17 +291,44 @@ mlx5_compress_xform_create(struct rte_compressdev *dev, struct mlx5_compress_xform *xfrm; uint32_t size; - if (xform->type == RTE_COMP_COMPRESS && xform->compress.level == - RTE_COMP_LEVEL_NONE) { - DRV_LOG(ERR, "Non-compressed block is not supported."); - return -ENOTSUP; - } - if ((xform->type == RTE_COMP_COMPRESS && xform->compress.hash_algo != - RTE_COMP_HASH_ALGO_NONE) || (xform->type == RTE_COMP_DECOMPRESS && - xform->decompress.hash_algo != RTE_COMP_HASH_ALGO_NONE)) { - DRV_LOG(ERR, "SHA is not supported."); + switch (xform->type) { + case RTE_COMP_COMPRESS: + if (xform->compress.algo == RTE_COMP_ALGO_NULL && + !priv->mmo_dma_qp && !priv->mmo_dma_sq) { + DRV_LOG(ERR, "Not enough capabilities to support DMA operation, maybe old FW/OFED version?"); + return -ENOTSUP; + } else if (!priv->mmo_comp_qp && !priv->mmo_comp_sq) { + DRV_LOG(ERR, "Not enough capabilities to support compress operation, maybe old FW/OFED version?"); + return -ENOTSUP; + } + if (xform->compress.level == RTE_COMP_LEVEL_NONE) { + DRV_LOG(ERR, "Non-compressed block is not supported."); + return -ENOTSUP; + } + if (xform->compress.hash_algo != RTE_COMP_HASH_ALGO_NONE) { + DRV_LOG(ERR, "SHA is not supported."); + return -ENOTSUP; + } + break; + case RTE_COMP_DECOMPRESS: + if (xform->decompress.algo == RTE_COMP_ALGO_NULL && + !priv->mmo_dma_qp && !priv->mmo_dma_sq) { + DRV_LOG(ERR, "Not enough capabilities to support DMA operation, maybe old FW/OFED version?"); + return -ENOTSUP; + } else if (!priv->mmo_decomp_qp && !priv->mmo_decomp_sq) { + DRV_LOG(ERR, "Not enough capabilities to support decompress operation, maybe old FW/OFED version?"); + return -ENOTSUP; + } + if (xform->compress.hash_algo != RTE_COMP_HASH_ALGO_NONE) { + DRV_LOG(ERR, "SHA is not supported."); + return -ENOTSUP; + } + break; + default: + DRV_LOG(ERR, "Xform type should be compress/decompress"); return -ENOTSUP; } + xfrm = rte_zmalloc_socket(__func__, sizeof(*xfrm), 0, priv->dev_config.socket_id); if (xfrm == NULL) @@ -816,12 +843,16 @@ mlx5_compress_dev_probe(struct rte_device *dev) rte_errno = ENODEV; return -rte_errno; } - if (mlx5_devx_cmd_query_hca_attr(ctx, &att) != 0 || - ((att.mmo_compress_sq_en == 0 || att.mmo_decompress_sq_en == 0 || - att.mmo_dma_sq_en == 0) && (att.mmo_compress_qp_en == 0 || - att.mmo_decompress_qp_en == 0 || att.mmo_dma_qp_en == 0))) { - DRV_LOG(ERR, "Not enough capabilities to support compress " - "operations, maybe old FW/OFED version?"); + if (mlx5_devx_cmd_query_hca_attr(ctx, &att) != 0) { + DRV_LOG(ERR, "Failed to query device capabilities"); + claim_zero(mlx5_glue->close_device(ctx)); + rte_errno = ENOTSUP; + return -ENOTSUP; + } + if (!att.mmo_decompress_qp_en && !att.mmo_decompress_sq_en + && !att.mmo_compress_qp_en && !att.mmo_compress_sq_en + && !att.mmo_dma_qp_en && !att.mmo_dma_sq_en) { + DRV_LOG(ERR, "Not enough capabilities to support compress operations, maybe old FW/OFED version?"); claim_zero(mlx5_glue->close_device(ctx)); rte_errno = ENOTSUP; return -ENOTSUP; -- 2.17.1