DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 3/4] vdpa/mlx5: fix constant type in QP creation
Date: Tue, 1 Jun 2021 10:11:21 +0300	[thread overview]
Message-ID: <20210601071122.1612432-3-michaelba@nvidia.com> (raw)
In-Reply-To: <20210601071122.1612432-1-michaelba@nvidia.com>

The mlx5_vdpa_event_qp_create function makes shifting to the numeric
constant 1, then multiplies it by another constant and finally assigns
it into a uint64_t variable.

The numeric constant type is an int with a 32-bit sign. if after
shifting , its MSB (bit of sign) will change, the uint64 variable will
get into it a different value than what the function intended it to get.

Set the numeric constant 1 to be uint64_t in the first place.

Fixes: 8395927cdfaf ("vdpa/mlx5: prepare HW queues")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index 88f6a4256d..3541c652ce 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -629,8 +629,8 @@ mlx5_vdpa_event_qp_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n,
 	attr.wq_umem_id = eqp->umem_obj->umem_id;
 	attr.wq_umem_offset = 0;
 	attr.dbr_umem_id = eqp->umem_obj->umem_id;
-	attr.dbr_address = (1 << log_desc_n) * MLX5_WSEG_SIZE;
 	attr.ts_format = mlx5_ts_format_conv(priv->qp_ts_format);
+	attr.dbr_address = RTE_BIT64(log_desc_n) * MLX5_WSEG_SIZE;
 	eqp->sw_qp = mlx5_devx_cmd_create_qp(priv->ctx, &attr);
 	if (!eqp->sw_qp) {
 		DRV_LOG(ERR, "Failed to create SW QP(%u).", rte_errno);
-- 
2.25.1


  parent reply	other threads:[~2021-06-01  7:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  7:11 [dpdk-dev] [PATCH 1/4] regex/mlx5: fix size of setup constants Michael Baum
2021-06-01  7:11 ` [dpdk-dev] [PATCH 2/4] compress/mlx5: fix constant size in QP creation Michael Baum
2021-06-07  7:28   ` Matan Azrad
2021-06-23  6:47   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-06-28 14:21     ` Michael Baum
2021-06-01  7:11 ` Michael Baum [this message]
2021-06-07  7:29   ` [dpdk-dev] [PATCH 3/4] vdpa/mlx5: fix constant type " Matan Azrad
2021-06-01  7:11 ` [dpdk-dev] [PATCH 4/4] net/mlx5: fix constant type in MP allocation Michael Baum
2021-06-07  7:29   ` Matan Azrad
2021-06-07  7:28 ` [dpdk-dev] [PATCH 1/4] regex/mlx5: fix size of setup constants Matan Azrad
2021-07-01  6:39 ` [dpdk-dev] [PATCH v2 " Michael Baum
2021-07-01  6:39   ` [dpdk-dev] [PATCH v2 2/4] compress/mlx5: fix constant size in QP creation Michael Baum
2021-07-01  6:39   ` [dpdk-dev] [PATCH v2 3/4] vdpa/mlx5: fix constant type " Michael Baum
2021-07-01  6:39   ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: fix constant type in MP allocation Michael Baum
2021-07-22 12:50   ` [dpdk-dev] [PATCH v2 1/4] regex/mlx5: fix size of setup constants 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=20210601071122.1612432-3-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@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).