Initializing a VF Miniport Driver

This topic describes the guidelines for writing a MiniportInitializeEx function for the miniport driver for a PCI Express (PCIe) Virtual Function (VF). The VF is exposed by a network adapter that supports single root I/O virtualization (SR-IOV).

Note

 These guidelines only apply to VF miniport drivers of the SR-IOV network adapter. For initialization guidelines for the miniport driver of a PCIe Physical Function (PF) of the adapter, see Initializing a PF Miniport Driver

The VF miniport driver follows the same steps as any NDIS miniport driver when its MiniportInitializeEx function is called. For more information about these steps, see Initializing a Miniport Driver.

In addition to these steps, the VF miniport driver must follow these additional steps when NDIS calls the driver's MiniportInitializeEx function:

  • The VF miniport driver calls the NdisGetHypervisorInfo function to verify that it is running in the Hyper-V child partition. This function returns an NDIS_HYPERVISOR_INFO structure which defines the partition type. If the partition type is reported as NdisHypervisorPartitionMsHvChild, the miniport driver is running in a Hyper-V child partition that is attached to the PF on the adapter.

    Note

    If the partition type is reported as NdisHypervisorPartitionMsHvParent, the miniport driver is running in the Hyper-V parent partition that is attached to the PF on the adapter. In this case, the miniport driver must not initialize as a VF driver. If possible, the driver must initialize as a PF driver as described in Initialization Sequence for PF Miniport Drivers.

  • Unlike the PF miniport driver, the VF miniport driver must not be installed with the SR-IOV standardized keywords and must not attempt to read these keywords. For more information about these keywords, see Standardized INF Keywords for SR-IOV.

  • The VF miniport driver reports the SR-IOV hardware capabilities of the underlying virtual network adapter through an NDIS_SRIOV_CAPABILITIES structure that is initialized in the following way:

    1. The miniport driver initializes the Header member. The driver sets the Type member of Header to NDIS_OBJECT_TYPE_DEFAULT.

      Starting with NDIS 6.30, the miniport driver sets the Revision member of Header to NDIS_SRIOV_CAPABILITIES _REVISION_1 and the Size member to NDIS_SIZEOF_SRIOV_CAPABILITIES_REVISION_1.

    2. The miniport driver sets the NDIS_SRIOV_CAPS_PF_MINIPORT flag in the SriovCapabilities member to report SR-IOV capabilities.

      Note

      The VF miniport driver must set both the NDIS_SRIOV_CAPS_VF_MINIPORT flag and the NDIS_SRIOV_CAPS_SRIOV_SUPPORTED flag.

    The VF miniport driver registers the SR-IOV capabilities of the network adapter by following these steps:

    1. The miniport driver initializes an NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES structure.

      The miniport driver sets the HardwareSriovCapabilities and CurrentSriovCapabilities members to a pointer to the previously initialized NDIS_SRIOV_CAPABILITIES structure.

    2. The driver calls NdisMSetMiniportAttributes and sets the MiniportAttributes parameter to a pointer to the NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES structure.

  • The VF miniport driver must not advertise virtual machine queue (VMQ) capabilities. However, the driver can advertise support for other NDIS technologies, such as power management and receive side scaling (RSS).

    For more information about RSS, see Receive Side Scaling.