Поделиться через


NdisAllocateBufferPool (Windows Embedded CE 6.0)

1/6/2010

This function returns a handle with which the caller can allocate buffer descriptors by calling the NdisAllocateBuffer function.

Syntax

VOID NdisAllocateBufferPool(
  PNDIS_STATUS Status,
  PNDIS_HANDLE PoolHandle,
  UINT NumberOfDescriptors
);

Parameters

  • Status
    [out] Pointer to a caller-supplied variable in which this function returns the final status of the buffer pool allocation.
  • PoolHandle
    [out] Pointer to a caller-supplied variable in which this function returns a handle to the buffer pool. This handle is a required parameter to the NDIS buffer functions that the driver calls subsequently.
  • NumberOfDescriptors
    [in] Specifies the number of buffer descriptors that the caller expects to allocate from the buffer pool without releasing any allocated buffer descriptors back to the pool.

Return Value

Always returns NDIS_STATUS_SUCCESS.

Remarks

After this function returns, the driver calls the NdisAllocateBuffer function one or more times to allocate the buffer descriptors that it requires. A driver should call this function during initialization.

The NumberOfDescriptors parameter specified by an NIC driver usually depends on the features of the NIC. For example, the driver of a bus master DMA NIC with ring buffers would specify at least a large enough NumberOfDescriptors to map the full ring.

The NumberOfDescriptors specified in the call to this function is the effective limit on how many times the driver can call NdisAllocateBuffer before it must call the NdisFreeBuffer function to return a buffer descriptor to the free list for the buffer pool.

When a driver no longer needs the buffer pool that it allocated, it calls the NdisFreeBufferPool function to release the buffer pool handle.

The driver must release any spin lock that it is holding before calling this function.

All lower-level NDIS drivers must allocate all buffer descriptors that they chain to packets from a buffer pool. Only highest-level protocol drivers can be given OS-dependent descriptors mapping virtual memory ranges. If these memory descriptors are equivalent to NDIS buffer descriptors, a highest-level protocol can pass such descriptors as parameters to NDIS functions.

Requirements

Header ndis.h
Library ndis.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
NdisAdjustBufferLength
NdisAllocateBuffer
NdisChainBufferAtBack
NdisChainBufferAtFront
NdisFreeBuffer
NdisFreeBufferPool
NdisQueryBuffer
NdisReleaseSpinLock