From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYtp6-0004aX-Il for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:38:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYtp2-0000wB-K2 for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:38:52 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:55493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYtp2-0000vI-6Z for qemu-devel@nongnu.org; Mon, 07 Sep 2015 06:38:48 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Sep 2015 11:38:39 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id F14212190066 for ; Mon, 7 Sep 2015 11:38:09 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t87AcbCg29622380 for ; Mon, 7 Sep 2015 10:38:37 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t87AcaQ6003224 for ; Mon, 7 Sep 2015 04:38:37 -0600 Message-ID: <55ED692C.4040203@linux.vnet.ibm.com> Date: Mon, 07 Sep 2015 12:38:36 +0200 From: Pierre Morel MIME-Version: 1.0 References: <1441212824-1459-1-git-send-email-pmorel@linux.vnet.ibm.com> <20150907102007.GA9593@stefanha-thinkpad.redhat.com> In-Reply-To: <20150907102007.GA9593@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4] virtio dataplane: adapt dataplane for virtio Version 1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: cornelia.huck@de.ibm.com, mst@redhat.com, qemu-devel@nongnu.org, gkurz@linux.vnet.ibm.com On 09/07/2015 12:20 PM, Stefan Hajnoczi wrote: > On Wed, Sep 02, 2015 at 06:53:44PM +0200, Pierre Morel wrote: >> + addr = virtio_queue_get_desc_addr(vdev, n); >> + size = virtio_queue_get_desc_size(vdev, n); >> + ptr = vring_map(&vring->mr_desc, addr, size, true); >> + if (!ptr) { >> + error_report("Failed to map 0x%16lx byte for vring desc at %16lx", >> + size, addr); >> + goto out_err_desc; >> } >> - >> - vring_init(&vring->vr, virtio_queue_get_num(vdev, n), vring_ptr, 4096); >> + vr->desc = ptr; >> + >> + addr = virtio_queue_get_avail_addr(vdev, n); >> + size = virtio_queue_get_avail_size(vdev, n); >> + size += sizeof(__virtio16); > Please add a comment explaining what these 2 bytes are for. ok, I send an v5 with this and including the remarks from Greg on read/write access > >> + ptr = vring_map(&vring->mr_avail, addr, size, true); >> + if (!ptr) { >> + error_report("Failed to map 0x%16lx byte for vring avail at %16lx", >> + size, addr); >> + goto out_err_avail; >> + } >> + vr->avail = ptr; >> + >> + addr = virtio_queue_get_used_addr(vdev, n); >> + size = virtio_queue_get_used_size(vdev, n); >> + size += sizeof(__virtio16); > Here too. > Here too too