共用方式為


MiniportReturnPacket (Compact 2013)

3/26/2014

This function is a required function in drivers that indicate receives with NdisMIndicateReceivePacket.

Syntax

VOID MiniportReturnPacket(
  NDIS_HANDLE MiniportAdapterContext,
  PNDIS_PACKET Packet
);

Parameters

  • MiniportAdapterContext
    [in] Specifies the handle to a miniport-allocated context area in which the driver maintains per-network adapter state, set up by MiniportInitialize.
  • Packet
    [in] Points to a packet descriptor being returned to the miniport, which previously indicated a packet array that contained this pointer.

Return Value

None.

Remarks

Drivers of bus master DMA network adapters that support multipacket receives and network adapter drivers that supply media-specific information, such as packet priorities, with their indications must have MiniportReturnPacket functions. NDIS intermediate drivers that bind themselves to such a network adapter driver must also have MiniportReturnPacket functions.

Any packet with associated NDIS_PACKET_OOB_DATA in which the Status is set to NDIS_STATUS_PENDING on return from NdisMIndicateReceivePacket will be returned to MiniportReturnPacket. When all bound protocols have called NdisReturnPackets as many times as necessary to release their references to the originally indicated packet array, NDIS returns pended packets from the array to the MiniportReturnPacket function of the driver that originally allocated the packet array.

Usually, MiniportReturnPacket prepares such a returned packet to be used in a subsequent receive indication. Although MiniportReturnPacket could return the buffer descriptors chained to the packet to buffer pool and the packet descriptor itself to packet pool, it is far more efficient to reuse returned descriptors.

MiniportReturnPacket must call NdisUnchainBufferAtXXX as many times as necessary to save the pointers to all chained buffer descriptors before it calls NdisReinitializePacket. Otherwise, MiniportReturnPacket cannot recover the buffer descriptors the driver originally chained to the packet for the indication.

MiniportReturnPacket can also call NdisZeroMemory with the pointer returned by NDIS_OOB_DATA_FROM_PACKET to prepare the packet's associated out-of-band block for reuse.

If a particular buffer descriptor was shortened to match the size of an indicated range of data, MiniportReturnPacket should call NdisAdjustBufferLength with that buffer descriptor to restore its mapping of the network adapter's receive buffer range.

Requirements

Header

externs.h

See Also

Reference

NDIS 5.x Legacy Functions
MiniportInitialize
NdisAdjustBufferLength
NdisMIndicateReceivePacket
NdisReinitializePacket
NdisReturnPackets
NdisZeroMemory
NDIS 5.x Legacy Reference