[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1499291458-30231-10-git-send-email-sstabellini@kernel.org>
Date: Wed, 5 Jul 2017 14:50:50 -0700
From: Stefano Stabellini <sstabellini@...nel.org>
To: xen-devel@...ts.xen.org
Cc: linux-kernel@...r.kernel.org, sstabellini@...nel.org,
jgross@...e.com, boris.ostrovsky@...cle.com,
Stefano Stabellini <stefano@...reto.com>
Subject: [PATCH v7 10/18] xen/pvcalls: implement listen command
Call inet_listen to implement the listen command.
Signed-off-by: Stefano Stabellini <stefano@...reto.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Reviewed-by: Juergen Gross <jgross@...e.com>
CC: boris.ostrovsky@...cle.com
CC: jgross@...e.com
---
drivers/xen/pvcalls-back.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index b3da63b..c9f773f 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -356,6 +356,27 @@ static int pvcalls_back_bind(struct xenbus_device *dev,
static int pvcalls_back_listen(struct xenbus_device *dev,
struct xen_pvcalls_request *req)
{
+ struct pvcalls_fedata *fedata;
+ int ret = -EINVAL;
+ struct sockpass_mapping *map;
+ struct xen_pvcalls_response *rsp;
+
+ fedata = dev_get_drvdata(&dev->dev);
+
+ down(&fedata->socket_lock);
+ map = radix_tree_lookup(&fedata->socketpass_mappings, req->u.listen.id);
+ up(&fedata->socket_lock);
+ if (map == NULL)
+ goto out;
+
+ ret = inet_listen(map->sock, req->u.listen.backlog);
+
+out:
+ rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++);
+ rsp->req_id = req->req_id;
+ rsp->cmd = req->cmd;
+ rsp->u.listen.id = req->u.listen.id;
+ rsp->ret = ret;
return 0;
}
--
1.9.1
Powered by blists - more mailing lists