patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@nvidia.com>
To: <dev@dpdk.org>
Cc: <wisamm@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH v2] app/flow-perf: add missing default option
Date: Tue, 16 Nov 2021 16:12:26 +0200
Message-ID: <20211116141228.14755-1-rasland@nvidia.com> (raw)
In-Reply-To: <20211111125032.29087-1-rasland@nvidia.com>

Currently, if an invalid parameter is passed to the application
it will cause a crash due to missing default in options.

For example:
        ./dpdk-test-flow-perf -a 01:00.0 -- --invalid

This adds missing default for options, and prints the
invalid option.

Fixes: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
Cc: wisamm@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
---
 app/test-flow-perf/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 2b612aa32c..11f1ee0e1e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -715,6 +715,7 @@ args_parse(int argc, char **argv)
 		{ "policy-mtr",                 1, 0, 0 },
 		{ "meter-profile",              1, 0, 0 },
 		{ "packet-mode",                0, 0, 0 },
+		{ 0, 0, 0, 0 },
 	};
 
 	RTE_ETH_FOREACH_DEV(i)
@@ -951,7 +952,7 @@ args_parse(int argc, char **argv)
 		default:
 			usage(argv[0]);
 			rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
-					argv[optind]);
+					argv[optind - 1]);
 			break;
 		}
 	}
-- 
2.25.1


  reply	other threads:[~2021-11-16 14:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 12:50 [PATCH] app/flow-perf: report invalid parameters Raslan Darawsheh
2021-11-16 14:12 ` Raslan Darawsheh [this message]
2021-11-16 14:18   ` [PATCH v2] app/flow-perf: add missing default option Wisam Monther
2021-11-17  9:49     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116141228.14755-1-rasland@nvidia.com \
    --to=rasland@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=wisamm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git