Skip to contentSkip to conversation

compress/mlx5: allow partial transformations support

PATCH Superseded Raja Zidane 3 participants 8 messages Sep 3, 2021 – Oct 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compress/mlx5: allow partial transformations support

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.

---
 drivers/compress/mlx5/mlx5_compress.c | 65 ++++++++++++++++++++-------
 1 file changed, 49 insertions(+), 16 deletions(-)
drivers/compress/mlx5/mlx5_compress.c +49 -16
index d65e1e14da..58e6a7cf8d 100644
@@ -291,17 +291,46 @@ 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.");
-		return -ENOTSUP;
+	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 +845,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;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 10 lines

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.

---

Please fix check-patch issues.

#2 lore raw

PATCH v2 1/1 compress/mlx5: allow partial transformations support

In reply to Raja Zidane

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 checkpatches errors.

---
 drivers/compress/mlx5/mlx5_compress.c | 61 ++++++++++++++++++++-------
 1 file changed, 46 insertions(+), 15 deletions(-)
drivers/compress/mlx5/mlx5_compress.c +46 -15
index d65e1e14da..1eb0f45b98 100644
@@ -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;
Signature · 1 line
2.17.1
#3 lore raw
Quoted 8 lines

----------------------------------------------------------------------
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.

Quoted 5 lines

V2: fix checkpatches errors.

---

Patch does not apply.. Is there some dependent patch?

#4 lore raw

PATCH v3 1/1 compress/mlx5: allow partial transformations support

In reply to Raja Zidane

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

---
 drivers/compress/mlx5/mlx5_compress.c | 61 ++++++++++++++++++++-------
 1 file changed, 46 insertions(+), 15 deletions(-)
drivers/compress/mlx5/mlx5_compress.c +46 -15
index 5c5aa87a18..e94e8fb0c6 100644
@@ -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;
Signature · 1 line
2.17.1
#5 lore raw
Quoted 7 lines

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.

Quoted 8 lines

V2: fix checkpatch errors
V3: rebase.

---mlx5: replaced hardware queue object

---

This patch does not apply.
When I see in patchworks, there is another series which include this patch. But that is also superseded and the latest series does not have this patch. Not sure what is happening here, is this patch needed or not?

Please make sure that previous version of patches are marked as superseded.

#6 lore raw

Hi Akhil

From: dev <[email protected]>

Quoted 12 lines
Quoted 12 lines

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

Quoted 7 lines
Quoted 3 lines

---

This patch does not apply.
When I see in patchworks, there is another series which include this patch. But that is also superseded and the latest series does not have this patch. Not sure what is happening here, is this patch needed or not?

Yes, this patch is needed.

This patch depended on a series that was integrated to the master branch by Thomas.
This is the link for the first patch of the series: https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Please let us know if you still have an issue in integration.

Quoted 3 lines

Please make sure that previous version of patches are marked as superseded.

Applied
#7 lore raw
Quoted 6 lines
Quoted 5 lines

This patch does not apply.
When I see in patchworks, there is another series which include this patch. But that is also superseded and the latest series does not have this patch. Not sure what is happening here, is this patch needed or not?

Quoted 10 lines

Yes, this patch is needed.

This patch depended on a series that was integrated to the master branch by Thomas.

Please let us know if you still have an issue in integration.

Applied to dpdk-next-crypto

Thanks.