1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation.
3 * Copyright(c) 2014 6WIND S.A.
9 #ifndef RTE_EXEC_ENV_WINDOWS
16 #ifndef RTE_EXEC_ENV_WINDOWS
20 #include <sys/types.h>
22 #ifndef RTE_EXEC_ENV_WINDOWS
26 #include <rte_string_fns.h>
29 #include <rte_lcore.h>
30 #include <rte_memory.h>
31 #include <rte_tailq.h>
32 #include <rte_version.h>
33 #include <rte_devargs.h>
34 #include <rte_memcpy.h>
35 #ifndef RTE_EXEC_ENV_WINDOWS
36 #include <rte_telemetry.h>
40 #include "eal_internal_cfg.h"
41 #include "eal_options.h"
42 #include "eal_filesystem.h"
43 #include "eal_private.h"
44 #ifndef RTE_EXEC_ENV_WINDOWS
45 #include "eal_trace.h"
48 #define BITS_PER_HEX 4
49 #define LCORE_OPT_LST 1
50 #define LCORE_OPT_MSK 2
51 #define LCORE_OPT_MAP 3
55 "b:" /* pci-blacklist */
57 "s:" /* service coremask */
61 "S:" /* service corelist */
62 "m:" /* memory size */
63 "n:" /* memory channels */
64 "r:" /* memory ranks */
66 "w:" /* pci-whitelist */
70 eal_long_options[] = {
71 {OPT_BASE_VIRTADDR, 1, NULL, OPT_BASE_VIRTADDR_NUM },
72 {OPT_CREATE_UIO_DEV, 0, NULL, OPT_CREATE_UIO_DEV_NUM },
73 {OPT_FILE_PREFIX, 1, NULL, OPT_FILE_PREFIX_NUM },
74 {OPT_HELP, 0, NULL, OPT_HELP_NUM },
75 {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM },
76 {OPT_HUGE_UNLINK, 0, NULL, OPT_HUGE_UNLINK_NUM },
77 {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM },
78 {OPT_LCORES, 1, NULL, OPT_LCORES_NUM },
79 {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM },
80 {OPT_TRACE, 1, NULL, OPT_TRACE_NUM },
81 {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM },
82 {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM },
83 {OPT_TRACE_MODE, 1, NULL, OPT_TRACE_MODE_NUM },
84 {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
85 {OPT_MAIN_LCORE, 1, NULL, OPT_MAIN_LCORE_NUM },
86 {OPT_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM},
87 {OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM },
88 {OPT_NO_HUGE, 0, NULL, OPT_NO_HUGE_NUM },
89 {OPT_NO_PCI, 0, NULL, OPT_NO_PCI_NUM },
90 {OPT_NO_SHCONF, 0, NULL, OPT_NO_SHCONF_NUM },
91 {OPT_IN_MEMORY, 0, NULL, OPT_IN_MEMORY_NUM },
92 {OPT_PCI_BLACKLIST, 1, NULL, OPT_PCI_BLACKLIST_NUM },
93 {OPT_PCI_WHITELIST, 1, NULL, OPT_PCI_WHITELIST_NUM },
94 {OPT_PROC_TYPE, 1, NULL, OPT_PROC_TYPE_NUM },
95 {OPT_SOCKET_MEM, 1, NULL, OPT_SOCKET_MEM_NUM },
96 {OPT_SOCKET_LIMIT, 1, NULL, OPT_SOCKET_LIMIT_NUM },
97 {OPT_SYSLOG, 1, NULL, OPT_SYSLOG_NUM },
98 {OPT_VDEV, 1, NULL, OPT_VDEV_NUM },
99 {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM },
100 {OPT_VFIO_VF_TOKEN, 1, NULL, OPT_VFIO_VF_TOKEN_NUM },
101 {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM },
102 {OPT_LEGACY_MEM, 0, NULL, OPT_LEGACY_MEM_NUM },
103 {OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM},
104 {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM},
105 {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM },
106 {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM },
107 {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM},
111 TAILQ_HEAD(shared_driver_list, shared_driver);
113 /* Definition for shared object drivers. */
114 struct shared_driver {
115 TAILQ_ENTRY(shared_driver) next;
121 /* List of external loadable drivers */
122 static struct shared_driver_list solib_list =
123 TAILQ_HEAD_INITIALIZER(solib_list);
125 #ifndef RTE_EXEC_ENV_WINDOWS
126 /* Default path of external loadable drivers */
127 static const char *default_solib_dir = RTE_EAL_PMD_PATH;
131 * Stringified version of solib path used by dpdk-pmdinfo.py
132 * Note: PLEASE DO NOT ALTER THIS without making a corresponding
133 * change to usertools/dpdk-pmdinfo.py
135 static const char dpdk_solib_path[] __rte_used =
136 "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
138 TAILQ_HEAD(device_option_list, device_option);
140 struct device_option {
141 TAILQ_ENTRY(device_option) next;
143 enum rte_devtype type;
147 static struct device_option_list devopt_list =
148 TAILQ_HEAD_INITIALIZER(devopt_list);
150 static int main_lcore_parsed;
151 static int mem_parsed;
152 static int core_parsed;
154 /* Allow the application to print its usage message too if set */
155 static rte_usage_hook_t rte_application_usage_hook;
157 /* Returns rte_usage_hook_t */
159 eal_get_application_usage_hook(void)
161 return rte_application_usage_hook;
164 /* Set a per-application usage message */
166 rte_set_application_usage_hook(rte_usage_hook_t usage_func)
168 rte_usage_hook_t old_func;
170 /* Will be NULL on the first call to denote the last usage routine. */
171 old_func = rte_application_usage_hook;
172 rte_application_usage_hook = usage_func;
177 #ifndef RTE_EXEC_ENV_WINDOWS
178 static char **eal_args;
179 static char **eal_app_args;
181 #define EAL_PARAM_REQ "/eal/params"
182 #define EAL_APP_PARAM_REQ "/eal/app_params"
184 /* callback handler for telemetry library to report out EAL flags */
186 handle_eal_info_request(const char *cmd, const char *params __rte_unused,
187 struct rte_tel_data *d)
193 if (strcmp(cmd, EAL_PARAM_REQ) == 0)
198 rte_tel_data_start_array(d, RTE_TEL_STRING_VAL);
199 if (args == NULL || args[0] == NULL)
202 for ( ; args[i] != NULL; i++)
203 used = rte_tel_data_add_array_string(d, args[i]);
208 eal_save_args(int argc, char **argv)
212 rte_telemetry_register_cmd(EAL_PARAM_REQ, handle_eal_info_request,
213 "Returns EAL commandline parameters used. Takes no parameters");
214 rte_telemetry_register_cmd(EAL_APP_PARAM_REQ, handle_eal_info_request,
215 "Returns app commandline parameters used. Takes no parameters");
217 /* clone argv to report out later. We overprovision, but
218 * this does not waste huge amounts of memory
220 eal_args = calloc(argc + 1, sizeof(*eal_args));
221 if (eal_args == NULL)
224 for (i = 0; i < argc; i++) {
225 eal_args[i] = strdup(argv[i]);
226 if (strcmp(argv[i], "--") == 0)
229 eal_args[i++] = NULL; /* always finish with NULL */
231 /* allow reporting of any app args we know about too */
235 eal_app_args = calloc(argc - i + 1, sizeof(*eal_args));
236 if (eal_app_args == NULL)
239 for (j = 0; i < argc; j++, i++)
240 eal_app_args[j] = strdup(argv[i]);
241 eal_app_args[j] = NULL;
248 eal_option_device_add(enum rte_devtype type, const char *optarg)
250 struct device_option *devopt;
254 optlen = strlen(optarg) + 1;
255 devopt = calloc(1, sizeof(*devopt) + optlen);
256 if (devopt == NULL) {
257 RTE_LOG(ERR, EAL, "Unable to allocate device option\n");
262 ret = strlcpy(devopt->arg, optarg, optlen);
264 RTE_LOG(ERR, EAL, "Unable to copy device option\n");
268 TAILQ_INSERT_TAIL(&devopt_list, devopt, next);
273 eal_option_device_parse(void)
275 struct device_option *devopt;
279 TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) {
281 ret = rte_devargs_add(devopt->type, devopt->arg);
283 RTE_LOG(ERR, EAL, "Unable to parse device '%s'\n",
286 TAILQ_REMOVE(&devopt_list, devopt, next);
293 eal_get_hugefile_prefix(void)
295 const struct internal_config *internal_conf =
296 eal_get_internal_configuration();
298 if (internal_conf->hugefile_prefix != NULL)
299 return internal_conf->hugefile_prefix;
300 return HUGEFILE_PREFIX_DEFAULT;
304 eal_reset_internal_config(struct internal_config *internal_cfg)
308 internal_cfg->memory = 0;
309 internal_cfg->force_nrank = 0;
310 internal_cfg->force_nchannel = 0;
311 internal_cfg->hugefile_prefix = NULL;
312 internal_cfg->hugepage_dir = NULL;
313 internal_cfg->force_sockets = 0;
314 /* zero out the NUMA config */
315 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
316 internal_cfg->socket_mem[i] = 0;
317 internal_cfg->force_socket_limits = 0;
318 /* zero out the NUMA limits config */
319 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
320 internal_cfg->socket_limit[i] = 0;
321 /* zero out hugedir descriptors */
322 for (i = 0; i < MAX_HUGEPAGE_SIZES; i++) {
323 memset(&internal_cfg->hugepage_info[i], 0,
324 sizeof(internal_cfg->hugepage_info[0]));
325 internal_cfg->hugepage_info[i].lock_descriptor = -1;
327 internal_cfg->base_virtaddr = 0;
330 internal_cfg->syslog_facility = LOG_DAEMON;
333 /* if set to NONE, interrupt mode is determined automatically */
334 internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE;
335 memset(internal_cfg->vfio_vf_token, 0,
336 sizeof(internal_cfg->vfio_vf_token));
338 #ifdef RTE_LIBEAL_USE_HPET
339 internal_cfg->no_hpet = 0;
341 internal_cfg->no_hpet = 1;
343 internal_cfg->vmware_tsc_map = 0;
344 internal_cfg->create_uio_dev = 0;
345 internal_cfg->iova_mode = RTE_IOVA_DC;
346 internal_cfg->user_mbuf_pool_ops_name = NULL;
347 CPU_ZERO(&internal_cfg->ctrl_cpuset);
348 internal_cfg->init_complete = 0;
349 internal_cfg->max_simd_bitwidth.bitwidth = RTE_VECT_DEFAULT_SIMD_BITWIDTH;
350 internal_cfg->max_simd_bitwidth.forced = 0;
354 eal_plugin_add(const char *path)
356 struct shared_driver *solib;
358 solib = malloc(sizeof(*solib));
360 RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
363 memset(solib, 0, sizeof(*solib));
364 strlcpy(solib->name, path, PATH_MAX);
365 TAILQ_INSERT_TAIL(&solib_list, solib, next);
370 #ifdef RTE_EXEC_ENV_WINDOWS
372 eal_plugins_init(void)
379 eal_plugindir_init(const char *path)
382 struct dirent *dent = NULL;
383 char sopath[PATH_MAX];
385 if (path == NULL || *path == '\0')
390 RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
391 path, strerror(errno));
395 while ((dent = readdir(d)) != NULL) {
397 int nlen = strnlen(dent->d_name, sizeof(dent->d_name));
399 /* check if name ends in .so */
400 if (strcmp(&dent->d_name[nlen - 3], ".so") != 0)
403 snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name);
405 /* if a regular file, add to list to load */
406 if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode)))
409 if (eal_plugin_add(sopath) == -1)
414 /* XXX this ignores failures from readdir() itself */
415 return (dent == NULL) ? 0 : -1;
419 verify_perms(const char *dirpath)
423 /* if not root, check down one level first */
424 if (strcmp(dirpath, "/") != 0) {
425 static __thread char last_dir_checked[PATH_MAX];
429 strlcpy(copy, dirpath, PATH_MAX);
431 if (strncmp(dir, last_dir_checked, PATH_MAX) != 0) {
432 if (verify_perms(dir) != 0)
434 strlcpy(last_dir_checked, dir, PATH_MAX);
438 /* call stat to check for permissions and ensure not world writable */
439 if (stat(dirpath, &st) != 0) {
440 RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n",
441 dirpath, strerror(errno));
444 if (st.st_mode & S_IWOTH) {
446 "Error, directory path %s is world-writable and insecure\n",
455 eal_dlopen(const char *pathname)
458 char *realp = realpath(pathname, NULL);
460 if (realp == NULL && errno == ENOENT) {
461 /* not a full or relative path, try a load from system dirs */
462 retval = dlopen(pathname, RTLD_NOW);
464 RTE_LOG(ERR, EAL, "%s\n", dlerror());
468 RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n",
469 pathname, strerror(errno));
472 if (strnlen(realp, PATH_MAX) == PATH_MAX) {
473 RTE_LOG(ERR, EAL, "Error, driver path greater than PATH_MAX\n");
477 /* do permissions checks */
478 if (verify_perms(realp) != 0)
481 retval = dlopen(realp, RTLD_NOW);
483 RTE_LOG(ERR, EAL, "%s\n", dlerror());
490 eal_plugins_init(void)
492 struct shared_driver *solib = NULL;
495 /* If we are not statically linked, add default driver loading
496 * path if it exists as a directory.
497 * (Using dlopen with NOLOAD flag on EAL, will return NULL if the EAL
498 * shared library is not already loaded i.e. it's statically linked.)
500 if (dlopen("librte_eal.so", RTLD_LAZY | RTLD_NOLOAD) != NULL &&
501 *default_solib_dir != '\0' &&
502 stat(default_solib_dir, &sb) == 0 &&
504 eal_plugin_add(default_solib_dir);
506 TAILQ_FOREACH(solib, &solib_list, next) {
508 if (stat(solib->name, &sb) == 0 && S_ISDIR(sb.st_mode)) {
509 if (eal_plugindir_init(solib->name) == -1) {
511 "Cannot init plugin directory %s\n",
516 RTE_LOG(DEBUG, EAL, "open shared lib %s\n",
518 solib->lib_handle = eal_dlopen(solib->name);
519 if (solib->lib_handle == NULL)
529 * Parse the coremask given as argument (hexadecimal string) and fill
530 * the global configuration (core role and core count) with the parsed
533 static int xdigit2val(unsigned char c)
547 eal_parse_service_coremask(const char *coremask)
549 struct rte_config *cfg = rte_eal_get_configuration();
551 unsigned int count = 0;
554 uint32_t taken_lcore_count = 0;
556 if (coremask == NULL)
558 /* Remove all blank characters ahead and after .
559 * Remove 0x/0X if exists.
561 while (isblank(*coremask))
563 if (coremask[0] == '0' && ((coremask[1] == 'x')
564 || (coremask[1] == 'X')))
566 i = strlen(coremask);
567 while ((i > 0) && isblank(coremask[i - 1]))
573 for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
575 if (isxdigit(c) == 0) {
576 /* invalid characters */
580 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE;
582 if ((1 << j) & val) {
583 /* handle main lcore already parsed */
584 uint32_t lcore = idx;
585 if (main_lcore_parsed &&
586 cfg->main_lcore == lcore) {
588 "lcore %u is main lcore, cannot use as service core\n",
593 if (eal_cpu_detected(idx) == 0) {
595 "lcore %u unavailable\n", idx);
599 if (cfg->lcore_role[idx] == ROLE_RTE)
602 lcore_config[idx].core_role = ROLE_SERVICE;
609 if (coremask[i] != '0')
612 for (; idx < RTE_MAX_LCORE; idx++)
613 lcore_config[idx].core_index = -1;
618 if (core_parsed && taken_lcore_count != count) {
619 RTE_LOG(WARNING, EAL,
620 "Not all service cores are in the coremask. "
621 "Please ensure -c or -l includes service cores\n");
624 cfg->service_lcore_count = count;
629 eal_service_cores_parsed(void)
632 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
633 if (lcore_config[idx].core_role == ROLE_SERVICE)
640 update_lcore_config(int *cores)
642 struct rte_config *cfg = rte_eal_get_configuration();
643 unsigned int count = 0;
647 for (i = 0; i < RTE_MAX_LCORE; i++) {
648 if (cores[i] != -1) {
649 if (eal_cpu_detected(i) == 0) {
650 RTE_LOG(ERR, EAL, "lcore %u unavailable\n", i);
654 cfg->lcore_role[i] = ROLE_RTE;
657 cfg->lcore_role[i] = ROLE_OFF;
659 lcore_config[i].core_index = cores[i];
662 cfg->lcore_count = count;
667 eal_parse_coremask(const char *coremask, int *cores)
674 for (idx = 0; idx < RTE_MAX_LCORE; idx++)
678 /* Remove all blank characters ahead and after .
679 * Remove 0x/0X if exists.
681 while (isblank(*coremask))
683 if (coremask[0] == '0' && ((coremask[1] == 'x')
684 || (coremask[1] == 'X')))
686 i = strlen(coremask);
687 while ((i > 0) && isblank(coremask[i - 1]))
692 for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
694 if (isxdigit(c) == 0) {
695 /* invalid characters */
699 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++)
701 if ((1 << j) & val) {
708 if (coremask[i] != '0')
716 eal_parse_service_corelist(const char *corelist)
718 struct rte_config *cfg = rte_eal_get_configuration();
723 uint32_t taken_lcore_count = 0;
725 if (corelist == NULL)
728 /* Remove all blank characters ahead and after */
729 while (isblank(*corelist))
731 i = strlen(corelist);
732 while ((i > 0) && isblank(corelist[i - 1]))
735 /* Get list of cores */
738 while (isblank(*corelist))
740 if (*corelist == '\0')
743 idx = strtoul(corelist, &end, 10);
744 if (errno || end == NULL)
746 while (isblank(*end))
750 } else if ((*end == ',') || (*end == '\0')) {
752 if (min == RTE_MAX_LCORE)
754 for (idx = min; idx <= max; idx++) {
755 if (cfg->lcore_role[idx] != ROLE_SERVICE) {
756 /* handle main lcore already parsed */
757 uint32_t lcore = idx;
758 if (cfg->main_lcore == lcore &&
761 "Error: lcore %u is main lcore, cannot use as service core\n",
765 if (cfg->lcore_role[idx] == ROLE_RTE)
768 lcore_config[idx].core_role =
777 } while (*end != '\0');
782 if (core_parsed && taken_lcore_count != count) {
783 RTE_LOG(WARNING, EAL,
784 "Not all service cores were in the coremask. "
785 "Please ensure -c or -l includes service cores\n");
792 eal_parse_corelist(const char *corelist, int *cores)
799 for (idx = 0; idx < RTE_MAX_LCORE; idx++)
802 /* Remove all blank characters ahead */
803 while (isblank(*corelist))
806 /* Get list of cores */
809 while (isblank(*corelist))
811 if (*corelist == '\0')
814 idx = strtol(corelist, &end, 10);
815 if (errno || end == NULL)
817 if (idx < 0 || idx >= RTE_MAX_LCORE)
819 while (isblank(*end))
823 } else if ((*end == ',') || (*end == '\0')) {
825 if (min == RTE_MAX_LCORE)
827 for (idx = min; idx <= max; idx++) {
828 if (cores[idx] == -1) {
837 } while (*end != '\0');
844 /* Changes the lcore id of the main thread */
846 eal_parse_main_lcore(const char *arg)
849 struct rte_config *cfg = rte_eal_get_configuration();
852 cfg->main_lcore = (uint32_t) strtol(arg, &parsing_end, 0);
853 if (errno || parsing_end[0] != 0)
855 if (cfg->main_lcore >= RTE_MAX_LCORE)
857 main_lcore_parsed = 1;
859 /* ensure main core is not used as service core */
860 if (lcore_config[cfg->main_lcore].core_role == ROLE_SERVICE) {
862 "Error: Main lcore is used as a service core\n");
870 * Parse elem, the elem could be single number/range or '(' ')' group
871 * 1) A single number elem, it's just a simple digit. e.g. 9
872 * 2) A single range elem, two digits with a '-' between. e.g. 2-6
873 * 3) A group elem, combines multiple 1) or 2) with '( )'. e.g (0,2-4,6)
874 * Within group elem, '-' used for a range separator;
875 * ',' used for a single number.
878 eal_parse_set(const char *input, rte_cpuset_t *set)
881 const char *str = input;
887 while (isblank(*str))
890 /* only digit or left bracket is qualify for start point */
891 if ((!isdigit(*str) && *str != '(') || *str == '\0')
894 /* process single number or single range of number */
897 idx = strtoul(str, &end, 10);
898 if (errno || end == NULL || idx >= CPU_SETSIZE)
901 while (isblank(*end))
907 /* process single <number>-<number> */
909 while (isblank(*end))
915 idx = strtoul(end, &end, 10);
916 if (errno || end == NULL || idx >= CPU_SETSIZE)
919 while (isblank(*end))
921 if (*end != ',' && *end != '\0')
925 if (*end != ',' && *end != '\0' &&
929 for (idx = RTE_MIN(min, max);
930 idx <= RTE_MAX(min, max); idx++)
937 /* process set within bracket */
939 while (isblank(*str))
947 /* go ahead to the first digit */
948 while (isblank(*str))
953 /* get the digit value */
955 idx = strtoul(str, &end, 10);
956 if (errno || end == NULL || idx >= CPU_SETSIZE)
959 /* go ahead to separator '-',',' and ')' */
960 while (isblank(*end))
963 if (min == RTE_MAX_LCORE)
965 else /* avoid continuous '-' */
967 } else if ((*end == ',') || (*end == ')')) {
969 if (min == RTE_MAX_LCORE)
971 for (idx = RTE_MIN(min, max);
972 idx <= RTE_MAX(min, max); idx++)
980 } while (*end != '\0' && *end != ')');
983 * to avoid failure that tail blank makes end character check fail
984 * in eal_parse_lcores( )
986 while (isblank(*str))
993 check_cpuset(rte_cpuset_t *set)
997 for (idx = 0; idx < CPU_SETSIZE; idx++) {
998 if (!CPU_ISSET(idx, set))
1001 if (eal_cpu_detected(idx) == 0) {
1002 RTE_LOG(ERR, EAL, "core %u "
1003 "unavailable\n", idx);
1011 * The format pattern: --lcores='<lcores[@cpus]>[<,lcores[@cpus]>...]'
1012 * lcores, cpus could be a single digit/range or a group.
1013 * '(' and ')' are necessary if it's a group.
1014 * If not supply '@cpus', the value of cpus uses the same as lcores.
1015 * e.g. '1,2@(5-7),(3-5)@(0,2),(0,6),7-8' means start 9 EAL thread as below
1016 * lcore 0 runs on cpuset 0x41 (cpu 0,6)
1017 * lcore 1 runs on cpuset 0x2 (cpu 1)
1018 * lcore 2 runs on cpuset 0xe0 (cpu 5,6,7)
1019 * lcore 3,4,5 runs on cpuset 0x5 (cpu 0,2)
1020 * lcore 6 runs on cpuset 0x41 (cpu 0,6)
1021 * lcore 7 runs on cpuset 0x80 (cpu 7)
1022 * lcore 8 runs on cpuset 0x100 (cpu 8)
1025 eal_parse_lcores(const char *lcores)
1027 struct rte_config *cfg = rte_eal_get_configuration();
1028 rte_cpuset_t lcore_set;
1029 unsigned int set_count;
1032 const char *lcore_start = NULL;
1033 const char *end = NULL;
1035 rte_cpuset_t cpuset;
1042 /* Remove all blank characters ahead and after */
1043 while (isblank(*lcores))
1048 /* Reset lcore config */
1049 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1050 cfg->lcore_role[idx] = ROLE_OFF;
1051 lcore_config[idx].core_index = -1;
1052 CPU_ZERO(&lcore_config[idx].cpuset);
1055 /* Get list of cores */
1057 while (isblank(*lcores))
1059 if (*lcores == '\0')
1064 /* record lcore_set start point */
1065 lcore_start = lcores;
1067 /* go across a complete bracket */
1068 if (*lcore_start == '(') {
1069 lcores += strcspn(lcores, ")");
1070 if (*lcores++ == '\0')
1074 /* scan the separator '@', ','(next) or '\0'(finish) */
1075 lcores += strcspn(lcores, "@,");
1077 if (*lcores == '@') {
1078 /* explicit assign cpuset and update the end cursor */
1079 offset = eal_parse_set(lcores + 1, &cpuset);
1082 end = lcores + 1 + offset;
1083 } else { /* ',' or '\0' */
1084 /* haven't given cpuset, current loop done */
1087 /* go back to check <number>-<number> */
1088 offset = strcspn(lcore_start, "(-");
1089 if (offset < (end - lcore_start) &&
1090 *(lcore_start + offset) != '(')
1094 if (*end != ',' && *end != '\0')
1097 /* parse lcore_set from start point */
1098 if (eal_parse_set(lcore_start, &lcore_set) < 0)
1101 /* without '@', by default using lcore_set as cpuset */
1103 rte_memcpy(&cpuset, &lcore_set, sizeof(cpuset));
1105 set_count = CPU_COUNT(&lcore_set);
1106 /* start to update lcore_set */
1107 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1108 if (!CPU_ISSET(idx, &lcore_set))
1112 if (cfg->lcore_role[idx] != ROLE_RTE) {
1113 lcore_config[idx].core_index = count;
1114 cfg->lcore_role[idx] = ROLE_RTE;
1120 CPU_SET(idx, &cpuset);
1123 if (check_cpuset(&cpuset) < 0)
1125 rte_memcpy(&lcore_config[idx].cpuset, &cpuset,
1126 sizeof(rte_cpuset_t));
1129 /* some cores from the lcore_set can't be handled by EAL */
1134 } while (*end != '\0');
1139 cfg->lcore_count = count;
1147 #ifndef RTE_EXEC_ENV_WINDOWS
1149 eal_parse_syslog(const char *facility, struct internal_config *conf)
1152 static const struct {
1156 { "auth", LOG_AUTH },
1157 { "cron", LOG_CRON },
1158 { "daemon", LOG_DAEMON },
1160 { "kern", LOG_KERN },
1162 { "mail", LOG_MAIL },
1163 { "news", LOG_NEWS },
1164 { "syslog", LOG_SYSLOG },
1165 { "user", LOG_USER },
1166 { "uucp", LOG_UUCP },
1167 { "local0", LOG_LOCAL0 },
1168 { "local1", LOG_LOCAL1 },
1169 { "local2", LOG_LOCAL2 },
1170 { "local3", LOG_LOCAL3 },
1171 { "local4", LOG_LOCAL4 },
1172 { "local5", LOG_LOCAL5 },
1173 { "local6", LOG_LOCAL6 },
1174 { "local7", LOG_LOCAL7 },
1178 for (i = 0; map[i].name; i++) {
1179 if (!strcmp(facility, map[i].name)) {
1180 conf->syslog_facility = map[i].value;
1189 eal_parse_log_priority(const char *level)
1191 static const char * const levels[] = {
1192 [RTE_LOG_EMERG] = "emergency",
1193 [RTE_LOG_ALERT] = "alert",
1194 [RTE_LOG_CRIT] = "critical",
1195 [RTE_LOG_ERR] = "error",
1196 [RTE_LOG_WARNING] = "warning",
1197 [RTE_LOG_NOTICE] = "notice",
1198 [RTE_LOG_INFO] = "info",
1199 [RTE_LOG_DEBUG] = "debug",
1201 size_t len = strlen(level);
1209 /* look for named values, skip 0 which is not a valid level */
1210 for (i = 1; i < RTE_DIM(levels); i++) {
1211 if (strncmp(levels[i], level, len) == 0)
1215 /* not a string, maybe it is numeric */
1217 tmp = strtoul(level, &end, 0);
1219 /* check for errors */
1220 if (errno != 0 || end == NULL || *end != '\0' ||
1228 eal_parse_log_level(const char *arg)
1230 const char *pattern = NULL;
1231 const char *regex = NULL;
1239 if ((level = strchr(str, ','))) {
1242 } else if ((level = strchr(str, ':'))) {
1249 priority = eal_parse_log_priority(level);
1251 fprintf(stderr, "invalid log priority: %s\n", level);
1256 if (rte_log_set_level_regexp(regex, priority) < 0) {
1257 fprintf(stderr, "cannot set log level %s,%d\n",
1261 if (rte_log_save_regexp(regex, priority) < 0)
1263 } else if (pattern) {
1264 if (rte_log_set_level_pattern(pattern, priority) < 0) {
1265 fprintf(stderr, "cannot set log level %s:%d\n",
1269 if (rte_log_save_pattern(pattern, priority) < 0)
1272 rte_log_set_global_level(priority);
1283 static enum rte_proc_type_t
1284 eal_parse_proc_type(const char *arg)
1286 if (strncasecmp(arg, "primary", sizeof("primary")) == 0)
1287 return RTE_PROC_PRIMARY;
1288 if (strncasecmp(arg, "secondary", sizeof("secondary")) == 0)
1289 return RTE_PROC_SECONDARY;
1290 if (strncasecmp(arg, "auto", sizeof("auto")) == 0)
1291 return RTE_PROC_AUTO;
1293 return RTE_PROC_INVALID;
1297 eal_parse_iova_mode(const char *name)
1300 struct internal_config *internal_conf =
1301 eal_get_internal_configuration();
1306 if (!strcmp("pa", name))
1308 else if (!strcmp("va", name))
1313 internal_conf->iova_mode = mode;
1318 eal_parse_simd_bitwidth(const char *arg)
1321 unsigned long bitwidth;
1323 struct internal_config *internal_conf =
1324 eal_get_internal_configuration();
1326 if (arg == NULL || arg[0] == '\0')
1330 bitwidth = strtoul(arg, &end, 0);
1332 /* check for errors */
1333 if (errno != 0 || end == NULL || *end != '\0' || bitwidth > RTE_VECT_SIMD_MAX)
1337 bitwidth = (unsigned long) RTE_VECT_SIMD_MAX;
1338 ret = rte_vect_set_max_simd_bitwidth(bitwidth);
1341 internal_conf->max_simd_bitwidth.forced = 1;
1346 eal_parse_base_virtaddr(const char *arg)
1350 struct internal_config *internal_conf =
1351 eal_get_internal_configuration();
1354 addr = strtoull(arg, &end, 16);
1356 /* check for errors */
1357 if ((errno != 0) || (arg[0] == '\0') || end == NULL || (*end != '\0'))
1360 /* make sure we don't exceed 32-bit boundary on 32-bit target */
1362 if (addr >= UINTPTR_MAX)
1366 /* align the addr on 16M boundary, 16MB is the minimum huge page
1367 * size on IBM Power architecture. If the addr is aligned to 16MB,
1368 * it can align to 2MB for x86. So this alignment can also be used
1369 * on x86 and other architectures.
1371 internal_conf->base_virtaddr =
1372 RTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M);
1377 /* caller is responsible for freeing the returned string */
1379 available_cores(void)
1387 /* find the first available cpu */
1388 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1389 if (eal_cpu_detected(idx) == 0)
1393 if (idx >= RTE_MAX_LCORE)
1396 /* first sequence */
1397 if (asprintf(&str, "%d", idx) < 0)
1402 for (idx++ ; idx < RTE_MAX_LCORE; idx++) {
1403 if (eal_cpu_detected(idx) == 0)
1406 if (idx == previous + 1) {
1412 /* finish current sequence */
1414 if (asprintf(&tmp, "%s-%d", str, previous) < 0) {
1423 if (asprintf(&tmp, "%s,%d", str, idx) < 0) {
1433 /* finish last sequence */
1435 if (asprintf(&tmp, "%s-%d", str, previous) < 0) {
1447 eal_parse_common_option(int opt, const char *optarg,
1448 struct internal_config *conf)
1458 if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI,
1468 if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI,
1476 int lcore_indexes[RTE_MAX_LCORE];
1478 if (eal_service_cores_parsed())
1479 RTE_LOG(WARNING, EAL,
1480 "Service cores parsed before dataplane cores. Please ensure -c is before -s or -S\n");
1481 if (eal_parse_coremask(optarg, lcore_indexes) < 0) {
1482 RTE_LOG(ERR, EAL, "invalid coremask syntax\n");
1485 if (update_lcore_config(lcore_indexes) < 0) {
1486 char *available = available_cores();
1489 "invalid coremask, please check specified cores are part of %s\n",
1496 RTE_LOG(ERR, EAL, "Option -c is ignored, because (%s) is set!\n",
1497 (core_parsed == LCORE_OPT_LST) ? "-l" :
1498 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1503 core_parsed = LCORE_OPT_MSK;
1508 int lcore_indexes[RTE_MAX_LCORE];
1510 if (eal_service_cores_parsed())
1511 RTE_LOG(WARNING, EAL,
1512 "Service cores parsed before dataplane cores. Please ensure -l is before -s or -S\n");
1514 if (eal_parse_corelist(optarg, lcore_indexes) < 0) {
1515 RTE_LOG(ERR, EAL, "invalid core list syntax\n");
1518 if (update_lcore_config(lcore_indexes) < 0) {
1519 char *available = available_cores();
1522 "invalid core list, please check specified cores are part of %s\n",
1529 RTE_LOG(ERR, EAL, "Option -l is ignored, because (%s) is set!\n",
1530 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1531 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1536 core_parsed = LCORE_OPT_LST;
1539 /* service coremask */
1541 if (eal_parse_service_coremask(optarg) < 0) {
1542 RTE_LOG(ERR, EAL, "invalid service coremask\n");
1546 /* service corelist */
1548 if (eal_parse_service_corelist(optarg) < 0) {
1549 RTE_LOG(ERR, EAL, "invalid service core list\n");
1553 /* size of memory */
1555 conf->memory = atoi(optarg);
1556 conf->memory *= 1024ULL;
1557 conf->memory *= 1024ULL;
1560 /* force number of channels */
1562 conf->force_nchannel = atoi(optarg);
1563 if (conf->force_nchannel == 0) {
1564 RTE_LOG(ERR, EAL, "invalid channel number\n");
1568 /* force number of ranks */
1570 conf->force_nrank = atoi(optarg);
1571 if (conf->force_nrank == 0 ||
1572 conf->force_nrank > 16) {
1573 RTE_LOG(ERR, EAL, "invalid rank number\n");
1577 /* force loading of external driver */
1579 if (eal_plugin_add(optarg) == -1)
1583 /* since message is explicitly requested by user, we
1584 * write message at highest log level so it can always
1586 * even if info or warning messages are disabled */
1587 RTE_LOG(CRIT, EAL, "RTE Version: '%s'\n", rte_version());
1591 case OPT_HUGE_UNLINK_NUM:
1592 conf->hugepage_unlink = 1;
1595 case OPT_NO_HUGE_NUM:
1596 conf->no_hugetlbfs = 1;
1597 /* no-huge is legacy mem */
1598 conf->legacy_mem = 1;
1601 case OPT_NO_PCI_NUM:
1605 case OPT_NO_HPET_NUM:
1609 case OPT_VMWARE_TSC_MAP_NUM:
1610 conf->vmware_tsc_map = 1;
1613 case OPT_NO_SHCONF_NUM:
1614 conf->no_shconf = 1;
1617 case OPT_IN_MEMORY_NUM:
1618 conf->in_memory = 1;
1619 /* in-memory is a superset of noshconf and huge-unlink */
1620 conf->no_shconf = 1;
1621 conf->hugepage_unlink = 1;
1624 case OPT_PROC_TYPE_NUM:
1625 conf->process_type = eal_parse_proc_type(optarg);
1628 case OPT_MASTER_LCORE_NUM:
1630 "Option --" OPT_MASTER_LCORE
1631 " is deprecated use " OPT_MAIN_LCORE "\n");
1633 case OPT_MAIN_LCORE_NUM:
1634 if (eal_parse_main_lcore(optarg) < 0) {
1635 RTE_LOG(ERR, EAL, "invalid parameter for --"
1636 OPT_MAIN_LCORE "\n");
1642 if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL,
1648 #ifndef RTE_EXEC_ENV_WINDOWS
1649 case OPT_SYSLOG_NUM:
1650 if (eal_parse_syslog(optarg, conf) < 0) {
1651 RTE_LOG(ERR, EAL, "invalid parameters for --"
1658 case OPT_LOG_LEVEL_NUM: {
1659 if (eal_parse_log_level(optarg) < 0) {
1661 "invalid parameters for --"
1662 OPT_LOG_LEVEL "\n");
1668 #ifndef RTE_EXEC_ENV_WINDOWS
1669 case OPT_TRACE_NUM: {
1670 if (eal_trace_args_save(optarg) < 0) {
1671 RTE_LOG(ERR, EAL, "invalid parameters for --"
1678 case OPT_TRACE_DIR_NUM: {
1679 if (eal_trace_dir_args_save(optarg) < 0) {
1680 RTE_LOG(ERR, EAL, "invalid parameters for --"
1681 OPT_TRACE_DIR "\n");
1687 case OPT_TRACE_BUF_SIZE_NUM: {
1688 if (eal_trace_bufsz_args_save(optarg) < 0) {
1689 RTE_LOG(ERR, EAL, "invalid parameters for --"
1690 OPT_TRACE_BUF_SIZE "\n");
1696 case OPT_TRACE_MODE_NUM: {
1697 if (eal_trace_mode_args_save(optarg) < 0) {
1698 RTE_LOG(ERR, EAL, "invalid parameters for --"
1699 OPT_TRACE_MODE "\n");
1704 #endif /* !RTE_EXEC_ENV_WINDOWS */
1706 case OPT_LCORES_NUM:
1707 if (eal_parse_lcores(optarg) < 0) {
1708 RTE_LOG(ERR, EAL, "invalid parameter for --"
1714 RTE_LOG(ERR, EAL, "Option --lcore is ignored, because (%s) is set!\n",
1715 (core_parsed == LCORE_OPT_LST) ? "-l" :
1716 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1721 core_parsed = LCORE_OPT_MAP;
1723 case OPT_LEGACY_MEM_NUM:
1724 conf->legacy_mem = 1;
1726 case OPT_SINGLE_FILE_SEGMENTS_NUM:
1727 conf->single_file_segments = 1;
1729 case OPT_IOVA_MODE_NUM:
1730 if (eal_parse_iova_mode(optarg) < 0) {
1731 RTE_LOG(ERR, EAL, "invalid parameters for --"
1732 OPT_IOVA_MODE "\n");
1736 case OPT_BASE_VIRTADDR_NUM:
1737 if (eal_parse_base_virtaddr(optarg) < 0) {
1738 RTE_LOG(ERR, EAL, "invalid parameter for --"
1739 OPT_BASE_VIRTADDR "\n");
1743 case OPT_TELEMETRY_NUM:
1745 case OPT_NO_TELEMETRY_NUM:
1746 conf->no_telemetry = 1;
1748 case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM:
1749 if (eal_parse_simd_bitwidth(optarg) < 0) {
1750 RTE_LOG(ERR, EAL, "invalid parameter for --"
1751 OPT_FORCE_MAX_SIMD_BITWIDTH "\n");
1756 /* don't know what to do, leave this to caller */
1764 RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) "
1765 "cannot be used at the same time\n");
1770 eal_auto_detect_cores(struct rte_config *cfg)
1772 unsigned int lcore_id;
1773 unsigned int removed = 0;
1774 rte_cpuset_t affinity_set;
1776 if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
1778 CPU_ZERO(&affinity_set);
1780 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1781 if (cfg->lcore_role[lcore_id] == ROLE_RTE &&
1782 !CPU_ISSET(lcore_id, &affinity_set)) {
1783 cfg->lcore_role[lcore_id] = ROLE_OFF;
1788 cfg->lcore_count -= removed;
1792 compute_ctrl_threads_cpuset(struct internal_config *internal_cfg)
1794 rte_cpuset_t *cpuset = &internal_cfg->ctrl_cpuset;
1795 rte_cpuset_t default_set;
1796 unsigned int lcore_id;
1798 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1799 if (rte_lcore_has_role(lcore_id, ROLE_OFF))
1801 RTE_CPU_OR(cpuset, cpuset, &lcore_config[lcore_id].cpuset);
1803 RTE_CPU_NOT(cpuset, cpuset);
1805 if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
1807 CPU_ZERO(&default_set);
1809 RTE_CPU_AND(cpuset, cpuset, &default_set);
1811 /* if no remaining cpu, use main lcore cpu affinity */
1812 if (!CPU_COUNT(cpuset)) {
1813 memcpy(cpuset, &lcore_config[rte_get_main_lcore()].cpuset,
1819 eal_cleanup_config(struct internal_config *internal_cfg)
1821 if (internal_cfg->hugefile_prefix != NULL)
1822 free(internal_cfg->hugefile_prefix);
1823 if (internal_cfg->hugepage_dir != NULL)
1824 free(internal_cfg->hugepage_dir);
1825 if (internal_cfg->user_mbuf_pool_ops_name != NULL)
1826 free(internal_cfg->user_mbuf_pool_ops_name);
1832 eal_adjust_config(struct internal_config *internal_cfg)
1835 struct rte_config *cfg = rte_eal_get_configuration();
1836 struct internal_config *internal_conf =
1837 eal_get_internal_configuration();
1840 eal_auto_detect_cores(cfg);
1842 if (internal_conf->process_type == RTE_PROC_AUTO)
1843 internal_conf->process_type = eal_proc_type_detect();
1845 /* default main lcore is the first one */
1846 if (!main_lcore_parsed) {
1847 cfg->main_lcore = rte_get_next_lcore(-1, 0, 0);
1848 if (cfg->main_lcore >= RTE_MAX_LCORE)
1850 lcore_config[cfg->main_lcore].core_role = ROLE_RTE;
1853 compute_ctrl_threads_cpuset(internal_cfg);
1855 /* if no memory amounts were requested, this will result in 0 and
1856 * will be overridden later, right after eal_hugepage_info_init() */
1857 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
1858 internal_cfg->memory += internal_cfg->socket_mem[i];
1864 eal_check_common_options(struct internal_config *internal_cfg)
1866 struct rte_config *cfg = rte_eal_get_configuration();
1867 const struct internal_config *internal_conf =
1868 eal_get_internal_configuration();
1870 if (cfg->lcore_role[cfg->main_lcore] != ROLE_RTE) {
1871 RTE_LOG(ERR, EAL, "Main lcore is not enabled for DPDK\n");
1875 if (internal_cfg->process_type == RTE_PROC_INVALID) {
1876 RTE_LOG(ERR, EAL, "Invalid process type specified\n");
1879 if (internal_cfg->hugefile_prefix != NULL &&
1880 strlen(internal_cfg->hugefile_prefix) < 1) {
1881 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_FILE_PREFIX " option\n");
1884 if (internal_cfg->hugepage_dir != NULL &&
1885 strlen(internal_cfg->hugepage_dir) < 1) {
1886 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n");
1889 if (internal_cfg->user_mbuf_pool_ops_name != NULL &&
1890 strlen(internal_cfg->user_mbuf_pool_ops_name) < 1) {
1891 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n");
1894 if (index(eal_get_hugefile_prefix(), '%') != NULL) {
1895 RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" "
1899 if (mem_parsed && internal_cfg->force_sockets == 1) {
1900 RTE_LOG(ERR, EAL, "Options -m and --"OPT_SOCKET_MEM" cannot "
1901 "be specified at the same time\n");
1904 if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) {
1905 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot "
1906 "be specified together with --"OPT_NO_HUGE"\n");
1909 if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink &&
1910 !internal_cfg->in_memory) {
1911 RTE_LOG(ERR, EAL, "Option --"OPT_HUGE_UNLINK" cannot "
1912 "be specified together with --"OPT_NO_HUGE"\n");
1915 if (internal_conf->force_socket_limits && internal_conf->legacy_mem) {
1916 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_LIMIT
1917 " is only supported in non-legacy memory mode\n");
1919 if (internal_cfg->single_file_segments &&
1920 internal_cfg->hugepage_unlink &&
1921 !internal_cfg->in_memory) {
1922 RTE_LOG(ERR, EAL, "Option --"OPT_SINGLE_FILE_SEGMENTS" is "
1923 "not compatible with --"OPT_HUGE_UNLINK"\n");
1926 if (internal_cfg->legacy_mem &&
1927 internal_cfg->in_memory) {
1928 RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible "
1929 "with --"OPT_IN_MEMORY"\n");
1932 if (internal_cfg->legacy_mem && internal_cfg->match_allocations) {
1933 RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible "
1934 "with --"OPT_MATCH_ALLOCATIONS"\n");
1937 if (internal_cfg->no_hugetlbfs && internal_cfg->match_allocations) {
1938 RTE_LOG(ERR, EAL, "Option --"OPT_NO_HUGE" is not compatible "
1939 "with --"OPT_MATCH_ALLOCATIONS"\n");
1942 if (internal_cfg->legacy_mem && internal_cfg->memory == 0) {
1943 RTE_LOG(NOTICE, EAL, "Static memory layout is selected, "
1944 "amount of reserved memory can be adjusted with "
1945 "-m or --"OPT_SOCKET_MEM"\n");
1952 rte_vect_get_max_simd_bitwidth(void)
1954 const struct internal_config *internal_conf =
1955 eal_get_internal_configuration();
1956 return internal_conf->max_simd_bitwidth.bitwidth;
1960 rte_vect_set_max_simd_bitwidth(uint16_t bitwidth)
1962 struct internal_config *internal_conf =
1963 eal_get_internal_configuration();
1964 if (internal_conf->max_simd_bitwidth.forced) {
1965 RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled");
1969 if (bitwidth < RTE_VECT_SIMD_DISABLED || !rte_is_power_of_2(bitwidth)) {
1970 RTE_LOG(ERR, EAL, "Invalid bitwidth value!\n");
1973 internal_conf->max_simd_bitwidth.bitwidth = bitwidth;
1978 eal_common_usage(void)
1980 printf("[options]\n\n"
1981 "EAL common options:\n"
1982 " -c COREMASK Hexadecimal bitmask of cores to run on\n"
1983 " -l CORELIST List of cores to run on\n"
1984 " The argument format is <c1>[-c2][,c3[-c4],...]\n"
1985 " where c1, c2, etc are core indexes between 0 and %d\n"
1986 " --"OPT_LCORES" COREMAP Map lcore set to physical cpu set\n"
1987 " The argument format is\n"
1988 " '<lcores[@cpus]>[<,lcores[@cpus]>...]'\n"
1989 " lcores and cpus list are grouped by '(' and ')'\n"
1990 " Within the group, '-' is used for range separator,\n"
1991 " ',' is used for single number separator.\n"
1992 " '( )' can be omitted for single element group,\n"
1993 " '@' can be omitted if cpus and lcores have the same value\n"
1994 " -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
1995 " --"OPT_MAIN_LCORE" ID Core ID that is used as main\n"
1996 " --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n"
1997 " -n CHANNELS Number of memory channels\n"
1998 " -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n"
1999 " -r RANKS Force number of memory ranks (don't detect)\n"
2000 " -b, --"OPT_PCI_BLACKLIST" Add a PCI device in black list.\n"
2001 " Prevent EAL from using this PCI device. The argument\n"
2002 " format is <domain:bus:devid.func>.\n"
2003 " -w, --"OPT_PCI_WHITELIST" Add a PCI device in white list.\n"
2004 " Only use the specified PCI devices. The argument format\n"
2005 " is <[domain:]bus:devid.func>. This option can be present\n"
2006 " several times (once per device).\n"
2007 " [NOTE: PCI whitelist cannot be used with -b option]\n"
2008 " --"OPT_VDEV" Add a virtual device.\n"
2009 " The argument format is <driver><id>[,key=val,...]\n"
2010 " (ex: --vdev=net_pcap0,iface=eth2).\n"
2011 " --"OPT_IOVA_MODE" Set IOVA mode. 'pa' for IOVA_PA\n"
2012 " 'va' for IOVA_VA\n"
2013 " -d LIB.so|DIR Add a driver or driver directory\n"
2014 " (can be used multiple times)\n"
2015 " --"OPT_VMWARE_TSC_MAP" Use VMware TSC map instead of native RDTSC\n"
2016 " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n"
2017 #ifndef RTE_EXEC_ENV_WINDOWS
2018 " --"OPT_SYSLOG" Set syslog facility\n"
2020 " --"OPT_LOG_LEVEL"=<int> Set global log level\n"
2021 " --"OPT_LOG_LEVEL"=<type-match>:<int>\n"
2022 " Set specific log level\n"
2023 #ifndef RTE_EXEC_ENV_WINDOWS
2024 " --"OPT_TRACE"=<regex-match>\n"
2025 " Enable trace based on regular expression trace name.\n"
2026 " By default, the trace is disabled.\n"
2027 " User must specify this option to enable trace.\n"
2028 " --"OPT_TRACE_DIR"=<directory path>\n"
2029 " Specify trace directory for trace output.\n"
2030 " By default, trace output will created at\n"
2031 " $HOME directory and parameter must be\n"
2032 " specified once only.\n"
2033 " --"OPT_TRACE_BUF_SIZE"=<int>\n"
2034 " Specify maximum size of allocated memory\n"
2035 " for trace output for each thread. Valid\n"
2036 " unit can be either 'B|K|M' for 'Bytes',\n"
2037 " 'KBytes' and 'MBytes' respectively.\n"
2038 " Default is 1MB and parameter must be\n"
2039 " specified once only.\n"
2040 " --"OPT_TRACE_MODE"=<o[verwrite] | d[iscard]>\n"
2041 " Specify the mode of update of trace\n"
2042 " output file. Either update on a file can\n"
2043 " be wrapped or discarded when file size\n"
2044 " reaches its maximum limit.\n"
2045 " Default mode is 'overwrite' and parameter\n"
2046 " must be specified once only.\n"
2047 #endif /* !RTE_EXEC_ENV_WINDOWS */
2048 " -v Display version information on startup\n"
2049 " -h, --help This help\n"
2050 " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n"
2051 " disable secondary process support\n"
2052 " --"OPT_BASE_VIRTADDR" Base virtual address\n"
2053 " --"OPT_TELEMETRY" Enable telemetry support (on by default)\n"
2054 " --"OPT_NO_TELEMETRY" Disable telemetry support\n"
2055 " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwidth\n"
2056 "\nEAL options for DEBUG use only:\n"
2057 " --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
2058 " --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
2059 " --"OPT_NO_PCI" Disable PCI\n"
2060 " --"OPT_NO_HPET" Disable HPET\n"
2061 " --"OPT_NO_SHCONF" No shared config (mmap'd files)\n"
2062 "\n", RTE_MAX_LCORE);