From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9AB3A0567; Wed, 10 Mar 2021 00:32:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8A7F22A586; Wed, 10 Mar 2021 00:31:56 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by mails.dpdk.org (Postfix) with ESMTP id 5B8D522A57F for ; Wed, 10 Mar 2021 00:31:54 +0100 (CET) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id A15185803CD; Tue, 9 Mar 2021 18:31:53 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 09 Mar 2021 18:31:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=z9q138BdglJgI nndfinARmV9LeG3Ecxpo8qz50GAHC0=; b=lE3T8EsxZzJIkhP4k2bGK9TvNeqvl j19Ef+c8qtEIrDYsN1gbf+UpF8jvtwkc6EAN+OBS6fF7vYSeBZRU4/eaRPLjOYN1 ufLuUgVkqlFdhWQGXUs7vkXtMb2y9Z72ob1/7IiBpkuxpQApf8Am9mqlcezQGq9x pvPXGKXexKvC6AvMtXS10y/X+WHt8jCPwp8MoSy5GLnonYz4YS8HaBCOsvA8xNka TdSJ8DnU/hvSo6ftgZvdgsSG6PlM6Px/UCXTEVbrbHDyoUJWUNGUrC7vFCtaTdhC Tgc2sOgYykSWoJKyBWEkzbN0m4+S8NBN71kOmT9Uz0rnIybY4VMPmxanA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=z9q138BdglJgInndfinARmV9LeG3Ecxpo8qz50GAHC0=; b=mShZB5c8 qHl6CUJuSYWgMzeBv793DrYWwFQGomSfAdmjH5lE6Vy9bSPZUgANezsa6OsEeoOe l4iO0Y0VYzNKWdz5B79LOiOg304HEx3Y6al6mVYI+YFxDMP25EZ3wBqgJtpcnXvS WVEtJ3XlTWc1xDdIacoE8Vg4ttgWHfSJtgsFwMNS/gz4W1nJKdkWQ9haPNpH+7Tq 11yObe3HtaUCA0/lGGoliZDuIJt7mPGc1911dgIAd+Mee52HKdCf4mvewZty/M+A mdX3JBwo0NcIVkUM547wVa1nvtlSkB58GUc12zoDUw4qMx08w8Zy/BAFUaF4ST9L VTpxxAZ6dLQcrg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudduiedgudejgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0A19124005D; Tue, 9 Mar 2021 18:31:51 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Reshma Pattan , Maryam Tahhan , Konstantin Ananyev , Nicolas Chautru , Declan Doherty , Ciara Power , Vladimir Medvedkin , Wisam Jaddo , Xiaoyun Li , Ori Kam , Bernard Iremonger Date: Wed, 10 Mar 2021 00:31:13 +0100 Message-Id: <20210309233116.1934666-10-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210309233116.1934666-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 09/11] app: hook in EAL usage help X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Use rte_set_application_usage_hook() in the test applications, so the full help including EAL options can be printed in one go with the EAL option -h or --help. Signed-off-by: Thomas Monjalon --- app/pdump/main.c | 2 ++ app/proc-info/main.c | 2 ++ app/test-acl/main.c | 2 ++ app/test-bbdev/main.c | 3 ++- app/test-compress-perf/comp_perf_options.h | 2 ++ app/test-compress-perf/comp_perf_options_parse.c | 8 ++++---- app/test-compress-perf/main.c | 3 ++- app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 8 ++++---- app/test-crypto-perf/main.c | 3 ++- app/test-fib/main.c | 8 ++++++++ app/test-flow-perf/main.c | 4 +++- app/test-pmd/parameters.c | 4 ++-- app/test-pmd/testpmd.c | 2 ++ app/test-pmd/testpmd.h | 1 + app/test-regex/main.c | 3 ++- app/test-sad/main.c | 7 +++++++ 17 files changed, 49 insertions(+), 15 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 63bbe65cd8..8641017f48 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -974,6 +974,8 @@ main(int argc, char **argv) char mp_flag[] = "--proc-type=secondary"; char *argp[argc + 2]; + rte_set_application_usage_hook(pdump_usage); + /* catch ctrl-c so we can print on exit */ signal(SIGINT, signal_handler); diff --git a/app/proc-info/main.c b/app/proc-info/main.c index b9587f7ded..e7d86bfa9d 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -1361,6 +1361,8 @@ main(int argc, char **argv) char *argp[argc + 4]; uint16_t nb_ports; + rte_set_application_usage_hook(proc_info_usage); + /* preparse app arguments */ ret = proc_info_preparse_args(argc, argv); if (ret < 0) { diff --git a/app/test-acl/main.c b/app/test-acl/main.c index 2cb2fe2579..9f95cb0fbf 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -1080,6 +1080,8 @@ main(int argc, char **argv) int ret; uint32_t lcore; + rte_set_application_usage_hook(print_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/test-bbdev/main.c b/app/test-bbdev/main.c index ff65173fdb..5960ec18b2 100644 --- a/app/test-bbdev/main.c +++ b/app/test-bbdev/main.c @@ -340,7 +340,8 @@ main(int argc, char **argv) { int ret; - /* Init EAL */ + rte_set_application_usage_hook(print_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) return 1; diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h index 0b777521c5..7dd785fba1 100644 --- a/app/test-compress-perf/comp_perf_options.h +++ b/app/test-compress-perf/comp_perf_options.h @@ -73,6 +73,8 @@ struct comp_test_data { uint32_t cyclecount_delay; }; +void comp_perf_usage(const char *progname); + int comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv); diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 019eddb7bd..39d7fd8c69 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -38,8 +38,8 @@ struct name_id_map { uint32_t id; }; -static void -usage(char *progname) +void +comp_perf_usage(const char *progname) { printf("%s [EAL options] --\n" " --ptest throughput / verify / pmd-cyclecount\n" @@ -619,7 +619,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) { switch (opt) { case 'h': - usage(argv[0]); + comp_perf_usage(argv[0]); exit(EXIT_SUCCESS); break; /* long options */ @@ -631,7 +631,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) break; default: - usage(argv[0]); + comp_perf_usage(argv[0]); return -EINVAL; } } diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index cc9951a9b1..dcd347528e 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -323,7 +323,8 @@ main(int argc, char **argv) uint8_t cdev_id; uint32_t lcore_id; - /* Initialise DPDK EAL */ + rte_set_application_usage_hook(comp_perf_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments!\n"); diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h index 9664a4b343..5f4a780614 100644 --- a/app/test-crypto-perf/cperf_options.h +++ b/app/test-crypto-perf/cperf_options.h @@ -153,6 +153,8 @@ struct cperf_options { uint8_t imix_distribution_count; }; +void cperf_usage(const char *progname); + void cperf_options_default(struct cperf_options *options); diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 40b6dfb648..3777bc7509 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -19,8 +19,8 @@ struct name_id_map { uint32_t id; }; -static void -usage(char *progname) +void +cperf_usage(const char *progname) { printf("%s [EAL options] --\n" " --silent: disable options dump\n" @@ -982,7 +982,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) while ((opt = getopt_long(argc, argv, "h", lgopts, &opt_idx)) != EOF) { switch (opt) { case 'h': - usage(argv[0]); + cperf_usage(argv[0]); exit(EXIT_SUCCESS); break; /* long options */ @@ -994,7 +994,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) break; default: - usage(argv[0]); + cperf_usage(argv[0]); return -EINVAL; } } diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 49af812d8b..497c4c5226 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -519,7 +519,8 @@ main(int argc, char **argv) int ret; uint32_t lcore_id; - /* Initialise DPDK EAL */ + rte_set_application_usage_hook(cperf_usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid EAL arguments!\n"); diff --git a/app/test-fib/main.c b/app/test-fib/main.c index b0a97b0d7e..420fe17c39 100644 --- a/app/test-fib/main.c +++ b/app/test-fib/main.c @@ -648,6 +648,12 @@ print_usage(void) config.prgname); } +static void +usage_hook(const char *prgname __rte_unused) +{ + print_usage(); +} + static int check_config(void) { @@ -1209,6 +1215,8 @@ main(int argc, char **argv) FILE *fl = NULL; uint8_t depth_lim; + rte_set_application_usage_hook(usage_hook); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 0aef767350..949a5e3e11 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -115,7 +115,7 @@ static struct multi_cores_pool mc_pool = { }; static void -usage(char *progname) +usage(const char *progname) { printf("\nusage: %s\n", progname); printf("\nControl configurations:\n"); @@ -1849,6 +1849,8 @@ main(int argc, char **argv) uint16_t port; struct rte_flow_error error; + rte_set_application_usage_hook(usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "EAL init failed\n"); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 55ecea6338..7f41021d4d 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -46,8 +46,8 @@ #include "testpmd.h" -static void -usage(char* progname) +void +usage(const char *progname) { printf("usage: %s [EAL options] -- " #ifdef RTE_LIB_CMDLINE diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1a57324b1b..1a60830037 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3771,6 +3771,8 @@ main(int argc, char** argv) rte_exit(EXIT_FAILURE, "Cannot register log type"); rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG); + rte_set_application_usage_hook(usage); + diag = rte_eal_init(argc, argv); if (diag < 0) rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n", diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ce83f31f0d..37348246f8 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -763,6 +763,7 @@ inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx) unsigned int parse_item_list(char* str, const char* item_name, unsigned int max_items, unsigned int *parsed_items, int check_unique_values); +void usage(const char *progname); void launch_args_parse(int argc, char** argv); void cmdline_read_from_file(const char *filename); void prompt(void); diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 7bb87bb1b8..ba09b20126 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -616,7 +616,8 @@ main(int argc, char **argv) uint32_t i; struct qps_per_lcore *qps_per_lcore; - /* Init EAL. */ + rte_set_application_usage_hook(usage); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_exit(EXIT_FAILURE, "EAL init failed\n"); diff --git a/app/test-sad/main.c b/app/test-sad/main.c index 1024757add..14a8263f8c 100644 --- a/app/test-sad/main.c +++ b/app/test-sad/main.c @@ -149,7 +149,12 @@ print_usage(void) "[-p ]\n" "[-c ]\n", config.prgname); +} +static void +usage_hook(const char *prgname __rte_unused) +{ + print_usage(); } static int @@ -620,6 +625,8 @@ main(int argc, char **argv) struct rte_ipsec_sad_conf conf = {0}; unsigned int lcore_id; + rte_set_application_usage_hook(usage_hook); + ret = rte_eal_init(argc, argv); if (ret < 0) rte_panic("Cannot init EAL\n"); -- 2.30.1