Thread (7 messages) 7 messages, 2 authors, 2021-06-23

Re: [PATCH rdma-next 2/2] RDMA: Use dma_map_sgtable for map umem pages

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-06-22 13:18:21
Also in: lkml

On Tue, Jun 22, 2021 at 02:39:42PM +0300, Leon Romanovsky wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 0eb40025075f..a76ef6a6bac5 100644
+++ b/drivers/infiniband/core/umem.c
@@ -51,11 +51,11 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d
 	struct scatterlist *sg;
 	unsigned int i;
 
-	if (umem->nmap > 0)
-		ib_dma_unmap_sg(dev, umem->sg_head.sgl, umem->sg_nents,
-				DMA_BIDIRECTIONAL);
+	if (dirty)
+		ib_dma_unmap_sgtable_attrs(dev, &umem->sg_head,
+					   DMA_BIDIRECTIONAL, 0);
 
-	for_each_sg(umem->sg_head.sgl, sg, umem->sg_nents, i)
+	for_each_sgtable_dma_sg(&umem->sg_head, sg, i)
 		unpin_user_page_range_dirty_lock(sg_page(sg),
 			DIV_ROUND_UP(sg->length, PAGE_SIZE), make_dirty);
This isn't right, can't mix sg_page with a _dma_ API

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help