DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] help option
@ 2015-01-29 18:07 Thomas Monjalon
  2015-01-29 18:07 ` [dpdk-dev] [PATCH 1/2] eal: sort and align options lists Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-01-29 18:07 UTC (permalink / raw)
  To: dev

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(-)

-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 1/2] eal: sort and align options lists
  2015-01-29 18:07 [dpdk-dev] [PATCH 0/2] help option Thomas Monjalon
@ 2015-01-29 18:07 ` Thomas Monjalon
  2015-01-29 18:07 ` [dpdk-dev] [PATCH 2/2] eal: add help option Thomas Monjalon
  2015-02-02 17:44 ` [dpdk-dev] [PATCH v2 0/2] " Thomas Monjalon
  2 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-01-29 18:07 UTC (permalink / raw)
  To: dev

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.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/common/eal_common_options.c | 112 ++++++++++++++---------------
 lib/librte_eal/linuxapp/eal/eal.c          |  19 +++--
 2 files changed, 64 insertions(+), 67 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 67e02dc..4890e78 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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);
 }
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index f99e158..e3955e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -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 ) {
-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 2/2] eal: add help option
  2015-01-29 18:07 [dpdk-dev] [PATCH 0/2] help option Thomas Monjalon
  2015-01-29 18:07 ` [dpdk-dev] [PATCH 1/2] eal: sort and align options lists Thomas Monjalon
@ 2015-01-29 18:07 ` Thomas Monjalon
  2015-02-02 17:44 ` [dpdk-dev] [PATCH v2 0/2] " Thomas Monjalon
  2 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-01-29 18:07 UTC (permalink / raw)
  To: dev

Help is printed with -h or --help.

Help is also printed for an unknown option.
This was broken since the rework of options.

Fixes: 489a9d6c9f77 ("merge bsd and linux common options parsing")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 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(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 69f3c03..ca2f445 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -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 "
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 4890e78..05d80bd 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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"
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index e476f8d..9536468 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -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"
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e3955e7..d8c0628 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -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));
-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 0/2] help option
  2015-01-29 18:07 [dpdk-dev] [PATCH 0/2] help option Thomas Monjalon
  2015-01-29 18:07 ` [dpdk-dev] [PATCH 1/2] eal: sort and align options lists Thomas Monjalon
  2015-01-29 18:07 ` [dpdk-dev] [PATCH 2/2] eal: add help option Thomas Monjalon
@ 2015-02-02 17:44 ` Thomas Monjalon
  2015-02-02 17:44   ` [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists Thomas Monjalon
                     ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-02 17:44 UTC (permalink / raw)
  To: dev

This 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(-)

-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists
  2015-02-02 17:44 ` [dpdk-dev] [PATCH v2 0/2] " Thomas Monjalon
