Tech Support > Microsoft Windows > Drivers > WDF Scatter/Gather Elements Number
WDF Scatter/Gather Elements Number
Posted by Gennady Mayko on January 9th, 2008



We need to transfer data to/from our PCI chip using scatter/gather
DMA. Scatter/gather descriptors for our device DMA engine should be
located in our chip's firmware memory (not in the PC memory), so we
need to pre-allocate space for them. For this we want to know the
maximum (or typical) number of scatter/gather elements that will be
used in WDF DMA transaction (last parameter of the EvtProgramDma
callback function).

Of course, we can limit number of those elements
(WdfDmaEnablerSetMaximumScatterGatherElements), however during our
experiments we sometime got error 0xC020020A
(STATUS_WDF_TOO_FRAGMENTED) from
WdfDmaTransactionInitializeUsingRequest function.

We also want to avoid starting DMA transfer several times with one
call to the EvtProgramDma callback function or to manually split the
input buffer and using WdfDmaTransactionInitialize function.

What is the recommended way to deal with limited number of scatter/
gather element?

Regards,
Gennady Mayko.

Posted by Tim Roberts on January 10th, 2008


Gennady Mayko <GMayko@gmail.com> wrote:
Well, what's the largest transfer you expect? The typical scatter/gather
list has one element per page, so max_transfer_size / 4096 will give you
your limit.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Posted by Gennady Mayko on January 10th, 2008


It seems not to be so simple...

For Windows XP, WDF 1.5, we noticed that for small DMA lengths (less
then 2 page size) WDF usually calls our callback function only once
with 1 or 2 SG descriptors (elements) in the list. For bigger DMA
lengths it calls this function once per full 2-pages size with 3 SG
descriptors, plus another last call with 1 or 2 SG descriptors. So it
seems that relatively big value (like 64) for the
WdfDmaEnablerSetMaximumScatterGatherElements function (for all DMA
lengths) will be OK, at least for this platform.

Regards,
Gennady Mayko.

Posted by Doron Holan [MSFT] on January 10th, 2008


note that the SG list size is controlled by the OS, KMDF does not control it
nor influence it. we just wrap OS functionality

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Gennady Mayko" <GMayko@gmail.com> wrote in message
news:128a2347-21e7-437f-837c-e120365535e7@d4g2000prg.googlegroups.com...
It seems not to be so simple...

For Windows XP, WDF 1.5, we noticed that for small DMA lengths (less
then 2 page size) WDF usually calls our callback function only once
with 1 or 2 SG descriptors (elements) in the list. For bigger DMA
lengths it calls this function once per full 2-pages size with 3 SG
descriptors, plus another last call with 1 or 2 SG descriptors. So it
seems that relatively big value (like 64) for the
WdfDmaEnablerSetMaximumScatterGatherElements function (for all DMA
lengths) will be OK, at least for this platform.

Regards,
Gennady Mayko.



Similar Posts