From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 766BCA0548; Tue, 22 Jun 2021 04:48:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0475140140; Tue, 22 Jun 2021 04:48:41 +0200 (CEST) Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by mails.dpdk.org (Postfix) with ESMTP id D527940040; Tue, 22 Jun 2021 04:48:37 +0200 (CEST) Received: from lenovo.loongson.cn (unknown [223.104.38.180]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx_0FvT9FgyKEVAA--.25550S2; Tue, 22 Jun 2021 10:48:23 +0800 (CST) From: SunChengLian To: dev@dpdk.org, sunchenglian@loongson.cn Cc: bruce.richardson@intel.com, stable@dpdk.org, david.marchand@redhat.com, vattunuru@marvell.com Date: Tue, 22 Jun 2021 10:47:05 +0800 Message-Id: <20210622024706.1179945-1-sunchenglian@loongson.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611100357.388290-1-sunchenglian@loongson.cn> References: <20210611100357.388290-1-sunchenglian@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9Dx_0FvT9FgyKEVAA--.25550S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uF18XryrGF1kAr48ZrWfuFg_yoW8Ar4fpF W5X3Z8X3WFvw12qw45t34fW34rGFyxJwsxZrZ5ZasFq3WkGan3Wr40kr1DZr1DGFWvyrZr ZF1avryfW3W5Ga7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F 4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_ Gr1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxV WUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI 7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r 1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4U MIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbYhF7UUUU U== X-CM-SenderInfo: pvxquxxhqjzxtdq6z05rqj20fqof0/1tbiAQATDl3QvNeZtgBNsY Subject: [dpdk-dev] [PATCH v3 1/2] examples/l2fwd: fix long option parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: David Marchand --- 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