@ 2015-02-02 17:44   ` Thomas Monjalon
  2015-02-03  6:26     ` David Marchand
       [not found]   ` <1422899093-20207-3-git-send-email-thomas.monjalon@6wind.com>
  2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
  2 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-02 17:44 UTC (permalink / raw)
  To: dev

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.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
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(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 67e02dc..4890e78 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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);
 }
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index e476f8d..fe1c85d 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -35,48 +35,48 @@
 
 enum {
 	/* long options mapped to a short option */
-#define OPT_PCI_WHITELIST "pci-whitelist"
-	OPT_PCI_WHITELIST_NUM = 'w',
-#define OPT_PCI_BLACKLIST "pci-blacklist"
-	OPT_PCI_BLACKLIST_NUM = 'b',
+#define OPT_PCI_BLACKLIST     "pci-blacklist"
+	OPT_PCI_BLACKLIST_NUM   = 'b',
+#define OPT_PCI_WHITELIST     "pci-whitelist"
+	OPT_PCI_WHITELIST_NUM   = 'w',
 
 	/* first long only option value must be >= 256, so that we won't
 	 * conflict with short options */
 	OPT_LONG_MIN_NUM = 256,
-#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,
+#define OPT_CREATE_UIO_DEV    "create-uio-dev"
+	OPT_CREATE_UIO_DEV_NUM,
+#define OPT_FILE_PREFIX       "file-prefix"
+	OPT_FILE_PREFIX_NUM,
+#define OPT_HUGE_DIR          "huge-dir"
+	OPT_HUGE_DIR_NUM,
+#define OPT_LOG_LEVEL         "log-level"
+	OPT_LOG_LEVEL_NUM,
+#define OPT_MASTER_LCORE      "master-lcore"
 	OPT_MASTER_LCORE_NUM,
-#define OPT_PROC_TYPE   "proc-type"
+#define OPT_PROC_TYPE         "proc-type"
 	OPT_PROC_TYPE_NUM,
-#define OPT_NO_SHCONF   "no-shconf"
-	OPT_NO_SHCONF_NUM,
-#define OPT_NO_HPET     "no-hpet"
+#define OPT_NO_HPET           "no-hpet"
 	OPT_NO_HPET_NUM,
-#define OPT_VMWARE_TSC_MAP   "vmware-tsc-map"
-	OPT_VMWARE_TSC_MAP_NUM,
-#define OPT_NO_PCI      "no-pci"
-	OPT_NO_PCI_NUM,
-#define OPT_NO_HUGE     "no-huge"
+#define OPT_NO_HUGE           "no-huge"
 	OPT_NO_HUGE_NUM,
-#define OPT_FILE_PREFIX "file-prefix"
-	OPT_FILE_PREFIX_NUM,
-#define OPT_SOCKET_MEM  "socket-mem"
+#define OPT_NO_PCI            "no-pci"
+	OPT_NO_PCI_NUM,
+#define OPT_NO_SHCONF         "no-shconf"
+	OPT_NO_SHCONF_NUM,
+#define OPT_SOCKET_MEM        "socket-mem"
 	OPT_SOCKET_MEM_NUM,
-#define OPT_VDEV        "vdev"
-	OPT_VDEV_NUM,
-#define OPT_SYSLOG      "syslog"
+#define OPT_SYSLOG            "syslog"
 	OPT_SYSLOG_NUM,
-#define OPT_LOG_LEVEL   "log-level"
-	OPT_LOG_LEVEL_NUM,
-#define OPT_BASE_VIRTADDR   "base-virtaddr"
-	OPT_BASE_VIRTADDR_NUM,
-#define OPT_XEN_DOM0    "xen-dom0"
-	OPT_XEN_DOM0_NUM,
-#define OPT_CREATE_UIO_DEV "create-uio-dev"
-	OPT_CREATE_UIO_DEV_NUM,
-#define OPT_VFIO_INTR    "vfio-intr"
+#define OPT_VDEV              "vdev"
+	OPT_VDEV_NUM,
+#define OPT_VFIO_INTR         "vfio-intr"
 	OPT_VFIO_INTR_NUM,
+#define OPT_VMWARE_TSC_MAP    "vmware-tsc-map"
+	OPT_VMWARE_TSC_MAP_NUM,
+#define OPT_XEN_DOM0          "xen-dom0"
+	OPT_XEN_DOM0_NUM,
 	OPT_LONG_MAX_NUM
 };
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index f99e158..e3955e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -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 ) {
-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists
  2015-02-02 17:44   ` [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists Thomas Monjalon
@ 2015-02-03  6:26     ` David Marchand
  2015-02-03  8:27       ` Thomas Monjalon
  0 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2015-02-03  6:26 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Two little comments.

On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> @@ -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]


>
> +              "  -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]


>         /* first long only option value must be >= 256, so that we won't
>          * conflict with short options */
>         OPT_LONG_MIN_NUM = 256,
> -#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.
Acked-by: David Marchand <david.marchand@6wind.com>

-- 
David Marchand

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] eal: add help option
       [not found]   ` <1422899093-20207-3-git-send-email-thomas.monjalon@6wind.com>
@ 2015-02-03  6:33     ` David Marchand
  2015-02-03  8:20       ` Thomas Monjalon
  0 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2015-02-03  6:33 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:
[snip]

> @@ -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]


> @@ -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 ?


-- 
David Marchand

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] eal: add help option
  2015-02-03  6:33     ` [dpdk-dev] [PATCH v2 2/2] eal: add help option David Marchand
@ 2015-02-03  8:20       ` Thomas Monjalon
  2015-02-03  9:07         ` David Marchand
  0 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-03  8:20 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

2015-02-03 07:33, David Marchand:
> On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
> wrote:
> [snip]
> > @@ -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]
> > @@ -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 ?

Because it's calling eal_usage() which is not callable from common parser.
eal_usage() print usage for common and environment-specific options.

-- 
Thomas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists
  2015-02-03  6:26     ` David Marchand
@ 2015-02-03  8:27       ` Thomas Monjalon
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-03  8:27 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

2015-02-03 07:26, David Marchand:
> Two little comments.
> 
> On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
> wrote:
> > @@ -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]
> > +              "  -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.

> [snip]
> >         /* first long only option value must be >= 256, so that we won't
> >          * conflict with short options */
> >         OPT_LONG_MIN_NUM = 256,
> > -#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 ?

Exactly, yes. I think we don't care what is the first number.
It doesn't deserve a painful assignment.

> The rest looks good to me.
> Acked-by: David Marchand <david.marchand@6wind.com>

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/2] eal: add help option
  2015-02-03  8:20       ` Thomas Monjalon
@ 2015-02-03  9:07         ` David Marchand
  0 siblings, 0 replies; 16+ messages in thread
