共用方式為


ProtocolStatus (Compact 2013)

3/26/2014

This function is a required driver function that handles status-change notifications raised by an underlying connectionless network adapter driver or by NDIS.

Syntax

VOID ProtocolStatus(
  NDIS_HANDLE ProtocolBindingContext,
  NDIS_STATUS GeneralStatus,
  PVOID StatusBuffer,
  UINT StatusBufferSize
);

Parameters

  • ProtocolBindingContext
    [in] Specifies the handle to a protocol-allocated context area in which the protocol driver maintains per-binding runtime state. The driver supplied this handle when it called NdisOpenAdapter.
  • GeneralStatus
    [in] Indicates the general status code, either raised by NDIS or propagated from the underlying driver's call to NdisMIndicateStatus.
  • StatusBuffer
    [in] Points to a buffer that contains medium-specific data that depends on the value of GeneralStatus.

    For some NDIS_STATUS_XXX values, this pointer is NULL and StatusBufferSize is set to zero.

  • StatusBufferSize
    [in] Specifies the number of bytes at StatusBuffer.

Return Value

None

Remarks

A call to ProtocolStatus notifies the protocol about changes in status of the underlying network adapter or its driver.

ProtocolStatus interprets a general status code. The General Status code is defined by NDIS as an NDIS_STATUS_XXX value, and indicates a change on the network adapter or in the underlying driver

If NDIS has called the underlying driver's MiniportReset function in an attempt to restore the network adapter to an operational state, NDIS can substitute NDIS_STATUS_RESET_START for the GeneralStatus indicated in the miniport's call to NdisMIndicateStatus.

Depending on the status at GeneralStatus, additional information about the specific reason for the change in status, which can be medium-specific

For example, ring-insert failures are specific to Token Ring (802.5) networks and do not apply for Ethernet (802.3) networks.

NDIS notifies all bound protocols when an underlying driver is resetting its network adapter by calling their ProtocolStatus functions, first with NDIS_STATUS_RESET_START and later, when the reset operation is done, with NDIS_STATUS_RESET_END. After each such call to a ProtocolStatus function, NDIS also calls the driver's ProtocolStatusComplete function.

Because NDIS will not accept protocol-initiated sends and requests to a miniport while a reset is in progress, the NDIS_STATUS_RESET_START notification warns bound protocols to hold off on their calls to NdisSendPackets, NdisSend, and NdisRequest on the binding designated by the respective ProtocolBindingContext given to their ProtocolStatus functions until they receive the corresponding NDIS_STATUS_RESET_END notification.

If the protocol itself initiated the reset operation with a call to NdisReset, its ProtocolStatus function receives the NDIS_STATUS_RESET_START and NDIS_STATUS_RESET_END notifications like any other protocol bound to the same underlying driver. However, if NdisReset returns NDIS_STATUS_PENDING, only the ProtocolStatusComplete function of the driver that initiated the reset operation is called.

Consequently, every protocol's ProtocolStatus function should take whatever action is required to prevent that protocol from submitting sends and requests as soon as ProtocolStatus receives the NDIS_STATUS_RESET_START notification and should re-enable subsequent sends and requests when ProtocolStatus receives the NDIS_STATUS_RESET_END notification. Usually, ProtocolStatus simply sets and clears a ResetInProgress flag in the ProtocolBindingContext area that other driver functions check before they initiate sends or requests on the binding.

As another example, the ProtocolStatus function of any protocol bound above NDISWAN receives a line-up notification whenever the underlying WAN network adapter miniport is establishing a new link. After such a protocol has traded link-specific context handles with NDISWAN, its ProtocolStatus function can receive additional link-specific line-up, line-down, and fragment indications, which the protocol can use to optimize throughput and/or performance on the link.

When the underlying network adapter driver signals a status change, it does not change associated event counters and thresholds.

Requirements

Header

ndis.h

Library

Ndislib.lib

See Also

Reference

NDIS 5.x Legacy Functions
MiniportReset
NdisMIndicateStatus
NdisOpenAdapter
NdisRequest
NdisReset
NdisSend
ProtocolStatusComplete