Previous Next

ProtocolCoSendComplete

The ProtocolCoSendComplete function is a required driver function in connection-oriented protocol drivers. ProtocolCoSendComplete completes the processing of a protocol-initiated send previously passed to NdisCoSendPackets.

VOID
  ProtocolCoSendComplete(
    IN NDIS_STATUS  Status,
    IN NDIS_HANDLE  ProtocolVcContext,
    IN PNDIS_PACKET  Packet
    );

Parameters

Status
Specifies the final status of the send operation, either NDIS_STATUS_SUCCESS or an error status propagated from the underlying driver.
ProtocolVcContext
Specifies the handle to a protocol-allocated context area in which the protocol driver maintains per-VC run-time state. The driver originally supplied this handle either when it called NdisCoCreateVc or from its ProtocolCoCreateVc function. This context area contains the NdisVcHandle that the driver previously passed to NdisCoSendPackets.
Packet
Pointer to the protocol-supplied packet descriptor for the completed send.

Headers

Declared in Ndis.h. Include Ndis.h.

Comments

ProtocolCoSendComplete performs whatever postprocessing is necessary for a completed transmit operation, such as notifying the client that originally requested the protocol to send data over the network on the VC.

Completion of a send operation usually implies that the underlying NIC driver actually has transmitted the given packet over the network. However, the driver of a so-called intelligent NIC can consider a send complete as soon as it downloads the net packet to its NIC. The underlying driver’s call to NdisMCoSendComplete causes NDIS to call the ProtocolCoSendComplete function.

When ProtocolCoSendComplete is called, the driver regains ownership of the following protocol-allocated resources:

Consequently, ProtocolCoSendComplete can either release these resources or prepare them for reuse in a subsequent call to NdisCoSendPackets. As a general rule, reusing such resources yields better performance than releasing them except, possibly, in periods of low network traffic if the protocol previously allocated a surplus of these resources to handle a period of heavy I/O demand.

To prepare the buffer and packet descriptors for reuse, ProtocolCoSendComplete should follow these guidelines:

Until ProtocolCoSendComplete is called, the current status of a protocol-initiated send is volatile. A protocol temporarily releases ownership of all resources it allocated for a send when it calls NdisCoSendPackets, even if the protocol supplies out-of-band information with the packet descriptors it allocates for sends. In particular, a protocol should never attempt to examine the Status member of the associated out-of-band data block when NdisCoSendPackets returns control.

Although NDIS always submits protocol-supplied packet arrays to the underlying miniport driver in the protocol-determined order passed in calls to NdisCoSendPackets, the underlying driver can complete the given packets in random order. That is, every bound protocol can rely on NDIS to submit the packets the protocol passes to NdisCoSendPackets in FIFO order to the underlying driver, but no protocol can rely on that underlying driver to call NdisMCoSendComplete with those packets in the same order.

ProtocolCoSendComplete must be written so that it can run at IRQL = DISPATCH_LEVEL.

See Also

MiniportCoSendPackets, NdisAllocateBuffer, NdisAllocatePacket, NdisCoSendPackets, NdisFreeBuffer, NdisFreePacket, NdisMCoSendComplete, NDIS_OOB_DATA_FROM_PACKET, NDIS_PACKET_OOB_DATA, NdisReinitializePacket, NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO, NDIS_SET_PACKET_TIME_TO_SEND, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront, NdisZeroMemory