Thread (149 messages) 149 messages, 6 authors, 2021-01-18

Re: [dpdk-dev] [PATCH 29/40] net/virtio: add Virtio-user vring file ops

From: David Marchand <hidden>
Date: 2021-01-05 21:25:20

On Sun, Dec 20, 2020 at 10:16 PM Maxime Coquelin
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index 2f1b4840ee..1805aee7f7 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -259,11 +259,44 @@ vhost_kernel_get_vring_base(struct virtio_user_dev *dev, struct vhost_vring_stat
        return vhost_kernel_set_vring(dev, VHOST_GET_VRING_BASE, state);
 }

+static int
+vhost_kernel_set_vring_file(struct virtio_user_dev *dev, uint64_t req,
+               struct vhost_vring_file *file)
+{
+       int ret, fd;
+       uint32_t index = file->index;
+
+       /* Convert from queue index to queue-pair & offset */
+       fd = dev->vhostfds[file->index / 2];
+       file->index %= 2;
+
+       ret = vhost_kernel_ioctl(fd, req, file);
+       if (ret < 0) {
+               PMD_DRV_LOG(ERR, "Failed to set vring file (request %lu)", req);
Breaks 32bits build.
+               return -1;
+       }
+
+       /* restore index back to queue index */
+       file->index = index;
+
+       return 0;
+}
+

-- 
David Marchand
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help