aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
authorYuri Benditovich <yuri.benditovich@daynix.com>2016-12-13 10:12:05 +0200
committerMichael S. Tsirkin <mst@redhat.com>2017-01-10 07:02:53 +0200
commit312d3b35349a153e5a069e53170fd929e6b73a2b (patch)
treeb31e4bcfe0ed47ff6dab6a98c03d74bbb5cfac8a /hw/virtio/virtio.c
parentf2fd57db363e465653efa55102104039b5516759 (diff)
net: Add virtio queue interface to update used index from vring state
Bring virtio queue to correct internal state for host-to-guest operations when vhost is temporary stopped. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 8357218ae6..baffff703f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2020,6 +2020,11 @@ void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx)
vdev->vq[n].shadow_avail_idx = idx;
}
+void virtio_queue_update_used_idx(VirtIODevice *vdev, int n)
+{
+ vdev->vq[n].used_idx = vring_used_idx(&vdev->vq[n]);
+}
+
void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n)
{
vdev->vq[n].signalled_used_valid = false;