[openib-general] DMA mapping abuses in MAD layer

Christoph Hellwig hch at lst.de
Fri Oct 14 02:28:23 PDT 2005


On Thu, Oct 13, 2005 at 04:17:45PM -0700, Sean Hefty wrote:
> Sean Hefty wrote:
> >Does anyone else have any other ideas on how to fix this issue?
> 
> The current MAD interface requires the user to have code similar to this:
> 
> 	send_buf->sge.addr = dma_map_single(mad_agent->device->dma_device,
> 					    buf, buf_size, DMA_TO_DEVICE);
> 	pci_unmap_addr_set(send_buf, mapping, send_buf->sge.addr);
> 
> This is consistent with how an ib_send_wr would be formatted for other QPs. 
> Another possibility, however, is to let the user do:
> 
> 	send_buf->sge.addr = (unsigned long) buf;
> 
> And then have the MAD layer perform the mapping/unmapping immediately 
> before and after posting to the QP.  This keeps the syntax of the current 
> interface, but still requires user changes.

If you change behaviour you should change the interface, in this case
you'd _really_ want to pass down the buffer as void pointer and not cast
it to a dma_addr_t - that would in fact break on ppc64 where dma_addr_t
is a 32bit data type and a pointer is 64bits wide.




More information about the general mailing list