[v1,3/5] eal: modify device event callback process func

Message ID 1534503091-31910-4-git-send-email-jia.guo@intel.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • Enable hotplug in vfio
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/checkpatch success coding style OK

Commit Message

Jeff Guo Aug. 17, 2018, 10:51 a.m.
This patch modify the device event callback process function name to be
more explicit, and exposure the API from private to public. The drivers
and apps would directly use this API to process device event callback.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
---
 lib/librte_eal/common/eal_common_dev.c  |  5 +++--
 lib/librte_eal/common/eal_private.h     | 12 ------------
 lib/librte_eal/common/include/rte_dev.h | 19 ++++++++++++++++++-
 lib/librte_eal/linuxapp/eal/eal_dev.c   |  2 +-
 lib/librte_ethdev/rte_ethdev.c          |  2 +-
 5 files changed, 23 insertions(+), 17 deletions(-)

Comments

Anatoly Burakov Sept. 26, 2018, 12:20 p.m. | #1
On 17-Aug-18 11:51 AM, Jeff Guo wrote:
> This patch modify the device event callback process function name to be
> more explicit, and exposure the API from private to public. The drivers
> and apps would directly use this API to process device event callback.
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> ---

<snip>

> -typedef void (*rte_dev_event_cb_fn)(char *device_name,
> +typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>   					enum rte_dev_event_type event,
>   					void *cb_arg);
>   
> @@ -439,6 +439,23 @@ rte_dev_event_callback_unregister(const char *device_name,
>    * @warning
>    * @b EXPERIMENTAL: this API may change without prior notice
>    *
> + * Internal Executes all the user application registered callbacks for

it probably should say @internal instead of "Internal", with comment 
starting on a new line.
Anatoly Burakov Sept. 26, 2018, 12:20 p.m. | #2
On 17-Aug-18 11:51 AM, Jeff Guo wrote:
> This patch modify the device event callback process function name to be
> more explicit, and exposure the API from private to public. The drivers
> and apps would directly use this API to process device event callback.
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> ---

<snip>

>    *
> + * Internal Executes all the user application registered callbacks for
> + * the specific device. It is for DPDK internal user only. User
> + * application should not call it directly.
> + *
> + * @param device_name
> + *  The device name.
> + * @param event
> + *  the device event type.
> + */
> +void  __rte_experimental
> +rte_dev_event_callback_process(const char *device_name,
> +			       enum rte_dev_event_type event);

Also, you've exported it but haven't added it to the .map file.
Jeff Guo Sept. 30, 2018, 10:30 a.m. | #3
On 9/26/2018 8:20 PM, Burakov, Anatoly wrote:
> On 17-Aug-18 11:51 AM, Jeff Guo wrote:
>> This patch modify the device event callback process function name to be
>> more explicit, and exposure the API from private to public. The drivers
>> and apps would directly use this API to process device event callback.
>>
>> Signed-off-by: Jeff Guo <jia.guo@intel.com>
>> ---
>
> <snip>
>
>> -typedef void (*rte_dev_event_cb_fn)(char *device_name,
>> +typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>>                       enum rte_dev_event_type event,
>>                       void *cb_arg);
>>   @@ -439,6 +439,23 @@ rte_dev_event_callback_unregister(const char 
>> *device_name,
>>    * @warning
>>    * @b EXPERIMENTAL: this API may change without prior notice
>>    *
>> + * Internal Executes all the user application registered callbacks for
>
> it probably should say @internal instead of "Internal", with comment 
> starting on a new line.
>

yes, you are here, and what i want is make it internal.
Jeff Guo Sept. 30, 2018, 10:31 a.m. | #4
On 9/26/2018 8:20 PM, Burakov, Anatoly wrote:
> On 17-Aug-18 11:51 AM, Jeff Guo wrote:
>> This patch modify the device event callback process function name to be
>> more explicit, and exposure the API from private to public. The drivers
>> and apps would directly use this API to process device event callback.
>>
>> Signed-off-by: Jeff Guo <jia.guo@intel.com>
>> ---
>
> <snip>
>
>>    *
>> + * Internal Executes all the user application registered callbacks for
>> + * the specific device. It is for DPDK internal user only. User
>> + * application should not call it directly.
>> + *
>> + * @param device_name
>> + *  The device name.
>> + * @param event
>> + *  the device event type.
>> + */
>> +void  __rte_experimental
>> +rte_dev_event_callback_process(const char *device_name,
>> +                   enum rte_dev_event_type event);
>
> Also, you've exported it but haven't added it to the .map file.
>

what i want is make it internal use, so i will modify the typo.

Patch

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 678dbca..2d610a4 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -342,8 +342,9 @@  rte_dev_event_callback_unregister(const char *device_name,
 	return ret;
 }
 
-void
-dev_callback_process(char *device_name, enum rte_dev_event_type event)
+void __rte_experimental
+rte_dev_event_callback_process(const char *device_name,
+			       enum rte_dev_event_type event)
 {
 	struct dev_event_callback *cb_lst;
 
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 3cf0357..8758f2b 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -259,18 +259,6 @@  struct rte_bus *rte_bus_find_by_device_name(const char *str);
 int rte_mp_channel_init(void);
 
 /**
- * Internal Executes all the user application registered callbacks for
- * the specific device. It is for DPDK internal user only. User
- * application should not call it directly.
- *
- * @param device_name
- *  The device name.
- * @param event
- *  the device event type.
- */
-void dev_callback_process(char *device_name, enum rte_dev_event_type event);
-
-/**
  * @internal
  * Parse a device string and store its information in an
  * rte_devargs structure.
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 0324c84..f35ba22 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -40,7 +40,7 @@  struct rte_dev_event {
 	char *devname;			/**< device name */
 };
 
-typedef void (*rte_dev_event_cb_fn)(char *device_name,
+typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
 
@@ -439,6 +439,23 @@  rte_dev_event_callback_unregister(const char *device_name,
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
  *
+ * Internal Executes all the user application registered callbacks for
+ * the specific device. It is for DPDK internal user only. User
+ * application should not call it directly.
+ *
+ * @param device_name
+ *  The device name.
+ * @param event
+ *  the device event type.
+ */
+void  __rte_experimental
+rte_dev_event_callback_process(const char *device_name,
+			       enum rte_dev_event_type event);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
  * Start the device event monitoring.
  *
  * @return
diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index fa5cb9b..09079ea 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
@@ -270,7 +270,7 @@  dev_uev_handler(__rte_unused void *param)
 				return;
 			}
 		}
-		dev_callback_process(uevent.devname, uevent.type);
+		rte_dev_event_callback_process(uevent.devname, uevent.type);
 	}
 }
 
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index d68bd4c..da1e9a6 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -4418,7 +4418,7 @@  rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
 }
 
 static void __rte_experimental
-eth_dev_event_callback(char *device_name, enum rte_dev_event_type type,
+eth_dev_event_callback(const char *device_name, enum rte_dev_event_type type,
 		       void *arg)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)arg;