DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l2fwd: fix l2fwd long options parse issue
@ 2021-06-10  1:01 SunChengLian
  2021-06-11  7:01 ` [dpdk-dev] [dpdk-stable] " David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ 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] 9+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue
  2021-06-10  1:01 [dpdk-dev] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
@ 2021-06-11  7:01 ` David Marchand
  2021-06-11 10:03 ` [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
  2021-06-11 10:27 ` [dpdk-dev] [PATCH v2 " SunChengLian
  2 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing
  2021-06-10  1:01 [dpdk-dev] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
  2021-06-11  7:01 ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2021-06-11 10:03 ` SunChengLian
  2021-06-17  9:14   ` David Marchand
                     ` (2 more replies)
  2021-06-11 10:27 ` [dpdk-dev] [PATCH v2 " SunChengLian
  2 siblings, 3 replies; 9+ 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] 9+ messages in thread

* [dpdk-dev] [PATCH v2 2/2] examples/l2fwd: remove mac-updating option
  2021-06-10  1:01 [dpdk-dev] [PATCH] examples/l2fwd: fix l2fwd long options parse issue SunChengLian
  2021-06-11  7:01 ` [dpdk-dev] [dpdk-stable] " David Marchand
  2021-06-11 10:03 ` [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
@ 2021-06-11 10:27 ` SunChengLian
  2021-06-17  9:16   ` [dpdk-dev] [dpdk-stable] " David Marchand
  2 siblings, 1 reply; 9+ 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] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing
  2021-06-11 10:03 ` [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
@ 2021-06-17  9:14   ` David Marchand
  2021-06-22  2:47   ` [dpdk-dev] [PATCH v3 " SunChengLian
  2021-06-22  2:49   ` [dpdk-dev] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option SunChengLian
  2 siblings, 0 replies; 9+ 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] 9+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 2/2] examples/l2fwd: remove mac-updating option
  2021-06-11 10:27 ` [dpdk-dev] [PATCH v2 " SunChengLian
@ 2021-06-17  9:16   ` David Marchand
  0 siblings, 0 replies; 9+ 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] 9+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] examples/l2fwd: fix long option parsing
  2021-06-11 10:03 ` [dpdk-dev] [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-07-05  9:38     ` David Marchand
  2021-06-22  2:49   ` [dpdk-dev] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option SunChengLian
  2 siblings, 1 reply; 9+ 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] 9+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] examples/l2fwd: remove mac-updating option
  2021-06-11 10:03 ` [dpdk-dev] [PATCH v2 1/2] examples/l2fwd: fix long option parsing SunChengLian
  2021-06-17  9:14   ` David Marchand
  2021-06-22  2:47   ` [dpdk-dev] [PATCH v3 " SunChengLian
@ 2021-06-22  2:49   ` SunChengLian
  2 siblings, 0 replies; 9+ 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] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/2] examples/l2fwd: fix long option parsing
  2021-06-22  2:47   ` [dpdk-dev] [PATCH v3 " SunChengLian
@ 2021-07-05  9:38     ` David Marchand
  0 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2021-07-05  9:38 UTC (permalink / raw)
  To: SunChengLian; +Cc: dev, Bruce Richardson, dpdk stable, Vamsi Attunuru

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.


-- 
David Marchand


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

end of thread, other threads:[~2021-07-05  9:38 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).