NDIS_STATUS_SWITCH_PORT_REMOVE_VF

The NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication is issued by a Hyper-V extensible switch forwarding extension to remove the binding between a virtual machine (VM) network adapter and a PCI Express (PCIe) virtual function (VF). The VF is exposed and supported by an underlying physical network adapter that supports the single root I/O virtualization (SR-IOV) interface.

In order to issue the NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication, the forwarding extension must encapsulate the indication in an NDIS_SWITCH_NIC_STATUS_INDICATION structure and issue an NDIS_STATUS_SWITCH_NIC_STATUS status indication.

For more information on this process, see Guidelines for Issuing an NDIS_STATUS_SWITCH_PORT_REMOVE_VF Status Indication.

Remarks

A PCIe VF is created and allocated by an underlying physical adapter that supports the SR-IOV interface. Once created, the virtualization stack attaches, or assigns, the VF to a Hyper-V child partition. The guest operating system that runs in this partition exposes a virtual machine (VM) network adapter that is bound to the VF of the underlying SR-IOV physical adapter.

After the virtual and physical network adapters are assigned, packets are routed directly between the VF and the VM network adapter. However, because the extensible switch is not involved in packet delivery, extensible switch port policies are not applied to these packets. This includes port policies for access control lists (ACLs) and quality of service (QoS).

An extensible switch forwarding extension can remove the assignment of the VF to the child partition by issuing an NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication. This indication causes the packets to be delivered through an extensible switch port instead of directly between the VM network adapter and the VF of the underlying SR-IOV physical adapter. This allows the extensible switch port policies to be applied to packets that are received or sent over the extensible switch port.

When the forwarding extension makes the NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication, it specifies the extensible switch port to which the VM network adapter is connected.

For more information about extensible switch forwarding extensions, see Forwarding Extensions.

Guidelines for Issuing an NDIS_STATUS_SWITCH_PORT_REMOVE_VF Status Indication

In order to issue the NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication, the forwarding extension must follow these steps:

  1. The forwarding extension initializes an NDIS_STATUS_INDICATION structure for the NDIS_STATUS_SWITCH_PORT_REMOVE_VF indication. For this indication, the forwarding extensions sets the following members of the NDIS_STATUS_INDICATION structure:

    • The StatusCode member must be set to NDIS_STATUS_SWITCH_PORT_REMOVE_VF.

    • The StatusBuffer member must be set to NULL.

    • The StatusBufferSize must be set to zero.

  2. The forwarding extension initializes an NDIS_SWITCH_NIC_STATUS_INDICATION structure. In order to remove a VF assignment, the forwarding extension must set the members in the following way:

    • The DestinationPortId member must be set to the identifier of an extensible switch port to which the VM network adapter is connected.

    • The DestinationNicIndex member must be set to the index value of the VM network adapter that is connected to the specified port.

    • The SourcePortId member must be set to NDIS_SWITCH_DEFAULT_PORT_ID.

    • The SourceNicIndex member must be set to NDIS_SWITCH_DEFAULT_NIC_INDEX.

    • The StatusIndication member must be set to the address of the NDIS_STATUS_INDICATION structure for the NDIS_STATUS_SWITCH_PORT_REMOVE_VF indication.

  3. The forwarding extension initializes an NDIS_STATUS_INDICATION structure for the NDIS_SWITCH_NIC_STATUS_INDICATION indication. For this indication, the forwarding extension sets the following members of the NDIS_STATUS_INDICATION structure:

  4. The forwarding extension must call ReferenceSwitchNic to increment a reference counter for the VM network adapter. If ReferenceSwitchNic does not complete with NDIS_STATUS_SUCCESS, the forwarding extension must not forward the status indication.

    Note  If the forwarding extension has received an OID_SWITCH_NIC_DISCONNECT set request for the VM adapter, it must not call ReferenceSwitchNic nor forward the status indication.

  5. The forwarding extension calls NdisFIndicateStatus to forward the NDIS_STATUS_INDICATION to overlying extensions in the extensible switch driver stack. When the forwarding extension calls this function, it sets the StatusIndication parameter to a pointer to the NDIS_STATUS_INDICATION structure for the NDIS_STATUS_SWITCH_NIC_STATUS indication.

  6. After NdisFIndicateStatus returns, the forwarding extension must call DereferenceSwitchNic to decrement the reference counter for the VM network adapter.

Note  The forwarding extension must follow the previous steps for each VF assignment that the forwarding extension is removing.

For more information on how a forwarding extension forwards status indications, see Filter Module Status Indications.

Guidelines for Determining VF Assignments

The forwarding extension can enumerate the current VF assignments for virtual network adapters by issuing an OID query request of OID_SWITCH_NIC_ARRAY. This request returns an NDIS_SWITCH_NIC_ARRAY structure that contains an array of NDIS_SWITCH_NIC_PARAMETERS structures. Each NDIS_SWITCH_NIC_PARAMETERS structure specifies the parameters of a network adapter that is exposed in one of the following environments:

  • The management operating system that runs in the Hyper-V parent partition.

    Network adapters that are exposed in this operating system are specified with an NDIS_SWITCH_NIC_TYPE enumeration value of NdisSwitchNicTypeExternal or NdisSwitchNicTypeInternal.

  • The guest operating system that runs in a Hyper-V child partition.

    Network adapters that are exposed in this operating system are specified with an NDIS_SWITCH_NIC_TYPE enumeration value of NdisSwitchNicTypeSynthetic or NdisSwitchNicTypeEmulated.

If the OID query request of OID_SWITCH_NIC_ARRAY completes with a status of NDIS_STATUS_SUCCESS, the forwarding extension can determine VF assignments by inspecting each NDIS_SWITCH_NIC_PARAMETERS structure in the returned array. If the VFAssigned member of the NDIS_SWITCH_NIC_PARAMETERS structure is set to TRUE, the network adapter that corresponds to the NDIS_SWITCH_NIC_PARAMETERS structure is assigned to a VF.

The forwarding extension can remove the assignment by issuing an NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication. In this case, the forwarding extension must set the DestinationPortId member of the NDIS_SWITCH_NIC_STATUS_INDICATION to the value of the PortId member of the NDIS_SWITCH_NIC_PARAMETERS structure.

For more information on how to issue an NDIS_STATUS_SWITCH_PORT_REMOVE_VF status indication, see Guidelines for Issuing an NDIS_STATUS_SWITCH_PORT_REMOVE_VF Status Indication.

Requirements

Version

Supported in NDIS 6.30 and later.

Header

Ndis.h (include Ndis.h)

See also


NdisFIndicateStatus

NDIS_STATUS_INDICATION

NDIS_STATUS_SWITCH_NIC_STATUS

NDIS_SWITCH_NIC_ARRAY

NDIS_SWITCH_NIC_PARAMETERS

NDIS_SWITCH_NIC_TYPE

OID_SWITCH_NIC_ARRAY