From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB6E7A0518; Fri, 19 Jun 2020 12:54:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C6C61BEB1; Fri, 19 Jun 2020 12:54:06 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4081D1BE8E for ; Fri, 19 Jun 2020 12:54:01 +0200 (CEST) IronPort-SDR: P9yutfvFzMIX85PTvX3IvX34BEZ8q/931wdRKtn2GruYgKm9/k6IaJ2sUO7wEXFTplRmQdu9Ol BUaKn6B2lSxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="131318774" X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="131318774" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 03:54:00 -0700 IronPort-SDR: B255WC5WdiGzIl1bzxFVGrnv7tmQyoNGL0kLwEMRHGBS58mk9Z0Fke/n2TffzavnPTzr9H8XqF HC5uxsuHfFHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="263347074" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by orsmga007.jf.intel.com with ESMTP; 19 Jun 2020 03:53:58 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: David Hunt , reshma.pattan@intel.com, hkalra@marvell.com, jerinjacobk@gmail.com, yinan.wang@intel.com Date: Fri, 19 Jun 2020 11:53:51 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 3/7] l3fwd-power: code style and flow fixes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Make the coding style more consistent, and the init logic control flow more explicit. Signed-off-by: Anatoly Burakov --- examples/l3fwd-power/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 5cee9d5387..c70611bb7f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1126,7 +1126,7 @@ main_empty_poll_loop(__rte_unused void *dummy) } /* main processing loop */ static int -main_loop(__rte_unused void *dummy) +main_legacy_loop(__rte_unused void *dummy) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; unsigned lcore_id; @@ -1581,6 +1581,7 @@ parse_ep_config(const char *q_arg) } #define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype" +#define CMD_LINE_OPT_EMPTY_POLL "empty-poll" #define CMD_LINE_OPT_TELEMETRY "telemetry" /* Parse the argument given in the command line of the application */ @@ -1598,7 +1599,7 @@ parse_args(int argc, char **argv) {"high-perf-cores", 1, 0, 0}, {"no-numa", 0, 0, 0}, {"enable-jumbo", 0, 0, 0}, - {"empty-poll", 1, 0, 0}, + {CMD_LINE_OPT_EMPTY_POLL, 1, 0, 0}, {CMD_LINE_OPT_PARSE_PTYPE, 0, 0, 0}, {CMD_LINE_OPT_TELEMETRY, 0, 0, 0}, {NULL, 0, 0, 0} @@ -1673,7 +1674,7 @@ parse_args(int argc, char **argv) } if (!strncmp(lgopts[option_index].name, - "empty-poll", 10)) { + CMD_LINE_OPT_EMPTY_POLL, 10)) { if (app_mode == APP_MODE_TELEMETRY) { printf(" empty-poll cannot be enabled as telemetry mode is enabled\n"); return -1; @@ -2253,7 +2254,9 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n"); - if (app_mode != APP_MODE_TELEMETRY && init_power_library()) + /* only legacy and empty poll mode rely on power library */ + if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) && + init_power_library()) rte_exit(EXIT_FAILURE, "init_power_library failed\n"); if (update_lcore_params() < 0) @@ -2526,12 +2529,12 @@ main(int argc, char **argv) /* launch per-lcore init on every lcore */ if (app_mode == APP_MODE_LEGACY) { - rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER); + rte_eal_mp_remote_launch(main_legacy_loop, NULL, CALL_MASTER); } else if (app_mode == APP_MODE_EMPTY_POLL) { empty_poll_stop = false; rte_eal_mp_remote_launch(main_empty_poll_loop, NULL, SKIP_MASTER); - } else { + } else if (app_mode == APP_MODE_TELEMETRY) { unsigned int i; /* Init metrics library */ @@ -2577,7 +2580,8 @@ main(int argc, char **argv) if (app_mode == APP_MODE_EMPTY_POLL) rte_power_empty_poll_stat_free(); - if (app_mode != APP_MODE_TELEMETRY && deinit_power_library()) + if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) && + deinit_power_library()) rte_exit(EXIT_FAILURE, "deinit_power_library failed\n"); if (rte_eal_cleanup() < 0) -- 2.17.1