If the device support arbitrary sg list mapping (device cap IB_DEVICE_SG_GAPS_REG set) we allocate the memory regions with IB_MR_TYPE_SG_GAPS and allow the block layer to send us gappy bio vectors. We use this functionality in iSER driver as well. Signed-off-by: Max Gurtovoy <maxg@xxxxxxxxxxxx> Reviewed-by: Leon Romanovsky <leon@xxxxxxxxxx> --- drivers/nvme/host/rdma.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 47a479f..1c6f974 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -294,8 +294,8 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) ib_dereg_mr(req->mr); - req->mr = ib_alloc_mr(dev->pd, IB_MR_TYPE_MEM_REG, - ctrl->max_fr_pages); + req->mr = ib_alloc_mr(dev->pd, ib_get_sg_mr_type(dev->dev), + ctrl->max_fr_pages); if (IS_ERR(req->mr)) { ret = PTR_ERR(req->mr); req->mr = NULL; @@ -348,8 +348,8 @@ static int __nvme_rdma_init_request(struct nvme_rdma_ctrl *ctrl, if (ret) return ret; - req->mr = ib_alloc_mr(dev->pd, IB_MR_TYPE_MEM_REG, - ctrl->max_fr_pages); + req->mr = ib_alloc_mr(dev->pd, ib_get_sg_mr_type(ibdev), + ctrl->max_fr_pages); if (IS_ERR(req->mr)) { ret = PTR_ERR(req->mr); goto out_free_qe; @@ -1608,6 +1608,9 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl) ctrl->ctrl.sqsize = min_t(int, NVME_CAP_MQES(ctrl->cap) + 1, ctrl->ctrl.sqsize); + if (ctrl->device->dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG) + ctrl->ctrl.sg_gaps_support = true; + error = nvme_enable_ctrl(&ctrl->ctrl, ctrl->cap); if (error) goto out_cleanup_queue; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html