DPDK patches and discussions
 help / color / mirror / Atom feed
From: reshmapa <reshma.pattan@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT
Date: Wed,  1 Oct 2014 14:33:47 +0100
Message-ID: <1412170427-7245-1-git-send-email-reshma.pattan@intel.com> (raw)
In-Reply-To: <1412073577-12248-1-git-send-email-reshma.pattan@intel.com>

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

  parent reply	other threads:[~2014-10-01 13:27 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     ` reshmapa [this message]
2014-10-01 13:46       ` [dpdk-dev] [PATCH v4] distributor_app: gracefull shutdown of tx/rx threads on SIGINT Pattan, Reshma
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=1412170427-7245-1-git-send-email-reshma.pattan@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git