IoGetDmaAdapter clarification

Hi,

I read the following paragraph in the documentation of GetScatterGatherList in the Windows 2003 DDK, which I find a bit confusing:

“On return from the driver-supplied routine, GetScatterGatherList keeps the map registers but frees the DMA adapter structure”.

What exactly does it mean by “frees the DMA adapter structure”? As I can see for example in the PCIDRV sample IoGetDmaAdapter is only called once, upon driver resource initialization.

By taking a look to AllocateAdapterChannel and the AdapterControl routine which returns an IO_ALLOCATION_ACTION I saw the documentation mentioning something about “retaining ownership of the adapter”.

So I can presume that it has something to do with marking internally the DMA adapter as free VS busy, so that the AdapterListControl routine can be called again (“When the adapter is free, the system calls the AdapterListControl routine.”)

If my understanding is correct then I guess that the wording “frees the DMS adapter **structure**” is a bit unfortunate.

Warm Regards
Dimitris Staikos

The DMA abstraction is that a “DMA adapter” is a serialized resource capable
of performing exactly one DMA transaction at a time, where a DMA transaction
may extend over several iterations of program/start/complete. It is a
reasonable model. If your device is capable of concurrent DMA operations you
should allocate multple DMA adapters.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@staikos.name
Sent: Friday, July 21, 2006 11:14 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoGetDmaAdapter clarification

Hi,

I read the following paragraph in the documentation of
GetScatterGatherList in the Windows 2003 DDK, which I find a
bit confusing:

“On return from the driver-supplied routine,
GetScatterGatherList keeps the map registers but frees the
DMA adapter structure”.

What exactly does it mean by “frees the DMA adapter
structure”? As I can see for example in the PCIDRV sample
IoGetDmaAdapter is only called once, upon driver resource
initialization.

By taking a look to AllocateAdapterChannel and the
AdapterControl routine which returns an IO_ALLOCATION_ACTION
I saw the documentation mentioning something about “retaining
ownership of the adapter”.

So I can presume that it has something to do with marking
internally the DMA adapter as free VS busy, so that the
AdapterListControl routine can be called again (“When the
adapter is free, the system calls the AdapterListControl routine.”)

If my understanding is correct then I guess that the wording
“frees the DMS adapter **structure**” is a bit unfortunate.

Warm Regards
Dimitris Staikos


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

Hi Mark,
I have a single PCI-E HBA and it can do 3 DMA operations at the same time. One on the Tx Side and Two Engines on the Rx side. I use the IoGetDmaAdapter and then call the API’s to get the scatter gather list.(and free it at the end of DMA operation).

This scatter gather list then gets translated to the hardware specific scatter gather list and posted to the hardware.

The Tx Side and Rx Side DMA can happen at the same time which means that I might be in a situation where I will be calling GetScatterGatherList for Tx side and approximately at the same time I will be calling this API from my Rx Side.

Do you think that I will end up in contention and will need more than one DMA adapters just to get the scatter gather lists??

Thanks for the help.
-Driver_Coder.

Mark Roddy wrote:
The DMA abstraction is that a “DMA adapter” is a serialized resource capable
of performing exactly one DMA transaction at a time, where a DMA transaction
may extend over several iterations of program/start/complete. It is a
reasonable model. If your device is capable of concurrent DMA operations you
should allocate multple DMA adapters.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@staikos.name
> Sent: Friday, July 21, 2006 11:14 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] IoGetDmaAdapter clarification
>
> Hi,
>
> I read the following paragraph in the documentation of
> GetScatterGatherList in the Windows 2003 DDK, which I find a
> bit confusing:
>
> “On return from the driver-supplied routine,
> GetScatterGatherList keeps the map registers but frees the
> DMA adapter structure”.
>
> What exactly does it mean by “frees the DMA adapter
> structure”? As I can see for example in the PCIDRV sample
> IoGetDmaAdapter is only called once, upon driver resource
> initialization.
>
> By taking a look to AllocateAdapterChannel and the
> AdapterControl routine which returns an IO_ALLOCATION_ACTION
> I saw the documentation mentioning something about “retaining
> ownership of the adapter”.
>
> So I can presume that it has something to do with marking
> internally the DMA adapter as free VS busy, so that the
> AdapterListControl routine can be called again (“When the
> adapter is free, the system calls the AdapterListControl routine.”)
>
> If my understanding is correct then I guess that the wording
> “frees the DMS adapter structure” is a bit unfortunate.
>
> Warm Regards
> Dimitris Staikos
>
> —
> 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

