DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: SunChengLian <sunchenglian@loongson.cn>
Cc: dev <dev@dpdk.org>, dpdk stable <stable@dpdk.org>,
	 Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] examples/l2fwd: fix l2fwd long options parse issue
Date: Fri, 11 Jun 2021 09:01:23 +0200	[thread overview]
Message-ID: <CAJFAV8y3ERzHcfjHPoB+SeeRYQg+Dr1X4_O5UFOiWnTBwHp-UA@mail.gmail.com> (raw)
In-Reply-To: <20210610010159.1813398-1-sunchenglian@loongson.cn>

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


  reply	other threads:[~2021-06-11  7:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  1:01 [dpdk-dev] " SunChengLian
2021-06-11  7:01 ` David Marchand [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJFAV8y3ERzHcfjHPoB+SeeRYQg+Dr1X4_O5UFOiWnTBwHp-UA@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=sunchenglian@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).