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>
Subject: [PATCH v2 1/4] net/virtio-user: rename queue iterator
Date: Thu, 28 Mar 2024 14:08:10 +0100 [thread overview]
Message-ID: <20240328130813.3696005-2-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20240328130813.3696005-1-maxime.coquelin@redhat.com>
This is a preliminary rework to prepare for iterating
over queues for non-setup operations.
Also, remove the error log that does not provide much
information given the callbacks already provide one.
Acked-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/net/virtio/virtio_user/virtio_user_dev.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 4fdfe70e7c..c3d44880f5 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -129,7 +129,7 @@ virtio_user_kick_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
}
static int
-virtio_user_queue_setup(struct virtio_user_dev *dev,
+virtio_user_foreach_queue(struct virtio_user_dev *dev,
int (*fn)(struct virtio_user_dev *, uint32_t))
{
uint32_t i, nr_vq;
@@ -138,12 +138,9 @@ virtio_user_queue_setup(struct virtio_user_dev *dev,
if (dev->hw_cvq)
nr_vq++;
- for (i = 0; i < nr_vq; i++) {
- if (fn(dev, i) < 0) {
- PMD_DRV_LOG(ERR, "(%s) setup VQ %u failed", dev->path, i);
+ for (i = 0; i < nr_vq; i++)
+ if (fn(dev, i) < 0)
return -1;
- }
- }
return 0;
}
@@ -157,7 +154,7 @@ virtio_user_dev_set_features(struct virtio_user_dev *dev)
pthread_mutex_lock(&dev->mutex);
/* Step 0: tell vhost to create queues */
- if (virtio_user_queue_setup(dev, virtio_user_create_queue) < 0)
+ if (virtio_user_foreach_queue(dev, virtio_user_create_queue) < 0)
goto error;
features = dev->features;
@@ -205,7 +202,7 @@ virtio_user_start_device(struct virtio_user_dev *dev)
goto error;
/* Step 3: kick queues */
- ret = virtio_user_queue_setup(dev, virtio_user_kick_queue);
+ ret = virtio_user_foreach_queue(dev, virtio_user_kick_queue);
if (ret < 0)
goto error;
--
2.44.0
next prev parent reply other threads:[~2024-03-28 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 13:08 [PATCH v2 0/4] Virtio-user queues setup fixes Maxime Coquelin
2024-03-28 13:08 ` Maxime Coquelin [this message]
2024-03-28 13:08 ` [PATCH v2 2/4] net/virtio-user: fix control queue destruction Maxime Coquelin
2024-03-28 13:08 ` [PATCH v2 3/4] net/virtio-user: fix shadow control queue notification init Maxime Coquelin
2024-03-28 13:08 ` [PATCH v2 4/4] net/virtio-user: fix control queue allocation 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=20240328130813.3696005-2-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@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).