NdisReinitializePacket

This function removes any chained buffers from a given packet and reinitializes it for reuse.

At a Glance

Header file: Ndis.h
Windows CE versions: 2.0 and later

Syntax

VOID NdisReinitializePacket( IN OUT PNDIS_PACKET Packet );

Parameters

Packet
Pointer to the packet descriptor allocated by the caller.

Remarks

This function reinitializes a packet descriptor so that the MiniportReserved and ProtocolReserved arrays contain all 0s and the head of the buffer chain is set to NULL.

A driver can call this function only with packet descriptors allocated by that driver. For example, a MiniportReturnPacket function is likely to call this function to prepare a driver-allocated packet for use in a subsequent receive indication.

Before calling this function, a driver must call the NdisFreeBuffer or the NdisUnchainBufferAtXXX functions as many times as necessary to release or to save all buffer descriptors chained to the packet. Otherwise, a call to this function causes a memory leak: all memory associated with the buffer descriptor chain cannot be used by NDIS nor by the driver until the system is rebooted.

A driver can call the NdisQueryPacket function to determine how many buffer descriptors are chained to a given packet and, therefore, how many calls to NdisFreeBuffer or NdisUnchainBufferAtXXX are required. It can call the NdisGetNextBuffer function to retrieve each buffer descriptor pointer to pass to NdisFreeBuffer.

A call to this function has no effect on the NDIS_PACKET_OOB_DATA structure associated with the packet descriptor. To prepare this block for reuse, the allocating driver can reset the relevant members with the appropriate NDIS_SET_PACKET_XXX macro( s ).

A driver that calls this function can run at any IRQL.

See Also

NdisAllocatePacket, NdisFreeBuffer, NdisGetNextBuffer, NdisQueryPacket, NDIS_SET_PACKET_HEADER_SIZE, NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO, NDIS_SET_PACKET_STATUS, NDIS_SET_PACKET_TIME_RECEIVED, NDIS_SET_PACKET_TIME_TO_SEND, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront, NdisZeroMemory