DriverEntry Guidelines for PF Miniport Drivers
This topic describes the guidelines for writing a DriverEntry function for the miniport driver of the PCI Express (PCIe) Physical Function (PF). The PF is a component of a network adapter that supports single root I/O virtualization (SR-IOV).
Note These guidelines only apply to PF miniport drivers. For initialization guidelines for the miniport driver of a PCIe Virtual Function (VF) of the adapter, see Initializing a VF Miniport Driver.
The SR-IOV network adapter must implement a hardware bridge that forwards network traffic over the physical port on the adapter and internal virtual ports (VPorts). This bridge is known as the NIC switch. For more information, see NIC Switches.
If the PF miniport driver supports the static creation of the NIC switch on the SR-IOV network adapter, it may need to allocate switch resources when the functional device object (FDO) is created for the network adapter in the device stack. In this case, the driver must allocate those resources before NDIS calls MiniportInitializeEx. To do this, the driver must register optional Plug-and-Play (PnP) handlers so that it can participate in the process when the adapter's FDO is added or removed from the device stack.
The miniport driver must provide a MiniportSetOptions function to register these PnP handler functions. To do this, the driver follows these steps from the context of the call to its DriverEntry function:
The miniport driver initializes an NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure with the entry points of the MiniportXxx functions. In particular, the driver sets the SetOptionsHandler member to the entry point of the driver's MiniportSetOptions function.
The miniport driver calls the NdisMRegisterMiniportDriver function to register its entry points. From the context of this call, NDIS calls the driver's MiniportSetOptions function
When NDIS calls MiniportSetOptions, the miniport driver calls the NdisSetOptionalHandlers function and specifies an NDIS_MINIPORT_PNP_CHARACTERISTICS structure. This structure defines the entry points for the MiniportAddDevice, MiniportRemoveDevice, MiniportStartDevice, and MiniportFilterResourceRequirements functions. NDIS calls these handler functions when it handles PnP I/O request packets (IRPs) issued by the PCI bus driver.
If the PF miniport driver must allocate additional software resources for the NIC switch before NDIS calls the driver's MiniportInitializeEx function, the driver must register a MiniportAddDevice function. When NDIS calls the MiniportAddDevice function, the PF miniport driver can call NdisReadConfiguration to read the NIC switch configuration keyword settings from the registry. For more information about these keywords, see Standardized INF Keywords for SR-IOV.
For more information about guidelines for the MiniportAddDevice function, see MiniportAddDevice Guidelines for PF Miniport Drivers.
For more information on how NIC switches are created, see Creating a NIC Switch.