NdisDprFreePacketNonInterlocked

VOID
   NdisDprFreePacketNonInterlocked(
       IN PNDIS_PACKET Packet
       );

NdisDprFreePacketNonInterlocked releases a driver-allocated packet descriptor and returns it to the free list when the caller is running at IRQL DISPATCH_LEVEL and that caller provides internal synchronization for accessing packet pool.

Parameters

Packet

Points to a packet descriptor returned by NdisDprAllocatePacketNonInterlocked.

Comments

Before calling NdisDprFreePacketNonInterlocked, the driver either must call NdisFreeBuffer as many times as necessary to release all buffer descriptors chained to the packet, or it must call an NdisUnchainBufferAtXxx function as many times as necessary to save all pointers to buffer descriptors. Otherwise, memory associated with buffer descriptors in the chain remains unusable by the driver

A caller of NdisDprFreePacketNonInterlocked and its reciprocal NdisDprAllocatePacketNonInterlocked is responsible for synchronizing all accesses to the packet pool that driver allocated with NdisAllocatePacketPool. Otherwise, the driver should let NDIS manage this synchronization on its behalf by calling NdisAllocate/FreePacket or NdisDprAllocate/FreePacket.

Usually, such a driver protects its packet pool with a driver-allocated spin lock. Before calling NdisDprFreePacketNonInterlocked, the driver calls NdisAcquireSpinLock, which raises IRQL to DISPATCH_LEVEL. Only when the driver resumes execution holding its spin lock does it call NdisDprFreePacketNonInterlocked. Such a driver releases its spin lock with NdisReleaseSpinLock when NdisDprFreePacketNonInterlocked returns control.

Callers of NdisDprFreePacketNonInterlocked must be running at IRQL DISPATCH_LEVEL.

See Also

NdisAcquireSpinLock, NdisAllocatePacketPool, NdisDprAllocatePacketNonInterlocked, NdisDprFreePacket, NdisFreeBuffer, NdisFreePacket, NdisReleaseSpinLock, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront