From patchwork Sun Aug 5 15:35:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10556169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E64213BB for ; Sun, 5 Aug 2018 15:40:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6657F29690 for ; Sun, 5 Aug 2018 15:40:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58FF5296BC; Sun, 5 Aug 2018 15:40:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 D6E2A29690 for ; Sun, 5 Aug 2018 15:40:22 +0000 (UTC) Received: from localhost ([::1]:58987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmL8o-0001Ko-3m for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Aug 2018 11:40:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmL4f-00074W-Es for qemu-devel@nongnu.org; Sun, 05 Aug 2018 11:36:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmL4d-0006RQ-RU for qemu-devel@nongnu.org; Sun, 05 Aug 2018 11:36:05 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35630) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fmL4d-0006RH-IZ for qemu-devel@nongnu.org; Sun, 05 Aug 2018 11:36:03 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w75Fa1fa130942; Sun, 5 Aug 2018 15:36:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=ZPAGZ1trhvvfYR8nPBO/l8Ij75UXyV3BZqG43sNOqp4=; b=L71uUd/aQNNGMnLU8b2v2F5TtDYjLg1yg+WKWowtAmanuprT8BkO1ekzQibaHuwm1GiE TK/LswOaoTFtWD73AX8CrGCSXorj6nYVlpgxhdkhyOwGz4jzGP540vFtpnkznghUHrMt RVDuDFzisqO4YyX7x9He42CdsZ9XpA34/lwcGrvfREBslX+h9ksicfWlhER/RoSf5t/u acfDRWLoVhWjwDHWRXN7/+iiqIPfvKHfGgmVJV7LFqUPWj4hM8+kAaC0FX7THXxoTBoZ Zz+w4AJxN9sMNZXp5e11YAnWp4+NCInNl9qzXrFpiOXbJMlpJJ8TjpsFI+nK5gGE3Af3 dQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2kn3jstccq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 05 Aug 2018 15:36:01 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w75Fa0eH010235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 5 Aug 2018 15:36:01 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w75Fa0io029089; Sun, 5 Aug 2018 15:36:00 GMT Received: from localhost.localdomain (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 05 Aug 2018 08:36:00 -0700 From: Yuval Shaia To: qemu-devel@nongnu.org, yuval.shaia@oracle.com, marcel.apfelbaum@gmail.com Date: Sun, 5 Aug 2018 18:35:11 +0300 Message-Id: <20180805153518.2983-7-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180805153518.2983-1-yuval.shaia@oracle.com> References: <20180805153518.2983-1-yuval.shaia@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8975 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=997 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808050173 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [PATCH v2 06/13] hw/rdma: Delete useless structure RdmaRmUserMR 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The structure RdmaRmUserMR has no benefits, remove it an move all its fields to struct RdmaRmMR. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum --- hw/rdma/rdma_backend.c | 3 +-- hw/rdma/rdma_rm.c | 16 ++++++++-------- hw/rdma/rdma_rm_defs.h | 10 +++------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c index 647e16399f..52981d652d 100644 --- a/hw/rdma/rdma_backend.c +++ b/hw/rdma/rdma_backend.c @@ -271,8 +271,7 @@ static int build_host_sge_array(RdmaDeviceResources *rdma_dev_res, return VENDOR_ERR_INVLKEY | ssge[ssge_idx].lkey; } - dsge->addr = (uintptr_t)mr->user_mr.host_virt + ssge[ssge_idx].addr - - mr->user_mr.guest_start; + dsge->addr = (uintptr_t)mr->virt + ssge[ssge_idx].addr - mr->start; dsge->length = ssge[ssge_idx].length; dsge->lkey = rdma_backend_mr_lkey(&mr->backend_mr); diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index 415da15efe..7403d24674 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -165,15 +165,15 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle, length = TARGET_PAGE_SIZE; addr = g_malloc(length); } else { - mr->user_mr.host_virt = host_virt; - pr_dbg("host_virt=0x%p\n", mr->user_mr.host_virt); - mr->user_mr.length = guest_length; + mr->virt = host_virt; + pr_dbg("host_virt=0x%p\n", mr->virt); + mr->length = guest_length; pr_dbg("length=%zu\n", guest_length); - mr->user_mr.guest_start = guest_start; - pr_dbg("guest_start=0x%" PRIx64 "\n", mr->user_mr.guest_start); + mr->start = guest_start; + pr_dbg("guest_start=0x%" PRIx64 "\n", mr->start); - length = mr->user_mr.length; - addr = mr->user_mr.host_virt; + length = mr->length; + addr = mr->virt; } ret = rdma_backend_create_mr(&mr->backend_mr, &pd->backend_pd, addr, length, @@ -214,7 +214,7 @@ void rdma_rm_dealloc_mr(RdmaDeviceResources *dev_res, uint32_t mr_handle) if (mr) { rdma_backend_destroy_mr(&mr->backend_mr); - munmap(mr->user_mr.host_virt, mr->user_mr.length); + munmap(mr->virt, mr->length); res_tbl_dealloc(&dev_res->mr_tbl, mr_handle); } } diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 226011176d..7228151239 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -55,16 +55,12 @@ typedef struct RdmaRmCQ { bool notify; } RdmaRmCQ; -typedef struct RdmaRmUserMR { - void *host_virt; - uint64_t guest_start; - size_t length; -} RdmaRmUserMR; - /* MR (DMA region) */ typedef struct RdmaRmMR { RdmaBackendMR backend_mr; - RdmaRmUserMR user_mr; + void *virt; + uint64_t start; + size_t length; uint32_t pd_handle; uint32_t lkey; uint32_t rkey;