[dpdk-dev] [PATCH v2 2/3] bus/pci: expose sysfs parsing API

Thomas Monjalon thomas at monjalon.net
Wed Mar 21 21:44:48 CET 2018


21/03/2018 14:21, Xiao Wang:
> Some existing sysfs parsing functions are helpful for the later vDPA
> driver, this patch make them global and expose them to shared lib.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
> ---
>  	/* parse driver */
>  	snprintf(filename, sizeof(filename), "%s/driver", dirname);
> -	ret = pci_get_kernel_driver_by_path(filename, driver);
> +	ret = rte_pci_device_kdriver_name(addr, driver);

I guess the snprintf above becomes useless.

> + * @param dri_name
> + *   Output buffer pointer.

Parameter name and comment can be improved here:
"kdrv_name" would be more meaningful.
As a comment, "Output buffer for kernel driver name"

> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * Parse the "resource" sysfs file.
> + *
> + * @param filename
> + *   The PCI resource file path.
> + * @dev
> + *   Pointer of rte_pci_device object, into which the parse result is recorded.
> + * @return
> + *   0 on success, -1 on error, 1 on no driver found.
> + */
> +int __rte_experimental
> +rte_pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev);

This is a Linux specific API.
Maybe remove "sysfs" and replace "filename" by "resource"?





More information about the dev mailing list