diff mbox series

eventdev: add PCI probe named convenience function

Message ID 1602528169-14356-1-git-send-email-timothy.mcdaniel@intel.com (mailing list archive)
State Superseded, archived
Headers show
Series eventdev: add PCI probe named convenience function | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/checkpatch warning coding style issues

Commit Message

Timothy McDaniel Oct. 12, 2020, 6:42 p.m. UTC
Add new internal wrapper function for use by pci drivers as a
.probe function to attach to an event interface.  Same as
rte_event_pmd_pci_probe, except the caller can specify the name.

Updated rte_event_pmd_pci_probe so as to not duplicate
code.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 lib/librte_eventdev/rte_eventdev_pmd_pci.h   | 45 ++++++++++++++++++++--------
 lib/librte_eventdev/rte_eventdev_version.map |  1 +
 2 files changed, 33 insertions(+), 13 deletions(-)

Comments

Kinsella, Ray Oct. 14, 2020, 9:31 a.m. UTC | #1
On 12/10/2020 19:42, Timothy McDaniel wrote:
> Add new internal wrapper function for use by pci drivers as a
> .probe function to attach to an event interface.  Same as
> rte_event_pmd_pci_probe, except the caller can specify the name.
> 
> Updated rte_event_pmd_pci_probe so as to not duplicate
> code.

Any reason why this couldn't be __rte_internal then ?

