NdisAllocateNetBufferMdlAndData function (ndis/nblapi.h)

NDIS drivers call the NdisAllocateNetBufferMdlAndData function to allocate a NET_BUFFER structure along with the associated MDL and data.

Syntax

NDIS_EXPORTED_ROUTINE NET_BUFFER * NdisAllocateNetBufferMdlAndData(
  [in] NDIS_HANDLE PoolHandle
);

Parameters

[in] PoolHandle

A NET_BUFFER structure pool handle that was previously returned from a call to the NdisAllocateNetBufferPool function.

Return value

NdisAllocateNetBufferMdlAndData returns a pointer to the NET_BUFFER structure that NDIS allocated. If the allocation was unsuccessful, this pointer is NULL.

Remarks

The caller must call the NdisAllocateNetBufferPool function and specify the maximum size of the data buffers. Given this value, NDIS can preallocate buffers for the caller.

This function allocates a NET_BUFFER structure, MDL and data in a single memory buffer. This is useful to achieve high performance when NET_BUFFER structures are frequently allocated and freed. The caller should not call NdisAllocateNetBuffer to allocate NET_BUFFERs out of NET_BUFFER pools which contain data.

NDIS uses the PoolHandle parameter to get a block of memory, and then creates the NET_BUFFER, MDL, and data buffer.

To free the NET_BUFFER and associated information, call the NdisFreeNetBuffer function.

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Universal
Header ndis/nblapi.h (include ndis.h)
Library Ndis.lib
IRQL <= DISPATCH_LEVEL
DDI compliance rules Irql_NetBuffer_Function(ndis), NdisAllocateNetBufferMdlAndData(ndis), NdisAllocateNetBufferMdlAndData_InitFail(ndis)

See also

NET_BUFFER

NdisAllocateNetBuffer

NdisFreeNetBuffer