From: David Marchand @ 2015-02-03  9:07 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Tue, Feb 3, 2015 at 9:20 AM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> 2015-02-03 07:33, David Marchand:
> > On Mon, Feb 2, 2015 at 6:44 PM, Thomas Monjalon <
> thomas.monjalon@6wind.com>
> > wrote:
> > [snip]
> > > @@ -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]
> > > @@ -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 ?
>
> 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.

Acked-by: David Marchand <david.marchand@6wind.com>


-- 
David Marchand

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v3 0/2] help option
  2015-02-02 17:44 ` [dpdk-dev] [PATCH v2 0/2] " Thomas Monjalon
  2015-02-02 17:44   ` [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists Thomas Monjalon
       [not found]   ` <1422899093-20207-3-git-send-email-thomas.monjalon@6wind.com>
@ 2015-02-12 16:47   ` Thomas Monjalon
  2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 1/2] eal: sort and align options lists Thomas Monjalon
                       ` (3 more replies)
  2 siblings, 4 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-12 16:47 UTC (permalink / raw)
  To: dev

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

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(-)

-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] eal: sort and align options lists
  2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
@ 2015-02-12 16:47     ` Thomas Monjalon
  2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 2/2] eal: add help option Thomas Monjalon
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-12 16:47 UTC (permalink / raw)
  To: dev

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.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
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(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 67e02dc..3dda237 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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);
 }
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index e476f8d..fe1c85d 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -35,48 +35,48 @@
 
 enum {
 	/* long options mapped to a short option */
-#define OPT_PCI_WHITELIST "pci-whitelist"
-	OPT_PCI_WHITELIST_NUM = 'w',
-#define OPT_PCI_BLACKLIST "pci-blacklist"
-	OPT_PCI_BLACKLIST_NUM = 'b',
+#define OPT_PCI_BLACKLIST     "pci-blacklist"
+	OPT_PCI_BLACKLIST_NUM   = 'b',
+#define OPT_PCI_WHITELIST     "pci-whitelist"
+	OPT_PCI_WHITELIST_NUM   = 'w',
 
 	/* first long only option value must be >= 256, so that we won't
 	 * conflict with short options */
 	OPT_LONG_MIN_NUM = 256,
-#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,
+#define OPT_CREATE_UIO_DEV    "create-uio-dev"
+	OPT_CREATE_UIO_DEV_NUM,
+#define OPT_FILE_PREFIX       "file-prefix"
+	OPT_FILE_PREFIX_NUM,
+#define OPT_HUGE_DIR          "huge-dir"
+	OPT_HUGE_DIR_NUM,
+#define OPT_LOG_LEVEL         "log-level"
+	OPT_LOG_LEVEL_NUM,
+#define OPT_MASTER_LCORE      "master-lcore"
 	OPT_MASTER_LCORE_NUM,
-#define OPT_PROC_TYPE   "proc-type"
+#define OPT_PROC_TYPE         "proc-type"
 	OPT_PROC_TYPE_NUM,
-#define OPT_NO_SHCONF   "no-shconf"
-	OPT_NO_SHCONF_NUM,
-#define OPT_NO_HPET     "no-hpet"
+#define OPT_NO_HPET           "no-hpet"
 	OPT_NO_HPET_NUM,
-#define OPT_VMWARE_TSC_MAP   "vmware-tsc-map"
-	OPT_VMWARE_TSC_MAP_NUM,
-#define OPT_NO_PCI      "no-pci"
-	OPT_NO_PCI_NUM,
-#define OPT_NO_HUGE     "no-huge"
+#define OPT_NO_HUGE           "no-huge"
 	OPT_NO_HUGE_NUM,
-#define OPT_FILE_PREFIX "file-prefix"
-	OPT_FILE_PREFIX_NUM,
-#define OPT_SOCKET_MEM  "socket-mem"
+#define OPT_NO_PCI            "no-pci"
+	OPT_NO_PCI_NUM,
+#define OPT_NO_SHCONF         "no-shconf"
+	OPT_NO_SHCONF_NUM,
+#define OPT_SOCKET_MEM        "socket-mem"
 	OPT_SOCKET_MEM_NUM,
-#define OPT_VDEV        "vdev"
-	OPT_VDEV_NUM,
-#define OPT_SYSLOG      "syslog"
+#define OPT_SYSLOG            "syslog"
 	OPT_SYSLOG_NUM,
-#define OPT_LOG_LEVEL   "log-level"
-	OPT_LOG_LEVEL_NUM,
-#define OPT_BASE_VIRTADDR   "base-virtaddr"
-	OPT_BASE_VIRTADDR_NUM,
-#define OPT_XEN_DOM0    "xen-dom0"
-	OPT_XEN_DOM0_NUM,
-#define OPT_CREATE_UIO_DEV "create-uio-dev"
-	OPT_CREATE_UIO_DEV_NUM,
-#define OPT_VFIO_INTR    "vfio-intr"
+#define OPT_VDEV              "vdev"
+	OPT_VDEV_NUM,
+#define OPT_VFIO_INTR         "vfio-intr"
 	OPT_VFIO_INTR_NUM,
+#define OPT_VMWARE_TSC_MAP    "vmware-tsc-map"
+	OPT_VMWARE_TSC_MAP_NUM,
+#define OPT_XEN_DOM0          "xen-dom0"
+	OPT_XEN_DOM0_NUM,
 	OPT_LONG_MAX_NUM
 };
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index f99e158..e3955e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -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 ) {
-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] eal: add help option
  2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
  2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 1/2] eal: sort and align options lists Thomas Monjalon
