我有一个基于SR-IOV的PCIe设备。我想找一种“受支持”的方法来恢复PCIe PF (物理函数)中的VF(虚拟函数)的数量。我在oracle文档中发现,有一个名为priv_vf_config()的函数可以返回一个结构,该结构包含一个包含vf数量的元素。在用于内核开发的标准linux包含中,是否有这种类型的函数的通用等价物?
发布于 2016-10-19 06:43:01
来自drivers/pci/iov.c
/**
* pci_num_vf - return number of VFs associated with a PF device_release_driver
* @dev: the PCI device
*
* Returns number of VFs, or 0 if SR-IOV is not enabled.
*/
int pci_num_vf(struct pci_dev *dev)在你的模块中包含<linux/pci.h>头来声明上面的函数。
还要确保在内核配置中启用CONFIG_PCI_IOV:
config PCI_IOV
bool "PCI IOV support"
depends on PCI
help
I/O Virtualization is a PCI feature supported by some devices
which allows them to create virtual devices which share their
physical resources.https://stackoverflow.com/questions/40115553
复制相似问题