Edit

Share via


Handling the OID_NIC_SWITCH_CREATE_SWITCH Request

NDIS issues an object identifier (OID) method request of OID_NIC_SWITCH_CREATE_SWITCH to do the following:

  • Enable a NIC switch on a network adapter that was statically created by the miniport driver for the PCI Express (PCIe) Physical Function (PF). The PF is a hardware component of the network adapter that supports single root I/O virtualization (SR-IOV).

    A NIC switch is statically created by the PF miniport driver from within the context to the call to MiniportInitializeEx. The driver allocates the resources and creates the switch based on parameters read from registry settings.

  • Dynamically create a NIC switch on a network adapter.

    If the PF miniport driver does not support static NIC switch creation, the miniport driver allocates the resources and creates the switch based on parameters that are specified in the OID request.

The PF miniport driver advertises its support of the SR-IOV interface when NDIS calls the driver's MiniportInitializeEx function. If the PF miniport driver supports SR-IOV, NDIS reads the NIC switch configuration from the registry. Before NDIS issues an OID method request of OID_NIC_SWITCH_CREATE_SWITCH to the PF miniport driver, NDIS formats an NDIS_NIC_SWITCH_PARAMETERS structure with the registry information in the following way:

  • NDIS sets the SwitchType member to the type of the NIC switch.

    Starting with Windows Server 2012, Windows only supports a switch type of NdisNicSwitchTypeExternal. An external switch specifies that the virtual ports (VPorts) that are connected to this type of switch can access the external network through the physical port on the network adapter.

    For more information about the NIC switch, see SR-IOV Architecture.

  • NDIS sets the SwitchId member to an identifier value for the NIC switch. The switch identifier is an integer between zero and the number of switches that the network adapter supports. An NDIS_DEFAULT_SWITCH_ID value indicates the default NIC switch.

    Note  Starting with Windows Server 2012, the SR-IOV interface only supports the default NIC switch on the network adapter.

  • NDIS sets the NumVFs member that specifies the number of PCIe Virtual Function (VFs) that can be allocated on the NIC switch.

When it receives the OID method request of OID_NIC_SWITCH_CREATE_SWITCH, the PF miniport driver must do the following:

  1. If the PF miniport driver supports static switch creation and configuration, it creates the NIC switch when NDIS calls MiniportInitializeEx. When the driver handles this OID request, it must verify the configuration parameters in the NDIS_NIC_SWITCH_PARAMETERS structure. The parameters must be the same as those used by the driver to create the switch during the call to MiniportInitializeEx. If this is not true, the driver must fail the OID request.

    For more information, see Static Creation of a NIC Switch.

  2. If the PF miniport driver supports dynamic switch creation and configuration, the driver must validate the configuration values of the NDIS_NIC_SWITCH_PARAMETERS structure and create the NIC switch based on these values.

    For more information, see Dynamic Creation of a NIC Switch.

  3. The PF miniport driver must allocate the necessary hardware and software resources for the default VPort on the NIC switch.

    Note  The default VPort is always created through an OID request of OID_NIC_SWITCH_CREATE_SWITCH and deleted through an OID request of OID_NIC_SWITCH_DELETE_SWITCH. OID requests of OID_NIC_SWITCH_CREATE_VPORT and OID_NIC_SWITCH_DELETE_VPORT are used for the creation and deletion of nondefault VPorts on the NIC switch.

  4. The PF miniport driver that supports dynamic switch creation and configuration must enable SR-IOV virtualization on the switch by calling NdisMEnableVirtualization. This call configures the NumVFs member and the VF Enable bit in the SR-IOV Extended Capability structure of the adapter's PCI Express (PCIe) configuration space.

    For more information about the SR-IOV configuration space, see the PCI-SIG Single Root I/O Virtualization and Sharing 1.1 specification.

    Note  If the PF miniport driver supports static switch creation, it enables SR-IOV virtualization after it creates the switch when MiniportInitializeEx is called.

If the PF miniport driver successfully completes the OID method request of OID_NIC_SWITCH_CREATE_SWITCH, it allows the following to occur:

  • VFs can be allocated on the NIC switch through OID method requests of OID_NIC_SWITCH_ALLOCATE_VF.

  • Nondefault VPorts can be created on the NIC switch through OID method requests of OID_NIC_SWITCH_CREATE_VPORT.

    The miniport driver is responsible for managing its pool of nondefault VPorts. The driver specifies the number of nondefault VPorts in its pool through the NumVPorts member of the NDIS_NIC_SWITCH_INFO structure. The driver returns this structure through an OID query request of OID_NIC_SWITCH_ENUM_SWITCHES.

    Note  The network adapter must always create a default VPort from its pool for the PF.