From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 9DD3ADE4 for ; Wed, 1 Oct 2014 15:40:41 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 01 Oct 2014 06:46:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,632,1406617200"; d="scan'208";a="581884586" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga001.jf.intel.com with ESMTP; 01 Oct 2014 06:46:52 -0700 Received: from irsmsx110.ger.corp.intel.com (163.33.3.25) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 1 Oct 2014 14:46:42 +0100 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.253]) by IRSMSX110.ger.corp.intel.com ([169.254.15.199]) with mapi id 14.03.0195.001; Wed, 1 Oct 2014 14:46:41 +0100 From: "Pattan, Reshma" To: "dev@dpdk.org" Thread-Topic: [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT Thread-Index: AQHP3Xxd20ZWD398c0qzZabn1W8zupwbQPyA Date: Wed, 1 Oct 2014 13:46:41 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831FE20F81@IRSMSX109.ger.corp.intel.com> References: <1412073577-12248-1-git-send-email-reshma.pattan@intel.com> <1412170427-7245-1-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1412170427-7245-1-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT 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: Wed, 01 Oct 2014 13:40:42 -0000 Self-NAK. = Reason: Incomplete patch. Will send updated next version soon. -----Original Message----- From: Pattan, Reshma = Sent: Wednesday, October 1, 2014 2:34 PM To: dev@dpdk.org Cc: Pattan, Reshma Subject: [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on= SIGINT From: Reshma Pattan *Handled gracefull shutdown of rx and tx threads upon SIGINT. *Gracefull shutdown of worker threads will be handled in future enhancements. Signed-off-by: Reshma Pattan --- examples/distributor_app/main.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/distributor_app/main.c b/examples/distributor_app/mai= n.c index f555d93..b6fa063 100644 --- a/examples/distributor_app/main.c +++ b/examples/distributor_app/main.c @@ -85,6 +85,7 @@ = /* mask of enabled ports */ static uint32_t enabled_port_mask =3D 0; +volatile uint8_t quit_signal =3D 0; = static volatile struct app_stats { struct { @@ -221,7 +222,7 @@ struct lcore_params { struct rte_ring *r; }; = -static __attribute__((noreturn)) void +static int lcore_rx(struct lcore_params *p) { struct rte_distributor *d =3D p->d; @@ -244,7 +245,7 @@ lcore_rx(struct lcore_params *p) = printf("\nCore %u doing packet RX.\n", rte_lcore_id()); port =3D 0; - for (;;) { + while (!quit_signal) { /* skip ports that are not enabled */ if ((enabled_port_mask & (1 << port)) =3D=3D 0) { if (++port =3D=3D nb_ports) @@ -307,7 +308,7 @@ flush_all_ports(struct output_buffer *tx_buffers, uint8= _t nb_ports) } } = -static __attribute__((noreturn)) void +static int lcore_tx(struct rte_ring *in_r) { static struct output_buffer tx_buffers[RTE_MAX_ETHPORTS]; @@ -328,7 +329,= 7 @@ lcore_tx(struct rte_ring *in_r) } = printf("\nCore %u doing packet TX.\n", rte_lcore_id()); - for (;;) { + while (!quit_signal) { for (port =3D 0; port < nb_ports; port++) { /* skip ports that are not enabled */ if ((enabled_port_mask & (1 << port)) =3D=3D 0) @@ -370,7 +371,6 @@ lco= re_tx(struct rte_ring *in_r) } } = - static __attribute__((noreturn)) void lcore_worker(struct lcore_params *p) { @@ -415,7 +415,7 @@ int_handler(int sig_num) printf(" - Out Errs: %"PRIu64"\n", eth_stats.oerrors); printf(" - Mbuf Errs: %"PRIu64"\n", eth_stats.rx_nombuf); } - exit(0); + quit_signal =3D 1; } = /* display usage */ -- 1.7.4.1 -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies.