DPDK patches and discussions
 help / color / mirror / Atom feed
From: Asaf Penso <asafp@mellanox.com>
To: dev@dpdk.org
Cc: viacheslavo@mellanox.com, matan@mellanox.com
Subject: [dpdk-dev] [PATCH] vdpa/mlx5: set default queue indices
Date: Mon, 23 Mar 2020 17:50:13 +0000	[thread overview]
Message-ID: <1584985813-14883-1-git-send-email-asafp@mellanox.com> (raw)

The rte_vhost_get_vring_base function is being called to get the values
of last_avail_idx and last_used_idx.
These fields will not have the correct values in case the function
returns an error.

Adding a check for the function return value, and in the case of an
error, set the fields to be zero and print a warning message.

Signed-off-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 2312331..cb2d61b 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -236,10 +236,17 @@
 		}
 		attr.available_addr = gpa;
 	}
-	rte_vhost_get_vring_base(priv->vid, index, &last_avail_idx,
+	ret = rte_vhost_get_vring_base(priv->vid, index, &last_avail_idx,
 				 &last_used_idx);
-	DRV_LOG(INFO, "vid %d: Init last_avail_idx=%d, last_used_idx=%d for "
-		"virtq %d.", priv->vid, last_avail_idx, last_used_idx, index);
+	if (ret) {
+		last_avail_idx = 0;
+		last_used_idx = 0;
+		DRV_LOG(WARNING, "Couldn't get vring base, idx are set to 0");
+	} else {
+		DRV_LOG(INFO, "vid %d: Init last_avail_idx=%d, last_used_idx=%d for "
+				"virtq %d.", priv->vid, last_avail_idx,
+				last_used_idx, index);
+	}
 	attr.hw_available_index = last_avail_idx;
 	attr.hw_used_index = last_used_idx;
 	attr.q_size = vq.size;
-- 
1.8.3.1


             reply	other threads:[~2020-03-23 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 17:50 Asaf Penso [this message]
2020-04-15  7:34 ` Maxime Coquelin
2020-04-15 11:52   ` Asaf Penso
2020-04-17 17:14 ` Maxime Coquelin

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=1584985813-14883-1-git-send-email-asafp@mellanox.com \
    --to=asafp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=viacheslavo@mellanox.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).