I’m rather new to NDIS development and was hoping for some thoughts on my implementation and some of the difficulties I’m having.
The MiniportSendPackets/ProtocolSendComplete implementation roughly proceeds as follows:
MiniportSendPackets –>
-
Use result from OID_GEN_MAXIMUM_SEND_PACKETS request to divide up the incoming packet array into slices.
-
Repackage each packet with a new descriptor from one of the following locations in order:
2.1. Packet descriptor cache (spin lock protected single list) filled during MiniportInitialise from send packet pool.
2.2. Same send packet pool from which the cache was originally filled if the cache is empty. -
Move/copy all relevant data from original packets and send each slice with NdisSendPackets.
-
If unsuccessful in 2 above, queue (spin locked protected double list) packets for sending later.
ProtocolSendComplete –>
-
If successful, recover original packets and return to sender
-
Return our packet descriptors to cache/pool (depends on current throughput stats etc).
-
Process and send any queued packets from MiniportSendPackets.
-
If unsuccessful in 1 or 3 above, queue packets for sending later.
-
If we’ve tried 4 above too many times return packets to sender with an appropriate error.
I need to come up with a better strategy for handling packets queued for sending later, as it’s possible for all my outstanding packets to be returned before I’ve queued the other packets, and therefore the
queued packets will never be processed until another packet is sent.
I’ve thought of two ways of handling this:
-
I could synchronize (spin lock) the sending/queueing code in MiniportSendPackets with the queue checking code in ProtocolSendComplete, but I was concerned that NdisSendPackets could call
ProtocolSendComplete in it’s context and therefore create a deadlock. -
After queuing packets start a timer to check the queue soon after.
Any thoughts on this would be greatly appreciated.
Cheers
Karl
PGP Public Key Fingerprint: 402F D539 3CDB DCC6 0E40 8437 B957 C9B2
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com