DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Marko Kovacevic <marko.kovacevic@intel.com>,
	Ori Kam <orika@mellanox.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	"Radu Nicolau" <radu.nicolau@intel.com>,
	Akhil Goyal <akhil.goyal@nxp.com>,
	"Tomasz Kantecki" <tomasz.kantecki@intel.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v8 09/10] examples/l2fwd-event: add graceful teardown
Date: Wed, 30 Oct 2019 21:56:50 +0530	[thread overview]
Message-ID: <20191030162651.3001-10-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20191030162651.3001-1-pbhagavatula@marvell.com>

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add graceful teardown that addresses both event mode and poll mode.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/l2fwd-event/main.c | 50 +++++++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index 01eb19f3e..142c00e8f 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -426,7 +426,7 @@ main(int argc, char **argv)
 	uint16_t port_id, last_port;
 	uint32_t nb_mbufs;
 	uint16_t nb_ports;
-	int ret;
+	int i, ret;
 
 	/* init EAL */
 	ret = rte_eal_init(argc, argv);
@@ -532,16 +532,46 @@ main(int argc, char **argv)
 	rte_eal_mp_remote_launch(l2fwd_launch_one_lcore, rsrc,
 				 SKIP_MASTER);
 	l2fwd_event_print_stats(rsrc);
-	rte_eal_mp_wait_lcore();
+	if (rsrc->event_mode) {
+		struct l2fwd_event_resources *evt_rsrc =
+							rsrc->evt_rsrc;
+		for (i = 0; i < evt_rsrc->rx_adptr.nb_rx_adptr; i++)
+			rte_event_eth_rx_adapter_stop(
+				evt_rsrc->rx_adptr.rx_adptr[i]);
+		for (i = 0; i < evt_rsrc->tx_adptr.nb_tx_adptr; i++)
+			rte_event_eth_tx_adapter_stop(
+				evt_rsrc->tx_adptr.tx_adptr[i]);
 
-	RTE_ETH_FOREACH_DEV(port_id) {
-		if ((rsrc->enabled_port_mask &
-						(1 << port_id)) == 0)
-			continue;
-		printf("Closing port %d...", port_id);
-		rte_eth_dev_stop(port_id);
-		rte_eth_dev_close(port_id);
-		printf(" Done\n");
+		RTE_ETH_FOREACH_DEV(port_id) {
+			if ((rsrc->enabled_port_mask &
+							(1 << port_id)) == 0)
+				continue;
+			rte_eth_dev_stop(port_id);
+		}
+
+		rte_eal_mp_wait_lcore();
+		RTE_ETH_FOREACH_DEV(port_id) {
+			if ((rsrc->enabled_port_mask &
+							(1 << port_id)) == 0)
+				continue;
+			rte_eth_dev_close(port_id);
+		}
+
+		rte_event_dev_stop(evt_rsrc->event_d_id);
+		rte_event_dev_close(evt_rsrc->event_d_id);
+
+	} else {
+		rte_eal_mp_wait_lcore();
+
+		RTE_ETH_FOREACH_DEV(port_id) {
+			if ((rsrc->enabled_port_mask &
+							(1 << port_id)) == 0)
+				continue;
+			printf("Closing port %d...", port_id);
+			rte_eth_dev_stop(port_id);
+			rte_eth_dev_close(port_id);
+			printf(" Done\n");
+		}
 	}
 	printf("Bye...\n");
 
-- 
2.17.1


  parent reply	other threads:[~2019-10-30 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 16:26 [dpdk-dev] [PATCH v8 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-30 16:26 ` [dpdk-dev] [PATCH v8 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-30 16:26 ` pbhagavatula [this message]
2019-10-30 17:03 ` [dpdk-dev] [PATCH v8 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-30 18:17 ` [dpdk-dev] [PATCH v8 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-11-04 17:11   ` Jerin Jacob

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=20191030162651.3001-10-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=marko.kovacevic@intel.com \
    --cc=orika@mellanox.com \
    --cc=radu.nicolau@intel.com \
    --cc=skori@marvell.com \
    --cc=tomasz.kantecki@intel.com \
    /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).