Advertising VMMQ capabilities
Miniport drivers register the Virtual Machine Multiple Queues (VMMQ) capability of a NIC during miniport adapter initialization.
Note
If the NIC supports VMMQ, the default VPort and at least one non-default VPort must support VMMQ.
During initialization, the miniport driver must examine the *RssOnHostVPorts INF keyword in order to determine if it should enable the VMMQ feature on the NIC. For more information on handling RSS keywords for VMMQ, see Standardized INF keywords for VMMQ.
Additionally, the stack can only activate VMMQ on the NIC if the miniport adapter supports creating a NIC switch. NDIS can create a NIC switch on the miniport adapter when either the *SriovPreferred INF keyword is set to one or *SriovPreferred is set to zero and *RssOrVmqPreference is set to one. For more information, see Standardized INF Keywords for SR-IOV and Standardized INF Keywords for VMQ.
When the miniport driver configures the parameters for the NIC switch, it must set the fields of the NDIS_NIC_SWITCH_PARAMETERS structure as follows:
Set the Revision member of Header to NDIS_NIC_SWITCH_PARAMETERS_REVISION_2.
Set NumQueuePairsForDefaultVPort to the number of queue pairs assigned to a default VPort.
Miniport drivers advertise the NIC's VMMQ capability through the NDIS_NIC_SWITCH_CAPABILITIES structure. The miniport driver must initialize NDIS_NIC_SWITCH_CAPABILITIES as follows:
Set the Revision member of Header to NDIS_NIC_SWITCH_CAPABILITIES_REVISION_3.
Set the NicSwitchCapabilities flags as follows:
Set NDIS_NIC_SWITCH_CAPS_SINGLE_VPORT_POOL to one to indicate that non-default VPorts can be created on the PF. This flag must be set.
Set NDIS_NIC_SWITCH_CAPS_ASYMMETRIC_QUEUE_PAIRS_FOR_NONDEFAULT_VPORT_SUPPORTED to indicate that NDIS can allocate an arbitrary number of VMMQ queues on each VPort. Otherwise, all non-default VPorts have the same maximum number of VMMQ queues as the MaxNumQueuePairsPerNonDefaultVPort field defines.
Set NDIS_NIC_SWITCH_CAPS_RSS_ON_PF_VPORTS_SUPPORTED to one to indicate that the NIC supports VMMQ for PF VPorts.
Note
If any of the following four per PF VPort flags are not set, higher level drivers will use the values that are specified when the RSS parameters of the PF VPorts are set (including the default VPort). For more information see Enabling, disabling, and updating VMMQ on a VPort.
- Set NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_INDIRECTION_TABLE_SUPPORTED to one to indicate that the NIC is able to maintain per PF VPort indirection tables. This flag must be set.
Note
The following three flags NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_FUNCTION_SUPPORTED, NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_TYPE_SUPPORTED, and NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_KEY_SUPPORTED must all be set to zero or all be set to one. If they're all set to zero, software will re-calculate the hash.
Set NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_FUNCTION_SUPPORTED to one if the NIC supports setting a different hash function per PF VPort.
Set NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_TYPE_SUPPORTED to one if the NIC supports setting a different hash type per PF VPort.
Set NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_HASH_KEY_SUPPORTED to one if the NIC supports setting a different hash secret key per PF VPort.
Set NDIS_NIC_SWITCH_CAPS_RSS_PER_PF_VPORT_INDIRECTION_TABLE_SIZE_RESTRICTED to one if the NIC has a limitation on indirection table size for PF VPorts. This flag forces the issuer of an RSS OID to use a per-PF VPort indirection table size equal to the number of VPort queues rounded up to the next power of two. This flag can be combined with the NDIS_NIC_SWITCH_CAPS_ASYMMETRIC_QUEUE_PAIRS_FOR_NONDEFAULT_VPORT_SUPPORTED flag (different PF VPorts can have different numbers of queues). This flag prevents VMMQ users from performing fine-grained queue steering.
Set MaxNumVPorts to specify the maximum number of VPorts.
Set MaxNumQueuePairs to specify the maximum number of queue pairs that can be assigned to all VPorts. This includes the default VPort that is attached to the PF. This number should reflect the actual hardware capabilities.
Set MaxNumQueuePairsPerNonDefaultVPort to specify the maximum number of queue pairs that can be assigned to a non-default VPort.
Set MaxNumRssCapableNonDefaultPFVPorts to specify the maximum number of non-default PF VPorts that can support VMMQ.
Set NumberOfIndirectionTableEntriesForDefaultVPort to specify the number of indirection table entries for the default VPort.
Set NumberOfIndirectionTableEntriesPerNonDefaultPFVPort to specify the number of indirection table entries for each non-default PF VPort. The size of indirection table should be the same for all non-default PF VPorts.
Set MaxNumQueuePairsForDefaultVPort to specify the maximum number of queue pairs that can be assigned to a default VPort during NIC Switch creation.
After the VMMQ capabilities are advertised, NDIS is responsible for handling the OID_GEN_RECEIVE_SCALE_CAPABILITIES OID when it is called on either the default VPort or a non-default VPort. When the miniport driver returns the RSS capabilities in the NDIS_RECEIVE_SCALE_CAPABILITIES structure, it should not constrain the NumberOfInterruptMessages fields by any of the standard RSS keywords (such as *MaxRssProcessors). The upper level driver will incorporate this number into the host CPU allocation algorithm.