NDIS_SWITCH_REFERENCE_SWITCH_PORT callback function (ndis.h)

The ReferenceSwitchPort function increments the Hyper-V extensible switch reference counter for an extensible switch port.

Syntax

NDIS_SWITCH_REFERENCE_SWITCH_PORT NdisSwitchReferenceSwitchPort;

NDIS_STATUS NdisSwitchReferenceSwitchPort(
  [in] NDIS_SWITCH_CONTEXT NdisSwitchContext,
  [in] NDIS_SWITCH_PORT_ID SwitchPortId
)
{...}

Parameters

[in] NdisSwitchContext

An NDIS_SWITCH_CONTEXT value that contains the handle of the extensible switch module to which the Hyper-V extensible switch extension is attached. When the extension calls NdisFGetOptionalSwitchHandlers, this handle is returned through the NdisSwitchContext parameter.

[in] SwitchPortId

An NDIS_SWITCH_PORT_ID value that contains the unique identifier of the extensible switch port for which the extensible switch reference counter is incremented.

Note  The SwitchPortId parameter must specify the identifier of a port that is in a created state. Identifiers for ports that are in a teardown or deleted state cannot be specified. For more information about port states, see Hyper-V Extensible Switch Port and Network Adapter States.
 

Return value

If the call succeeds, the function returns NDIS_STATUS_SUCCESS. Otherwise, it returns an NDIS_STATUS_Xxx error code that is defined in Ndis.h.

Remarks

The extensible switch extension calls ReferenceSwitchPort to increment the reference counter for an extensible switch port. While the reference counter has a nonzero value, the protocol edge of the extensible switch will not issue an object identifier (OID) set request of OID_SWITCH_PORT_DELETE to delete the extensible switch port.

After the extension calls ReferenceSwitchPort, it must call DereferenceSwitchPort to decrement the reference counter.

The extension calls ReferenceSwitchPort after the port has reached the Port created state. The extension must not call ReferenceSwitchPort after the connection has reached the Port tearing down or Port not created states. For more information about these states, see Hyper-V Extensible Switch Port and Network Adapter States.

The extension must call ReferenceSwitchPort when it performs any operation that requires the port to be in an active state. For example, the extension must call ReferenceSwitchPort before it issues an OID method request of OID_SWITCH_PORT_PROPERTY_ENUM.

The extension calls ReferenceSwitchPort after the port has reached the Port created state. The extension must not call ReferenceSwitchNic after the port has reached the Port tearing down state. For more information about these states, see Hyper-V Extensible Switch Port and Network Adapter States.

Note  When the extension calls ReferenceSwitchPort, it does not have to synchronize the call with its code that handles OID requests. As a result, it is possible for the extension to call ReferenceSwitchPort while the protocol edge of the extensible switch issues an OID request of OID_SWITCH_PORT_TEARDOWN. However, if the call to ReferenceSwitchPort completes with NDIS_STATUS_SUCCESS, the extension can still issue the OID_SWITCH_PORT_PROPERTY_ENUM OID request after it handles the OID_SWITCH_PORT_TEARDOWN OID request.
 

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.30 and later.
Target Platform Desktop
Header ndis.h (include Ndis.h)
IRQL <= DISPATCH_LEVEL

See also

DereferenceSwitchNic

NdisFGetOptionalSwitchHandlers

OID_SWITCH_PORT_DELETE

OID_SWITCH_PORT_PROPERTY_ENUM

OID_SWITCH_PORT_TEARDOWN