NdisMSendComplete

VOID
    NdisMSendComplete(
        IN
 NDIS_HANDLE MiniportAdapterHandle,
        IN PNDIS_PACKET Packet,
        IN NDIS_STATUS Status
        );

NdisMSendComplete returns the packet and final status of a completed send request for which the driver previously returned NDIS_STATUS_PENDING.

Parameters

MiniportAdapterHandle
Specifies the handle originally input to MiniportInitialize.
Packet
Points to the protocol-allocated packet originally input to MiniportSend.
Status
Specifies the final status of the transmit request that has just been completed.

Comments

The NDIS library queues incoming send packets on behalf of miniports so each NIC driver can deal with one device-transmit operation at a time, although a miniport can transmit several packets per operation, depending on the capabilities of its NIC. NDIS serializes the submission of incoming packet arrays to each miniport’s MiniportSendPackets function, and it serializes the submission of packets to each miniport’s MiniportSend function. NDIS queues incoming send requests in FIFO order when it cannot pass on each such request immediately because the underlying NIC driver is already busy.

If MiniportSendPackets sets the Status in the out-of-band data block for a packet to NDIS_STATUS_PENDING or if MiniportSend returns NDIS_STATUS_PENDING for an incoming packet, the miniport must eventually call NdisMSendComplete with the original packet to indicate which send request it has completed. While the status of such a send packet is pending, the miniport retains ownership of that packet.

A call to NdisMSendComplete causes NDIS to call the ProtocolSendComplete function of the driver that initiated the request with its call to NdisSendPackets or NdisSend. The miniport’s call to NdisMSendComplete releases ownership of the given packet to the protocol driver that originally allocated it.

If MiniportSend(Packets) returns a status other than NDIS_STATUS_PENDING for a given packet, the miniport never calls NdisMSendComplete with that packet. The return from MiniportSend(Packets) releases ownership of such a packet.

Consequently, a miniport must not call NdisMSendComplete with any packet for which its MiniportSend(Packets) function did not return NDIS_STATUS_PENDING. Any send packet for which a NIC driver returns something other than NDIS_STATUS_PENDING should be considered inaccessible by that miniport as soon as its MiniportSend(Packets) function returns control.

A miniport’s call to NdisMSendComplete does not necessarily mean that a particular packet has been transmitted over the wire. Usually, such a packet has been transmitted except, possibly, by the driver of a NIC in which packets can be queued in the hardware.

Miniport drivers that declared their devices of type NdisMediumWan in response to a preceding OID_GEN_MEDIA_SUPPORTED or OID_GEN_MEDIA_IN_USE request call NdisMWanSendComplete rather than NdisMSendComplete.

Callers of NdisMSendComplete run at IRQL DISPATCH_LEVEL.

See Also

MiniportInitialize, MiniportSend, MiniportSendPackets, NdisMSendResourcesAvailable, NdisMWanSendComplete, NDIS_PACKET, NDIS_PACKET_OOB_DATA, NdisSend, NdisSendPackets, NDIS_SET_PACKET_STATUS, ProtocolSendComplete