Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751355AbdFBTe0 (ORCPT ); Fri, 2 Jun 2017 15:34:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:55996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbdFBTcA (ORCPT ); Fri, 2 Jun 2017 15:32:00 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6724223A2E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sstabellini@kernel.org From: Stefano Stabellini To: xen-devel@lists.xen.org Cc: linux-kernel@vger.kernel.org, sstabellini@kernel.org, jgross@suse.com, boris.ostrovsky@oracle.com, Stefano Stabellini Subject: [PATCH v3 10/18] xen/pvcalls: implement listen command Date: Fri, 2 Jun 2017 12:31:47 -0700 Message-Id: <1496431915-20774-10-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496431915-20774-1-git-send-email-sstabellini@kernel.org> References: <1496431915-20774-1-git-send-email-sstabellini@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1222 Lines: 43 Call inet_listen to implement the listen command. Signed-off-by: Stefano Stabellini CC: boris.ostrovsky@oracle.com CC: jgross@suse.com --- drivers/xen/pvcalls-back.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c index 4a0cfa3..a75586e 100644 --- a/drivers/xen/pvcalls-back.c +++ b/drivers/xen/pvcalls-back.c @@ -355,7 +355,26 @@ static int pvcalls_back_bind(struct xenbus_device *dev, static int pvcalls_back_listen(struct xenbus_device *dev, struct xen_pvcalls_request *req) { - return 0; + struct pvcalls_fedata *priv; + int ret = -EINVAL; + struct sockpass_mapping *map; + struct xen_pvcalls_response *rsp; + + priv = dev_get_drvdata(&dev->dev); + + map = radix_tree_lookup(&priv->socketpass_mappings, req->u.listen.id); + if (map == NULL) + goto out; + + ret = inet_listen(map->sock, req->u.listen.backlog); + +out: + rsp = RING_GET_RESPONSE(&priv->ring, priv->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 ret; } static int pvcalls_back_accept(struct xenbus_device *dev, -- 1.9.1