From b196d4f1d62dc0976fd3999ff753f94944fcb657 Mon Sep 17 00:00:00 2001 From: Yuval Shaia Date: Fri, 20 Mar 2020 16:34:29 +0200 Subject: hw/rdma: Skip data-path mr_id translation With the change made in commit 68b89aee71 ("Utilize ibv_reg_mr_iova for memory registration") the MR emulation is no longer needed in order to translate the guest addresses into host addresses. With that, the next obvious step is to skip entirely the processing in data-path. To accomplish this, return the backend's lkey to driver so we will not need to do the emulated mr_id to backend mr_id translation in data-path. The function build_host_sge_array is still called in data-path but only for backward computability with statistics collection. While there, as a cosmetic change to make the code cleaner - make one copy of the function rdma_backend_create_mr and leave the redundant guest_start argument in the legacy code. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Message-Id: <20200320143429.9490-3-yuval.shaia.ml@gmail.com> Signed-off-by: Marcel Apfelbaum --- hw/rdma/rdma_rm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'hw/rdma/rdma_rm.c') diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index 1524dfaeaa..7e9ea283c9 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -227,21 +227,20 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle, mr->length = guest_length; mr->virt += (mr->start & (TARGET_PAGE_SIZE - 1)); -#ifdef LEGACY_RDMA_REG_MR - ret = rdma_backend_create_mr(&mr->backend_mr, &pd->backend_pd, mr->virt, - mr->length, access_flags); -#else ret = rdma_backend_create_mr(&mr->backend_mr, &pd->backend_pd, mr->virt, mr->length, guest_start, access_flags); -#endif if (ret) { ret = -EIO; goto out_dealloc_mr; } +#ifdef LEGACY_RDMA_REG_MR + /* We keep mr_handle in lkey so send and recv get get mr ptr */ + *lkey = *mr_handle; +#else + *lkey = rdma_backend_mr_lkey(&mr->backend_mr); +#endif } - /* We keep mr_handle in lkey so send and recv get get mr ptr */ - *lkey = *mr_handle; *rkey = -1; mr->pd_handle = pd_handle; -- cgit v1.2.3