07e72203f59982b5fcd12a2feddc395f2a128cb1
[dpdk.git] / lib / librte_eal / bsdapp / eal / eal.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
5  *   Copyright(c) 2014 6WIND S.A.
6  *   All rights reserved.
7  *
8  *   Redistribution and use in source and binary forms, with or without
9  *   modification, are permitted provided that the following conditions
10  *   are met:
11  *
12  *     * Redistributions of source code must retain the above copyright
13  *       notice, this list of conditions and the following disclaimer.
14  *     * Redistributions in binary form must reproduce the above copyright
15  *       notice, this list of conditions and the following disclaimer in
16  *       the documentation and/or other materials provided with the
17  *       distribution.
18  *     * Neither the name of Intel Corporation nor the names of its
19  *       contributors may be used to endorse or promote products derived
20  *       from this software without specific prior written permission.
21  *
22  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <stdint.h>
38 #include <string.h>
39 #include <stdarg.h>
40 #include <unistd.h>
41 #include <pthread.h>
42 #include <syslog.h>
43 #include <getopt.h>
44 #include <sys/file.h>
45 #include <stddef.h>
46 #include <errno.h>
47 #include <limits.h>
48 #include <sys/mman.h>
49 #include <sys/queue.h>
50
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_eal.h>
57 #include <rte_eal_memconfig.h>
58 #include <rte_errno.h>
59 #include <rte_per_lcore.h>
60 #include <rte_lcore.h>
61 #include <rte_service_component.h>
62 #include <rte_log.h>
63 #include <rte_random.h>
64 #include <rte_cycles.h>
65 #include <rte_string_fns.h>
66 #include <rte_cpuflags.h>
67 #include <rte_interrupts.h>
68 #include <rte_bus.h>
69 #include <rte_pci.h>
70 #include <rte_dev.h>
71 #include <rte_devargs.h>
72 #include <rte_version.h>
73 #include <rte_atomic.h>
74 #include <malloc_heap.h>
75
76 #include "eal_private.h"
77 #include "eal_thread.h"
78 #include "eal_internal_cfg.h"
79 #include "eal_filesystem.h"
80 #include "eal_hugepages.h"
81 #include "eal_options.h"
82
83 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
84
85 /* Allow the application to print its usage message too if set */
86 static rte_usage_hook_t rte_application_usage_hook = NULL;
87 /* early configuration structure, when memory config is not mmapped */
88 static struct rte_mem_config early_mem_config;
89
90 /* define fd variable here, because file needs to be kept open for the
91  * duration of the program, as we hold a write lock on it in the primary proc */
92 static int mem_cfg_fd = -1;
93
94 static struct flock wr_lock = {
95                 .l_type = F_WRLCK,
96                 .l_whence = SEEK_SET,
97                 .l_start = offsetof(struct rte_mem_config, memseg),
98                 .l_len = sizeof(early_mem_config.memseg),
99 };
100
101 /* Address of global and public configuration */
102 static struct rte_config rte_config = {
103                 .mem_config = &early_mem_config,
104 };
105
106 /* internal configuration (per-core) */
107 struct lcore_config lcore_config[RTE_MAX_LCORE];
108
109 /* internal configuration */
110 struct internal_config internal_config;
111
112 /* used by rte_rdtsc() */
113 int rte_cycles_vmware_tsc_map;
114
115 /* Return a pointer to the configuration structure */
116 struct rte_config *
117 rte_eal_get_configuration(void)
118 {
119         return &rte_config;
120 }
121
122 enum rte_iova_mode
123 rte_eal_iova_mode(void)
124 {
125         return rte_eal_get_configuration()->iova_mode;
126 }
127
128 /* parse a sysfs (or other) file containing one integer value */
129 int
130 eal_parse_sysfs_value(const char *filename, unsigned long *val)
131 {
132         FILE *f;
133         char buf[BUFSIZ];
134         char *end = NULL;
135
136         if ((f = fopen(filename, "r")) == NULL) {
137                 RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
138                         __func__, filename);
139                 return -1;
140         }
141
142         if (fgets(buf, sizeof(buf), f) == NULL) {
143                 RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
144                         __func__, filename);
145                 fclose(f);
146                 return -1;
147         }
148         *val = strtoul(buf, &end, 0);
149         if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
150                 RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
151                                 __func__, filename);
152                 fclose(f);
153                 return -1;
154         }
155         fclose(f);
156         return 0;
157 }
158
159
160 /* create memory configuration in shared/mmap memory. Take out
161  * a write lock on the memsegs, so we can auto-detect primary/secondary.
162  * This means we never close the file while running (auto-close on exit).
163  * We also don't lock the whole file, so that in future we can use read-locks
164  * on other parts, e.g. memzones, to detect if there are running secondary
165  * processes. */
166 static void
167 rte_eal_config_create(void)
168 {
169         void *rte_mem_cfg_addr;
170         int retval;
171
172         const char *pathname = eal_runtime_config_path();
173
174         if (internal_config.no_shconf)
175                 return;
176
177         if (mem_cfg_fd < 0){
178                 mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
179                 if (mem_cfg_fd < 0)
180                         rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
181         }
182
183         retval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));
184         if (retval < 0){
185                 close(mem_cfg_fd);
186                 rte_panic("Cannot resize '%s' for rte_mem_config\n", pathname);
187         }
188
189         retval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);
190         if (retval < 0){
191                 close(mem_cfg_fd);
192                 rte_exit(EXIT_FAILURE, "Cannot create lock on '%s'. Is another primary "
193                                 "process running?\n", pathname);
194         }
195
196         rte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),
197                                 PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
198
199         if (rte_mem_cfg_addr == MAP_FAILED){
200                 rte_panic("Cannot mmap memory for rte_config\n");
201         }
202         memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
203         rte_config.mem_config = rte_mem_cfg_addr;
204 }
205
206 /* attach to an existing shared memory config */
207 static void
208 rte_eal_config_attach(void)
209 {
210         void *rte_mem_cfg_addr;
211         const char *pathname = eal_runtime_config_path();
212
213         if (internal_config.no_shconf)
214                 return;
215
216         if (mem_cfg_fd < 0){
217                 mem_cfg_fd = open(pathname, O_RDWR);
218                 if (mem_cfg_fd < 0)
219                         rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
220         }
221
222         rte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),
223                                 PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);
224         close(mem_cfg_fd);
225         if (rte_mem_cfg_addr == MAP_FAILED)
226                 rte_panic("Cannot mmap memory for rte_config\n");
227
228         rte_config.mem_config = rte_mem_cfg_addr;
229 }
230
231 /* Detect if we are a primary or a secondary process */
232 enum rte_proc_type_t
233 eal_proc_type_detect(void)
234 {
235         enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
236         const char *pathname = eal_runtime_config_path();
237
238         /* if we can open the file but not get a write-lock we are a secondary
239          * process. NOTE: if we get a file handle back, we keep that open
240          * and don't close it to prevent a race condition between multiple opens */
241         if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
242                         (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
243                 ptype = RTE_PROC_SECONDARY;
244
245         RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
246                         ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");
247
248         return ptype;
249 }
250
251 /* Sets up rte_config structure with the pointer to shared memory config.*/
252 static void
253 rte_config_init(void)
254 {
255         rte_config.process_type = internal_config.process_type;
256
257         switch (rte_config.process_type){
258         case RTE_PROC_PRIMARY:
259                 rte_eal_config_create();
260                 break;
261         case RTE_PROC_SECONDARY:
262                 rte_eal_config_attach();
263                 rte_eal_mcfg_wait_complete(rte_config.mem_config);
264                 break;
265         case RTE_PROC_AUTO:
266         case RTE_PROC_INVALID:
267                 rte_panic("Invalid process type\n");
268         }
269 }
270
271 /* display usage */
272 static void
273 eal_usage(const char *prgname)
274 {
275         printf("\nUsage: %s ", prgname);
276         eal_common_usage();
277         /* Allow the application to print its usage message too if hook is set */
278         if ( rte_application_usage_hook ) {
279                 printf("===== Application Usage =====\n\n");
280                 rte_application_usage_hook(prgname);
281         }
282 }
283
284 /* Set a per-application usage message */
285 rte_usage_hook_t
286 rte_set_application_usage_hook( rte_usage_hook_t usage_func )
287 {
288         rte_usage_hook_t        old_func;
289
290         /* Will be NULL on the first call to denote the last usage routine. */
291         old_func                                        = rte_application_usage_hook;
292         rte_application_usage_hook      = usage_func;
293
294         return old_func;
295 }
296
297 static inline size_t
298 eal_get_hugepage_mem_size(void)
299 {
300         uint64_t size = 0;
301         unsigned i, j;
302
303         for (i = 0; i < internal_config.num_hugepage_sizes; i++) {
304                 struct hugepage_info *hpi = &internal_config.hugepage_info[i];
305                 if (hpi->hugedir != NULL) {
306                         for (j = 0; j < RTE_MAX_NUMA_NODES; j++) {
307                                 size += hpi->hugepage_sz * hpi->num_pages[j];
308                         }
309                 }
310         }
311
312         return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
313 }
314
315 /* Parse the arguments for --log-level only */
316 static void
317 eal_log_level_parse(int argc, char **argv)
318 {
319         int opt;
320         char **argvopt;
321         int option_index;
322         const int old_optind = optind;
323         const int old_optopt = optopt;
324         const int old_optreset = optreset;
325         char * const old_optarg = optarg;
326
327         argvopt = argv;
328         optind = 1;
329         optreset = 1;
330
331         while ((opt = getopt_long(argc, argvopt, eal_short_options,
332                                   eal_long_options, &option_index)) != EOF) {
333
334                 int ret;
335
336                 /* getopt is not happy, stop right now */
337                 if (opt == '?')
338                         break;
339
340                 ret = (opt == OPT_LOG_LEVEL_NUM) ?
341                         eal_parse_common_option(opt, optarg, &internal_config) : 0;
342
343                 /* common parser is not happy */
344                 if (ret < 0)
345                         break;
346         }
347
348         /* restore getopt lib */
349         optind = old_optind;
350         optopt = old_optopt;
351         optreset = old_optreset;
352         optarg = old_optarg;
353 }
354
355 /* Parse the argument given in the command line of the application */
356 static int
357 eal_parse_args(int argc, char **argv)
358 {
359         int opt, ret;
360         char **argvopt;
361         int option_index;
362         char *prgname = argv[0];
363         const int old_optind = optind;
364         const int old_optopt = optopt;
365         const int old_optreset = optreset;
366         char * const old_optarg = optarg;
367
368         argvopt = argv;
369         optind = 1;
370         optreset = 1;
371
372         while ((opt = getopt_long(argc, argvopt, eal_short_options,
373                                   eal_long_options, &option_index)) != EOF) {
374
375                 /* getopt is not happy, stop right now */
376                 if (opt == '?') {
377                         eal_usage(prgname);
378                         ret = -1;
379                         goto out;
380                 }
381
382                 ret = eal_parse_common_option(opt, optarg, &internal_config);
383                 /* common parser is not happy */
384                 if (ret < 0) {
385                         eal_usage(prgname);
386                         ret = -1;
387                         goto out;
388                 }
389                 /* common parser handled this option */
390                 if (ret == 0)
391                         continue;
392
393                 switch (opt) {
394                 case 'h':
395                         eal_usage(prgname);
396                         exit(EXIT_SUCCESS);
397                 default:
398                         if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
399                                 RTE_LOG(ERR, EAL, "Option %c is not supported "
400                                         "on FreeBSD\n", opt);
401                         } else if (opt >= OPT_LONG_MIN_NUM &&
402                                    opt < OPT_LONG_MAX_NUM) {
403                                 RTE_LOG(ERR, EAL, "Option %s is not supported "
404                                         "on FreeBSD\n",
405                                         eal_long_options[option_index].name);
406                         } else {
407                                 RTE_LOG(ERR, EAL, "Option %d is not supported "
408                                         "on FreeBSD\n", opt);
409                         }
410                         eal_usage(prgname);
411                         ret = -1;
412                         goto out;
413                 }
414         }
415
416         if (eal_adjust_config(&internal_config) != 0) {
417                 ret = -1;
418                 goto out;
419         }
420
421         /* sanity checks */
422         if (eal_check_common_options(&internal_config) != 0) {
423                 eal_usage(prgname);
424                 ret = -1;
425                 goto out;
426         }
427
428         if (optind >= 0)
429                 argv[optind-1] = prgname;
430         ret = optind-1;
431
432 out:
433         /* restore getopt lib */
434         optind = old_optind;
435         optopt = old_optopt;
436         optreset = old_optreset;
437         optarg = old_optarg;
438
439         return ret;
440 }
441
442 static void
443 eal_check_mem_on_local_socket(void)
444 {
445         const struct rte_memseg *ms;
446         int i, socket_id;
447
448         socket_id = rte_lcore_to_socket_id(rte_config.master_lcore);
449
450         ms = rte_eal_get_physmem_layout();
451
452         for (i = 0; i < RTE_MAX_MEMSEG; i++)
453                 if (ms[i].socket_id == socket_id &&
454                                 ms[i].len > 0)
455                         return;
456
457         RTE_LOG(WARNING, EAL, "WARNING: Master core has no "
458                         "memory on local socket!\n");
459 }
460
461 static int
462 sync_func(__attribute__((unused)) void *arg)
463 {
464         return 0;
465 }
466
467 inline static void
468 rte_eal_mcfg_complete(void)
469 {
470         /* ALL shared mem_config related INIT DONE */
471         if (rte_config.process_type == RTE_PROC_PRIMARY)
472                 rte_config.mem_config->magic = RTE_MAGIC;
473 }
474
475 /* return non-zero if hugepages are enabled. */
476 int rte_eal_has_hugepages(void)
477 {
478         return !internal_config.no_hugetlbfs;
479 }
480
481 /* Abstraction for port I/0 privilege */
482 int
483 rte_eal_iopl_init(void)
484 {
485         static int fd;
486
487         fd = open("/dev/io", O_RDWR);
488         if (fd < 0)
489                 return -1;
490         /* keep fd open for iopl */
491         return 0;
492 }
493
494 static void rte_eal_init_alert(const char *msg)
495 {
496         fprintf(stderr, "EAL: FATAL: %s\n", msg);
497         RTE_LOG(ERR, EAL, "%s\n", msg);
498 }
499
500 /* Launch threads, called at application init(). */
501 int
502 rte_eal_init(int argc, char **argv)
503 {
504         int i, fctret, ret;
505         pthread_t thread_id;
506         static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
507         char cpuset[RTE_CPU_AFFINITY_STR_LEN];
508         char thread_name[RTE_MAX_THREAD_NAME_LEN];
509
510         /* checks if the machine is adequate */
511         if (!rte_cpu_is_supported()) {
512                 rte_eal_init_alert("unsupported cpu type.");
513                 rte_errno = ENOTSUP;
514                 return -1;
515         }
516
517         if (!rte_atomic32_test_and_set(&run_once)) {
518                 rte_eal_init_alert("already called initialization.");
519                 rte_errno = EALREADY;
520                 return -1;
521         }
522
523         thread_id = pthread_self();
524
525         eal_reset_internal_config(&internal_config);
526
527         /* set log level as early as possible */
528         eal_log_level_parse(argc, argv);
529
530         if (rte_eal_cpu_init() < 0) {
531                 rte_eal_init_alert("Cannot detect lcores.");
532                 rte_errno = ENOTSUP;
533                 return -1;
534         }
535
536         fctret = eal_parse_args(argc, argv);
537         if (fctret < 0) {
538                 rte_eal_init_alert("Invalid 'command line' arguments.");
539                 rte_errno = EINVAL;
540                 rte_atomic32_clear(&run_once);
541                 return -1;
542         }
543
544         if (internal_config.no_hugetlbfs == 0 &&
545                         internal_config.process_type != RTE_PROC_SECONDARY &&
546                         eal_hugepage_info_init() < 0) {
547                 rte_eal_init_alert("Cannot get hugepage information.");
548                 rte_errno = EACCES;
549                 rte_atomic32_clear(&run_once);
550                 return -1;
551         }
552
553         if (internal_config.memory == 0 && internal_config.force_sockets == 0) {
554                 if (internal_config.no_hugetlbfs)
555                         internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
556                 else
557                         internal_config.memory = eal_get_hugepage_mem_size();
558         }
559
560         if (internal_config.vmware_tsc_map == 1) {
561 #ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
562                 rte_cycles_vmware_tsc_map = 1;
563                 RTE_LOG (DEBUG, EAL, "Using VMWARE TSC MAP, "
564                                 "you must have monitor_control.pseudo_perfctr = TRUE\n");
565 #else
566                 RTE_LOG (WARNING, EAL, "Ignoring --vmware-tsc-map because "
567                                 "RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT is not set\n");
568 #endif
569         }
570
571         rte_srand(rte_rdtsc());
572
573         rte_config_init();
574
575         if (rte_eal_memory_init() < 0) {
576                 rte_eal_init_alert("Cannot init memory\n");
577                 rte_errno = ENOMEM;
578                 return -1;
579         }
580
581         if (rte_eal_memzone_init() < 0) {
582                 rte_eal_init_alert("Cannot init memzone\n");
583                 rte_errno = ENODEV;
584                 return -1;
585         }
586
587         if (rte_eal_tailqs_init() < 0) {
588                 rte_eal_init_alert("Cannot init tail queues for objects\n");
589                 rte_errno = EFAULT;
590                 return -1;
591         }
592
593         if (rte_eal_alarm_init() < 0) {
594                 rte_eal_init_alert("Cannot init interrupt-handling thread\n");
595                 /* rte_eal_alarm_init sets rte_errno on failure. */
596                 return -1;
597         }
598
599         if (rte_eal_intr_init() < 0) {
600                 rte_eal_init_alert("Cannot init interrupt-handling thread\n");
601                 return -1;
602         }
603
604         if (rte_eal_timer_init() < 0) {
605                 rte_eal_init_alert("Cannot init HPET or TSC timers\n");
606                 rte_errno = ENOTSUP;
607                 return -1;
608         }
609
610         eal_check_mem_on_local_socket();
611
612         if (eal_plugins_init() < 0)
613                 rte_eal_init_alert("Cannot init plugins\n");
614
615         eal_thread_init_master(rte_config.master_lcore);
616
617         ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
618
619         RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
620                 rte_config.master_lcore, thread_id, cpuset,
621                 ret == 0 ? "" : "...");
622
623         if (eal_option_device_parse()) {
624                 rte_errno = ENODEV;
625                 return -1;
626         }
627
628         if (rte_bus_scan()) {
629                 rte_eal_init_alert("Cannot scan the buses for devices\n");
630                 rte_errno = ENODEV;
631                 return -1;
632         }
633
634         RTE_LCORE_FOREACH_SLAVE(i) {
635
636                 /*
637                  * create communication pipes between master thread
638                  * and children
639                  */
640                 if (pipe(lcore_config[i].pipe_master2slave) < 0)
641                         rte_panic("Cannot create pipe\n");
642                 if (pipe(lcore_config[i].pipe_slave2master) < 0)
643                         rte_panic("Cannot create pipe\n");
644
645                 lcore_config[i].state = WAIT;
646
647                 /* create a thread for each lcore */
648                 ret = pthread_create(&lcore_config[i].thread_id, NULL,
649                                      eal_thread_loop, NULL);
650                 if (ret != 0)
651                         rte_panic("Cannot create thread\n");
652
653                 /* Set thread_name for aid in debugging. */
654                 snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
655                                 "lcore-slave-%d", i);
656                 rte_thread_setname(lcore_config[i].thread_id, thread_name);
657         }
658
659         /*
660          * Launch a dummy function on all slave lcores, so that master lcore
661          * knows they are all ready when this function returns.
662          */
663         rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
664         rte_eal_mp_wait_lcore();
665
666         /* initialize services so vdevs register service during bus_probe. */
667         ret = rte_service_init();
668         if (ret) {
669                 rte_eal_init_alert("rte_service_init() failed\n");
670                 rte_errno = ENOEXEC;
671                 return -1;
672         }
673
674         /* Probe all the buses and devices/drivers on them */
675         if (rte_bus_probe()) {
676                 rte_eal_init_alert("Cannot probe devices\n");
677                 rte_errno = ENOTSUP;
678                 return -1;
679         }
680
681         /* initialize default service/lcore mappings and start running. Ignore
682          * -ENOTSUP, as it indicates no service coremask passed to EAL.
683          */
684         ret = rte_service_start_with_defaults();
685         if (ret < 0 && ret != -ENOTSUP) {
686                 rte_errno = ENOEXEC;
687                 return -1;
688         }
689
690         rte_eal_mcfg_complete();
691
692         return fctret;
693 }
694
695 /* get core role */
696 enum rte_lcore_role_t
697 rte_eal_lcore_role(unsigned lcore_id)
698 {
699         return rte_config.lcore_role[lcore_id];
700 }
701
702 enum rte_proc_type_t
703 rte_eal_process_type(void)
704 {
705         return rte_config.process_type;
706 }