DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raja Zidane <rzidane@nvidia.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH V5 5/5] compress/mlx5: allow partial transformations support
Date: Thu, 30 Sep 2021 05:44:38 +0000	[thread overview]
Message-ID: <20210930054438.5960-6-rzidane@nvidia.com> (raw)
In-Reply-To: <20210930054438.5960-1-rzidane@nvidia.com>

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 <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 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


  parent reply	other threads:[~2021-09-30  5:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 14:21 [dpdk-dev] [PATCH 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-09-03 14:21 ` [dpdk-dev] [PATCH 1/5] common/mlx5: share DevX QP operations Raja Zidane
2021-09-12 16:36   ` [dpdk-dev] [PATCH V2 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-09-12 16:36     ` [dpdk-dev] [PATCH V2 1/5] common/mlx5: share DevX QP operations Raja Zidane
2021-09-15  0:04       ` [dpdk-dev] [PATCH V3 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-09-15  0:05         ` [dpdk-dev] [PATCH V3 1/5] common/mlx5: share DevX QP operations Raja Zidane
2021-09-15  0:05         ` [dpdk-dev] [PATCH V3 2/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-09-22 19:48           ` Thomas Monjalon
2021-09-15  0:05         ` [dpdk-dev] [PATCH V3 3/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-09-15  0:05         ` [dpdk-dev] [PATCH V3 4/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-09-15  0:05         ` [dpdk-dev] [PATCH V3 5/5] regex/mlx5: refactor HW queue objects Raja Zidane
2021-09-28 12:16         ` [dpdk-dev] [PATCH V4 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-09-28 12:16           ` [dpdk-dev] [PATCH V4 1/5] common/mlx5: share DevX QP operations Raja Zidane
2021-09-28 12:16           ` [dpdk-dev] [PATCH V4 2/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-09-28 12:16           ` [dpdk-dev] [PATCH V4 3/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-09-28 12:16           ` [dpdk-dev] [PATCH V4 4/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-09-28 12:16           ` [dpdk-dev] [PATCH V4 5/5] regex/mlx5: refactor HW queue objects Raja Zidane
2021-09-30  5:44           ` [dpdk-dev] [PATCH V5 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-09-30  5:44             ` [dpdk-dev] [PATCH V5 1/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-09-30  5:44             ` [dpdk-dev] [PATCH V5 2/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-09-30  5:44             ` [dpdk-dev] [PATCH V5 3/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-09-30  5:44             ` [dpdk-dev] [PATCH V5 4/5] regex/mlx5: refactor HW queue objects Raja Zidane
2021-09-30  5:44             ` Raja Zidane [this message]
2021-10-05 12:27             ` [dpdk-dev] [PATCH V6 0/5] mlx5: replaced hardware queue object Raja Zidane
2021-10-05 12:27               ` [dpdk-dev] [PATCH V6 1/5] common/mlx5: share DevX QP operations Raja Zidane
2021-10-05 12:27               ` [dpdk-dev] [PATCH V6 2/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-10-05 12:27               ` [dpdk-dev] [PATCH V6 3/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-10-05 12:27               ` [dpdk-dev] [PATCH V6 4/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-10-05 12:27               ` [dpdk-dev] [PATCH V6 5/5] regex/mlx5: refactor HW queue objects Raja Zidane
2021-10-05 16:18               ` [dpdk-dev] [PATCH V6 0/5] mlx5: replaced hardware queue object Thomas Monjalon
2021-09-12 16:36     ` [dpdk-dev] [PATCH V2 2/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-09-12 16:36     ` [dpdk-dev] [PATCH V2 3/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-09-12 16:36     ` [dpdk-dev] [PATCH V2 4/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-09-12 16:36     ` [dpdk-dev] [PATCH V2 5/5] regex/mlx5: refactor HW queue objects Raja Zidane
2021-09-03 14:21 ` [dpdk-dev] [PATCH 2/5] common/mlx5: update new MMO HCA capabilities Raja Zidane
2021-09-03 14:21 ` [dpdk-dev] [PATCH 3/5] common/mlx5: add MMO configuration for the DevX QP Raja Zidane
2021-09-03 14:21 ` [dpdk-dev] [PATCH 4/5] compress/mlx5: refactor queue HW object Raja Zidane
2021-09-03 14:21 ` [dpdk-dev] [PATCH 5/5] regex/mlx5: refactor HW queue objects Raja Zidane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210930054438.5960-6-rzidane@nvidia.com \
    --to=rzidane@nvidia.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).