NdisInitializeNPagedLookasideList (Compact 2013)
3/26/2014
This function initializes a lookaside list. After a successful initialization, nonpaged fixed-size blocks can be allocated from and freed to the lookaside list.
Syntax
VOID NdisInitializeNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside,
IN PALLOCATE_FUNCTION Allocate OPTIONAL,
IN PFREE_FUNCTION Free OPTIONAL,
IN ULONG Flags,
IN ULONG Size,
IN ULONG Tag,
IN USHORT Depth
);
Parameters
- Lookaside
Pointer to the caller-supplied lookaside list head to be initialized. The driver must provide a list head that is resident, that is, in nonpaged system space.
- Allocate
Either is NULL or specifies the entry point of a caller-supplied function that will allocate an entry of the specified Size when it is called. If allocate is NULL, NdisAllocateFromNPagedLookasideList subsequently allocates entries on behalf of the caller. If the caller provides an Allocate function, it must also provide a Free function.
- Free
Either is NULL or specifies the entry point of a caller-supplied function that will free an entry of the specified Size whenever it is called. If Free is NULL, NdisFreeToNPagedLookasideList subsequently frees entries on behalf of the caller.
- Flags
Reserved for system use; set to 0 (zero).
- Size
Specifies the size in bytes of each entry to be subsequently allocated from the lookaside list.
- Tag
Specifies a caller-supplied pool tag for lookaside list entries. The Tag is a string of four characters delimited by single quotation marks (for example, 'derF'). The characters are usually specified in reverse order so they are easier to read when dumping pool or tracking pool usage in the debugger.
- Depth
Reserved for system use; set to 0 (zero).
Return Value
None.
Remarks
NdisInitializeNPagedLookasideList initializes the caller-supplied list head but allocates no memory for list entries. The initial entries are allocated on an as-needed basis either with calls to the NdisAllocateFromNPagedLookasideList function or by the driver-supplied Allocate callback function at the Allocate parameter. The list is populated as the driver frees entries back to the list with the NdisFreeToNPagedLookasideList function. Entries collect on the list until a system-determined but dynamically sized limit is reached. Then, any surplus entries in the lookaside list are returned to nonpaged pool, either by NdisFreeToNPagedLookasideList or with calls to the driver-supplied Free callback function at the Free parameter.
All entries in the lookaside list are of the same size, which is specified in the Size parameter. A lookaside list is especially useful to drivers that must dynamically allocate and free fixed-size context areas in which to maintain run-time state about their outstanding I/O operations. For example, connection-oriented NDIS drivers are likely to find lookaside lists especially useful because such drivers usually maintain a dynamic set of context areas to track outgoing and incoming calls.
It is more efficient for a driver to allow the NdisAllocateFromNPagedLookasideList and NdisFreeToNPagedLookasideList functions to manage the allocation and deallocation of entries. However, a driver that tracks state internally about its memory usage might supply Allocate and Free functions to NdisInitializeNPagedLookasideList.
Callers of NdisInitializeNPagedLookasideList must be running at IRQL <= DISPATCH_LEVEL, but are usually running at PASSIVE_LEVEL.
Requirements
Header |
ndis.h |
Library |
ndis.lib |
See Also
Reference
NDIS Lookaside Lists Interface
NdisDeleteNPagedLookasideList