From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <radu.nicolau@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 200802C5
 for <dev@dpdk.org>; Tue,  7 Aug 2018 15:31:17 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga007.jf.intel.com ([10.7.209.58])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 07 Aug 2018 06:31:17 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.51,455,1526367600"; d="scan'208";a="62981608"
Received: from silpixa00383879.ir.intel.com (HELO
 silpixa00383879.ger.corp.intel.com) ([10.237.223.127])
 by orsmga007.jf.intel.com with ESMTP; 07 Aug 2018 06:31:15 -0700
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com, lei.a.yao@intel.com, pablo.de.lara.guarch@intel.com,
 Radu Nicolau <radu.nicolau@intel.com>
Date: Tue,  7 Aug 2018 14:24:44 +0100
Message-Id: <1533648284-16224-1-git-send-email-radu.nicolau@intel.com>
X-Mailer: git-send-email 2.7.5
In-Reply-To: <1531921784-10578-1-git-send-email-radu.nicolau@intel.com>
References: <1531921784-10578-1-git-send-email-radu.nicolau@intel.com>
Subject: [dpdk-dev] [PATCH v3] examples/l3fw-power: do not exit on power lib
	init failure
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Aug 2018 13:31:18 -0000

Do not exit the application if power library fails to initialize
or high performance cores configuration cannot be used - this was the
behavior of the application before the patch that added the high/regular
performance option and also this is the normally expected behavior, the
application can be used with no power options, i.e. test framework.

Fixes: f88e7c175a68 ("examples/l3fwd-power: add high/regular perf cores options")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v3: updated commit msg
v2: updated init_power_library to return error code if any core init fails


 examples/l3fwd-power/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index d15cd52..e73b853 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1638,11 +1638,13 @@ init_power_library(void)
 	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
 		if (rte_lcore_is_enabled(lcore_id)) {
 			/* init power management library */
-			ret = rte_power_init(lcore_id);
-			if (ret)
+			int cpi_ret = rte_power_init(lcore_id);
+			if (cpi_ret) {
 				RTE_LOG(ERR, POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
+				ret = -1;
+			}
 		}
 	}
 	return ret;
@@ -1683,10 +1685,10 @@ main(int argc, char **argv)
 		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
 
 	if (init_power_library())
-		rte_exit(EXIT_FAILURE, "init_power_library failed\n");
+		RTE_LOG(ERR, POWER, "init_power_library failed\n");
 
 	if (update_lcore_params() < 0)
-		rte_exit(EXIT_FAILURE, "update_lcore_params failed\n");
+		RTE_LOG(ERR, POWER, "update_lcore_params failed\n");
 
 	if (check_lcore_params() < 0)
 		rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");
-- 
2.7.5