[v2,1/4] net/virtio-user: rename queue iterator
Checks
Commit Message
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(-)
@@ -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;