From 67fe29bb86132d89c3436daa8791989ceffd0961 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 26 Nov 2008 14:50:34 +0000 Subject: [PATCH] Virtio: move virtqueue_next_desc() around virtio_next_desc() is only used in virtqueue_pop(), so move them alongside one another. Signed-off-by: Mark McLoughlin Signed-off-by: Avi Kivity --- hw/virtio.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 8fac354c92..fe0a120d68 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -107,6 +107,21 @@ static void virtqueue_init(VirtQueue *vq, void *p) vq->vring.used = (void *)TARGET_PAGE_ALIGN((unsigned long)&vq->vring.avail->ring[vq->vring.num]); } +void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, + unsigned int len) +{ + VRingUsedElem *used; + + /* Get a pointer to the next entry in the used ring. */ + used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; + used->id = elem->index; + used->len = len; + /* Make sure buffer is written before we update index. */ + wmb(); + vq->vring.used->idx++; + vq->inuse--; +} + static unsigned virtqueue_next_desc(VirtQueue *vq, unsigned int i) { unsigned int next; @@ -126,21 +141,6 @@ static unsigned virtqueue_next_desc(VirtQueue *vq, unsigned int i) return next; } -void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, - unsigned int len) -{ - VRingUsedElem *used; - - /* Get a pointer to the next entry in the used ring. */ - used = &vq->vring.used->ring[vq->vring.used->idx % vq->vring.num]; - used->id = elem->index; - used->len = len; - /* Make sure buffer is written before we update index. */ - wmb(); - vq->vring.used->idx++; - vq->inuse--; -} - int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) { unsigned int i, head; -- 2.11.4.GIT