NdisAllocatePacket

VOID
    NdisAllocatePacket(

        OUT PNDIS_STATUS  Status,
        OUT PNDIS_PACKET  *Packet,
        IN NDIS_HANDLE  PoolHandle
        );

NdisAllocatePacket allocates and initializes a packet descriptor.

Parameters

Status
Points to a caller-supplied variable in which this function returns the final status of the request, which can be one of the following:
NDIS_STATUS_SUCCESS
The caller can use the packet descriptor returned at Packet.
NDIS_STATUS_RESOURCES
The free list for the packet pool currently has no available entries. A subsequent call to NdisFreePacket will return the given entry to the free list.
Packet
Points to a caller-supplied variable in which this function returns a pointer to the allocated packet descriptor.
PoolHandle
Specifies the handle returned by a preceding call to NdisAllocatePacketPool.

Comments

NDIS drivers must allocate packet descriptors from packet pool. Protocol drivers call NdisAllocatePacket one or more times for their subsequent calls to NdisSend or NdisSendPackets. Miniports call NdisAllocatePacket one or more times for subsequent calls to NdisMIndicateReceivePacket. NDIS intermediate drivers must call NdisAllocatePacket to repackage sends and receive indications in fresh packet descriptors before passing incoming transfer requests on to other NDIS drivers.

Each packet descriptor will eventually have one or more buffer descriptors chained to it. NdisAllocatePacket zero-initializes the packet descriptor and sets its buffer chain pointer to NULL. The caller must chain the buffer descriptor(s) mapping the packet data to the packet descriptor before it is sent or indicated. Most NDIS drivers allocate buffer descriptors with NdisAllocateBuffer.

Drivers must use the NDIS_GET/SET_PACKET_XXX macros or NDIS_OOB_DATA_FROM_PACKET to access or set up any out-of-band information associated with the packet descriptor.

Callers of NdisAllocatePacket run at IRQL <= DISPATCH_LEVEL.

See Also

NdisAllocateBuffer, NdisAllocatePacketPool, NdisDprAllocatePacket, NdisDprFreePacket, NdisFreePacket, NDIS_GET_PACKET_HEADER_SIZE, NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO, NDIS_GET_PACKET_STATUS, NDIS_GET_PACKET_TIME_RECEIVED, NDIS_GET_PACKET_TIME_SENT, NDIS_GET_PACKET_TIME_TO_SEND, NdisMArcIndicateReceive, NdisMEthIndicateReceive, NdisMFddiIndicateReceive, NdisMIndicateReceivePacket, NdisMTrIndicateReceive, NDIS_OOB_DATA_FROM_PACKET, NDIS_PACKET, NDIS_PACKET_OOB_DATA, NdisSend, NdisSendPackets, NDIS_SET_PACKET_HEADER_SIZE, NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO, NDIS_SET_PACKET_STATUS, NDIS_SET_PACKET_TIME_RECEIVED, NDIS_SET_PACKET_TIME_SENT, NDIS_SET_PACKET_TIME_TO_SEND