[v9,02/14] bus/ifpga: add function for AFU search by name
Checks
Commit Message
In many scenarios, AFU is needed searched by name, this
function add the feature.
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
drivers/bus/ifpga/ifpga_bus.c | 13 +++++++++++++
drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++
drivers/bus/ifpga/rte_bus_ifpga_version.map | 9 +++++++++
3 files changed, 31 insertions(+)
Comments
On 4/16/2019 4:17 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@intel.com>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
> drivers/bus/ifpga/ifpga_bus.c | 13 +++++++++++++
> drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++
> drivers/bus/ifpga/rte_bus_ifpga_version.map | 9 +++++++++
> 3 files changed, 31 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;
> +}
> +
> 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..88a6289 100644
> --- a/drivers/bus/ifpga/rte_bus_ifpga.h
> +++ b/drivers/bus/ifpga/rte_bus_ifpga.h
> @@ -120,6 +120,15 @@ struct rte_afu_driver {
> }
>
> /**
> + * Find AFU by AFU name.
> + *
> + * @param name
> + * A pointer to AFU name string.
> + */
> +struct rte_afu_device *
> +rte_ifpga_find_afu_by_name(const char *name);
> +
> +/**
> * Register a ifpga afu device driver.
> *
> * @param driver
> diff --git a/drivers/bus/ifpga/rte_bus_ifpga_version.map b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> index a027979..51b1353 100644
> --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> @@ -8,3 +8,12 @@ DPDK_18.05 {
>
> local: *;
> };
> +
> +DPDK_19.05 {
> + global:
> +
> + rte_ifpga_find_afu_by_name;
> +
> + local: *;
> +};
> +
syntax is slightly different [1] but I can fix while merging.
[1]
DPDK_19.05 {
global:
rte_ifpga_find_afu_by_name;
} DPDK_18.05;
no 'local: *;' except first one, and later ones has a reference at the end of
the block 'DPDK_18.05;'
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, April 16, 2019 16:48
> To: Xu, Rosen <rosen.xu@intel.com>; dev@dpdk.org
> Cc: Zhang, Tianfei <tianfei.zhang@intel.com>; Wei, Dan
> <dan.wei@intel.com>; Pei, Andy <andy.pei@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>; Chen,
> Santos <santos.chen@intel.com>; Zhang, Zhang <zhang.zhang@intel.com>;
> Lomartire, David <david.lomartire@intel.com>; Hu, Jia <jia.hu@intel.com>
> Subject: Re: [PATCH v9 02/14] bus/ifpga: add function for AFU search by
> name
>
> On 4/16/2019 4:17 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@intel.com>
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> > drivers/bus/ifpga/ifpga_bus.c | 13 +++++++++++++
> > drivers/bus/ifpga/rte_bus_ifpga.h | 9 +++++++++
> > drivers/bus/ifpga/rte_bus_ifpga_version.map | 9 +++++++++
> > 3 files changed, 31 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;
> > +}
> > +
> > 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..88a6289 100644
> > --- a/drivers/bus/ifpga/rte_bus_ifpga.h
> > +++ b/drivers/bus/ifpga/rte_bus_ifpga.h
> > @@ -120,6 +120,15 @@ struct rte_afu_driver { }
> >
> > /**
> > + * Find AFU by AFU name.
> > + *
> > + * @param name
> > + * A pointer to AFU name string.
> > + */
> > +struct rte_afu_device *
> > +rte_ifpga_find_afu_by_name(const char *name);
> > +
> > +/**
> > * Register a ifpga afu device driver.
> > *
> > * @param driver
> > diff --git a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > index a027979..51b1353 100644
> > --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > @@ -8,3 +8,12 @@ DPDK_18.05 {
> >
> > local: *;
> > };
> > +
> > +DPDK_19.05 {
> > + global:
> > +
> > + rte_ifpga_find_afu_by_name;
> > +
> > + local: *;
> > +};
> > +
>
> syntax is slightly different [1] but I can fix while merging.
Thanks Ferruh.
> [1]
> DPDK_19.05 {
> global:
>
> rte_ifpga_find_afu_by_name;
>
> } DPDK_18.05;
>
> no 'local: *;' except first one, and later ones has a reference at the end of the
> block 'DPDK_18.05;'
@@ -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;
+}
+
static const char * const valid_args[] = {
#define IFPGA_ARG_NAME "ifpga"
IFPGA_ARG_NAME,
@@ -120,6 +120,15 @@ struct rte_afu_driver {
}
/**
+ * Find AFU by AFU name.
+ *
+ * @param name
+ * A pointer to AFU name string.
+ */
+struct rte_afu_device *
+rte_ifpga_find_afu_by_name(const char *name);
+
+/**
* Register a ifpga afu device driver.
*
* @param driver
@@ -8,3 +8,12 @@ DPDK_18.05 {
local: *;
};
+
+DPDK_19.05 {
+ global:
+
+ rte_ifpga_find_afu_by_name;
+
+ local: *;
+};
+