Hi all,
I have to design for one of my customers an NDIS MUX driver 1:2 with the following (semplified) logic:
a) each frame should be transmitted on the primary physical adapter
b) the frame should also be provided in the input buffer of a custom library
c) any data returned from custom library should be transmitted on the secondary physical adapter
d) the library works with data buffer and knows nothing about MDL, NET_BUFFER etc. etc.
For the output data path I suppose to use the following pattern:
Dinamically allocate library input & output buffers from non paged pool
NdisGetDataBuffer() with Storage=‘input buffer’ to get access to a contiguous input frame
Invoke the library with pointer returned by NdisGetDataBuffer() & output buffer
NdisAllocateMdl() to get an MDL describing the library output buffer
NdisAllocateNetBufferAndNetBufferList() with above MDL to build the NET_BUFFER_LIST
NdisAllocateNetBufferListContext() for a context area to save reference to allocated resources
NdisSendNetBufferLists() to send library output to the secondary adapter
Forward the input NET_BUFFER_LIST to the primary adapter
Any suggestions, opinion & comment for above logic will by highly appreciated.
I see no problem with this design. I’m sure you’re aware that copying each packet to a flat buffer will be a scalability bottleneck, but not until you reach >1Gbps traffic. So this would be fine in many configurations.
You can optimize steps 4-6 a bit by pre-allocating the output buffers and NBLs associated with the output buffers. Keep pre-created (NBL+buffer) pairs on a lookaside list so they’re ready to go when the library returns a result. But that’s more fine-tuning the perf, not essential for correctness.
Hi Jeffrey,
I will take care of your optimization suggestions.
I understand that flat buffers are a bottleneck but currently they are
required to interface the custom library.
Thanks a lot,
PaoloC
P.S. I presume I will have to post some more questions for this design
----- Original Message -----
From: “Jeffrey Tippet” To: “Windows System Software Devs Interest List” Sent: Tuesday, August 13, 2013 4:03 AM Subject: RE: [ntdev] NDIS mux 1:2
I see no problem with this design. I’m sure you’re aware that copying each packet to a flat buffer will be a scalability bottleneck, but not until you reach >1Gbps traffic. So this would be fine in many configurations.
You can optimize steps 4-6 a bit by pre-allocating the output buffers and NBLs associated with the output buffers. Keep pre-created (NBL+buffer) pairs on a lookaside list so they’re ready to go when the library returns a result. But that’s more fine-tuning the perf, not essential for correctness.