4 * Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 #include <sys/queue.h>
51 #include <rte_common.h>
52 #include <rte_debug.h>
53 #include <rte_memory.h>
54 #include <rte_memzone.h>
55 #include <rte_launch.h>
56 #include <rte_tailq.h>
58 #include <rte_eal_memconfig.h>
59 #include <rte_per_lcore.h>
60 #include <rte_lcore.h>
62 #include <rte_random.h>
63 #include <rte_cycles.h>
64 #include <rte_string_fns.h>
65 #include <rte_cpuflags.h>
66 #include <rte_interrupts.h>
68 #include <rte_common.h>
69 #include <rte_version.h>
70 #include <rte_atomic.h>
71 #include <malloc_heap.h>
73 #include "eal_private.h"
74 #include "eal_thread.h"
75 #include "eal_internal_cfg.h"
76 #include "eal_filesystem.h"
77 #include "eal_hugepages.h"
79 #define OPT_HUGE_DIR "huge-dir"
80 #define OPT_PROC_TYPE "proc-type"
81 #define OPT_NO_SHCONF "no-shconf"
82 #define OPT_NO_HPET "no-hpet"
83 #define OPT_NO_PCI "no-pci"
84 #define OPT_NO_HUGE "no-huge"
85 #define OPT_FILE_PREFIX "file-prefix"
86 #define OPT_SOCKET_MEM "socket-mem"
88 #define RTE_EAL_BLACKLIST_SIZE 0x100
90 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
92 #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)
94 #define GET_BLACKLIST_FIELD(in, fd, lim, dlm) \
99 val = strtoul((in), &end, 16); \
100 if (errno != 0 || end[0] != (dlm) || val > (lim)) \
102 (fd) = (typeof (fd))val; \
106 /* Allow the application to print its usage message too if set */
107 static rte_usage_hook_t rte_application_usage_hook = NULL;
108 /* early configuration structure, when memory config is not mmapped */
109 static struct rte_mem_config early_mem_config;
111 /* define fd variable here, because file needs to be kept open for the
112 * duration of the program, as we hold a write lock on it in the primary proc */
113 static int mem_cfg_fd = -1;
115 static struct flock wr_lock = {
117 .l_whence = SEEK_SET,
118 .l_start = offsetof(struct rte_mem_config, memseg),
119 .l_len = sizeof(early_mem_config.memseg),
122 /* Address of global and public configuration */
123 static struct rte_config rte_config = {
124 .mem_config = &early_mem_config,
127 static struct rte_pci_addr eal_dev_blacklist[RTE_EAL_BLACKLIST_SIZE];
129 /* internal configuration (per-core) */
130 struct lcore_config lcore_config[RTE_MAX_LCORE];
132 /* internal configuration */
133 struct internal_config internal_config;
135 /* Return a pointer to the configuration structure */
137 rte_eal_get_configuration(void)
142 /* parse a sysfs (or other) file containing one integer value */
144 eal_parse_sysfs_value(const char *filename, unsigned long *val)
150 if ((f = fopen(filename, "r")) == NULL) {
151 RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
156 if (fgets(buf, sizeof(buf), f) == NULL) {
157 RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
162 *val = strtoul(buf, &end, 0);
163 if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
164 RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
174 /* create memory configuration in shared/mmap memory. Take out
175 * a write lock on the memsegs, so we can auto-detect primary/secondary.
176 * This means we never close the file while running (auto-close on exit).
177 * We also don't lock the whole file, so that in future we can use read-locks
178 * on other parts, e.g. memzones, to detect if there are running secondary
181 rte_eal_config_create(void)
183 void *rte_mem_cfg_addr;
186 const char *pathname = eal_runtime_config_path();
188 if (internal_config.no_shconf)
192 mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
194 rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
197 retval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));
200 rte_panic("Cannot resize '%s' for rte_mem_config\n", pathname);
203 retval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);
206 rte_exit(EXIT_FAILURE, "Cannot create lock on '%s'. Is another primary "
207 "process running?\n", pathname);
210 rte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),
211 PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
213 if (rte_mem_cfg_addr == MAP_FAILED){
214 rte_panic("Cannot mmap memory for rte_config\n");
216 memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
217 rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;
220 /* attach to an existing shared memory config */
222 rte_eal_config_attach(void)
224 void *rte_mem_cfg_addr;
225 const char *pathname = eal_runtime_config_path();
227 if (internal_config.no_shconf)
231 mem_cfg_fd = open(pathname, O_RDWR);
233 rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
236 rte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),
237 PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
239 if (rte_mem_cfg_addr == MAP_FAILED)
240 rte_panic("Cannot mmap memory for rte_config\n");
242 rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;
245 /* Detect if we are a primary or a secondary process */
246 static enum rte_proc_type_t
247 eal_proc_type_detect(void)
249 enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
250 const char *pathname = eal_runtime_config_path();
252 /* if we can open the file but not get a write-lock we are a secondary
253 * process. NOTE: if we get a file handle back, we keep that open
254 * and don't close it to prevent a race condition between multiple opens */
255 if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
256 (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
257 ptype = RTE_PROC_SECONDARY;
259 RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
260 ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");
265 /* Sets up rte_config structure with the pointer to shared memory config.*/
267 rte_config_init(void)
269 /* set the magic in configuration structure */
270 rte_config.magic = RTE_MAGIC;
271 rte_config.process_type = (internal_config.process_type == RTE_PROC_AUTO) ?
272 eal_proc_type_detect() : /* for auto, detect the type */
273 internal_config.process_type; /* otherwise use what's already set */
275 switch (rte_config.process_type){
276 case RTE_PROC_PRIMARY:
277 rte_eal_config_create();
279 case RTE_PROC_SECONDARY:
280 rte_eal_config_attach();
281 rte_eal_mcfg_wait_complete(rte_config.mem_config);
284 case RTE_PROC_INVALID:
285 rte_panic("Invalid process type\n");
289 /* Unlocks hugepage directories that were locked by eal_hugepage_info_init */
291 eal_hugedirs_unlock(void)
295 for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
297 /* skip uninitialized */
298 if (internal_config.hugepage_info[i].lock_descriptor == 0)
300 /* unlock hugepage file */
301 flock(internal_config.hugepage_info[i].lock_descriptor, LOCK_UN);
302 close(internal_config.hugepage_info[i].lock_descriptor);
303 /* reset the field */
304 internal_config.hugepage_info[i].lock_descriptor = 0;
310 eal_usage(const char *prgname)
312 printf("\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]"
313 "[--proc-type primary|secondary|auto] \n\n"
315 " -c COREMASK : A hexadecimal bitmask of cores to run on\n"
316 " -n NUM : Number of memory channels\n"
317 " -v : Display version information on startup\n"
318 " -b <domain:bus:devid.func>: to prevent EAL from using specified "
320 " (multiple -b options are allowed)\n"
321 " -m MB : memory to allocate (see also --"OPT_SOCKET_MEM")\n"
322 " -r NUM : force number of memory ranks (don't detect)\n"
323 " --"OPT_SOCKET_MEM" : memory to allocate on specific \n"
324 " sockets (use comma separated values)\n"
325 " --"OPT_HUGE_DIR" : directory where hugetlbfs is mounted\n"
326 " --"OPT_PROC_TYPE" : type of this process\n"
327 " --"OPT_FILE_PREFIX": prefix for hugepage filenames\n"
328 "\nEAL options for DEBUG use only:\n"
329 " --"OPT_NO_HUGE" : use malloc instead of hugetlbfs\n"
330 " --"OPT_NO_PCI" : disable pci\n"
331 " --"OPT_NO_HPET" : disable hpet\n"
332 " --"OPT_NO_SHCONF": no shared config (mmap'd files)\n\n",
334 /* Allow the application to print its usage message too if hook is set */
335 if ( rte_application_usage_hook ) {
336 printf("===== Application Usage =====\n\n");
337 rte_application_usage_hook(prgname);
341 /* Set a per-application usage message */
343 rte_set_application_usage_hook( rte_usage_hook_t usage_func )
345 rte_usage_hook_t old_func;
347 /* Will be NULL on the first call to denote the last usage routine. */
348 old_func = rte_application_usage_hook;
349 rte_application_usage_hook = usage_func;
355 * Parse the coremask given as argument (hexadecimal string) and fill
356 * the global configuration (core role and core count) with the parsed
360 eal_parse_coremask(const char *coremask)
362 struct rte_config *cfg = rte_eal_get_configuration();
365 unsigned long long cm;
368 /* parse hexadecimal string */
369 cm = strtoull(coremask, &end, 16);
370 if ((coremask[0] == '\0') || (end == NULL) || (*end != '\0') || (cm == 0))
373 RTE_LOG(DEBUG, EAL, "coremask set to %llx\n", cm);
374 /* set core role and core count */
375 for (i = 0; i < RTE_MAX_LCORE; i++) {
376 if ((1ULL << i) & cm) {
378 cfg->master_lcore = i;
379 cfg->lcore_role[i] = ROLE_RTE;
383 cfg->lcore_role[i] = ROLE_OFF;
390 eal_parse_socket_mem(char *socket_mem)
392 char * arg[RTE_MAX_NUMA_NODES];
395 uint64_t total_mem = 0;
397 len = strnlen(socket_mem, SOCKET_MEM_STRLEN);
398 if (len == SOCKET_MEM_STRLEN) {
399 RTE_LOG(ERR, EAL, "--socket-mem is too long\n");
403 /* all other error cases will be caught later */
404 if (!isdigit(socket_mem[len-1]))
407 /* split the optarg into separate socket values */
408 arg_num = rte_strsplit(socket_mem, len,
409 arg, RTE_MAX_NUMA_NODES, ',');
411 /* if split failed, or 0 arguments */
415 internal_config.force_sockets = 1;
417 /* parse each defined socket option */
419 for (i = 0; i < arg_num; i++) {
421 internal_config.socket_mem[i] = strtoull(arg[i], &end, 10);
423 /* check for invalid input */
425 (arg[i][0] == '\0') || (end == NULL) || (*end != '\0'))
427 internal_config.socket_mem[i] *= 1024ULL;
428 internal_config.socket_mem[i] *= 1024ULL;
429 total_mem += internal_config.socket_mem[i];
432 /* check if we have a positive amount of total memory */
440 eal_get_hugepage_mem_size(void)
445 for (i = 0; i < internal_config.num_hugepage_sizes; i++) {
446 struct hugepage_info *hpi = &internal_config.hugepage_info[i];
447 if (hpi->hugedir != NULL) {
448 for (j = 0; j < RTE_MAX_NUMA_NODES; j++) {
449 size += hpi->hugepage_sz * hpi->num_pages[j];
454 return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
457 static enum rte_proc_type_t
458 eal_parse_proc_type(const char *arg)
460 if (strncasecmp(arg, "primary", sizeof("primary")) == 0)
461 return RTE_PROC_PRIMARY;
462 if (strncasecmp(arg, "secondary", sizeof("secondary")) == 0)
463 return RTE_PROC_SECONDARY;
464 if (strncasecmp(arg, "auto", sizeof("auto")) == 0)
465 return RTE_PROC_AUTO;
467 return RTE_PROC_INVALID;
471 eal_parse_blacklist(const char *input, struct rte_pci_addr *dev2bl)
473 GET_BLACKLIST_FIELD(input, dev2bl->domain, UINT16_MAX, ':');
474 GET_BLACKLIST_FIELD(input, dev2bl->bus, UINT8_MAX, ':');
475 GET_BLACKLIST_FIELD(input, dev2bl->devid, UINT8_MAX, '.');
476 GET_BLACKLIST_FIELD(input, dev2bl->function, UINT8_MAX, 0);
481 eal_parse_blacklist_opt(const char *optarg, size_t idx)
483 if (idx >= sizeof (eal_dev_blacklist) / sizeof (eal_dev_blacklist[0])) {
485 "%s - too many devices to blacklist...\n",
488 } else if (eal_parse_blacklist(optarg, eal_dev_blacklist + idx) != 0) {
490 "%s - invalid device to blacklist...\n",
500 /* Parse the argument given in the command line of the application */
502 eal_parse_args(int argc, char **argv)
508 ssize_t blacklist_index = 0;;
509 char *prgname = argv[0];
510 static struct option lgopts[] = {
511 {OPT_NO_HUGE, 0, 0, 0},
512 {OPT_NO_PCI, 0, 0, 0},
513 {OPT_NO_HPET, 0, 0, 0},
514 {OPT_HUGE_DIR, 1, 0, 0},
515 {OPT_NO_SHCONF, 0, 0, 0},
516 {OPT_PROC_TYPE, 1, 0, 0},
517 {OPT_FILE_PREFIX, 1, 0, 0},
518 {OPT_SOCKET_MEM, 1, 0, 0},
524 internal_config.memory = 0;
525 internal_config.force_nrank = 0;
526 internal_config.force_nchannel = 0;
527 internal_config.hugefile_prefix = HUGEFILE_PREFIX_DEFAULT;
528 internal_config.hugepage_dir = NULL;
529 internal_config.force_sockets = 0;
530 #ifdef RTE_LIBEAL_USE_HPET
531 internal_config.no_hpet = 0;
533 internal_config.no_hpet = 1;
535 /* zero out the NUMA config */
536 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
537 internal_config.socket_mem[i] = 0;
539 /* zero out hugedir descriptors */
540 for (i = 0; i < MAX_HUGEPAGE_SIZES; i++)
541 internal_config.hugepage_info[i].lock_descriptor = 0;
543 while ((opt = getopt_long(argc, argvopt, "b:c:m:n:r:v",
544 lgopts, &option_index)) != EOF) {
549 if ((blacklist_index = eal_parse_blacklist_opt(optarg,
550 blacklist_index)) < 0) {
557 if (eal_parse_coremask(optarg) < 0) {
558 RTE_LOG(ERR, EAL, "invalid coremask\n");
566 internal_config.memory = atoi(optarg);
567 internal_config.memory *= 1024ULL;
568 internal_config.memory *= 1024ULL;
570 /* force number of channels */
572 internal_config.force_nchannel = atoi(optarg);
573 if (internal_config.force_nchannel == 0 ||
574 internal_config.force_nchannel > 4) {
575 RTE_LOG(ERR, EAL, "invalid channel number\n");
580 /* force number of ranks */
582 internal_config.force_nrank = atoi(optarg);
583 if (internal_config.force_nrank == 0 ||
584 internal_config.force_nrank > 16) {
585 RTE_LOG(ERR, EAL, "invalid rank number\n");
591 /* since message is explicitly requested by user, we
592 * write message at highest log level so it can always be seen
593 * even if info or warning messages are disabled */
594 RTE_LOG(CRIT, EAL, "RTE Version: '%s'\n", rte_version());
599 if (!strcmp(lgopts[option_index].name, OPT_NO_HUGE)) {
600 internal_config.no_hugetlbfs = 1;
602 else if (!strcmp(lgopts[option_index].name, OPT_NO_PCI)) {
603 internal_config.no_pci = 1;
605 else if (!strcmp(lgopts[option_index].name, OPT_NO_HPET)) {
606 internal_config.no_hpet = 1;
608 else if (!strcmp(lgopts[option_index].name, OPT_NO_SHCONF)) {
609 internal_config.no_shconf = 1;
611 else if (!strcmp(lgopts[option_index].name, OPT_HUGE_DIR)) {
612 internal_config.hugepage_dir = optarg;
614 else if (!strcmp(lgopts[option_index].name, OPT_PROC_TYPE)) {
615 internal_config.process_type = eal_parse_proc_type(optarg);
617 else if (!strcmp(lgopts[option_index].name, OPT_FILE_PREFIX)) {
618 internal_config.hugefile_prefix = optarg;
620 else if (!strcmp(lgopts[option_index].name, OPT_SOCKET_MEM)) {
621 if (eal_parse_socket_mem(optarg) < 0) {
622 RTE_LOG(ERR, EAL, "invalid parameters for --"
623 OPT_SOCKET_MEM "\n");
638 RTE_LOG(ERR, EAL, "coremask not specified\n");
642 if (internal_config.process_type == RTE_PROC_AUTO){
643 internal_config.process_type = eal_proc_type_detect();
645 if (internal_config.process_type == RTE_PROC_INVALID){
646 RTE_LOG(ERR, EAL, "Invalid process type specified\n");
650 if (internal_config.process_type == RTE_PROC_PRIMARY &&
651 internal_config.force_nchannel == 0) {
652 RTE_LOG(ERR, EAL, "Number of memory channels (-n) not specified\n");
656 if (index(internal_config.hugefile_prefix,'%') != NULL){
657 RTE_LOG(ERR, EAL, "Invalid char, '%%', in '"OPT_FILE_PREFIX"' option\n");
661 if (internal_config.memory > 0 && internal_config.force_sockets == 1) {
662 RTE_LOG(ERR, EAL, "Options -m and --socket-mem cannot be specified "
663 "at the same time\n");
667 /* --no-huge doesn't make sense with either -m or --socket-mem */
668 if (internal_config.no_hugetlbfs &&
669 (internal_config.memory > 0 ||
670 internal_config.force_sockets == 1)) {
671 RTE_LOG(ERR, EAL, "Options -m or --socket-mem cannot be specified "
672 "together with --no-huge!\n");
677 if (blacklist_index > 0)
678 rte_eal_pci_set_blacklist(eal_dev_blacklist, blacklist_index);
681 argv[optind-1] = prgname;
683 /* if no memory amounts were requested, this will result in 0 and
684 * will be overriden later, right after eal_hugepage_info_init() */
685 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
686 internal_config.memory += internal_config.socket_mem[i];
689 optind = 0; /* reset getopt lib */
694 eal_check_mem_on_local_socket(void)
696 const struct rte_memseg *ms;
699 socket_id = rte_lcore_to_socket_id(rte_config.master_lcore);
701 ms = rte_eal_get_physmem_layout();
703 for (i = 0; i < RTE_MAX_MEMSEG; i++)
704 if (ms[i].socket_id == socket_id &&
708 RTE_LOG(WARNING, EAL, "WARNING: Master core has no "
709 "memory on local socket!\n");
713 sync_func(__attribute__((unused)) void *arg)
719 rte_eal_mcfg_complete(void)
721 /* ALL shared mem_config related INIT DONE */
722 if (rte_config.process_type == RTE_PROC_PRIMARY)
723 rte_config.mem_config->magic = RTE_MAGIC;
726 /* Launch threads, called at application init(). */
728 rte_eal_init(int argc, char **argv)
732 static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
734 if (!rte_atomic32_test_and_set(&run_once))
737 thread_id = pthread_self();
739 if (rte_eal_log_early_init() < 0)
740 rte_panic("Cannot init early logs\n");
742 fctret = eal_parse_args(argc, argv);
746 if (internal_config.no_hugetlbfs == 0 &&
747 internal_config.process_type != RTE_PROC_SECONDARY &&
748 eal_hugepage_info_init() < 0)
749 rte_panic("Cannot get hugepage information\n");
751 if (internal_config.memory == 0 && internal_config.force_sockets == 0) {
752 if (internal_config.no_hugetlbfs)
753 internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
755 internal_config.memory = eal_get_hugepage_mem_size();
758 rte_srand(rte_rdtsc());
762 if (rte_eal_cpu_init() < 0)
763 rte_panic("Cannot detect lcores\n");
765 if (rte_eal_memory_init() < 0)
766 rte_panic("Cannot init memory\n");
768 /* the directories are locked during eal_hugepage_info_init */
769 eal_hugedirs_unlock();
771 if (rte_eal_memzone_init() < 0)
772 rte_panic("Cannot init memzone\n");
774 if (rte_eal_tailqs_init() < 0)
775 rte_panic("Cannot init tail queues for objects\n");
777 if (rte_eal_log_init() < 0)
778 rte_panic("Cannot init logs\n");
780 if (rte_eal_alarm_init() < 0)
781 rte_panic("Cannot init interrupt-handling thread\n");
783 if (rte_eal_intr_init() < 0)
784 rte_panic("Cannot init interrupt-handling thread\n");
786 if (rte_eal_hpet_init() < 0)
787 rte_panic("Cannot init HPET\n");
789 if (rte_eal_pci_init() < 0)
790 rte_panic("Cannot init PCI\n");
792 RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n",
793 rte_config.master_lcore, (int)thread_id);
795 eal_check_mem_on_local_socket();
797 rte_eal_mcfg_complete();
799 RTE_LCORE_FOREACH_SLAVE(i) {
802 * create communication pipes between master thread
805 if (pipe(lcore_config[i].pipe_master2slave) < 0)
806 rte_panic("Cannot create pipe\n");
807 if (pipe(lcore_config[i].pipe_slave2master) < 0)
808 rte_panic("Cannot create pipe\n");
810 lcore_config[i].state = WAIT;
812 /* create a thread for each lcore */
813 ret = pthread_create(&lcore_config[i].thread_id, NULL,
814 eal_thread_loop, NULL);
816 rte_panic("Cannot create thread\n");
819 eal_thread_init_master(rte_config.master_lcore);
822 * Launch a dummy function on all slave lcores, so that master lcore
823 * knows they are all ready when this function returns.
825 rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
826 rte_eal_mp_wait_lcore();
832 enum rte_lcore_role_t
833 rte_eal_lcore_role(unsigned lcore_id)
835 return (rte_config.lcore_role[lcore_id]);
839 rte_eal_process_type(void)
841 return (rte_config.process_type);