1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation.
3 * Copyright(c) 2014 6WIND S.A.
20 #include <sys/queue.h>
23 #include <rte_compat.h>
24 #include <rte_common.h>
25 #include <rte_debug.h>
26 #include <rte_memory.h>
27 #include <rte_launch.h>
29 #include <rte_errno.h>
30 #include <rte_per_lcore.h>
31 #include <rte_lcore.h>
32 #include <rte_service_component.h>
34 #include <rte_random.h>
35 #include <rte_cycles.h>
36 #include <rte_string_fns.h>
37 #include <rte_cpuflags.h>
38 #include <rte_interrupts.h>
41 #include <rte_devargs.h>
42 #include <rte_version.h>
44 #include <malloc_heap.h>
45 #include <telemetry_internal.h>
47 #include "eal_private.h"
48 #include "eal_thread.h"
49 #include "eal_internal_cfg.h"
50 #include "eal_filesystem.h"
51 #include "eal_hugepages.h"
52 #include "eal_options.h"
53 #include "eal_memcfg.h"
54 #include "eal_trace.h"
56 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
58 /* define fd variable here, because file needs to be kept open for the
59 * duration of the program, as we hold a write lock on it in the primary proc */
60 static int mem_cfg_fd = -1;
62 static struct flock wr_lock = {
65 .l_start = offsetof(struct rte_mem_config, memsegs),
66 .l_len = RTE_SIZEOF_FIELD(struct rte_mem_config, memsegs),
69 /* internal configuration (per-core) */
70 struct lcore_config lcore_config[RTE_MAX_LCORE];
72 /* used by rte_rdtsc() */
73 int rte_cycles_vmware_tsc_map;
75 static const char *default_runtime_dir = "/var/run";
78 eal_create_runtime_dir(void)
80 const char *directory = default_runtime_dir;
81 const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
82 const char *fallback = "/tmp";
83 char run_dir[PATH_MAX];
88 /* try XDG path first, fall back to /tmp */
89 if (xdg_runtime_dir != NULL)
90 directory = xdg_runtime_dir;
94 /* create DPDK subdirectory under runtime dir */
95 ret = snprintf(tmp, sizeof(tmp), "%s/dpdk", directory);
96 if (ret < 0 || ret == sizeof(tmp)) {
97 RTE_LOG(ERR, EAL, "Error creating DPDK runtime path name\n");
101 /* create prefix-specific subdirectory under DPDK runtime dir */
102 ret = snprintf(run_dir, sizeof(run_dir), "%s/%s",
103 tmp, eal_get_hugefile_prefix());
104 if (ret < 0 || ret == sizeof(run_dir)) {
105 RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime path name\n");
109 /* create the path if it doesn't exist. no "mkdir -p" here, so do it
112 ret = mkdir(tmp, 0700);
113 if (ret < 0 && errno != EEXIST) {
114 RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
115 tmp, strerror(errno));
119 ret = mkdir(run_dir, 0700);
120 if (ret < 0 && errno != EEXIST) {
121 RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
122 run_dir, strerror(errno));
126 if (eal_set_runtime_dir(run_dir, sizeof(run_dir)))
133 eal_clean_runtime_dir(void)
135 /* FreeBSD doesn't need this implemented for now, because, unlike Linux,
136 * FreeBSD doesn't create per-process files, so no need to clean up.
141 /* parse a sysfs (or other) file containing one integer value */
143 eal_parse_sysfs_value(const char *filename, unsigned long *val)
149 if ((f = fopen(filename, "r")) == NULL) {
150 RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
155 if (fgets(buf, sizeof(buf), f) == NULL) {
156 RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
161 *val = strtoul(buf, &end, 0);
162 if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
163 RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
173 /* create memory configuration in shared/mmap memory. Take out
174 * a write lock on the memsegs, so we can auto-detect primary/secondary.
175 * This means we never close the file while running (auto-close on exit).
176 * We also don't lock the whole file, so that in future we can use read-locks
177 * on other parts, e.g. memzones, to detect if there are running secondary
180 rte_eal_config_create(void)
182 struct rte_config *config = rte_eal_get_configuration();
183 const struct internal_config *internal_conf =
184 eal_get_internal_configuration();
185 size_t page_sz = sysconf(_SC_PAGE_SIZE);
186 size_t cfg_len = sizeof(struct rte_mem_config);
187 size_t cfg_len_aligned = RTE_ALIGN(cfg_len, page_sz);
188 void *rte_mem_cfg_addr, *mapped_mem_cfg_addr;
191 const char *pathname = eal_runtime_config_path();
193 if (internal_conf->no_shconf)
196 /* map the config before base address so that we don't waste a page */
197 if (internal_conf->base_virtaddr != 0)
198 rte_mem_cfg_addr = (void *)
199 RTE_ALIGN_FLOOR(internal_conf->base_virtaddr -
200 sizeof(struct rte_mem_config), page_sz);
202 rte_mem_cfg_addr = NULL;
205 mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600);
206 if (mem_cfg_fd < 0) {
207 RTE_LOG(ERR, EAL, "Cannot open '%s' for rte_mem_config\n",
213 retval = ftruncate(mem_cfg_fd, cfg_len);
217 RTE_LOG(ERR, EAL, "Cannot resize '%s' for rte_mem_config\n",
222 retval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);
226 RTE_LOG(ERR, EAL, "Cannot create lock on '%s'. Is another primary "
227 "process running?\n", pathname);
231 /* reserve space for config */
232 rte_mem_cfg_addr = eal_get_virtual_area(rte_mem_cfg_addr,
233 &cfg_len_aligned, page_sz, 0, 0);
234 if (rte_mem_cfg_addr == NULL) {
235 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
241 /* remap the actual file into the space we've just reserved */
242 mapped_mem_cfg_addr = mmap(rte_mem_cfg_addr,
243 cfg_len_aligned, PROT_READ | PROT_WRITE,
244 MAP_SHARED | MAP_FIXED, mem_cfg_fd, 0);
245 if (mapped_mem_cfg_addr == MAP_FAILED) {
246 RTE_LOG(ERR, EAL, "Cannot remap memory for rte_config\n");
247 munmap(rte_mem_cfg_addr, cfg_len);
253 memcpy(rte_mem_cfg_addr, config->mem_config, sizeof(struct rte_mem_config));
254 config->mem_config = rte_mem_cfg_addr;
256 /* store address of the config in the config itself so that secondary
257 * processes could later map the config into this exact location
259 config->mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;
263 /* attach to an existing shared memory config */
265 rte_eal_config_attach(void)
267 void *rte_mem_cfg_addr;
268 const char *pathname = eal_runtime_config_path();
269 struct rte_config *config = rte_eal_get_configuration();
270 const struct internal_config *internal_conf =
271 eal_get_internal_configuration();
274 if (internal_conf->no_shconf)
278 mem_cfg_fd = open(pathname, O_RDWR);
279 if (mem_cfg_fd < 0) {
280 RTE_LOG(ERR, EAL, "Cannot open '%s' for rte_mem_config\n",
286 rte_mem_cfg_addr = mmap(NULL, sizeof(*config->mem_config),
287 PROT_READ, MAP_SHARED, mem_cfg_fd, 0);
288 /* don't close the fd here, it will be closed on reattach */
289 if (rte_mem_cfg_addr == MAP_FAILED) {
292 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
293 errno, strerror(errno));
297 config->mem_config = rte_mem_cfg_addr;
302 /* reattach the shared config at exact memory location primary process has it */
304 rte_eal_config_reattach(void)
306 struct rte_mem_config *mem_config;
307 void *rte_mem_cfg_addr;
308 struct rte_config *config = rte_eal_get_configuration();
309 const struct internal_config *internal_conf =
310 eal_get_internal_configuration();
312 if (internal_conf->no_shconf)
315 /* save the address primary process has mapped shared config to */
317 (void *)(uintptr_t)config->mem_config->mem_cfg_addr;
319 /* unmap original config */
320 munmap(config->mem_config, sizeof(struct rte_mem_config));
322 /* remap the config at proper address */
323 mem_config = (struct rte_mem_config *) mmap(rte_mem_cfg_addr,
324 sizeof(*mem_config), PROT_READ | PROT_WRITE, MAP_SHARED,
329 if (mem_config == MAP_FAILED || mem_config != rte_mem_cfg_addr) {
330 if (mem_config != MAP_FAILED) {
331 /* errno is stale, don't use */
332 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
333 " - please use '--" OPT_BASE_VIRTADDR
335 rte_mem_cfg_addr, mem_config);
336 munmap(mem_config, sizeof(struct rte_mem_config));
339 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
340 errno, strerror(errno));
344 config->mem_config = mem_config;
349 /* Detect if we are a primary or a secondary process */
351 eal_proc_type_detect(void)
353 enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
354 const char *pathname = eal_runtime_config_path();
355 const struct internal_config *internal_conf =
356 eal_get_internal_configuration();
358 /* if there no shared config, there can be no secondary processes */
359 if (!internal_conf->no_shconf) {
360 /* if we can open the file but not get a write-lock we are a
361 * secondary process. NOTE: if we get a file handle back, we
362 * keep that open and don't close it to prevent a race condition
363 * between multiple opens.
365 if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
366 (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
367 ptype = RTE_PROC_SECONDARY;
370 RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
371 ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");
376 /* Sets up rte_config structure with the pointer to shared memory config.*/
378 rte_config_init(void)
380 struct rte_config *config = rte_eal_get_configuration();
381 const struct internal_config *internal_conf =
382 eal_get_internal_configuration();
384 config->process_type = internal_conf->process_type;
386 switch (config->process_type) {
387 case RTE_PROC_PRIMARY:
388 if (rte_eal_config_create() < 0)
390 eal_mcfg_update_from_internal();
392 case RTE_PROC_SECONDARY:
393 if (rte_eal_config_attach() < 0)
395 eal_mcfg_wait_complete();
396 if (eal_mcfg_check_version() < 0) {
397 RTE_LOG(ERR, EAL, "Primary and secondary process DPDK version mismatch\n");
400 if (rte_eal_config_reattach() < 0)
402 if (!__rte_mp_enable()) {
403 RTE_LOG(ERR, EAL, "Primary process refused secondary attachment\n");
406 eal_mcfg_update_internal();
409 case RTE_PROC_INVALID:
410 RTE_LOG(ERR, EAL, "Invalid process type %d\n",
411 config->process_type);
420 eal_usage(const char *prgname)
422 rte_usage_hook_t hook = eal_get_application_usage_hook();
424 printf("\nUsage: %s ", prgname);
426 /* Allow the application to print its usage message too if hook is set */
428 printf("===== Application Usage =====\n\n");
434 eal_get_hugepage_mem_size(void)
438 struct internal_config *internal_conf =
439 eal_get_internal_configuration();
441 for (i = 0; i < internal_conf->num_hugepage_sizes; i++) {
442 struct hugepage_info *hpi = &internal_conf->hugepage_info[i];
443 if (strnlen(hpi->hugedir, sizeof(hpi->hugedir)) != 0) {
444 for (j = 0; j < RTE_MAX_NUMA_NODES; j++) {
445 size += hpi->hugepage_sz * hpi->num_pages[j];
450 return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
453 /* Parse the arguments for --log-level only */
455 eal_log_level_parse(int argc, char **argv)
460 const int old_optind = optind;
461 const int old_optopt = optopt;
462 const int old_optreset = optreset;
463 char * const old_optarg = optarg;
464 struct internal_config *internal_conf =
465 eal_get_internal_configuration();
471 while ((opt = getopt_long(argc, argvopt, eal_short_options,
472 eal_long_options, &option_index)) != EOF) {
476 /* getopt is not happy, stop right now */
480 ret = (opt == OPT_LOG_LEVEL_NUM) ?
481 eal_parse_common_option(opt, optarg, internal_conf) : 0;
483 /* common parser is not happy */
488 /* restore getopt lib */
491 optreset = old_optreset;
495 /* Parse the argument given in the command line of the application */
497 eal_parse_args(int argc, char **argv)
502 char *prgname = argv[0];
503 const int old_optind = optind;
504 const int old_optopt = optopt;
505 const int old_optreset = optreset;
506 char * const old_optarg = optarg;
507 struct internal_config *internal_conf =
508 eal_get_internal_configuration();
514 while ((opt = getopt_long(argc, argvopt, eal_short_options,
515 eal_long_options, &option_index)) != EOF) {
517 /* getopt didn't recognise the option */
524 /* eal_log_level_parse() already handled this option */
525 if (opt == OPT_LOG_LEVEL_NUM)
528 ret = eal_parse_common_option(opt, optarg, internal_conf);
529 /* common parser is not happy */
535 /* common parser handled this option */
540 case OPT_MBUF_POOL_OPS_NAME_NUM:
542 char *ops_name = strdup(optarg);
543 if (ops_name == NULL)
544 RTE_LOG(ERR, EAL, "Could not store mbuf pool ops name\n");
546 /* free old ops name */
547 if (internal_conf->user_mbuf_pool_ops_name !=
549 free(internal_conf->user_mbuf_pool_ops_name);
551 internal_conf->user_mbuf_pool_ops_name =
560 if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
561 RTE_LOG(ERR, EAL, "Option %c is not supported "
562 "on FreeBSD\n", opt);
563 } else if (opt >= OPT_LONG_MIN_NUM &&
564 opt < OPT_LONG_MAX_NUM) {
565 RTE_LOG(ERR, EAL, "Option %s is not supported "
567 eal_long_options[option_index].name);
569 RTE_LOG(ERR, EAL, "Option %d is not supported "
570 "on FreeBSD\n", opt);
578 /* create runtime data directory. In no_shconf mode, skip any errors */
579 if (eal_create_runtime_dir() < 0) {
580 if (internal_conf->no_shconf == 0) {
581 RTE_LOG(ERR, EAL, "Cannot create runtime directory\n");
585 RTE_LOG(WARNING, EAL, "No DPDK runtime directory created\n");
588 if (eal_adjust_config(internal_conf) != 0) {
594 if (eal_check_common_options(internal_conf) != 0) {
601 argv[optind-1] = prgname;
605 /* restore getopt lib */
608 optreset = old_optreset;
615 check_socket(const struct rte_memseg_list *msl, void *arg)
617 int *socket_id = arg;
622 if (msl->socket_id == *socket_id && msl->memseg_arr.count != 0)
629 eal_check_mem_on_local_socket(void)
632 const struct rte_config *config = rte_eal_get_configuration();
634 socket_id = rte_lcore_to_socket_id(config->main_lcore);
636 if (rte_memseg_list_walk(check_socket, &socket_id) == 0)
637 RTE_LOG(WARNING, EAL, "WARNING: Main core has no memory on local socket!\n");
642 sync_func(__rte_unused void *arg)
646 /* Abstraction for port I/0 privilege */
648 rte_eal_iopl_init(void)
653 fd = open("/dev/io", O_RDWR);
657 /* keep fd open for iopl */
661 static void rte_eal_init_alert(const char *msg)
663 fprintf(stderr, "EAL: FATAL: %s\n", msg);
664 RTE_LOG(ERR, EAL, "%s\n", msg);
667 /* Launch threads, called at application init(). */
669 rte_eal_init(int argc, char **argv)
673 static uint32_t run_once;
674 uint32_t has_run = 0;
675 char cpuset[RTE_CPU_AFFINITY_STR_LEN];
676 char thread_name[RTE_MAX_THREAD_NAME_LEN];
677 const struct rte_config *config = rte_eal_get_configuration();
678 struct internal_config *internal_conf =
679 eal_get_internal_configuration();
681 /* checks if the machine is adequate */
682 if (!rte_cpu_is_supported()) {
683 rte_eal_init_alert("unsupported cpu type.");
688 if (!__atomic_compare_exchange_n(&run_once, &has_run, 1, 0,
689 __ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
690 rte_eal_init_alert("already called initialization.");
691 rte_errno = EALREADY;
695 thread_id = pthread_self();
697 eal_reset_internal_config(internal_conf);
699 /* clone argv to report out later in telemetry */
700 eal_save_args(argc, argv);
702 /* set log level as early as possible */
703 eal_log_level_parse(argc, argv);
705 if (rte_eal_cpu_init() < 0) {
706 rte_eal_init_alert("Cannot detect lcores.");
711 fctret = eal_parse_args(argc, argv);
713 rte_eal_init_alert("Invalid 'command line' arguments.");
715 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
719 /* FreeBSD always uses legacy memory model */
720 internal_conf->legacy_mem = true;
722 if (eal_plugins_init() < 0) {
723 rte_eal_init_alert("Cannot init plugins");
725 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
729 if (eal_trace_init() < 0) {
730 rte_eal_init_alert("Cannot init trace");
732 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
736 if (eal_option_device_parse()) {
738 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
742 if (rte_config_init() < 0) {
743 rte_eal_init_alert("Cannot init config");
747 if (rte_eal_intr_init() < 0) {
748 rte_eal_init_alert("Cannot init interrupt-handling thread");
752 if (rte_eal_alarm_init() < 0) {
753 rte_eal_init_alert("Cannot init alarm");
754 /* rte_eal_alarm_init sets rte_errno on failure. */
758 /* Put mp channel init before bus scan so that we can init the vdev
759 * bus through mp channel in the secondary process before the bus scan.
761 if (rte_mp_channel_init() < 0 && rte_errno != ENOTSUP) {
762 rte_eal_init_alert("failed to init mp channel");
763 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
769 if (rte_bus_scan()) {
770 rte_eal_init_alert("Cannot scan the buses for devices");
772 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
776 /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
777 if (internal_conf->iova_mode == RTE_IOVA_DC) {
778 /* autodetect the IOVA mapping mode (default is RTE_IOVA_PA) */
779 enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();
781 if (iova_mode == RTE_IOVA_DC)
782 iova_mode = RTE_IOVA_PA;
783 rte_eal_get_configuration()->iova_mode = iova_mode;
785 rte_eal_get_configuration()->iova_mode =
786 internal_conf->iova_mode;
789 RTE_LOG(INFO, EAL, "Selected IOVA mode '%s'\n",
790 rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
792 if (internal_conf->no_hugetlbfs == 0) {
793 /* rte_config isn't initialized yet */
794 ret = internal_conf->process_type == RTE_PROC_PRIMARY ?
795 eal_hugepage_info_init() :
796 eal_hugepage_info_read();
798 rte_eal_init_alert("Cannot get hugepage information.");
800 __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED);
805 if (internal_conf->memory == 0 && internal_conf->force_sockets == 0) {
806 if (internal_conf->no_hugetlbfs)
807 internal_conf->memory = MEMSIZE_IF_NO_HUGE_PAGE;
809 internal_conf->memory = eal_get_hugepage_mem_size();
812 if (internal_conf->vmware_tsc_map == 1) {
813 #ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
814 rte_cycles_vmware_tsc_map = 1;
815 RTE_LOG (DEBUG, EAL, "Using VMWARE TSC MAP, "
816 "you must have monitor_control.pseudo_perfctr = TRUE\n");
818 RTE_LOG (WARNING, EAL, "Ignoring --vmware-tsc-map because "
819 "RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT is not set\n");
823 /* in secondary processes, memory init may allocate additional fbarrays
824 * not present in primary processes, so to avoid any potential issues,
825 * initialize memzones first.
827 if (rte_eal_memzone_init() < 0) {
828 rte_eal_init_alert("Cannot init memzone");
833 if (rte_eal_memory_init() < 0) {
834 rte_eal_init_alert("Cannot init memory");
839 if (rte_eal_malloc_heap_init() < 0) {
840 rte_eal_init_alert("Cannot init malloc heap");
845 if (rte_eal_tailqs_init() < 0) {
846 rte_eal_init_alert("Cannot init tail queues for objects");
851 if (rte_eal_timer_init() < 0) {
852 rte_eal_init_alert("Cannot init HPET or TSC timers");
857 eal_check_mem_on_local_socket();
859 if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
860 &lcore_config[config->main_lcore].cpuset) != 0) {
861 rte_eal_init_alert("Cannot set affinity");
865 __rte_thread_init(config->main_lcore,
866 &lcore_config[config->main_lcore].cpuset);
868 ret = eal_thread_dump_current_affinity(cpuset, sizeof(cpuset));
870 RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
871 config->main_lcore, thread_id, cpuset,
872 ret == 0 ? "" : "...");
874 RTE_LCORE_FOREACH_WORKER(i) {
877 * create communication pipes between main thread
880 if (pipe(lcore_config[i].pipe_main2worker) < 0)
881 rte_panic("Cannot create pipe\n");
882 if (pipe(lcore_config[i].pipe_worker2main) < 0)
883 rte_panic("Cannot create pipe\n");
885 lcore_config[i].state = WAIT;
887 /* create a thread for each lcore */
888 ret = pthread_create(&lcore_config[i].thread_id, NULL,
889 eal_thread_loop, NULL);
891 rte_panic("Cannot create thread\n");
893 /* Set thread_name for aid in debugging. */
894 snprintf(thread_name, sizeof(thread_name),
895 "lcore-worker-%d", i);
896 rte_thread_setname(lcore_config[i].thread_id, thread_name);
898 ret = pthread_setaffinity_np(lcore_config[i].thread_id,
899 sizeof(rte_cpuset_t), &lcore_config[i].cpuset);
901 rte_panic("Cannot set affinity\n");
905 * Launch a dummy function on all worker lcores, so that main lcore
906 * knows they are all ready when this function returns.
908 rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MAIN);
909 rte_eal_mp_wait_lcore();
911 /* initialize services so vdevs register service during bus_probe. */
912 ret = rte_service_init();
914 rte_eal_init_alert("rte_service_init() failed");
919 /* Probe all the buses and devices/drivers on them */
920 if (rte_bus_probe()) {
921 rte_eal_init_alert("Cannot probe devices");
926 /* initialize default service/lcore mappings and start running. Ignore
927 * -ENOTSUP, as it indicates no service coremask passed to EAL.
929 ret = rte_service_start_with_defaults();
930 if (ret < 0 && ret != -ENOTSUP) {
936 * Clean up unused files in runtime directory. We do this at the end of
937 * init and not at the beginning because we want to clean stuff up
938 * whether we are primary or secondary process, but we cannot remove
939 * primary process' files because secondary should be able to run even
940 * if primary process is dead.
942 * In no_shconf mode, no runtime directory is created in the first
943 * place, so no cleanup needed.
945 if (!internal_conf->no_shconf && eal_clean_runtime_dir() < 0) {
946 rte_eal_init_alert("Cannot clear runtime directory");
949 if (!internal_conf->no_telemetry) {
950 int tlog = rte_log_register_type_and_pick_level(
951 "lib.telemetry", RTE_LOG_WARNING);
953 tlog = RTE_LOGTYPE_EAL;
954 if (rte_telemetry_init(rte_eal_get_runtime_dir(),
956 &internal_conf->ctrl_cpuset, rte_log, tlog) != 0)
966 rte_eal_cleanup(void)
968 struct internal_config *internal_conf =
969 eal_get_internal_configuration();
970 rte_service_finalize();
971 rte_mp_channel_cleanup();
972 /* after this point, any DPDK pointers will become dangling */
973 rte_eal_memory_detach();
976 eal_cleanup_config(internal_conf);
980 int rte_eal_create_uio_dev(void)
982 const struct internal_config *internal_conf =
983 eal_get_internal_configuration();
984 return internal_conf->create_uio_dev;
988 rte_eal_vfio_intr_mode(void)
990 return RTE_INTR_MODE_NONE;
994 rte_eal_vfio_get_vf_token(__rte_unused rte_uuid_t vf_token)
998 int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
999 __rte_unused const char *dev_addr,
1000 __rte_unused int *vfio_dev_fd,
1001 __rte_unused struct vfio_device_info *device_info)
1006 int rte_vfio_release_device(__rte_unused const char *sysfs_base,
1007 __rte_unused const char *dev_addr,
1008 __rte_unused int fd)
1013 int rte_vfio_enable(__rte_unused const char *modname)
1018 int rte_vfio_is_enabled(__rte_unused const char *modname)
1023 int rte_vfio_noiommu_is_enabled(void)
1028 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
1034 rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
1035 __rte_unused const char *dev_addr,
1036 __rte_unused int *iommu_group_num)
1042 rte_vfio_get_container_fd(void)
1048 rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
1054 rte_vfio_container_create(void)
1060 rte_vfio_container_destroy(__rte_unused int container_fd)
1066 rte_vfio_container_group_bind(__rte_unused int container_fd,
1067 __rte_unused int iommu_group_num)
1073 rte_vfio_container_group_unbind(__rte_unused int container_fd,
1074 __rte_unused int iommu_group_num)
1080 rte_vfio_container_dma_map(__rte_unused int container_fd,
1081 __rte_unused uint64_t vaddr,
1082 __rte_unused uint64_t iova,
1083 __rte_unused uint64_t len)
1089 rte_vfio_container_dma_unmap(__rte_unused int container_fd,
1090 __rte_unused uint64_t vaddr,
1091 __rte_unused uint64_t iova,
1092 __rte_unused uint64_t len)