From patchwork Fri Dec 30 15:19:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 89373 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp6462096qgi; Fri, 30 Dec 2016 06:24:13 -0800 (PST) X-Received: by 10.55.162.86 with SMTP id l83mr44874462qke.17.1483107853119; Fri, 30 Dec 2016 06:24:13 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z19si29495137qkg.204.2016.12.30.06.24.12; Fri, 30 Dec 2016 06:24:13 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 029DF60A2C; Fri, 30 Dec 2016 14:24:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DF530609F1; Fri, 30 Dec 2016 14:21:07 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 46E1160A2B; Fri, 30 Dec 2016 14:21:01 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by lists.linaro.org (Postfix) with ESMTPS id 81884609F7 for ; Fri, 30 Dec 2016 14:20:19 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id c13so237812101lfg.0 for ; Fri, 30 Dec 2016 06:20:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pcGVKHgApbDlfUDpeGCminC1LnSXe8yEDJmwaKWFiHI=; b=B5n93lkKx8EQy/66To+Ly6wzafOLPAcuFZwRCbH3jJSecwbkliRi4WtSBHRYqe5wvM kBKVi0xWFWUKfTlItYV4vRXHt33Mlylq0H98MQCasaJcBPqDIPn+E2nABZn4sy3Nt2y2 lOnnjkAeJpaa2Z2FgjgvAbknysejDSsDBHgPl2fA72BmIuNXvfhQ9w/5zDvmTu/FSHRS PHRSNg/Q4+8synRxxWgEBIjGZRrqSrkrkWh/B/gfmOFopHGsPvzDqJaB3jhwQmkrDlUf 3CX3GNrYr+rtDHjI8e7yxcDQzdX0+3dVpUTIvnXSSvQxu09R+Lh2+NXFiixIKhWvJ20I j4mg== X-Gm-Message-State: AIkVDXJyvKudwt1AVc1D79TO0JYWzohpHmMRELyWLzwXNHGml0t3TgaJD4FKWVRBr9q4NssyOyU= X-Received: by 10.25.0.196 with SMTP id 187mr16155217lfa.156.1483107618284; Fri, 30 Dec 2016 06:20:18 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id t126sm13807670lff.26.2016.12.30.06.20.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Dec 2016 06:20:17 -0800 (PST) From: Christophe Milard To: francois.ozog@linaro.org, forrest.shi@linaro.org, mike.holmes@linaro.org, yi.he@linaro.org, bill.fischofer@linaro.org, petri.savolainen@nokia.com, lng-odp@lists.linaro.org Date: Fri, 30 Dec 2016 16:19:38 +0100 Message-Id: <1483111178-58507-6-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483111178-58507-1-git-send-email-christophe.milard@linaro.org> References: <1483111178-58507-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCHv8 5/5] linux-gen: modules: adding initial file to load modules X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The shared objects listed in the ODP configuration files are loaded at init time. The odp configuration file lists the shared objects to be loaded as shown in the following example: module = { modules = ["enumerator1.so", "driver1.so"]; }; Signed-off-by: Christophe Milard --- configure.ac | 4 ++-- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp_internal.h | 3 +++ platform/linux-generic/m4/configure.m4 | 1 + platform/linux-generic/odp_init.c | 7 +++++++ 5 files changed, 14 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/configure.ac b/configure.ac index 3a20959..e2b4f9d 100644 --- a/configure.ac +++ b/configure.ac @@ -55,7 +55,7 @@ AC_PROG_MAKE_SET AM_PROG_AR #Use libtool -LT_INIT([]) +LT_INIT([dlopen]) AC_SUBST([LIBTOOL_DEPS]) AM_PROG_LIBTOOL @@ -66,7 +66,7 @@ AC_CHECK_FUNCS([bzero clock_gettime gethostbyname getpagesize gettimeofday memse # Checks for header files. AC_HEADER_RESOLV -AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h dlfcn.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 9e5e095..e440129 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -173,6 +173,7 @@ __LIB__libodp_linux_la_SOURCES = \ _fdserver.c \ _ishm.c \ _ishmphy.c \ + _modules.c \ odp_atomic.c \ odp_barrier.c \ odp_buffer.c \ diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 9d1fc58..05c8a42 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -71,6 +71,7 @@ enum init_stage { CLASSIFICATION_INIT, TRAFFIC_MNGR_INIT, NAME_TABLE_INIT, + MODULES_INIT, ALL_INIT /* All init stages completed */ }; @@ -129,6 +130,8 @@ int _odp_ishm_init_local(void); int _odp_ishm_term_global(void); int _odp_ishm_term_local(void); +int _odp_modules_init_global(void); + int cpuinfo_parser(FILE *file, system_info_t *sysinfo); uint64_t odp_cpu_hz_current(int id); diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index 5fab0cc..96bec46 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -46,6 +46,7 @@ m4_include([platform/linux-generic/m4/odp_netmap.m4]) m4_include([platform/linux-generic/m4/odp_dpdk.m4]) m4_include([platform/linux-generic/m4/odp_ipc.m4]) m4_include([platform/linux-generic/m4/odp_schedule.m4]) +m4_include([platform/linux-generic/m4/odp_drivers.m4]) AC_CONFIG_FILES([platform/linux-generic/Makefile platform/linux-generic/include/odp/api/plat/static_inline.h]) diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 35160ce..0dee2ec 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -258,6 +258,12 @@ int odp_init_global(odp_instance_t *instance, ODP_ERR("ODP name table init failed\n"); goto init_failed; } + stage = NAME_TABLE_INIT; + + if (_odp_modules_init_global()) { + ODP_ERR("ODP modules init failed\n"); + goto init_failed; + } *instance = (odp_instance_t)odp_global_data.main_pid; @@ -283,6 +289,7 @@ int _odp_term_global(enum init_stage stage) switch (stage) { case ALL_INIT: + case MODULES_INIT: case NAME_TABLE_INIT: if (_odp_int_name_tbl_term_global()) { ODP_ERR("Name table term failed.\n");