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

Viewed 36

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,

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

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?!

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.. I moved all my buffer freeing to the SendComplete and i no longer get bugcheck, 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..

And another side 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?

0 Answers
Related