Thread (99 messages) 99 messages, 6 authors, 2021-05-11

Re: [PATCH 14/16] nvme-rdma: Ensure dma support when using p2pdma

From: John Hubbard <jhubbard@nvidia.com>
Date: 2021-05-03 01:37:30
Also in: linux-iommu, linux-mm, linux-nvme, linux-pci, lkml

On 4/8/21 10:01 AM, Logan Gunthorpe wrote:
Ensure the dma operations support p2pdma before using the RDMA
device for P2PDMA. This allows switching the RDMA driver from
pci_p2pdma_map_sg() to dma_map_sg_p2pdma().
Tentatively, this looks right, but it really should be combined
with a following patch that uses it. Then you don't have to try
to explain, above, why it's needed. :)
quoted hunk ↗ jump to hunk
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
  drivers/nvme/target/rdma.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 6c1f3ab7649c..3ec7e77e5416 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -414,7 +414,8 @@ static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev,
  	if (ib_dma_mapping_error(ndev->device, r->send_sge.addr))
  		goto out_free_rsp;
  
-	if (!ib_uses_virt_dma(ndev->device))
+	if (!ib_uses_virt_dma(ndev->device) &&
+	    dma_pci_p2pdma_supported(&ndev->device->dev))
  		r->req.p2p_client = &ndev->device->dev;
  	r->send_sge.length = sizeof(*r->req.cqe);
  	r->send_sge.lkey = ndev->pd->local_dma_lkey;
thanks,
-- 
John Hubbard
NVIDIA
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help