80f11d0221a70f26e6b7c32ac857f0524551ee33
[dpdk.git] / lib / librte_eal / common / eal_common_options.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation.
3  * Copyright(c) 2014 6WIND S.A.
4  */
5
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <string.h>
9 #include <syslog.h>
10 #include <ctype.h>
11 #include <limits.h>
12 #include <errno.h>
13 #include <getopt.h>
14 #include <dlfcn.h>
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 #include <dirent.h>
18
19 #include <rte_eal.h>
20 #include <rte_log.h>
21 #include <rte_lcore.h>
22 #include <rte_tailq.h>
23 #include <rte_version.h>
24 #include <rte_devargs.h>
25 #include <rte_memcpy.h>
26
27 #include "eal_internal_cfg.h"
28 #include "eal_options.h"
29 #include "eal_filesystem.h"
30 #include "eal_private.h"
31
32 #define BITS_PER_HEX 4
33 #define LCORE_OPT_LST 1
34 #define LCORE_OPT_MSK 2
35 #define LCORE_OPT_MAP 3
36
37 const char
38 eal_short_options[] =
39         "b:" /* pci-blacklist */
40         "c:" /* coremask */
41         "s:" /* service coremask */
42         "d:" /* driver */
43         "h"  /* help */
44         "l:" /* corelist */
45         "S:" /* service corelist */
46         "m:" /* memory size */
47         "n:" /* memory channels */
48         "r:" /* memory ranks */
49         "v"  /* version */
50         "w:" /* pci-whitelist */
51         ;
52
53 const struct option
54 eal_long_options[] = {
55         {OPT_BASE_VIRTADDR,     1, NULL, OPT_BASE_VIRTADDR_NUM    },
56         {OPT_CREATE_UIO_DEV,    0, NULL, OPT_CREATE_UIO_DEV_NUM   },
57         {OPT_FILE_PREFIX,       1, NULL, OPT_FILE_PREFIX_NUM      },
58         {OPT_HELP,              0, NULL, OPT_HELP_NUM             },
59         {OPT_HUGE_DIR,          1, NULL, OPT_HUGE_DIR_NUM         },
60         {OPT_HUGE_UNLINK,       0, NULL, OPT_HUGE_UNLINK_NUM      },
61         {OPT_LCORES,            1, NULL, OPT_LCORES_NUM           },
62         {OPT_LOG_LEVEL,         1, NULL, OPT_LOG_LEVEL_NUM        },
63         {OPT_MASTER_LCORE,      1, NULL, OPT_MASTER_LCORE_NUM     },
64         {OPT_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM},
65         {OPT_NO_HPET,           0, NULL, OPT_NO_HPET_NUM          },
66         {OPT_NO_HUGE,           0, NULL, OPT_NO_HUGE_NUM          },
67         {OPT_NO_PCI,            0, NULL, OPT_NO_PCI_NUM           },
68         {OPT_NO_SHCONF,         0, NULL, OPT_NO_SHCONF_NUM        },
69         {OPT_IN_MEMORY,         0, NULL, OPT_IN_MEMORY_NUM        },
70         {OPT_PCI_BLACKLIST,     1, NULL, OPT_PCI_BLACKLIST_NUM    },
71         {OPT_PCI_WHITELIST,     1, NULL, OPT_PCI_WHITELIST_NUM    },
72         {OPT_PROC_TYPE,         1, NULL, OPT_PROC_TYPE_NUM        },
73         {OPT_SOCKET_MEM,        1, NULL, OPT_SOCKET_MEM_NUM       },
74         {OPT_SOCKET_LIMIT,      1, NULL, OPT_SOCKET_LIMIT_NUM     },
75         {OPT_SYSLOG,            1, NULL, OPT_SYSLOG_NUM           },
76         {OPT_VDEV,              1, NULL, OPT_VDEV_NUM             },
77         {OPT_VFIO_INTR,         1, NULL, OPT_VFIO_INTR_NUM        },
78         {OPT_VMWARE_TSC_MAP,    0, NULL, OPT_VMWARE_TSC_MAP_NUM   },
79         {OPT_LEGACY_MEM,        0, NULL, OPT_LEGACY_MEM_NUM       },
80         {OPT_SINGLE_FILE_SEGMENTS, 0, NULL, OPT_SINGLE_FILE_SEGMENTS_NUM},
81         {0,                     0, NULL, 0                        }
82 };
83
84 TAILQ_HEAD(shared_driver_list, shared_driver);
85
86 /* Definition for shared object drivers. */
87 struct shared_driver {
88         TAILQ_ENTRY(shared_driver) next;
89
90         char    name[PATH_MAX];
91         void*   lib_handle;
92 };
93
94 /* List of external loadable drivers */
95 static struct shared_driver_list solib_list =
96 TAILQ_HEAD_INITIALIZER(solib_list);
97
98 /* Default path of external loadable drivers */
99 static const char *default_solib_dir = RTE_EAL_PMD_PATH;
100
101 /*
102  * Stringified version of solib path used by dpdk-pmdinfo.py
103  * Note: PLEASE DO NOT ALTER THIS without making a corresponding
104  * change to usertools/dpdk-pmdinfo.py
105  */
106 static const char dpdk_solib_path[] __attribute__((used)) =
107 "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
108
109 TAILQ_HEAD(device_option_list, device_option);
110
111 struct device_option {
112         TAILQ_ENTRY(device_option) next;
113
114         enum rte_devtype type;
115         char arg[];
116 };
117
118 static struct device_option_list devopt_list =
119 TAILQ_HEAD_INITIALIZER(devopt_list);
120
121 static int master_lcore_parsed;
122 static int mem_parsed;
123 static int core_parsed;
124
125 static int
126 eal_option_device_add(enum rte_devtype type, const char *optarg)
127 {
128         struct device_option *devopt;
129         size_t optlen;
130         int ret;
131
132         optlen = strlen(optarg) + 1;
133         devopt = calloc(1, sizeof(*devopt) + optlen);
134         if (devopt == NULL) {
135                 RTE_LOG(ERR, EAL, "Unable to allocate device option\n");
136                 return -ENOMEM;
137         }
138
139         devopt->type = type;
140         ret = snprintf(devopt->arg, optlen, "%s", optarg);
141         if (ret < 0) {
142                 RTE_LOG(ERR, EAL, "Unable to copy device option\n");
143                 free(devopt);
144                 return -EINVAL;
145         }
146         TAILQ_INSERT_TAIL(&devopt_list, devopt, next);
147         return 0;
148 }
149
150 int
151 eal_option_device_parse(void)
152 {
153         struct device_option *devopt;
154         void *tmp;
155         int ret = 0;
156
157         TAILQ_FOREACH_SAFE(devopt, &devopt_list, next, tmp) {
158                 if (ret == 0) {
159                         ret = rte_devargs_add(devopt->type, devopt->arg);
160                         if (ret)
161                                 RTE_LOG(ERR, EAL, "Unable to parse device '%s'\n",
162                                         devopt->arg);
163                 }
164                 TAILQ_REMOVE(&devopt_list, devopt, next);
165                 free(devopt);
166         }
167         return ret;
168 }
169
170 void
171 eal_reset_internal_config(struct internal_config *internal_cfg)
172 {
173         int i;
174
175         internal_cfg->memory = 0;
176         internal_cfg->force_nrank = 0;
177         internal_cfg->force_nchannel = 0;
178         internal_cfg->hugefile_prefix = HUGEFILE_PREFIX_DEFAULT;
179         internal_cfg->hugepage_dir = NULL;
180         internal_cfg->force_sockets = 0;
181         /* zero out the NUMA config */
182         for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
183                 internal_cfg->socket_mem[i] = 0;
184         internal_cfg->force_socket_limits = 0;
185         /* zero out the NUMA limits config */
186         for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
187                 internal_cfg->socket_limit[i] = 0;
188         /* zero out hugedir descriptors */
189         for (i = 0; i < MAX_HUGEPAGE_SIZES; i++) {
190                 memset(&internal_cfg->hugepage_info[i], 0,
191                                 sizeof(internal_cfg->hugepage_info[0]));
192                 internal_cfg->hugepage_info[i].lock_descriptor = -1;
193         }
194         internal_cfg->base_virtaddr = 0;
195
196         internal_cfg->syslog_facility = LOG_DAEMON;
197
198         /* if set to NONE, interrupt mode is determined automatically */
199         internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE;
200
201 #ifdef RTE_LIBEAL_USE_HPET
202         internal_cfg->no_hpet = 0;
203 #else
204         internal_cfg->no_hpet = 1;
205 #endif
206         internal_cfg->vmware_tsc_map = 0;
207         internal_cfg->create_uio_dev = 0;
208         internal_cfg->user_mbuf_pool_ops_name = NULL;
209         internal_cfg->init_complete = 0;
210 }
211
212 static int
213 eal_plugin_add(const char *path)
214 {
215         struct shared_driver *solib;
216
217         solib = malloc(sizeof(*solib));
218         if (solib == NULL) {
219                 RTE_LOG(ERR, EAL, "malloc(solib) failed\n");
220                 return -1;
221         }
222         memset(solib, 0, sizeof(*solib));
223         strncpy(solib->name, path, PATH_MAX-1);
224         solib->name[PATH_MAX-1] = 0;
225         TAILQ_INSERT_TAIL(&solib_list, solib, next);
226
227         return 0;
228 }
229
230 static int
231 eal_plugindir_init(const char *path)
232 {
233         DIR *d = NULL;
234         struct dirent *dent = NULL;
235         char sopath[PATH_MAX];
236
237         if (path == NULL || *path == '\0')
238                 return 0;
239
240         d = opendir(path);
241         if (d == NULL) {
242                 RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
243                         path, strerror(errno));
244                 return -1;
245         }
246
247         while ((dent = readdir(d)) != NULL) {
248                 struct stat sb;
249
250                 snprintf(sopath, PATH_MAX-1, "%s/%s", path, dent->d_name);
251                 sopath[PATH_MAX-1] = 0;
252
253                 if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode)))
254                         continue;
255
256                 if (eal_plugin_add(sopath) == -1)
257                         break;
258         }
259
260         closedir(d);
261         /* XXX this ignores failures from readdir() itself */
262         return (dent == NULL) ? 0 : -1;
263 }
264
265 int
266 eal_plugins_init(void)
267 {
268         struct shared_driver *solib = NULL;
269         struct stat sb;
270
271         if (*default_solib_dir != '\0' && stat(default_solib_dir, &sb) == 0 &&
272                                 S_ISDIR(sb.st_mode))
273                 eal_plugin_add(default_solib_dir);
274
275         TAILQ_FOREACH(solib, &solib_list, next) {
276
277                 if (stat(solib->name, &sb) == 0 && S_ISDIR(sb.st_mode)) {
278                         if (eal_plugindir_init(solib->name) == -1) {
279                                 RTE_LOG(ERR, EAL,
280                                         "Cannot init plugin directory %s\n",
281                                         solib->name);
282                                 return -1;
283                         }
284                 } else {
285                         RTE_LOG(DEBUG, EAL, "open shared lib %s\n",
286                                 solib->name);
287                         solib->lib_handle = dlopen(solib->name, RTLD_NOW);
288                         if (solib->lib_handle == NULL) {
289                                 RTE_LOG(ERR, EAL, "%s\n", dlerror());
290                                 return -1;
291                         }
292                 }
293
294         }
295         return 0;
296 }
297
298 /*
299  * Parse the coremask given as argument (hexadecimal string) and fill
300  * the global configuration (core role and core count) with the parsed
301  * value.
302  */
303 static int xdigit2val(unsigned char c)
304 {
305         int val;
306
307         if (isdigit(c))
308                 val = c - '0';
309         else if (isupper(c))
310                 val = c - 'A' + 10;
311         else
312                 val = c - 'a' + 10;
313         return val;
314 }
315
316 static int
317 eal_parse_service_coremask(const char *coremask)
318 {
319         struct rte_config *cfg = rte_eal_get_configuration();
320         int i, j, idx = 0;
321         unsigned int count = 0;
322         char c;
323         int val;
324
325         if (coremask == NULL)
326                 return -1;
327         /* Remove all blank characters ahead and after .
328          * Remove 0x/0X if exists.
329          */
330         while (isblank(*coremask))
331                 coremask++;
332         if (coremask[0] == '0' && ((coremask[1] == 'x')
333                 || (coremask[1] == 'X')))
334                 coremask += 2;
335         i = strlen(coremask);
336         while ((i > 0) && isblank(coremask[i - 1]))
337                 i--;
338
339         if (i == 0)
340                 return -1;
341
342         for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
343                 c = coremask[i];
344                 if (isxdigit(c) == 0) {
345                         /* invalid characters */
346                         return -1;
347                 }
348                 val = xdigit2val(c);
349                 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE;
350                                 j++, idx++) {
351                         if ((1 << j) & val) {
352                                 /* handle master lcore already parsed */
353                                 uint32_t lcore = idx;
354                                 if (master_lcore_parsed &&
355                                                 cfg->master_lcore == lcore) {
356                                         RTE_LOG(ERR, EAL,
357                                                 "Error: lcore %u is master lcore, cannot use as service core\n",
358                                                 idx);
359                                         return -1;
360                                 }
361
362                                 if (!lcore_config[idx].detected) {
363                                         RTE_LOG(ERR, EAL,
364                                                 "lcore %u unavailable\n", idx);
365                                         return -1;
366                                 }
367                                 lcore_config[idx].core_role = ROLE_SERVICE;
368                                 count++;
369                         }
370                 }
371         }
372
373         for (; i >= 0; i--)
374                 if (coremask[i] != '0')
375                         return -1;
376
377         for (; idx < RTE_MAX_LCORE; idx++)
378                 lcore_config[idx].core_index = -1;
379
380         if (count == 0)
381                 return -1;
382
383         cfg->service_lcore_count = count;
384         return 0;
385 }
386
387 static int
388 eal_parse_coremask(const char *coremask)
389 {
390         struct rte_config *cfg = rte_eal_get_configuration();
391         int i, j, idx = 0;
392         unsigned count = 0;
393         char c;
394         int val;
395
396         if (coremask == NULL)
397                 return -1;
398         /* Remove all blank characters ahead and after .
399          * Remove 0x/0X if exists.
400          */
401         while (isblank(*coremask))
402                 coremask++;
403         if (coremask[0] == '0' && ((coremask[1] == 'x')
404                 || (coremask[1] == 'X')))
405                 coremask += 2;
406         i = strlen(coremask);
407         while ((i > 0) && isblank(coremask[i - 1]))
408                 i--;
409         if (i == 0)
410                 return -1;
411
412         for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
413                 c = coremask[i];
414                 if (isxdigit(c) == 0) {
415                         /* invalid characters */
416                         return -1;
417                 }
418                 val = xdigit2val(c);
419                 for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++)
420                 {
421                         if ((1 << j) & val) {
422                                 if (!lcore_config[idx].detected) {
423                                         RTE_LOG(ERR, EAL, "lcore %u "
424                                                 "unavailable\n", idx);
425                                         return -1;
426                                 }
427                                 cfg->lcore_role[idx] = ROLE_RTE;
428                                 lcore_config[idx].core_index = count;
429                                 count++;
430                         } else {
431                                 cfg->lcore_role[idx] = ROLE_OFF;
432                                 lcore_config[idx].core_index = -1;
433                         }
434                 }
435         }
436         for (; i >= 0; i--)
437                 if (coremask[i] != '0')
438                         return -1;
439         for (; idx < RTE_MAX_LCORE; idx++) {
440                 cfg->lcore_role[idx] = ROLE_OFF;
441                 lcore_config[idx].core_index = -1;
442         }
443         if (count == 0)
444                 return -1;
445         /* Update the count of enabled logical cores of the EAL configuration */
446         cfg->lcore_count = count;
447         return 0;
448 }
449
450 static int
451 eal_parse_service_corelist(const char *corelist)
452 {
453         struct rte_config *cfg = rte_eal_get_configuration();
454         int i, idx = 0;
455         unsigned count = 0;
456         char *end = NULL;
457         int min, max;
458
459         if (corelist == NULL)
460                 return -1;
461
462         /* Remove all blank characters ahead and after */
463         while (isblank(*corelist))
464                 corelist++;
465         i = strlen(corelist);
466         while ((i > 0) && isblank(corelist[i - 1]))
467                 i--;
468
469         /* Get list of cores */
470         min = RTE_MAX_LCORE;
471         do {
472                 while (isblank(*corelist))
473                         corelist++;
474                 if (*corelist == '\0')
475                         return -1;
476                 errno = 0;
477                 idx = strtoul(corelist, &end, 10);
478                 if (errno || end == NULL)
479                         return -1;
480                 while (isblank(*end))
481                         end++;
482                 if (*end == '-') {
483                         min = idx;
484                 } else if ((*end == ',') || (*end == '\0')) {
485                         max = idx;
486                         if (min == RTE_MAX_LCORE)
487                                 min = idx;
488                         for (idx = min; idx <= max; idx++) {
489                                 if (cfg->lcore_role[idx] != ROLE_SERVICE) {
490                                         /* handle master lcore already parsed */
491                                         uint32_t lcore = idx;
492                                         if (cfg->master_lcore == lcore &&
493                                                         master_lcore_parsed) {
494                                                 RTE_LOG(ERR, EAL,
495                                                         "Error: lcore %u is master lcore, cannot use as service core\n",
496                                                         idx);
497                                                 return -1;
498                                         }
499                                         lcore_config[idx].core_role =
500                                                         ROLE_SERVICE;
501                                         count++;
502                                 }
503                         }
504                         min = RTE_MAX_LCORE;
505                 } else
506                         return -1;
507                 corelist = end + 1;
508         } while (*end != '\0');
509
510         if (count == 0)
511                 return -1;
512
513         return 0;
514 }
515
516 static int
517 eal_parse_corelist(const char *corelist)
518 {
519         struct rte_config *cfg = rte_eal_get_configuration();
520         int i, idx = 0;
521         unsigned count = 0;
522         char *end = NULL;
523         int min, max;
524
525         if (corelist == NULL)
526                 return -1;
527
528         /* Remove all blank characters ahead and after */
529         while (isblank(*corelist))
530                 corelist++;
531         i = strlen(corelist);
532         while ((i > 0) && isblank(corelist[i - 1]))
533                 i--;
534
535         /* Reset config */
536         for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
537                 cfg->lcore_role[idx] = ROLE_OFF;
538                 lcore_config[idx].core_index = -1;
539         }
540
541         /* Get list of cores */
542         min = RTE_MAX_LCORE;
543         do {
544                 while (isblank(*corelist))
545                         corelist++;
546                 if (*corelist == '\0')
547                         return -1;
548                 errno = 0;
549                 idx = strtoul(corelist, &end, 10);
550                 if (errno || end == NULL)
551                         return -1;
552                 while (isblank(*end))
553                         end++;
554                 if (*end == '-') {
555                         min = idx;
556                 } else if ((*end == ',') || (*end == '\0')) {
557                         max = idx;
558                         if (min == RTE_MAX_LCORE)
559                                 min = idx;
560                         for (idx = min; idx <= max; idx++) {
561                                 if (cfg->lcore_role[idx] != ROLE_RTE) {
562                                         cfg->lcore_role[idx] = ROLE_RTE;
563                                         lcore_config[idx].core_index = count;
564                                         count++;
565                                 }
566                         }
567                         min = RTE_MAX_LCORE;
568                 } else
569                         return -1;
570                 corelist = end + 1;
571         } while (*end != '\0');
572
573         if (count == 0)
574                 return -1;
575
576         /* Update the count of enabled logical cores of the EAL configuration */
577         cfg->lcore_count = count;
578
579         return 0;
580 }
581
582 /* Changes the lcore id of the master thread */
583 static int
584 eal_parse_master_lcore(const char *arg)
585 {
586         char *parsing_end;
587         struct rte_config *cfg = rte_eal_get_configuration();
588
589         errno = 0;
590         cfg->master_lcore = (uint32_t) strtol(arg, &parsing_end, 0);
591         if (errno || parsing_end[0] != 0)
592                 return -1;
593         if (cfg->master_lcore >= RTE_MAX_LCORE)
594                 return -1;
595         master_lcore_parsed = 1;
596
597         /* ensure master core is not used as service core */
598         if (lcore_config[cfg->master_lcore].core_role == ROLE_SERVICE) {
599                 RTE_LOG(ERR, EAL, "Error: Master lcore is used as a service core.\n");
600                 return -1;
601         }
602
603         return 0;
604 }
605
606 /*
607  * Parse elem, the elem could be single number/range or '(' ')' group
608  * 1) A single number elem, it's just a simple digit. e.g. 9
609  * 2) A single range elem, two digits with a '-' between. e.g. 2-6
610  * 3) A group elem, combines multiple 1) or 2) with '( )'. e.g (0,2-4,6)
611  *    Within group elem, '-' used for a range separator;
612  *                       ',' used for a single number.
613  */
614 static int
615 eal_parse_set(const char *input, uint16_t set[], unsigned num)
616 {
617         unsigned idx;
618         const char *str = input;
619         char *end = NULL;
620         unsigned min, max;
621
622         memset(set, 0, num * sizeof(uint16_t));
623
624         while (isblank(*str))
625                 str++;
626
627         /* only digit or left bracket is qualify for start point */
628         if ((!isdigit(*str) && *str != '(') || *str == '\0')
629                 return -1;
630
631         /* process single number or single range of number */
632         if (*str != '(') {
633                 errno = 0;
634                 idx = strtoul(str, &end, 10);
635                 if (errno || end == NULL || idx >= num)
636                         return -1;
637                 else {
638                         while (isblank(*end))
639                                 end++;
640
641                         min = idx;
642                         max = idx;
643                         if (*end == '-') {
644                                 /* process single <number>-<number> */
645                                 end++;
646                                 while (isblank(*end))
647                                         end++;
648                                 if (!isdigit(*end))
649                                         return -1;
650
651                                 errno = 0;
652                                 idx = strtoul(end, &end, 10);
653                                 if (errno || end == NULL || idx >= num)
654                                         return -1;
655                                 max = idx;
656                                 while (isblank(*end))
657                                         end++;
658                                 if (*end != ',' && *end != '\0')
659                                         return -1;
660                         }
661
662                         if (*end != ',' && *end != '\0' &&
663                             *end != '@')
664                                 return -1;
665
666                         for (idx = RTE_MIN(min, max);
667                              idx <= RTE_MAX(min, max); idx++)
668                                 set[idx] = 1;
669
670                         return end - input;
671                 }
672         }
673
674         /* process set within bracket */
675         str++;
676         while (isblank(*str))
677                 str++;
678         if (*str == '\0')
679                 return -1;
680
681         min = RTE_MAX_LCORE;
682         do {
683
684                 /* go ahead to the first digit */
685                 while (isblank(*str))
686                         str++;
687                 if (!isdigit(*str))
688                         return -1;
689
690                 /* get the digit value */
691                 errno = 0;
692                 idx = strtoul(str, &end, 10);
693                 if (errno || end == NULL || idx >= num)
694                         return -1;
695
696                 /* go ahead to separator '-',',' and ')' */
697                 while (isblank(*end))
698                         end++;
699                 if (*end == '-') {
700                         if (min == RTE_MAX_LCORE)
701                                 min = idx;
702                         else /* avoid continuous '-' */
703                                 return -1;
704                 } else if ((*end == ',') || (*end == ')')) {
705                         max = idx;
706                         if (min == RTE_MAX_LCORE)
707                                 min = idx;
708                         for (idx = RTE_MIN(min, max);
709                              idx <= RTE_MAX(min, max); idx++)
710                                 set[idx] = 1;
711
712                         min = RTE_MAX_LCORE;
713                 } else
714                         return -1;
715
716                 str = end + 1;
717         } while (*end != '\0' && *end != ')');
718
719         /*
720          * to avoid failure that tail blank makes end character check fail
721          * in eal_parse_lcores( )
722          */
723         while (isblank(*str))
724                 str++;
725
726         return str - input;
727 }
728
729 /* convert from set array to cpuset bitmap */
730 static int
731 convert_to_cpuset(rte_cpuset_t *cpusetp,
732               uint16_t *set, unsigned num)
733 {
734         unsigned idx;
735
736         CPU_ZERO(cpusetp);
737
738         for (idx = 0; idx < num; idx++) {
739                 if (!set[idx])
740                         continue;
741
742                 if (!lcore_config[idx].detected) {
743                         RTE_LOG(ERR, EAL, "core %u "
744                                 "unavailable\n", idx);
745                         return -1;
746                 }
747
748                 CPU_SET(idx, cpusetp);
749         }
750
751         return 0;
752 }
753
754 /*
755  * The format pattern: --lcores='<lcores[@cpus]>[<,lcores[@cpus]>...]'
756  * lcores, cpus could be a single digit/range or a group.
757  * '(' and ')' are necessary if it's a group.
758  * If not supply '@cpus', the value of cpus uses the same as lcores.
759  * e.g. '1,2@(5-7),(3-5)@(0,2),(0,6),7-8' means start 9 EAL thread as below
760  *   lcore 0 runs on cpuset 0x41 (cpu 0,6)
761  *   lcore 1 runs on cpuset 0x2 (cpu 1)
762  *   lcore 2 runs on cpuset 0xe0 (cpu 5,6,7)
763  *   lcore 3,4,5 runs on cpuset 0x5 (cpu 0,2)
764  *   lcore 6 runs on cpuset 0x41 (cpu 0,6)
765  *   lcore 7 runs on cpuset 0x80 (cpu 7)
766  *   lcore 8 runs on cpuset 0x100 (cpu 8)
767  */
768 static int
769 eal_parse_lcores(const char *lcores)
770 {
771         struct rte_config *cfg = rte_eal_get_configuration();
772         static uint16_t set[RTE_MAX_LCORE];
773         unsigned idx = 0;
774         unsigned count = 0;
775         const char *lcore_start = NULL;
776         const char *end = NULL;
777         int offset;
778         rte_cpuset_t cpuset;
779         int lflags;
780         int ret = -1;
781
782         if (lcores == NULL)
783                 return -1;
784
785         /* Remove all blank characters ahead and after */
786         while (isblank(*lcores))
787                 lcores++;
788
789         CPU_ZERO(&cpuset);
790
791         /* Reset lcore config */
792         for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
793                 cfg->lcore_role[idx] = ROLE_OFF;
794                 lcore_config[idx].core_index = -1;
795                 CPU_ZERO(&lcore_config[idx].cpuset);
796         }
797
798         /* Get list of cores */
799         do {
800                 while (isblank(*lcores))
801                         lcores++;
802                 if (*lcores == '\0')
803                         goto err;
804
805                 lflags = 0;
806
807                 /* record lcore_set start point */
808                 lcore_start = lcores;
809
810                 /* go across a complete bracket */
811                 if (*lcore_start == '(') {
812                         lcores += strcspn(lcores, ")");
813                         if (*lcores++ == '\0')
814                                 goto err;
815                 }
816
817                 /* scan the separator '@', ','(next) or '\0'(finish) */
818                 lcores += strcspn(lcores, "@,");
819
820                 if (*lcores == '@') {
821                         /* explicit assign cpu_set */
822                         offset = eal_parse_set(lcores + 1, set, RTE_DIM(set));
823                         if (offset < 0)
824                                 goto err;
825
826                         /* prepare cpu_set and update the end cursor */
827                         if (0 > convert_to_cpuset(&cpuset,
828                                                   set, RTE_DIM(set)))
829                                 goto err;
830                         end = lcores + 1 + offset;
831                 } else { /* ',' or '\0' */
832                         /* haven't given cpu_set, current loop done */
833                         end = lcores;
834
835                         /* go back to check <number>-<number> */
836                         offset = strcspn(lcore_start, "(-");
837                         if (offset < (end - lcore_start) &&
838                             *(lcore_start + offset) != '(')
839                                 lflags = 1;
840                 }
841
842                 if (*end != ',' && *end != '\0')
843                         goto err;
844
845                 /* parse lcore_set from start point */
846                 if (0 > eal_parse_set(lcore_start, set, RTE_DIM(set)))
847                         goto err;
848
849                 /* without '@', by default using lcore_set as cpu_set */
850                 if (*lcores != '@' &&
851                     0 > convert_to_cpuset(&cpuset, set, RTE_DIM(set)))
852                         goto err;
853
854                 /* start to update lcore_set */
855                 for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
856                         if (!set[idx])
857                                 continue;
858
859                         if (cfg->lcore_role[idx] != ROLE_RTE) {
860                                 lcore_config[idx].core_index = count;
861                                 cfg->lcore_role[idx] = ROLE_RTE;
862                                 count++;
863                         }
864
865                         if (lflags) {
866                                 CPU_ZERO(&cpuset);
867                                 CPU_SET(idx, &cpuset);
868                         }
869                         rte_memcpy(&lcore_config[idx].cpuset, &cpuset,
870                                    sizeof(rte_cpuset_t));
871                 }
872
873                 lcores = end + 1;
874         } while (*end != '\0');
875
876         if (count == 0)
877                 goto err;
878
879         cfg->lcore_count = count;
880         ret = 0;
881
882 err:
883
884         return ret;
885 }
886
887 static int
888 eal_parse_syslog(const char *facility, struct internal_config *conf)
889 {
890         int i;
891         static const struct {
892                 const char *name;
893                 int value;
894         } map[] = {
895                 { "auth", LOG_AUTH },
896                 { "cron", LOG_CRON },
897                 { "daemon", LOG_DAEMON },
898                 { "ftp", LOG_FTP },
899                 { "kern", LOG_KERN },
900                 { "lpr", LOG_LPR },
901                 { "mail", LOG_MAIL },
902                 { "news", LOG_NEWS },
903                 { "syslog", LOG_SYSLOG },
904                 { "user", LOG_USER },
905                 { "uucp", LOG_UUCP },
906                 { "local0", LOG_LOCAL0 },
907                 { "local1", LOG_LOCAL1 },
908                 { "local2", LOG_LOCAL2 },
909                 { "local3", LOG_LOCAL3 },
910                 { "local4", LOG_LOCAL4 },
911                 { "local5", LOG_LOCAL5 },
912                 { "local6", LOG_LOCAL6 },
913                 { "local7", LOG_LOCAL7 },
914                 { NULL, 0 }
915         };
916
917         for (i = 0; map[i].name; i++) {
918                 if (!strcmp(facility, map[i].name)) {
919                         conf->syslog_facility = map[i].value;
920                         return 0;
921                 }
922         }
923         return -1;
924 }
925
926 static int
927 eal_parse_log_priority(const char *level)
928 {
929         static const char * const levels[] = {
930                 [RTE_LOG_EMERG]   = "emergency",
931                 [RTE_LOG_ALERT]   = "alert",
932                 [RTE_LOG_CRIT]    = "critical",
933                 [RTE_LOG_ERR]     = "error",
934                 [RTE_LOG_WARNING] = "warning",
935                 [RTE_LOG_NOTICE]  = "notice",
936                 [RTE_LOG_INFO]    = "info",
937                 [RTE_LOG_DEBUG]   = "debug",
938         };
939         size_t len = strlen(level);
940         unsigned long tmp;
941         char *end;
942         unsigned int i;
943
944         if (len == 0)
945                 return -1;
946
947         /* look for named values, skip 0 which is not a valid level */
948         for (i = 1; i < RTE_DIM(levels); i++) {
949                 if (strncmp(levels[i], level, len) == 0)
950                         return i;
951         }
952
953         /* not a string, maybe it is numeric */
954         errno = 0;
955         tmp = strtoul(level, &end, 0);
956
957         /* check for errors */
958         if (errno != 0 || end == NULL || *end != '\0' ||
959             tmp >= UINT32_MAX)
960                 return -1;
961
962         return tmp;
963 }
964
965 static int
966 eal_parse_log_level(const char *arg)
967 {
968         const char *pattern = NULL;
969         const char *regex = NULL;
970         char *str, *level;
971         int priority;
972
973         str = strdup(arg);
974         if (str == NULL)
975                 return -1;
976
977         if ((level = strchr(str, ','))) {
978                 regex = str;
979                 *level++ = '\0';
980         } else if ((level = strchr(str, ':'))) {
981                 pattern = str;
982                 *level++ = '\0';
983         } else {
984                 level = str;
985         }
986
987         priority = eal_parse_log_priority(level);
988         if (priority < 0) {
989                 fprintf(stderr, "invalid log priority: %s\n", level);
990                 goto fail;
991         }
992
993         if (regex) {
994                 if (rte_log_set_level_regexp(regex, priority) < 0) {
995                         fprintf(stderr, "cannot set log level %s,%d\n",
996                                 pattern, priority);
997                         goto fail;
998                 }
999                 if (rte_log_save_regexp(regex, priority) < 0)
1000                         goto fail;
1001         } else if (pattern) {
1002                 if (rte_log_set_level_pattern(pattern, priority) < 0) {
1003                         fprintf(stderr, "cannot set log level %s:%d\n",
1004                                 pattern, priority);
1005                         goto fail;
1006                 }
1007                 if (rte_log_save_pattern(pattern, priority) < 0)
1008                         goto fail;
1009         } else {
1010                 rte_log_set_global_level(priority);
1011         }
1012
1013         free(str);
1014         return 0;
1015
1016 fail:
1017         free(str);
1018         return -1;
1019 }
1020
1021 static enum rte_proc_type_t
1022 eal_parse_proc_type(const char *arg)
1023 {
1024         if (strncasecmp(arg, "primary", sizeof("primary")) == 0)
1025                 return RTE_PROC_PRIMARY;
1026         if (strncasecmp(arg, "secondary", sizeof("secondary")) == 0)
1027                 return RTE_PROC_SECONDARY;
1028         if (strncasecmp(arg, "auto", sizeof("auto")) == 0)
1029                 return RTE_PROC_AUTO;
1030
1031         return RTE_PROC_INVALID;
1032 }
1033
1034 int
1035 eal_parse_common_option(int opt, const char *optarg,
1036                         struct internal_config *conf)
1037 {
1038         static int b_used;
1039         static int w_used;
1040
1041         switch (opt) {
1042         /* blacklist */
1043         case 'b':
1044                 if (w_used)
1045                         goto bw_used;
1046                 if (eal_option_device_add(RTE_DEVTYPE_BLACKLISTED_PCI,
1047                                 optarg) < 0) {
1048                         return -1;
1049                 }
1050                 b_used = 1;
1051                 break;
1052         /* whitelist */
1053         case 'w':
1054                 if (b_used)
1055                         goto bw_used;
1056                 if (eal_option_device_add(RTE_DEVTYPE_WHITELISTED_PCI,
1057                                 optarg) < 0) {
1058                         return -1;
1059                 }
1060                 w_used = 1;
1061                 break;
1062         /* coremask */
1063         case 'c':
1064                 if (eal_parse_coremask(optarg) < 0) {
1065                         RTE_LOG(ERR, EAL, "invalid coremask\n");
1066                         return -1;
1067                 }
1068
1069                 if (core_parsed) {
1070                         RTE_LOG(ERR, EAL, "Option -c is ignored, because (%s) is set!\n",
1071                                 (core_parsed == LCORE_OPT_LST) ? "-l" :
1072                                 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1073                                 "-c");
1074                         return -1;
1075                 }
1076
1077                 core_parsed = LCORE_OPT_MSK;
1078                 break;
1079         /* corelist */
1080         case 'l':
1081                 if (eal_parse_corelist(optarg) < 0) {
1082                         RTE_LOG(ERR, EAL, "invalid core list\n");
1083                         return -1;
1084                 }
1085
1086                 if (core_parsed) {
1087                         RTE_LOG(ERR, EAL, "Option -l is ignored, because (%s) is set!\n",
1088                                 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1089                                 (core_parsed == LCORE_OPT_MAP) ? "--lcore" :
1090                                 "-l");
1091                         return -1;
1092                 }
1093
1094                 core_parsed = LCORE_OPT_LST;
1095                 break;
1096         /* service coremask */
1097         case 's':
1098                 if (eal_parse_service_coremask(optarg) < 0) {
1099                         RTE_LOG(ERR, EAL, "invalid service coremask\n");
1100                         return -1;
1101                 }
1102                 break;
1103         /* service corelist */
1104         case 'S':
1105                 if (eal_parse_service_corelist(optarg) < 0) {
1106                         RTE_LOG(ERR, EAL, "invalid service core list\n");
1107                         return -1;
1108                 }
1109                 break;
1110         /* size of memory */
1111         case 'm':
1112                 conf->memory = atoi(optarg);
1113                 conf->memory *= 1024ULL;
1114                 conf->memory *= 1024ULL;
1115                 mem_parsed = 1;
1116                 break;
1117         /* force number of channels */
1118         case 'n':
1119                 conf->force_nchannel = atoi(optarg);
1120                 if (conf->force_nchannel == 0) {
1121                         RTE_LOG(ERR, EAL, "invalid channel number\n");
1122                         return -1;
1123                 }
1124                 break;
1125         /* force number of ranks */
1126         case 'r':
1127                 conf->force_nrank = atoi(optarg);
1128                 if (conf->force_nrank == 0 ||
1129                     conf->force_nrank > 16) {
1130                         RTE_LOG(ERR, EAL, "invalid rank number\n");
1131                         return -1;
1132                 }
1133                 break;
1134         /* force loading of external driver */
1135         case 'd':
1136                 if (eal_plugin_add(optarg) == -1)
1137                         return -1;
1138                 break;
1139         case 'v':
1140                 /* since message is explicitly requested by user, we
1141                  * write message at highest log level so it can always
1142                  * be seen
1143                  * even if info or warning messages are disabled */
1144                 RTE_LOG(CRIT, EAL, "RTE Version: '%s'\n", rte_version());
1145                 break;
1146
1147         /* long options */
1148         case OPT_HUGE_UNLINK_NUM:
1149                 conf->hugepage_unlink = 1;
1150                 break;
1151
1152         case OPT_NO_HUGE_NUM:
1153                 conf->no_hugetlbfs = 1;
1154                 /* no-huge is legacy mem */
1155                 conf->legacy_mem = 1;
1156                 break;
1157
1158         case OPT_NO_PCI_NUM:
1159                 conf->no_pci = 1;
1160                 break;
1161
1162         case OPT_NO_HPET_NUM:
1163                 conf->no_hpet = 1;
1164                 break;
1165
1166         case OPT_VMWARE_TSC_MAP_NUM:
1167                 conf->vmware_tsc_map = 1;
1168                 break;
1169
1170         case OPT_NO_SHCONF_NUM:
1171                 conf->no_shconf = 1;
1172                 break;
1173
1174         case OPT_IN_MEMORY_NUM:
1175                 conf->in_memory = 1;
1176                 /* in-memory is a superset of noshconf and huge-unlink */
1177                 conf->no_shconf = 1;
1178                 conf->hugepage_unlink = 1;
1179                 break;
1180
1181         case OPT_PROC_TYPE_NUM:
1182                 conf->process_type = eal_parse_proc_type(optarg);
1183                 break;
1184
1185         case OPT_MASTER_LCORE_NUM:
1186                 if (eal_parse_master_lcore(optarg) < 0) {
1187                         RTE_LOG(ERR, EAL, "invalid parameter for --"
1188                                         OPT_MASTER_LCORE "\n");
1189                         return -1;
1190                 }
1191                 break;
1192
1193         case OPT_VDEV_NUM:
1194                 if (eal_option_device_add(RTE_DEVTYPE_VIRTUAL,
1195                                 optarg) < 0) {
1196                         return -1;
1197                 }
1198                 break;
1199
1200         case OPT_SYSLOG_NUM:
1201                 if (eal_parse_syslog(optarg, conf) < 0) {
1202                         RTE_LOG(ERR, EAL, "invalid parameters for --"
1203                                         OPT_SYSLOG "\n");
1204                         return -1;
1205                 }
1206                 break;
1207
1208         case OPT_LOG_LEVEL_NUM: {
1209                 if (eal_parse_log_level(optarg) < 0) {
1210                         RTE_LOG(ERR, EAL,
1211                                 "invalid parameters for --"
1212                                 OPT_LOG_LEVEL "\n");
1213                         return -1;
1214                 }
1215                 break;
1216         }
1217         case OPT_LCORES_NUM:
1218                 if (eal_parse_lcores(optarg) < 0) {
1219                         RTE_LOG(ERR, EAL, "invalid parameter for --"
1220                                 OPT_LCORES "\n");
1221                         return -1;
1222                 }
1223
1224                 if (core_parsed) {
1225                         RTE_LOG(ERR, EAL, "Option --lcore is ignored, because (%s) is set!\n",
1226                                 (core_parsed == LCORE_OPT_LST) ? "-l" :
1227                                 (core_parsed == LCORE_OPT_MSK) ? "-c" :
1228                                 "--lcore");
1229                         return -1;
1230                 }
1231
1232                 core_parsed = LCORE_OPT_MAP;
1233                 break;
1234         case OPT_LEGACY_MEM_NUM:
1235                 conf->legacy_mem = 1;
1236                 break;
1237         case OPT_SINGLE_FILE_SEGMENTS_NUM:
1238                 conf->single_file_segments = 1;
1239                 break;
1240
1241         /* don't know what to do, leave this to caller */
1242         default:
1243                 return 1;
1244
1245         }
1246
1247         return 0;
1248 bw_used:
1249         RTE_LOG(ERR, EAL, "Options blacklist (-b) and whitelist (-w) "
1250                 "cannot be used at the same time\n");
1251         return -1;
1252 }
1253
1254 static void
1255 eal_auto_detect_cores(struct rte_config *cfg)
1256 {
1257         unsigned int lcore_id;
1258         unsigned int removed = 0;
1259         rte_cpuset_t affinity_set;
1260         pthread_t tid = pthread_self();
1261
1262         if (pthread_getaffinity_np(tid, sizeof(rte_cpuset_t),
1263                                 &affinity_set) < 0)
1264                 CPU_ZERO(&affinity_set);
1265
1266         for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
1267                 if (cfg->lcore_role[lcore_id] == ROLE_RTE &&
1268                     !CPU_ISSET(lcore_id, &affinity_set)) {
1269                         cfg->lcore_role[lcore_id] = ROLE_OFF;
1270                         removed++;
1271                 }
1272         }
1273
1274         cfg->lcore_count -= removed;
1275 }
1276
1277 int
1278 eal_adjust_config(struct internal_config *internal_cfg)
1279 {
1280         int i;
1281         struct rte_config *cfg = rte_eal_get_configuration();
1282
1283         if (!core_parsed)
1284                 eal_auto_detect_cores(cfg);
1285
1286         if (internal_config.process_type == RTE_PROC_AUTO)
1287                 internal_config.process_type = eal_proc_type_detect();
1288
1289         /* default master lcore is the first one */
1290         if (!master_lcore_parsed) {
1291                 cfg->master_lcore = rte_get_next_lcore(-1, 0, 0);
1292                 lcore_config[cfg->master_lcore].core_role = ROLE_RTE;
1293         }
1294
1295         /* if no memory amounts were requested, this will result in 0 and
1296          * will be overridden later, right after eal_hugepage_info_init() */
1297         for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
1298                 internal_cfg->memory += internal_cfg->socket_mem[i];
1299
1300         return 0;
1301 }
1302
1303 int
1304 eal_check_common_options(struct internal_config *internal_cfg)
1305 {
1306         struct rte_config *cfg = rte_eal_get_configuration();
1307
1308         if (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) {
1309                 RTE_LOG(ERR, EAL, "Master lcore is not enabled for DPDK\n");
1310                 return -1;
1311         }
1312
1313         if (internal_cfg->process_type == RTE_PROC_INVALID) {
1314                 RTE_LOG(ERR, EAL, "Invalid process type specified\n");
1315                 return -1;
1316         }
1317         if (index(internal_cfg->hugefile_prefix, '%') != NULL) {
1318                 RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" "
1319                         "option\n");
1320                 return -1;
1321         }
1322         if (mem_parsed && internal_cfg->force_sockets == 1) {
1323                 RTE_LOG(ERR, EAL, "Options -m and --"OPT_SOCKET_MEM" cannot "
1324                         "be specified at the same time\n");
1325                 return -1;
1326         }
1327         if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) {
1328                 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot "
1329                         "be specified together with --"OPT_NO_HUGE"\n");
1330                 return -1;
1331         }
1332         if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink &&
1333                         !internal_cfg->in_memory) {
1334                 RTE_LOG(ERR, EAL, "Option --"OPT_HUGE_UNLINK" cannot "
1335                         "be specified together with --"OPT_NO_HUGE"\n");
1336                 return -1;
1337         }
1338         if (internal_config.force_socket_limits && internal_config.legacy_mem) {
1339                 RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_LIMIT
1340                         " is only supported in non-legacy memory mode\n");
1341         }
1342         if (internal_cfg->single_file_segments &&
1343                         internal_cfg->hugepage_unlink) {
1344                 RTE_LOG(ERR, EAL, "Option --"OPT_SINGLE_FILE_SEGMENTS" is "
1345                         "not compatible with neither --"OPT_IN_MEMORY" nor "
1346                         "--"OPT_HUGE_UNLINK"\n");
1347                 return -1;
1348         }
1349
1350         return 0;
1351 }
1352
1353 void
1354 eal_common_usage(void)
1355 {
1356         printf("[options]\n\n"
1357                "EAL common options:\n"
1358                "  -c COREMASK         Hexadecimal bitmask of cores to run on\n"
1359                "  -l CORELIST         List of cores to run on\n"
1360                "                      The argument format is <c1>[-c2][,c3[-c4],...]\n"
1361                "                      where c1, c2, etc are core indexes between 0 and %d\n"
1362                "  --"OPT_LCORES" COREMAP    Map lcore set to physical cpu set\n"
1363                "                      The argument format is\n"
1364                "                            '<lcores[@cpus]>[<,lcores[@cpus]>...]'\n"
1365                "                      lcores and cpus list are grouped by '(' and ')'\n"
1366                "                      Within the group, '-' is used for range separator,\n"
1367                "                      ',' is used for single number separator.\n"
1368                "                      '( )' can be omitted for single element group,\n"
1369                "                      '@' can be omitted if cpus and lcores have the same value\n"
1370                "  -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n"
1371                "  --"OPT_MASTER_LCORE" ID   Core ID that is used as master\n"
1372                "  --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n"
1373                "  -n CHANNELS         Number of memory channels\n"
1374                "  -m MB               Memory to allocate (see also --"OPT_SOCKET_MEM")\n"
1375                "  -r RANKS            Force number of memory ranks (don't detect)\n"
1376                "  -b, --"OPT_PCI_BLACKLIST" Add a PCI device in black list.\n"
1377                "                      Prevent EAL from using this PCI device. The argument\n"
1378                "                      format is <domain:bus:devid.func>.\n"
1379                "  -w, --"OPT_PCI_WHITELIST" Add a PCI device in white list.\n"
1380                "                      Only use the specified PCI devices. The argument format\n"
1381                "                      is <[domain:]bus:devid.func>. This option can be present\n"
1382                "                      several times (once per device).\n"
1383                "                      [NOTE: PCI whitelist cannot be used with -b option]\n"
1384                "  --"OPT_VDEV"              Add a virtual device.\n"
1385                "                      The argument format is <driver><id>[,key=val,...]\n"
1386                "                      (ex: --vdev=net_pcap0,iface=eth2).\n"
1387                "  -d LIB.so|DIR       Add a driver or driver directory\n"
1388                "                      (can be used multiple times)\n"
1389                "  --"OPT_VMWARE_TSC_MAP"    Use VMware TSC map instead of native RDTSC\n"
1390                "  --"OPT_PROC_TYPE"         Type of this process (primary|secondary|auto)\n"
1391                "  --"OPT_SYSLOG"            Set syslog facility\n"
1392                "  --"OPT_LOG_LEVEL"=<int>   Set global log level\n"
1393                "  --"OPT_LOG_LEVEL"=<type-match>:<int>\n"
1394                "                      Set specific log level\n"
1395                "  -v                  Display version information on startup\n"
1396                "  -h, --help          This help\n"
1397                "  --"OPT_IN_MEMORY"   Operate entirely in memory. This will\n"
1398                "                      disable secondary process support\n"
1399                "\nEAL options for DEBUG use only:\n"
1400                "  --"OPT_HUGE_UNLINK"       Unlink hugepage files after init\n"
1401                "  --"OPT_NO_HUGE"           Use malloc instead of hugetlbfs\n"
1402                "  --"OPT_NO_PCI"            Disable PCI\n"
1403                "  --"OPT_NO_HPET"           Disable HPET\n"
1404                "  --"OPT_NO_SHCONF"         No shared config (mmap'd files)\n"
1405                "\n", RTE_MAX_LCORE);
1406 }