Microsoft Windows CE 3.0  

NdisAllocatePacketPool

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function allocates and initializes a block of storage for a pool of packet descriptors.

VOID NdisAllocatePacketPool(
OUT PNDIS_STATUS
Status
,
OUT PNDIS_HANDLE
PoolHandle
,
IN UINT
NumberOfDescriptors
,
IN UINT
ProtocolReservedLength
);

Parameters

Status
Pointer to a caller-supplied variable in which this function returns the status of the packet pool allocation; one of the following:
Value Description
NDIS_STATUS_SUCCESS The driver can make calls to the NdisAllocatePacketfunction when it needs packet descriptors to make indications up to higher-level drivers or to send packets down to lower-level drivers.
NDIS_STATUS_RESOURCES The attempt to allocate a packet pool failed, possibly due to a shortage of memory. However, the caller might attempt to decrease the NumberOfDescriptorsparameter and call again immediately.
PoolHandle
Handle to the packet pool. This handle is a required parameter to the NDIS packet functions that the driver calls subsequently.
NumberOfDescriptors
Specifies the number of packet descriptors that the pool should contain.
ProtocolReservedLength
Specifies the number of bytes to be allocated for the ProtocolReservedarray of each packet descriptor. For packet descriptors to be used in receive indications, this parameter can be at most 16 bytes.

Return Values

A handle to the packet pool indicates success.

Remarks

The caller should save the handle returned by this function. Usually, the driver next calls the NdisAllocatePacketfunction one or more times with this handle to allocate a set of packet descriptors. The NumberofDescriptorsspecified in the call to this function is the effective limit on how many times the driver can call NdisAllocatePacketbefore it must call the NdisFreePacketfunction to return a packet descriptor to the free list for the packet pool.

Since packets sent or indicated are returned to the allocating driver, it can reuse each packet descriptor after calling the NdisReinitializePacketfunction and setting it up again with a chain of buffer descriptors, or the driver can call the NdisFreePacketfunction to return that packet to the free list. Reinitializing and reusing packets allocated from the packet pool is far faster than freeing and reallocating them. Before a driver calls NdisReinitializePacketwith a packet descriptor, it must save the pointers to buffer descriptors that are chained to the packet descriptor since NdisReinitializePacketsets the head of the buffer chain to NULL.

When the driver no longer needs the packet pool, it calls the NdisFreePacketPoolfunction to release the packet pool storage.

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

A driver that calls this function runs at IRQL <=DISPATCH_LEVEL.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ndis.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

NdisAllocatePacket, NdisFreePacketPool, NdisMIndicateReceivePacket, NdisReinitializePacket, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.