From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id DEE3F1B5F1 for ; Fri, 12 Oct 2018 15:17:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2018 06:17:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,372,1534834800"; d="scan'208";a="77532308" Received: from unknown (HELO saesrv02-S2600CWR.intel.com) ([10.224.122.203]) by fmsmga007.fm.intel.com with ESMTP; 12 Oct 2018 06:17:51 -0700 From: Vipin Varghese To: dev@dpdk.org, harry.van.haaren@intel.com Cc: stephen1.byrne@intel.com, Vipin Varghese Date: Fri, 12 Oct 2018 18:44:03 +0530 Message-Id: <20181012131403.36566-1-vipin.varghese@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/service_cores: check lcores before test run 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: , X-List-Received-Date: Fri, 12 Oct 2018 13:17:54 -0000 The service core samples has varied profiles created to run on specified lcore count. The patch adds the check before each run, to ensure example has sufficent lcores to be added as service cores on given run profile. If sufficent cores are not found, the run is skipped with user notification. Signed-off-by: Vipin Varghese --- examples/service_cores/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/service_cores/main.c b/examples/service_cores/main.c index 2cd572904..c7c792810 100644 --- a/examples/service_cores/main.c +++ b/examples/service_cores/main.c @@ -118,6 +118,12 @@ apply_profile(int profile_id) struct profile *p = &profiles[profile_id]; const uint8_t core_off = 1; + if (p->num_cores > rte_lcore_count() + 1) { + printf("insufficent cores to run (%s)", + p->name); + return; + } + for (i = 0; i < p->num_cores; i++) { uint32_t core = i + core_off; ret = rte_service_lcore_add(core); -- 2.17.1