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 BAE2DA0C43; Wed, 15 Sep 2021 02:12:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6790D4014F; Wed, 15 Sep 2021 02:12:41 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by mails.dpdk.org (Postfix) with ESMTP id 5EA614003C for ; Wed, 15 Sep 2021 02:12:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=djjW6cR3YiiAZLx5G1YkKNsWjS1Wvs4IM61tRLZoa/Jf/3VTQP8g78FCo5nFuDe4Ap7YfeRVHKbYDtt+0zBitfmKi4SL5jZIFFZ3pd2ONwLUVgIT/jkB3JfJDMkgtIv2QORgeFWTk1Jp80q5a2PeUOZLDlcjFle0F0bSJVZg3vZHsFFvBs+asw7ImkVT/y70Y6VCONCpMn6dqtI+OkrshoTByEReDwtXILF0O47ZVde7zyC8Pz+HzrxtigRqb2eH+H4S5nZhW4adU5ggW+Moy/nt98jtPQqj19aqil3hBFNYoK7tA+GC5K/zYs2U2W5AWQcValShx83KUtc1/sV9PA== 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=m/cMHzZbxg/UZIC56RWyXAD/CeFQhHldJ/NIVtBjlXw=; b=BwDcGyHIiP3l9V/776rksi0o9wtY7gXiXK5QPzs2hegXB2xnGZ7RJsXbtQ4xw/oobKok/BPs33VR9oy7EcVInBQk6iJzny8c4uz0gPV4+KYom+Ye8+VSr1ZWzb8CvtK5vmkVcJC9opfExq4qwgZrsZZ18GY0Zgn0H65ojx/vpeulL2Q4grYdma0qj6Ns5SvRB3Z8Cwv2tI7KtKT+H5SEiXnlRojE14znCR57v0yJ09AWg7nEhC26aZYh6oYs4+Mb88Hu8wTWeB6tp1Ty2QBS1b6TmWzK00hm+JFuL8rQydB4SuhFPKwb+0ThdSNvoBTs9VZFHrLQ07rwJX7hRbFU1Q== 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=m/cMHzZbxg/UZIC56RWyXAD/CeFQhHldJ/NIVtBjlXw=; b=O13GEek3MCsh2Uef7cUzxH3YWWarOrhyi0f8KYQ9Lszg3wMni+mU2iqKhGvlSdFqXHTV6cKS2JBPJ7+RPR/gXrPpZt8Nju9cVy4ubnPDFbGLDYgEYOQgeUH0coGt8eQFM6xh0Ho9/MEDCubTjpi/iXL1D1ydLuR0fTOJNMNC/vDnkermRBp3Dg3w7spGcp+WWWz3cvAFnnpM6H8fH/jrF0Zz8lStAGqbU7k8SAHhqA4dfrL23yGLgwUAdHpjAEf+19e6lEC+lrbG6F2vSyPmQqPluW4+j0b/n6FXh4sFujZtKn4GQySVdDfCx+tuObcP/shJPKWnNGU1dIgF4mA8Kw== Received: from MW4PR04CA0346.namprd04.prod.outlook.com (2603:10b6:303:8a::21) by CH2PR12MB3830.namprd12.prod.outlook.com (2603:10b6:610:2f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Wed, 15 Sep 2021 00:12:37 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::b3) by MW4PR04CA0346.outlook.office365.com (2603:10b6:303:8a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 00:12:37 +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 CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 00:12:37 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 15 Sep 2021 00:12:37 +0000 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 15 Sep 2021 00:12:36 +0000 From: Raja Zidane To: Date: Wed, 15 Sep 2021 00:12:23 +0000 Message-ID: <20210915001223.6238-1-rzidane@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210905155753.23024-1-rzidane@nvidia.com> References: <20210905155753.23024-1-rzidane@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9dd7396a-6512-4430-1ad5-08d977dd863f X-MS-TrafficTypeDiagnostic: CH2PR12MB3830: 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: bE9HcIBwH7k8vAanYkNh2nBIddi3/ARu/GuAOpBVTLUi/79q6xSuKxdyId5xGOy1Jcn1ryBX+tIbGn1ezBKKZtLouKGk41au9UD9EE4Wqua9HjePSDsv2JI+igUieswCJkbu+Jd75k+JCBsRy5HO0rz2xmUFfNmyshpRkajRGd9JT6ACtgLUySARMvQW0qW09Os3uNfUsaql1UuLRmuObHAUNAI6oopayFp9ut24s+nrtSaVB2T8U5KDaCzM+NiX1u6jHEVDsXMT7lXOsJiW2orLQsZONWPbAopJqBtAOZDXQTgHdh9Zffb1SzAHjKxktQX0FAF9gXx996k1kKJaNeZZGbORF1YNVkyrZcnV88w1LNhsjMTellXccDGM0cb7O3QOTaN+5vh2Y6u/dcfD91jQXmZjVaupzSl/uBX0wJCGlmNvbxaJfrDLiqz9iClAtLxY+yANlOeTOE7DzML7QsGBvPf1S7hEQrJVVXlaMr/pwzvDEEwNtPY5xSNAmQENoIf+gAbJszaaw7VFo5IQpbp7XZqZ+bqbZb3Za6oZE3+6DfmTL3QDtiN0nw55z9g4MW/cDJ2AmRItT8Q4+MTOOEpSxTkUsgTcgrKC+TA2YRWwNGzNAH7Tvn9GYLhSfaLkkVy9JWELCyYGrg4ESKnbTgc9Dlimuat2tSOl17R3u8UEPlFu5hinS+rTlEUfTPnCLD6E0oV5RZihSnpN+mPQbg== 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)(346002)(396003)(39860400002)(136003)(376002)(46966006)(36840700001)(356005)(2616005)(70206006)(83380400001)(8676002)(426003)(36906005)(336012)(7696005)(316002)(478600001)(16526019)(86362001)(36756003)(26005)(70586007)(82310400003)(186003)(47076005)(36860700001)(7636003)(6916009)(6286002)(55016002)(6666004)(82740400003)(2906002)(5660300002)(8936002)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 00:12:37.2256 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dd7396a-6512-4430-1ad5-08d977dd863f 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: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3830 Subject: [dpdk-dev] [PATCH V3] 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. V2: fix checkpatch errors V3: rebase. ---mlx5: replaced hardware queue object 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