Hi all.
To the receive path of NDIS filter driver arrives NetBufferLists, that consists of only one NetBuffer (as documented).
But what about MDLs.
Is it one or maybe several MDLs inside that NetBuffer?
If there are several, then the reason for this is not clear to me․ After all, MDL can have any length․
And the same question about NetBufferLists. It is one or maybe several NetBufferLists in a chain.
Thanks
That will depend upon how you have structured the buffers filled in by hardware.
If you have a single, physically-contiguous buffer for each NetBuffer, then it is a single MDL.
If your receive buffer is not physically-contiguous for the network frame, then you will have to build multiple MDLs for each fragment.
In the NDIS driver I did for WEC7/WEC2013 I structured it such that every received packet was placed into a physically-contiguous buffer so I only needed a single MDL for each NetBuffer.
Greg
On Thu, 19 Jan 2023 15:40:35 +0000 (UTC), Arsen wrote:
OSR https://community.osr.com/
Arsen Started a new discussion. Account of MDLs in NetBuffer
Hi all.
To the receive path of NDIS filter driver arrives NetBufferLists, that consists of only one NetBuffer (as documented).
But what about MDLs.
Is it one or maybe several MDLs inside that NetBuffer?
If there are several, then the reason for this is not clear to me․ After all, MDL can have any length․
And the same question about NetBufferLists. It is one or maybe several NetBufferLists in a chain.
Thanks
Thank You Mr. Gregory.
Thank you Mr Gregory. I understand that it depends on the settings of my network card.
If you have a single, physically-contiguous buffer for each NetBuffer, then it is a single MDL.
If your receive buffer is not physically-contiguous for the network frame, then you will have to build multiple MDLs for each fragment.
That’s not correct. Most buffers are not physically contiguous, but an MDL must be VIRTUALLY contiguous. The whole point of an MDL is to gather physically disparate pages into a single unit.
If there are several, then the reason for this is not clear to me․ After all, MDL can have any length․
That’s also not true. An MDL is limited to 4 gigabytes. Until Windows 7, an MDL was limited to 32 megabytes, because the “Size” parameter that gives the total size of the MDL is a 16-bit field. Since each page entry is 8 bytes, that’s 65536 / 8 x 4096, or 32MB. (It’s a little bit less than that, because the 65536 has to include the size of the MDL structure.)
Mr. Tim-Roberts. Thank you. In any case, I think that network packets cannot be larger than 4 gigabytes, so there can be one mdl in one NetBuffer in the receive path, one NetBuffer and several NetBufferLists.