A.3.4  Sending Data

In preparation for sending data to the network interface card, a transport driver must create a packet that consists of data and a header. At this time, the driver can make an optional call to NdisSetSendFlags to set the Flags field in the packet header to pass additional send information to the NIC driver as Figure A.3.4 shows. After this, the transport driver is ready to call NdisSend, which forwards the call to MacSend in the NIC driver.

In its send request to MacSend, the transport driver instructs the NIC driver to transmit the passed packet through the network interface card onto the network. MacSend translates the packet into data frames and carries out the send operation. If necessary, the NIC driver can call NdisQuerySendFlags to retrieve additional send information.

MacSend completes synchronously if it finishes the send operation before it returns. The function returns a status code other than NDIS_STATUS_PENDING for synchronous operation.

Like MacOpenAdapter, MacSend can also be asynchronous if it cannot complete the send operation before it returns. In this case, it returns NDIS_STATUS_PENDING to the transport driver to indicate that the packet has been queued for transmission. The NIC driver eventually calls ProtocolSendComplete through NdisCompleteSend to allow postprocessing. When ProtocolSendComplete returns, the transport driver regains ownership of the packet.

Figure A.3.4   Sending Data