On 7/29/10 11:25 AM, Tom Tucker wrote:
From: Tom Tucker<[email protected]>

Add an ib_iomem_get service that converts a vma to an array of
physical addresses. This makes it easier for each device driver to
add support for the reg_io_mr provider method.

Signed-off-by: Tom Tucker<[email protected]>
---

  drivers/infiniband/core/umem.c |  248 ++++++++++++++++++++++++++++++++++++++--
  include/rdma/ib_umem.h         |   14 ++
  2 files changed, 251 insertions(+), 11 deletions(-)

[...snip...]

+                       /* The pfn_list we built is a set of Page
+                        * Frame Numbers (PFN) whose physical address
+                        * is PFN<<  PAGE_SHIFT. The SG DMA mapping
+                        * services expect page addresses, not PFN,
+                        * therefore, we have to do the dma mapping
+                        * ourselves here. */
+                       for (i = 0; i<  chunk->nents; ++i) {
+                               sg_set_page(&chunk->page_list[i], 0,
+                                           PAGE_SIZE, 0);
+                               chunk->page_list[i].dma_address =
+                                       (pfn_list[i]<<  PAGE_SHIFT);

This is not architecture independent. Does anyone have any thoughts on how this ought to be done?

+                               chunk->page_list[i].dma_length = PAGE_SIZE;
+                       }
+                       chunk->nmap = chunk->nents;
+                       ret -= chunk->nents;
+                       off += chunk->nents;
+                       list_add_tail(&chunk->list,&umem->chunk_list);
+               }
+
+               ret = 0;
+       }
+
[...snip...]

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to