nvme_rdma/nvmf: add cb_fns to check mr contiguity

This is necessary to confirm that a buffer that spans a 2_MB boundary is
still in a single MR.

Change-Id: If0d14e514ab2197a0d2e3af4f565f56d50591210
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/435179 (master)
Reviewed-on: https://review.gerrithub.io/435689
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Seth Howell 2018-11-27 14:09:29 -07:00 committed by Ben Walker
parent c93b418730
commit 2f7de0751b
2 changed files with 16 additions and 2 deletions

View File

@ -642,6 +642,13 @@ nvme_rdma_mr_map_notify(void *cb_ctx, struct spdk_mem_map *map,
return rc; return rc;
} }
static int
nvme_rdma_check_contiguous_entries(uint64_t addr_1, uint64_t addr_2)
{
/* Two contiguous mappings will point to the same address which is the start of the RDMA MR. */
return addr_1 == addr_2;
}
static int static int
nvme_rdma_register_mem(struct nvme_rdma_qpair *rqpair) nvme_rdma_register_mem(struct nvme_rdma_qpair *rqpair)
{ {
@ -649,7 +656,7 @@ nvme_rdma_register_mem(struct nvme_rdma_qpair *rqpair)
struct spdk_nvme_rdma_mr_map *mr_map; struct spdk_nvme_rdma_mr_map *mr_map;
const struct spdk_mem_map_ops nvme_rdma_map_ops = { const struct spdk_mem_map_ops nvme_rdma_map_ops = {
.notify_cb = nvme_rdma_mr_map_notify, .notify_cb = nvme_rdma_mr_map_notify,
.are_contiguous = NULL .are_contiguous = nvme_rdma_check_contiguous_entries
}; };
pthread_mutex_lock(&g_rdma_mr_maps_mutex); pthread_mutex_lock(&g_rdma_mr_maps_mutex);

View File

@ -1031,6 +1031,13 @@ spdk_nvmf_rdma_mem_notify(void *cb_ctx, struct spdk_mem_map *map,
return 0; return 0;
} }
static int
spdk_nvmf_rdma_check_contiguous_entries(uint64_t addr_1, uint64_t addr_2)
{
/* Two contiguous mappings will point to the same address which is the start of the RDMA MR. */
return addr_1 == addr_2;
}
typedef enum spdk_nvme_data_transfer spdk_nvme_data_transfer_t; typedef enum spdk_nvme_data_transfer spdk_nvme_data_transfer_t;
static spdk_nvme_data_transfer_t static spdk_nvme_data_transfer_t
@ -1495,7 +1502,7 @@ spdk_nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
const struct spdk_mem_map_ops nvmf_rdma_map_ops = { const struct spdk_mem_map_ops nvmf_rdma_map_ops = {
.notify_cb = spdk_nvmf_rdma_mem_notify, .notify_cb = spdk_nvmf_rdma_mem_notify,
.are_contiguous = NULL .are_contiguous = spdk_nvmf_rdma_check_contiguous_entries
}; };
rtransport = calloc(1, sizeof(*rtransport)); rtransport = calloc(1, sizeof(*rtransport));