共用方式為


MiniportWanSend (Compact 2013)

3/26/2014

This function is required if the driver controls a WAN network adapter. Such a driver does not have a MiniportSend function.

Syntax

NDIS_STATUS MiniportWanSend(
  NDIS_HANDLE MiniportAdapterContext,
  NDIS_HANDLE NdisLinkHandle,
  PNDIS_WAN_PACKET WanPacket
);

Parameters

  • MiniportAdapterContext
    [in] Specifies the handle, originally input to MiniportInitialize, identifying the miniport and WAN network adapter it controls.
  • NdisLinkHandle
    [in] Specifies the handle to a miniport-allocated context area for this link. The driver previously returned this handle in an NDIS_MAC_LINE_UP indication when the link was established.
  • WanPacket
    [in] Points to an NDIS_WAN_PACKET structure, specifying the data to be transmitted. This structure specifies the virtual range for a buffer with guaranteed padding at the beginning and end. The driver can manipulate the data in this buffer in any way.

Return Value

The following table shows the values that MiniportWanSend can return.

Value

Description

NDIS_STATUS_SUCCESS

The driver (or its network adapter) has accepted the packet data for transmission. Therefore, MiniportWanSend is returning the packet.

NDIS_STATUS_PENDING

The driver will complete the packet asynchronously with a call to NdisMWanSendComplete.

NDIS_STATUS_FAILURE or NDIS_STATUS_XXX

The given packet was invalid or unacceptable to the network adapter.

Remarks

When MiniportWanSend is called, ownership of both the packet descriptor and the packet data is transferred to the driver until it completes the given packet, either synchronously or asynchronously. If MiniportWanSend returns a status other than NDIS_STATUS_PENDING, the request is considered complete and ownership of the packet immediately reverts to the initiator of the send request. If MiniportWanSend returns NDIS_STATUS_PENDING, the miniport subsequently must call NdisMWanSendComplete with the packet to indicate completion of the transmit request.

MiniportWanSend can use both the MacReservedXXX and WanPacketQueue members within the NDIS_WAN_PACKET structure. However, the miniport cannot access the ProtocolReservedXXX members.

Any NDIS intermediate driver that binds itself to an underlying WAN miniport is responsible for providing a fresh NDIS_WAN_PACKET structure to the underlying driver's MiniportWanSend function. Before such an intermediate driver calls NdisSend, it must repackage the send packet given to its MiniportWanSend function so that the underlying driver will have MacReservedx and WanPacketQueue areas of its own to use.

The available header padding in a given packet can be calculated as (CurrentBuffer - StartBuffer), the available tail padding as (EndBuffer - (CurrentBuffer + CurrentLength)). The header and tail padding is guaranteed to be at least the length that the miniport requested in response to a previous OID_WAN_GET_INFO query. The header and tail padding for any packet given to MiniportWanSend can be more than the length that was requested.

MiniportWanSend can neither return NDIS_STATUS_RESOURCES for an input packet nor call NdisMSendResourcesAvailable. Instead, the miniport must queue incoming send packets internally for subsequent transmission. The miniport controls how many packets NDIS will submit to MiniportWanSend when the network adapter driver sets the SendWindow value in the driver's NDIS_MAC_LINE_UP indication to establish the given link. NDISWAN uses this value as an upper bound on uncompleted sends submitted to MiniportWanSend so that the miniport's internal queue cannot be overrun, and the miniport can adjust the SendWindow dynamically with subsequent line-up indications for established links. If the miniport set the SendWindow to zero when it called NdisMIndicateStatus with a particular line-up indication, NDISWAN uses the MaxTransmit value that the driver originally set in response to the OID_WAN_GET_INFO query as its limit on submitted but uncompleted send packets.

Each packet passed to MiniportWanSend is set up according to one of the flags that the miniport set in the FramingBits member in response to the OID_WAN_GET_INFO query. It will contain simple HDLC PPP framing if the driver claimed to support PPP. For SLIP or RAS framing, such a packet contains only the data portion without any framing whatsoever.

A WAN driver cannot manage software loopback or promiscuous mode loopback internally. NDISWAN supplies this loopback support for WAN drivers.

MiniportWanSend can be pre-empted by an interrupt.

Requirements

Header

externs.h

See Also

Reference

NDIS 5.x Legacy Functions
MiniportInitialize
MiniportQueryInformation
MiniportSend
NDIS_MAC_LINE_UP
NdisMIndicateStatus
NdisMSendResourcesAvailable
NdisMWanSendComplete
NDIS_WAN_PACKET
NdisSend
NDIS 5.x Legacy Reference