From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d35JS-00084q-75 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 14:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d35JR-0005rr-CF for qemu-devel@nongnu.org; Tue, 25 Apr 2017 14:35:46 -0400 Received: from mail.kernel.org ([198.145.29.136]:50226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d35JR-0005rA-6u for qemu-devel@nongnu.org; Tue, 25 Apr 2017 14:35:45 -0400 From: Stefano Stabellini Date: Tue, 25 Apr 2017 11:35:08 -0700 Message-Id: <1493145313-31311-16-git-send-email-sstabellini@kernel.org> In-Reply-To: <1493145313-31311-1-git-send-email-sstabellini@kernel.org> References: <1493145313-31311-1-git-send-email-sstabellini@kernel.org> Subject: [Qemu-devel] [PATCH 16/21] xen/9pfs: send responses back to the frontend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: stefanha@gmail.com, sstabellini@kernel.org, stefanha@redhat.com, anthony.perard@citrix.com, xen-devel@lists.xenproject.org, qemu-devel@nongnu.org, Stefano Stabellini , jgross@suse.com, "Aneesh Kumar K.V" , Greg Kurz Once a request is completed, xen_9pfs_push_and_notify gets called. In xen_9pfs_push_and_notify, update the indexes (data has already been copied to the sg by the common code) and send a notification to the frontend. Schedule the bottom-half to check if we already have any other requests pending. Signed-off-by: Stefano Stabellini CC: anthony.perard@citrix.com CC: jgross@suse.com CC: Aneesh Kumar K.V CC: Greg Kurz --- hw/9pfs/xen-9p-backend.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c index 9068703..9c7f41a 100644 --- a/hw/9pfs/xen-9p-backend.c +++ b/hw/9pfs/xen-9p-backend.c @@ -180,6 +180,25 @@ static void xen_9pfs_init_in_iov_from_pdu(V9fsPDU *pdu, static void xen_9pfs_push_and_notify(V9fsPDU *pdu) { + RING_IDX prod; + Xen9pfsDev *priv = container_of(pdu->s, Xen9pfsDev, state); + Xen9pfsRing *ring = &priv->rings[pdu->tag % priv->num_rings]; + + g_free(ring->sg); + ring->sg = NULL; + + ring->intf->out_cons = ring->out_cons; + xen_wmb(); + + prod = ring->intf->in_prod; + xen_rmb(); + ring->intf->in_prod = prod + pdu->size; + xen_wmb(); + + ring->inprogress = false; + xenevtchn_notify(ring->evtchndev, ring->local_port); + + qemu_bh_schedule(ring->bh); } static const struct V9fsTransport xen_9p_transport = { -- 1.9.1