4.4.3  Packet Ownership

A miniport can complete a send synchronously by returning NDIS_STATUS_SUCCESS, by returning NDIS_STATUS_FAILURE, or by returning a driver-determined status. In all these cases, the miniport relinquishes ownership of the packet(s) after it returns from its MiniportSendPackets or MiniportSend function.

If a miniport does not have the available internal resources to accept and process a send packet, it can return NDIS_STATUS_RESOURCES. In this case, the miniport also temporarily relinquishes ownership of the packet(s) for which it returns this status. NDIS will resubmit the send request for this and, if an array of packets was submitted, for all subsequent packets in the same array, when the miniport calls either of the following:

·NdisMSendComplete to notify NDIS that it has completed a previously submitted send.

·NdisMSendResourcesAvailable to notify NDIS that the miniport now has available resources to accept a send request.

If the miniport has the resources to send a packet but cannot complete the send immediately, it returns NDIS_STATUS_PENDING. In this case, the miniport:

·Retains ownership of the packet.

·Must call NdisMSendComplete when it completes the transmit operation, passing the status of the operation as the Status parameter to the call. When the miniport calls NdisMSendComplete, passing a pointer to the completed packet, it gives up ownership and must not make any further references to the packet. Ownership reverts to the protocol driver that originally allocated the packet.

If a miniport implements a MiniportSendPackets function, and returns NDIS_STATUS_PENDING for any of the packets, it must call NdisMSendComplete once for each such packet.