From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wu, Jingjing" Subject: Re: [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug Date: Wed, 24 Jan 2018 15:21:04 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810F180A8@SHSMSX103.ccr.corp.intel.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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "Ananyev, Konstantin" , "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "thomas@monjalon.net" , "Zhang, Helin" , "motih@mellanox.com" To: "Guo, Jia" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "gaetan.rivet@6wind.com" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 71CA91B016 for ; Wed, 24 Jan 2018 16:21:06 +0100 (CET) In-Reply-To: <1516248723-16985-3-git-send-email-jia.guo@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > + > +static void > +add_uevent_callback(void *arg) > +{ > + char *dev_name =3D (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? > + 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, > } >=20 > static int > +in_hotplug_list(const char *dev_name) > +{ > + struct hotplug_request *hp_request =3D 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?