mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 15:47:16 -04:00
Expose pci_sriov_get_totalvfs() to Rust PCI drivers so they can query how many SR-IOV VFs a device supports. Use a conditional C helper because the !CONFIG_PCI_IOV version of pci_sriov_get_totalvfs() is a static inline function and is therefore not emitted into the Rust bindings. Return Option<NonZero<u16>> so Rust callers must handle the zero value that represents unavailable SR-IOV. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Cc: Alexandre Courbot <acourbot@nvidia.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: David Laight <david.laight.linux@gmail.com> Cc: Gary Guo <gary@garyguo.net> Cc: linux-pci@vger.kernel.org Link: https://lore.kernel.org/all/DJHPRE4TGGT8.BUTMYOF5YE05@nvidia.com/ Signed-off-by: Zhi Wang <zhiw@nvidia.com> Link: https://patch.msgid.link/20260722073913.1807677-3-zhiw@nvidia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>