Skip to content

Commit

Permalink
vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base
Browse files Browse the repository at this point in the history
Fixes: 6d0b222 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ")

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20220512175747.142058-4-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
eugpermar authored and mstsirkin committed May 13, 2022
1 parent 81abfa5 commit 6390364
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/virtio/vhost-vdpa.c
Expand Up @@ -1172,11 +1172,11 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
struct vhost_vring_state *ring)
{
struct vhost_vdpa *v = dev->opaque;
int vdpa_idx = ring->index - dev->vq_index;
int ret;

if (v->shadow_vqs_enabled) {
VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
ring->index);
VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);

/*
* Setting base as last used idx, so destination will see as available
Expand Down

0 comments on commit 6390364

Please sign in to comment.