From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 07:21:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,408,1511856000"; d="scan'208";a="24375383" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 24 Jan 2018 07:21:05 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Jan 2018 07:21:05 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Jan 2018 07:21:05 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Wed, 24 Jan 2018 23:21:04 +0800 From: "Wu, Jingjing" To: "Guo, Jia" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "gaetan.rivet@6wind.com" CC: "Ananyev, Konstantin" , "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "thomas@monjalon.net" , "Zhang, Helin" , "motih@mellanox.com" Thread-Topic: [PATCH V12 3/3] app/testpmd: use uevent to monitor hotplug Thread-Index: AQHTkBK7XwsS8SuVWEKeNPnk6nDnRaODLAyg 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> In-Reply-To: <1516248723-16985-3-git-send-email-jia.guo@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGQ2ODgxZmUtMDI1MC00NTQwLWE4ZWYtZWI1YjBhMTZlNDBiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im93VEVBcFhSSHNKanNtSm41MlBrdnRtZlV0eGI4SkVJWjduZGdERW91Smc9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Wed, 24 Jan 2018 15:21:07 -0000 > + > +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?