[openib-general] [PATCH v2 1/7] IB/core - Add DMA mapping functions to allow device drivers to interpose
Or Gerlitz
or.gerlitz at gmail.com
Tue Dec 5 13:09:15 PST 2006
On 11/30/06, Ralph Campbell <ralph.campbell at qlogic.com> wrote:
> diff -r c76ed2f1387b include/rdma/ib_verbs.h
> --- a/include/rdma/ib_verbs.h Wed Nov 29 13:28:14 2006 +0800
> +++ b/include/rdma/ib_verbs.h Wed Nov 29 13:54:37 2006 -0800
> +struct ib_dma_mapping_ops {
> + int (*mapping_error)(struct ib_device *dev,
> + u64 dma_addr);
> + u64 (*map_single)(struct ib_device *dev,
> + void *ptr, size_t size,
> + enum dma_data_direction direction);
> + void (*unmap_single)(struct ib_device *dev,
> + u64 addr, size_t size,
> + enum dma_data_direction direction);
> + u64 (*map_page)(struct ib_device *dev,
> + struct page *page, unsigned long offset,
> + size_t size,
> + enum dma_data_direction direction);
> + void (*unmap_page)(struct ib_device *dev,
> + u64 addr, size_t size,
> + enum dma_data_direction direction);
> + int (*map_sg)(struct ib_device *dev,
> + struct scatterlist *sg, int nents,
> + enum dma_data_direction direction);
> + void (*unmap_sg)(struct ib_device *dev,
> + struct scatterlist *sg, int nents,
> + enum dma_data_direction direction);
> + u64 (*dma_address)(struct ib_device *dev,
> + struct scatterlist *sg);
> + unsigned int (*dma_len)(struct ib_device *dev,
> + struct scatterlist *sg);
> + void (*sync_single_for_cpu)(struct ib_device *dev,
> + u64 dma_handle,
> + size_t size,
> + enum dma_data_direction dir);
> + void (*sync_single_for_device)(struct ib_device *dev,
> + u64 dma_handle,
> + size_t size,
> + enum dma_data_direction dir);
> };
This structure misses some functions which are members of struct
dma_mapping_ops.
The most notable miss to me is dma_alloc/free_coherent, please note
that an IB consumer can call dma_alloc_coherent and place the resulted
dma_addr_t within an SGE provided to ibv_post_send/recv, see the RDS
code doing the allocation at ib_cm.c :: rds_ib_setup_qp and the direct
usage of the dma_addr_t at ib_recv :: rds_ib_recv_init_ring under
under http://oss.oracle.com/projects/rds/src/trunk/linux/net/rds
Also I see in struct dma_mapping_ops also something called
dma_map_simple not sure what it does and who can use it.
Or.
More information about the general
mailing list