Skip to content

link: add support for IFLA_VFINFO_LIST and IFLA_VF_STATS#295

Merged
jsimonetti merged 1 commit intojsimonetti:masterfrom
aharivel:sriov
Feb 8, 2026
Merged

link: add support for IFLA_VFINFO_LIST and IFLA_VF_STATS#295
jsimonetti merged 1 commit intojsimonetti:masterfrom
aharivel:sriov

Conversation

@aharivel
Copy link
Copy Markdown
Contributor

Add support for decoding Virtual Function (VF) information from netlink messages. This enables users to retrieve SR-IOV VF details when querying network interfaces.

The implementation adds:

  • VFStats struct containing per-VF traffic statistics (packets, bytes, broadcast, multicast, dropped counters for both RX and TX)
  • VFInfo struct containing VF configuration (MAC address, VLAN, QoS, TX rate limits, spoof check, link state, RSS query, trust settings)
  • VFLinkState type with Auto/Enable/Disable constants
  • NumVF and VFInfoList fields to LinkAttributes
  • Decoding logic for IFLA_NUM_VF and IFLA_VFINFO_LIST nested attributes

The VF information follows the kernel's nested attribute structure.

This is useful for monitoring and managing SR-IOV enabled network interfaces where the Physical Function (PF) exposes multiple Virtual Functions to guest VMs or containers.

@jsimonetti
Copy link
Copy Markdown
Owner

Hi @aharivel ,
Thank you for this contribution.
I have no way to actually test this for real, but it looks good.

It looks like you forgot to gofmt some files. Could you fix that please?

Add support for decoding Virtual Function (VF) information from netlink
messages. This enables users to retrieve SR-IOV VF details when querying
network interfaces.

The implementation adds:
- VFStats struct containing per-VF traffic statistics (packets, bytes,
  broadcast, multicast, dropped counters for both RX and TX)
- VFInfo struct containing VF configuration (MAC address, VLAN, QoS,
  TX rate limits, spoof check, link state, RSS query, trust settings)
- VFLinkState type with Auto/Enable/Disable constants
- NumVF and VFInfoList fields to LinkAttributes
- Decoding logic for IFLA_NUM_VF and IFLA_VFINFO_LIST nested attributes

The VF information follows the kernel's nested attribute structure.

This is useful for monitoring and managing SR-IOV enabled network
interfaces where the Physical Function (PF) exposes multiple Virtual
Functions to guest VMs or containers.

Signed-off-by: Anthony Harivel <[email protected]>
@aharivel
Copy link
Copy Markdown
Contributor Author

aharivel commented Feb 2, 2026

Hi @jsimonetti
My apology for the linter issue, this should now be solved.
I've tested with Intel E810 and Mellanox CX6 NIC both binded with the kernel driver and the VFIO_PCI driver.
If you require output of my testing app, just let me know.

My end goal is to enhance Prometheus node_exporter that is using your library.
( https://github.com/prometheus/node_exporter/blob/master/collector/netdev_linux.go )

@jsimonetti
Copy link
Copy Markdown
Owner

Thank you for the contribution!

@jsimonetti jsimonetti merged commit b3f5422 into jsimonetti:master Feb 8, 2026
8 checks passed
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