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 6BD14A0562; Thu, 1 Apr 2021 13:20:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24652141078; Thu, 1 Apr 2021 13:20:22 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 6C8E34067B for ; Thu, 1 Apr 2021 13:20:20 +0200 (CEST) IronPort-SDR: 6OjHfQRKQIB9+tMWMJnh/HCV0+8Xl/iMdtsoV066CaQLdAOm5EslxqMweznUm0fd1aN2YxDRlx P5+bf3UTAdhA== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="253559992" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="253559992" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 04:20:19 -0700 IronPort-SDR: lp69UWud7IBoFnHaIUj1lMVpdKttJJgxMS7xgb9mWPlnnHwsStwFwxyjRbcNYf57OVoywVCfp3 RyTVb7IKI8cw== X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="596300247" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.250.93]) ([10.213.250.93]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 04:20:17 -0700 To: Conor Walsh , jerinj@marvell.com, stephen@networkplumber.org, bernard.iremonger@intel.com, konstantin.ananyev@intel.com, vladimir.medvedkin@intel.com Cc: dev@dpdk.org References: <20210311120153.186213-1-conor.walsh@intel.com> <20210315113439.1045223-1-conor.walsh@intel.com> <20210315113439.1045223-4-conor.walsh@intel.com> From: "Burakov, Anatoly" Message-ID: <9bb4ba59-5df1-5e19-78cf-3344270ff889@intel.com> Date: Thu, 1 Apr 2021 12:20:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210315113439.1045223-4-conor.walsh@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 3/5] examples/l3fwd: add FIB infrastructure 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" On 15-Mar-21 11:34 AM, Conor Walsh wrote: > The purpose of this commit is to add the necessary function calls > and supporting infrastructure to allow the Forwarding Information Base > (FIB) library to be integrated into the l3fwd sample app. > Instead of adding an individual flag for FIB, a new flag '--lookup' has > been added that allows the user to select their desired lookup method. > The flags '-E' and '-L' have been retained for backwards compatibility. > > Signed-off-by: Conor Walsh > Acked-by: Konstantin Ananyev > Acked-by: Vladimir Medvedkin > --- > @@ -310,7 +328,10 @@ print_usage(const char *prgname) > " Valid only if --mode=eventdev\n" > " --event-eth-rxqs: Number of ethernet RX queues per device.\n" > " Default: 1\n" > - " Valid only if --mode=eventdev\n\n", > + " Valid only if --mode=eventdev\n" > + " --lookup: Select the lookup method\n" > + " Default: lpm\n" > + " Accepted: em (Exact Match), lpm (Longest Prefix Match), fib (First Information Base)\n\n", Isn't it Forward Information Base? > prgname); > } > > @@ -485,13 +506,32 @@ parse_event_eth_rx_queues(const char *eth_rx_queues) > evt_rsrc->eth_rx_queues = num_eth_rx_queues; > } > > +static void > +parse_lookup(const char *optarg) > +{ > + if (lookup_mode != L3FWD_LOOKUP_DEFAULT) { > + rte_exit(EXIT_FAILURE, > + "Only one lookup mode is allowed at a time!\n"); > + } > + if (!strcmp(optarg, "em")) > + lookup_mode = L3FWD_LOOKUP_EM; > + else if (!strcmp(optarg, "lpm")) > + lookup_mode = L3FWD_LOOKUP_LPM; > + else if (!strcmp(optarg, "fib")) > + lookup_mode = L3FWD_LOOKUP_FIB; > + else { > + rte_exit(EXIT_FAILURE, > + "Invalid --lookup option! Accepted options: em, lpm, fib\n"); > + } > +} > + I don't think having rte_exit() calls inside a parsing function is good practice. The check at the beginning of the function can be done in optarg switch (like you have for E and L switches), while the latter can be replaced with a RTE_LOG(ERR, ...) and a return -1, which can be checked by the caller. Once the above is fixed, Acked-by: Anatoly Burako -- Thanks, Anatoly