[dpdk-dev] [PATCH v1 02/11] drivers/bus/ifpga: add function for AFU search by name

Ferruh Yigit ferruh.yigit at intel.com
Wed Mar 6 13:44:47 CET 2019


On 2/28/2019 7:13 AM, Rosen Xu wrote:
> In many scenarios, AFU is needed searched by name, this
> function add the feature.
> 
> Signed-off-by: Rosen Xu <rosen.xu at intel.com>
> Signed-off-by: Andy Pei <andy.pei at intel.com>
> ---
>  drivers/bus/ifpga/ifpga_bus.c     | 13 +++++++++++++
>  drivers/bus/ifpga/rte_bus_ifpga.h |  3 +++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
> index 55d3abf..dfd6b1f 100644
> --- a/drivers/bus/ifpga/ifpga_bus.c
> +++ b/drivers/bus/ifpga/ifpga_bus.c
> @@ -73,6 +73,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver)
>  	return NULL;
>  }
>  
> +struct rte_afu_device *
> +rte_ifpga_find_afu_by_name(const char *name)
> +{
> +	struct rte_afu_device *afu_dev = NULL;
> +
> +	TAILQ_FOREACH(afu_dev, &ifpga_afu_dev_list, next) {
> +		if (afu_dev &&
> +			!strcmp(afu_dev->device.name, name))
> +			return afu_dev;
> +	}
> +	return NULL;
> +}

I can see this function called from drivers in following patches, did you test
this via shared library build? To be able to called from different library,
should this API needs to be added into .map file?

> +
>  static const char * const valid_args[] = {
>  #define IFPGA_ARG_NAME         "ifpga"
>  	IFPGA_ARG_NAME,
> diff --git a/drivers/bus/ifpga/rte_bus_ifpga.h b/drivers/bus/ifpga/rte_bus_ifpga.h
> index 820eeaa..5762a33 100644
> --- a/drivers/bus/ifpga/rte_bus_ifpga.h
> +++ b/drivers/bus/ifpga/rte_bus_ifpga.h
> @@ -119,6 +119,9 @@ struct rte_afu_driver {
>  	return NULL;
>  }
>  
> +struct rte_afu_device *
> +rte_ifpga_find_afu_by_name(const char *name);

This is public header, can you please add function comments in doxygen format?


More information about the dev mailing list