[openib-general] ib_get_dma_mr and dma_map_single

Roland Dreier rolandd at cisco.com
Tue Aug 9 10:52:55 PDT 2005


    Joe> Hello - I am attempting to port code that calls the gen1
    Joe> function ib_memory_register -- I saw the other posts about
    Joe> this issue -- I have looked into pci_map_single to map a
    Joe> buffer -- but I am failing to see how ib_get_dma_mr fits in
    Joe> with this....

ib_get_dma_mr() returns a memory region that can use DMA addresses
returned from the DMA mapping API.  In other words, when posting work
requests, you take the bus address you get from the DMA mapping API
and the L_Key you get from ib_get_dma_mr() and put them in the
gather/scatter list of your work request.

    Joe>       Also, this might not be a question I should ask here,
    Joe> but why not? What is the difference between pci_map_single
    Joe> and dma_map_single ? Are they interchangable?

pci_map_single() works for PCI devices and takes a struct pci_dev
pointer.  dma_map_single works for generic devices and takes a struct
device pointer.  Since the IB midlayer gives you a struct device
pointer (device->dma_device), you should use the dma_map_XXX functions.

In general, the dma_map_XXX functions are somewhat more general and
are designed to support situations like special rules for on-chip
peripherals in embedded devices and other strange platforms.  For
standard x86-like systems, it's a distinction without a difference.

 - R.



More information about the general mailing list