The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
I am trying to limit the number of SG elements sent by the NDIS stack. Below is the scenario:
I am using iperf3 to send TSO traffic. The miniport driver support LSO V2 with maximum payload of 256k bytes. Once the NetBuffer is received by the miniport driver from NDIS stack, the driver calls NdisMAllocateNetBufferSGList() for NDIS to prepare and provide the SG list to the driver. The number of SG elements represent the non-contiguous pages/memory in the MDL. For a packet of 128K bytes, I see that the driver receives about 33 SG elements (1 for header and rest for that payload with each of maximum 4K bytes). Each SG element is mapped to the transmit ring descriptor. With more payload, number of SG elements increases and hence the use of number of descriptors. Now I want to limit this number of SG elements to say for example 20 with each having more than 4K of payload.
Is there a way to tell the NDIS stack to provide max number of SG elements? With each element having more than 4K size?
I researched a bit and found no way to do 1. So, another question is is there a way to allocate large memory (contiguous pages) and tell NDIS to use it to store the payload and create SG list from that. As pages are contiguous the number of SG elements would reduce. Any pointer to this would be great.
Another way I was thinking is once the SG elements are provided, the driver will use large private buffers and copy those elements to the buffers and use the buffer addresses to pass it to descriptors. My concern here is it will lead to copy operation which will hit performance and I would like to keep the hit to minimum.
Other possibility I was thinking is is there a way to split the NetBuffer into 2 NB with each having half of original payload and pass each of them separately to create SG list? How complicated this would be?
Any other way to achieve this to limit the number of SG elements?
|Upcoming OSR Seminars|
|OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!|
|Writing WDF Drivers||7 Dec 2020||LIVE ONLINE|
|Internals & Software Drivers||25 Jan 2021||LIVE ONLINE|
|Developing Minifilters||8 March 2021||LIVE ONLINE|