From patchwork Fri Jun 23 09:06:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 25653 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 126655699; Fri, 23 Jun 2017 11:06:37 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id F19773252 for ; Fri, 23 Jun 2017 11:06:29 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jun 2017 02:06:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,377,1493708400"; d="scan'208";a="277769874" Received: from silpixa00398672.ir.intel.com ([10.237.223.128]) by fmsmga004.fm.intel.com with ESMTP; 23 Jun 2017 02:06:27 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, keith.wiles@intel.com, bruce.richardson@intel.com, Harry van Haaren Date: Fri, 23 Jun 2017 10:06:16 +0100 Message-Id: <1498208779-166205-3-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498208779-166205-1-git-send-email-harry.van.haaren@intel.com> References: <1498208779-166205-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH 3/6] service cores: EAL init changes 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" This commit shows the changes required in rte_eal_init() to transparently launch the service threads. The threads are launched into the service worker functions here because after rte_eal_init() the application is not gauranteed to call any other DPDK API. As the registration of services happens at initialization time, the services that require CPU time are already available when we reach the end of rte_eal_init(). Signed-off-by: Harry van Haaren Acked-by: Jerin Jacob --- lib/librte_eal/linuxapp/eal/eal.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 7c78f2d..4d6ad0e 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -78,6 +78,7 @@ #include #include #include +#include #include "eal_private.h" #include "eal_thread.h" @@ -939,6 +940,20 @@ rte_eal_init(int argc, char **argv) return -1; } + /* initialize service core threads and default service-core mapping */ + struct rte_config *config = rte_eal_get_configuration(); + uint32_t service_cores[RTE_MAX_LCORE]; + int count = rte_service_core_list(service_cores, RTE_MAX_LCORE); + for (i = 0; i < count; i++) { + config->lcore_role[service_cores[i]] = ROLE_SERVICE; + rte_service_core_start(service_cores[i]); + } + ret = rte_service_init_default_mapping(); + if (ret) { + rte_errno = ENOEXEC; + return -1; + } + rte_eal_mcfg_complete(); return fctret;