patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue
@ 2021-06-10  1:01 SunChengLian
  2021-06-11  7:01 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: SunChengLian @ 2021-06-10  1:01 UTC (permalink / raw)
  To: dev; +Cc: SunChengLian, stable, Bruce Richardson

Readd other long options case in l2fwd_parse_args function
to ensure all long options will work well.

Fixes: fa19eb20d2126d8bc63acc8f336a353dfaf8c354 ("examples/l2fwd: add forwarding port mapping option")
Cc: stable@dpdk.org

Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
---
 examples/l2fwd/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index ffb67bb901..3215ec3806 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -502,6 +502,9 @@ l2fwd_parse_args(int argc, char **argv)
 			}
 			break;
 
+		case 0:
+			break;
+
 		default:
 			l2fwd_usage(prgname);
 			return -1;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue
  2021-06-10  1:01 [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
@ 2021-06-11  7:01 ` David Marchand
  2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
  2021-06-11 10:27 ` [dpdk-stable] [PATCH v2 " SunChengLian
  2 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2021-06-11  7:01 UTC (permalink / raw)
  To: SunChengLian; +Cc: dev, dpdk stable, Bruce Richardson

On Thu, Jun 10, 2021 at 3:02 AM SunChengLian <sunchenglian@loongson.cn> wrote:
>
> Readd other long options case in l2fwd_parse_args function
> to ensure all long options will work well.

Please, be more explicit about the thing you want to fix.

I understand --no-mac-updating is broken.
You want to fix this long option.
Is this correct?


The Fixes: should follow the common format.
I recommend setting this alias in your config so that you only need to
call "git fixline $sha1":
$ git config alias.fixline "log -1 --abbrev=12 --format='Fixes: %h
(\"%s\")%nCc: %ae'"

So here, it should be:
Fixes: fa19eb20d212 ("examples/l2fwd: add forwarding port mapping option")


And I recommend aligning this example with others.
Iow do something like:

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 32d405e65a..06cf8e1f14 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -433,13 +433,14 @@ 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}
 };
@@ -492,6 +493,14 @@ l2fwd_parse_args(int argc, char **argv)
                        break;

                /* long options */
+               case CMD_LINE_OPT_MAC_UPDATING_NUM:
+                       mac_updating = 1;
+                       break;
+
+               case CMD_LINE_OPT_NO_MAC_UPDATING_NUM:
+                       mac_updating = 0;
+                       break;
+
                case CMD_LINE_OPT_PORTMAP_NUM:
                        ret = l2fwd_parse_port_pair_config(optarg);
                        if (ret) {


In a followup patch, the "mac-updating" option can be removed since
the associated mac_updating variable is set to 1 by default.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing
  2021-06-10  1:01 [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
  2021-06-11  7:01 ` David Marchand
@ 2021-06-11 10:03 ` SunChengLian
  2021-06-17  9:14   ` David Marchand
                     ` (2 more replies)
  2021-06-11 10:27 ` [dpdk-stable] [PATCH v2 " SunChengLian
  2 siblings, 3 replies; 8+ messages in thread
From: SunChengLian @ 2021-06-11 10:03 UTC (permalink / raw)
  To: dev, sunchenglian; +Cc: bruce.richardson, stable, david.marchand

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: stable@dpdk.org

Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
---
 examples/l2fwd/main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index ffb67bb901..a8fa091842 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -434,13 +434,14 @@ 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 +503,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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v2 2/2] examples/l2fwd: remove mac-updating option
  2021-06-10  1:01 [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
  2021-06-11  7:01 ` David Marchand
  2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
@ 2021-06-11 10:27 ` SunChengLian
  2021-06-17  9:16   ` David Marchand
  2 siblings, 1 reply; 8+ messages in thread
From: SunChengLian @ 2021-06-11 10:27 UTC (permalink / raw)
  To: dev, sunchenglian; +Cc: bruce.richardson, stable, david.marchand

The "mac-updating" option can be removed since the associated mac_updating
variable is set to 1 by default.

Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
---
 examples/l2fwd/main.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index a8fa091842..65b290291d 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -434,13 +434,11 @@ enum {
 
 	/* first long only option value must be >= 256, so that we won't
 	 * conflict with short options */
-	CMD_LINE_OPT_MAC_UPDATING_NUM = 256,
-	CMD_LINE_OPT_NO_MAC_UPDATING_NUM,
+	CMD_LINE_OPT_NO_MAC_UPDATING_NUM=256,
 	CMD_LINE_OPT_PORTMAP_NUM,
 };
 
 static const struct option lgopts[] = {
-	{ 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}
@@ -503,10 +501,6 @@ 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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing
  2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
@ 2021-06-17  9:14   ` David Marchand
  2021-06-22  2:47   ` [dpdk-stable] [PATCH v3 " SunChengLian
  2021-06-22  2:49   ` [dpdk-stable] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option SunChengLian
  2 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2021-06-17  9:14 UTC (permalink / raw)
  To: SunChengLian; +Cc: dev, Bruce Richardson, dpdk stable

On Fri, Jun 11, 2021 at 12:05 PM 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: stable@dpdk.org
>
> Signed-off-by: SunChengLian <sunchenglian@loongson.cn>

Reviewed-by: David Marchand <david.marchand@redhat.com>

-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-stable] [PATCH v2 2/2] examples/l2fwd: remove mac-updating option
  2021-06-11 10:27 ` [dpdk-stable] [PATCH v2 " SunChengLian
@ 2021-06-17  9:16   ` David Marchand
  0 siblings, 0 replies; 8+ messages in thread
From: David Marchand @ 2021-06-17  9:16 UTC (permalink / raw)
  To: SunChengLian; +Cc: dev, Bruce Richardson, dpdk stable

On Fri, Jun 11, 2021 at 12:28 PM SunChengLian <sunchenglian@loongson.cn> wrote:
>
> The "mac-updating" option can be removed since the associated mac_updating
> variable is set to 1 by default.
>
> Signed-off-by: SunChengLian <sunchenglian@loongson.cn>
> ---
>  examples/l2fwd/main.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
> index a8fa091842..65b290291d 100644
> --- a/examples/l2fwd/main.c
> +++ b/examples/l2fwd/main.c
> @@ -434,13 +434,11 @@ enum {
>
>         /* first long only option value must be >= 256, so that we won't
>          * conflict with short options */
> -       CMD_LINE_OPT_MAC_UPDATING_NUM = 256,
> -       CMD_LINE_OPT_NO_MAC_UPDATING_NUM,
> +       CMD_LINE_OPT_NO_MAC_UPDATING_NUM=256,

Nit: s/=256/ = 256/

>         CMD_LINE_OPT_PORTMAP_NUM,
>  };
>
>  static const struct option lgopts[] = {
> -       { 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}
> @@ -503,10 +501,6 @@ 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;
> --
> 2.25.1
>

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v3 1/2] examples/l2fwd: fix long option parsing
  2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
  2021-06-17  9:14   ` David Marchand
@ 2021-06-22  2:47   ` SunChengLian
  2021-06-22  2:49   ` [dpdk-stable] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option SunChengLian
  2 siblings, 0 replies; 8+ messages in thread
From: SunChengLian @ 2021-06-22  2:47 UTC (permalink / raw)
  To: dev, sunchenglian; +Cc: bruce.richardson, stable, david.marchand, vattunuru

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(-)

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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-stable] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option
  2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
  2021-06-17  9:14   ` David Marchand
  2021-06-22  2:47   ` [dpdk-stable] [PATCH v3 " SunChengLian
@ 2021-06-22  2:49   ` SunChengLian
  2 siblings, 0 replies; 8+ messages in thread
From: SunChengLian @ 2021-06-22  2:49 UTC (permalink / raw)
  To: dev, sunchenglian; +Cc: bruce.richardson, stable, david.marchand

The "mac-updating" option can be removed since the associated mac_updating
variable is set to 1 by default.

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

diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 23e5e46761..70d342f23a 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -307,7 +307,7 @@ l2fwd_usage(const char *prgname)
 	       "  -p PORTMASK: hexadecimal bitmask of ports to configure\n"
 	       "  -q NQ: number of queue (=ports) per lcore (default is 1)\n"
 	       "  -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n"
-	       "  --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n"
+	       "  --no-mac-updating: Disable MAC addresses updating (enabled by default)\n"
 	       "      When enabled:\n"
 	       "       - The source MAC address is replaced by the TX port MAC address\n"
 	       "       - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\n"
@@ -425,7 +425,6 @@ static const char short_options[] =
 	"T:"  /* timer period */
 	;
 
-#define CMD_LINE_OPT_MAC_UPDATING "mac-updating"
 #define CMD_LINE_OPT_NO_MAC_UPDATING "no-mac-updating"
 #define CMD_LINE_OPT_PORTMAP_CONFIG "portmap"
 
@@ -434,14 +433,11 @@ enum {
 
 	/* first long only option value must be >= 256, so that we won't
 	 * conflict with short options */
-	CMD_LINE_OPT_MAC_UPDATING_NUM = 256,
-	CMD_LINE_OPT_NO_MAC_UPDATING_NUM,
+	CMD_LINE_OPT_NO_MAC_UPDATING_NUM = 256,
 	CMD_LINE_OPT_PORTMAP_NUM,
 };
 
 static const struct option lgopts[] = {
-	{ 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},
@@ -505,10 +501,6 @@ 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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-22  2:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  1:01 [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
2021-06-11  7:01 ` David Marchand
2021-06-11 10:03 ` [dpdk-stable] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
2021-06-17  9:14   ` David Marchand
2021-06-22  2:47   ` [dpdk-stable] [PATCH v3 " SunChengLian
2021-06-22  2:49   ` [dpdk-stable] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option SunChengLian
2021-06-11 10:27 ` [dpdk-stable] [PATCH v2 " SunChengLian
2021-06-17  9:16   ` David Marchand

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://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/ https://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