From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 06:58:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,412,1511856000"; d="scan'208";a="12966641" Received: from tianfeiz-mobl2.ccr.corp.intel.com (HELO [10.255.28.200]) ([10.255.28.200]) by fmsmga007.fm.intel.com with ESMTP; 25 Jan 2018 06:58:24 -0800 To: "Wu, Jingjing" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "gaetan.rivet@6wind.com" 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> Cc: "Ananyev, Konstantin" , "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "thomas@monjalon.net" , "Zhang, Helin" , "motih@mellanox.com" From: "Guo, Jia" Message-ID: Date: Thu, 25 Jan 2018 22:58:24 +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: <9BB6961774997848B5B42BEC655768F810F180A8@SHSMSX103.ccr.corp.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug 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: Thu, 25 Jan 2018 14:58:28 -0000 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.