From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Guo, Jia" Subject: Re: [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug Date: Thu, 25 Jan 2018 22:58:24 +0800 Message-ID: References: <1516013331-18939-3-git-send-email-jia.guo@intel.com> <1516248723-16985-1-git-send-email-jia.guo@intel.com> <1516248723-16985-3-git-send-email-jia.guo@intel.com> <9BB6961774997848B5B42BEC655768F810F180A8@SHSMSX103.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "Ananyev, Konstantin" , "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "thomas@monjalon.net" , "Zhang, Helin" , "motih@mellanox.com" To: "Wu, Jingjing" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "gaetan.rivet@6wind.com" Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C41C4199AC for ; Thu, 25 Jan 2018 15:58:27 +0100 (CET) In-Reply-To: <9BB6961774997848B5B42BEC655768F810F180A8@SHSMSX103.ccr.corp.intel.com> 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/24/2018 11:21 PM, Wu, Jingjing wrote: >> + >> +static void >> +add_uevent_callback(void *arg) >> +{ >> + char *dev_name = (char *)arg; >> + >> + rte_eal_alarm_cancel(add_uevent_callback, arg); >> + >> + if (!in_hotplug_list(dev_name)) >> + return; >> + >> + RTE_LOG(ERR, EAL, "add device: %s\n", dev_name); > It's not an error, replace by printf? sure. >> + attach_port(dev_name); >> +} >> + >> /* This function is used by the interrupt thread */ >> static int >> eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, >> @@ -1931,6 +2014,82 @@ eth_event_callback(portid_t port_id, enum >> rte_eth_event_type type, void *param, >> } >> >> static int >> +in_hotplug_list(const char *dev_name) >> +{ >> + struct hotplug_request *hp_request = NULL; >> + >> + TAILQ_FOREACH(hp_request, &hp_list, next) { >> + if (!strcmp(hp_request->dev_name, dev_name)) >> + break; >> + } >> + >> + if (hp_request) >> + return 1; >> + > Is it better to use TRUE and FALSE? ok,make sense.