From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za0AM-0000Cx-7T for qemu-devel@nongnu.org; Thu, 10 Sep 2015 07:37:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Za0AJ-00026f-0s for qemu-devel@nongnu.org; Thu, 10 Sep 2015 07:37:22 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:55277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Za0AI-00025Q-N4 for qemu-devel@nongnu.org; Thu, 10 Sep 2015 07:37:18 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Sep 2015 12:37:14 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 41896219005E for ; Thu, 10 Sep 2015 12:36:43 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t8ABbBeS34340940 for ; Thu, 10 Sep 2015 11:37:11 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t8ABbA0o020237 for ; Thu, 10 Sep 2015 05:37:11 -0600 From: Pierre Morel Date: Thu, 10 Sep 2015 13:37:10 +0200 Message-Id: <1441885030-12430-1-git-send-email-pmorel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] 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: cornelia.huck@de.ibm.com, mst@redhat.com, pmorel@linux.vnet.ibm.com, stefanha@redhat.com, gkurz@linux.vnet.ibm.com 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 --- PING... 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 788b556..5c856eb 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) -- 2.3.0