NIC SR-IOV Support in the Generic PCI Driver

https://blueprints.launchpad.net/openstack-cyborg/+spec/pci-driver-nic-support

The generic PCI driver (pci_driver) can discover NIC VFs and drive flavor-based PCI passthrough today, but cannot serve the Neutron smartNIC SR-IOV port flow (accelerator-direct vnic-type) because it does not report the physnet traits or resource classes that Placement needs for scheduling. This spec closes the gaps so that pci_driver can serve the NIC SR-IOV use case via whitelist-based device selection, without requiring a hardcoded device ID list.

Problem Description

The Intel NIC driver (intel_nic_driver) is currently the only Cyborg driver that supports the Neutron smartNIC SR-IOV port flow (Nova smartNIC SR-IOV spec). It works, but has a hardcoded list of known PCI device IDs (KNOWN_NICS). Any new NIC variant requires a code change. A device_addresses allow-list was added in 2026.2 (commit 664f75c) to address the lack of device exclusion, but the hardcoded device list remains.

The generic PCI driver (pci_driver) avoids hardcoded device IDs entirely — it uses [pci] passthrough_whitelist with vendor/product/address filtering to select devices. A prior investigation on Intel XXV710 hardware (LP#2165432) confirmed:

  • Path A (flavor-based passthrough) works end-to-end with the unmodified pci_driver: VFs discovered, Placement resources created, ARQ bound, VF attached as VFIO <hostdev>.

  • Path B (Neutron accelerator-direct port) fails for two reasons. First, Nova’s get_arq_pci_device_profile() does a hard key lookup for physical_network in the ARQ attach handle, raising KeyError when the driver does not populate it — this is fixed by change 1005623. Second, the driver does not report physnet traits or a NIC-appropriate resource class, so Placement cannot match devices to physical networks.

Upstream discussion (LP#2167144) determined that Nova should not source the physical network from the attach handle. The end-to-end fix has three parts:

  1. Nova: Remove the physical_network key from get_arq_pci_device_profile() entirely — the ARQ attach handle should only provide the PCI slot address and ARQ UUID for port binding. This is change 1005623.

  2. Cyborg: Report CUSTOM_PHYSNET_<value> as a trait on resource providers so Placement can match devices to physical networks. This is tracked in this spec (item 3).

  3. Nova: In create_resource_requests(), when handling an accelerator-direct port, add a CUSTOM_PHYSNET_<value> required trait to the device profile request groups using the physnet already read from Neutron.

The whitelist infrastructure already accepts a physical_network tag (PciDeviceSpec.get_tags() returns it), but the PCI driver never reads it.

Use Cases

As a deployer, I want to use the generic PCI driver with a whitelist to expose NIC VFs for SR-IOV passthrough, so that I do not need to maintain a hardcoded device ID list when adding new NIC hardware.

As a deployer migrating from intel_nic_driver, I want to configure the PCI driver’s whitelist to produce the same resource class and traits my existing device profiles target, so that I can switch drivers without rewriting all my device profiles.

As a developer, I want a single configurable driver that can serve GPU, NIC, and other PCI device classes, reducing the maintenance burden of per-vendor driver code.

Proposed Change

All changes are in the openstack/cyborg repository. Neutron’s sriovnicswitch mechanism driver and port_device_profile extension work as-is. Nova’s KeyError on the missing physical_network key is fixed by change 1005623 (see Problem Description).

1. Report correct device type

_generate_driver_device() hardcodes type = constants.DEVICE_GPU. NIC VFs appear as GPUs in the devices API, which is misleading.

The lspci -nnn -D output already contains the PCI class code in brackets (e.g. [0200] for network controller, [0300] for display controller, [0302] for 3D controller). These class codes are standardised by the PCI-SIG specification and are manufacturer-independent. The driver can infer the device type from the class code:

0200 → DEVICE_NIC
03xx → DEVICE_GPU
other → DEVICE_PCI

2. Configurable resource class

The PCI driver currently reports CUSTOM_PCI for every device. This is too coarse — different devices should use different resource classes so that Placement can distinguish them. Aligning with the Nova PCI-in-Placement spec:

  • Generic PCI devices continue to default to CUSTOM_PCI. Changing the default to CUSTOM_PCI_<VENDOR_ID>_<PRODUCT_ID> would require an online data migration for existing deployments and can be addressed in a future effort.

  • Neutron SR-IOV VFs (indicated by the presence of physical_network in the whitelist) should default to SRIOV_NET_VF, the standard os-resource-classes class for SR-IOV network VFs. This aligns with how Nova and Neutron expect SR-IOV resources to be tracked.

To support migration from intel_nic_driver (which reports CUSTOM_NIC) and to give operators explicit control, allow a resource_class tag in the whitelist JSON that overrides the default:

[pci]
passthrough_whitelist = {"address": "0000:3b:0a.*",
                         "physical_network": "physnet1",
                         "resource_class": "CUSTOM_NIC"}

This is a generic knob — operators can set any custom resource class string. This is consistent with how Nova’s PCI passthrough whitelist handles resource_class overrides and with the PCI driver’s philosophy of trusting operator-provided configuration.

3. Emit physnet trait

When physical_network is present in the whitelist, emit a CUSTOM_PHYSNET_<PHYSNET> trait (e.g. CUSTOM_PHYSNET_PHYSNET1). This follows the naming convention from the Nova smartNIC SR-IOV spec and enables device profile targeting by physical network.

The existing CUSTOM_PCI_<VENDOR> and CUSTOM_PCI_PRODUCT_ID_<id> traits should be reviewed — if the resource class is changed to encode vendor and product ID in a future effort, these traits become redundant. This cleanup can happen as part of that effort considering the online data migration needed to ensure no disruptions for cloud operators who are upgrading.

4. Populate parent_addr for PF/VF relationship

_discover_pcis() sets parent_addr = None, so VFs are not associated with their parent PF. For each discovered device, check if it is a VF (has a physfn symlink in /sys/bus/pci/devices/<addr>/) and populate parent_addr with the PF address.

This also enables operators to whitelist a PF address and have all its VFs discovered, matching the NIC driver’s behavior. The driver should ensure that a PF and its VFs are not both reported as separate devices — only VFs should appear when SR-IOV is in use.

5. NIC device emulation in pci-sim

devstack/lib/pci_sim currently emulates generic PCI devices for flavor-based passthrough (Path A) only. Add an emulated NIC device type that exercises the accelerator-direct port flow:

  • Emulated NIC VF with PCI class code 0200 and realistic vendor/product IDs.

  • Whitelist with physical_network so the physnet plumbing is exercised end-to-end.

  • port_device_profile ML2 extension, SR-IOV agent config, and a provider network in the test resource setup.

  • Tempest test: boot a VM with an accelerator-direct port against the emulated VF.

This would be the first CI coverage for the Cyborg→Nova→Neutron SR-IOV port path.

6. Deprecate intel_nic_driver

Once the PCI driver is NIC-capable (items 1-5), begin a deprecation cycle:

  • Add a deprecation warning when intel_nic_driver is loaded, directing operators to pci_driver with a whitelist and physical_network.

  • Document the migration path: equivalent whitelist JSON for each KNOWN_NICS entry, mapping physical_device_mappings and function_device_mappings config to whitelist tags, device profile resource class and trait changes.

  • Release note with the deprecation timeline (standard two-cycle deprecation).

  • Removal of intel_nic_driver entrypoint, KNOWN_NICS, and nic/intel/ driver code after the deprecation period.

Alternatives

Do nothing. The intel_nic_driver works for NIC SR-IOV today, and device_addresses (commit 664f75c) already solved the device exclusion problem. The only remaining pci_driver draw is removing the hardcoded KNOWN_NICS list. This is a valid option if the project is satisfied with maintaining per-vendor NIC driver code.

Fix only the physnet bug. Land the physical_network plumbing (LP#2165432) as a standalone bug fix, with no further work. This unblocks Path B but leaves the PCI driver as a second-class option for NICs (wrong device type, wrong resource class, no physnet traits). Operators would need to accept these rough edges or continue using intel_nic_driver.

Move NIC support into a new driver. Instead of extending pci_driver, create a new generic_nic_driver that combines the PCI driver’s whitelist approach with the NIC driver’s physnet plumbing. This avoids complexity in the PCI driver but adds a third driver to maintain, which is the opposite of consolidation.

Infer resource class from PCI class code. Map 0200 to CUSTOM_NIC, 03xx to a GPU resource class, and everything else to CUSTOM_PCI. This would make the resource class automatic with no whitelist tag needed. However, the mapping does not generalise: there is no CUSTOM_GPU resource class in Cyborg — GPUs use the standard PGPU and VGPU classes, and the distinction between physical and virtual GPU cannot be determined from a PCI class code. The inference would only work for NICs, making it a special case disguised as a general mechanism.

No resource class override. Operators update device profiles manually when migrating. The migration checklist is small (device profiles are typically 1-3 per deployment) and well-understood. This keeps the driver simpler at the cost of a one-time operational step, but it adds unnecessary friction when a simple configuration tag eliminates it.

Data Model Impact

None. The resource_class value is passed through the existing driver object model (DriverAttribute, DriverDevice.type). No new database columns or migrations are required.

REST API Impact

None. The devices API will report the correct type field (e.g. NIC instead of GPU) for PCI-driver-discovered NICs. This is a data correctness fix, not a schema change.

Security Impact

None. The change does not introduce new authentication, alter access control, or handle sensitive data. The physical_network value is an operator-provided configuration string, not user input.

Notifications Impact

None.

Other End User Impact

None. End users interact with device profiles and accelerator-direct ports, neither of which changes. The device profile may need to target different resource classes/traits depending on the driver, but this is a deployer configuration choice, not an end-user-visible change.

Performance Impact

Negligible. The additional get_devspec() call during discovery is a linear scan of the whitelist specs (typically 1-3 entries) and runs once per agent restart, not per request.

Other Deployer Impact

New optional tags in [pci] passthrough_whitelist:

  • physical_network: already accepted by the whitelist parser but currently ignored by the driver. After this change, it selects the default resource class (SRIOV_NET_VF) and triggers reporting of a CUSTOM_PHYSNET_<value> trait.

  • resource_class: new tag, overrides the default resource class (CUSTOM_PCI for generic devices, SRIOV_NET_VF when physical_network is set).

Example configuration for NIC SR-IOV via pci_driver:

[agent]
enabled_drivers = pci_driver

[pci]
passthrough_whitelist = {"address": "0000:3b:0a.*",
                         "physical_network": "physnet1"}

With physical_network set, the driver defaults to SRIOV_NET_VF and emits a CUSTOM_PHYSNET_PHYSNET1 trait. To match a legacy CUSTOM_NIC device profile, add "resource_class": "CUSTOM_NIC" to the whitelist entry.

Deployers migrating from intel_nic_driver will need to:

  1. Replace their [nic_devices] / [x710_static] configuration with an equivalent [pci] passthrough_whitelist entry including physical_network.

  2. Optionally set resource_class to CUSTOM_NIC to match existing device profiles, or update profiles to target SRIOV_NET_VF.

  3. Switch CYBORG_ENABLED_DRIVERS from intel_nic_driver to pci_driver.

Developer Impact

The intel_nic_driver will eventually be deprecated. Developers adding support for new NIC hardware should target the generic PCI driver’s whitelist mechanism rather than adding entries to KNOWN_NICS.

Upgrade Impact

The change is additive. Existing pci_driver deployments (GPU/generic PCI passthrough) are unaffected — the new whitelist tags are optional and the default behavior is unchanged.

Existing intel_nic_driver deployments are unaffected until the operator chooses to migrate. The deprecation warning (item 6) will be added only after the PCI driver is confirmed NIC-capable and tested in CI.

During the deprecation period, both drivers will coexist. There is no data migration required — switching drivers triggers a rediscovery cycle that rebuilds device objects and Placement resource providers from scratch.

Implementation

Assignee(s)

Primary assignee:

melwitt

Other contributors:

None

Work Items

Phase 1 — Unblock Path B:

  • Report correct device type (item 1)

Phase 2 — Migration-ready:

  • Configurable resource class (item 2)

  • Emit physnet trait (item 3)

  • Populate parent_addr for PF/VF relationship (item 4)

Phase 3 — CI and deprecation:

  • NIC device emulation in pci-sim (item 5)

  • Deprecate intel_nic_driver (item 6)

Dependencies

  • Change 1005623 (Nova): removes physical_network from get_arq_pci_device_profile(), fixing the KeyError that blocks Path B for any driver that does not populate it.

  • A follow-on Nova change to add CUSTOM_PHYSNET_<value> required traits to device profile request groups in create_resource_requests() for accelerator-direct ports (LP#2167144 part 3). Not yet proposed.

  • The Cyborg-side whitelist infrastructure (Whitelist.get_devspec(), PciDeviceSpec.get_tags()) already exists.

Testing

Unit tests (tests/unit/): each work item includes unit tests. Key scenarios:

  • Device type is inferred from PCI class code.

  • Default resource class is CUSTOM_PCI for generic devices, SRIOV_NET_VF when physical_network is present.

  • resource_class tag overrides the default.

  • CUSTOM_PHYSNET_<PHYSNET> trait is emitted when physical_network is present.

  • VFs are discovered with parent_addr populated; the PF is excluded from the device list when its VFs are whitelisted.

  • Deprecation warning is emitted when intel_nic_driver is loaded.

Integration tests (pci-sim + Tempest): item 5 adds an emulated NIC VF to pci-sim that exercises the full accelerator-direct port flow in the gate. This is the first CI coverage for the Cyborg→Nova→Neutron SR-IOV path and requires no specialized hardware. Note: runtime attach/detach of accelerator-direct ports is not currently supported by Nova (returns HTTP 400); testing is limited to boot-time attachment.

Documentation Impact

  • Admin guide: document pci_driver configuration for NIC SR-IOV, including the new whitelist tags (physical_network, resource_class).

  • Migration guide: steps to move from intel_nic_driver to pci_driver, including equivalent whitelist entries for KNOWN_NICS device IDs and config mapping.

  • Release note: deprecation notice for intel_nic_driver when item 6 lands.

References

History

Revisions

Release Name

Description

2027.1

Introduced