Determining NIC Switch Capabilities
This topic describes how NDIS and overlying drivers determine the NIC switch capabilities of a network adapter that supports single root I/O virtualization (SR-IOV). This topic contains the following information:
Reporting NIC Switch Capabilities during MiniportInitializeEx
Querying NIC Switch Capabilities by Overlying Drivers
Note Only the miniport driver for the PCI Express (PCIe) Physical Function (PF) of an SR-IOV network adapter can report NIC switch capabilities. Miniport drivers for PCIe Virtual Functions (VFs) must not report the NIC switch capabilities of the SR-IOV adapter.
For more information on NIC switches, see NIC Switches.
Reporting NIC Switch Capabilities during MiniportInitializeEx
When NDIS calls the miniport driver's MiniportInitializeEx function, the driver provides the following NIC switch capabilities:
The complete set of hardware capabilities for a NIC switch that the network adapter can support.
Note Starting with NDIS 6.30, only one NIC switch is created on the network adapter. This switch is known as the default NIC switch.
The NIC switch capabilities that are currently enabled on the network adapter.
The miniport driver reports the NIC switch hardware capabilities of the underlying network adapter through an NDIS_NIC_SWITCH_CAPABILITIES structure that is initialized in the following way:
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_NIC_SWITCH_CAPABILITIES_REVISION_2 and the Size member to NDIS_SIZEOF_NIC_SWITCH_CAPABILITIES_REVISION_2.
The miniport driver sets appropriate flags in the NicSwitchCapabilities member of the NDIS_NIC_SWITCH_CAPABILITIES structure to the NIC switch capabilities of the SR-IOV network adapter. For example, the miniport driver sets the NDIS_NIC_SWITCH_CAPS_PER_VPORT_INTERRUPT_MODERATION_SUPPORTED flag if the NIC switch supports interrupt moderation on each virtual port (VPort) that is created on the switch.
The miniport driver sets the other members of the NDIS_NIC_SWITCH_CAPABILITIES structure to the range of values for the NIC switch capabilities of the SR-IOV network adapter. For example, the miniport driver sets the MaxNumVFs and MaxNumVPorts members to the maximum number of VFs and VPorts that the adapter can support.
Note Depending on the available hardware resources on the network adapter, the miniport driver can set the MaxNumVFs member to a value that is less than its *NumVFs keyword. For more information about this keyword, see Standardized INF Keywords for SR-IOV.
When NDIS calls the miniport driver's MiniportInitializeEx function, the driver registers the NIC switch capabilities of the network adapter by following these steps:
The miniport driver initializes an NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES structure.
The miniport driver sets the HardwareNicSwitchCapabilities member to a pointer to a previously initialized NDIS_NIC_SWITCH_CAPABILITIES structure.
If the registry setting for the *SRIOV INF keyword has a value of one, the network adapter is currently enabled for NIC switch creation and configuration. The miniport driver sets the CurrentNicSwitchCapabilities members to a pointer to the same NDIS_NIC_SWITCH_CAPABILITIES structure.
If the registry setting for the *SRIOV INF keyword has a value of zero, the network adapter is not currently enabled for NIC switch creation and configuration. The miniport driver must set the CurrentNicSwitchCapabilities member to NULL.
For more information about the *SRIOV INF keyword, see Standardized INF Keywords for SR-IOV.
The driver calls NdisMSetMiniportAttributes and sets the MiniportAttributes parameter to a pointer to the NDIS_MINIPORT_ADAPTER_HARDWARE_ASSIST_ATTRIBUTES structure.
For more information about the adapter initialization process, see Initializing a Miniport Adapter.
Creating a NIC switch without SR-IOV
Miniport drivers in NDIS 6.60 and later must adhere to the following requirements for the coexistence of a NIC switch and VMQ capabilities when SR-IOV is not enabled. When SR-IOV is enabled, the miniport driver should adhere to the existing requirements in the previous section.
- The miniport driver advertises both NIC switch and VMQ capabilities.
- The NIC can toggle between NIC switch and VMQ mode without a NIC restart.
- When the NIC starts initially, it is ready to be in either mode (either creating a NIC switch or creating VMQ queues).
- If a NIC switch is created, the miniport fails any subsequent VMQ queue allocation callbacks.
- If a VMQ queue is created first, the miniport driver succeeds the VMQ queue allocation and fails any NIC switch allocation calls.
- When the NIC switch is deleted or all VMQ queues are deleted, the miniport driver returns to the initial state and is ready to go into either of these modes again.
- When the NIC starts initially, it is ready to be in either mode (either creating a NIC switch or creating VMQ queues).
To advertise that a NIC switch can be created without the use of SR-IOV, the miniport driver sets the NDIS_NIC_SWITCH_CAPS_NIC_SWITCH_WITHOUT_IOV_SUPPORTED flag in the NicSwitchCapabilities member of the NDIS_NIC_SWITCH_CAPABILITIES structure.
Querying NIC Switch Capabilities by Overlying Drivers
NDIS passes the network adapter's currently enabled NIC switch capabilities to overlying drivers that bind to the network adapter in the following way:
When NDIS calls an overlying filter driver's FilterAttach function, NDIS passes the network adapter's NIC switch capabilities through the AttachParameters parameter. This parameter contains a pointer to an NDIS_FILTER_ATTACH_PARAMETERS structure. The NicSwitchCapabilities member of this structure contains a pointer to an NDIS_NIC_SWITCH_CAPABILITIES structure.
When NDIS calls an overlying protocol driver's ProtocolBindAdapterEx function, NDIS passes the network adapter's NIC switch capabilities through the BindParameters parameter. This parameter contains a pointer to an NDIS_FILTER_ATTACH_PARAMETERS structure. The NicSwitchCapabilities member of this structure contains a pointer to an NDIS_NIC_SWITCH_CAPABILITIES structure.
NDIS also returns the NDIS_NIC_SWITCH_CAPABILITIES structure when it handles object identifier (OID) query requests of OID_NIC_SWITCH_HARDWARE_CAPABILITIES and OID_NIC_SWITCH_CURRENT_CAPABILITIES that are issued by overlying protocol or filter drivers.