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_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM},
86 {OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM },
87 {OPT_NO_HUGE, 0, NULL, OPT_NO_HUGE_NUM },
88 {OPT_NO_PCI, 0, NULL, OPT_NO_PCI_NUM },
89 {OPT_NO_SHCONF, 0, NULL, OPT_NO_SHCONF_NUM },
90 {OPT_IN_MEMORY, 0, NULL, OPT_IN_MEMORY_NUM },
91 {OPT_PCI_BLACKLIST, 1, NULL, OPT_PCI_BLACKLIST_NUM },
92 {OPT_PCI_WHITELIST, 1, NULL, OPT_PCI_WHITELIST_NUM },
93 {OPT_PROC_TYPE, 1, NULL, OPT_PROC_TYPE_NUM },
94 {OPT_SOCKET_MEM, 1, NULL, OPT_SOCKET_MEM_NUM },
95 {OPT_SOCKET_LIMIT, 1, NULL, OPT_SOCKET_LIMIT_NUM },
96 {OPT_SYSLOG, 1, NULL, OPT_SYSLOG_NUM },
97 {OPT_VDEV, 1, NULL, OPT_VDEV_NUM },
98 {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM },
99 {OPT_VFIO_VF_TOKEN, 1, NULL, OPT_VFIO_VF_TOKEN_NUM },
100 {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM },
101 {OPT_LEGACY_MEM, 0, NULL, OPT_LEGACY_MEM_NUM },
102 {OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM},
103 {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM},
104 {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM },
105 {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM },
106 {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM},
110 TAILQ_HEAD(shared_driver_list, shared_driver);
112 /* Definition for shared object drivers. */
113 struct shared_driver {
114 TAILQ_ENTRY(shared_driver) next;
120 /* List of external loadable drivers */
121 static struct shared_driver_list solib_list =
122 TAILQ_HEAD_INITIALIZER(solib_list);
124 #ifndef RTE_EXEC_ENV_WINDOWS
125 /* Default path of external loadable drivers */
126 static const char *default_solib_dir = RTE_EAL_PMD_PATH;
130 * Stringified version of solib path used by dpdk-pmdinfo.py
131 * Note: PLEASE DO NOT ALTER THIS without making a corresponding
132 * change to usertools/dpdk-pmdinfo.py
134 static const char dpdk_solib_path[] __rte_used =
135 "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
137 TAILQ_HEAD(device_option_list, device_option);
139 struct device_option {
140 TAILQ_ENTRY(device_option) next;
142 enum rte_devtype type;
146 static struct device_option_list devopt_list =
147 TAILQ_HEAD_INITIALIZER(devopt_list);
149 static int master_lcore_parsed;
150 static int mem_parsed;
151 static int core_parsed;
153 /* Allow the application to print its usage message too if set */
154 static rte_usage_hook_t rte_application_usage_hook;
156 /* Returns rte_usage_hook_t */
158 eal_get_application_usage_hook(void)
160 return rte_application_usage_hook;
163 /* Set a per-application usage message */
165 rte_set_application_usage_hook(rte_usage_hook_t usage_func)
167 rte_usage_hook_t old_func;
169 /* Will be NULL on the first call to denote the last usage routine. */
170 old_func = rte_application_usage_hook;
171 rte_application_usage_hook = usage_func;
176 #ifndef RTE_EXEC_ENV_WINDOWS
177 static char **eal_args;
178 static char **eal_app_args;
180 #define EAL_PARAM_REQ "/eal/params"
181 #define EAL_APP_PARAM_REQ "/eal/app_params"
183 /* callback handler for telemetry library to report out EAL flags */
185 handle_eal_info_request(const char *cmd, const char *params __rte_unused,
186 struct rte_tel_data *d)
192 if (strcmp(cmd, EAL_PARAM_REQ) == 0)
197 rte_tel_data_start_array(d, RTE_TEL_STRING_VAL);
198 if (args == NULL || args[0] == NULL)
201 for ( ; args[i] != NULL; i++)
202 used = rte_tel_data_add_array_string(d, args[i]);
207 eal_save_args(int argc, char **argv)
211 rte_telemetry_register_cmd(EAL_PARAM_REQ, handle_eal_info_request,
212 "Returns EAL commandline parameters used. Takes no parameters");
213 rte_telemetry_register_cmd(EAL_APP_PARAM_REQ, handle_eal_info_request,
214 "Returns app commandline parameters used. Takes no parameters");
216 /* clone argv to report out later. We overprovision, but
217 * this does not waste huge amounts of memory
219 eal_args = calloc(argc + 1, sizeof(*eal_args));
220 if (eal_args == NULL)
223 for (i = 0; i < argc; i++) {
224 eal_args[i] = strdup(argv[i]);
225 if (strcmp(argv[i], "--") == 0)
228 eal_args[i++] = NULL; /* always finish with NULL */
230 /* allow reporting of any app args we know about too */
234 eal_app_args = calloc(argc - i + 1, sizeof(*eal_args));
235 if (eal_app_args == NULL)
238 for (j = 0; i < argc; j++, i++)
239 eal_app_args[j] = strdup(argv[i]);
240 eal_app_args[j] = NULL;
247 eal_option_device_add(enum rte_devtype type, const char *optarg)
249 struct device_option *devopt;
253 optlen = strlen(optarg) + 1;
254 devopt = calloc(1, sizeof(*devopt) + optlen);
255 if (devopt == NULL) {
256 RTE_LOG(ERR, EAL, "Unable to allocate device option\n");
261 ret = strlcpy(devopt->arg, optarg, optlen);
263 RTE_LOG(ERR, EAL, "Unable to copy device option\n");
267 TAILQ_INSERT_TAIL(&devopt_list, devopt, next);
272 eal_option_device_parse(void)
274 struct device_option *devopt;
278 TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) {
280 ret = rte_devargs_add(devopt->type, devopt->arg);
282 RTE_LOG(ERR, EAL, "Unable to parse device '%s'\n",
285 TAILQ_REMOVE(&devopt_list, devopt, next);
292 eal_get_hugefile_prefix(void)
294 const struct internal_config *internal_conf =
295 eal_get_internal_configuration();
297 if (internal_conf->hugefile_prefix != NULL)
298 return internal_conf->hugefile_prefix;
299 return HUGEFILE_PREFIX_DEFAULT;
303 eal_reset_internal_config(struct internal_config *internal_cfg)
307 internal_cfg->memory = 0;
308 internal_cfg->force_nrank = 0;
309 internal_cfg->force_nchannel = 0;
310 internal_cfg->hugefile_prefix = NULL;
311 internal_cfg->hugepage_dir = NULL;
312 internal_cfg->force_sockets = 0;
313 /* zero out the NUMA config */
314 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
315 internal_cfg->socket_mem[i] = 0;
316 internal_cfg->force_socket_limits = 0;
317 /* zero out the NUMA limits config */
318 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
319 internal_cfg->socket_limit[i] = 0;
320 /* zero out hugedir descriptors */
321 for (i = 0; i < MAX_HUGEPAGE_SIZES; i++) {
322 memset(&internal_cfg->hugepage_info[i], 0,
323 sizeof(internal_cfg->hugepage_info[0]));
324 internal_cfg->hugepage_info[i].lock_descriptor = -1;
326 internal_cfg->base_virtaddr = 0;
329 internal_cfg->syslog_facility = LOG_DAEMON;
332 /* if set to NONE, interrupt mode is determined automatically */
333 internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE;
334 memset(internal_cfg->vfio_vf_token, 0,
335 sizeof(internal_cfg->vfio_vf_token));
337 #ifdef RTE_LIBEAL_USE_HPET
338 internal_cfg->no_hpet = 0;
340 internal_cfg->no_hpet = 1;
342 internal_cfg->vmware_tsc_map = 0;
343 internal_cfg->create_uio_dev = 0;
344 internal_cfg->iova_mode = RTE_IOVA_DC;
345 internal_cfg->user_mbuf_pool_ops_name = NULL;
346 CPU_ZERO(&internal_cfg->ctrl_cpuset);
347 internal_cfg->init_complete = 0;
348 internal_cfg->max_simd_bitwidth.bitwidth = RTE_VECT_DEFAULT_SIMD_BITWIDTH;
349 internal_cfg->max_simd_bitwidth.forced = 0;
353 eal_plugin_add(const char *path)
355 struct shared_driver *solib;
357 solib = malloc(sizeof(*solib));
359 RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
362 memset(solib, 0, sizeof(*solib));
363 strlcpy(solib->name, path, PATH_MAX);
364 TAILQ_INSERT_TAIL(&solib_list, solib, next);
369 #ifdef RTE_EXEC_ENV_WINDOWS
371 eal_plugins_init(void)
378 eal_plugindir_init(const char *path)
381 struct dirent *dent = NULL;
382 char sopath[PATH_MAX];
384 if (path == NULL || *path == '\0')
389 RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
390 path, strerror(errno));
394 while ((dent = readdir(d)) != NULL) {
396 int nlen = strnlen(dent->d_name, sizeof(dent->d_name));
398 /* check if name ends in .so */
399 if (strcmp(&dent->d_name[nlen - 3], ".so") != 0)
402 snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name);
404 /* if a regular file, add to list to load */
405 if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode)))
408 if (eal_plugin_add(sopath) == -1)
413 /* XXX this ignores failures from readdir() itself */
414 return (dent == NULL) ? 0 : -1;
418 verify_perms(const char *dirpath)
422 /* if not root, check down one level first */
423 if (strcmp(dirpath, "/") != 0) {
424 static __thread char last_dir_checked[PATH_MAX];
428 strlcpy(copy, dirpath, PATH_MAX);
430 if (strncmp(dir, last_dir_checked, PATH_MAX) != 0) {
431 if (verify_perms(dir) != 0)
433 strlcpy(last_dir_checked, dir, PATH_MAX);
437 /* call stat to check for permissions and ensure not world writable */
438 if (stat(dirpath, &st) != 0) {
439 RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n",
440 dirpath, strerror(errno));
443 if (st.st_mode & S_IWOTH) {
445 "Error, directory path %s is world-writable and insecure\n",
454 eal_dlopen(const char *pathname)
457 char *realp = realpath(pathname, NULL);
459 if (realp == NULL && errno == ENOENT) {
460 /* not a full or relative path, try a load from system dirs */
461 retval = dlopen(pathname, RTLD_NOW);
463 RTE_LOG(ERR, EAL, "%s\n", dlerror());
467 RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n",
468 pathname, strerror(errno));
471 if (strnlen(realp, PATH_MAX) == PATH_MAX) {
472 RTE_LOG(ERR, EAL, "Error, driver path greater than PATH_MAX\n");
476 /* do permissions checks */
477 if (verify_perms(realp) != 0)
480 retval = dlopen(realp, RTLD_NOW);
482 RTE_LOG(ERR, EAL, "%s\n", dlerror());
489 eal_plugins_init(void)
491 struct shared_driver *solib = NULL;
494 /* If we are not statically linked, add default driver loading
495 * path if it exists as a directory.
496 * (Using dlopen with NOLOAD flag on EAL, will return NULL if the EAL
497 * shared library is not already loaded i.e. it's statically linked.)
499 if (dlopen("librte_eal.so", RTLD_LAZY | RTLD_NOLOAD) != NULL &&
500 *default_solib_dir != '\0' &&
501 stat(default_solib_dir, &sb) == 0 &&
503 eal_plugin_add(default_solib_dir);
505 TAILQ_FOREACH(solib, &solib_list, next) {
507 if (stat(solib->name, &sb) == 0 && S_ISDIR(sb.st_mode)) {
508 if (eal_plugindir_init(solib->name) == -1) {
510 "Cannot init plugin directory %s\n",
515 RTE_LOG(DEBUG, EAL, "open shared lib %s\n",
517 solib->lib_handle = eal_dlopen(solib->name);
518 if (solib->lib_handle == NULL)
528 * Parse the coremask given as argument (hexadecimal string) and fill
529 * the global configuration (core role and core count) with the parsed
532 static int xdigit2val(unsigned char c)
546 eal_parse_service_coremask(const char *coremask)
548 struct rte_config *cfg = rte_eal_get_configuration();
550 unsigned int count = 0;
553 uint32_t taken_lcore_count = 0;
555 if (coremask == NULL)
557 /* Remove all blank characters ahead and after .
558 * Remove 0x/0X if exists.
560 while (isblank(*coremask))
562 if (coremask[0] == '0' && ((coremask[1] == 'x')
563 || (coremask[1] == 'X')))
565 i = strlen(coremask);
566 while ((i > 0) && isblank(coremask[i - 1]))
572 for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
574 if (isxdigit(c) == 0) {
575 /* invalid characters */
579 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE;
581 if ((1 << j) & val) {
582 /* handle master lcore already parsed */
583 uint32_t lcore = idx;
584 if (master_lcore_parsed &&
585 cfg->master_lcore == lcore) {
587 "lcore %u is master lcore, cannot use as service core\n",
592 if (eal_cpu_detected(idx) == 0) {
594 "lcore %u unavailable\n", idx);
598 if (cfg->lcore_role[idx] == ROLE_RTE)
601 lcore_config[idx].core_role = ROLE_SERVICE;
608 if (coremask[i] != '0')
611 for (; idx < RTE_MAX_LCORE; idx++)
612 lcore_config[idx].core_index = -1;
617 if (core_parsed && taken_lcore_count != count) {
618 RTE_LOG(WARNING, EAL,
619 "Not all service cores are in the coremask. "
620 "Please ensure -c or -l includes service cores\n");
623 cfg->service_lcore_count = count;
628 eal_service_cores_parsed(void)
631 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
632 if (lcore_config[idx].core_role == ROLE_SERVICE)
639 update_lcore_config(int *cores)
641 struct rte_config *cfg = rte_eal_get_configuration();
642 unsigned int count = 0;
646 for (i = 0; i < RTE_MAX_LCORE; i++) {
647 if (cores[i] != -1) {
648 if (eal_cpu_detected(i) == 0) {
649 RTE_LOG(ERR, EAL, "lcore %u unavailable\n", i);
653 cfg->lcore_role[i] = ROLE_RTE;
656 cfg->lcore_role[i] = ROLE_OFF;
658 lcore_config[i].core_index = cores[i];
661 cfg->lcore_count = count;
666 eal_parse_coremask(const char *coremask, int *cores)
673 for (idx = 0; idx < RTE_MAX_LCORE; idx++)
677 /* Remove all blank characters ahead and after .
678 * Remove 0x/0X if exists.
680 while (isblank(*coremask))
682 if (coremask[0] == '0' && ((coremask[1] == 'x')
683 || (coremask[1] == 'X')))
685 i = strlen(coremask);
686 while ((i > 0) && isblank(coremask[i - 1]))
691 for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
693 if (isxdigit(c) == 0) {
694 /* invalid characters */
698 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++)
700 if ((1 << j) & val) {
707 if (coremask[i] != '0')
715 eal_parse_service_corelist(const char *corelist)
717 struct rte_config *cfg = rte_eal_get_configuration();
722 uint32_t taken_lcore_count = 0;
724 if (corelist == NULL)
727 /* Remove all blank characters ahead and after */
728 while (isblank(*corelist))
730 i = strlen(corelist);
731 while ((i > 0) && isblank(corelist[i - 1]))
734 /* Get list of cores */
737 while (isblank(*corelist))
739 if (*corelist == '\0')
742 idx = strtoul(corelist, &end, 10);
743 if (errno || end == NULL)
745 while (isblank(*end))
749 } else if ((*end == ',') || (*end == '\0')) {
751 if (min == RTE_MAX_LCORE)
753 for (idx = min; idx <= max; idx++) {
754 if (cfg->lcore_role[idx] != ROLE_SERVICE) {
755 /* handle master lcore already parsed */
756 uint32_t lcore = idx;
757 if (cfg->master_lcore == lcore &&
758 master_lcore_parsed) {
760 "Error: lcore %u is master lcore, cannot use as service core\n",
764 if (cfg->lcore_role[idx] == ROLE_RTE)
767 lcore_config[idx].core_role =
776 } while (*end != '\0');
781 if (core_parsed && taken_lcore_count != count) {
782 RTE_LOG(WARNING, EAL,
783 "Not all service cores were in the coremask. "
784 "Please ensure -c or -l includes service cores\n");
791 eal_parse_corelist(const char *corelist, int *cores)
798 for (idx = 0; idx < RTE_MAX_LCORE; idx++)
801 /* Remove all blank characters ahead */
802 while (isblank(*corelist))
805 /* Get list of cores */
808 while (isblank(*corelist))
810 if (*corelist == '\0')
813 idx = strtol(corelist, &end, 10);
814 if (errno || end == NULL)
816 if (idx < 0 || idx >= RTE_MAX_LCORE)
818 while (isblank(*end))
822 } else if ((*end == ',') || (*end == '\0')) {
824 if (min == RTE_MAX_LCORE)
826 for (idx = min; idx <= max; idx++) {
827 if (cores[idx] == -1) {
836 } while (*end != '\0');
843 /* Changes the lcore id of the master thread */
845 eal_parse_master_lcore(const char *arg)
848 struct rte_config *cfg = rte_eal_get_configuration();
851 cfg->master_lcore = (uint32_t) strtol(arg, &parsing_end, 0);
852 if (errno || parsing_end[0] != 0)
854 if (cfg->master_lcore >= RTE_MAX_LCORE)
856 master_lcore_parsed = 1;
858 /* ensure master core is not used as service core */
859 if (lcore_config[cfg->master_lcore].core_role == ROLE_SERVICE) {
861 "Error: Master lcore is used as a service core\n");
869 * Parse elem, the elem could be single number/range or '(' ')' group
870 * 1) A single number elem, it's just a simple digit. e.g. 9
871 * 2) A single range elem, two digits with a '-' between. e.g. 2-6
872 * 3) A group elem, combines multiple 1) or 2) with '( )'. e.g (0,2-4,6)
873 * Within group elem, '-' used for a range separator;
874 * ',' used for a single number.
877 eal_parse_set(const char *input, rte_cpuset_t *set)
880 const char *str = input;
886 while (isblank(*str))
889 /* only digit or left bracket is qualify for start point */
890 if ((!isdigit(*str) && *str != '(') || *str == '\0')
893 /* process single number or single range of number */
896 idx = strtoul(str, &end, 10);
897 if (errno || end == NULL || idx >= CPU_SETSIZE)
900 while (isblank(*end))
906 /* process single <number>-<number> */
908 while (isblank(*end))
914 idx = strtoul(end, &end, 10);
915 if (errno || end == NULL || idx >= CPU_SETSIZE)
918 while (isblank(*end))
920 if (*end != ',' && *end != '\0')
924 if (*end != ',' && *end != '\0' &&
928 for (idx = RTE_MIN(min, max);
929 idx <= RTE_MAX(min, max); idx++)
936 /* process set within bracket */
938 while (isblank(*str))
946 /* go ahead to the first digit */
947 while (isblank(*str))
952 /* get the digit value */
954 idx = strtoul(str, &end, 10);
955 if (errno || end == NULL || idx >= CPU_SETSIZE)
958 /* go ahead to separator '-',',' and ')' */
959 while (isblank(*end))
962 if (min == RTE_MAX_LCORE)
964 else /* avoid continuous '-' */
966 } else if ((*end == ',') || (*end == ')')) {
968 if (min == RTE_MAX_LCORE)
970 for (idx = RTE_MIN(min, max);
971 idx <= RTE_MAX(min, max); idx++)
979 } while (*end != '\0' && *end != ')');
982 * to avoid failure that tail blank makes end character check fail
983 * in eal_parse_lcores( )
985 while (isblank(*str))
992 check_cpuset(rte_cpuset_t *set)
996 for (idx = 0; idx < CPU_SETSIZE; idx++) {
997 if (!CPU_ISSET(idx, set))
1000 if (eal_cpu_detected(idx) == 0) {
1001 RTE_LOG(ERR, EAL, "core %u "
1002 "unavailable\n", idx);
1010 * The format pattern: --lcores='<lcores[@cpus]>[<,lcores[@cpus]>...]'
1011 * lcores, cpus could be a single digit/range or a group.
1012 * '(' and ')' are necessary if it's a group.
1013 * If not supply '@cpus', the value of cpus uses the same as lcores.
1014 * e.g. '1,2@(5-7),(3-5)@(0,2),(0,6),7-8' means start 9 EAL thread as below
1015 * lcore 0 runs on cpuset 0x41 (cpu 0,6)
1016 * lcore 1 runs on cpuset 0x2 (cpu 1)
1017 * lcore 2 runs on cpuset 0xe0 (cpu 5,6,7)
1018 * lcore 3,4,5 runs on cpuset 0x5 (cpu 0,2)
1019 * lcore 6 runs on cpuset 0x41 (cpu 0,6)
1020 * lcore 7 runs on cpuset 0x80 (cpu 7)
1021 * lcore 8 runs on cpuset 0x100 (cpu 8)
1024 eal_parse_lcores(const char *lcores)
1026 struct rte_config *cfg = rte_eal_get_configuration();
1027 rte_cpuset_t lcore_set;
1028 unsigned int set_count;
1031 const char *lcore_start = NULL;
1032 const char *end = NULL;
1034 rte_cpuset_t cpuset;
1041 /* Remove all blank characters ahead and after */
1042 while (isblank(*lcores))
1047 /* Reset lcore config */
1048 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1049 cfg->lcore_role[idx] = ROLE_OFF;
1050 lcore_config[idx].core_index = -1;
1051 CPU_ZERO(&lcore_config[idx].cpuset);
1054 /* Get list of cores */
1056 while (isblank(*lcores))
1058 if (*lcores == '\0')
1063 /* record lcore_set start point */
1064 lcore_start = lcores;
1066 /* go across a complete bracket */
1067 if (*lcore_start == '(') {
1068 lcores += strcspn(lcores, ")");
1069 if (*lcores++ == '\0')
1073 /* scan the separator '@', ','(next) or '\0'(finish) */
1074 lcores += strcspn(lcores, "@,");
1076 if (*lcores == '@') {
1077 /* explicit assign cpuset and update the end cursor */
1078 offset = eal_parse_set(lcores + 1, &cpuset);
1081 end = lcores + 1 + offset;
1082 } else { /* ',' or '\0' */
1083 /* haven't given cpuset, current loop done */
1086 /* go back to check <number>-<number> */
1087 offset = strcspn(lcore_start, "(-");
1088 if (offset < (end - lcore_start) &&
1089 *(lcore_start + offset) != '(')
1093 if (*end != ',' && *end != '\0')
1096 /* parse lcore_set from start point */
1097 if (eal_parse_set(lcore_start, &lcore_set) < 0)
1100 /* without '@', by default using lcore_set as cpuset */
1102 rte_memcpy(&cpuset, &lcore_set, sizeof(cpuset));
1104 set_count = CPU_COUNT(&lcore_set);
1105 /* start to update lcore_set */
1106 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1107 if (!CPU_ISSET(idx, &lcore_set))
1111 if (cfg->lcore_role[idx] != ROLE_RTE) {
1112 lcore_config[idx].core_index = count;
1113 cfg->lcore_role[idx] = ROLE_RTE;
1119 CPU_SET(idx, &cpuset);
1122 if (check_cpuset(&cpuset) < 0)
1124 rte_memcpy(&lcore_config[idx].cpuset, &cpuset,
1125 sizeof(rte_cpuset_t));
1128 /* some cores from the lcore_set can't be handled by EAL */
1133 } while (*end != '\0');
1138 cfg->lcore_count = count;
1146 #ifndef RTE_EXEC_ENV_WINDOWS
1148 eal_parse_syslog(const char *facility, struct internal_config *conf)
1151 static const struct {
1155 { "auth", LOG_AUTH },
1156 { "cron", LOG_CRON },
1157 { "daemon", LOG_DAEMON },
1159 { "kern", LOG_KERN },
1161 { "mail", LOG_MAIL },
1162 { "news", LOG_NEWS },
1163 { "syslog", LOG_SYSLOG },
1164 { "user", LOG_USER },
1165 { "uucp", LOG_UUCP },
1166 { "local0", LOG_LOCAL0 },
1167 { "local1", LOG_LOCAL1 },
1168 { "local2", LOG_LOCAL2 },
1169 { "local3", LOG_LOCAL3 },
1170 { "local4", LOG_LOCAL4 },
1171 { "local5", LOG_LOCAL5 },
1172 { "local6", LOG_LOCAL6 },
1173 { "local7", LOG_LOCAL7 },
1177 for (i = 0; map[i].name; i++) {
1178 if (!strcmp(facility, map[i].name)) {
1179 conf->syslog_facility = map[i].value;
1188 eal_parse_log_priority(const char *level)
1190 static const char * const levels[] = {
1191 [RTE_LOG_EMERG] = "emergency",
1192 [RTE_LOG_ALERT] = "alert",
1193 [RTE_LOG_CRIT] = "critical",
1194 [RTE_LOG_ERR] = "error",
1195 [RTE_LOG_WARNING] = "warning",
1196 [RTE_LOG_NOTICE] = "notice",
1197 [RTE_LOG_INFO] = "info",
1198 [RTE_LOG_DEBUG] = "debug",
1200 size_t len = strlen(level);
1208 /* look for named values, skip 0 which is not a valid level */
1209 for (i = 1; i < RTE_DIM(levels); i++) {
1210 if (strncmp(levels[i], level, len) == 0)
1214 /* not a string, maybe it is numeric */
1216 tmp = strtoul(level, &end, 0);
1218 /* check for errors */
1219 if (errno != 0 || end == NULL || *end != '\0' ||
1227 eal_parse_log_level(const char *arg)
1229 const char *pattern = NULL;
1230 const char *regex = NULL;
1238 if ((level = strchr(str, ','))) {
1241 } else if ((level = strchr(str, ':'))) {
1248 priority = eal_parse_log_priority(level);
1250 fprintf(stderr, "invalid log priority: %s\n", level);
1255 if (rte_log_set_level_regexp(regex, priority) < 0) {
1256 fprintf(stderr, "cannot set log level %s,%d\n",
1260 if (rte_log_save_regexp(regex, priority) < 0)
1262 } else if (pattern) {
1263 if (rte_log_set_level_pattern(pattern, priority) < 0) {
1264 fprintf(stderr, "cannot set log level %s:%d\n",
1268 if (rte_log_save_pattern(pattern, priority) < 0)
1271 rte_log_set_global_level(priority);
1282 static enum rte_proc_type_t
1283 eal_parse_proc_type(const char *arg)
1285 if (strncasecmp(arg, "primary", sizeof("primary")) == 0)
1286 return RTE_PROC_PRIMARY;
1287 if (strncasecmp(arg, "secondary", sizeof("secondary")) == 0)
1288 return RTE_PROC_SECONDARY;
1289 if (strncasecmp(arg, "auto", sizeof("auto")) == 0)
1290 return RTE_PROC_AUTO;
1292 return RTE_PROC_INVALID;
1296 eal_parse_iova_mode(const char *name)
1299 struct internal_config *internal_conf =
1300 eal_get_internal_configuration();
1305 if (!strcmp("pa", name))
1307 else if (!strcmp("va", name))
1312 internal_conf->iova_mode = mode;
1317 eal_parse_simd_bitwidth(const char *arg)
1320 unsigned long bitwidth;
1322 struct internal_config *internal_conf =
1323 eal_get_internal_configuration();
1325 if (arg == NULL || arg[0] == '\0')
1329 bitwidth = strtoul(arg, &end, 0);
1331 /* check for errors */
1332 if (errno != 0 || end == NULL || *end != '\0' || bitwidth > RTE_VECT_SIMD_MAX)
1336 bitwidth = (unsigned long) RTE_VECT_SIMD_MAX;
1337 ret = rte_vect_set_max_simd_bitwidth(bitwidth);
1340 internal_conf->max_simd_bitwidth.forced = 1;
1345 eal_parse_base_virtaddr(const char *arg)
1349 struct internal_config *internal_conf =
1350 eal_get_internal_configuration();
1353 addr = strtoull(arg, &end, 16);
1355 /* check for errors */
1356 if ((errno != 0) || (arg[0] == '\0') || end == NULL || (*end != '\0'))
1359 /* make sure we don't exceed 32-bit boundary on 32-bit target */
1361 if (addr >= UINTPTR_MAX)
1365 /* align the addr on 16M boundary, 16MB is the minimum huge page
1366 * size on IBM Power architecture. If the addr is aligned to 16MB,
1367 * it can align to 2MB for x86. So this alignment can also be used
1368 * on x86 and other architectures.
1370 internal_conf->base_virtaddr =
1371 RTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M);
1376 /* caller is responsible for freeing the returned string */
1378 available_cores(void)
1386 /* find the first available cpu */
1387 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
1388 if (eal_cpu_detected(idx) == 0)
1392 if (idx >= RTE_MAX_LCORE)
1395 /* first sequence */
1396 if (asprintf(&str, "%d", idx) < 0)
1401 for (idx++ ; idx < RTE_MAX_LCORE; idx++) {
1402 if (eal_cpu_detected(idx) == 0)
1405 if (idx == previous + 1) {
1411 /* finish current sequence */
1413 if (asprintf(&tmp, "%s-%d", str, previous) < 0) {
1422 if (asprintf(&tmp, "%s,%d", str, idx) < 0) {
1432 /* finish last sequence */
1434 if (asprintf(&tmp, "%s-%d", str, previous) < 0) {
1446 eal_parse_common_option(int opt, const char *optarg,
1447 struct internal_config *conf)
1457 if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI,
1467 if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI,
1475 int lcore_indexes[RTE_MAX_LCORE];
1477 if (eal_service_cores_parsed())
1478 RTE_LOG(WARNING, EAL,
1479 "Service cores parsed before dataplane cores. Please ensure -c is before -s or -S\n");
1480 if (eal_parse_coremask(optarg, lcore_indexes) < 0) {
1481 RTE_LOG(ERR, EAL, "invalid coremask syntax\n");
1484 if (update_lcore_config(lcore_indexes) < 0) {
1485 char *available = available_cores();
1488 "invalid coremask, please check specified cores are part of %s\n",
1495 RTE_LOG(ERR, EAL, "Option -c is ignored, because (%s) is set!\n",
1496 (core_parsed == LCORE_OPT_LST) ? "-l" :
1497 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1502 core_parsed = LCORE_OPT_MSK;
1507 int lcore_indexes[RTE_MAX_LCORE];
1509 if (eal_service_cores_parsed())
1510 RTE_LOG(WARNING, EAL,
1511 "Service cores parsed before dataplane cores. Please ensure -l is before -s or -S\n");
1513 if (eal_parse_corelist(optarg, lcore_indexes) < 0) {
1514 RTE_LOG(ERR, EAL, "invalid core list syntax\n");
1517 if (update_lcore_config(lcore_indexes) < 0) {
1518 char *available = available_cores();
1521 "invalid core list, please check specified cores are part of %s\n",
1528 RTE_LOG(ERR, EAL, "Option -l is ignored, because (%s) is set!\n",
1529 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1530 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1535 core_parsed = LCORE_OPT_LST;
1538 /* service coremask */
1540 if (eal_parse_service_coremask(optarg) < 0) {
1541 RTE_LOG(ERR, EAL, "invalid service coremask\n");
1545 /* service corelist */
1547 if (eal_parse_service_corelist(optarg) < 0) {
1548 RTE_LOG(ERR, EAL, "invalid service core list\n");
1552 /* size of memory */
1554 conf->memory = atoi(optarg);
1555 conf->memory *= 1024ULL;
1556 conf->memory *= 1024ULL;
1559 /* force number of channels */
1561 conf->force_nchannel = atoi(optarg);
1562 if (conf->force_nchannel == 0) {
1563 RTE_LOG(ERR, EAL, "invalid channel number\n");
1567 /* force number of ranks */
1569 conf->force_nrank = atoi(optarg);
1570 if (conf->force_nrank == 0 ||
1571 conf->force_nrank > 16) {
1572 RTE_LOG(ERR, EAL, "invalid rank number\n");
1576 /* force loading of external driver */
1578 if (eal_plugin_add(optarg) == -1)
1582 /* since message is explicitly requested by user, we
1583 * write message at highest log level so it can always
1585 * even if info or warning messages are disabled */
1586 RTE_LOG(CRIT, EAL, "RTE Version: '%s'\n", rte_version());
1590 case OPT_HUGE_UNLINK_NUM:
1591 conf->hugepage_unlink = 1;
1594 case OPT_NO_HUGE_NUM:
1595 conf->no_hugetlbfs = 1;
1596 /* no-huge is legacy mem */
1597 conf->legacy_mem = 1;
1600 case OPT_NO_PCI_NUM:
1604 case OPT_NO_HPET_NUM:
1608 case OPT_VMWARE_TSC_MAP_NUM:
1609 conf->vmware_tsc_map = 1;
1612 case OPT_NO_SHCONF_NUM:
1613 conf->no_shconf = 1;
1616 case OPT_IN_MEMORY_NUM:
1617 conf->in_memory = 1;
1618 /* in-memory is a superset of noshconf and huge-unlink */
1619 conf->no_shconf = 1;
1620 conf->hugepage_unlink = 1;
1623 case OPT_PROC_TYPE_NUM:
1624 conf->process_type = eal_parse_proc_type(optarg);
1627 case OPT_MASTER_LCORE_NUM:
1628 if (eal_parse_master_lcore(optarg) < 0) {
1629 RTE_LOG(ERR, EAL, "invalid parameter for --"
1630 OPT_MASTER_LCORE "\n");
1636 if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL,
1642 #ifndef RTE_EXEC_ENV_WINDOWS
1643 case OPT_SYSLOG_NUM:
1644 if (eal_parse_syslog(optarg, conf) < 0) {
1645 RTE_LOG(ERR, EAL, "invalid parameters for --"
1652 case OPT_LOG_LEVEL_NUM: {
1653 if (eal_parse_log_level(optarg) < 0) {
1655 "invalid parameters for --"
1656 OPT_LOG_LEVEL "\n");
1662 #ifndef RTE_EXEC_ENV_WINDOWS
1663 case OPT_TRACE_NUM: {
1664 if (eal_trace_args_save(optarg) < 0) {
1665 RTE_LOG(ERR, EAL, "invalid parameters for --"
1672 case OPT_TRACE_DIR_NUM: {
1673 if (eal_trace_dir_args_save(optarg) < 0) {
1674 RTE_LOG(ERR, EAL, "invalid parameters for --"
1675 OPT_TRACE_DIR "\n");
1681 case OPT_TRACE_BUF_SIZE_NUM: {
1682 if (eal_trace_bufsz_args_save(optarg) < 0) {
1683 RTE_LOG(ERR, EAL, "invalid parameters for --"
1684 OPT_TRACE_BUF_SIZE "\n");
1690 case OPT_TRACE_MODE_NUM: {
1691 if (eal_trace_mode_args_save(optarg) < 0) {
1692 RTE_LOG(ERR, EAL, "invalid parameters for --"
1693 OPT_TRACE_MODE "\n");
1698 #endif /* !RTE_EXEC_ENV_WINDOWS */
1700 case OPT_LCORES_NUM:
1701 if (eal_parse_lcores(optarg) < 0) {
1702 RTE_LOG(ERR, EAL, "invalid parameter for --"
1708 RTE_LOG(ERR, EAL, "Option --lcore is ignored, because (%s) is set!\n",
1709 (core_parsed == LCORE_OPT_LST) ? "-l" :
1710 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1715 core_parsed = LCORE_OPT_MAP;
1717 case OPT_LEGACY_MEM_NUM:
1718 conf->legacy_mem = 1;
1720 case OPT_SINGLE_FILE_SEGMENTS_NUM:
1721 conf->single_file_segments = 1;
1723 case OPT_IOVA_MODE_NUM:
1724 if (eal_parse_iova_mode(optarg) < 0) {
1725 RTE_LOG(ERR, EAL, "invalid parameters for --"
1726 OPT_IOVA_MODE "\n");
1730 case OPT_BASE_VIRTADDR_NUM:
1731 if (eal_parse_base_virtaddr(optarg) < 0) {
1732 RTE_LOG(ERR, EAL, "invalid parameter for --"
1733 OPT_BASE_VIRTADDR "\n");
1737 case OPT_TELEMETRY_NUM:
1739 case OPT_NO_TELEMETRY_NUM:
1740 conf->no_telemetry = 1;
1742 case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM:
1743 if (eal_parse_simd_bitwidth(optarg) < 0) {
1744 RTE_LOG(ERR, EAL, "invalid parameter for --"
1745 OPT_FORCE_MAX_SIMD_BITWIDTH "\n");
1750 /* don't know what to do, leave this to caller */
1758 RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) "
1759 "cannot be used at the same time\n");
1764 eal_auto_detect_cores(struct rte_config *cfg)
1766 unsigned int lcore_id;
1767 unsigned int removed = 0;
1768 rte_cpuset_t affinity_set;
1770 if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
1772 CPU_ZERO(&affinity_set);
1774 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1775 if (cfg->lcore_role[lcore_id] == ROLE_RTE &&
1776 !CPU_ISSET(lcore_id, &affinity_set)) {
1777 cfg->lcore_role[lcore_id] = ROLE_OFF;
1782 cfg->lcore_count -= removed;
1786 compute_ctrl_threads_cpuset(struct internal_config *internal_cfg)
1788 rte_cpuset_t *cpuset = &internal_cfg->ctrl_cpuset;
1789 rte_cpuset_t default_set;
1790 unsigned int lcore_id;
1792 for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1793 if (rte_lcore_has_role(lcore_id, ROLE_OFF))
1795 RTE_CPU_OR(cpuset, cpuset, &lcore_config[lcore_id].cpuset);
1797 RTE_CPU_NOT(cpuset, cpuset);
1799 if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t),
1801 CPU_ZERO(&default_set);
1803 RTE_CPU_AND(cpuset, cpuset, &default_set);
1805 /* if no remaining cpu, use master lcore cpu affinity */
1806 if (!CPU_COUNT(cpuset)) {
1807 memcpy(cpuset, &lcore_config[rte_get_master_lcore()].cpuset,
1813 eal_cleanup_config(struct internal_config *internal_cfg)
1815 if (internal_cfg->hugefile_prefix != NULL)
1816 free(internal_cfg->hugefile_prefix);
1817 if (internal_cfg->hugepage_dir != NULL)
1818 free(internal_cfg->hugepage_dir);
1819 if (internal_cfg->user_mbuf_pool_ops_name != NULL)
1820 free(internal_cfg->user_mbuf_pool_ops_name);
1826 eal_adjust_config(struct internal_config *internal_cfg)
1829 struct rte_config *cfg = rte_eal_get_configuration();
1830 struct internal_config *internal_conf =
1831 eal_get_internal_configuration();
1834 eal_auto_detect_cores(cfg);
1836 if (internal_conf->process_type == RTE_PROC_AUTO)
1837 internal_conf->process_type = eal_proc_type_detect();
1839 /* default master lcore is the first one */
1840 if (!master_lcore_parsed) {
1841 cfg->master_lcore = rte_get_next_lcore(-1, 0, 0);
1842 if (cfg->master_lcore >= RTE_MAX_LCORE)
1844 lcore_config[cfg->master_lcore].core_role = ROLE_RTE;
1847 compute_ctrl_threads_cpuset(internal_cfg);
1849 /* if no memory amounts were requested, this will result in 0 and
1850 * will be overridden later, right after eal_hugepage_info_init() */
1851 for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
1852 internal_cfg->memory += internal_cfg->socket_mem[i];
1858 eal_check_common_options(struct internal_config *internal_cfg)
1860 struct rte_config *cfg = rte_eal_get_configuration();
1861 const struct internal_config *internal_conf =
1862 eal_get_internal_configuration();
1864 if (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) {
1865 RTE_LOG(ERR, EAL, "Master lcore is not enabled for DPDK\n");
1869 if (internal_cfg->process_type == RTE_PROC_INVALID) {
1870 RTE_LOG(ERR, EAL, "Invalid process type specified\n");
1873 if (internal_cfg->hugefile_prefix != NULL &&
1874 strlen(internal_cfg->hugefile_prefix) < 1) {
1875 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_FILE_PREFIX " option\n");
1878 if (internal_cfg->hugepage_dir != NULL &&
1879 strlen(internal_cfg->hugepage_dir) < 1) {
1880 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n");
1883 if (internal_cfg->user_mbuf_pool_ops_name != NULL &&
1884 strlen(internal_cfg->user_mbuf_pool_ops_name) < 1) {
1885 RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n");
1888 if (index(eal_get_hugefile_prefix(), '%') != NULL) {
1889 RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" "
1893 if (mem_parsed && internal_cfg->force_sockets == 1) {
1894 RTE_LOG(ERR, EAL, "Options -m and --"OPT_SOCKET_MEM" cannot "
1895 "be specified at the same time\n");
1898 if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) {
1899 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot "
1900 "be specified together with --"OPT_NO_HUGE"\n");
1903 if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink &&
1904 !internal_cfg->in_memory) {
1905 RTE_LOG(ERR, EAL, "Option --"OPT_HUGE_UNLINK" cannot "
1906 "be specified together with --"OPT_NO_HUGE"\n");
1909 if (internal_conf->force_socket_limits && internal_conf->legacy_mem) {
1910 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_LIMIT
1911 " is only supported in non-legacy memory mode\n");
1913 if (internal_cfg->single_file_segments &&
1914 internal_cfg->hugepage_unlink &&
1915 !internal_cfg->in_memory) {
1916 RTE_LOG(ERR, EAL, "Option --"OPT_SINGLE_FILE_SEGMENTS" is "
1917 "not compatible with --"OPT_HUGE_UNLINK"\n");
1920 if (internal_cfg->legacy_mem &&
1921 internal_cfg->in_memory) {
1922 RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible "
1923 "with --"OPT_IN_MEMORY"\n");
1926 if (internal_cfg->legacy_mem && internal_cfg->match_allocations) {
1927 RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible "
1928 "with --"OPT_MATCH_ALLOCATIONS"\n");
1931 if (internal_cfg->no_hugetlbfs && internal_cfg->match_allocations) {
1932 RTE_LOG(ERR, EAL, "Option --"OPT_NO_HUGE" is not compatible "
1933 "with --"OPT_MATCH_ALLOCATIONS"\n");
1936 if (internal_cfg->legacy_mem && internal_cfg->memory == 0) {
1937 RTE_LOG(NOTICE, EAL, "Static memory layout is selected, "
1938 "amount of reserved memory can be adjusted with "
1939 "-m or --"OPT_SOCKET_MEM"\n");
1946 rte_vect_get_max_simd_bitwidth(void)
1948 const struct internal_config *internal_conf =
1949 eal_get_internal_configuration();
1950 return internal_conf->max_simd_bitwidth.bitwidth;
1954 rte_vect_set_max_simd_bitwidth(uint16_t bitwidth)
1956 struct internal_config *internal_conf =
1957 eal_get_internal_configuration();
1958 if (internal_conf->max_simd_bitwidth.forced) {
1959 RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime override enabled");
1963 if (bitwidth < RTE_VECT_SIMD_DISABLED || !rte_is_power_of_2(bitwidth)) {
1964 RTE_LOG(ERR, EAL, "Invalid bitwidth value!\n");
1967 internal_conf->max_simd_bitwidth.bitwidth = bitwidth;
1972 eal_common_usage(void)
1974 printf("[options]\n\n"
1975 "EAL common options:\n"
1976 " -c COREMASK Hexadecimal bitmask of cores to run on\n"
1977 " -l CORELIST List of cores to run on\n"
1978 " The argument format is <c1>[-c2][,c3[-c4],...]\n"
1979 " where c1, c2, etc are core indexes between 0 and %d\n"
1980 " --"OPT_LCORES" COREMAP Map lcore set to physical cpu set\n"
1981 " The argument format is\n"
1982 " '<lcores[@cpus]>[<,lcores[@cpus]>...]'\n"
1983 " lcores and cpus list are grouped by '(' and ')'\n"
1984 " Within the group, '-' is used for range separator,\n"
1985 " ',' is used for single number separator.\n"
1986 " '( )' can be omitted for single element group,\n"
1987 " '@' can be omitted if cpus and lcores have the same value\n"
1988 " -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
1989 " --"OPT_MASTER_LCORE" ID Core ID that is used as master\n"
1990 " --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n"
1991 " -n CHANNELS Number of memory channels\n"
1992 " -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n"
1993 " -r RANKS Force number of memory ranks (don't detect)\n"
1994 " -b, --"OPT_PCI_BLACKLIST" Add a PCI device in black list.\n"
1995 " Prevent EAL from using this PCI device. The argument\n"
1996 " format is <domain:bus:devid.func>.\n"
1997 " -w, --"OPT_PCI_WHITELIST" Add a PCI device in white list.\n"
1998 " Only use the specified PCI devices. The argument format\n"
1999 " is <[domain:]bus:devid.func>. This option can be present\n"
2000 " several times (once per device).\n"
2001 " [NOTE: PCI whitelist cannot be used with -b option]\n"
2002 " --"OPT_VDEV" Add a virtual device.\n"
2003 " The argument format is <driver><id>[,key=val,...]\n"
2004 " (ex: --vdev=net_pcap0,iface=eth2).\n"
2005 " --"OPT_IOVA_MODE" Set IOVA mode. 'pa' for IOVA_PA\n"
2006 " 'va' for IOVA_VA\n"
2007 " -d LIB.so|DIR Add a driver or driver directory\n"
2008 " (can be used multiple times)\n"
2009 " --"OPT_VMWARE_TSC_MAP" Use VMware TSC map instead of native RDTSC\n"
2010 " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n"
2011 #ifndef RTE_EXEC_ENV_WINDOWS
2012 " --"OPT_SYSLOG" Set syslog facility\n"
2014 " --"OPT_LOG_LEVEL"=<int> Set global log level\n"
2015 " --"OPT_LOG_LEVEL"=<type-match>:<int>\n"
2016 " Set specific log level\n"
2017 #ifndef RTE_EXEC_ENV_WINDOWS
2018 " --"OPT_TRACE"=<regex-match>\n"
2019 " Enable trace based on regular expression trace name.\n"
2020 " By default, the trace is disabled.\n"
2021 " User must specify this option to enable trace.\n"
2022 " --"OPT_TRACE_DIR"=<directory path>\n"
2023 " Specify trace directory for trace output.\n"
2024 " By default, trace output will created at\n"
2025 " $HOME directory and parameter must be\n"
2026 " specified once only.\n"
2027 " --"OPT_TRACE_BUF_SIZE"=<int>\n"
2028 " Specify maximum size of allocated memory\n"
2029 " for trace output for each thread. Valid\n"
2030 " unit can be either 'B|K|M' for 'Bytes',\n"
2031 " 'KBytes' and 'MBytes' respectively.\n"
2032 " Default is 1MB and parameter must be\n"
2033 " specified once only.\n"
2034 " --"OPT_TRACE_MODE"=<o[verwrite] | d[iscard]>\n"
2035 " Specify the mode of update of trace\n"
2036 " output file. Either update on a file can\n"
2037 " be wrapped or discarded when file size\n"
2038 " reaches its maximum limit.\n"
2039 " Default mode is 'overwrite' and parameter\n"
2040 " must be specified once only.\n"
2041 #endif /* !RTE_EXEC_ENV_WINDOWS */
2042 " -v Display version information on startup\n"
2043 " -h, --help This help\n"
2044 " --"OPT_IN_MEMORY" Operate entirely in memory. This will\n"
2045 " disable secondary process support\n"
2046 " --"OPT_BASE_VIRTADDR" Base virtual address\n"
2047 " --"OPT_TELEMETRY" Enable telemetry support (on by default)\n"
2048 " --"OPT_NO_TELEMETRY" Disable telemetry support\n"
2049 " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwidth\n"
2050 "\nEAL options for DEBUG use only:\n"
2051 " --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n"
2052 " --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n"
2053 " --"OPT_NO_PCI" Disable PCI\n"
2054 " --"OPT_NO_HPET" Disable HPET\n"
2055 " --"OPT_NO_SHCONF" No shared config (mmap'd files)\n"
2056 "\n", RTE_MAX_LCORE);