Commit f8693c2c authored by Ladi Prosek's avatar Ladi Prosek Committed by Amit Shah
Browse files

virtio-rng: ask for more data if queue is not fully drained



This commit effectively reverts:

  commit 4621c176
  Author: Amit Shah <amit.shah@redhat.com>
  Date:   Wed Nov 21 11:21:19 2012 +0530

  virtio-rng: remove extra request for entropy

but instead of calling virtio_rng_process unconditionally, it
first checks to see if the queue is empty as a little bit of
optimization.

Signed-off-by: default avatarLadi Prosek <lprosek@redhat.com>
Reviewed-by: default avatarAmit Shah <amit.shah@redhat.com>
Message-Id: <1456998514-19271-1-git-send-email-lprosek@redhat.com>
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
parent 60253ed1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -69,6 +69,13 @@ static void chr_read(void *opaque, const void *buf, size_t size)
        g_free(elem);
    }
    virtio_notify(vdev, vrng->vq);

    if (!virtio_queue_empty(vrng->vq)) {
        /* If we didn't drain the queue, call virtio_rng_process
         * to take care of asking for more data as appropriate.
         */
        virtio_rng_process(vrng);
    }
}

static void virtio_rng_process(VirtIORNG *vrng)