From patchwork Wed Jul 5 21:50:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9827227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE29060351 for ; Wed, 5 Jul 2017 21:53:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BED8B25223 for ; Wed, 5 Jul 2017 21:53:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3B482850D; Wed, 5 Jul 2017 21:53:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4694825223 for ; Wed, 5 Jul 2017 21:53:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSsCW-0003IO-41; Wed, 05 Jul 2017 21:51:12 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSsCU-0003FG-GW for xen-devel@lists.xen.org; Wed, 05 Jul 2017 21:51:10 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id F4/86-02022-D4F5D595; Wed, 05 Jul 2017 21:51:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42I5NlE2WdcrPjb S4OlEFYslHxezODB6HN39mymAMYo1My8pvyKBNePQnINsBbO4Ko5N3sncwPiTo4uRi0NIYB2T RMfiRqYuRk4OFgEHiRudt9i7GDk4GAViJB78sAYJMwqESUy+vIQVxGYTMJT4+2QTG4gtIiAtc e3zZUaQOcwCkxklXr/7xQySEBawl1i65Q0rxExViU/3XoPN5xVwl/hzvBssLiEgJ3Hy2GQwmx MofqZ1ISvEQW2MEnuf/2CawMi7gJFhFaNGcWpRWWqRrpGBXlJRZnpGSW5iZo6uoYGpXm5qcXF iempOYlKxXnJ+7iZGYEDUMzAw7mBsnO13iFGSg0lJlPePfmykEF9SfkplRmJxRnxRaU5q8SFG GQ4OJQne37FAOcGi1PTUirTMHGBowqQlOHiURHhXCwOleYsLEnOLM9MhUqcYjTk2rF7/hYnj1 YT/35iEWPLy81KlxHmF4oBKBUBKM0rz4AbBYuYSo6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJW HebSD38GTmlcDtewV0ChPQKYqNMSCnlCQipKQaGBXPcAXG9m6KdGrLqbiRdchS8c3eYqe0Ipf 9Sf9ct+24Hhik2ce5Sf5N6+6mpGuLZhQdPTvbzV4rSqE10sIxxjLlm958iynBs+xX9h28wZ5v 9tQi4HiNwKr1R3Y+vPCiuH6xwvLSyfNPfdSLWf6J7WX5WTvh8gg/w93mgdP5z7gsPa9h/C7QT YmlOCPRUIu5qDgRABY5JUGUAgAA X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1499291465!85718808!1 X-Originating-IP: [198.145.29.99] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36145 invoked from network); 5 Jul 2017 21:51:06 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.99) by server-16.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Jul 2017 21:51:06 -0000 Received: from localhost.localdomain (162-198-228-33.lightspeed.wlfrct.sbcglobal.net [162.198.228.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EEF422C7D; Wed, 5 Jul 2017 21:51:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EEF422C7D From: Stefano Stabellini To: xen-devel@lists.xen.org Date: Wed, 5 Jul 2017 14:50:50 -0700 Message-Id: <1499291458-30231-10-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499291458-30231-1-git-send-email-sstabellini@kernel.org> References: <1499291458-30231-1-git-send-email-sstabellini@kernel.org> Cc: jgross@suse.com, Stefano Stabellini , boris.ostrovsky@oracle.com, sstabellini@kernel.org, linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH v7 10/18] xen/pvcalls: implement listen command X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Call inet_listen to implement the listen command. Signed-off-by: Stefano Stabellini Reviewed-by: Boris Ostrovsky Reviewed-by: Juergen Gross CC: boris.ostrovsky@oracle.com CC: jgross@suse.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; }