> 
> Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
> ---
>  lib/librte_eventdev/rte_eventdev_pmd_pci.h   | 45 ++++++++++++++++++++--------
>  lib/librte_eventdev/rte_eventdev_version.map |  1 +
>  2 files changed, 33 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev_pmd_pci.h b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
> index a3f9244..4c215f7 100644
> --- a/lib/librte_eventdev/rte_eventdev_pmd_pci.h
> +++ b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
> @@ -32,28 +32,24 @@ typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev);
>  
>  /**
>   * @internal
> - * Wrapper for use by pci drivers as a .probe function to attach to a event
> - * interface.
> + * Wrapper for use by pci drivers as a .probe function to attach to an event
> + * interface.  Same as rte_event_pmd_pci_probe, except caller can specify
> + * the name.
>   */
>  static inline int
> -rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
> -			    struct rte_pci_device *pci_dev,
> -			    size_t private_data_size,
> -			    eventdev_pmd_pci_callback_t devinit)
> +rte_event_pmd_pci_probe_named(struct rte_pci_driver *pci_drv,
> +			      struct rte_pci_device *pci_dev,
> +			      size_t private_data_size,
> +			      eventdev_pmd_pci_callback_t devinit,
> +			      const char *name)
>  {
>  	struct rte_eventdev *eventdev;
> -
> -	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
> -
>  	int retval;
>  
>  	if (devinit == NULL)
>  		return -EINVAL;
>  
> -	rte_pci_device_name(&pci_dev->addr, eventdev_name,
> -			sizeof(eventdev_name));
> -
> -	eventdev = rte_event_pmd_allocate(eventdev_name,
> +	eventdev = rte_event_pmd_allocate(name,
>  			 pci_dev->device.numa_node);
>  	if (eventdev == NULL)
>  		return -ENOMEM;
> @@ -90,6 +86,29 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
>  
>  /**
>   * @internal
> + * Wrapper for use by pci drivers as a .probe function to attach to a event
> + * interface.
> + */
> +static inline int
> +rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
> +			    struct rte_pci_device *pci_dev,
> +			    size_t private_data_size,
> +			    eventdev_pmd_pci_callback_t devinit)
> +{
> +	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
> +
> +	rte_pci_device_name(&pci_dev->addr, eventdev_name,
> +			sizeof(eventdev_name));
> +
> +	return rte_event_pmd_pci_probe_named(pci_drv,
> +					     pci_dev,
> +					     private_data_size,
> +					     devinit,
> +					     eventdev_name);
> +}
> +
> +/**
> + * @internal
>   * Wrapper for use by pci drivers as a .remove function to detach a event
>   * interface.
>   */
> diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
> index 2846d04..88fb2bd 100644
> --- a/lib/librte_eventdev/rte_eventdev_version.map
> +++ b/lib/librte_eventdev/rte_eventdev_version.map
> @@ -57,6 +57,7 @@ DPDK_21 {
>  	rte_event_eth_tx_adapter_stop;
>  	rte_event_pmd_allocate;
>  	rte_event_pmd_pci_probe;
> +	rte_event_pmd_pci_probe_named;
>  	rte_event_pmd_pci_remove;
>  	rte_event_pmd_release;
>  	rte_event_pmd_vdev_init;
>
Eads, Gage Oct. 14, 2020, 3:37 p.m. UTC | #2
> -----Original Message-----
> From: Kinsella, Ray <mdr@ashroe.eu>
> Sent: Wednesday, October 14, 2020 4:31 AM
> To: McDaniel, Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob
> <jerinj@marvell.com>; Neil Horman <nhorman@tuxdriver.com>
> Cc: dev@dpdk.org; Carrillo, Erik G <erik.g.carrillo@intel.com>; Eads, Gage
> <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>
> Subject: Re: [PATCH] eventdev: add PCI probe named convenience function
> 
> 
> 
> On 12/10/2020 19:42, Timothy McDaniel wrote:
> > Add new internal wrapper function for use by pci drivers as a
> > .probe function to attach to an event interface.  Same as
> > rte_event_pmd_pci_probe, except the caller can specify the name.
> >
> > Updated rte_event_pmd_pci_probe so as to not duplicate
> > code.
> 
> Any reason why this couldn't be __rte_internal then ?

On a related note...should a static function defined in an internal header file
be included the version.map file? Doesn't that only pertain to symbols in the
.so? Probably harmless if so, but now may be a good time to correct it.

Thanks,
Gage
Kinsella, Ray Oct. 16, 2020, 11:26 a.m. UTC | #3
On 14/10/2020 16:37, Eads, Gage wrote:
> 
> 
>> -----Original Message-----
>> From: Kinsella, Ray <mdr@ashroe.eu>
>> Sent: Wednesday, October 14, 2020 4:31 AM
>> To: McDaniel, Timothy <timothy.mcdaniel@intel.com>; Jerin Jacob
>> <jerinj@marvell.com>; Neil Horman <nhorman@tuxdriver.com>
>> Cc: dev@dpdk.org; Carrillo, Erik G <erik.g.carrillo@intel.com>; Eads, Gage
>> <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>
>> Subject: Re: [PATCH] eventdev: add PCI probe named convenience function
>>
>>
>>
>> On 12/10/2020 19:42, Timothy McDaniel wrote:
>>> Add new internal wrapper function for use by pci drivers as a
>>> .probe function to attach to an event interface.  Same as
>>> rte_event_pmd_pci_probe, except the caller can specify the name.
>>>
>>> Updated rte_event_pmd_pci_probe so as to not duplicate
>>> code.
>>
>> Any reason why this couldn't be __rte_internal then ?
> 
> On a related note...should a static function defined in an internal header file
> be included the version.map file? Doesn't that only pertain to symbols in the
> .so? Probably harmless if so, but now may be a good time to correct it.

Good catch.

> Thanks,
> Gage
>
diff mbox series

Patch

diff --git a/lib/librte_eventdev/rte_eventdev_pmd_pci.h b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
index a3f9244..4c215f7 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd_pci.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd_pci.h
@@ -32,28 +32,24 @@  typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev);
 
 /**
  * @internal
- * Wrapper for use by pci drivers as a .probe function to attach to a event
- * interface.
+ * Wrapper for use by pci drivers as a .probe function to attach to an event
+ * interface.  Same as rte_event_pmd_pci_probe, except caller can specify
+ * the name.
  */
 static inline int
-rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
-			    struct rte_pci_device *pci_dev,
-			    size_t private_data_size,
-			    eventdev_pmd_pci_callback_t devinit)
+rte_event_pmd_pci_probe_named(struct rte_pci_driver *pci_drv,
+			      struct rte_pci_device *pci_dev,
+			      size_t private_data_size,
+			      eventdev_pmd_pci_callback_t devinit,
+			      const char *name)
 {
 	struct rte_eventdev *eventdev;
-
-	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
-
 	int retval;
 
 	if (devinit == NULL)
 		return -EINVAL;
 
-	rte_pci_device_name(&pci_dev->addr, eventdev_name,
-			sizeof(eventdev_name));
-
-	eventdev = rte_event_pmd_allocate(eventdev_name,
+	eventdev = rte_event_pmd_allocate(name,
 			 pci_dev->device.numa_node);
 	if (eventdev == NULL)
 		return -ENOMEM;
@@ -90,6 +86,29 @@  rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
 
 /**
  * @internal
+ * Wrapper for use by pci drivers as a .probe function to attach to a event
+ * interface.
+ */
+static inline int
+rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
+			    struct rte_pci_device *pci_dev,
+			    size_t private_data_size,
+			    eventdev_pmd_pci_callback_t devinit)
+{
+	char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN];
+
+	rte_pci_device_name(&pci_dev->addr, eventdev_name,
+			sizeof(eventdev_name));
+
+	return rte_event_pmd_pci_probe_named(pci_drv,
+					     pci_dev,
+					     private_data_size,
+					     devinit,
+					     eventdev_name);
+}
+
+/**
+ * @internal
  * Wrapper for use by pci drivers as a .remove function to detach a event
  * interface.
  */
diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
index 2846d04..88fb2bd 100644
--- a/lib/librte_eventdev/rte_eventdev_version.map
+++ b/lib/librte_eventdev/rte_eventdev_version.map
@@ -57,6 +57,7 @@  DPDK_21 {
 	rte_event_eth_tx_adapter_stop;
 	rte_event_pmd_allocate;
 	rte_event_pmd_pci_probe;
+	rte_event_pmd_pci_probe_named;
 	rte_event_pmd_pci_remove;
 	rte_event_pmd_release;
 	rte_event_pmd_vdev_init;