From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C240C5A52 for ; Thu, 24 Dec 2015 11:18:48 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 24 Dec 2015 02:18:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,473,1444719600"; d="scan'208";a="847666967" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 24 Dec 2015 02:18:47 -0800 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 24 Dec 2015 02:18:47 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 24 Dec 2015 02:18:47 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.28]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.151]) with mapi id 14.03.0248.002; Thu, 24 Dec 2015 18:18:45 +0800 From: "Wang, Zhihong" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/3] app/test-pmd: Handle SIGINT and SIGTERM in testpmd Thread-Index: AQHRPiJ7LAEuFSVhlUipf0yLdy67jZ7Z7BPA Date: Thu, 24 Dec 2015 10:18:44 +0000 Message-ID: <8F6C2BD409508844A0EFC19955BE0941857EC5@SHSMSX103.ccr.corp.intel.com> References: <1450900995-84185-1-git-send-email-zhihong.wang@intel.com> <1450900995-84185-2-git-send-email-zhihong.wang@intel.com> <533710CFB86FA344BFBF2D6802E6028622F001E7@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E6028622F001E7@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWJjNjQwYzYtMzQ0Ny00ZmQxLTliMjQtMjI3NTgwNWViNTgwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjQuMTAuMTkiLCJUcnVzdGVkTGFiZWxIYXNoIjoib1FXUlJjNnpEOU1PTjllWkpYXC9UR2N6eVZxSWlUMXJ5czhYWE0wa0xLS009In0= 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 1/3] app/test-pmd: Handle SIGINT and SIGTERM in testpmd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2015 10:18:49 -0000 > > +/* When we receive a INT signal, close all ports */ static void > > +sigint_handler(__rte_unused int signum) { > > + unsigned portid; > > + > > + printf("Preparing to exit...\n"); >=20 > Better to notice user "Signal xxx received, reparing to exit... " Can do that. >=20 > > + FOREACH_PORT(portid, ports) { > > + if (port_id_is_invalid(portid, ENABLED_WARN)) > > + continue; > > + printf("Stopping port %d...", portid); > > + rte_eth_dev_stop(portid); > > + rte_eth_dev_close(portid); > > + printf(" Done\n"); > > + } > > + printf("Bye...\n"); >=20 > Here why don't call pmd_test_exit()? Any issue with that func? Yes should just call this one :) >=20 > Thanks, > Michael > > + exit(0); > > +} > > + > > int > > main(int argc, char** argv) > > { > > int diag; > > uint8_t port_id; > > > > + signal(SIGINT, sigint_handler); > > + signal(SIGTERM, sigint_handler); > > + > > diag =3D rte_eal_init(argc, argv); > > if (diag < 0) > > rte_panic("Cannot init EAL\n");