help option
cover help option
This is a small reorganization of options.
The main goal is to provide a nice --help option.
Thomas Monjalon (2):
eal: sort and align options lists
eal: add help option
lib/librte_eal/bsdapp/eal/eal.c | 7 +- lib/librte_eal/common/eal_common_options.c | 115 +++++++++++++++-------------- lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/linuxapp/eal/eal.c | 27 ++++--- 4 files changed, 82 insertions(+), 69 deletions(-)
Signature · 1 line
2.2.2
A message that is not in the archive (sent off-list or not yet received): 1422554832-30093-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
PATCH 1/2 eal: sort and align options lists
Options listing in usage help was a mess.
The main usage line is fixed and shorter.
The options in usage output are logically sorted (cpu/mem/dev/proc), aligned and lightly reworded.
The options in declarations are alphabetically sorted. Code in swith statement is not moved.
--- lib/librte_eal/common/eal_common_options.c | 112 ++++++++++++++--------------- lib/librte_eal/linuxapp/eal/eal.c | 19 +++-- 2 files changed, 64 insertions(+), 67 deletions(-)
lib/librte_eal/common/eal_common_options.c +56 -56
@@ -55,37 +55,38 @@const char eal_short_options[] ="b:" /* pci-blacklist */ -"w:" /* pci-whitelist */ "c:" /* coremask */ -"d:" +"d:" /* driver */ "l:" /* corelist */ -"m:" -"n:" -"r:" -"v" ; +"m:" /* memory size */ +"n:" /* memory channels */ +"r:" /* memory ranks */ +"v" /* version */ +"w:" /* pci-whitelist */ + ;const struct option eal_long_options[] = { - {OPT_HUGE_DIR ,1 ,0 ,OPT_HUGE_DIR_NUM }, - {OPT_MASTER_LCORE ,1 ,0 ,OPT_MASTER_LCORE_NUM }, - {OPT_PROC_TYPE ,1 ,0 ,OPT_PROC_TYPE_NUM }, - {OPT_NO_SHCONF ,0 ,0 ,OPT_NO_SHCONF_NUM }, - {OPT_NO_HPET ,0 ,0 ,OPT_NO_HPET_NUM }, - {OPT_VMWARE_TSC_MAP ,0 ,0 ,OPT_VMWARE_TSC_MAP_NUM }, - {OPT_NO_PCI ,0 ,0 ,OPT_NO_PCI_NUM }, - {OPT_NO_HUGE ,0 ,0 ,OPT_NO_HUGE_NUM }, - {OPT_FILE_PREFIX ,1 ,0 ,OPT_FILE_PREFIX_NUM }, - {OPT_SOCKET_MEM ,1 ,0 ,OPT_SOCKET_MEM_NUM }, - {OPT_PCI_WHITELIST ,1 ,0 ,OPT_PCI_WHITELIST_NUM }, - {OPT_PCI_BLACKLIST ,1 ,0 ,OPT_PCI_BLACKLIST_NUM }, - {OPT_VDEV ,1 ,0 ,OPT_VDEV_NUM }, - {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, - {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, - {OPT_BASE_VIRTADDR ,1 ,0 ,OPT_BASE_VIRTADDR_NUM }, - {OPT_XEN_DOM0 ,0 ,0 ,OPT_XEN_DOM0_NUM }, - {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, - {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, - {0 ,0 ,0 ,0 } + {OPT_BASE_VIRTADDR ,1 ,NULL ,OPT_BASE_VIRTADDR_NUM }, + {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, + {OPT_FILE_PREFIX ,1 ,NULL ,OPT_FILE_PREFIX_NUM }, + {OPT_HUGE_DIR ,1 ,NULL ,OPT_HUGE_DIR_NUM }, + {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, + {OPT_MASTER_LCORE ,1 ,NULL ,OPT_MASTER_LCORE_NUM }, + {OPT_NO_HPET ,0 ,NULL ,OPT_NO_HPET_NUM }, + {OPT_NO_HUGE ,0 ,NULL ,OPT_NO_HUGE_NUM }, + {OPT_NO_PCI ,0 ,NULL ,OPT_NO_PCI_NUM }, + {OPT_NO_SHCONF ,0 ,NULL ,OPT_NO_SHCONF_NUM }, + {OPT_PCI_BLACKLIST ,1 ,NULL ,OPT_PCI_BLACKLIST_NUM }, + {OPT_PCI_WHITELIST ,1 ,NULL ,OPT_PCI_WHITELIST_NUM }, + {OPT_PROC_TYPE ,1 ,NULL ,OPT_PROC_TYPE_NUM }, + {OPT_SOCKET_MEM ,1 ,NULL ,OPT_SOCKET_MEM_NUM }, + {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, + {OPT_VDEV ,1 ,NULL ,OPT_VDEV_NUM }, + {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, + {OPT_VMWARE_TSC_MAP ,0 ,NULL ,OPT_VMWARE_TSC_MAP_NUM }, + {OPT_XEN_DOM0 ,0 ,NULL ,OPT_XEN_DOM0_NUM }, + {0 ,0 ,NULL ,0 } };static int lcores_parsed;
@@ -578,37 +579,36 @@ eal_check_common_options(struct internal_config *internal_cfg)void eal_common_usage (void ) { -printf ("-c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]" -"[--proc-type primary|secondary|auto]\n\n" +printf ("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" "EAL common options:\n" -" -c COREMASK : A hexadecimal bitmask of cores to run on\n" -" -l CORELIST : List of cores to run on\n" -" The argument format is <c1>[-c2][,c3[-c4],...]\n" -" where c1, c2, etc are core indexes between 0 and %d\n" -" --" OPT_MASTER_LCORE " ID: Core ID that is used as master\n" -" -n NUM : Number of memory channels\n" -" -v : Display version information on startup\n" -" -m MB : memory to allocate (see also --" OPT_SOCKET_MEM ")\n" -" -r NUM : force number of memory ranks (don't detect)\n" -" --" OPT_SYSLOG " : set syslog facility\n" -" --" OPT_LOG_LEVEL " : set default log level\n" -" --" OPT_PROC_TYPE " : type of this process\n" -" --" OPT_PCI_BLACKLIST ", -b: add a PCI device in black list.\n" -" Prevent EAL from using this PCI device. The argument\n" -" format is <domain:bus:devid.func>.\n" -" --" OPT_PCI_WHITELIST ", -w: add a PCI device in white list.\n" -" Only use the specified PCI devices. The argument format\n" -" is <[domain:]bus:devid.func>. This option can be present\n" -" several times (once per device).\n" -" [NOTE: PCI whitelist cannot be used with -b option]\n" -" --" OPT_VDEV ": add a virtual device.\n" -" The argument format is <driver><id>[,key=val,...]\n" -" (ex: --vdev=eth_pcap0,iface=eth2).\n" -" --" OPT_VMWARE_TSC_MAP ": use VMware TSC map instead of native RDTSC\n" +" -c COREMASK Hexadecimal bitmask of cores to run on\n" +" -l CORELIST List of cores to run on\n" +" The argument format is <c1>[-c2][,c3[-c4],...]\n" +" where c1, c2, etc are core indexes between 0 and %d\n" +" --" OPT_MASTER_LCORE " ID Core ID that is used as master\n" +" -n NUM Number of memory channels\n" +" -m MB Memory to allocate (see also --" OPT_SOCKET_MEM ")\n" +" -r NUM Force number of memory ranks (don't detect)\n" +" -b, --" OPT_PCI_BLACKLIST " Add a PCI device in black list.\n" +" Prevent EAL from using this PCI device. The argument\n" +" format is <domain:bus:devid.func>.\n" +" -w, --" OPT_PCI_WHITELIST " Add a PCI device in white list.\n" +" Only use the specified PCI devices. The argument format\n" +" is <[domain:]bus:devid.func>. This option can be present\n" +" several times (once per device).\n" +" [NOTE: PCI whitelist cannot be used with -b option]\n" +" --" OPT_VDEV " Add a virtual device.\n" +" The argument format is <driver><id>[,key=val,...]\n" +" (ex: --vdev=eth_pcap0,iface=eth2).\n" +" --" OPT_VMWARE_TSC_MAP " Use VMware TSC map instead of native RDTSC\n" +" --" OPT_PROC_TYPE " Type of this process (primary|secondary|auto)\n" +" --" OPT_SYSLOG " Set syslog facility\n" +" --" OPT_LOG_LEVEL " Set default log level\n" +" -v Display version information on startup\n" "\nEAL options for DEBUG use only:\n" -" --" OPT_NO_HUGE " : use malloc instead of hugetlbfs\n" -" --" OPT_NO_PCI " : disable pci\n" -" --" OPT_NO_HPET " : disable hpet\n" -" --" OPT_NO_SHCONF ": no shared config (mmap'd files)\n" +" --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" +" --" OPT_NO_PCI " Disable PCI\n" +" --" OPT_NO_HPET " Disable HPET\n" +" --" OPT_NO_SHCONF " No shared config (mmap'd files)\n" "\n" ,RTE_MAX_LCORE ); }
lib/librte_eal/linuxapp/eal/eal.c +8 -11
@@ -352,17 +352,14 @@ eal_usage(const char *prgname)printf ("\nUsage: %s " , prgname);eal_common_usage ();printf ("EAL Linux options:\n" -" -d LIB.so : add driver (can be used multiple times)\n" -" --" OPT_XEN_DOM0 " : support application running on Xen Domain0 " -"without hugetlbfs\n" -" --" OPT_SOCKET_MEM " : memory to allocate on specific\n" -" sockets (use comma separated values)\n" -" --" OPT_HUGE_DIR " : directory where hugetlbfs is mounted\n" -" --" OPT_FILE_PREFIX ": prefix for hugepage filenames\n" -" --" OPT_BASE_VIRTADDR ": specify base virtual address\n" -" --" OPT_VFIO_INTR ": specify desired interrupt mode for VFIO " -"(legacy|msi|msix)\n" -" --" OPT_CREATE_UIO_DEV ": create /dev/uioX (usually done by hotplug)\n" +" -d LIB.so Add driver (can be used multiple times)\n" +" --" OPT_SOCKET_MEM " Memory to allocate on sockets (comma separated values)\n" +" --" OPT_HUGE_DIR " Directory where hugetlbfs is mounted\n" +" --" OPT_FILE_PREFIX " Prefix for hugepage filenames\n" +" --" OPT_BASE_VIRTADDR " Base virtual address\n" +" --" OPT_CREATE_UIO_DEV " Create /dev/uioX (usually done by hotplug)\n" +" --" OPT_VFIO_INTR " Interrupt mode for VFIO (legacy|msi|msix)\n" +" --" OPT_XEN_DOM0 " Support running on Xen dom0 without hugetlbfs\n" "\n" );/* Allow the application to print its usage message too if hook is set */ if ( rte_application_usage_hook ) {
Signature · 1 line
2.2.2
PATCH 2/2 eal: add help option
In reply to a message not in the archiveHelp is printed with -h or --help.
Help is also printed for an unknown option.
This was broken since the rework of options.
--- lib/librte_eal/bsdapp/eal/eal.c | 7 ++++++- lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linuxapp/eal/eal.c | 8 +++++++- 4 files changed, 18 insertions(+), 2 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +6 -1
@@ -326,8 +326,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is not supported "
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -57,6 +57,7 @@ eal_short_options[] ="b:" /* pci-blacklist */ "c:" /* coremask */ "d:" /* driver */ +"h" /* help */ "l:" /* corelist */ "m:" /* memory size */ "n:" /* memory channels */
@@ -70,6 +71,7 @@ eal_long_options[] = { {OPT_BASE_VIRTADDR, 1, NULL, OPT_BASE_VIRTADDR_NUM }, {OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM }, {OPT_FILE_PREFIX, 1, NULL, OPT_FILE_PREFIX_NUM }, + {OPT_HELP, 0, NULL, OPT_HELP_NUM }, {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@@ -605,6 +607,7 @@ eal_common_usage(void)" --" OPT_SYSLOG " Set syslog facility\n" " --" OPT_LOG_LEVEL " Set default log level\n" " -v Display version information on startup\n" +" -h, --help This help\n" "\nEAL options for DEBUG use only:\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" " --" OPT_NO_PCI " Disable PCI\n"
lib/librte_eal/common/eal_options.h +2 -0
@@ -35,6 +35,8 @@enum {/* long options mapped to a short option */ +#define OPT_HELP "help" + OPT_HELP_NUM = 'h',#define OPT_PCI_WHITELIST "pci-whitelist" OPT_PCI_WHITELIST_NUM = 'w',#define OPT_PCI_BLACKLIST "pci-blacklist"
lib/librte_eal/linuxapp/eal/eal.c +7 -1
@@ -520,8 +520,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));
Signature · 1 line
2.2.2
v2 cover help option
In reply to a message not in the archiveThis is a small reorganization of options.
The main goal is to provide a nice --help option.
changes in v2:
- sort also the options enum
Thomas Monjalon (2):
eal: sort and align options lists
eal: add help option
lib/librte_eal/bsdapp/eal/eal.c | 7 +- lib/librte_eal/common/eal_common_options.c | 115 +++++++++++++++-------------- lib/librte_eal/common/eal_options.h | 64 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 27 ++++--- 4 files changed, 113 insertions(+), 100 deletions(-)
Signature · 1 line
2.2.2
A message that is not in the archive (sent off-list or not yet received): 1422899093-20207-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
PATCH v2 1/2 eal: sort and align options lists
Options listing in usage help was a mess.
The main usage line is fixed and shorter.
The options in usage output are logically sorted (cpu/mem/dev/proc), aligned and lightly reworded.
The options in declarations are alphabetically sorted. Code in swith statement is not moved.
---
changes in v2:
- sort and align options enum in .h
--- lib/librte_eal/common/eal_common_options.c | 112 ++++++++++++++--------------- lib/librte_eal/common/eal_options.h | 62 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 19 +++-- 3 files changed, 95 insertions(+), 98 deletions(-)
lib/librte_eal/common/eal_common_options.c +56 -56
@@ -55,37 +55,38 @@const char eal_short_options[] ="b:" /* pci-blacklist */ -"w:" /* pci-whitelist */ "c:" /* coremask */ -"d:" +"d:" /* driver */ "l:" /* corelist */ -"m:" -"n:" -"r:" -"v" ; +"m:" /* memory size */ +"n:" /* memory channels */ +"r:" /* memory ranks */ +"v" /* version */ +"w:" /* pci-whitelist */ + ;const struct option eal_long_options[] = { - {OPT_HUGE_DIR ,1 ,0 ,OPT_HUGE_DIR_NUM }, - {OPT_MASTER_LCORE ,1 ,0 ,OPT_MASTER_LCORE_NUM }, - {OPT_PROC_TYPE ,1 ,0 ,OPT_PROC_TYPE_NUM }, - {OPT_NO_SHCONF ,0 ,0 ,OPT_NO_SHCONF_NUM }, - {OPT_NO_HPET ,0 ,0 ,OPT_NO_HPET_NUM }, - {OPT_VMWARE_TSC_MAP ,0 ,0 ,OPT_VMWARE_TSC_MAP_NUM }, - {OPT_NO_PCI ,0 ,0 ,OPT_NO_PCI_NUM }, - {OPT_NO_HUGE ,0 ,0 ,OPT_NO_HUGE_NUM }, - {OPT_FILE_PREFIX ,1 ,0 ,OPT_FILE_PREFIX_NUM }, - {OPT_SOCKET_MEM ,1 ,0 ,OPT_SOCKET_MEM_NUM }, - {OPT_PCI_WHITELIST ,1 ,0 ,OPT_PCI_WHITELIST_NUM }, - {OPT_PCI_BLACKLIST ,1 ,0 ,OPT_PCI_BLACKLIST_NUM }, - {OPT_VDEV ,1 ,0 ,OPT_VDEV_NUM }, - {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, - {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, - {OPT_BASE_VIRTADDR ,1 ,0 ,OPT_BASE_VIRTADDR_NUM }, - {OPT_XEN_DOM0 ,0 ,0 ,OPT_XEN_DOM0_NUM }, - {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, - {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, - {0 ,0 ,0 ,0 } + {OPT_BASE_VIRTADDR ,1 ,NULL ,OPT_BASE_VIRTADDR_NUM }, + {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, + {OPT_FILE_PREFIX ,1 ,NULL ,OPT_FILE_PREFIX_NUM }, + {OPT_HUGE_DIR ,1 ,NULL ,OPT_HUGE_DIR_NUM }, + {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, + {OPT_MASTER_LCORE ,1 ,NULL ,OPT_MASTER_LCORE_NUM }, + {OPT_NO_HPET ,0 ,NULL ,OPT_NO_HPET_NUM }, + {OPT_NO_HUGE ,0 ,NULL ,OPT_NO_HUGE_NUM }, + {OPT_NO_PCI ,0 ,NULL ,OPT_NO_PCI_NUM }, + {OPT_NO_SHCONF ,0 ,NULL ,OPT_NO_SHCONF_NUM }, + {OPT_PCI_BLACKLIST ,1 ,NULL ,OPT_PCI_BLACKLIST_NUM }, + {OPT_PCI_WHITELIST ,1 ,NULL ,OPT_PCI_WHITELIST_NUM }, + {OPT_PROC_TYPE ,1 ,NULL ,OPT_PROC_TYPE_NUM }, + {OPT_SOCKET_MEM ,1 ,NULL ,OPT_SOCKET_MEM_NUM }, + {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, + {OPT_VDEV ,1 ,NULL ,OPT_VDEV_NUM }, + {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, + {OPT_VMWARE_TSC_MAP ,0 ,NULL ,OPT_VMWARE_TSC_MAP_NUM }, + {OPT_XEN_DOM0 ,0 ,NULL ,OPT_XEN_DOM0_NUM }, + {0 ,0 ,NULL ,0 } };static int lcores_parsed;
@@ -578,37 +579,36 @@ eal_check_common_options(struct internal_config *internal_cfg)void eal_common_usage (void ) { -printf ("-c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]" -"[--proc-type primary|secondary|auto]\n\n" +printf ("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" "EAL common options:\n" -" -c COREMASK : A hexadecimal bitmask of cores to run on\n" -" -l CORELIST : List of cores to run on\n" -" The argument format is <c1>[-c2][,c3[-c4],...]\n" -" where c1, c2, etc are core indexes between 0 and %d\n" -" --" OPT_MASTER_LCORE " ID: Core ID that is used as master\n" -" -n NUM : Number of memory channels\n" -" -v : Display version information on startup\n" -" -m MB : memory to allocate (see also --" OPT_SOCKET_MEM ")\n" -" -r NUM : force number of memory ranks (don't detect)\n" -" --" OPT_SYSLOG " : set syslog facility\n" -" --" OPT_LOG_LEVEL " : set default log level\n" -" --" OPT_PROC_TYPE " : type of this process\n" -" --" OPT_PCI_BLACKLIST ", -b: add a PCI device in black list.\n" -" Prevent EAL from using this PCI device. The argument\n" -" format is <domain:bus:devid.func>.\n" -" --" OPT_PCI_WHITELIST ", -w: add a PCI device in white list.\n" -" Only use the specified PCI devices. The argument format\n" -" is <[domain:]bus:devid.func>. This option can be present\n" -" several times (once per device).\n" -" [NOTE: PCI whitelist cannot be used with -b option]\n" -" --" OPT_VDEV ": add a virtual device.\n" -" The argument format is <driver><id>[,key=val,...]\n" -" (ex: --vdev=eth_pcap0,iface=eth2).\n" -" --" OPT_VMWARE_TSC_MAP ": use VMware TSC map instead of native RDTSC\n" +" -c COREMASK Hexadecimal bitmask of cores to run on\n" +" -l CORELIST List of cores to run on\n" +" The argument format is <c1>[-c2][,c3[-c4],...]\n" +" where c1, c2, etc are core indexes between 0 and %d\n" +" --" OPT_MASTER_LCORE " ID Core ID that is used as master\n" +" -n NUM Number of memory channels\n" +" -m MB Memory to allocate (see also --" OPT_SOCKET_MEM ")\n" +" -r NUM Force number of memory ranks (don't detect)\n" +" -b, --" OPT_PCI_BLACKLIST " Add a PCI device in black list.\n" +" Prevent EAL from using this PCI device. The argument\n" +" format is <domain:bus:devid.func>.\n" +" -w, --" OPT_PCI_WHITELIST " Add a PCI device in white list.\n" +" Only use the specified PCI devices. The argument format\n" +" is <[domain:]bus:devid.func>. This option can be present\n" +" several times (once per device).\n" +" [NOTE: PCI whitelist cannot be used with -b option]\n" +" --" OPT_VDEV " Add a virtual device.\n" +" The argument format is <driver><id>[,key=val,...]\n" +" (ex: --vdev=eth_pcap0,iface=eth2).\n" +" --" OPT_VMWARE_TSC_MAP " Use VMware TSC map instead of native RDTSC\n" +" --" OPT_PROC_TYPE " Type of this process (primary|secondary|auto)\n" +" --" OPT_SYSLOG " Set syslog facility\n" +" --" OPT_LOG_LEVEL " Set default log level\n" +" -v Display version information on startup\n" "\nEAL options for DEBUG use only:\n" -" --" OPT_NO_HUGE " : use malloc instead of hugetlbfs\n" -" --" OPT_NO_PCI " : disable pci\n" -" --" OPT_NO_HPET " : disable hpet\n" -" --" OPT_NO_SHCONF ": no shared config (mmap'd files)\n" +" --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" +" --" OPT_NO_PCI " Disable PCI\n" +" --" OPT_NO_HPET " Disable HPET\n" +" --" OPT_NO_SHCONF " No shared config (mmap'd files)\n" "\n" ,RTE_MAX_LCORE ); }
lib/librte_eal/common/eal_options.h +31 -31
79 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal.c +8 -11
@@ -352,17 +352,14 @@ eal_usage(const char *prgname)printf ("\nUsage: %s " , prgname);eal_common_usage ();printf ("EAL Linux options:\n" -" -d LIB.so : add driver (can be used multiple times)\n" -" --" OPT_XEN_DOM0 " : support application running on Xen Domain0 " -"without hugetlbfs\n" -" --" OPT_SOCKET_MEM " : memory to allocate on specific\n" -" sockets (use comma separated values)\n" -" --" OPT_HUGE_DIR " : directory where hugetlbfs is mounted\n" -" --" OPT_FILE_PREFIX ": prefix for hugepage filenames\n" -" --" OPT_BASE_VIRTADDR ": specify base virtual address\n" -" --" OPT_VFIO_INTR ": specify desired interrupt mode for VFIO " -"(legacy|msi|msix)\n" -" --" OPT_CREATE_UIO_DEV ": create /dev/uioX (usually done by hotplug)\n" +" -d LIB.so Add driver (can be used multiple times)\n" +" --" OPT_SOCKET_MEM " Memory to allocate on sockets (comma separated values)\n" +" --" OPT_HUGE_DIR " Directory where hugetlbfs is mounted\n" +" --" OPT_FILE_PREFIX " Prefix for hugepage filenames\n" +" --" OPT_BASE_VIRTADDR " Base virtual address\n" +" --" OPT_CREATE_UIO_DEV " Create /dev/uioX (usually done by hotplug)\n" +" --" OPT_VFIO_INTR " Interrupt mode for VFIO (legacy|msi|msix)\n" +" --" OPT_XEN_DOM0 " Support running on Xen dom0 without hugetlbfs\n" "\n" );/* Allow the application to print its usage message too if hook is set */ if ( rte_application_usage_hook ) {
Signature · 1 line
2.2.2
A message that is not in the archive (sent off-list or not yet received): 1422899093-20207-2-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
David Marchand
Acked-byRe: [PATCH v2 1/2] eal: sort and align options lists
Two little comments.
Quoted 16 lines · Thomas Monjalon
lib/librte_eal/common/eal_common_options.c +0
-1@@ -578,37 +579,36 @@ eal_check_common_options(struct internal_config *internal_cfg)void eal_common_usage (void ) { - printf("-c COREMASK -n NUM [-m NB] [-r NUM] [-b<domain:bus:devid.func>]"
lib/librte_eal/common/eal_common_options.c +1
-2-"[--proc-type primary|secondary|auto]\n\n" +printf ("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" "EAL common options:\n" - " -c COREMASK : A hexadecimal bitmask of cores to runon\n"
(quoted diff) +0
-2- " -l CORELIST : List of cores to run on\n" - " The argument format is<c1>[-c2][,c3[-c4],...]\n"
[snip]
Quoted 3 lines
+ " -n NUM Number of memory channels\n"
Not really a problem, but for consistency : here, you are talking about NUM, while at first, you wrote -n CHANNELS.
[snip]
lib/librte_eal/common/eal_options.h line 47
Quoted 9 lines
/* first long only option value must be >= 256, so that we won't * conflict with short options */ OPT_LONG_MIN_NUM = 256,lib/librte_eal/common/eal_options.h +2
-3-#define OPT_HUGE_DIR "huge-dir" -OPT_HUGE_DIR_NUM =OPT_LONG_MIN_NUM , -#define OPT_MASTER_LCORE "master-lcore" +#define OPT_BASE_VIRTADDR "base-virtaddr" + OPT_BASE_VIRTADDR_NUM,
Why skip the first entry ?
Afaik, OPT_BASE_VIRTADDR_NUM will be set to 257, is it to avoid having this = OPT_LONG_MIN_NUM moved anytime we add a new long option at the top of the enum ?
The rest looks good to me.
Signature · 1 line
David Marchand
A message that is not in the archive (sent off-list or not yet received): CALwxeUsqHWxP7y3kOfBUHTjXim_TSFwHOkeip9DV+MiEoSUY0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 1/2] eal: sort and align options lists
2015-02-03 07:26, David Marchand:
Quoted 17 lines
Two little comments.
Quoted 12 lines · Thomas Monjalon
lib/librte_eal/common/eal_common_options.c +1
-5@@ -578,37 +579,36 @@ eal_check_common_options(struct internal_config *internal_cfg)void eal_common_usage (void ) { -printf ("-c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]" -"[--proc-type primary|secondary|auto]\n\n" +printf ("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" "EAL common options:\n" -" -c COREMASK : A hexadecimal bitmask of cores to run on\n" -" -l CORELIST : List of cores to run on\n" - " The argument format is <c1>[-c2][,c3[-c4],...]\n"[snip]
Quoted 4 lines
Quoted 1 line
+ " -n NUM Number of memory channels\n"
Not really a problem, but for consistency : here, you are talking about NUM, while at first, you wrote -n CHANNELS.
Yes you're right. I changed headline but not the description of this option. Will do.
Quoted 14 lines
[snip]
lib/librte_eal/common/eal_options.h line 47
Quoted 8 lines
/* first long only option value must be >= 256, so that we won't * conflict with short options */ OPT_LONG_MIN_NUM = 256,lib/librte_eal/common/eal_options.h +2
-3-#define OPT_HUGE_DIR "huge-dir" -OPT_HUGE_DIR_NUM =OPT_LONG_MIN_NUM , -#define OPT_MASTER_LCORE "master-lcore" +#define OPT_BASE_VIRTADDR "base-virtaddr" + OPT_BASE_VIRTADDR_NUM,Why skip the first entry ?
Afaik,OPT_BASE_VIRTADDR_NUMwill be set to 257, is it to avoid having this =OPT_LONG_MIN_NUMmoved anytime we add a new long option at the top of the enum ?
Exactly, yes. I think we don't care what is the first number. It doesn't deserve a painful assignment.
Quoted 2 lines
The rest looks good to me.
Acked-by David Marchand <[email protected]>
Thanks
Signature · 1 line
Thomas
PATCH v2 2/2 eal: add help option
In reply to a message not in the archiveHelp is printed with -h or --help.
Help is also printed for an unknown option.
This was broken since the rework of options.
--- lib/librte_eal/bsdapp/eal/eal.c | 7 ++++++- lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linuxapp/eal/eal.c | 8 +++++++- 4 files changed, 18 insertions(+), 2 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +6 -1
@@ -326,8 +326,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is not supported "
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -57,6 +57,7 @@ eal_short_options[] ="b:" /* pci-blacklist */ "c:" /* coremask */ "d:" /* driver */ +"h" /* help */ "l:" /* corelist */ "m:" /* memory size */ "n:" /* memory channels */
@@ -70,6 +71,7 @@ eal_long_options[] = { {OPT_BASE_VIRTADDR, 1, NULL, OPT_BASE_VIRTADDR_NUM }, {OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM }, {OPT_FILE_PREFIX, 1, NULL, OPT_FILE_PREFIX_NUM }, + {OPT_HELP, 0, NULL, OPT_HELP_NUM }, {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@@ -605,6 +607,7 @@ eal_common_usage(void)" --" OPT_SYSLOG " Set syslog facility\n" " --" OPT_LOG_LEVEL " Set default log level\n" " -v Display version information on startup\n" +" -h, --help This help\n" "\nEAL options for DEBUG use only:\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" " --" OPT_NO_PCI " Disable PCI\n"
lib/librte_eal/common/eal_options.h +2 -0
@@ -35,6 +35,8 @@enum {/* long options mapped to a short option */ +#define OPT_HELP "help" + OPT_HELP_NUM = 'h',#define OPT_PCI_BLACKLIST "pci-blacklist" OPT_PCI_BLACKLIST_NUM = 'b',#define OPT_PCI_WHITELIST "pci-whitelist"
lib/librte_eal/linuxapp/eal/eal.c +7 -1
@@ -520,8 +520,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));
Signature · 1 line
2.2.2
A message that is not in the archive (sent off-list or not yet received): 1422899093-20207-3-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
Re: [PATCH v2 2/2] eal: add help option
On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <[email protected]> wrote:
[snip]
Quoted 12 lines
lib/librte_eal/bsdapp/eal/eal.c +3
-0@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is notsupported "
[snip]
lib/librte_eal/linuxapp/eal/eal.c eal_parse_args(int argc, char **argv) · line 545
Quoted 12 lines
lib/librte_eal/linuxapp/eal/eal.c +4
-0@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));
Why not move those two in common parser ?
Signature · 1 line
David Marchand
A message that is not in the archive (sent off-list or not yet received): CALwxeUsq+oq_LobThh=0nFQJfTMfmmof+dmJOPq=EL3gdh+0Cw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v2 2/2] eal: add help option
2015-02-03 07:33, David Marchand:
Quoted 17 lines
On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <[email protected]> wrote:
[snip]Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal.c +3
-0@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is not supported "[snip]
Quoted 3 lines
(quoted diff) +0
-0@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv) continue;
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal.c eal_parse_args(int argc, char **argv) · line 545
Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal.c +4
-0switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));Why not move those two in common parser ?
Because it's calling eal_usage() which is not callable from common parser. eal_usage() print usage for common and environment-specific options.
Signature · 1 line
Thomas
David Marchand
Acked-byRe: [PATCH v2 2/2] eal: add help option
Quoted 31 lines · Thomas Monjalon
2015-02-03 07:33, David Marchand:
Quoted 1 line
On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <
Quoted 5 lines
wrote:
[snip]Quoted 3 lines
(quoted diff) +0
-0@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv) continue;Quoted 7 lines
lib/librte_eal/bsdapp/eal/eal.c eal_parse_args(int argc, char **argv)
Quoted 7 lines
lib/librte_eal/bsdapp/eal/eal.c +3
-0switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is notsupported "
Quoted 4 lines
[snip]
Quoted 3 lines
(quoted diff) +0
-0@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv) continue;Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal.c eal_parse_args(int argc, char **argv) · line 545
Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal.c +4
-0switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));Why not move those two in common parser ?
Quoted 3 lines
Because it's calling
eal_usage()which is not callable from common parser.eal_usage()print usage for common and environment-specific options.
Oh right ...
Then, I suppose it is fine like this.
Signature · 1 line
David Marchand
v3 cover help option
In reply to a message not in the archiveThis is a small reorganization of options.
The main goal is to provide a nice --help option.
changes in v3:
- reword arguments in usage
changes in v2:
- sort also the options enum
Thomas Monjalon (2):
eal: sort and align options lists
eal: add help option
lib/librte_eal/bsdapp/eal/eal.c | 7 +- lib/librte_eal/common/eal_common_options.c | 115 +++++++++++++++-------------- lib/librte_eal/common/eal_options.h | 64 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 27 ++++--- 4 files changed, 113 insertions(+), 100 deletions(-)
Signature · 1 line
2.2.2
A message that is not in the archive (sent off-list or not yet received): 1423759677-32152-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
PATCH v3 1/2 eal: sort and align options lists
Options listing in usage help was a mess.
The main usage line is fixed and shorter.
The options in usage output are logically sorted (cpu/mem/dev/proc), aligned and lightly reworded.
The options in declarations are alphabetically sorted. Code in swith statement is not moved.
---
changes in v3:
- reword arguments in usage
changes in v2:
- sort and align options enum in .h
--- lib/librte_eal/common/eal_common_options.c | 112 ++++++++++++++--------------- lib/librte_eal/common/eal_options.h | 62 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 19 +++-- 3 files changed, 95 insertions(+), 98 deletions(-)
lib/librte_eal/common/eal_common_options.c +56 -56
@@ -55,37 +55,38 @@const char eal_short_options[] ="b:" /* pci-blacklist */ -"w:" /* pci-whitelist */ "c:" /* coremask */ -"d:" +"d:" /* driver */ "l:" /* corelist */ -"m:" -"n:" -"r:" -"v" ; +"m:" /* memory size */ +"n:" /* memory channels */ +"r:" /* memory ranks */ +"v" /* version */ +"w:" /* pci-whitelist */ + ;const struct option eal_long_options[] = { - {OPT_HUGE_DIR ,1 ,0 ,OPT_HUGE_DIR_NUM }, - {OPT_MASTER_LCORE ,1 ,0 ,OPT_MASTER_LCORE_NUM }, - {OPT_PROC_TYPE ,1 ,0 ,OPT_PROC_TYPE_NUM }, - {OPT_NO_SHCONF ,0 ,0 ,OPT_NO_SHCONF_NUM }, - {OPT_NO_HPET ,0 ,0 ,OPT_NO_HPET_NUM }, - {OPT_VMWARE_TSC_MAP ,0 ,0 ,OPT_VMWARE_TSC_MAP_NUM }, - {OPT_NO_PCI ,0 ,0 ,OPT_NO_PCI_NUM }, - {OPT_NO_HUGE ,0 ,0 ,OPT_NO_HUGE_NUM }, - {OPT_FILE_PREFIX ,1 ,0 ,OPT_FILE_PREFIX_NUM }, - {OPT_SOCKET_MEM ,1 ,0 ,OPT_SOCKET_MEM_NUM }, - {OPT_PCI_WHITELIST ,1 ,0 ,OPT_PCI_WHITELIST_NUM }, - {OPT_PCI_BLACKLIST ,1 ,0 ,OPT_PCI_BLACKLIST_NUM }, - {OPT_VDEV ,1 ,0 ,OPT_VDEV_NUM }, - {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, - {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, - {OPT_BASE_VIRTADDR ,1 ,0 ,OPT_BASE_VIRTADDR_NUM }, - {OPT_XEN_DOM0 ,0 ,0 ,OPT_XEN_DOM0_NUM }, - {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, - {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, - {0 ,0 ,0 ,0 } + {OPT_BASE_VIRTADDR ,1 ,NULL ,OPT_BASE_VIRTADDR_NUM }, + {OPT_CREATE_UIO_DEV ,1 ,NULL ,OPT_CREATE_UIO_DEV_NUM }, + {OPT_FILE_PREFIX ,1 ,NULL ,OPT_FILE_PREFIX_NUM }, + {OPT_HUGE_DIR ,1 ,NULL ,OPT_HUGE_DIR_NUM }, + {OPT_LOG_LEVEL ,1 ,NULL ,OPT_LOG_LEVEL_NUM }, + {OPT_MASTER_LCORE ,1 ,NULL ,OPT_MASTER_LCORE_NUM }, + {OPT_NO_HPET ,0 ,NULL ,OPT_NO_HPET_NUM }, + {OPT_NO_HUGE ,0 ,NULL ,OPT_NO_HUGE_NUM }, + {OPT_NO_PCI ,0 ,NULL ,OPT_NO_PCI_NUM }, + {OPT_NO_SHCONF ,0 ,NULL ,OPT_NO_SHCONF_NUM }, + {OPT_PCI_BLACKLIST ,1 ,NULL ,OPT_PCI_BLACKLIST_NUM }, + {OPT_PCI_WHITELIST ,1 ,NULL ,OPT_PCI_WHITELIST_NUM }, + {OPT_PROC_TYPE ,1 ,NULL ,OPT_PROC_TYPE_NUM }, + {OPT_SOCKET_MEM ,1 ,NULL ,OPT_SOCKET_MEM_NUM }, + {OPT_SYSLOG ,1 ,NULL ,OPT_SYSLOG_NUM }, + {OPT_VDEV ,1 ,NULL ,OPT_VDEV_NUM }, + {OPT_VFIO_INTR ,1 ,NULL ,OPT_VFIO_INTR_NUM }, + {OPT_VMWARE_TSC_MAP ,0 ,NULL ,OPT_VMWARE_TSC_MAP_NUM }, + {OPT_XEN_DOM0 ,0 ,NULL ,OPT_XEN_DOM0_NUM }, + {0 ,0 ,NULL ,0 } };static int lcores_parsed;
@@ -578,37 +579,36 @@ eal_check_common_options(struct internal_config *internal_cfg)void eal_common_usage (void ) { -printf ("-c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]" -"[--proc-type primary|secondary|auto]\n\n" +printf ("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" "EAL common options:\n" -" -c COREMASK : A hexadecimal bitmask of cores to run on\n" -" -l CORELIST : List of cores to run on\n" -" The argument format is <c1>[-c2][,c3[-c4],...]\n" -" where c1, c2, etc are core indexes between 0 and %d\n" -" --" OPT_MASTER_LCORE " ID: Core ID that is used as master\n" -" -n NUM : Number of memory channels\n" -" -v : Display version information on startup\n" -" -m MB : memory to allocate (see also --" OPT_SOCKET_MEM ")\n" -" -r NUM : force number of memory ranks (don't detect)\n" -" --" OPT_SYSLOG " : set syslog facility\n" -" --" OPT_LOG_LEVEL " : set default log level\n" -" --" OPT_PROC_TYPE " : type of this process\n" -" --" OPT_PCI_BLACKLIST ", -b: add a PCI device in black list.\n" -" Prevent EAL from using this PCI device. The argument\n" -" format is <domain:bus:devid.func>.\n" -" --" OPT_PCI_WHITELIST ", -w: add a PCI device in white list.\n" -" Only use the specified PCI devices. The argument format\n" -" is <[domain:]bus:devid.func>. This option can be present\n" -" several times (once per device).\n" -" [NOTE: PCI whitelist cannot be used with -b option]\n" -" --" OPT_VDEV ": add a virtual device.\n" -" The argument format is <driver><id>[,key=val,...]\n" -" (ex: --vdev=eth_pcap0,iface=eth2).\n" -" --" OPT_VMWARE_TSC_MAP ": use VMware TSC map instead of native RDTSC\n" +" -c COREMASK Hexadecimal bitmask of cores to run on\n" +" -l CORELIST List of cores to run on\n" +" The argument format is <c1>[-c2][,c3[-c4],...]\n" +" where c1, c2, etc are core indexes between 0 and %d\n" +" --" OPT_MASTER_LCORE " ID Core ID that is used as master\n" +" -n CHANNELS Number of memory channels\n" +" -m MB Memory to allocate (see also --" OPT_SOCKET_MEM ")\n" +" -r RANKS Force number of memory ranks (don't detect)\n" +" -b, --" OPT_PCI_BLACKLIST " Add a PCI device in black list.\n" +" Prevent EAL from using this PCI device. The argument\n" +" format is <domain:bus:devid.func>.\n" +" -w, --" OPT_PCI_WHITELIST " Add a PCI device in white list.\n" +" Only use the specified PCI devices. The argument format\n" +" is <[domain:]bus:devid.func>. This option can be present\n" +" several times (once per device).\n" +" [NOTE: PCI whitelist cannot be used with -b option]\n" +" --" OPT_VDEV " Add a virtual device.\n" +" The argument format is <driver><id>[,key=val,...]\n" +" (ex: --vdev=eth_pcap0,iface=eth2).\n" +" --" OPT_VMWARE_TSC_MAP " Use VMware TSC map instead of native RDTSC\n" +" --" OPT_PROC_TYPE " Type of this process (primary|secondary|auto)\n" +" --" OPT_SYSLOG " Set syslog facility\n" +" --" OPT_LOG_LEVEL " Set default log level\n" +" -v Display version information on startup\n" "\nEAL options for DEBUG use only:\n" -" --" OPT_NO_HUGE " : use malloc instead of hugetlbfs\n" -" --" OPT_NO_PCI " : disable pci\n" -" --" OPT_NO_HPET " : disable hpet\n" -" --" OPT_NO_SHCONF ": no shared config (mmap'd files)\n" +" --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" +" --" OPT_NO_PCI " Disable PCI\n" +" --" OPT_NO_HPET " Disable HPET\n" +" --" OPT_NO_SHCONF " No shared config (mmap'd files)\n" "\n" ,RTE_MAX_LCORE ); }
lib/librte_eal/common/eal_options.h +31 -31
79 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal.c +8 -11
@@ -352,17 +352,14 @@ eal_usage(const char *prgname)printf ("\nUsage: %s " , prgname);eal_common_usage ();printf ("EAL Linux options:\n" -" -d LIB.so : add driver (can be used multiple times)\n" -" --" OPT_XEN_DOM0 " : support application running on Xen Domain0 " -"without hugetlbfs\n" -" --" OPT_SOCKET_MEM " : memory to allocate on specific\n" -" sockets (use comma separated values)\n" -" --" OPT_HUGE_DIR " : directory where hugetlbfs is mounted\n" -" --" OPT_FILE_PREFIX ": prefix for hugepage filenames\n" -" --" OPT_BASE_VIRTADDR ": specify base virtual address\n" -" --" OPT_VFIO_INTR ": specify desired interrupt mode for VFIO " -"(legacy|msi|msix)\n" -" --" OPT_CREATE_UIO_DEV ": create /dev/uioX (usually done by hotplug)\n" +" -d LIB.so Add driver (can be used multiple times)\n" +" --" OPT_SOCKET_MEM " Memory to allocate on sockets (comma separated values)\n" +" --" OPT_HUGE_DIR " Directory where hugetlbfs is mounted\n" +" --" OPT_FILE_PREFIX " Prefix for hugepage filenames\n" +" --" OPT_BASE_VIRTADDR " Base virtual address\n" +" --" OPT_CREATE_UIO_DEV " Create /dev/uioX (usually done by hotplug)\n" +" --" OPT_VFIO_INTR " Interrupt mode for VFIO (legacy|msi|msix)\n" +" --" OPT_XEN_DOM0 " Support running on Xen dom0 without hugetlbfs\n" "\n" );/* Allow the application to print its usage message too if hook is set */ if ( rte_application_usage_hook ) {
Signature · 1 line
2.2.2
PATCH v3 2/2 eal: add help option
In reply to a message not in the archiveHelp is printed with -h or --help.
Help is also printed for an unknown option.
This was broken since the rework of options.
--- lib/librte_eal/bsdapp/eal/eal.c | 7 ++++++- lib/librte_eal/common/eal_common_options.c | 3 +++ lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linuxapp/eal/eal.c | 8 +++++++- 4 files changed, 18 insertions(+), 2 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +6 -1
@@ -326,8 +326,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -340,6 +342,9 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS );default :if (opt <OPT_LONG_MIN_NUM &&isprint (opt)) { RTE_LOG(ERR, EAL, "Option %c is not supported "
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -57,6 +57,7 @@ eal_short_options[] ="b:" /* pci-blacklist */ "c:" /* coremask */ "d:" /* driver */ +"h" /* help */ "l:" /* corelist */ "m:" /* memory size */ "n:" /* memory channels */
@@ -70,6 +71,7 @@ eal_long_options[] = { {OPT_BASE_VIRTADDR, 1, NULL, OPT_BASE_VIRTADDR_NUM }, {OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM }, {OPT_FILE_PREFIX, 1, NULL, OPT_FILE_PREFIX_NUM }, + {OPT_HELP, 0, NULL, OPT_HELP_NUM }, {OPT_HUGE_DIR, 1, NULL, OPT_HUGE_DIR_NUM }, {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM },
@@ -605,6 +607,7 @@ eal_common_usage(void)" --" OPT_SYSLOG " Set syslog facility\n" " --" OPT_LOG_LEVEL " Set default log level\n" " -v Display version information on startup\n" +" -h, --help This help\n" "\nEAL options for DEBUG use only:\n" " --" OPT_NO_HUGE " Use malloc instead of hugetlbfs\n" " --" OPT_NO_PCI " Disable PCI\n"
lib/librte_eal/common/eal_options.h +2 -0
@@ -35,6 +35,8 @@enum {/* long options mapped to a short option */ +#define OPT_HELP "help" + OPT_HELP_NUM = 'h',#define OPT_PCI_BLACKLIST "pci-blacklist" OPT_PCI_BLACKLIST_NUM = 'b',#define OPT_PCI_WHITELIST "pci-whitelist"
lib/librte_eal/linuxapp/eal/eal.c +7 -1
@@ -520,8 +520,10 @@ eal_parse_args(int argc, char **argv)int ret;/* getopt is not happy, stop right now */ -if (opt =='?' ) +if (opt =='?' ) { +eal_usage (prgname);return -1 ; + } ret =eal_parse_common_option (opt, optarg, &internal_config);/* common parser is not happy */
@@ -534,6 +536,10 @@ eal_parse_args(int argc, char **argv)continue ;switch (opt) { +case 'h' : +eal_usage (prgname); +exit (EXIT_SUCCESS ); +/* force loading of external driver */ case 'd' : solib =malloc (sizeof (*solib));
Signature · 1 line
2.2.2
David Marchand
Acked-byQuoted 12 lines · Thomas Monjalon
This is a small reorganization of options.
The main goal is to provide a nice --help option.changes in v3:
- reword arguments in usage
changes in v2:
- sort also the options enumThomas Monjalon (2):
eal: sort and align options lists
eal: add help option
Quoted 7 lines
lib/librte_eal/bsdapp/eal/eal.c | 7 +- lib/librte_eal/common/eal_common_options.c | 115 +++++++++++++++-------------- lib/librte_eal/common/eal_options.h | 64 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 27 ++++--- 4 files changed, 113 insertions(+), 100 deletions(-)
Series
Signature · 1 line
David Marchand
A message that is not in the archive (sent off-list or not yet received): CALwxeUu7vdnwcSuRmWPqanBj5A+jbW+yQDCT9qYuoH7LNtUBTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Thomas Monjalon
AppliedQuoted 8 lines
Quoted 8 lines
This is a small reorganization of options.
The main goal is to provide a nice --help option.changes in v3:
- reword arguments in usage
changes in v2:
- sort also the options enum
Quoted 6 lines
Quoted 3 lines
Thomas Monjalon (2):
eal: sort and align options lists
eal: add help optionSeries
Acked-by David Marchand <[email protected]>
Applied, thanks
Neil Horman
Acked-byQuoted 12 lines · Thomas Monjalon
This is a small reorganization of options.
The main goal is to provide a nice --help option.changes in v3:
- reword arguments in usage
changes in v2:
- sort also the options enumThomas Monjalon (2):
eal: sort and align options lists
eal: add help option
Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal.c | 7 +- lib/librte_eal/common/eal_common_options.c | 115 +++++++++++++++-------------- lib/librte_eal/common/eal_options.h | 64 ++++++++-------- lib/librte_eal/linuxapp/eal/eal.c | 27 ++++--- 4 files changed, 113 insertions(+), 100 deletions(-)Signature · 1 line
2.2.2