From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Xc-0006FY-8L for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:26:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf6Xb-0002Bh-Gk for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:26:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6Xb-0002BV-Cg for qemu-devel@nongnu.org; Thu, 24 Sep 2015 09:26:27 -0400 Date: Thu, 24 Sep 2015 16:20:07 +0300 From: "Michael S. Tsirkin" Message-ID: <1443100738-14970-2-git-send-email-mst@redhat.com> References: <1443100738-14970-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443100738-14970-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 01/22] virtio: right size for virtio_queue_get_avail_size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Pierre Morel From: Pierre Morel 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 --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- MST