From: Pierre Morel Date: Thu, 10 Sep 2015 11:37:10 +0000 (+0200) Subject: virtio: right size for virtio_queue_get_avail_size X-Git-Tag: TizenStudio_2.0_p2.3.2~120^2~1^2~165^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50764fc8a382dc17ccc06c0ba29184d0fd73016e;p=sdk%2Femulator%2Fqemu.git virtio: right size for virtio_queue_get_avail_size Being working on dataplane I notice something strange: virtio_queue_get_avail_size() used a 64bit size index for the calculation of the available ring size. It is quite strange but it did work with the old calculation of the avail ring, at most with performance penalty, and I wonder where I missed something. This patch let use a 16bit size as defined in virtio_ring.h Signed-off-by: Pierre Morel Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 0832db9..730c7f0 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1460,7 +1460,7 @@ hwaddr virtio_queue_get_desc_size(VirtIODevice *vdev, int n) hwaddr virtio_queue_get_avail_size(VirtIODevice *vdev, int n) { return offsetof(VRingAvail, ring) + - sizeof(uint64_t) * vdev->vq[n].vring.num; + sizeof(uint16_t) * vdev->vq[n].vring.num; } hwaddr virtio_queue_get_used_size(VirtIODevice *vdev, int n)