From fc57fd9900dc6344b8833e7641f63cddc6840301 Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Wed, 23 Sep 2015 12:19:59 +0800 Subject: vhost: introduce vhost_backend_get_vq_index method Minusing the idx with the base(dev->vq_index) for vhost-kernel, and then adding it back for vhost-user doesn't seem right. Here introduces a new method vhost_backend_get_vq_index() for getting the right vq index for following vhost messages calls. Suggested-by: Jason Wang Signed-off-by: Yuanhan Liu Reviewed-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Signed-off-by: Yuanhan Liu Tested-by: Marcel Apfelbaum --- include/hw/virtio/vhost-backend.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index e472f29714..e1dfc6dd73 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -24,12 +24,14 @@ typedef int (*vhost_call)(struct vhost_dev *dev, unsigned long int request, void *arg); typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque); typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev); +typedef int (*vhost_backend_get_vq_index)(struct vhost_dev *dev, int idx); typedef struct VhostOps { VhostBackendType backend_type; vhost_call vhost_call; vhost_backend_init vhost_backend_init; vhost_backend_cleanup vhost_backend_cleanup; + vhost_backend_get_vq_index vhost_backend_get_vq_index; } VhostOps; extern const VhostOps user_ops; -- cgit v1.2.3