Share via


Sending Packets from an NDIS WAN Miniport Driver (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

An upper-layer driver calls NdisSendPacketsto send packets to an underlying NDIS WAN miniport driver. The NDISWAN intermediate driver forwards those packets. Before NDISWAN forwards packets, it repackages them. NDISWAN also reformats the structure of the packets from NDIS_PACKETstructures into NDIS_WAN_PACKETstructures before forwarding.

The NDISWAN intermediate driver forwards the repackaged packets to NDIS, which calls the NDIS WAN miniport driver's MiniportWanSendfunction. MiniportWanSendtransmits packets through the NIC onto the wide area network.

The NDIS WAN miniport driver owns both the packet descriptor and the packet data until the send completes, regardless of whether the send completes synchronously or asynchronously. If the miniport driver does not immediately complete the send request, it returns NDIS_STATUS_PENDING from MiniportWanSendand must later call NdisMWanSendCompleteto complete the send request.

A completion call does not necessarily indicate that a packet has been transmitted; however, with the exception of intelligent NICs, the packet usually has been transmitted. A completion call does, however, indicate that the miniport driver is ready to release ownership of the packet.

If the NDIS WAN miniport driver returns a status other than NDIS_STATUS_PENDING, the send operation is considered to be complete, and ownership of the packet immediately reverts to the caller. In this case, the miniport driver does not call a completion function for that packet.

After the NDIS WAN miniport driver receives a send packet in its MiniportWanSendfunction, it should send the packet out on the active connection, which is an established link.

Unlike non-WAN connectionless miniport drivers, the NDIS WAN miniport driver cannot return a status of NDIS_STATUS_RESOURCES to indicate that it does not have enough resources currently available to process the transmission of packets. Instead, the WAN miniport driver should queue the send internally for a later time and perhaps lower the SendWindowvalue on the connection. This SendWindowvalue is the number of outstanding packets that the WAN miniport driver can handle per connection. The miniport driver specifies this SendWindowvalue to an upper-layer driver.

The NDIS WAN miniport driver specifies the default number of outstanding packets that it can have per data channel in the MaxTransmit member of the NDIS_WAN_INFO structure. The miniport driver provides this structure when the miniport driver responds to the OID_WAN_GET_INFOrequest from the protocol driver.

The miniport driver can specify the send window dynamically and on a per-line basis by calling NdisMIndicateStatuswith a line-up indication. In the call to NdisMIndicateStatus, the miniport driver provides a new nonzero value for the SendWindowmember of the NDIS_MAC_LINE_UPstructure. If the miniport driver sets the value of the SendWindowmember to zero, NDISWAN uses the default value in MaxTransmitfor that line.

The NDIS WAN miniport driver might have to modify or add to the header as well as add to the end (tail) of the packet (for example, to add the FCS). Appropriate padding at the beginning and end of the packet was provided previously by the miniport driver. The WAN miniport driver can alter the data in the packet in any way it sees fit in order to send that packet on the WAN medium.

Note   NDIS WAN miniport drivers never call the NdisMSendResourcesAvailable function.

 

Packets that are passed to the WAN miniport driver's send function contain simple HDLC PPP framing if PPP framing is set. For SLIP or RAS framing, packets contain only the data portion with no framing whatsoever. For more information about WAN packet framing, see WAN Packet Framing.

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

The following applies to the WAN packet for an NDIS WAN miniport driver:

  • The MacReservedx members as well as the WanPacketQueue member of the NDIS_WAN_PACKET structure are fully available for use by the NDIS WAN miniport driver.

  • 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 size requested, but it can be larger.

 

 

Send comments about this topic to Microsoft