From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Guo, Jia" Subject: Re: [PATCH V12 1/3] eal: add uevent monitor api and callback func Date: Fri, 19 Jan 2018 10:51:10 +0800 Message-ID: <2a12c3e3-50a0-9f82-bd41-3d6fce4705aa@intel.com> References: <1516013331-18939-3-git-send-email-jia.guo@intel.com> <1516248723-16985-1-git-send-email-jia.guo@intel.com> <3568576.lheXnZb7QM@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, stephen@networkplumber.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, gaetan.rivet@6wind.com, konstantin.ananyev@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, jingjing.wu@intel.com, helin.zhang@intel.com, motih@mellanox.com To: Thomas Monjalon Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E25601B2DF for ; Fri, 19 Jan 2018 03:51:13 +0100 (CET) In-Reply-To: <3568576.lheXnZb7QM@xps> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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); >> + > >