DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raja Zidane <rzidane@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>
Subject: [dpdk-dev] [PATCH 4/4] common/mlx5: fix RQ size configuration in QP create
Date: Thu, 4 Nov 2021 12:49:29 +0000	[thread overview]
Message-ID: <20211104124929.24899-5-rzidane@nvidia.com> (raw)
In-Reply-To: <20211104124929.24899-1-rzidane@nvidia.com>

The number of WQEBBs was provided to QP create, and QP size was calculated
by multiplying the number of WQEBBs by 64, which is the send WQE size.
When creating RQ in the QP (i.e., vdpa driver), the queue size was bigger
because the receive WQE size is 16.
Provide queue size to QP create instead of the number of WQEBBs.

Fixes: f9213ab12cf9 ("common/mlx5: share DevX queue pair operations")

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_common_devx.c  | 9 ++++-----
 drivers/common/mlx5/mlx5_common_devx.h  | 2 +-
 drivers/compress/mlx5/mlx5_compress.c   | 5 +++--
 drivers/crypto/mlx5/mlx5_crypto.c       | 5 +++--
 drivers/regex/mlx5/mlx5_regex_control.c | 4 ++--
 drivers/vdpa/mlx5/mlx5_vdpa_event.c     | 5 +++--
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common_devx.c b/drivers/common/mlx5/mlx5_common_devx.c
index 0e58308b0b..cd491012a0 100644
--- a/drivers/common/mlx5/mlx5_common_devx.c
+++ b/drivers/common/mlx5/mlx5_common_devx.c
@@ -305,8 +305,8 @@ mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp)
  *   Context returned from mlx5 open_device() glue function.
  * @param[in/out] qp_obj
  *   Pointer to QP to create.
- * @param[in] log_wqbb_n
- *   Log of number of WQBBs in queue.
+ * @param[in] queue_size
+ *   Size of queue to create.
  * @param[in] attr
  *   Pointer to QP attributes structure.
  * @param[in] socket
@@ -316,7 +316,7 @@ mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp)
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n,
+mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t queue_size,
 		    struct mlx5_devx_qp_attr *attr, int socket)
 {
 	struct mlx5_devx_obj *qp = NULL;
@@ -324,7 +324,6 @@ mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n,
 	void *umem_buf = NULL;
 	size_t alignment = MLX5_WQE_BUF_ALIGNMENT;
 	uint32_t umem_size, umem_dbrec;
-	uint32_t num_of_wqbbs = RTE_BIT32(log_wqbb_n);
 	int ret;
 
 	if (alignment == (size_t)-1) {
@@ -333,7 +332,7 @@ mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj, uint32_t log_wqbb_n,
 		return -rte_errno;
 	}
 	/* Allocate memory buffer for WQEs and doorbell record. */
-	umem_size = MLX5_WQE_SIZE * num_of_wqbbs;
+	umem_size = queue_size;
 	umem_dbrec = RTE_ALIGN(umem_size, MLX5_DBR_SIZE);
 	umem_size += MLX5_DBR_SIZE;
 	umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size,
diff --git a/drivers/common/mlx5/mlx5_common_devx.h b/drivers/common/mlx5/mlx5_common_devx.h
index 7138bd7914..14e90ddb38 100644
--- a/drivers/common/mlx5/mlx5_common_devx.h
+++ b/drivers/common/mlx5/mlx5_common_devx.h
@@ -76,7 +76,7 @@ void mlx5_devx_qp_destroy(struct mlx5_devx_qp *qp);
 
 __rte_internal
 int mlx5_devx_qp_create(void *ctx, struct mlx5_devx_qp *qp_obj,
-			uint32_t log_wqbb_n,
+			uint32_t queue_size,
 			struct mlx5_devx_qp_attr *attr, int socket);
 
 __rte_internal
diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index 6bb750781f..e7344c9d92 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -247,8 +247,9 @@ mlx5_compress_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
 	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;
-	ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp, log_ops_n, &qp_attr,
-				  socket_id);
+	ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp,
+					qp_attr.num_of_send_wqbbs *
+					MLX5_WQE_SIZE, &qp_attr, socket_id);
 	if (ret != 0) {
 		DRV_LOG(ERR, "Failed to create QP.");
 		goto err;
diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c
index 7931a84070..56941a5c1c 100644
--- a/drivers/crypto/mlx5/mlx5_crypto.c
+++ b/drivers/crypto/mlx5/mlx5_crypto.c
@@ -641,8 +641,9 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	attr.num_of_send_wqbbs = RTE_BIT32(log_wqbb_n);
 	attr.ts_format =
 		mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format);
