From patchwork Fri Mar 23 15:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 10305039 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 D8C49600F6 for ; Fri, 23 Mar 2018 15:59:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C841328F8E for ; Fri, 23 Mar 2018 15:59:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7ED128FEC; Fri, 23 Mar 2018 15:59:38 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30F3C28FEB for ; Fri, 23 Mar 2018 15:59:38 +0000 (UTC) Received: from localhost ([::1]:38706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezP6P-0006I9-9Y for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Mar 2018 11:59:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezP0H-0008Cp-2I for qemu-devel@nongnu.org; Fri, 23 Mar 2018 11:53:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezP0G-0007dr-5j for qemu-devel@nongnu.org; Fri, 23 Mar 2018 11:53:17 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54822 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezP0G-0007dZ-0f for qemu-devel@nongnu.org; Fri, 23 Mar 2018 11:53:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8210A40201A7; Fri, 23 Mar 2018 15:53:15 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ADDA2023233; Fri, 23 Mar 2018 15:53:12 +0000 (UTC) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:53:00 +0300 Message-Id: <20180323155306.83812-3-marcel@redhat.com> In-Reply-To: <20180323155306.83812-1-marcel@redhat.com> References: <20180323155306.83812-1-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Mar 2018 15:53:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Mar 2018 15:53:15 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH PULL 2/8] hw/rdma: Add support for Query QP verb to pvrdma device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mst@redhat.com, f4bug@amsat.org, yuval.shaia@oracle.com, stefanha@redhat.com, marcel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Yuval Shaia This IB verb is needed by some applications - implement it. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Signed-off-by: Marcel Apfelbaum --- hw/rdma/vmw/pvrdma_cmd.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index 293dfed29f..cf8c50af31 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -515,6 +515,28 @@ static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req, return rsp->hdr.err; } +static int query_qp(PVRDMADev *dev, union pvrdma_cmd_req *req, + union pvrdma_cmd_resp *rsp) +{ + struct pvrdma_cmd_query_qp *cmd = &req->query_qp; + struct pvrdma_cmd_query_qp_resp *resp = &rsp->query_qp_resp; + struct ibv_qp_init_attr init_attr; + + pr_dbg("qp_handle=%d\n", cmd->qp_handle); + + memset(rsp, 0, sizeof(*rsp)); + rsp->hdr.response = cmd->hdr.response; + rsp->hdr.ack = PVRDMA_CMD_QUERY_QP_RESP; + + rsp->hdr.err = rdma_rm_query_qp(&dev->rdma_dev_res, &dev->backend_dev, + cmd->qp_handle, + (struct ibv_qp_attr *)&resp->attrs, -1, + &init_attr); + + pr_dbg("ret=%d\n", rsp->hdr.err); + return rsp->hdr.err; +} + static int destroy_qp(PVRDMADev *dev, union pvrdma_cmd_req *req, union pvrdma_cmd_resp *rsp) { @@ -636,7 +658,7 @@ static struct cmd_handler cmd_handlers[] = { {PVRDMA_CMD_DESTROY_CQ, destroy_cq}, {PVRDMA_CMD_CREATE_QP, create_qp}, {PVRDMA_CMD_MODIFY_QP, modify_qp}, - {PVRDMA_CMD_QUERY_QP, NULL}, + {PVRDMA_CMD_QUERY_QP, query_qp}, {PVRDMA_CMD_DESTROY_QP, destroy_qp}, {PVRDMA_CMD_CREATE_UC, create_uc}, {PVRDMA_CMD_DESTROY_UC, destroy_uc},