summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2017-03-22 10:16:09 -0700
committerStefano Stabellini <sstabellini@kernel.org>2017-04-25 11:04:33 -0700
commit4476e09e34d4257d2bfbdb70d106a154f42c928b (patch)
treec2196451ca695d75f68550b77be2d0d266e703a8
parent40a2389207fb1a7ee179a9eba1b2fe9a5584bbc3 (diff)
downloadfocaccia-qemu-4476e09e34d4257d2bfbdb70d106a154f42c928b.tar.gz
focaccia-qemu-4476e09e34d4257d2bfbdb70d106a154f42c928b.zip
xen/9pfs: send responses back to the frontend
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 <stefano@aporeto.com>
CC: anthony.perard@citrix.com
CC: jgross@suse.com
CC: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
CC: Greg Kurz <groug@kaod.org>
-rw-r--r--hw/9pfs/xen-9p-backend.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 9068703697..9c7f41af99 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 = {