Proper way of freeing buffers when using NdisSendPackets? (NDIS 5.0)

Hey everyone,

When using the simple case of NdisSend, I free the packet buffer and the buffer in case the returned status is not NDIS_STATUS_PENDING,

But how to properly free buffers in case of NdisSendPackets when i send multiple packets at once? because unlike NdisSend, it does not return any status.

So what is the proper way of freeing the buffers that i Allocated with NdisAllocatePacket and NdisAllcateBuffer in the case of NdisSendPackets?

Also, in the NdisSendPackets page, MSDN says:

“The caller of NdisSendPackets should test the returned status for each packet in such an array individually when its ProtocolSendComplete function is called with the completion Status”

But in the ProtocolSendComplete MSDN, it says:

“This function is a required driver function that completes the processing of a protocol-initiated send previously passed to NdisSendPackets or NdisSend, which returned NDIS_STATUS_PENDING.”

So… based on what i gathered, SendComplete is called only for packets that returned NDIS_STATUS_PENDING.
But why it says that i "should test the returned status " in the SendComplete, if its only for NDIS_STATUS_PENDING?!

And how should i free Buffers then? Should i look through all the packets after Call to NdisSendPackets and use NDIS_GET_PACKET_STATUS to see the result, and if its not NDIS_STATUS_PENDING then free it? or…?!

(Note that currently i already free every packet buffer that i receive in my SendComplete)

The main problem I’m facing right now is that even tho I’m looping through every packet in the array after NdisSendPackets, and freeing only the ones that are not NDIS_STATUS_PENDING, i got a bugcheck at NdisFreeBuffer for “Attempt to free pool which was already freed” (BAD_POOL_CALLER), even tho I’m sure as hell i didn’t free it before myself…

And weirdly enough, when i don’t free the packet buffers that do not have NDIS_STATUS_PENDING in their status, i don’t get any BSOD.

So it seems like that my SendComplete is getting called for every one of the packets, not not just the ones that had NDIS_STATUS_PENDING…? I thought it only gets called for packets that have NDIS_STATUS_PENDING? at least its the case when using NdisSend.

Update: So it seems like my assumption was true and my SendComplete gets called for every packet, and not just the ones that return NDIS_STATUS_PENDING…

Anyone got any idea why this is happening?

And another question:
Do all NICs support multi packet send/recv? Is there any need for me to be worry when i use a packet array with NdisSendPackets and NdisMIndicateReceivePacket, instead of a single packet, or do all the NICs properly support multi packet send/recv?