[dpdk-dev] [PATCH 29/40] net/virtio: add Virtio-user vring file ops
David Marchand
david.marchand at redhat.com
Tue Jan 5 22:24:59 CET 2021
On Sun, Dec 20, 2020 at 10:16 PM Maxime Coquelin
<maxime.coquelin at redhat.com> wrote:
> 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
More information about the dev
mailing list