diff mbox

[dpdk-dev] eal_pci: Fix max_vfs missing for none igb_uio driver

Message ID 1423653001-11660-1-git-send-email-michael.qiu@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Michael Qiu Feb. 11, 2015, 11:10 a.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>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Marchand Feb. 11, 2015, 12:32 p.m. UTC | #1
Hello Michael,

On Wed, Feb 11, 2015 at 12:10 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>
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c
> b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index 1f43688..3da4b69 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -305,7 +305,7 @@ pci_scan_one(const char *dirname, uint16_t domain,
> uint8_t bus,
>
>         /* get max_vfs */
>         dev->max_vfs = 0;
> -       snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
> +       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;
>
>
Not too sure about this change.
Quickly looked, and as far as I can see, sriov_numvfs has been introduced
by 1789382a ("PCI: SRIOV control and status via sysfs").

Won't your change break anything that uses a kernel < 3.8 (not backported) ?
Michael Qiu Feb. 11, 2015, 12:41 p.m. UTC | #2
On 2/11/2015 8:32 PM, David Marchand wrote:
> Hello Michael, 
>
> On Wed, Feb 11, 2015 at 12:10 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>>
>     ---
>      lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +-
>      1 file changed, 1 insertion(+), 1 deletion(-)
>
>     diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c
>     b/lib/librte_eal/linuxapp/eal/eal_pci.c
>     index 1f43688..3da4b69 100644
>     --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
>     +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
>     @@ -305,7 +305,7 @@ pci_scan_one(const char *dirname, uint16_t
>     domain, uint8_t bus,
>
>             /* get max_vfs */
>             dev->max_vfs = 0;
>     -       snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
>     +       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;
>
>
> Not too sure about this change.
> Quickly looked, and as far as I can see, sriov_numvfs has been
> introduced by 1789382a ("PCI: SRIOV control and status via sysfs").
>
> Won't your change break anything that uses a kernel < 3.8 (not
> backported) ?

OK, you are right, I will fix this in v2, actually it will break nothing
as the code already done accessing check.

But not enough, for kernel version less than 3.8 and driver is igb_uio,
it is indeed not suitable for leaving max_vfs zero.

BTW, for kernel version less than 3.8 and driver is vfio or
pci_uio_generic, how could we fill this field?

Thanks,
Michael
>
>
> -- 
> David Marchand
diff mbox

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 1f43688..3da4b69 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -305,7 +305,7 @@  pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 
 	/* get max_vfs */
 	dev->max_vfs = 0;
-	snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
+	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;