DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/eventdev: move eth stop to the end
@ 2020-12-21  5:34 Feifei Wang
  2020-12-21  9:32 ` [dpdk-dev] [PATCH v2] " Feifei Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Feifei Wang @ 2020-12-21  5:34 UTC (permalink / raw)
  To: Harry van Haaren, Nikhil Rao, Pavan Nikhilesh
  Cc: dev, nd, Feifei Wang, pbhagavatula, stable

Move eth stop code from "signal_handler" function to the end of "main"
function. There are two reasons for this:

First, this improves code maintenance and makes code look simple and clear.
Based on this change, after receiving the interrupt signal, "fdata->done"
is set as 1. Then the main thread will wait all worker lcores to jump out
of the loop. Finally, the main thread will stop and then close eth dev port.

Second, for older version, the main thread first stops eth dev port and then
waits the end of worker lcore. This may cause errors because it may stop the
eth dev port which worker lcores are using. This moving change can fix this
by waiting all worker threads to exit and then stop the eth dev port.

In the meanwhile, remove wmb in signal_handler.

This is because when the main lcore receive the stop signal, it stores 1
into fdata->done. And then the worker lcores load "fdata->done" and jump out
of the loop to stop running. Nothing should be stored after updating
fdata->done, so the wmb is unnecessary.

Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")
Cc: pbhagavatula@marvell.com
Cc: stable@dpdk.org

Suggested-by: Ruifeng Wang <ruifeng.wang@arm.com>
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 examples/eventdev_pipeline/main.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 823f8b51c..ac2ace5c4 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -291,17 +291,6 @@ signal_handler(int signum)
 			rte_event_dev_dump(0, stdout);
 		once = 1;
 		fdata->done = 1;
-		rte_smp_wmb();
-
-		RTE_ETH_FOREACH_DEV(portid) {
-			rte_event_eth_rx_adapter_stop(portid);
-			rte_event_eth_tx_adapter_stop(portid);
-			if (rte_eth_dev_stop(portid) < 0)
-				printf("Failed to stop port %u", portid);
-		}
-
-		rte_eal_mp_wait_lcore();
-
 	}
 	if (signum == SIGTSTP)
 		rte_event_dev_dump(0, stdout);
@@ -465,6 +454,10 @@ main(int argc, char **argv)
 	}
 
 	RTE_ETH_FOREACH_DEV(portid) {
+		rte_event_eth_rx_adapter_stop(portid);
+		rte_event_eth_tx_adapter_stop(portid);
+		if (rte_eth_dev_stop(portid) < 0)
+			printf("Failed to stop port %u", portid);
 		rte_eth_dev_close(portid);
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-01-26 13:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  5:34 [dpdk-dev] [PATCH] examples/eventdev: move eth stop to the end Feifei Wang
2020-12-21  9:32 ` [dpdk-dev] [PATCH v2] " Feifei Wang
2020-12-21  9:56 ` [dpdk-dev] [PATCH] " Van Haaren, Harry
2020-12-22  5:31   ` [dpdk-dev] 回复: " Feifei Wang
2021-01-05  5:14 ` [dpdk-dev] [PATCH v3] examples/eventdev: refactor ethdev port stop Feifei Wang
2021-01-05 10:09   ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2021-01-14  6:24     ` [dpdk-dev] 回复: " Feifei Wang
2021-01-14  8:50       ` Feifei Wang
2021-01-14 10:30 ` [dpdk-dev] [PATCH v4 0/3] fix bugs for examples/evnentdev Feifei Wang
2021-01-14 10:30   ` [dpdk-dev] [PATCH v4 1/3] doc: fix core enabled bug for eventdev pipeline example Feifei Wang
2021-01-14 10:31   ` [dpdk-dev] [PATCH v4 2/3] examples/eventdev: add info output for main core Feifei Wang
2021-01-14 10:31   ` [dpdk-dev] [PATCH v4 3/3] examples/eventdev: move eth stop to the end Feifei Wang
2021-01-25 17:51     ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2021-01-26 13:37       ` Jerin Jacob

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).