When I talk about doing “common buffer DMA” as opposed to “packet based
DMA” or “slave mode DMA” or “scatter-gather DMA” I tend be talking about
#1.
But yes - those are the modes of using common buffer. To contain data,
to contain SG lists, and/or to contain control information.
Now don’t make the mistake of assuming they’re mutually exclusive J
-p
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Wu, Cody
Sent: Sunday, October 08, 2006 4:53 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about common buffer DMA
Hi, Peter
Thanks very much for your clarification! Now I have a better idea about
what common buffer is.
Actually I have read the whole series of “About DMA” in your blog
already and only the part on Common Buffer puzzled me a little bit. I
have to say, these articles are really worth reading for anyone who is
interested in DMA principle & programming. My misunderstanding will all
be attributed to my rather lack of experiences in this field. J
So just as you have pointed out, common buffer DMA can mean three
different things based on how you use it (or may be not that different).
-
It could be used as a pure data buffer in which case you can
assemble little pieces of user data in the buffer and send them out as a
whole. The outstanding example will be most NIC. Nearly all PCI
Busmaster with DMA engine will support this mode.
-
It could be used to hold a SG list but the actual data is never
transferred here. There could be other control structures here anyway.
This mode requires support from hardware.
-
It could contain both space for data and control to fulfill some
most advanced functionality. Ring buffer, for example, is one of many
possibilities that this mode could be put to use. Once again, this is
largely hardware dependent.
Is my understanding correct this time? Correct me please if I miss
anything. 
Btw, for anyone interested in DMA, here is peter’s blog url which I
strongly recommend:
http://blogs.msdn.com/peterwie/archive/2006/02/27/540252.aspx
Best regards,
Cody
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Monday, October 09, 2006 1:42 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about common buffer DMA
The terminology around DMA isn’t the greatest because it mixes software
programming model with how the DMA controller on the device works.
David is correct that any Busmastering PCI device should be able to do
“common buffer” DMA as easily as it can do “packet-based” DMA. It’s all
a matter of where the DMA controller is going to pickup data from -
either a fixed common buffer location or a location per-request. If the
controller can handle a per-request base/length pair (or a per-request
SG list) then you can provide values which cause it to read from a
location in the common buffer instead of providing values that cause it
to read from the original request pages.
Composing data buffers in common buffer can be slower or faster
depending on your hardware. For example, say your device can’t handle a
non-page-aligned break in the middle of an SG list. Network drivers
tend to get chained MDLs which consist of small non-aligned buffers (for
the different network headers). To send the entire packet you would
either need to program the device to transfer a chunk, then on the
interrupt setup to transfer another chunk, or you’d need to compose a
contiguous data blob in common-buffer to send the whole thing. At some
point for every device with this problme there’s a buffer size at which
composing the data in common buffer is faster than taking N interrupts
to do a single transfer.
-p
From: xxxxx@lists.osr.com on behalf of Wu, Cody
Sent: Sat 10/7/2006 8:50 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about common buffer DMA
Hi, David
Thanks for your reply.
Well, I doubt if any busmaster pci card can use common buffer dma. It
seems to me the common buffer dma is more frequently related to some
kind of third party hardwares. Most Pci Busmaster devices, tend to use
its own Dma engine to perform read/write operations and they can be
programmed easily with the physical address/transfer length pairs. So to
me they make better sense to be categorized as Packet Based Dma. Correct
me please if I am confusing some concepts here. Thanks!
Best regards,
Cody
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Sunday, October 08, 2006 11:04 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Question about common buffer DMA
Any busmaster PCI card can use common buffer DMA. Just look at the read
or write request and analyze the MDL to see if there is more than one
entry. If there is more than one, just copy the data to the common
buffer and use an MDL that has only one entry. This is good to slow
your driver down or just see how it works. Just never allow a MDL list
of multiple pieces. You could do both in your driver and switch based
upon a user IoCtl via a private device object so you can see how the two
methods compare. I hope common buffer DMA devices are extremely rare or
non-existant.
“Wu, Cody” wrote in message
news:xxxxx@ntdev…
Hi, all
I read a lot about common buffer DMA models recently and there
is still one thing I am not sure about. Hopefully someone here can share
with me your thoughts on it.
I know common DMA buffers needs to allocate a physically
contiguous memory region for the communication between the device and
the driver. I am just thinking that, if we are using common buffer
devices, the user data would have to be copied from user-space memory to
the common buffer first, and then set the relative control structure in
the common buffer and program the hardware to initiate the real
transfer. If that is the case, wouldn’t it be much more slowly than
doing a direct memory copy since now we have to copy user data to common
buffer before DMA transfer is started every time? Is this some sort of
downside of using common buffer DMA?
By the way, I would be grateful is someone can recommend me some
common buffer DMA adapters and I would like to read its datasheet for
the implementation details. Thanks in advance for any of your
explanations!!!
Best regards,
Cody
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer