From a9533f4083f3704b37c115bf3da1565ecd6d8133 Mon Sep 17 00:00:00 2001 From: zkhatami88 Date: Tue, 5 Feb 2019 12:51:53 +0100 Subject: [PATCH] nvme: remaning changes related to nvme hooks Change-Id: I07f3f403bef26a7c3e41b3c9f74e7ba4e378b2cc Signed-off-by: zkhatami88 Reviewed-on: https://review.gerrithub.io/c/443650 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447452 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/nvme/nvme_rdma.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/nvme/nvme_rdma.c b/lib/nvme/nvme_rdma.c index 901b0ee9ee..37bd3a8d23 100644 --- a/lib/nvme/nvme_rdma.c +++ b/lib/nvme/nvme_rdma.c @@ -914,14 +914,23 @@ nvme_rdma_build_contig_inline_request(struct nvme_rdma_qpair *rqpair, assert(nvme_payload_type(&req->payload) == NVME_PAYLOAD_TYPE_CONTIG); requested_size = req->payload_size; - mr = (struct ibv_mr *)spdk_mem_map_translate(rqpair->mr_map->map, - (uint64_t)payload, &requested_size); - if (mr == NULL || requested_size < req->payload_size) { - if (mr) { - SPDK_ERRLOG("Data buffer split over multiple RDMA Memory Regions\n"); + if (!g_nvme_hooks.get_rkey) { + mr = (struct ibv_mr *)spdk_mem_map_translate(rqpair->mr_map->map, + (uint64_t)payload, &requested_size); + + if (mr == NULL || requested_size < req->payload_size) { + if (mr) { + SPDK_ERRLOG("Data buffer split over multiple RDMA Memory Regions\n"); + } + return -EINVAL; } - return -EINVAL; + rdma_req->send_sgl[1].lkey = mr->lkey; + } else { + rdma_req->send_sgl[1].lkey = spdk_mem_map_translate(rqpair->mr_map->map, + (uint64_t)payload, + &requested_size); + } /* The first element of this SGL is pointing at an @@ -932,7 +941,6 @@ nvme_rdma_build_contig_inline_request(struct nvme_rdma_qpair *rqpair, rdma_req->send_sgl[1].addr = (uint64_t)payload; rdma_req->send_sgl[1].length = (uint32_t)req->payload_size; - rdma_req->send_sgl[1].lkey = mr->lkey; /* The RDMA SGL contains two elements. The first describes * the NVMe command and the second describes the data