examples/eventdev: move ethdev stop to the end
authorFeifei Wang <feifei.wang2@arm.com>
Thu, 14 Jan 2021 10:31:01 +0000 (18:31 +0800)
committerJerin Jacob <jerinj@marvell.com>
Tue, 26 Jan 2021 12:58:01 +0000 (13:58 +0100)
commitf3527e0b97ae4adf2e1871e6f67b17968b4a9486
treecba3c6cd012cd9e8ce79d904dba2cfcd0f70c9c8
parent198b5448433ed329becaf47003faf038132fbb7f
examples/eventdev: move ethdev stop to the end

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: 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>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
examples/eventdev_pipeline/main.c