[openib-general] [PATCH v2 1/7] IB/core - Add DMA mapping functions to allow device drivers to interpose

Ralph Campbell ralph.campbell at qlogic.com
Tue Dec 5 14:20:52 PST 2006


On Tue, 2006-12-05 at 23:09 +0200, Or Gerlitz wrote:
> 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

This looks like a very different version of RDS from what was
in SVN a month ago.  The SVN version didn't call alloc_dma_coherent().

> 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.

I don't see anything with "simple" in the name.
There is one call to dma_map_single() in the inline function
for ib_dma_map_single() if the ib_device.dma_ops is NULL.





More information about the general mailing list