DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Pattan, Reshma" <reshma.pattan@intel.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT
Date: Wed, 1 Oct 2014 13:46:41 +0000	[thread overview]
Message-ID: <3AEA2BF9852C6F48A459DA490692831FE20F81@IRSMSX109.ger.corp.intel.com> (raw)
In-Reply-To: <1412170427-7245-1-git-send-email-reshma.pattan@intel.com>

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 <reshma.pattan@intel.com>

	*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 <reshma.pattan@intel.com>
---
 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/main.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 = 0;
+volatile uint8_t quit_signal = 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 = p->d;
@@ -244,7 +245,7 @@ lcore_rx(struct lcore_params *p)
 
 	printf("\nCore %u doing packet RX.\n", rte_lcore_id());
 	port = 0;
-	for (;;) {
+	while (!quit_signal) {
 		/* skip ports that are not enabled */
 		if ((enabled_port_mask & (1 << port)) == 0) {
 			if (++port == 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 = 0; port < nb_ports; port++) {
 			/* skip ports that are not enabled */
 			if ((enabled_port_mask & (1 << port)) == 0) @@ -370,7 +371,6 @@ lcore_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 = 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 sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

  reply	other threads:[~2014-10-01 13:40 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 12:13 [dpdk-dev] [PATCH 0/3] distributor_app: new sample application for distributor library reshmapa
2014-09-16 12:13 ` [dpdk-dev] [PATCH 1/3] distributor_app: new sample app reshmapa
2014-09-16 12:13 ` [dpdk-dev] [PATCH 2/3] distributor_app: code review comments implementation reshmapa
2014-09-16 12:13 ` [dpdk-dev] [PATCH 3/3] distributor_app: removed extra spaces reshmapa
2014-09-23 12:55 ` [dpdk-dev] [PATCH 0/3] distributor_app: new sample application for distributor library Bruce Richardson
2014-09-24 14:16 ` [dpdk-dev] [PATCH v2] distributor_app: new sample app reshmapa
2014-09-26 15:11   ` De Lara Guarch, Pablo
2014-09-26 15:51     ` Ananyev, Konstantin
2014-09-29 12:39       ` Pattan, Reshma
2014-09-29 13:06         ` Ananyev, Konstantin
2014-09-29 13:35           ` De Lara Guarch, Pablo
2014-09-29 14:35             ` Neil Horman
2014-09-30  8:02             ` Pattan, Reshma
2014-09-30  9:21               ` Ananyev, Konstantin
2014-09-30 10:39   ` [dpdk-dev] [PATCH v3] " reshmapa
2014-09-30 11:34     ` Neil Horman
2014-09-30 12:18       ` Bruce Richardson
2014-09-30 13:39         ` Neil Horman
2014-10-01 14:47           ` Pattan, Reshma
2014-10-01 14:56             ` Neil Horman
2014-10-01 15:37               ` Bruce Richardson
2014-10-01 16:07                 ` Neil Horman
2014-10-06 14:16                   ` Pattan, Reshma
2014-10-06 14:44                     ` Neil Horman
2014-10-06 17:34                       ` Pattan, Reshma
2014-10-06 19:02                         ` Neil Horman
2014-10-02  9:04                 ` Ananyev, Konstantin
2014-10-01 13:33     ` [dpdk-dev] [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT reshmapa
2014-10-01 13:46       ` Pattan, Reshma [this message]
2014-10-01 13:49       ` Thomas Monjalon
2014-10-01 14:33       ` [dpdk-dev] [PATCH v5] distributor_app: new sample app reshmapa
2014-10-17 13:59         ` [dpdk-dev] [PATCH v6] " Reshma Pattan
2014-11-02 20:08           ` De Lara Guarch, Pablo
2014-11-03 15:49           ` [dpdk-dev] [PATCH v7] " Reshma Pattan
2014-11-03 16:03             ` De Lara Guarch, Pablo
2014-11-13 21:30               ` Thomas Monjalon
2014-11-14  8:44                 ` Pattan, Reshma
2014-11-16 21:59                   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3AEA2BF9852C6F48A459DA490692831FE20F81@IRSMSX109.ger.corp.intel.com \
    --to=reshma.pattan@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).