1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
7 #include <rte_launch.h>
8 #include <rte_atomic.h>
10 #include <rte_lcore.h>
12 #include "eal_private.h"
15 * Wait until a lcore finished its job.
18 rte_eal_wait_lcore(unsigned worker_id)
20 while (__atomic_load_n(&lcore_config[worker_id].state,
21 __ATOMIC_ACQUIRE) != WAIT)
24 return lcore_config[worker_id].ret;
28 * Check that every WORKER lcores are in WAIT state, then call
29 * rte_eal_remote_launch() for all of them. If call_main is true
30 * (set to CALL_MAIN), also call the function on the main lcore.
33 rte_eal_mp_remote_launch(int (*f)(void *), void *arg,
34 enum rte_rmt_call_main_t call_main)
37 int main_lcore = rte_get_main_lcore();
39 /* check state of lcores */
40 RTE_LCORE_FOREACH_WORKER(lcore_id) {
41 if (lcore_config[lcore_id].state != WAIT)
45 /* send messages to cores */
46 RTE_LCORE_FOREACH_WORKER(lcore_id) {
47 rte_eal_remote_launch(f, arg, lcore_id);
50 if (call_main == CALL_MAIN) {
51 lcore_config[main_lcore].ret = f(arg);
52 lcore_config[main_lcore].state = WAIT;
59 * Return the state of the lcore identified by worker_id.
61 enum rte_lcore_state_t
62 rte_eal_get_lcore_state(unsigned lcore_id)
64 return lcore_config[lcore_id].state;
68 * Do a rte_eal_wait_lcore() for every lcore. The return values are
72 rte_eal_mp_wait_lcore(void)
76 RTE_LCORE_FOREACH_WORKER(lcore_id) {
77 rte_eal_wait_lcore(lcore_id);