5.3.3 Sending On a WAN Miniport

MiniportWanSend transmits a packet through the adapter onto the network.

Ownership of both the packet descriptor and the packet data is transferred to the WAN NIC driver until this request is completed, either synchronously or asynchronously. If the WAN miniport returns NDIS_STATUS_PENDING, it must later indicate completion of the request by calling NdisMWanSendComplete. If the WAN miniport returns a status other than NDIS_STATUS_PENDING, the request is considered to be complete, and ownership of the packet immediately reverts to the caller.

Unlike LAN miniports, the WAN driver cannot return a status of NDIS_STATUS_RESOURCES to indicate that it does not have enough resources currently available to process the transmit. Instead, the WAN miniport should queue the send internally for a later time and perhaps lower the SendWindow value on the line by making a line-up indication. The NDISWAN driver will insure that the WAN miniport driver never has more than SendWindow packets outstanding. If a WAN miniport makes a line-up indication for a particular line, and sets the SendWindow to zero, NDISWAN reverts to using the default value of the transmit window passed as the MaxTransmit value provided to an earlier OID_WAN_GET_INFO request.

It is also an error for the WAN miniport NIC driver to call NdisMSendResourcesAvailable.

The packet passed to MiniportWanSend will contain simple HDLC PPP framing if PPP framing is set. For SLIP or RAS framing, the packet contains only the data portion with no framing whatsoever. Simple HDLC PPP framing is discussed later in more detail.

A WAN NIC driver must not attempt to provide software loopback or promiscuous mode loopback. Both of these are fully supported in the NDISWAN driver.

The MacReservedx members as well as the WanPacketQueue member of the NDIS_WAN_PACKET is fully available for use by the WAN miniport.

The available header padding is simply CurrentBuffer-StartBuffer. The available tail padding is EndBuffer-(CurrentBuffer+CurrentLength). The header and tail padding is guaranteed to be at least the amount requested, but it can be more.

See NDIS_WAN_PACKET in the Network Driver Reference for details of the WAN packet descriptor structure.

A WAN miniport calls NdisMWanSendComplete to indicate that it has completed a previous transmit operation for which it returned NDIS_STATUS_PENDING. This does not necessarily imply that the packet has been transmitted, although, with the exception of intelligent adapters, it generally has. It does however, mean the miniport is ready to release ownership of the packet.

When a WAN miniport calls NdisMWanSendComplete, it passes back the original packet to indicate which send operation was completed. If MiniportWanSend returns a status other than NDIS_STATUS_PENDING, it does not call NdisMWanSendComplete for that packet.