NdisInterlockedInsertHeadList macro (ndis.h)
The NdisInterlockedInsertHeadList function inserts an entry, usually a packet, at the head of a doubly linked list so that access to the list is synchronized in a multiprocessor-safe way.
Syntax
void NdisInterlockedInsertHeadList(
[in] _ListHead,
[in] _ListEntry,
[in] _SpinLock
);
Parameters
[in] _ListHead
A pointer to the head of the doubly linked list into which an entry is to be inserted.
[in] _ListEntry
A pointer to the entry to be inserted at the head of the list.
[in] _SpinLock
A pointer to a caller-supplied spin lock, used to synchronize access to the list.
Return value
None
Remarks
Before calling NdisInterlockedInsertHeadList, a driver must initialize the variable at ListHead with the NdisInitializeListHead function and the variable at SpinLock with the NdisAllocateSpinLock function. The driver also must provide resident storage for these variables and for its internal queue.
The caller-supplied spin lock prevents any other function from accessing the driver's internal queue while NdisInterlockedInsertHeadList is inserting the given entry, even when the driver is running on a multiprocessor computer.
NdisInterlockedInsertHeadList raises IRQL to DISPATCH_LEVEL when it acquires the given spin lock and restores the original IRQL before it returns control. Consequently, any driver function that calls NdisInterlockedInsertHeadList cannot be pageable code.
Most NDIS drivers process packets in FIFO order, so any driver that uses an interlocked queue tends to cal thel NdisInterlockedInsertTailList function far more frequently than NdisInterlockedInsertHeadList. Such a driver usually calls NdisInterlockedInsertHeadList only to requeue a packet for a retry operation.
To convert a returned value back to the address of the inserted entry, a driver can use the CONTAINING_RECORD macro.
If NdisInterlockedInsertHeadList is called at IRQL >= DISPATCH_LEVEL, the storage for the ListHead parameter and the list entries must be resident.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisInterlockedInsertHeadList (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisInterlockedInsertHeadList (NDIS 5.1)) in Windows XP. |
Target Platform | Universal |
Header | ndis.h (include Ndis.h) |
Library | Ndis.lib |
IRQL | Any level |