Repository navigation
pillar: apply the network interface order to SR-IOV VFs - #7198
Draft
christoph-zededa wants to merge 4 commits into
Draft
christoph-zededa wants to merge 4 commits into
christoph-zededa wants to merge 4 commits into
Conversation
github-actions
Bot
requested review from
andrewd-zededa,
eriknordmark,
europaul,
milan-zededa,
naiming-zededa,
rene,
rucoder and
shjala
November 23, 2026 18:28
Commit 68e5122 ("sriov: remove isNet() for Virtual Function") fixed a race in domainmgr: a network adapter is not handed to pciback while NIM tests a network config, so when the testing started while the VFs of a NIC were being set up, only a part of them was passed through. That commit came without a test. TestVfsAssignedToPciBackWhileTestingStarts lets the testing start before each of four VFs in turn, and after the last one, and expects all of them to be handed to pciback, while a regular NIC is held back. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
Commit 68e5122 ("sriov: remove isNet() for Virtual Function") took SR-IOV VFs out of IoType.IsNet() to fix a race in domainmgr: a network adapter is not handed to pciback while NIM tests a network config, so when the testing started while the VFs were being set up, only a part of them was passed through. IsNet() also decides which adapters take part in the user-defined network interface order (EnforceNetworkInterfaceOrder). Since that commit zedagent dropped the interface order of a VF and the KVM PCI address allocator placed VFs after all other network interfaces, so a VM saw its VFs last, whatever order was configured. Revert that commit, so that a VF is a network adapter again and is ordered like any other directly assigned NIC. Fix the race where it occurs instead: a VF only exists to be passed through and is never an EVE network port, so do not hold it back during network testing. TestCreateDomConfigVFInterfaceOrder covers the PCI address allocator with two VFs of one host device, which share a bridge, and a VF of another device. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
A test of SR-IOV needs an edge device with a NIC that supports it. QEMU emulates one: igb, an Intel 82576, on which the guest can create up to 7 virtual functions. Let a client ask for such a NIC per interface of an EVE device (EVEInterface.sriov). The QEMU and the Proxmox provider then attach an igb in place of the virtio NIC, and advertise that they can with the new capability CAPABILITY_SRIOV_NIC. The libvirt provider does not offer such a NIC yet. The NIC sits behind a PCIe root port: a new one with the QEMU provider, the one every cross-connected NIC already has with Proxmox. Its virtual functions show up behind that port, where Linux puts each of them into an IOMMU group of its own, so that EVE can pass every one of them through to an application separately. igb has no boot ROM, so a device cannot boot from the network over such a NIC. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
Add TestSRIOVInterfaceOrder to the app NICs suite. It lets EVE create two virtual functions on a NIC and assigns both to an application whose interface order puts them between its two virtual NICs. The guest must find the VFs between the virtual NICs on its PCI bus (it cannot tell the two VFs apart), and the app info and metrics must list all four adapters in the configured order. EVE used to place VFs after all other network interfaces, whatever their interface order, and the test fails on such an image. For this a port of the network model can be marked as SR-IOV capable (Port.eve_sriov). The harness passes that on to the broker and requires CAPABILITY_SRIOV_NIC, so the test is skipped with a provider that has no such NIC. Like the set of ports, the property cannot be changed while a test runs. EVE loads the driver of the NIC, igb, as a kernel module, later than the built-in virtio_net of the other NICs, so it numbers such a NIC (ethN) after all the others, whatever the order of ports. The harness therefore rejects a network model that lists an SR-IOV capable port of a device before another port of that device. The device config builder learns the number of VFs of a physical function (PhysicalIOConfig.VFCount) and the type of a directly assigned network adapter (DirectlyAssignedNetworkAdapter.Type). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Ostarek <christoph@zededa.com>
christoph-zededa
force-pushed
the
sriov_iface_order
branch
from
November 23, 2026 18:29
bc1f43c to
cb497ee
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7198 +/- ##
==========================================
+ Coverage 30.99% 31.47% +0.48%
==========================================
Files 562 573 +11
Lines 101231 102827 +1596
==========================================
+ Hits 31380 32369 +989
- Misses 67412 68063 +651
+ Partials 2439 2395 -44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
@christoph-zededa When you are ready with this for review/merge -- could you split the evetest broker enhancements together with evetest/grpcapi addition into a separate PR? Once that is merged, broker will upgrade (as soon as there are no running tests), and therefore the newly added test should then succeed here. You will be also able to update sdn/vm/go.mod properly here. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
EnforceNetworkInterfaceOrderset, SR-IOV virtual functions (VFs) assigned to a VM show up in the guest after all its other network interfaces, whatever interface order is configured for them. Virtual NICs and other directly assigned NICs are ordered as configured, anddocs/APP-CONNECTIVITY.mddescribes the interface order as covering VFs too.This was introduced by #5604. Commit 68e5122 ("sriov: remove isNet() for Virtual Function") took VFs out of
IoType.IsNet()to fix a race in domainmgr: a network adapter is not handed to pciback while NIM tests a network config, so when the testing started while the VFs were being set up, only a part of them was passed through. ButIsNet()also decides which adapters take part in the interface order. Since then zedagent drops the interface order of a VF, and the KVM PCI address allocator places VFs after all network interfaces.The commits:
domainmgr: test handing VFs to pciback while NIM is testingadds a test for that race; there was none. It passes before and after the fix.pillar: apply the network interface order to SR-IOV VFsreverts 68e5122, so that a VF is a network adapter again and is ordered like any other directly assigned NIC, and fixes the race where it occurs instead: a VF only exists to be passed through and is never an EVE network port, so domainmgr no longer holds it back during network testing.evetest: add an SR-IOV capable NIC to QEMU and Proxmoxlets a test ask for an emulated Intel 82576 (igb), on which EVE can create VFs. The two providers advertise it asCAPABILITY_SRIOV_NIC.evetest: test the interface order of SR-IOV VFsaddsTestSRIOVInterfaceOrderto the app NICs suite.What else changes for VFs
IsNet()has more callers than the interface order, so a VF is treated like other directly assigned NICs in these places again:EnforceNetworkInterfaceOrder, the interface order of a VF is no longer ignored, so the documented rules apply to it. It has to be unique within the app, otherwise zedagent reports a config error for the app; an existing app whose VFs have no unique interface order configured (it did not matter so far) gets this error after the upgrade. And VFs that are functions of the same host PCI device (same bus and device number, which the VFs of a NIC usually share) cannot have another interface ordered between them; the app is not started with such an order.EnforceNetworkInterfaceOrderwith VFs today, the PCI addresses of its NICs in the guest change with the upgrade. That is the fix, but it can rename interfaces in the guest.Can't find ifname <pf>vf<N>at error level when it looks up the MAC address of a VF, as no host interface has that name.NIM's testing and the last-resort config still do not see VFs: they look adapters up by the interface name of a port, and the adapter of a VF is named
<pf>vf<N>.How to test and validate this PR
On a device with an SR-IOV capable NIC and the KVM hypervisor:
lspci | grep -i ethernet). The VF comes before the virtual NIC. Without this PR it comes after it.Automated tests:
TestCreateDomConfigVFInterfaceOrder(pkg/pillar/hypervisor): PCI address allocation for three VFs, two of them functions of one host device, and a virtual NIC. It fails without the fix.TestVfsAssignedToPciBackWhileTestingStarts(pkg/pillar/cmd/domainmgr): the race fixed by SR-IOV: Fix API logic and add I350 NIC support #5604. It fails if 68e5122 is reverted without the change in domainmgr.TestSRIOVInterfaceOrder(make evetest NAME=TestSRIOVInterfaceOrder): EVE creates two VFs on an emulatedigband assigns them to an app between its two virtual NICs. The test checks the position of the NICs on the guest's PCI bus and the order in the app info and metrics. It is skipped with a device provider that has no SR-IOV capable NIC (libvirt) and with a hypervisor other than KVM.Tested so far:
types,hypervisor,cmd/domainmgr,cmd/zedagent,cmd/zedkube,dpcmanager,dpcreconciler,sriov) pass with-tags k -race.TestSRIOVInterfaceOrderpasses with the QEMU provider on an amd64 host with an EVE image built from this branch. On an image of master it fails: the guest sees both VFs after the virtual NICs.Not tested:
TestSRIOVInterfaceOrderin CI. As far as I can tell fromevetest/deploy/proxmox, the CI brokers run the broker of master, which does not advertiseCAPABILITY_SRIOV_NICyet, so I expect the test to be skipped in the evetest run of this PR and to run on Proxmox for the first time after the merge.Changelog notes
SR-IOV virtual functions assigned to a VM now follow the configured network interface order (when enforcing the network interface order is enabled for the VM), like other directly assigned NICs. Until now they always appeared in the guest after all other network interfaces. For VMs that use this option together with virtual functions, the PCI addresses of the NICs in the guest change accordingly, and each virtual function needs an interface order that is unique within the VM.
PR Backports
The interface order of VFs is broken on every branch that has both the network interface order and the change of #5604, which was backported to 16.0-stable (b82f09f) and 14.5-stable (d7d1c95). 13.4-stable has that change as well (8e762db), but not the network interface order.
Checklist
docs/APP-CONNECTIVITY.mdalready describes the interface order as covering VFs;evetest/sdn/README.mddescribes the neweve_sriovport attribute)And the last but not least:
check them.
🤖 Generated with Claude Code