-	ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp_obj, log_wqbb_n,
-				  &attr, socket_id);
+	ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp->qp_obj,
+					attr.num_of_send_wqbbs * MLX5_WQE_SIZE,
+					&attr, socket_id);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to create QP.");
 		goto error;
diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 4491f1c98a..2c1d933bbf 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -155,8 +155,8 @@ regex_ctrl_create_hw_qp(struct mlx5_regex_priv *priv, struct mlx5_regex_qp *qp,
 			log_nb_desc));
 	attr.mmo = priv->mmo_regex_qp_cap;
 	ret = mlx5_devx_qp_create(priv->cdev->ctx, &qp_obj->qp_obj,
-			MLX5_REGEX_WQE_LOG_NUM(priv->has_umr, log_nb_desc),
-			&attr, SOCKET_ID_ANY);
+			attr.num_of_send_wqbbs * MLX5_WQE_SIZE, &attr,
+			SOCKET_ID_ANY);
 	if (ret) {
 		DRV_LOG(ERR, "Can't create QP object.");
 		rte_errno = ENOMEM;
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 759d7633c9..3590afd52c 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -613,8 +613,9 @@ mlx5_vdpa_event_qp_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n,
 	attr.num_of_send_wqbbs = 0; /* No need SQ. */
 	attr.ts_format =
 		mlx5_ts_format_conv(priv->cdev->config.hca_attr.qp_ts_format);
-	ret = mlx5_devx_qp_create(priv->cdev->ctx, &(eqp->sw_qp), log_desc_n,
-				  &attr, SOCKET_ID_ANY);
+	ret = mlx5_devx_qp_create(priv->cdev->ctx, &(eqp->sw_qp),
+					attr.num_of_receive_wqes *
+					MLX5_WSEG_SIZE, &attr, SOCKET_ID_ANY);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to create SW QP(%u).", rte_errno);
 		goto error;
-- 
2.17.1


  parent reply	other threads:[~2021-11-04 12:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 12:49 [dpdk-dev] [PATCH 0/4] fixes to queue size config Raja Zidane
2021-11-04 12:49 ` [dpdk-dev] [PATCH 1/4] common/mlx5: fix overflows in DevX queues size calculations Raja Zidane
2021-11-04 12:49 ` [dpdk-dev] [PATCH 2/4] crypto/mlx5: fix driver destroy before the configuration Raja Zidane
2021-11-04 12:49 ` [dpdk-dev] [PATCH 3/4] crypto/mlx5: fix the queue size configuration Raja Zidane
2021-11-04 18:59   ` Tal Shnaiderman
2021-11-04 12:49 ` Raja Zidane [this message]
2021-11-08  9:02 ` [dpdk-dev] [PATCH 0/4] fixes to queue size config Thomas Monjalon
2021-11-08 12:33 ` [dpdk-dev] [PATCH V2 " Raja Zidane
2021-11-08 12:33   ` [dpdk-dev] [PATCH V2 1/4] common/mlx5: fix overflows in DevX queues size calculations Raja Zidane
2021-11-08 12:33   ` [dpdk-dev] [PATCH V2 2/4] crypto/mlx5: fix driver destroy before the configuration Raja Zidane
2021-11-08 12:33   ` [dpdk-dev] [PATCH V2 3/4] crypto/mlx5: fix the queue size configuration Raja Zidane
2021-11-08 12:33   ` [dpdk-dev] [PATCH V2 4/4] common/mlx5: fix RQ size configuration in QP create Raja Zidane
2021-11-08 13:09   ` [dpdk-dev] [PATCH V2 0/4] fixes to queue size config Raja Zidane
2021-11-08 13:09     ` [dpdk-dev] [PATCH V2 1/4] common/mlx5: fix overflows in DevX queues size calculations Raja Zidane
2021-11-08 13:09     ` [dpdk-dev] [PATCH V2 2/4] crypto/mlx5: fix driver destroy before the configuration Raja Zidane
2021-11-08 13:09     ` [dpdk-dev] [PATCH V2 3/4] crypto/mlx5: fix the queue size configuration Raja Zidane
2021-11-08 13:09     ` [dpdk-dev] [PATCH V2 4/4] common/mlx5: fix RQ size configuration in QP create Raja Zidane
2021-11-08 18:44     ` [dpdk-dev] [PATCH V2 0/4] fixes to queue size config Thomas Monjalon

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=20211104124929.24899-5-rzidane@nvidia.com \
    --to=rzidane@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    /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).