Skip to content

Commit 1e97af7

Browse files
lsgunthChristoph Hellwig
authored andcommitted
RDMA/rw: drop pci_p2pdma_[un]map_sg()
dma_map_sg() now supports the use of P2PDMA pages so pci_p2pdma_map_sg() is no longer necessary and may be dropped. This means the rdma_rw_[un]map_sg() helpers are no longer necessary. Remove it all. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 495758b commit 1e97af7

1 file changed

Lines changed: 9 additions & 36 deletions

File tree

  • drivers/infiniband/core

drivers/infiniband/core/rw.c

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -274,33 +274,6 @@ static int rdma_rw_init_single_wr(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
274274
return 1;
275275
}
276276

277-
static void rdma_rw_unmap_sg(struct ib_device *dev, struct scatterlist *sg,
278-
u32 sg_cnt, enum dma_data_direction dir)
279-
{
280-
if (is_pci_p2pdma_page(sg_page(sg)))
281-
pci_p2pdma_unmap_sg(dev->dma_device, sg, sg_cnt, dir);
282-
else
283-
ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
284-
}
285-
286-
static int rdma_rw_map_sgtable(struct ib_device *dev, struct sg_table *sgt,
287-
enum dma_data_direction dir)
288-
{
289-
int nents;
290-
291-
if (is_pci_p2pdma_page(sg_page(sgt->sgl))) {
292-
if (WARN_ON_ONCE(ib_uses_virt_dma(dev)))
293-
return 0;
294-
nents = pci_p2pdma_map_sg(dev->dma_device, sgt->sgl,
295-
sgt->orig_nents, dir);
296-
if (!nents)
297-
return -EIO;
298-
sgt->nents = nents;
299-
return 0;
300-
}
301-
return ib_dma_map_sgtable_attrs(dev, sgt, dir, 0);
302-
}
303-
304277
/**
305278
* rdma_rw_ctx_init - initialize a RDMA READ/WRITE context
306279
* @ctx: context to initialize
@@ -327,7 +300,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u32 port_num,
327300
};
328301
int ret;
329302

330-
ret = rdma_rw_map_sgtable(dev, &sgt, dir);
303+
ret = ib_dma_map_sgtable_attrs(dev, &sgt, dir, 0);
331304
if (ret)
332305
return ret;
333306
sg_cnt = sgt.nents;
@@ -366,7 +339,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u32 port_num,
366339
return ret;
367340

368341
out_unmap_sg:
369-
rdma_rw_unmap_sg(dev, sgt.sgl, sgt.orig_nents, dir);
342+
ib_dma_unmap_sgtable_attrs(dev, &sgt, dir, 0);
370343
return ret;
371344
}
372345
EXPORT_SYMBOL(rdma_rw_ctx_init);
@@ -414,12 +387,12 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
414387
return -EINVAL;
415388
}
416389

417-
ret = rdma_rw_map_sgtable(dev, &sgt, dir);
390+
ret = ib_dma_map_sgtable_attrs(dev, &sgt, dir, 0);
418391
if (ret)
419392
return ret;
420393

421394
if (prot_sg_cnt) {
422-
ret = rdma_rw_map_sgtable(dev, &prot_sgt, dir);
395+
ret = ib_dma_map_sgtable_attrs(dev, &prot_sgt, dir, 0);
423396
if (ret)
424397
goto out_unmap_sg;
425398
}
@@ -486,9 +459,9 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
486459
kfree(ctx->reg);
487460
out_unmap_prot_sg:
488461
if (prot_sgt.nents)
489-
rdma_rw_unmap_sg(dev, prot_sgt.sgl, prot_sgt.orig_nents, dir);
462+
ib_dma_unmap_sgtable_attrs(dev, &prot_sgt, dir, 0);
490463
out_unmap_sg:
491-
rdma_rw_unmap_sg(dev, sgt.sgl, sgt.orig_nents, dir);
464+
ib_dma_unmap_sgtable_attrs(dev, &sgt, dir, 0);
492465
return ret;
493466
}
494467
EXPORT_SYMBOL(rdma_rw_ctx_signature_init);
@@ -621,7 +594,7 @@ void rdma_rw_ctx_destroy(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
621594
break;
622595
}
623596

624-
rdma_rw_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
597+
ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
625598
}
626599
EXPORT_SYMBOL(rdma_rw_ctx_destroy);
627600

@@ -649,8 +622,8 @@ void rdma_rw_ctx_destroy_signature(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
649622
kfree(ctx->reg);
650623

651624
if (prot_sg_cnt)
652-
rdma_rw_unmap_sg(qp->pd->device, prot_sg, prot_sg_cnt, dir);
653-
rdma_rw_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
625+
ib_dma_unmap_sg(qp->pd->device, prot_sg, prot_sg_cnt, dir);
626+
ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
654627
}
655628
EXPORT_SYMBOL(rdma_rw_ctx_destroy_signature);
656629

0 commit comments

Comments
 (0)