cilium/cilium · error

pf kernel ifname for device %s: %w

Error message

pf kernel ifname for device %s: %w

What it means

In parseDevice, after resolving the VF's parent PF PCI address from sysfs, the manager looks up the PF's netlink attributes by PCI address; if absent it cannot determine the PF kernel interface name and fails with errInterfaceNotFound. The PF netdev either doesn't exist or wasn't enumerated.

Source

Thrown at pkg/networkdriver/sriov/sriov.go:471

	dev.Vendor = strings.TrimSpace(string(vendor))

	device, err := os.ReadFile(filepath.Join(devicePath, "device"))
	if err != nil {
		return nil, err
	}
	dev.DeviceID = strings.TrimSpace(string(device))

	pfPath, err := os.Readlink(filepath.Join(devicePath, "physfn"))
	if err != nil {
		// this is not a vf
		return nil, errNotAVF
	}

	pfAddr := filepath.Base(pfPath)

	pfAttrs, ok := netlinkAttrs[PCIAddr(pfAddr)]
	if !ok {
		return nil, fmt.Errorf("pf kernel ifname for device %s: %w", pfAddr, errInterfaceNotFound)
	}

	dev.PFName = pfAttrs.Name
	pfDevPath := filepath.Join(mgr.pciDevicesPath(), pfAddr)

	// to resolve the VF id, we iterate over all VFs under the PF attributes
	// and map the ids to the `virtfn$x` path under the pf device.
	// if the path linked matches the path of our vf address, then we found the id.
	for _, vf := range pfAttrs.Vfs {
		// root@c3-small-x86-01-bernardo:/sys/class/net/enp2s0f0np0/device# readlink virtfn0
		// ../0000:02:00.2
		// root@c3-small-x86-01-bernardo:/sys/class/net/enp2s0f0np0/device# readlink virtfn1
		// ../0000:02:00.3
		v, err := os.Readlink(filepath.Join(pfDevPath, fmt.Sprintf("virtfn%d", vf.ID)))
		if err != nil {
			continue
		}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Verify the PF has a kernel netdev: ls /sys/bus/pci/devices/<pf-addr>/net/.
  2. If the PF must be kernel-managed, rebind it to its NIC driver (e.g. mlx5_core) instead of vfio-pci.
  3. Re-run discovery after the PF netdev is registered; boot-time races resolve once links are up.
  4. Check the manager's sysfs root (/host/sys) is mounted correctly in the container.
Defensive patterns

Strategy: validation

Validate before calling

pfNet := "/sys/bus/pci/devices/" + pfAddr + "/net"
if entries, err := os.ReadDir(pfNet); err != nil || len(entries) == 0 {
    return fmt.Errorf("PF %s has no kernel netdev; SR-IOV discovery will fail", pfAddr)
}

Try / catch

devices, err := mgr.ListDevices(ctx)
if err != nil {
    if errors.Is(err, sriov.ErrInterfaceNotFound) {
        // PF bound to userspace driver or missing; alert and re-run after fix
    }
    return err
}

Prevention

When it happens

Trigger: Discovering a VF whose parent PF's PCI address is not in the pciAddr→netlink-attrs map built from LinkList — PF netdev missing, PF bound to a non-netdev driver (vfio-pci), or safenetlink.LinkList failing to return the PF.

Common situations: PF bound to DPDK drivers so no kernel interface exists; BIOS/boot option disabling the PF netdev; netlink enumeration race during node boot; sysfs mounted at a non-standard path so ParentDev resolution mismatches.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/29e2bb657952be51. Report an issue: GitHub.