[v8,02/14] bus/ifpga: add function for AFU search by name

Message ID 1555304823-91456-3-git-send-email-rosen.xu@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series Add patch set for IPN3KE |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xu, Rosen April 15, 2019, 5:06 a.m. UTC
  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 |  6 ++++++
 3 files changed, 28 insertions(+)
  

Comments

Ferruh Yigit April 15, 2019, 12:28 p.m. UTC | #1
On 4/15/2019 6:06 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 |  6 ++++++
>  3 files changed, 28 insertions(+)
> 
> diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
> index 55d3abf..8bfae29 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_experimental
> +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..c00f60e 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_experimental
> +rte_ifpga_find_afu_by_name(const char *name);
> +


Hi Rosen,

This is the bus code, and only drivers will call it right? I think there is no
intention to make this run by application code, the functions need to be
exported because driver and bus are different libraries.
If above correct, there is no point of making the function experimental, can
drop the __rte_experimental tag, and update .map file to not use EXPERIMENTAL.


> +/**
>   * 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..247ccfe 100644
> --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> @@ -8,3 +8,9 @@ DPDK_18.05 {
>  
>  	local: *;
>  };
> +
> +EXPERIMENTAL {
> +    global:
> +
> +    rte_ifpga_find_afu_by_name;
> +};
> \ No newline at end of file
>
  
Xu, Rosen April 15, 2019, 12:37 p.m. UTC | #2
Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, April 15, 2019 20:28
> 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>;
> Thomas Monjalon <thomas@monjalon.net>
> Subject: Re: [PATCH v8 02/14] bus/ifpga: add function for AFU search by
> name
> 
> On 4/15/2019 6:06 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 |  6 ++++++
> >  3 files changed, 28 insertions(+)
> >
> > diff --git a/drivers/bus/ifpga/ifpga_bus.c
> > b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..8bfae29 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_experimental
> > +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..c00f60e 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_experimental
> > +rte_ifpga_find_afu_by_name(const char *name);
> > +
> 
> 
> Hi Rosen,
> 
> This is the bus code, and only drivers will call it right? I think there is no
> intention to make this run by application code, the functions need to be
> exported because driver and bus are different libraries.
> If above correct, there is no point of making the function experimental, can
> drop the __rte_experimental tag, and update .map file to not use
> EXPERIMENTAL.

Yes, above is correct.
I will apply it in v9.

> 
> > +/**
> >   * 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..247ccfe 100644
> > --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > @@ -8,3 +8,9 @@ DPDK_18.05 {
> >
> >  	local: *;
> >  };
> > +
> > +EXPERIMENTAL {
> > +    global:
> > +
> > +    rte_ifpga_find_afu_by_name;
> > +};
> > \ No newline at end of file
> >
  
Xu, Rosen April 16, 2019, 2:50 a.m. UTC | #3
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, April 15, 2019 20:28
> 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>;
> Thomas Monjalon <thomas@monjalon.net>
> Subject: Re: [PATCH v8 02/14] bus/ifpga: add function for AFU search by
> name
> 
> On 4/15/2019 6:06 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 |  6 ++++++
> >  3 files changed, 28 insertions(+)
> >
> > diff --git a/drivers/bus/ifpga/ifpga_bus.c
> > b/drivers/bus/ifpga/ifpga_bus.c index 55d3abf..8bfae29 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_experimental
> > +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..c00f60e 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_experimental
> > +rte_ifpga_find_afu_by_name(const char *name);
> > +
> 
> 
> Hi Rosen,
> 
> This is the bus code, and only drivers will call it right? I think there is no
> intention to make this run by application code, the functions need to be
> exported because driver and bus are different libraries.
> If above correct, there is no point of making the function experimental, can
> drop the __rte_experimental tag, and update .map file to not use
> EXPERIMENTAL.

Hi Ferruh,

Just double confirm with you, if I follow this modification, there is one checkpatch error.

> 
> > +/**
> >   * 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..247ccfe 100644
> > --- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > +++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
> > @@ -8,3 +8,9 @@ DPDK_18.05 {
> >
> >  	local: *;
> >  };
> > +
> > +EXPERIMENTAL {
> > +    global:
> > +
> > +    rte_ifpga_find_afu_by_name;
> > +};
> > \ No newline at end of file
> >
  
Thomas Monjalon April 16, 2019, 8:09 a.m. UTC | #4
16/04/2019 04:50, Xu, Rosen:
> From: Yigit, Ferruh
> > > --- 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_experimental
> > > +rte_ifpga_find_afu_by_name(const char *name);
> > > +
> > 
> > 
> > Hi Rosen,
> > 
> > This is the bus code, and only drivers will call it right? I think there is no
> > intention to make this run by application code, the functions need to be
> > exported because driver and bus are different libraries.
> > If above correct, there is no point of making the function experimental, can
> > drop the __rte_experimental tag, and update .map file to not use
> > EXPERIMENTAL.
> 
> Hi Ferruh,
> 
> Just double confirm with you, if I follow this modification, there is one checkpatch error.

This is a warning, and Ferruh allows it in this case :)
  
Xu, Rosen April 16, 2019, 8:15 a.m. UTC | #5
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Tuesday, April 16, 2019 16:10
> To: Xu, Rosen <rosen.xu@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; 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 v8 02/14] bus/ifpga: add function for AFU search by
> name
> 
> 16/04/2019 04:50, Xu, Rosen:
> > From: Yigit, Ferruh
> > > > --- 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_experimental
> > > > +rte_ifpga_find_afu_by_name(const char *name);
> > > > +
> > >
> > >
> > > Hi Rosen,
> > >
> > > This is the bus code, and only drivers will call it right? I think
> > > there is no intention to make this run by application code, the
> > > functions need to be exported because driver and bus are different
> libraries.
> > > If above correct, there is no point of making the function
> > > experimental, can drop the __rte_experimental tag, and update .map
> > > file to not use EXPERIMENTAL.
> >
> > Hi Ferruh,
> >
> > Just double confirm with you, if I follow this modification, there is one
> checkpatch error.
> 
> This is a warning, and Ferruh allows it in this case :)
> 

Okay Thomas.
  

Patch

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index 55d3abf..8bfae29 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_experimental
+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..c00f60e 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_experimental
+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..247ccfe 100644
--- a/drivers/bus/ifpga/rte_bus_ifpga_version.map
+++ b/drivers/bus/ifpga/rte_bus_ifpga_version.map
@@ -8,3 +8,9 @@  DPDK_18.05 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+    global:
+
+    rte_ifpga_find_afu_by_name;
+};
\ No newline at end of file