eal: modify device event process function
authorJeff Guo <jia.guo@intel.com>
Thu, 4 Oct 2018 06:44:41 +0000 (14:44 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 15 Oct 2018 20:55:55 +0000 (22:55 +0200)
This patch modify the device event callback process function name to be
more explicit, change the variable to be const. And more, because not only
eal device helper will use the callback, but also vfio bus will use the
callback to handle hot-unplug, so exposure the API out from private eal.
The bus drivers and eal device would directly use this API to process
device event callback.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
app/test-pmd/testpmd.c
lib/librte_eal/bsdapp/eal/eal_dev.c
lib/librte_eal/common/eal_common_dev.c
lib/librte_eal/common/eal_private.h
lib/librte_eal/common/include/rte_dev.h
lib/librte_eal/linuxapp/eal/eal_dev.c
lib/librte_eal/rte_eal_version.map

index e8b3fa5..5dbbf78 100644 (file)
@@ -487,7 +487,7 @@ static void check_all_ports_link_status(uint32_t port_mask);
 static int eth_event_callback(portid_t port_id,
                              enum rte_eth_event_type type,
                              void *param, void *ret_param);
-static void eth_dev_event_callback(char *device_name,
+static void eth_dev_event_callback(const char *device_name,
                                enum rte_dev_event_type type,
                                void *param);
 
@@ -2543,7 +2543,7 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 
 /* This function is used by the interrupt thread */
 static void
-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,
                             __rte_unused void *arg)
 {
        uint16_t port_id;
index 255d611..3a3a2a5 100644 (file)
@@ -33,3 +33,11 @@ rte_dev_hotplug_handle_disable(void)
        RTE_LOG(ERR, EAL, "Device event is not supported for FreeBSD\n");
        return -1;
 }
+
+void  __rte_experimental
+rte_dev_event_callback_process(const char *device_name,
+                              enum rte_dev_event_type event)
+{
+       RTE_LOG(ERR, EAL,
+               "Device event callback process is not supported for FreeBSD.\n");
+}
index 7663eaa..1c82f40 100644 (file)
@@ -366,8 +366,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;
 
index 4174d33..535a715 100644 (file)
@@ -258,18 +258,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
index 99e9cc9..9b9c98b 100644 (file)
@@ -39,7 +39,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);
 
@@ -454,6 +454,22 @@ rte_dev_event_callback_unregister(const char *device_name,
                                  rte_dev_event_cb_fn cb_fn,
                                  void *cb_arg);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Executes all the user application registered callbacks for
+ * the specific device.
+ *
+ * @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
index fe662ef..d589c69 100644 (file)
@@ -277,7 +277,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);
        }
 }
 
index 2486c33..ff76c71 100644 (file)
@@ -275,6 +275,7 @@ EXPERIMENTAL {
        rte_class_register;
        rte_class_unregister;
        rte_ctrl_thread_create;
+       rte_dev_event_callback_process;
        rte_dev_event_callback_register;
        rte_dev_event_callback_unregister;
        rte_dev_event_monitor_start;