New USB stack and Zero copy.

Hans Petter Selasky hselasky at c2i.net
Wed Jul 4 07:01:34 UTC 2007


Hi,

I want to get rid of the copying between DMA'able memory and non-DMA'able 
memory.

Currently I allocate N memory-pages for each USB transfer like separate pages. 
The bus-dma system then assigns all of these pages each their virtual 
address.

What I see is that when I allocate more than PAGE_SIZE bytes using bus-dma, I 
get physically contiguous memory. I don't need that for the USB stack.

The question is:

Should we change bus-dma to support so called scatter and gather allocations, 
where the physical allocation is non-contiguous, and the virtual allocation 
is contiguous accross all the scattered pages ?

Also: How is the easiest way to load memory pages into DMA ? And I want that 
the loadig works like this, that when the page must be bounced it should not 
allocate a bounce buffer, hence I already have a bounce buffer. I only need 
to know which pages I can forward directly to the USB hardware, and the rest 
I will bounce somewhere else.

--HPS


More information about the freebsd-usb mailing list