From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D7B9E9AA8 for ; Wed, 11 Feb 2015 14:26:04 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 11 Feb 2015 05:21:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,558,1418112000"; d="scan'208";a="525964796" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 11 Feb 2015 05:17:54 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1BDQ0oW021417; Wed, 11 Feb 2015 21:26:00 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1BDPumK016683; Wed, 11 Feb 2015 21:25:58 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1BDPuvs016676; Wed, 11 Feb 2015 21:25:56 +0800 From: Michael Qiu To: dev@dpdk.org Date: Wed, 11 Feb 2015 21:25:55 +0800 Message-Id: <1423661155-16645-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1423653001-11660-1-git-send-email-michael.qiu@intel.com> References: <1423653001-11660-1-git-send-email-michael.qiu@intel.com> Subject: [dpdk-dev] [PATCH v2] eal_pci: Fix max_vfs missing for none igb_uio driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2015 13:26:05 -0000 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 --- v2 --> v1: backport for kernel version less than 3.8 lib/librte_eal/linuxapp/eal/eal_pci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index b5f5410..fcf5511 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -272,8 +272,16 @@ 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 none igb_uio driver, need kernel + * version greater than 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 */ -- 1.9.3