Sending NET_BUFFER Structures from CoNDIS Drivers

The following figure illustrates a basic CoNDIS send operation, which involves a protocol driver, NDIS, and a miniport driver.

Diagram illustrating a basic CoNDIS send operation involving a protocol driver, NDIS, and a miniport driver.

As the preceding figure shows, protocol drivers call the NdisCoSendNetBufferLists function to send NET_BUFFER_LIST structures on a virtual connection (VC). NDIS then calls the miniport driver's MiniportCoSendNetBufferLists function to forward the NET_BUFFER_LIST structures to an underlying miniport driver.

All NET_BUFFER-based send operations are asynchronous. Therefore, the miniport driver always calls the NdisMCoSendNetBufferListsComplete function and provides an appropriate status code when it is done sending the data. The miniport driver can complete the send operation for each NET_BUFFER_LIST structure independent of other NET_BUFFER_LIST structures. NDIS calls the protocol driver's ProtocolCoSendNetBufferListsComplete function each time the miniport driver calls NdisMCoSendNetBufferListsComplete.

Protocol drivers can reclaim the ownership of the NET_BUFFER_LIST structures and all associated structures and data as soon as NDIS calls the protocol driver's ProtocolCoSendNetBufferListsComplete function.

The miniport driver or NDIS can return the NET_BUFFER_LIST structures in any order. But protocol drivers are guaranteed that the list of NET_BUFFER structures that are attached to each NET_BUFFER_LIST structure has not been modified.

Protocols drivers set the SourceHandle member in the NET_BUFFER_LIST structure to the same value as the NdisVcHandle parameter of NdisCoSendNetBufferLists. NDIS uses the SourceHandle member to return the NET_BUFFER_LIST structures to the protocol driver that sent the NET_BUFFER_LIST structures.

Intermediate drivers also set the SourceHandle member in the NET_BUFFER_LIST structure to the NdisVcHandle value. If an intermediate driver forwards a send request, the driver must save the SourceHandle value that the overlying driver provided before it writes to the SourceHandle member. When NDIS returns a forwarded NET_BUFFER_LIST structure to the intermediate driver, the intermediate driver must restore the SourceHandle that it saved.

Protocol drivers can cancel send requests by using the same mechanisms as connectionless drivers. For more information about canceling send requests, see Canceling a Send Operation.