NDIS mux 1:2

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:

  1. Dinamically allocate library input & output buffers from non paged pool
  2. NdisGetDataBuffer() with Storage=‘input buffer’ to get access to a contiguous input frame
  3. Invoke the library with pointer returned by NdisGetDataBuffer() & output buffer
  4. NdisAllocateMdl() to get an MDL describing the library output buffer
  5. NdisAllocateNetBufferAndNetBufferList() with above MDL to build the NET_BUFFER_LIST
  6. NdisAllocateNetBufferListContext() for a context area to save reference to allocated resources
  7. NdisSendNetBufferLists() to send library output to the secondary adapter
  8. Forward the input NET_BUFFER_LIST to the primary adapter

Any suggestions, opinion & comment for above logic will by highly appreciated.

Best regards,
PaoloC

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 :slight_smile:

----- 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.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.3392 / Virus Database: 3211/6571 - Release Date: 08/12/13