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

Qiu, Michael michael.qiu at intel.com
Wed Feb 11 14:27:50 CET 2015


[+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 at 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 */



More information about the dev mailing list