From: Michael Qiu Date: Wed, 11 Feb 2015 13:25:55 +0000 (+0800) Subject: pci: fix max VFs for non igb_uio drivers X-Git-Tag: spdx-start~9772 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ed2547b68fb0b47d2b17ce6a16a5b8f299b0ead4;p=dpdk.git 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 --- 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 */