summaryrefslogtreecommitdiff
path: root/drivers/xen
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2017-07-06 11:01:06 -0700
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2017-08-31 09:45:55 -0400
commit8ce3f7626f96b985142c5e93f9f2dc338b0c21bf (patch)
tree5c842bb28f32e66893fc5dc86de7245f583963c6 /drivers/xen
parent331a63e6f8e42bf20dfa5b94d717a5ef130fcbee (diff)
downloadlinux-rpi3-8ce3f7626f96b985142c5e93f9f2dc338b0c21bf.tar.gz
linux-rpi3-8ce3f7626f96b985142c5e93f9f2dc338b0c21bf.tar.bz2
linux-rpi3-8ce3f7626f96b985142c5e93f9f2dc338b0c21bf.zip
xen/pvcalls: implement listen command
Call inet_listen to implement the listen command. Signed-off-by: Stefano Stabellini <stefano@aporeto.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Juergen Gross <jgross@suse.com> CC: boris.ostrovsky@oracle.com CC: jgross@suse.com Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/pvcalls-back.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index a6b8468c1341..648fa75f3cc2 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -356,6 +356,27 @@ out:
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;
}