Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times…but I couldn’t find a clear answer. So here I go again…

Our NIC hardware DMA supports 32bit addressing. It has support for scatter-gather. But the restriction is that except for the last fragment in scatter-gather list, the remaining fragments need to be multiple of 4 number of bytes. (ie 4, 8, 12…bytes). I know when we initialize the scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that that the alignment is 32 bit…but will it also ensure our requirement (of size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet into shared buffer and pass the this buffer to DMA as one single buffer (Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

There's no way to do this - what's more, I think you will get lots of
violations of this when TCP is above you since it uses chained MDLs to
generate the IP packet headers and each element is just as big as it needs
to be (and is at a different, non-contiguous, physical address).

I think you should speak to your HW engineers and get the DMA engine fixed
:wink:

/simgr


From: Susaant K [mailto:xxxxx@redpinesignals.com]
Sent: Tuesday, October 14, 2003 12:57 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times...but I
couldn't find a clear answer. So here I go again...

Our NIC hardware DMA supports 32bit addressing. It has support for
scatter-gather. But the restriction is that except for the last fragment in
scatter-gather list, the remaining fragments need to be multiple of 4 number
of bytes. (ie 4, 8, 12...bytes). I know when we initialize the
scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that
that the alignment is 32 bit...but will it also ensure our requirement (of
size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet
into shared buffer and pass the this buffer to DMA as one single buffer
(Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The boundaries between chunks of the scatter-gather list are always aligned on physical page size, which is better then 4byte.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com

----- Original Message -----
From: Susaant K
To: Windows System Software Devs Interest List
Sent: Tuesday, October 14, 2003 8:56 AM
Subject: [ntdev] Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times...but I couldn't find a clear answer. So here I go again...

Our NIC hardware DMA supports 32bit addressing. It has support for scatter-gather. But the restriction is that except for the last fragment in scatter-gather list, the remaining fragments need to be multiple of 4 number of bytes. (ie 4, 8, 12...bytes). I know when we initialize the scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that that the alignment is 32 bit...but will it also ensure our requirement (of size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet into shared buffer and pass the this buffer to DMA as one single buffer (Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Um… I dont think so – both the start address and length can be any byte
offset in the page (so in the SG list entry, the logical address field can
be any byte offset and the length can be any value.

/simgr


From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, October 14, 2003 2:57 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Scatter gather doubts

The boundaries between chunks of the scatter-gather list are always
aligned on physical page size, which is better then 4byte.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com mailto:xxxxx
http://www.storagecraft.com http:

----- Original Message -----
From: Susaant K mailto:xxxxx
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Tuesday, October 14, 2003 8:56 AM
Subject: [ntdev] Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times…but I
couldn’t find a clear answer. So here I go again…

Our NIC hardware DMA supports 32bit addressing. It has support for
scatter-gather. But the restriction is that except for the last fragment in
scatter-gather list, the remaining fragments need to be multiple of 4 number
of bytes. (ie 4, 8, 12…bytes). I know when we initialize the
scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that
that the alignment is 32 bit…but will it also ensure our requirement (of
size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet
into shared buffer and pass the this buffer to DMA as one single buffer
(Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx>

Just to get myself clear...

Logical address often defines as the bus relative address, and that is the way a DMA device sees, and in that case it make sense to be on the physical page boundary !!!

-prokash
----- Original Message -----
From: Graham, Simon
To: Windows System Software Devs Interest List
Sent: Tuesday, October 14, 2003 12:09 PM
Subject: [ntdev] Re: Scatter gather doubts

Um... I dont think so -- both the start address and length can be any byte offset in the page (so in the SG list entry, the logical address field can be any byte offset and the length can be any value.

/simgr


From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, October 14, 2003 2:57 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Scatter gather doubts

The boundaries between chunks of the scatter-gather list are always aligned on physical page size, which is better then 4byte.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Susaant K
To: Windows System Software Devs Interest List
Sent: Tuesday, October 14, 2003 8:56 AM
Subject: [ntdev] Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times...but I couldn't find a clear answer. So here I go again...

Our NIC hardware DMA supports 32bit addressing. It has support for scatter-gather. But the restriction is that except for the last fragment in scatter-gather list, the remaining fragments need to be multiple of 4 number of bytes. (ie 4, 8, 12...bytes). I know when we initialize the scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that that the alignment is 32 bit...but will it also ensure our requirement (of size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet into shared buffer and pass the this buffer to DMA as one single buffer (Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@garlic.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

No - the logical address in the SG list represents the start byte of the DMA
transfer and will have a page offset value of whatever the original data
location is; if I attempt to DMA from/to a location at offset 23 in a page
for length 1 byte, then the SG entry logical address will have page offset
of 23 and length 1. Since NDIS uses MDL chains to setup IP packets, each MDL
in the chain will be at least one SG entry in the SG list and may have
non-aligned page offset and length.

/simgr


From: Prokash Sinha [mailto:xxxxx@garlic.com]
Sent: Tuesday, October 14, 2003 4:16 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Scatter gather doubts

Just to get myself clear…

Logical address often defines as the bus relative address, and that is the
way a DMA device sees, and in that case it make sense to be on the physical
page boundary !!!

-prokash

----- Original Message -----
From: Graham, Simon mailto:xxxxx
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Tuesday, October 14, 2003 12:09 PM
Subject: [ntdev] Re: Scatter gather doubts

Um… I dont think so – both the start address and length can be any byte
offset in the page (so in the SG list entry, the logical address field can
be any byte offset and the length can be any value.

/simgr

_____

From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, October 14, 2003 2:57 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Scatter gather doubts

The boundaries between chunks of the scatter-gather list are always
aligned on physical page size, which is better then 4byte.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com mailto:xxxxx
http://www.storagecraft.com http:

----- Original Message -----
From: Susaant K mailto:xxxxx
To: Windows System Software Devs Interest mailto:xxxxx List

Sent: Tuesday, October 14, 2003 8:56 AM
Subject: [ntdev] Scatter gather doubts

Hi all,

I guess this question has already been asked quite a number of times…but I
couldn’t find a clear answer. So here I go again…

Our NIC hardware DMA supports 32bit addressing. It has support for
scatter-gather. But the restriction is that except for the last fragment in
scatter-gather list, the remaining fragments need to be multiple of 4 number
of bytes. (ie 4, 8, 12…bytes). I know when we initialize the
scatter-gather dma (NdisMInitializeScatterGatherDma) it will ensure that
that the alignment is 32 bit…but will it also ensure our requirement (of
size being multiple of 4 bytes)?

If not, is the only option that is available is to copy the entire packet
into shared buffer and pass the this buffer to DMA as one single buffer
(Ignoring Scatter-Gather altogether)?

Thanks in advance.

Regards,
Susaant

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@garlic.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>