[dpdk-stable] patch 'app/testpmd: report invalid command line parameter' has been queued to LTS release 18.11.6

Kevin Traynor ktraynor at redhat.com
Wed Dec 11 22:26:34 CET 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/17/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/6abcaabc8dc56fe7c6c0480a739f63672576e50d

Thanks.

Kevin.

---
>From 6abcaabc8dc56fe7c6c0480a739f63672576e50d Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Mon, 18 Nov 2019 16:37:14 +0100
Subject: [PATCH] app/testpmd: report invalid command line parameter

[ upstream commit 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 ]

We currently do not check that a non option string has been passed to
testpmd.

Example:
$ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \
	--vdev net_null1 -- -i nb-cores=2 --total-num-mbuf 2048
[...]
testpmd> show config fwd
io packet forwarding - ports=2 - cores=1 - streams=2 - NUMA support
enabled, MP allocation mode: native
Logical Core 1 (socket 0) forwards packets on 2 streams:
  RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
  RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00

Here nb-cores=2 is just ignored, while the (probably sleepy) user did not
notice this.

Validate that all strings passed to testpmd are part of a known option.

After this patch:
$ ./master/app/testpmd --no-huge -m 512 --vdev net_null0 \
	--vdev net_null1 -- -i nb-cores=2 --total-num-mbuf 2048
[...]
Invalid parameter: nb-cores=2
EAL: Error - exiting with code: 1
  Cause: Command line incorrect

While at it, when passing an unknown option, print the string that gets
refused by getopt_long to help the user.

Fixes: af75078fece3 ("first public release")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test-pmd/parameters.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index bfb5834f4..4d5e28970 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1246,4 +1246,5 @@ launch_args_parse(int argc, char** argv)
 		default:
 			usage(argv[0]);
+			printf("Invalid option: %s\n", argv[optind]);
 			rte_exit(EXIT_FAILURE,
 				 "Command line is incomplete or incorrect\n");
@@ -1252,4 +1253,10 @@ launch_args_parse(int argc, char** argv)
 	}
 
+	if (optind != argc) {
+		usage(argv[0]);
+		printf("Invalid parameter: %s\n", argv[optind]);
+		rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
+	}
+
 	/* Set offload configuration from command line parameters. */
 	rx_mode.offloads = rx_offloads;
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-11 21:24:16.041470581 +0000
+++ 0042-app-testpmd-report-invalid-command-line-parameter.patch	2019-12-11 21:24:12.691650722 +0000
@@ -1 +1 @@
-From 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 Mon Sep 17 00:00:00 2001
+From 6abcaabc8dc56fe7c6c0480a739f63672576e50d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8fad2e5ab2c54ae12db0c3255b69d0c4f44a5194 ]
+
@@ -37 +38,0 @@
-Cc: stable at dpdk.org
@@ -46 +47 @@
-index deca7a682..2e7a50441 100644
+index bfb5834f4..4d5e28970 100644
@@ -49 +50 @@
-@@ -1364,4 +1364,5 @@ launch_args_parse(int argc, char** argv)
+@@ -1246,4 +1246,5 @@ launch_args_parse(int argc, char** argv)
@@ -55 +56 @@
-@@ -1370,4 +1371,10 @@ launch_args_parse(int argc, char** argv)
+@@ -1252,4 +1253,10 @@ launch_args_parse(int argc, char** argv)



More information about the stable mailing list