[v2,2/2] examples/l2fwd: remove mac-updating option

Message ID 20210611102741.389045-2-sunchenglian@loongson.cn (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series examples/l2fwd: fix l2fwd long options parse issue |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

SunChengLian June 11, 2021, 10:27 a.m. UTC
  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(-)
  

Comments

David Marchand June 17, 2021, 9:16 a.m. UTC | #1
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>
  

Patch

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;