From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>, Akhil Goyal <gakhil@marvell.com>,
"Thomas Monjalon" <thomas@monjalon.net>
Subject: [PATCH 5/7] compress/mlx5: add xform validate function
Date: Mon, 9 Jan 2023 09:58:36 +0200 [thread overview]
Message-ID: <20230109075838.2508039-6-michaelba@nvidia.com> (raw)
In-Reply-To: <20230109075838.2508039-1-michaelba@nvidia.com>
Separate the xform validations from create function into new function.
The new function checks caps directly from HCA attr structure, so all
capabilities in priv structure were removed.
Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
drivers/compress/mlx5/mlx5_compress.c | 55 +++++++++++++--------------
1 file changed, 27 insertions(+), 28 deletions(-)
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index f03a50b9ee..48d08335db 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -45,13 +45,6 @@ struct mlx5_compress_priv {
struct rte_compressdev_config dev_config;
LIST_HEAD(xform_list, mlx5_compress_xform) xform_list;
rte_spinlock_t xform_sl;
- /* HCA caps */
- uint32_t mmo_decomp_sq:1;
- uint32_t mmo_decomp_qp:1;
- uint32_t mmo_comp_sq:1;
- uint32_t mmo_comp_qp:1;
- uint32_t mmo_dma_sq:1;
- uint32_t mmo_dma_qp:1;
uint32_t log_block_sz;
uint32_t crc32_opaq_offs;
};
@@ -178,6 +171,7 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
uint32_t max_inflight_ops, int socket_id)
{
struct mlx5_compress_priv *priv = dev->data->dev_private;
+ struct mlx5_hca_attr *attr = &priv->cdev->config.hca_attr;
struct mlx5_compress_qp *qp;
struct mlx5_devx_cq_attr cq_attr = {
.uar_page_id = mlx5_os_get_devx_uar_page_id(priv->uar.obj),
@@ -238,12 +232,11 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
goto err;
}
qp_attr.cqn = qp->cq.cq->id;
- qp_attr.ts_format =
- mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format);
+ qp_attr.ts_format = mlx5_ts_format_conv(attr->qp_ts_format);
qp_attr.num_of_receive_wqes = 0;
qp_attr.num_of_send_wqbbs = RTE_BIT32(log_ops_n);
- qp_attr.mmo = priv->mmo_decomp_qp || priv->mmo_comp_qp ||
- priv->mmo_dma_qp;
+ qp_attr.mmo = attr->mmo_decompress_qp_en || attr->mmo_compress_qp_en ||
+ attr->mmo_dma_qp_en;
ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp,
qp_attr.num_of_send_wqbbs *
MLX5_WQE_SIZE, &qp_attr, socket_id);
@@ -276,21 +269,17 @@ mlx5_compress_xform_free(struct rte_compressdev *dev, void *xform)
}
static int
-mlx5_compress_xform_create(struct rte_compressdev *dev,
- const struct rte_comp_xform *xform,
- void **private_xform)
+mlx5_compress_xform_validate(const struct rte_comp_xform *xform,
+ const struct mlx5_hca_attr *attr)
{
- struct mlx5_compress_priv *priv = dev->data->dev_private;
- struct mlx5_compress_xform *xfrm;
- uint32_t size;
-
switch (xform->type) {
case RTE_COMP_COMPRESS:
if (xform->compress.algo == RTE_COMP_ALGO_NULL &&
- !priv->mmo_dma_qp && !priv->mmo_dma_sq) {
+ !attr->mmo_dma_qp_en && !attr->mmo_dma_sq_en) {
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) {
+ } 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?");
return -ENOTSUP;
}
@@ -305,10 +294,11 @@ mlx5_compress_xform_create(struct rte_compressdev *dev,
break;
case RTE_COMP_DECOMPRESS:
if (xform->decompress.algo == RTE_COMP_ALGO_NULL &&
- !priv->mmo_dma_qp && !priv->mmo_dma_sq) {
+ !attr->mmo_dma_qp_en && !attr->mmo_dma_sq_en) {
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) {
+ } else if (!attr->mmo_decompress_qp_en &&
+ !attr->mmo_decompress_sq_en) {
DRV_LOG(ERR, "Not enough capabilities to support decompress operation, maybe old FW/OFED version?");
return -ENOTSUP;
}
@@ -321,7 +311,22 @@ mlx5_compress_xform_create(struct rte_compressdev *dev,
DRV_LOG(ERR, "Xform type should be compress/decompress");
return -ENOTSUP;
}
+ return 0;
+}
+
+static int
+mlx5_compress_xform_create(struct rte_compressdev *dev,
+ const struct rte_comp_xform *xform,
+ void **private_xform)
+{
+ struct mlx5_compress_priv *priv = dev->data->dev_private;
+ struct mlx5_compress_xform *xfrm;
+ uint32_t size;
+ int ret;
+ ret = mlx5_compress_xform_validate(xform, &priv->cdev->config.hca_attr);
+ if (ret < 0)
+ return ret;
xfrm = rte_zmalloc_socket(__func__, sizeof(*xfrm), 0,
priv->dev_config.socket_id);
if (xfrm == NULL)
@@ -746,12 +751,6 @@ 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;
- priv->mmo_decomp_sq = attr->mmo_decompress_sq_en;
- priv->mmo_decomp_qp = attr->mmo_decompress_qp_en;
- priv->mmo_comp_sq = attr->mmo_compress_sq_en;
- priv->mmo_comp_qp = attr->mmo_compress_qp_en;
- priv->mmo_dma_sq = attr->mmo_dma_sq_en;
- priv->mmo_dma_qp = attr->mmo_dma_qp_en;
if (attr->gga_comp_opaq_new_version)
crc32_opaq_offset = offsetof(union mlx5_gga_compress_opaque,
v2.crc32);
--
2.25.1
next prev parent reply other threads:[~2023-01-09 7:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 7:58 [PATCH 0/7] compress/mlx5: add LZ4 support Michael Baum
2023-01-09 7:58 ` [PATCH 1/7] compress/mlx5: fix wrong output Adler-32 checksum offset Michael Baum
2023-01-09 7:58 ` [PATCH 2/7] compress/mlx5: fix QP setup for partial transformations Michael Baum
2023-01-09 7:58 ` [PATCH 3/7] compress/mlx5: support new metadata layout added in BF3 Michael Baum
2023-01-09 7:58 ` [PATCH 4/7] compress/mlx5: remove unused variable from priv structure Michael Baum
2023-01-09 7:58 ` Michael Baum [this message]
2023-01-09 7:58 ` [PATCH 6/7] common/mlx5: add LZ4 capabilities check Michael Baum
2023-01-09 7:58 ` [PATCH 7/7] compress/mlx5: add support for LZ4 algorithm Michael Baum
2023-02-02 16:25 ` [PATCH v2 0/8] compress/mlx5: add LZ4 support Michael Baum
2023-02-02 16:25 ` [PATCH v2 1/8] compress/mlx5: fix decompress xform validation Michael Baum
2023-02-02 16:25 ` [PATCH v2 2/8] compress/mlx5: fix wrong output Adler-32 checksum offset Michael Baum
2023-02-02 16:25 ` [PATCH v2 3/8] compress/mlx5: fix QP setup for partial transformations Michael Baum
2023-02-02 16:25 ` [PATCH v2 4/8] compress/mlx5: support new metadata layout added in BF3 Michael Baum
2023-02-02 16:25 ` [PATCH v2 5/8] compress/mlx5: remove unused variable from priv structure Michael Baum
2023-02-02 16:25 ` [PATCH v2 6/8] compress/mlx5: add xform validate function Michael Baum
2023-02-02 16:25 ` [PATCH v2 7/8] common/mlx5: add LZ4 capabilities check Michael Baum
2023-02-02 16:25 ` [PATCH v2 8/8] compress/mlx5: add support for LZ4 algorithm Michael Baum
2023-02-21 7:07 ` [PATCH v3 0/8] compress/mlx5: add LZ4 support Michael Baum
2023-02-21 7:07 ` [PATCH v3 1/8] compress/mlx5: fix decompress xform validation Michael Baum
2023-02-21 7:07 ` [PATCH v3 2/8] compress/mlx5: fix wrong output Adler-32 checksum offset Michael Baum
2023-02-21 7:07 ` [PATCH v3 3/8] compress/mlx5: fix QP setup for partial transformations Michael Baum
2023-02-21 7:07 ` [PATCH v3 4/8] compress/mlx5: support new metadata layout added in BF3 Michael Baum
2023-02-21 7:07 ` [PATCH v3 5/8] compress/mlx5: remove unused variable from priv structure Michael Baum
2023-02-21 7:07 ` [PATCH v3 6/8] compress/mlx5: add xform validate function Michael Baum
2023-02-21 7:07 ` [PATCH v3 7/8] common/mlx5: add LZ4 capabilities check Michael Baum
2023-02-21 7:07 ` [PATCH v3 8/8] compress/mlx5: add support for LZ4 algorithm Michael Baum
2023-02-27 18:17 ` [EXT] [PATCH v3 0/8] compress/mlx5: add LZ4 support Akhil Goyal
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=20230109075838.2508039-6-michaelba@nvidia.com \
--to=michaelba@nvidia.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=matan@nvidia.com \
--cc=thomas@monjalon.net \
/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).