From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVZtn-0006pw-QD for qemu-devel@nongnu.org; Tue, 16 Feb 2016 02:18:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVZti-0007Gj-P0 for qemu-devel@nongnu.org; Tue, 16 Feb 2016 02:18:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVZti-0007Gd-HA for qemu-devel@nongnu.org; Tue, 16 Feb 2016 02:18:10 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 46AE5694 for ; Tue, 16 Feb 2016 07:18:10 +0000 (UTC) Date: Tue, 16 Feb 2016 15:18:08 +0800 From: Fam Zheng Message-ID: <20160216071808.GJ18664@ad.usersys.redhat.com> References: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> <1455470231-5223-3-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455470231-5223-3-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/8] vring: make vring_enable_notification return void List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com On Sun, 02/14 18:17, Paolo Bonzini wrote: > 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 > --- > hw/block/dataplane/virtio-blk.c | 3 ++- > hw/virtio/dataplane/vring.c | 3 +-- > include/hw/virtio/dataplane/vring.h | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c > index 0d99781..03b81bc 100644 > --- a/hw/block/dataplane/virtio-blk.c > +++ b/hw/block/dataplane/virtio-blk.c > @@ -128,7 +128,8 @@ static void handle_notify(EventNotifier *e) > /* Re-enable guest->host notifies and stop processing the vring. > * 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; > } > } else { /* fatal error */ > diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c > index 4308d9f..157e8b8 100644 > --- a/hw/virtio/dataplane/vring.c > +++ b/hw/virtio/dataplane/vring.c > @@ -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. > */ > -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)) { > 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); > } > 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() */ > diff --git a/include/hw/virtio/dataplane/vring.h b/include/hw/virtio/dataplane/vring.h > index e80985e..e1c2a65 100644 > --- a/include/hw/virtio/dataplane/vring.h > +++ b/include/hw/virtio/dataplane/vring.h > @@ -42,7 +42,7 @@ static inline void vring_set_broken(Vring *vring) > bool vring_setup(Vring *vring, VirtIODevice *vdev, int n); > void vring_teardown(Vring *vring, VirtIODevice *vdev, int n); > 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); > void *vring_pop(VirtIODevice *vdev, Vring *vring, size_t sz); > void vring_push(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem, > -- > 1.8.3.1 > > > Reviewed-by: Fam Zheng