From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>, stable@dpdk.org
Subject: [PATCH 2/4] net/virtio: use iterator to destroy Virtio-user queues
Date: Wed, 27 Mar 2024 10:40:30 +0100 [thread overview]
Message-ID: <20240327094032.2400951-3-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20240327094032.2400951-1-maxime.coquelin@redhat.com>
This patch uses the freshly renamed iterator to destroy
queues at stop time. Doing this, we fix the missing
control queue destroy.
Fixes: 90966e8e5b67 ("net/virtio-user: send shadow virtqueue info to the backend")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
.../net/virtio/virtio_user/virtio_user_dev.c | 27 ++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index c3d44880f5..0776c54deb 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -33,6 +33,22 @@ const char * const virtio_user_backend_strings[] = {
[VIRTIO_USER_BACKEND_VHOST_VDPA] = "VHOST_VDPA",
};
+static int
+virtio_user_destroy_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
+{
+ struct vhost_vring_state state;
+ int ret;
+
+ state.index = queue_sel;
+ ret = dev->ops->get_vring_base(dev, &state);
+ if (ret < 0) {
+ PMD_DRV_LOG(ERR, "(%s) Failed to destroy queue %u", dev->path, queue_sel);
+ return -1;
+ }
+
+ return 0;
+}
+
static int
virtio_user_create_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
{
@@ -237,7 +253,6 @@ virtio_user_start_device(struct virtio_user_dev *dev)
int virtio_user_stop_device(struct virtio_user_dev *dev)
{
- struct vhost_vring_state state;
uint32_t i;
int ret;
@@ -258,14 +273,8 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
}
/* Stop the backend. */
- for (i = 0; i < dev->max_queue_pairs * 2; ++i) {
- state.index = i;
- ret = dev->ops->get_vring_base(dev, &state);
- if (ret < 0) {
- PMD_DRV_LOG(ERR, "(%s) get_vring_base failed, index=%u", dev->path, i);
- goto err;
- }
- }
+ if (virtio_user_foreach_queue(dev, virtio_user_destroy_queue) < 0)
+ goto err;
dev->started = false;
--
2.44.0
next prev parent reply other threads:[~2024-03-27 9:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 9:40 [PATCH 0/4] Virtio-user queues setup fixes Maxime Coquelin
2024-03-27 9:40 ` [PATCH 1/4] net/virtio: rename Virtio-user queue iterator Maxime Coquelin
2024-03-27 9:40 ` Maxime Coquelin [this message]
2024-03-27 9:40 ` [PATCH 3/4] net/virtio: fix shadow control queue notification init Maxime Coquelin
2024-03-27 9:40 ` [PATCH 4/4] net/virtio: fix shadow control queue allocation Maxime Coquelin
2024-03-27 10:04 ` [PATCH 0/4] Virtio-user queues setup fixes David Marchand
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=20240327094032.2400951-3-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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).