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 <rte_option.h>
45 #include <rte_atomic.h>
46 #include <malloc_heap.h>
47 #include <rte_telemetry.h>
49 #include "eal_private.h"
50 #include "eal_thread.h"
51 #include "eal_internal_cfg.h"
52 #include "eal_filesystem.h"
53 #include "eal_hugepages.h"
54 #include "eal_options.h"
55 #include "eal_memcfg.h"
56 #include "eal_trace.h"
58 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
60 /* Allow the application to print its usage message too if set */
61 static rte_usage_hook_t rte_application_usage_hook = NULL;
62 /* early configuration structure, when memory config is not mmapped */
63 static struct rte_mem_config early_mem_config;
65 /* define fd variable here, because file needs to be kept open for the
66 * duration of the program, as we hold a write lock on it in the primary proc */
67 static int mem_cfg_fd = -1;
69 static struct flock wr_lock = {
72 .l_start = offsetof(struct rte_mem_config, memsegs),
73 .l_len = sizeof(early_mem_config.memsegs),
76 /* Address of global and public configuration */
77 static struct rte_config rte_config = {
78 .mem_config = &early_mem_config,
81 /* internal configuration (per-core) */
82 struct lcore_config lcore_config[RTE_MAX_LCORE];
84 /* internal configuration */
85 struct internal_config internal_config;
87 /* used by rte_rdtsc() */
88 int rte_cycles_vmware_tsc_map;
90 /* platform-specific runtime dir */
91 static char runtime_dir[PATH_MAX];
93 static const char *default_runtime_dir = "/var/run";
96 eal_create_runtime_dir(void)
98 const char *directory = default_runtime_dir;
99 const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
100 const char *fallback = "/tmp";
105 /* try XDG path first, fall back to /tmp */
106 if (xdg_runtime_dir != NULL)
107 directory = xdg_runtime_dir;
109 directory = fallback;
111 /* create DPDK subdirectory under runtime dir */
112 ret = snprintf(tmp, sizeof(tmp), "%s/dpdk", directory);
113 if (ret < 0 || ret == sizeof(tmp)) {
114 RTE_LOG(ERR, EAL, "Error creating DPDK runtime path name\n");
118 /* create prefix-specific subdirectory under DPDK runtime dir */
119 ret = snprintf(runtime_dir, sizeof(runtime_dir), "%s/%s",
120 tmp, eal_get_hugefile_prefix());
121 if (ret < 0 || ret == sizeof(runtime_dir)) {
122 RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime path name\n");
126 /* create the path if it doesn't exist. no "mkdir -p" here, so do it
129 ret = mkdir(tmp, 0700);
130 if (ret < 0 && errno != EEXIST) {
131 RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
132 tmp, strerror(errno));
136 ret = mkdir(runtime_dir, 0700);
137 if (ret < 0 && errno != EEXIST) {
138 RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
139 runtime_dir, strerror(errno));
147 eal_clean_runtime_dir(void)
149 /* FreeBSD doesn't need this implemented for now, because, unlike Linux,
150 * FreeBSD doesn't create per-process files, so no need to clean up.
157 rte_eal_get_runtime_dir(void)
162 /* Return user provided mbuf pool ops name */
164 rte_eal_mbuf_user_pool_ops(void)
166 return internal_config.user_mbuf_pool_ops_name;
169 /* Return a pointer to the configuration structure */
171 rte_eal_get_configuration(void)
177 rte_eal_iova_mode(void)
179 return rte_eal_get_configuration()->iova_mode;
182 /* parse a sysfs (or other) file containing one integer value */
184 eal_parse_sysfs_value(const char *filename, unsigned long *val)
190 if ((f = fopen(filename, "r")) == NULL) {
191 RTE_LOG(ERR, EAL, "%s(): cannot open sysfs value %s\n",
196 if (fgets(buf, sizeof(buf), f) == NULL) {
197 RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
202 *val = strtoul(buf, &end, 0);
203 if ((buf[0] == '\0') || (end == NULL) || (*end != '\n')) {
204 RTE_LOG(ERR, EAL, "%s(): cannot parse sysfs value %s\n",
214 /* create memory configuration in shared/mmap memory. Take out
215 * a write lock on the memsegs, so we can auto-detect primary/secondary.
216 * This means we never close the file while running (auto-close on exit).
217 * We also don't lock the whole file, so that in future we can use read-locks
218 * on other parts, e.g. memzones, to detect if there are running secondary
221 rte_eal_config_create(void)
223 size_t page_sz = sysconf(_SC_PAGE_SIZE);
224 size_t cfg_len = sizeof(*rte_config.mem_config);
225 size_t cfg_len_aligned = RTE_ALIGN(cfg_len, page_sz);
226 void *rte_mem_cfg_addr, *mapped_mem_cfg_addr;
229 const char *pathname = eal_runtime_config_path();
231 if (internal_config.no_shconf)
234 /* map the config before base address so that we don't waste a page */
235 if (internal_config.base_virtaddr != 0)
236 rte_mem_cfg_addr = (void *)
237 RTE_ALIGN_FLOOR(internal_config.base_virtaddr -
238 sizeof(struct rte_mem_config), page_sz);
240 rte_mem_cfg_addr = NULL;
243 mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600);
244 if (mem_cfg_fd < 0) {
245 RTE_LOG(ERR, EAL, "Cannot open '%s' for rte_mem_config\n",
251 retval = ftruncate(mem_cfg_fd, cfg_len);
255 RTE_LOG(ERR, EAL, "Cannot resize '%s' for rte_mem_config\n",
260 retval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);
264 RTE_LOG(ERR, EAL, "Cannot create lock on '%s'. Is another primary "
265 "process running?\n", pathname);
269 /* reserve space for config */
270 rte_mem_cfg_addr = eal_get_virtual_area(rte_mem_cfg_addr,
271 &cfg_len_aligned, page_sz, 0, 0);
272 if (rte_mem_cfg_addr == NULL) {
273 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config\n");
279 /* remap the actual file into the space we've just reserved */
280 mapped_mem_cfg_addr = mmap(rte_mem_cfg_addr,
281 cfg_len_aligned, PROT_READ | PROT_WRITE,
282 MAP_SHARED | MAP_FIXED, mem_cfg_fd, 0);
283 if (mapped_mem_cfg_addr == MAP_FAILED) {
284 RTE_LOG(ERR, EAL, "Cannot remap memory for rte_config\n");
285 munmap(rte_mem_cfg_addr, cfg_len);
291 memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
292 rte_config.mem_config = rte_mem_cfg_addr;
294 /* store address of the config in the config itself so that secondary
295 * processes could later map the config into this exact location
297 rte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;
302 /* attach to an existing shared memory config */
304 rte_eal_config_attach(void)
306 void *rte_mem_cfg_addr;
307 const char *pathname = eal_runtime_config_path();
309 if (internal_config.no_shconf)
313 mem_cfg_fd = open(pathname, O_RDWR);
314 if (mem_cfg_fd < 0) {
315 RTE_LOG(ERR, EAL, "Cannot open '%s' for rte_mem_config\n",
321 rte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),
322 PROT_READ, MAP_SHARED, mem_cfg_fd, 0);
323 /* don't close the fd here, it will be closed on reattach */
324 if (rte_mem_cfg_addr == MAP_FAILED) {
327 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
328 errno, strerror(errno));
332 rte_config.mem_config = rte_mem_cfg_addr;
337 /* reattach the shared config at exact memory location primary process has it */
339 rte_eal_config_reattach(void)
341 struct rte_mem_config *mem_config;
342 void *rte_mem_cfg_addr;
344 if (internal_config.no_shconf)
347 /* save the address primary process has mapped shared config to */
349 (void *)(uintptr_t)rte_config.mem_config->mem_cfg_addr;
351 /* unmap original config */
352 munmap(rte_config.mem_config, sizeof(struct rte_mem_config));
354 /* remap the config at proper address */
355 mem_config = (struct rte_mem_config *) mmap(rte_mem_cfg_addr,
356 sizeof(*mem_config), PROT_READ | PROT_WRITE, MAP_SHARED,
361 if (mem_config == MAP_FAILED || mem_config != rte_mem_cfg_addr) {
362 if (mem_config != MAP_FAILED) {
363 /* errno is stale, don't use */
364 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
365 " - please use '--" OPT_BASE_VIRTADDR
367 rte_mem_cfg_addr, mem_config);
368 munmap(mem_config, sizeof(struct rte_mem_config));
371 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
372 errno, strerror(errno));
376 rte_config.mem_config = mem_config;
381 /* Detect if we are a primary or a secondary process */
383 eal_proc_type_detect(void)
385 enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
386 const char *pathname = eal_runtime_config_path();
388 /* if there no shared config, there can be no secondary processes */
389 if (!internal_config.no_shconf) {
390 /* if we can open the file but not get a write-lock we are a
391 * secondary process. NOTE: if we get a file handle back, we
392 * keep that open and don't close it to prevent a race condition
393 * between multiple opens.
395 if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
396 (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
397 ptype = RTE_PROC_SECONDARY;
400 RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
401 ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");
406 /* Sets up rte_config structure with the pointer to shared memory config.*/
408 rte_config_init(void)
410 rte_config.process_type = internal_config.process_type;
412 switch (rte_config.process_type){
413 case RTE_PROC_PRIMARY:
414 if (rte_eal_config_create() < 0)
416 eal_mcfg_update_from_internal();
418 case RTE_PROC_SECONDARY:
419 if (rte_eal_config_attach() < 0)
421 eal_mcfg_wait_complete();
422 if (eal_mcfg_check_version() < 0) {
423 RTE_LOG(ERR, EAL, "Primary and secondary process DPDK version mismatch\n");
426 if (rte_eal_config_reattach() < 0)
428 eal_mcfg_update_internal();
431 case RTE_PROC_INVALID:
432 RTE_LOG(ERR, EAL, "Invalid process type %d\n",
433 rte_config.process_type);
442 eal_usage(const char *prgname)
444 printf("\nUsage: %s ", prgname);
446 /* Allow the application to print its usage message too if hook is set */
447 if ( rte_application_usage_hook ) {
448 printf("===== Application Usage =====\n\n");
449 rte_application_usage_hook(prgname);
453 /* Set a per-application usage message */
455 rte_set_application_usage_hook( rte_usage_hook_t usage_func )
457 rte_usage_hook_t old_func;
459 /* Will be NULL on the first call to denote the last usage routine. */
460 old_func = rte_application_usage_hook;
461 rte_application_usage_hook = usage_func;
467 eal_get_hugepage_mem_size(void)
472 for (i = 0; i < internal_config.num_hugepage_sizes; i++) {
473 struct hugepage_info *hpi = &internal_config.hugepage_info[i];
474 if (strnlen(hpi->hugedir, sizeof(hpi->hugedir)) != 0) {
475 for (j = 0; j < RTE_MAX_NUMA_NODES; j++) {
476 size += hpi->hugepage_sz * hpi->num_pages[j];
481 return (size < SIZE_MAX) ? (size_t)(size) : SIZE_MAX;
484 /* Parse the arguments for --log-level only */
486 eal_log_level_parse(int argc, char **argv)
491 const int old_optind = optind;
492 const int old_optopt = optopt;
493 const int old_optreset = optreset;
494 char * const old_optarg = optarg;
500 while ((opt = getopt_long(argc, argvopt, eal_short_options,
501 eal_long_options, &option_index)) != EOF) {
505 /* getopt is not happy, stop right now */
509 ret = (opt == OPT_LOG_LEVEL_NUM) ?
510 eal_parse_common_option(opt, optarg, &internal_config) : 0;
512 /* common parser is not happy */
517 /* restore getopt lib */
520 optreset = old_optreset;
524 /* Parse the argument given in the command line of the application */
526 eal_parse_args(int argc, char **argv)
531 char *prgname = argv[0];
532 const int old_optind = optind;
533 const int old_optopt = optopt;
534 const int old_optreset = optreset;
535 char * const old_optarg = optarg;
542 while ((opt = getopt_long(argc, argvopt, eal_short_options,
543 eal_long_options, &option_index)) != EOF) {
546 * getopt didn't recognise the option, lets parse the
547 * registered options to see if the flag is valid
550 ret = rte_option_parse(argv[optind-1]);
559 ret = eal_parse_common_option(opt, optarg, &internal_config);
560 /* common parser is not happy */
566 /* common parser handled this option */
571 case OPT_MBUF_POOL_OPS_NAME_NUM:
573 char *ops_name = strdup(optarg);
574 if (ops_name == NULL)
575 RTE_LOG(ERR, EAL, "Could not store mbuf pool ops name\n");
577 /* free old ops name */
578 if (internal_config.user_mbuf_pool_ops_name !=
580 free(internal_config.user_mbuf_pool_ops_name);
582 internal_config.user_mbuf_pool_ops_name =
591 if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
592 RTE_LOG(ERR, EAL, "Option %c is not supported "
593 "on FreeBSD\n", opt);
594 } else if (opt >= OPT_LONG_MIN_NUM &&
595 opt < OPT_LONG_MAX_NUM) {
596 RTE_LOG(ERR, EAL, "Option %s is not supported "
598 eal_long_options[option_index].name);
600 RTE_LOG(ERR, EAL, "Option %d is not supported "
601 "on FreeBSD\n", opt);
609 /* create runtime data directory */
610 if (internal_config.no_shconf == 0 &&
611 eal_create_runtime_dir() < 0) {
612 RTE_LOG(ERR, EAL, "Cannot create runtime directory\n");
617 if (eal_adjust_config(&internal_config) != 0) {
623 if (eal_check_common_options(&internal_config) != 0) {
630 argv[optind-1] = prgname;
634 /* restore getopt lib */
637 optreset = old_optreset;
644 check_socket(const struct rte_memseg_list *msl, void *arg)
646 int *socket_id = arg;
651 if (msl->socket_id == *socket_id && msl->memseg_arr.count != 0)
658 eal_check_mem_on_local_socket(void)
662 socket_id = rte_lcore_to_socket_id(rte_config.master_lcore);
664 if (rte_memseg_list_walk(check_socket, &socket_id) == 0)
665 RTE_LOG(WARNING, EAL, "WARNING: Master core has no memory on local socket!\n");
670 sync_func(__rte_unused void *arg)
675 /* return non-zero if hugepages are enabled. */
676 int rte_eal_has_hugepages(void)
678 return !internal_config.no_hugetlbfs;
681 /* Abstraction for port I/0 privilege */
683 rte_eal_iopl_init(void)
688 fd = open("/dev/io", O_RDWR);
692 /* keep fd open for iopl */
696 static void rte_eal_init_alert(const char *msg)
698 fprintf(stderr, "EAL: FATAL: %s\n", msg);
699 RTE_LOG(ERR, EAL, "%s\n", msg);
702 /* Launch threads, called at application init(). */
704 rte_eal_init(int argc, char **argv)
708 static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
709 char cpuset[RTE_CPU_AFFINITY_STR_LEN];
710 char thread_name[RTE_MAX_THREAD_NAME_LEN];
712 /* checks if the machine is adequate */
713 if (!rte_cpu_is_supported()) {
714 rte_eal_init_alert("unsupported cpu type.");
719 if (!rte_atomic32_test_and_set(&run_once)) {
720 rte_eal_init_alert("already called initialization.");
721 rte_errno = EALREADY;
725 thread_id = pthread_self();
727 eal_reset_internal_config(&internal_config);
729 /* set log level as early as possible */
730 eal_log_level_parse(argc, argv);
732 if (rte_eal_cpu_init() < 0) {
733 rte_eal_init_alert("Cannot detect lcores.");
738 fctret = eal_parse_args(argc, argv);
740 rte_eal_init_alert("Invalid 'command line' arguments.");
742 rte_atomic32_clear(&run_once);
746 /* FreeBSD always uses legacy memory model */
747 internal_config.legacy_mem = true;
749 if (eal_plugins_init() < 0) {
750 rte_eal_init_alert("Cannot init plugins");
752 rte_atomic32_clear(&run_once);
756 if (eal_trace_init() < 0) {
757 rte_eal_init_alert("Cannot init trace");
759 rte_atomic32_clear(&run_once);
763 if (eal_option_device_parse()) {
765 rte_atomic32_clear(&run_once);
769 if (rte_config_init() < 0) {
770 rte_eal_init_alert("Cannot init config");
774 if (rte_eal_intr_init() < 0) {
775 rte_eal_init_alert("Cannot init interrupt-handling thread");
779 if (rte_eal_alarm_init() < 0) {
780 rte_eal_init_alert("Cannot init alarm");
781 /* rte_eal_alarm_init sets rte_errno on failure. */
785 /* Put mp channel init before bus scan so that we can init the vdev
786 * bus through mp channel in the secondary process before the bus scan.
788 if (rte_mp_channel_init() < 0 && rte_errno != ENOTSUP) {
789 rte_eal_init_alert("failed to init mp channel");
790 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
796 if (rte_bus_scan()) {
797 rte_eal_init_alert("Cannot scan the buses for devices");
799 rte_atomic32_clear(&run_once);
803 /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
804 if (internal_config.iova_mode == RTE_IOVA_DC) {
805 /* autodetect the IOVA mapping mode (default is RTE_IOVA_PA) */
806 enum rte_iova_mode iova_mode = rte_bus_get_iommu_class();
808 if (iova_mode == RTE_IOVA_DC)
809 iova_mode = RTE_IOVA_PA;
810 rte_eal_get_configuration()->iova_mode = iova_mode;
812 rte_eal_get_configuration()->iova_mode =
813 internal_config.iova_mode;
816 RTE_LOG(INFO, EAL, "Selected IOVA mode '%s'\n",
817 rte_eal_iova_mode() == RTE_IOVA_PA ? "PA" : "VA");
819 if (internal_config.no_hugetlbfs == 0) {
820 /* rte_config isn't initialized yet */
821 ret = internal_config.process_type == RTE_PROC_PRIMARY ?
822 eal_hugepage_info_init() :
823 eal_hugepage_info_read();
825 rte_eal_init_alert("Cannot get hugepage information.");
827 rte_atomic32_clear(&run_once);
832 if (internal_config.memory == 0 && internal_config.force_sockets == 0) {
833 if (internal_config.no_hugetlbfs)
834 internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
836 internal_config.memory = eal_get_hugepage_mem_size();
839 if (internal_config.vmware_tsc_map == 1) {
840 #ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT
841 rte_cycles_vmware_tsc_map = 1;
842 RTE_LOG (DEBUG, EAL, "Using VMWARE TSC MAP, "
843 "you must have monitor_control.pseudo_perfctr = TRUE\n");
845 RTE_LOG (WARNING, EAL, "Ignoring --vmware-tsc-map because "
846 "RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT is not set\n");
850 /* in secondary processes, memory init may allocate additional fbarrays
851 * not present in primary processes, so to avoid any potential issues,
852 * initialize memzones first.
854 if (rte_eal_memzone_init() < 0) {
855 rte_eal_init_alert("Cannot init memzone");
860 if (rte_eal_memory_init() < 0) {
861 rte_eal_init_alert("Cannot init memory");
866 if (rte_eal_malloc_heap_init() < 0) {
867 rte_eal_init_alert("Cannot init malloc heap");
872 if (rte_eal_tailqs_init() < 0) {
873 rte_eal_init_alert("Cannot init tail queues for objects");
878 if (rte_eal_timer_init() < 0) {
879 rte_eal_init_alert("Cannot init HPET or TSC timers");
884 eal_check_mem_on_local_socket();
886 eal_thread_init_master(rte_config.master_lcore);
888 ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
890 RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
891 rte_config.master_lcore, thread_id, cpuset,
892 ret == 0 ? "" : "...");
894 RTE_LCORE_FOREACH_SLAVE(i) {
897 * create communication pipes between master thread
900 if (pipe(lcore_config[i].pipe_master2slave) < 0)
901 rte_panic("Cannot create pipe\n");
902 if (pipe(lcore_config[i].pipe_slave2master) < 0)
903 rte_panic("Cannot create pipe\n");
905 lcore_config[i].state = WAIT;
907 /* create a thread for each lcore */
908 ret = pthread_create(&lcore_config[i].thread_id, NULL,
909 eal_thread_loop, NULL);
911 rte_panic("Cannot create thread\n");
913 /* Set thread_name for aid in debugging. */
914 snprintf(thread_name, sizeof(thread_name),
915 "lcore-slave-%d", i);
916 rte_thread_setname(lcore_config[i].thread_id, thread_name);
920 * Launch a dummy function on all slave lcores, so that master lcore
921 * knows they are all ready when this function returns.
923 rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER);
924 rte_eal_mp_wait_lcore();
926 /* initialize services so vdevs register service during bus_probe. */
927 ret = rte_service_init();
929 rte_eal_init_alert("rte_service_init() failed");
934 /* Probe all the buses and devices/drivers on them */
935 if (rte_bus_probe()) {
936 rte_eal_init_alert("Cannot probe devices");
941 /* initialize default service/lcore mappings and start running. Ignore
942 * -ENOTSUP, as it indicates no service coremask passed to EAL.
944 ret = rte_service_start_with_defaults();
945 if (ret < 0 && ret != -ENOTSUP) {
951 * Clean up unused files in runtime directory. We do this at the end of
952 * init and not at the beginning because we want to clean stuff up
953 * whether we are primary or secondary process, but we cannot remove
954 * primary process' files because secondary should be able to run even
955 * if primary process is dead.
957 * In no_shconf mode, no runtime directory is created in the first
958 * place, so no cleanup needed.
960 if (!internal_config.no_shconf && eal_clean_runtime_dir() < 0) {
961 rte_eal_init_alert("Cannot clear runtime directory\n");
964 if (!internal_config.no_telemetry) {
965 const char *error_str;
966 if (rte_telemetry_init(rte_eal_get_runtime_dir(),
968 rte_eal_init_alert(error_str);
975 /* Call each registered callback, if enabled */
982 rte_eal_cleanup(void)
984 rte_service_finalize();
985 rte_mp_channel_cleanup();
988 eal_cleanup_config(&internal_config);
993 rte_eal_process_type(void)
995 return rte_config.process_type;
998 int rte_eal_has_pci(void)
1000 return !internal_config.no_pci;
1003 int rte_eal_create_uio_dev(void)
1005 return internal_config.create_uio_dev;
1009 rte_eal_vfio_intr_mode(void)
1011 return RTE_INTR_MODE_NONE;
1014 int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
1015 __rte_unused const char *dev_addr,
1016 __rte_unused int *vfio_dev_fd,
1017 __rte_unused struct vfio_device_info *device_info)
1022 int rte_vfio_release_device(__rte_unused const char *sysfs_base,
1023 __rte_unused const char *dev_addr,
1024 __rte_unused int fd)
1029 int rte_vfio_enable(__rte_unused const char *modname)
1034 int rte_vfio_is_enabled(__rte_unused const char *modname)
1039 int rte_vfio_noiommu_is_enabled(void)
1044 int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
1050 rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
1051 __rte_unused const char *dev_addr,
1052 __rte_unused int *iommu_group_num)
1058 rte_vfio_get_container_fd(void)
1064 rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
1070 rte_vfio_container_create(void)
1076 rte_vfio_container_destroy(__rte_unused int container_fd)
1082 rte_vfio_container_group_bind(__rte_unused int container_fd,
1083 __rte_unused int iommu_group_num)
1089 rte_vfio_container_group_unbind(__rte_unused int container_fd,
1090 __rte_unused int iommu_group_num)
1096 rte_vfio_container_dma_map(__rte_unused int container_fd,
1097 __rte_unused uint64_t vaddr,
1098 __rte_unused uint64_t iova,
1099 __rte_unused uint64_t len)
1105 rte_vfio_container_dma_unmap(__rte_unused int container_fd,
1106 __rte_unused uint64_t vaddr,
1107 __rte_unused uint64_t iova,
1108 __rte_unused uint64_t len)