@ 2015-02-12 16:47     ` Thomas Monjalon
  2015-02-13 10:50     ` [dpdk-dev] [PATCH v3 0/2] " David Marchand
  2015-02-13 12:57     ` Neil Horman
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-12 16:47 UTC (permalink / raw)
  To: dev

Help is printed with -h or --help.

Help is also printed for an unknown option.
This was broken since the rework of options.

Fixes: 489a9d6c9f77 ("merge bsd and linux common options parsing")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
---
 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(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 69f3c03..ca2f445 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -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 "
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 3dda237..4314e4e 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -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"
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index fe1c85d..d199a00 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -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"
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e3955e7..d8c0628 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -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));
-- 
2.2.2

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] help option
  2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
  2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 1/2] eal: sort and align options lists Thomas Monjalon
  2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 2/2] eal: add help option Thomas Monjalon
@ 2015-02-13 10:50     ` David Marchand
  2015-02-24 11:09       ` Thomas Monjalon
  2015-02-13 12:57     ` Neil Horman
  3 siblings, 1 reply; 16+ messages in thread
From: David Marchand @ 2015-02-13 10:50 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Thu, Feb 12, 2015 at 5:47 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> 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
>
> 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(-)
>

Series
Acked-by: David Marchand <david.marchand@6wind.com>


-- 
David Marchand

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] help option
  2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
                       ` (2 preceding siblings ...)
  2015-02-13 10:50     ` [dpdk-dev] [PATCH v3 0/2] " David Marchand
@ 2015-02-13 12:57     ` Neil Horman
  3 siblings, 0 replies; 16+ messages in thread
From: Neil Horman @ 2015-02-13 12:57 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Thu, Feb 12, 2015 at 05:47:55PM +0100, Thomas Monjalon wrote:
> 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
> 
> 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(-)
> 
> -- 
> 2.2.2
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] help option
  2015-02-13 10:50     ` [dpdk-dev] [PATCH v3 0/2] " David Marchand
@ 2015-02-24 11:09       ` Thomas Monjalon
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2015-02-24 11:09 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

> > 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
> >
> > Thomas Monjalon (2):
> >   eal: sort and align options lists
> >   eal: add help option
> 
> Series
> Acked-by: David Marchand <david.marchand@6wind.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-02-24 11:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 18:07 [dpdk-dev] [PATCH 0/2] help option Thomas Monjalon
2015-01-29 18:07 ` [dpdk-dev] [PATCH 1/2] eal: sort and align options lists Thomas Monjalon
2015-01-29 18:07 ` [dpdk-dev] [PATCH 2/2] eal: add help option Thomas Monjalon
2015-02-02 17:44 ` [dpdk-dev] [PATCH v2 0/2] " Thomas Monjalon
2015-02-02 17:44   ` [dpdk-dev] [PATCH v2 1/2] eal: sort and align options lists Thomas Monjalon
2015-02-03  6:26     ` David Marchand
2015-02-03  8:27       ` Thomas Monjalon
     [not found]   ` <1422899093-20207-3-git-send-email-thomas.monjalon@6wind.com>
2015-02-03  6:33     ` [dpdk-dev] [PATCH v2 2/2] eal: add help option David Marchand
2015-02-03  8:20       ` Thomas Monjalon
2015-02-03  9:07         ` David Marchand
2015-02-12 16:47   ` [dpdk-dev] [PATCH v3 0/2] " Thomas Monjalon
2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 1/2] eal: sort and align options lists Thomas Monjalon
2015-02-12 16:47     ` [dpdk-dev] [PATCH v3 2/2] eal: add help option Thomas Monjalon
2015-02-13 10:50     ` [dpdk-dev] [PATCH v3 0/2] " David Marchand
2015-02-24 11:09       ` Thomas Monjalon
2015-02-13 12:57     ` Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).