Hi David,

On Wednesday 09 May 2007, David Brownell wrote:
> On Wednesday 09 May 2007, Laurent Pinchart wrote:
> > I wasn't aware of those functions. Just to make sure I get this right, am
> > I right to say that URB buffers should be allocated as contiguous cache
> > coherent physical memory (using usb_buffer_alloc, which in turns call
> > dma_alloc_coherent for big DMAable buffers)
>
> Not many applications need cache-coherent buffers.
> Few of them involve "big" transfers.
>
> > or as normal memory using scatter-gather routines ?
>
> Likewise not many stacks hand you scatterlists.  If you
> get a scatterlist, there's no real option about how to
> do that I/O:  either dma map yourself, or let usbcore
> handle it for you (using the usb_sg_* calls)
>
> > I currently allocate big bulk buffers using usb_buffer_alloc, which puts
> > a lot of pressure on the memory allocator.
>
> Bad answer, unless you really need that kind of buffer.
> From what you've said, you don't need them, and should
> not use those allocator calls.

Could you elaborate a bit on the subject ? Which allocator calls should I 
use ? Just kmalloc ? When does a USB driver need cache coherent buffers ?

> > Using scatter-gather mappings would
> > help. However, if I'm not mistaken, the usb_sg_* routines are designed
> > for synchronous use (with usb_sg_wait), and thus can't be used for
> > streaming data.
>
> Right.  Scatterlists come from the block layer, which
> doesn't stream.

Thanks for your help.

Laurent Pinchart

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to