Commit f3e6d311 authored by Shiraz, Saleem's avatar Shiraz, Saleem Committed by Jason Gunthorpe

RDMA/vmw_pvrdma: Use for_each_sg_dma_page iterator on umem SGL

Use the for_each_sg_dma_page iterator variant to walk the umem DMA-mapped
SGL and get the page DMA address. This avoids the extra loop to iterate
pages in the SGE when for_each_sg iterator is used.

Additionally, purge umem->page_shift usage in the driver as its only
relevant for ODP MRs. Use system page size and shift instead.
Signed-off-by: default avatarShiraz, Saleem <shiraz.saleem@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b44e47eb
...@@ -183,25 +183,20 @@ int pvrdma_page_dir_insert_umem(struct pvrdma_page_dir *pdir, ...@@ -183,25 +183,20 @@ int pvrdma_page_dir_insert_umem(struct pvrdma_page_dir *pdir,
struct ib_umem *umem, u64 offset) struct ib_umem *umem, u64 offset)
{ {
u64 i = offset; u64 i = offset;
int j, entry; int ret = 0;
int ret = 0, len = 0; struct sg_dma_page_iter sg_iter;
struct scatterlist *sg;
if (offset >= pdir->npages) if (offset >= pdir->npages)
return -EINVAL; return -EINVAL;
for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { for_each_sg_dma_page(umem->sg_head.sgl, &sg_iter, umem->nmap, 0) {
len = sg_dma_len(sg) >> PAGE_SHIFT; dma_addr_t addr = sg_page_iter_dma_address(&sg_iter);
for (j = 0; j < len; j++) {
dma_addr_t addr = sg_dma_address(sg) +
(j << umem->page_shift);
ret = pvrdma_page_dir_insert_dma(pdir, i, addr); ret = pvrdma_page_dir_insert_dma(pdir, i, addr);
if (ret) if (ret)
goto exit; goto exit;
i++; i++;
}
} }
exit: exit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment