MiniportSend (Windows Embedded CE 6.0)

1/6/2010

This function transfers a protocol-supplied packet over the network.

Syntax

NDIS_STATUS MiniportSend(
  NDIS_HANDLE MiniportAdapterContext,
  PNDIS_PACKET Packet,
  UINT Flags
);

Parameters

  • MiniportAdapterContext
    [in] Specifies the handle to a miniport-allocated context area in which the driver maintains per-network adapter state, set up by MiniportInitialize.
  • Packet
    [in] Points to a packet descriptor specifying the data to be transmitted.
  • Flags
    [in] Specifies the packet flags, if any, set by the protocol.

Return Value

The following table shows the values that MiniportSend can return.

Value Description

NDIS_STATUS_SUCCESS

The driver (or its network adapter) has accepted the packet data for transmission, so MiniportSend is returning the packet, which NDIS will return to the protocol.

NDIS_STATUS_PENDING

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

NDIS_STATUS_RESOURCES

The driver (or network adapter) currently has insufficient resources available to process the given packet so NDIS should queue the send packet for a resubmission when the driver next calls NdisMSendResourcesAvailable or NdisMSendComplete.

NDIS_STATUS_FAILURE

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

Remarks

MiniportSend can safely access the packet and all buffer descriptors chained to the packet until the given packet is complete. If MiniportSend returns a status other than NDIS_STATUS_PENDING or NDIS_STATUS_RESOURCES, the request is considered complete and ownership of the packet descriptor and all memory associated with the packet reverts to the allocating protocol.

If MiniportSend returns NDIS_STATUS_PENDING, the driver subsequently must signal completion of the request by calling NdisMSendComplete. When MiniportSend returns NDIS_STATUS_RESOURCES, the NDIS library reflects this status to the protocol as NDIS_STATUS_PENDING.

When this function returns a packet with NDIS_STATUS_RESOURCES, the next packet submitted to MiniportSend is the same packet it just returned to NDIS. Consequently, MiniportSend can optimize by retaining information about such a returned packet if the driver currently has sufficient resources to store the information. NDIS assumes MiniportSend is ready to accept that packet as soon as the driver calls NdisMSendResourcesAvailable or NdisMSendComplete, whichever occurs first.

Each protocol driver must pass packet descriptors to NdisSend that are fully set up to be passed by the underlying driver's MiniportSend function to its network adapter. That is, the protocol is responsible for determining what is required, based on the medium type selected by the miniport to which the protocol bound itself. However, a protocol can supply net packets mapped by the chained buffer descriptors that are shorter than the minimum for the selected medium, which MiniportSend must pad if its medium imposes a minimum-length requirement on transmits.

Any NDIS intermediate driver that layers itself between a higher-level protocol and an underlying network adapter driver has the same responsibility as any protocol driver to set up packets according to the requirements of the underlying miniport and its selected medium. Such an intermediate driver must repackage each incoming send packet in a fresh packet descriptor that was allocated by the intermediate driver.

MiniportSend can use only the eight-byte area at MiniportReserved within the NDIS_PACKET structure for its own purposes. Consequently, an NDIS intermediate driver that forwards send requests to an underlying network adapter driver must repackage the packets input to its MiniportSend function in fresh packet descriptors, which the intermediate driver allocates from packet pool, so that the underlying miniport has a MiniportReserved area it can use.

MiniportSend can call NdisQueryPacket to extract information, such as the number of buffer descriptors chained to the packet and the total size in bytes of the requested transfer. It can call NdisGetFirstBufferFromPacket, NdisQueryBuffer, or NdisQueryBufferOffset to extract information about individual buffers containing the data to be transmitted.

The Flags parameter can provide information about a send that is not contained in the packet data itself. Currently, there are no system-defined flags, but a pair of closely coupled protocol and miniport drivers can pass information in this parameter, which MiniportSend can retrieve with NdisGetPacketFlags. However, such a pair of drivers can communicate more information, such as time stamps and packet priority, in the NDIS_PACKET_OOB_DATA block associated with each packet descriptor.

If the underlying driver's MiniportQueryInformation function set the NDIS_MAC_OPTION_NO_LOOPBACK flag when the NDIS library queried the OID_GEN_MAC_OPTIONS, the miniport must not attempt to loop back any packets. The NDIS library provides software loopback support for such a driver.

MiniportSend can be pre-empted by an interrupt.

Requirements

Header externs.h
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Upper-Edge Functions
NDIS_PACKET
MiniportInitialize
MiniportQueryInformation
NdisGetFirstBufferFromPacket
NdisGetPacketFlags
NdisMSendComplete
NdisMSendResourcesAvailable
NdisQueryBuffer
NdisQueryBufferOffset
NdisQueryPacket
NdisSend