Implementing a ProtocolCoReceivePacket Handler (NDIS 5.1)
Note NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.
When an underlying connection-oriented miniport driver indicates an array of one or more packet descriptors with NdisMCoIndicateReceivePacket, NDIS calls a bound protocol driver's ProtocolCoReceivePacketfunction with each packet descriptor. ProtocolCoReceivePacketmust call the NDIS_GET_PACKET_STATUSmacro once for each packet descriptor to obtain the OOB block Statusfor the associated packet.
If a miniport driver sets the OOB block Statusassociated with a packet descriptor to NDIS_STATUS_SUCCESS before calling NdisMCoIndicateReceivePacket, the miniport driver temporarily relinquished ownership of the resources associated with the packet descriptor. In this case, the miniport driver depends on the consumers of those packets to return them in a timely manner. Otherwise, the miniport driver can run short of receive resources, such as receive buffer space in the NIC.
If a miniport driver does run short of resources, it sets a packet's OOB block Statusto NDIS_STATUS_RESOURCES. Indicating a packet with this status forces the ProtocolCoReceivePacketfunction of the protocol driver to copy the packet data immediately rather than retain the resources that the miniport driver allocated. ProtocolCoReceivePacketmust return zero in such a situation.
If the underlying miniport driver does not set NDIS_STATUS_RESOURCES in the OOB block associated with a packet descriptor in the packet array that it passes to NdisMCoIndicateReceivePacket, it allows the protocol driver (or its clients) to retain the packet descriptor and all the resources it specifies until the protocol or its clients have consumed the data and returned the packet descriptor.