Allocating Resources for a Virtual Function

A network adapter that supports single root I/O virtualization (SR-IOV) must be able to support the following hardware components:

  • One PCI Express (PCIe) Physical Function (PF). The PF always exists on the network adapter and is attached to the Hyper-V parent partition.

    For more information on this hardware component, see SR-IOV Physical Function (PF).

  • One or more PCIe Virtual Functions (VF). Each VF must be initialized and attached to a Hyper-V child partition before the networking components of the guest operating system can send or receive packets over the VF.

    For more information on this hardware component, see SR-IOV Virtual Functions (VFs).

The PF miniport driver, which runs in the management operating system of the Hyper-V parent partition, allocates resources for the PF and each VF on the SR-IOV network adapter. This driver allocates resources for the PF as it would for any network adapter. However, the driver allocates resources for each VF in the following way:

  • The PF miniport driver allocates hardware resources for each VF when the driver creates the network interface card (NIC) on the network adapter. The driver completes the hardware resource allocation for the VFs by calling NdisMEnableVirtualization. For more information on this process, see Creating a NIC Switch.

  • The PF miniport driver allocates software resources for a VF when the driver handles an object identifier (OID) method request of OID_NIC_SWITCH_ALLOCATE_VF. Even though the hardware resources have been allocated for a VF, it is considered nonoperational until the PF miniport driver successfully completes the OID_NIC_SWITCH_ALLOCATE_VF.

The overlying driver can request the allocation of software resources for a VF by issuing an OID method request of OID_NIC_SWITCH_ALLOCATE_VF. The InformationBuffer member of the NDIS_OID_REQUEST structure for the OID request contains a pointer to an NDIS_NIC_SWITCH_VF_PARAMETERS structure.

After a successful return from the OID request, the InformationBuffer member of the NDIS_OID_REQUEST structure contains a pointer to an NDIS_NIC_SWITCH_VF_PARAMETERS structure. This structure has an adapter-unique VF identifier and PCI Requestor Identifier (RID). These identifiers are used in the following ways:

  • The overlying driver uses the VF identifier in actions related to the VF, such as the following:

  • The RID is used by the virtualization stack for remapping DMA and interrupts between the PF and VF. The RID also enables the hardware input/output memory management unit (IOMMU) to convert guest physical addresses to host physical addresses.

For more information on how the overlying driver issues OID_NIC_SWITCH_ALLOCATE_VF method requests, see Issuing OID_NIC_SWITCH_ALLOCATE_VF Requests.

For more information on how the PF miniport driver handles OID_NIC_SWITCH_ALLOCATE_VF method requests, see Handling OID_NIC_SWITCH_ALLOCATE_VF Requests.

Note  After resources for a VF have been allocated through an OID method request of OID_NIC_SWITCH_ALLOCATE_VF, the resource parameters for the VF cannot be changed dynamically.