From ed2547b68fb0b47d2b17ce6a16a5b8f299b0ead4 Mon Sep 17 00:00:00 2001 From: Michael Qiu Date: Wed, 11 Feb 2015 21:25:55 +0800 Subject: [PATCH] pci: fix max VFs for non igb_uio drivers max_vfs will only be created by igb_uio driver, for other drivers like vfio or pci_uio_generic, max_vfs will miss. But sriov_numvfs is not driver related, just get the vf numbers from that field. Signed-off-by: Michael Qiu Acked-by: David Marchand --- lib/librte_eal/linuxapp/eal/eal_pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index b5f54101e8..15db9c4b3b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -272,8 +272,15 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, dev->max_vfs = 0; snprintf(filename, sizeof(filename), "%s/max_vfs", dirname); if (!access(filename, F_OK) && - eal_parse_sysfs_value(filename, &tmp) == 0) { + eal_parse_sysfs_value(filename, &tmp) == 0) dev->max_vfs = (uint16_t)tmp; + else { + /* for non igb_uio driver, need kernel version >= 3.8 */ + snprintf(filename, sizeof(filename), + "%s/sriov_numvfs", dirname); + if (!access(filename, F_OK) && + eal_parse_sysfs_value(filename, &tmp) == 0) + dev->max_vfs = (uint16_t)tmp; } /* get numa node */ -- 2.20.1