vring: make vring_enable_notification return void

Make the API more similar to the regular virtqueue API.  This will
help when modifying the code to not use vring.c anymore.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Paolo Bonzini 2016-02-14 18:17:05 +01:00 committed by Michael S. Tsirkin
parent ef0716df7f
commit 8b1fe1cedf
3 changed files with 4 additions and 4 deletions

View file

@ -128,7 +128,8 @@ static void handle_notify(EventNotifier *e)
/* Re-enable guest->host notifies and stop processing the vring. /* Re-enable guest->host notifies and stop processing the vring.
* But if the guest has snuck in more descriptors, keep processing. * But if the guest has snuck in more descriptors, keep processing.
*/ */
if (vring_enable_notification(s->vdev, &s->vring)) { vring_enable_notification(s->vdev, &s->vring);
if (!vring_more_avail(s->vdev, &s->vring)) {
break; break;
} }
} else { /* fatal error */ } else { /* fatal error */

View file

@ -175,7 +175,7 @@ void vring_disable_notification(VirtIODevice *vdev, Vring *vring)
* *
* Return true if the vring is empty, false if there are more requests. * Return true if the vring is empty, false if there are more requests.
*/ */
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) void vring_enable_notification(VirtIODevice *vdev, Vring *vring)
{ {
if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
vring_avail_event(&vring->vr) = vring->vr.avail->idx; vring_avail_event(&vring->vr) = vring->vr.avail->idx;
@ -183,7 +183,6 @@ bool vring_enable_notification(VirtIODevice *vdev, Vring *vring)
vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY);
} }
smp_mb(); /* ensure update is seen before reading avail_idx */ smp_mb(); /* ensure update is seen before reading avail_idx */
return !vring_more_avail(vdev, vring);
} }
/* This is stolen from linux/drivers/vhost/vhost.c:vhost_notify() */ /* This is stolen from linux/drivers/vhost/vhost.c:vhost_notify() */

View file

@ -42,7 +42,7 @@ static inline void vring_set_broken(Vring *vring)
bool vring_setup(Vring *vring, VirtIODevice *vdev, int n); bool vring_setup(Vring *vring, VirtIODevice *vdev, int n);
void vring_teardown(Vring *vring, VirtIODevice *vdev, int n); void vring_teardown(Vring *vring, VirtIODevice *vdev, int n);
void vring_disable_notification(VirtIODevice *vdev, Vring *vring); void vring_disable_notification(VirtIODevice *vdev, Vring *vring);
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring); void vring_enable_notification(VirtIODevice *vdev, Vring *vring);
bool vring_should_notify(VirtIODevice *vdev, Vring *vring); bool vring_should_notify(VirtIODevice *vdev, Vring *vring);
void *vring_pop(VirtIODevice *vdev, Vring *vring, size_t sz); void *vring_pop(VirtIODevice *vdev, Vring *vring, size_t sz);
void vring_push(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem, void vring_push(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem,