[v5,2/4] eal: improve options usage text

Message ID 20210405193954.1115838-3-thomas@monjalon.net (mailing list archive)
State Changes Requested, archived
Delegated to: David Marchand
Headers
Series improve options help |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon April 5, 2021, 7:39 p.m. UTC
  The description of the EAL options was printed before the application
description provided via the hook.
It is better to let the application print the global syntax
and describes the detail of the EAL options below.

Also, some useless lines are removed,
and the alignment of few options is fixed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 lib/librte_eal/common/eal_common_options.c | 11 +++++------
 lib/librte_eal/freebsd/eal.c               |  8 ++++----
 lib/librte_eal/linux/eal.c                 | 12 ++++++------
 lib/librte_eal/windows/eal.c               | 10 ++++------
 4 files changed, 19 insertions(+), 22 deletions(-)
  

Comments

Stephen Hemminger July 6, 2023, 6:45 p.m. UTC | #1
On Mon,  5 Apr 2021 21:39:52 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> The description of the EAL options was printed before the application
> description provided via the hook.
> It is better to let the application print the global syntax
> and describes the detail of the EAL options below.
> 
> Also, some useless lines are removed,
> and the alignment of few options is fixed.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

The default eal usage is due for an overhaul. Split it into sections
and only show a short summary.  See git for an example.

But this part is fine, probably hold for 23.11 where users might
expect more changes.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Stephen Hemminger March 18, 2024, 10:11 p.m. UTC | #2
On Mon,  5 Apr 2021 21:39:52 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> The description of the EAL options was printed before the application
> description provided via the hook.
> It is better to let the application print the global syntax
> and describes the detail of the EAL options below.
> 
> Also, some useless lines are removed,
> and the alignment of few options is fixed.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

This patch no longer applies, please rebase and resubmit
  

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 2951b1aca2..08a85614c9 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -2045,8 +2045,7 @@  rte_vect_set_max_simd_bitwidth(uint16_t bitwidth)
 void
 eal_common_usage(void)
 {
-	printf("[options]\n\n"
-	       "EAL common options:\n"
+	printf("EAL common options:\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"
@@ -2076,7 +2075,7 @@  eal_common_usage(void)
 	       "  --"OPT_VDEV"              Add a virtual device.\n"
 	       "                      The argument format is <driver><id>[,key=val,...]\n"
 	       "                      (ex: --vdev=net_pcap0,iface=eth2).\n"
-	       "  --"OPT_IOVA_MODE"   Set IOVA mode. 'pa' for IOVA_PA\n"
+	       "  --"OPT_IOVA_MODE"         Set IOVA mode. 'pa' for IOVA_PA\n"
 	       "                      'va' for IOVA_VA\n"
 	       "  -d LIB.so|DIR       Add a driver or driver directory\n"
 	       "                      (can be used multiple times)\n"
@@ -2116,11 +2115,11 @@  eal_common_usage(void)
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 	       "  -v                  Display version information on startup\n"
 	       "  -h, --help          This help\n"
-	       "  --"OPT_IN_MEMORY"   Operate entirely in memory. This will\n"
+	       "  --"OPT_IN_MEMORY"         Operate entirely in memory. This will\n"
 	       "                      disable secondary process support\n"
 	       "  --"OPT_BASE_VIRTADDR"     Base virtual address\n"
-	       "  --"OPT_TELEMETRY"   Enable telemetry support (on by default)\n"
-	       "  --"OPT_NO_TELEMETRY"   Disable telemetry support\n"
+	       "  --"OPT_TELEMETRY"         Enable telemetry support (on by default)\n"
+	       "  --"OPT_NO_TELEMETRY"      Disable telemetry support\n"
 	       "  --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwidth\n"
 	       "\nEAL options for DEBUG use only:\n"
 	       "  --"OPT_HUGE_UNLINK"       Unlink hugepage files after init\n"
diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 32442e5ba6..4e10d37253 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -421,13 +421,13 @@  eal_usage(const char *prgname)
 {
 	rte_usage_hook_t hook = eal_get_application_usage_hook();
 
-	printf("\nUsage: %s ", prgname);
-	eal_common_usage();
-	/* Allow the application to print its usage message too if hook is set */
 	if (hook) {
-		printf("===== Application Usage =====\n\n");
+		/* Print application usage through EAL options parsing. */
 		(hook)(prgname);
+		printf("\n");
 	}
+
+	eal_common_usage();
 }
 
 static inline size_t
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index ac27dd4274..4f36f9b1f5 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -535,7 +535,12 @@  eal_usage(const char *prgname)
 {
 	rte_usage_hook_t hook = eal_get_application_usage_hook();
 
-	printf("\nUsage: %s ", prgname);
+	if (hook) {
+		/* Print application usage through EAL options parsing. */
+		(hook)(prgname);
+		printf("\n");
+	}
+
 	eal_common_usage();
 	printf("EAL Linux options:\n"
 	       "  --"OPT_SOCKET_MEM"        Memory to allocate on sockets (comma separated values)\n"
@@ -549,11 +554,6 @@  eal_usage(const char *prgname)
 	       "  --"OPT_SINGLE_FILE_SEGMENTS" Put all hugepage memory in single files\n"
 	       "  --"OPT_MATCH_ALLOCATIONS" Free hugepages exactly as allocated\n"
 	       "\n");
-	/* Allow the application to print its usage message too if hook is set */
-	if (hook) {
-		printf("===== Application Usage =====\n\n");
-		(hook)(prgname);
-	}
 }
 
 static int
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 68a1fd1d21..25921eecb2 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -80,15 +80,13 @@  eal_usage(const char *prgname)
 {
 	rte_usage_hook_t hook = eal_get_application_usage_hook();
 
-	printf("\nUsage: %s ", prgname);
-	eal_common_usage();
-	/* Allow the application to print its usage message too
-	 * if hook is set
-	 */
 	if (hook) {
-		printf("===== Application Usage =====\n\n");
+		/* Print application usage through EAL options parsing. */
 		(hook)(prgname);
+		printf("\n");
 	}
+
+	eal_common_usage();
 }
 
 /* Parse the arguments for --log-level only */