On Wed, Dec 02, 2015 at 01:59:38PM +0200, Sagi Grimberg wrote: > >where nents is the number of entries in the sglist. > ></quote> > > From Documentation/DMA_API.txt > > <quote> > int > dma_map_sg(struct device *dev, struct scatterlist *sg, > int nents, enum dma_data_direction direction) > > Returns: the number of DMA address segments mapped (this may be shorter > than <nents> passed in if some elements of the scatter/gather list are > physically or virtually adjacent and an IOMMU maps them with a single > entry). > </quote>
dma_map_sg returns the actual number of entries to iterate. At least historically some IOMMU implementations would do strange tricks like: If entries 2 and 3 could be merged dma_len for 2 would span 2 and 3, and then entry 3 would actually have the dma addr and len for entry 4. I'm not sure anyone still does that, but the first spot to check would be the Parisc IOMMU drivers. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html