From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C05053257 for ; Tue, 11 Jul 2017 16:19:36 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 11 Jul 2017 07:19:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,346,1496127600"; d="scan'208";a="125185167" Received: from silpixa00398672.ir.intel.com ([10.237.223.128]) by fmsmga005.fm.intel.com with ESMTP; 11 Jul 2017 07:19:34 -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: Tue, 11 Jul 2017 15:19:28 +0100 Message-Id: <1499782773-12277-3-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499782773-12277-1-git-send-email-harry.van.haaren@intel.com> References: <1499445667-32588-1-git-send-email-harry.van.haaren@intel.com> <1499782773-12277-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v5 2/7] 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: , X-List-Received-Date: Tue, 11 Jul 2017 14:19:37 -0000 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 --- v5: - Simplify EAL code, calling rte_service_start_with_defaults() (Jerin) - Added Ack from ML v4: - Added #include for service cores in BSD eal.c v2 comments: - Include BSD implementation (Jerin) - Move details of core-tracking into rte_service_lcore_add(Jerin) - Given there are changes other to suggested, not using Ack --- lib/librte_eal/bsdapp/eal/eal.c | 18 ++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 05f0c1f..3e7a3a8 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -72,6 +72,7 @@ #include #include #include +#include #include #include "eal_private.h" @@ -653,6 +654,14 @@ rte_eal_init(int argc, char **argv) rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); rte_eal_mp_wait_lcore(); + /* initialize services so vdevs register service during bus_probe. */ + ret = rte_service_init(); + if (ret) { + rte_eal_init_alert("rte_service_init() failed\n"); + rte_errno = ENOEXEC; + return -1; + } + /* Probe all the buses and devices/drivers on them */ if (rte_bus_probe()) { rte_eal_init_alert("Cannot probe devices\n"); @@ -660,6 +669,15 @@ rte_eal_init(int argc, char **argv) return -1; } + /* initialize default service/lcore mappings and start running. Ignore + * -ENOTSUP, as it indicates no service coremask passed to EAL. + */ + ret = rte_service_start_with_defaults(); + if (ret < 0 && ret != -ENOTSUP) { + rte_errno = ENOEXEC; + return -1; + } + rte_eal_mcfg_complete(); return fctret; diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 7c78f2d..2914646 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" @@ -932,6 +933,14 @@ rte_eal_init(int argc, char **argv) rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); rte_eal_mp_wait_lcore(); + /* initialize services so vdevs register service during bus_probe. */ + ret = rte_service_init(); + if (ret) { + rte_eal_init_alert("rte_service_init() failed\n"); + rte_errno = ENOEXEC; + return -1; + } + /* Probe all the buses and devices/drivers on them */ if (rte_bus_probe()) { rte_eal_init_alert("Cannot probe devices\n"); @@ -939,6 +948,15 @@ rte_eal_init(int argc, char **argv) return -1; } + /* initialize default service/lcore mappings and start running. Ignore + * -ENOTSUP, as it indicates no service coremask passed to EAL. + */ + ret = rte_service_start_with_defaults(); + if (ret < 0 && ret != -ENOTSUP) { + rte_errno = ENOEXEC; + return -1; + } + rte_eal_mcfg_complete(); return fctret; -- 2.7.4