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 D793AA0C47; Fri, 11 Jun 2021 12:05:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A58140688; Fri, 11 Jun 2021 12:05:05 +0200 (CEST) Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by mails.dpdk.org (Postfix) with ESMTP id E300C4067C; Fri, 11 Jun 2021 12:05:03 +0200 (CEST) Received: from lenovo.loongson.cn (unknown [223.104.42.78]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxD0JENcNgYTYPAA--.17020S2; Fri, 11 Jun 2021 18:04:59 +0800 (CST) From: SunChengLian To: dev@dpdk.org, sunchenglian@loongson.cn Cc: bruce.richardson@intel.com, stable@dpdk.org, david.marchand@redhat.com Date: Fri, 11 Jun 2021 18:03:56 +0800 Message-Id: <20210611100357.388290-1-sunchenglian@loongson.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210610010159.1813398-1-sunchenglian@loongson.cn> References: <20210610010159.1813398-1-sunchenglian@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9DxD0JENcNgYTYPAA--.17020S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uF18XryrGF4rCw4DAw45GFg_yoW8WrWfpF Z5W3Z8XF1Fvw12qw45t34rW3s5GFyfJwsxZrZ5Zasrt3WkGan3Wr40kr1DZr1DGFWvyrZr ZF1avryfW3W5Ca7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_Gw1l 42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJV WUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAK I48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r 4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUboKZJUUUUU== X-CM-SenderInfo: pvxquxxhqjzxtdq6z05rqj20fqof0/1tbiAQAJDl3QvNcSiwAXsu Subject: [dpdk-dev] [PATCH v2 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: stable@dpdk.org Signed-off-by: SunChengLian --- 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