Skip to content

fix: Topology file index inconsistent on windows, sort by PCI address - #55

Open
khudson2 wants to merge 1 commit into
intel:mainfrom
khudson2:win-net-iface-index
Open

khudson2 wants to merge 1 commit into
intel:mainfrom
khudson2:win-net-iface-index

Conversation

@khudson2

Copy link
Copy Markdown

In the mfd-config README, this is listed as a valid configuration:
network_interfaces: # optional
pci_device: 8086:1572:0000:001a # long PCIDevice: vid:did:subvid:subdid
interface_index: 2 # list index

However, which interface this returns varies from run to run.

In Linux, the adapter list comes from lspci, which is sorted by PCI ID, and therefore by port index.

In windows, the adapter list comes from Win32_NetworkAdapter which is in no particular order. That means the adapter index is basically random for windows. In order to make it behave like other operating systems, it should be sorted by PCI address before being returned.

I ran my failing test 10 times and got the same test adapter on SUT and client consistently with this fix.

Copilot AI review requested due to automatic review settings July 28, 2026 23:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes Windows network interface indexing by sorting the returned adapter list by PCI address, aligning Windows behavior with Linux (where lspci ordering is deterministic) so interface_index in topology/config maps consistently to the same physical port.

Changes:

  • Sort Windows _get_all_interfaces_info() results by pci_address (with None placed last).
  • Add a unit test asserting deterministic ordering based on PCI address.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
mfd_network_adapter/network_adapter_owner/windows.py Sorts returned Windows NIC list by PCI address for deterministic interface indexing.
tests/unit/test_mfd_network_adapter/test_network_adapter_owner/test_windows_network_owner.py Adds a unit test to validate sorting behavior of _get_all_interfaces_info().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Kevin J Hudson <kevin.j.hudson@intel.com>
@khudson2
khudson2 force-pushed the win-net-iface-index branch from 2b0eedf to a68518c Compare July 29, 2026 00:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants