NDIS_GET_PACKET_STATUS (Compact 2013)

3/26/2014

This macro returns the Status value from the out-of-band (OOB) data block associated with a given packet descriptor.

Syntax

NDIS_STATUS NDIS_GET_PACKET_STATUS(
  PNDIS_PACKET _Packet
);

Parameters

  • _Packet
    Points to a packet descriptor

Return Value

The return value is the Status value of the OOB data block associated with _Packet. The following table shows the possible status values returned by NDIS_GET_PACKET_STATUS.

Value

Description

NDIS_STATUS_SUCCESS

If this is set on return from a miniport's call to NdisMIndicateReceivePacket, the miniport regains ownership of the following:

  • The packet descriptor
  • The associated out-of-band data block and of any media-specific information buffer specified in this block
  • All buffers mapped by buffer descriptors chained to the packet the miniport just indicated

The miniport driver can prepare these descriptors, the out-of-band block, and media-specific information buffer, if any, for reuse in subsequent receive indications, and, if it is a network adapter driver, can receive new data in the network adapter's receive buffers mapped by the returned buffer descriptors.

NDIS_STATUS_PENDING

If this is set on return from NdisMIndicateReceivePacket, protocols keep ownership of the following:

  • The packet descriptor
  • The associated out-of-band data block and of any media-specific information buffer specified in this block
  • All buffers mapped by buffer descriptors chained to the packet the miniport previously indicated

Until the packet descriptor is returned to the MiniportReturnPacket function of the indicating driver, it should not access any of the buffers specified with the packet descriptor.

NDIS_STATUS_RESOURCES

If this is set, a protocol driver's ProtocolReceivePacket function must copy the packet data immediately instead of keeping the network adapter-driver-allocated packet resources.

Remarks

Use this macro in serialized drivers, miniports, or intermediate drivers that will indicate a receive up to higher-level drivers. When packet Status is set to NDIS_STATUS_RESOURCES, connection-oriented protocols call this macro from ProtocolReceivePacket.

Deserialized drivers do not have to use this macro. When such drivers indicate up a packet whose Status is not set to NDIS_STATUS_RESOURCES, NDIS always returns the packet to the driver's MiniportReturnPacket function. When such drivers indicate up a packet whose Status is set to NDIS_STATUS_RESOURCES, NDIS always returns the packet implicitly on return from NdisMIndicateReceivePacket. In short, when NDIS returns a packet to a driver, either on the return from NdisMIndicateReceivePacket or to the driver's MiniportReturnPacket function, the returned packet and all its associated resources belong to the driver. The driver should save the status of each received packet that it indicates up so that it knows, on the return of NdisMIndicateReceivePacket, whether the packet's Status is NDIS_STATUS_RESOURCES.

Protocol drivers should never test the Status value in an associated out-of-band data block on return from NdisSendPackets or NdisSend. NDIS or the underlying driver keeps ownership of the packet descriptor, of the associated out-of-band block and any buffers specified in this block, and of all buffers mapped by buffer descriptors chained to the packet descriptor until the ProtocolSendComplete function is called with the packet descriptor.

The NDIS_GET_PACKET_STATUS macro is defined as follows.

#define NDIS_GET_PACKET_STATUS(_Packet)                                 \
                        ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) +    \
                        (_Packet)->Private.NdisPacketOobOffset))->Status

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Network Driver Macros
MiniportReturnPacket
NdisAllocatePacket
NdisMIndicateReceivePacket
NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO
NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO
NDIS_SET_PACKET_STATUS
NDIS_PACKET_OOB_DATA
NDIS_OOB_DATA_FROM_PACKET
NdisSend
NdisSendPackets
ProtocolReceivePacket
ProtocolSendComplete
NDIS 5.x Legacy Reference