On Friday 18 May 2007, David Brownell wrote:
> On Thursday 17 May 2007, Hans Petter Selasky wrote:
> > Isn't that the job of "usb_buffer_alloc()", to allocate memory in blocks
> > of PAGE_SIZE bytes?
>
> Not at all.  The "size" parameter is in bytes, and the utility
> code it calls goes to some lengths to *avoid* that kind of wastage.
> As they say:  UTSL!
>
> The original reason to have such routines was to allocate small
> buffers for HID devices on systems where DMA map/unmap operations
> were absurdly expensive on such small buffers.  (Think IOMMU ops
> across a slowish bus.)

The usb_buffer_alloc name is misleading. Many USB driver developers believe it 
is a generic purpose buffer allocator.

I'd like to change usb_buffer_alloc to make it a general purpose allocator. A 
parameter would tell the function to just allocate memory (default behaviour) 
or to allocate a DMA coherent mapping as well. We could even pass the URB 
pointer to the function to set the URB_TRANSFER_NO_DMA_MAP automatically 
(although usb_buffer_alloc can be used to allocate the setup buffer, so the 
API might have to be a little different).

> > Is it right understood that the Linux USB stack does currently not use
> > scatter and gathering? To me it seems like that, hence in the URB Linux
> > only has a single DMA address value.
>
> Let me guess -- you didn't read my response on that topic ... ?

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