[dpdk-dev] [PATCH v2 4/6] eal: update rte_eal_wait_lcore definition
Honnappa Nagarahalli
honnappa.nagarahalli at arm.com
Fri Sep 10 01:13:10 CEST 2021
Since the FINISHED state is removed, the API rte_eal_wait_lcore
is updated to always return the status of the last function that
ran in the worker core.
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
Reviewed-by: Feifei Wang <feifei.wang at arm.com>
---
lib/eal/common/eal_common_launch.c | 6 ++----
lib/eal/include/rte_launch.h | 12 +++++-------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/lib/eal/common/eal_common_launch.c b/lib/eal/common/eal_common_launch.c
index 78fd940267..4bc842417a 100644
--- a/lib/eal/common/eal_common_launch.c
+++ b/lib/eal/common/eal_common_launch.c
@@ -23,10 +23,8 @@
int
rte_eal_wait_lcore(unsigned worker_id)
{
- if (lcore_config[worker_id].state == WAIT)
- return 0;
-
- while (lcore_config[worker_id].state != WAIT)
+ while (__atomic_load_n(&lcore_config[worker_id].state,
+ __ATOMIC_ACQUIRE) != WAIT)
rte_pause();
rte_rmb();
diff --git a/lib/eal/include/rte_launch.h b/lib/eal/include/rte_launch.h
index ed0bb4762a..f2d386e6e2 100644
--- a/lib/eal/include/rte_launch.h
+++ b/lib/eal/include/rte_launch.h
@@ -119,18 +119,16 @@ enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned int worker_id);
*
* To be executed on the MAIN lcore only.
*
- * If the worker lcore identified by the worker_id is in a FINISHED state,
- * switch to the WAIT state. If the lcore is in RUNNING state, wait until
- * the lcore finishes its job and moves to the FINISHED state.
+ * If the lcore identified by the worker_id is in RUNNING state, wait until
+ * the lcore finishes its job and moves to the WAIT state.
*
* @param worker_id
* The identifier of the lcore.
* @return
- * - 0: If the lcore identified by the worker_id is in a WAIT state.
+ * - 0: If the remote launch function was never called on the lcore
+ * identified by the worker_id.
* - The value that was returned by the previous remote launch
- * function call if the lcore identified by the worker_id was in a
- * FINISHED or RUNNING state. In this case, it changes the state
- * of the lcore to WAIT.
+ * function call.
*/
int rte_eal_wait_lcore(unsigned worker_id);
--
2.25.1
More information about the dev
mailing list