NdisDprAllocatePacketNonInterlocked allocates and initializes a packet descriptor. Because Windows CE does not support DPC IRQL, all NdisDprXXX functions perform identically to the non-DPR equivalent.
VOID NdisDprAllocatePacketNonInterlocked( PNDIS_STATUS Status, PNDIS_PACKET* Packet, NDIS_HANDLE PoolHandle );
[out] Pointer to a caller-supplied variable in which this function returns the final status of the request.
[out]Pointer to a caller-supplied variable in which this function returns a pointer to the allocated packet descriptor.
[in]Specifies the handle returned by a preceding call to NdisAllocatePacketPool.
The following table shows the return values for this function
|NDIS_STATUS_SUCCESS||The caller can use the packet descriptor returned at Packet.|
|NDIS_STATUS_RESOURCES||The free list for the packet pool currently has no available entries. A subsequent call to NdisDprFreePacketNonInterlocked will return the given entry to the free list. The variable at Packet is set to NULL.|
A driver that calls NdisDprAllocatePacketNonInterlocked (and its reciprocal NdisDprFreePacketNonInterlocked) manages the synchronization of its accesses to packet pool internally. The driver allocated such accesses with NdisAllocatePacketPool.
Usually, a driver such as this protects its packet pool with a driver-allocated spin lock. When the driver resumes execution with a locked packet pool, it calls NdisDprAllocatePacketNonInterlocked. After NdisDprAllocatePacketNonInterlocked returns control, the driver releases its spin lock with NdisReleaseSpinLock.
Any packet descriptor allocated with NdisDprAllocatePacketNonInterlocked must be freed with NdisDprFreePacketNonInterlocked except, possibly, when a driver is releasing its allocated resources just before being unloaded. Otherwise, a runtime synchronization error occurs that can cause race conditions to release any packet descriptor with NdisDprFreePacket or NdisFreePacket if that packet descriptor was allocated with NdisDprAllocatePacketNonInterlocked.
If the driver does not manage the synchronization, it should let NDIS manage this synchronization on its behalf by calling NdisAllocatePacket or NdisDprAllocatePacket. In this case, the driver calls NdisAcquireSpinLock before it releases a packet descriptor back to pool with NdisDprFreePacketNonInterlocked and, then, it calls NdisReleaseSpinLock.
OS Versions: Windows CE .NET 4.0 and later.
MiniportDisableInterrupt | MiniportISR | MiniportSynchronizeISR | NdisAcquireSpinLock | NdisAllocatePacket | NdisAllocatePacketPool | NdisAllocateSpinLock | NdisDprAllocatePacket | NdisDprFreePacket | NdisDprFreePacketNonInterlocked | NdisDprReleaseSpinLock | NdisFreePacket | NdisMSynchronizeWithInterrupt | NdisReleaseSpinLock
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.