1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Intel Corporation
10 #include <rte_lcore.h>
11 #include <eal_thread.h>
12 #include <eal_private.h>
14 /* Address of global and public configuration */
15 static struct rte_config rte_config;
17 /* internal configuration (per-core) */
18 struct lcore_config lcore_config[RTE_MAX_LCORE];
20 /* Return a pointer to the configuration structure */
22 rte_eal_get_configuration(void)
28 sync_func(void *arg __rte_unused)
34 rte_eal_init_alert(const char *msg)
36 fprintf(stderr, "EAL: FATAL: %s\n", msg);
37 RTE_LOG(ERR, EAL, "%s\n", msg);
40 /* Launch threads, called at application init(). */
42 rte_eal_init(int argc __rte_unused, char **argv __rte_unused)
46 /* create a map of all processors in the system */
49 if (rte_eal_cpu_init() < 0) {
50 rte_eal_init_alert("Cannot detect lcores.");
55 eal_thread_init_master(rte_config.master_lcore);
57 RTE_LCORE_FOREACH_SLAVE(i) {
60 * create communication pipes between master thread
63 if (_pipe(lcore_config[i].pipe_master2slave,
64 sizeof(char), _O_BINARY) < 0)
65 rte_panic("Cannot create pipe\n");
66 if (_pipe(lcore_config[i].pipe_slave2master,
67 sizeof(char), _O_BINARY) < 0)
68 rte_panic("Cannot create pipe\n");
70 lcore_config[i].state = WAIT;
72 /* create a thread for each lcore */
73 if (eal_thread_create(&lcore_config[i].thread_id) != 0)
74 rte_panic("Cannot create thread\n");
78 * Launch a dummy function on all slave lcores, so that master lcore
79 * knows they are all ready when this function returns.
81 rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
82 rte_eal_mp_wait_lcore();