diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2022-07-08 10:51:02 -0600 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2022-07-26 07:28:07 -0400 |
commit | 495758bb1a72316094ee854dc51f667ad3db29b5 (patch) | |
tree | 2c72be9c3fcacde2dfde6e7eb59db6ae03afd171 /drivers/nvme | |
parent | 91fb2b6052f75a2f9375db5d5924860ab2313a1d (diff) | |
download | linux-stable-495758bb1a72316094ee854dc51f667ad3db29b5.tar.gz linux-stable-495758bb1a72316094ee854dc51f667ad3db29b5.tar.bz2 linux-stable-495758bb1a72316094ee854dc51f667ad3db29b5.zip |
RDMA/core: introduce ib_dma_pci_p2p_dma_supported()
Introduce the helper function ib_dma_pci_p2p_dma_supported() to check
if a given ib_device can be used in P2PDMA transfers. This ensures
the ib_device is not using virt_dma and also that the underlying
dma_device supports P2PDMA.
Use the new helper in nvme-rdma to replace the existing check for
ib_uses_virt_dma(). Adding the dma_pci_p2pdma_supported() check allows
switching away from pci_p2pdma_[un]map_sg().
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/target/rdma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index 09fdcac87d17..4597bca43a6d 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c @@ -415,7 +415,7 @@ 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_dma_pci_p2p_dma_supported(ndev->device)) r->req.p2p_client = &ndev->device->dev; r->send_sge.length = sizeof(*r->req.cqe); r->send_sge.lkey = ndev->pd->local_dma_lkey; |