Message ID | 1423661155-16645-1-git-send-email-michael.qiu@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id DC1529AAA; Wed, 11 Feb 2015 14:26:06 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D7B9E9AA8 for <dev@dpdk.org>; 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 <michael.qiu@intel.com> 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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Michael Qiu
Feb. 11, 2015, 1:25 p.m. UTC
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 <michael.qiu@intel.com>
---
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(-)
Comments
[+cc] David On 2/11/2015 9:26 PM, Qiu, Michael wrote: > 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 <michael.qiu@intel.com> > --- > 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 */
On Wed, Feb 11, 2015 at 2:25 PM, Michael Qiu <michael.qiu@intel.com> wrote: > 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 <michael.qiu@intel.com> > --- > 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 */ > I can see a different solution : maybe faking a sriov_numvfs parameter from igb_uio for kernels that don't have it and doing nothing for kernels that already provide sriov_numvfs. But your solution is more straightforward (and we don't need to update documentation and/or existing scripts afaik). Acked-by: David Marchand <david.marchand@6wind.com>
2015-02-11 21:25, Michael Qiu: > 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 <michael.qiu@intel.com> [...] > 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 I think it's a typo. Do you mean "for non igb_uio driver"? > + * 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 */ >
On 2/13/2015 12:26 AM, Thomas Monjalon wrote: > 2015-02-11 21:25, Michael Qiu: >> 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 <michael.qiu@intel.com> > [...] >> 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 > I think it's a typo. Do you mean "for non igb_uio driver"? Hi, Thomas Yes, you are right. Did I need to send out V3 patch for this typo? Thanks, Michael > >> + * 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 */ >> >
On 2/12/2015 1:50 PM, David Marchand wrote: > On Wed, Feb 11, 2015 at 2:25 PM, Michael Qiu <michael.qiu@intel.com > <mailto:michael.qiu@intel.com>> wrote: > > 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 <michael.qiu@intel.com > <mailto:michael.qiu@intel.com>> > --- > 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 */ > > > I can see a different solution : maybe faking a sriov_numvfs parameter > from igb_uio for kernels that don't have it and doing nothing for > kernels that already provide sriov_numvfs. Yes, your solution is much more better, but little complex. My solution can be a quick fix. > But your solution is more straightforward (and we don't need to update > documentation and/or existing scripts afaik). > > Acked-by: David Marchand <david.marchand@6wind.com > <mailto:david.marchand@6wind.com>> > Thanks David for reviewing this patch and your good comments Thanks, Michale > -- > David Marchand
2015-02-13 02:56, Qiu, Michael: > On 2/13/2015 12:26 AM, Thomas Monjalon wrote: > > 2015-02-11 21:25, Michael Qiu: > >> 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 <michael.qiu@intel.com> > > [...] > >> 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 > > I think it's a typo. Do you mean "for non igb_uio driver"? > > Hi, Thomas > > Yes, you are right. > > Did I need to send out V3 patch for this typo? No, thanks. Your agreement is enough. I'll fix it.
> > 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 <michael.qiu@intel.com> > > I can see a different solution : maybe faking a sriov_numvfs parameter from > igb_uio for kernels that don't have it and doing nothing for kernels that > already provide sriov_numvfs. > But your solution is more straightforward (and we don't need to update > documentation and/or existing scripts afaik). > > Acked-by: David Marchand <david.marchand@6wind.com> Applied, thanks
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 */