From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2018 18:51:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,380,1511856000"; d="scan'208";a="194555463" Received: from jguo15x-mobl3.ccr.corp.intel.com (HELO [10.67.68.50]) ([10.67.68.50]) by orsmga005.jf.intel.com with ESMTP; 18 Jan 2018 18:51:10 -0800 To: Thomas Monjalon References: <1516013331-18939-3-git-send-email-jia.guo@intel.com> <1516248723-16985-1-git-send-email-jia.guo@intel.com> <3568576.lheXnZb7QM@xps> 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 From: "Guo, Jia" Message-ID: <2a12c3e3-50a0-9f82-bd41-3d6fce4705aa@intel.com> Date: Fri, 19 Jan 2018 10:51:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <3568576.lheXnZb7QM@xps> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH V12 1/3] eal: add uevent monitor api and callback func X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2018 02:51:14 -0000 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); >> + > >