On 1/19/2018 9:13 AM, Thomas Monjalon wrote:
18/01/2018 05:12, Jeff Guo:
+ * It registers the callback for the specific device.
+ * Multiple callbacks cal be registered at the same time.
+ *
+ * @param device_name
+ *  The device name, that is the param name of the struct rte_device,
Why not using rte_device pointer?
sorry, maybe i have address the reason in other patch mail loop but i will explain again. since if use NULL for all device, a callback could not belong to a NULL rte_device pointer.
+ *  null value means for all devices.
I don't see any management of NULL value.
On the contrary, I see
+       if (device_name == NULL)
+               return -EINVAL;
the device_name is from the uevent massage, it should not be null for ever. NULL value for all devices is use the params dev_name in the structure of rte_dev_event_callback, and control by below part of code. if dev->name is null, don't care about the whether the device_name have been registered or not. i think that would be fulfill all new device monitor.

        TAILQ_FOREACH(cb_lst, &(dev_event_cbs), next) {
                if (cb_lst->cb_fn == NULL || (strcmp(cb_lst->dev_name,
                        device_name) && cb_lst->dev_name))
                        continue;
                dev_cb = *cb_lst;


+ * @param cb_fn
+ *  callback address.
+ * @param cb_arg
+ *  address of parameter for callback.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+int rte_dev_callback_register(char *device_name, rte_dev_event_cb_fn cb_fn,
+                                       void *cb_arg);
+



Reply via email to