---------------------------------
How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.

I would use separate adapter objects to allow full concurrency.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Driver Coder
Sent: Friday, July 21, 2006 5:08 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoGetDmaAdapter clarification

Hi Mark,
I have a single PCI-E HBA and it can do 3 DMA operations at the same
time. One on the Tx Side and Two Engines on the Rx side. I use the
IoGetDmaAdapter and then call the API’s to get the scatter gather list.(and
free it at the end of DMA operation).

This scatter gather list then gets translated to the hardware specific
scatter gather list and posted to the hardware.

The Tx Side and Rx Side DMA can happen at the same time which means that I
might be in a situation where I will be calling GetScatterGatherList for Tx
side and approximately at the same time I will be calling this API from my
Rx Side.

Do you think that I will end up in contention and will need more than one
DMA adapters just to get the scatter gather lists??

Thanks for the help.
-Driver_Coder.

Mark Roddy wrote:

The DMA abstraction is that a “DMA adapter” is a serialized resource capable
of performing exactly one DMA transaction at a time, where a DMA transaction
may extend over several iterations of program/start/complete. It is a
reasonable model. If your device is capable of concurrent DMA operations you
should allocate multple DMA adapters.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@staikos.name
> Sent: Friday, July 21, 2006 11:14 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] IoGetDmaAdapter clarification
>
> Hi,
>
> I read the following paragraph in the documentation of
> GetScatterGatherList in the Windows 2003 DDK, which I find a
> bit confusing:
>
> “On return from the driver-supplied routine,
> GetScatterGatherList keeps the map registers but frees the
> DMA adapter structure”.
>
> What exactly does it mean by “frees the DMA adapter
> structure”? As I can see for example in the PCIDRV sample
> IoGetDmaAdapter is only called once, upon driver resource
> initialization.
>
> By taking a look to AllocateAdapterChannel and the
> AdapterControl routine which returns an IO_ALLOCATION_ACTION
> I saw the documentation mentioning something about “retaining
> ownership of the adapter”.
>
> So I can presume that it has something to do with marking
> internally the DMA adapter as free VS busy, so that the
> AdapterListControl routine can be called again (“When the
> adapter is free, the system calls the AdapterListControl routine.”)
>
> If my understanding is correct then I guess that the wording
> “frees the DMS adapter structure” is a bit unfortunate.
>
> Warm Regards
> Dimitris Staikos
>
> —
> 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

_____

How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone
http:t=39663/*http://voice.yahoo.com> call rates. — 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</http:>

Hi Mark,

Thanks but this wasn’t what I was asking. My device has at least 12 completely independent DMA contexts and I have a separate DMA adapter object for each context.

My comment had to do with the documentation of IoGetDmaAdapter being a bit misleading when it says that “On return from the driver-supplied routine, GetScatterGatherList keeps the map
registers but frees the DMA adapter **structure**”.
Obviously the DMA adapter *structure* is not freed since I can reuse it over and over again, but more likely “marked as free\available for the next DMA operation”.

That was my point and I just wanted to confirm that my understanding is not mistaken :slight_smile:

Warm Regards,
Dimitris Staikos

Free in this case means releases its ownership of the adapter object
allowing it to be reused for another dma transaction.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@staikos.name
Sent: Monday, July 24, 2006 3:32 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IoGetDmaAdapter clarification

Hi Mark,

Thanks but this wasn’t what I was asking. My device has at
least 12 completely independent DMA contexts and I have a
separate DMA adapter object for each context.

My comment had to do with the documentation of
IoGetDmaAdapter being a bit misleading when it says that “On
return from the driver-supplied routine, GetScatterGatherList
keeps the map registers but frees the DMA adapter **structure**”.
Obviously the DMA adapter *structure* is not freed since I
can reuse it over and over again, but more likely “marked as
free\available for the next DMA operation”.

That was my point and I just wanted to confirm that my
understanding is not mistaken :slight_smile:

Warm Regards,
Dimitris Staikos


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