[PATCH 8/8] nvme-rdma: enable user to disallow T10-PI offload

Max Gurtovoy mgurtovoy at nvidia.com
Mon Jan 22 06:56:59 PST 2024


From: Israel Rukshin <israelr at nvidia.com>

Disallowing metadata support helps the user to save system
resources and allow a more flexible configuration. For example,
in multipath case, when PI offload is supported only on one of
the paths (running on ConnectX-4 that support PI offload and on
ConnectX-3 that doesn't support PI offload) then two NS heads
will be created by default and multipath can't be enabled on this
setup. But when the disallow_pi flag is used on the path that
supports PI (ConnectX-4 path) then only a single NS head will be
created and multipath will be set properly.

Signed-off-by: Israel Rukshin <israelr at nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy at nvidia.com>
---
 drivers/nvme/host/rdma.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index a380bafbed08..0c5671832b50 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -791,8 +791,9 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
 	ctrl->ctrl.numa_node = ibdev_to_node(ctrl->device->dev);
 
 	/* T10-PI support */
-	if (ctrl->device->dev->attrs.kernel_cap_flags &
-	    IBK_INTEGRITY_HANDOVER)
+	if (!ctrl->ctrl.opts->disallow_pi &&
+	    (ctrl->device->dev->attrs.kernel_cap_flags &
+	     IBK_INTEGRITY_HANDOVER))
 		pi_capable = true;
 
 	ctrl->max_fr_pages = nvme_rdma_get_max_fr_pages(ctrl->device->dev,
@@ -2325,7 +2326,7 @@ static struct nvmf_transport_ops nvme_rdma_transport = {
 	.allowed_opts	= NVMF_OPT_TRSVCID | NVMF_OPT_RECONNECT_DELAY |
 			  NVMF_OPT_HOST_TRADDR | NVMF_OPT_CTRL_LOSS_TMO |
 			  NVMF_OPT_NR_WRITE_QUEUES | NVMF_OPT_NR_POLL_QUEUES |
-			  NVMF_OPT_TOS,
+			  NVMF_OPT_TOS | NVMF_OPT_DISALLOW_PI,
 	.create_ctrl	= nvme_rdma_create_ctrl,
 };
 
-- 
2.18.1




More information about the Linux-nvme mailing list