A.3.5 Indicating and Transferring Received Data

When the network interface card receives a data packet over the network, the associated NIC driver issues a call to NdisIndicateReceive as Figure A.3.5 shows. In this call, the driver includes the NDIS binding context for delivery of indications to the transport driver. NdisIndicateReceive passes this context to ProtocolReceive in the transport driver. The transport driver can use any context value that it requires for associating incoming indications with specific network interface cards that it has opened.

The transport driver initiates the transfer of the data packet by calling MacTransferData through NdisTransferData. The NIC driver responds by using MacTransferData to copy the received data frames into the packet structure that the transport driver provides in its call.

MacTransferData is another potentially asynchronous function. If the function completes synchronously, it simply writes the packet to the transport driver and returns a status other than NDIS_STATUS_PENDING. If the function is unable to complete the transfer data operation before it returns, it writes NDIS_STATUS_PENDING. The NIC driver later calls NdisCompleteTransferData to forward the call to ProtocolTransferDataComplete for postprocessing and reception of the copied data frame.

Once all incoming data frames have been received by the network interface card, the NIC driver calls NdisIndicateReceiveComplete. The NDIS interface library then calls ProtocolReceiveComplete to indicate to the transport driver that post-receive processing can be performed.

Figure A.3.5 Indicating and transferring received data