diff mbox series

[v3,1/2] examples/l2fwd: fix long option parsing

Message ID 20210622024706.1179945-1-sunchenglian@loongson.cn (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers show
Series [v3,1/2] examples/l2fwd: fix long option parsing | expand

Checks

Context Check Description
ci/iol-mellanox-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

SunChengLian June 22, 2021, 2:47 a.m. UTC
For l2fwd, --no-mac-updating and --mac-updating are treated as invalid
arguments.Rework long options parsing to let --no-mac-updating and
--mac-updating options work well.

Fixes: fa19eb20d212 ("examples/l2fwd: add forwarding port mapping option")
Cc: vattunuru@marvell.com
Cc: stable@dpdk.org

Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 examples/l2fwd/main.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

David Marchand July 5, 2021, 9:38 a.m. UTC | #1
On Tue, Jun 22, 2021 at 4:48 AM SunChengLian <sunchenglian@loongson.cn> wrote:
>
> For l2fwd, --no-mac-updating and --mac-updating are treated as invalid
> arguments.Rework long options parsing to let --no-mac-updating and
> --mac-updating options work well.
>
> Fixes: fa19eb20d212 ("examples/l2fwd: add forwarding port mapping option")
> Cc: vattunuru@marvell.com
> Cc: stable@dpdk.org
>
> Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Series applied, thanks.
diff mbox series

Patch

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index ffb67bb901..23e5e46761 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -434,13 +434,16 @@  enum {
 
 	/* first long only option value must be >= 256, so that we won't
 	 * conflict with short options */
-	CMD_LINE_OPT_MIN_NUM = 256,
+	CMD_LINE_OPT_MAC_UPDATING_NUM = 256,
+	CMD_LINE_OPT_NO_MAC_UPDATING_NUM,
 	CMD_LINE_OPT_PORTMAP_NUM,
 };
 
 static const struct option lgopts[] = {
-	{ CMD_LINE_OPT_MAC_UPDATING, no_argument, &mac_updating, 1},
-	{ CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, &mac_updating, 0},
+	{ CMD_LINE_OPT_MAC_UPDATING, no_argument, 0,
+		CMD_LINE_OPT_MAC_UPDATING_NUM},
+	{ CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, 0,
+		CMD_LINE_OPT_NO_MAC_UPDATING_NUM},
 	{ CMD_LINE_OPT_PORTMAP_CONFIG, 1, 0, CMD_LINE_OPT_PORTMAP_NUM},
 	{NULL, 0, 0, 0}
 };
@@ -502,6 +505,14 @@  l2fwd_parse_args(int argc, char **argv)
 			}
 			break;
 
+		case CMD_LINE_OPT_MAC_UPDATING_NUM:
+			mac_updating = 1;
+			break;
+
+		case CMD_LINE_OPT_NO_MAC_UPDATING_NUM:
+			mac_updating = 0;
+			break;
+
 		default:
 			l2fwd_usage(prgname);
 			return -1;