NdisInitializeNPagedLookasideList (NDIS 5.1) function
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
NdisInitializeNPagedLookasideList 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_opt_ PALLOCATE_FUNCTION Allocate,
_In_opt_ PFREE_FUNCTION Free,
_In_ ULONG Flags,
_In_ ULONG Size,
_In_ ULONG Tag,
_In_ USHORT Depth
);
Parameters
Lookaside [in]
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 [in, optional]
Either is NULL or specifies the entry point of a caller-supplied function that will allocate an entry of the specified Size whenever it is called. If Allocate is NULL, NdisAllocateFromNPagedLookasideList subsequently allocates entries on behalf of the caller. If the caller provides an Allocate function, it also must provide a Free function.Free [in, optional]
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 [in]
Must be zero. This parameter is reserved for system use.Size [in]
Specifies the size in bytes of each entry to be subsequently allocated from the lookaside list.Tag [in]
Specifies a caller-supplied pool tag for lookaside list entries. The Tag is a string of four characters delimited by single quote 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 [in]
Must be zero. This parameter is also reserved for system use.
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 NdisAllocateFromNPagedLookasideList or by the driver-supplied Allocate callback. The list becomes populated as the driver frees entries back to the list with NdisFreeToNPagedLookasideList. 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.
All entries in the lookaside list are of the same size, which is specified when the driver called NdisInitializeNPagedLookasideList. A lookaside list is particularly 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 instance, connection-oriented NDIS drivers are likely to find lookaside lists particularly 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 NdisAllocate/Free..LookasideList functions 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
Target platform |
Desktop |
Version |
|
Header |
Ndis.h (include Ndis.h) |
IRQL |
<= DISPATCH_LEVEL (see Remarks section) |
See also
NdisAllocateFromNPagedLookasideList