From patchwork Thu Jul 9 13:46:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 50959 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4D550228E5 for ; Thu, 9 Jul 2015 13:47:58 +0000 (UTC) Received: by lbko2 with SMTP id o2sf10323776lbk.0 for ; Thu, 09 Jul 2015 06:47:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=fgtbYbVCm8OTe/GZ6IA1Xi/j7X/zNrBK6AMsLlqp6rQ=; b=S6ss+IZhRxeBYXtsZh3sS9dpHTvb62GltZIaHEpgab1qeJ5NVAyekdmCbxA/BTvSwq 3LjgSqZRHJX5Pv1/8DzJTsjdh43XXKW4hduiZ0UvqeQeTn3nuYeATVZ4pa4lmV3mvWED Vmc7lI0CjmfsKsVeo+vrKVFtL/d5TxnfHL6mAa2nxw+DVLw/edqk+XrIu/28QAx9v70l I/VXeAuWYNOs0B9iq+QZjoQ06vdqEFaSMXu3D1zENpRZ5q21AiTnCxeoY41YqIqdAVfF is65yXvKJverPrswToi01MqO4T5Zik1iptOGt+vd1+3MVrbpvak9cAArm1kiRo1w2NZ7 o9Iw== X-Gm-Message-State: ALoCoQlvuYqrG9f0FA1zEOe2X9a3tMwM8IgZ1OfBnve4y2zHApme5hHPUmHv69X2FYMrPqNj3vBq X-Received: by 10.152.27.130 with SMTP id t2mr8007203lag.2.1436449677048; Thu, 09 Jul 2015 06:47:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.197 with SMTP id ks5ls1046082lac.64.gmail; Thu, 09 Jul 2015 06:47:56 -0700 (PDT) X-Received: by 10.152.7.206 with SMTP id l14mr14844738laa.3.1436449676888; Thu, 09 Jul 2015 06:47:56 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id zl2si4868526lbb.55.2015.07.09.06.47.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 06:47:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by laar3 with SMTP id r3so247127831laa.0 for ; Thu, 09 Jul 2015 06:47:56 -0700 (PDT) X-Received: by 10.113.4.105 with SMTP id cd9mr9137909lbd.106.1436449676684; Thu, 09 Jul 2015 06:47:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp680987lbb; Thu, 9 Jul 2015 06:47:55 -0700 (PDT) X-Received: by 10.140.218.198 with SMTP id o189mr25573001qhb.47.1436449675205; Thu, 09 Jul 2015 06:47:55 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h137si6644853qhc.38.2015.07.09.06.47.54; Thu, 09 Jul 2015 06:47:55 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id 4F09061FCC; Thu, 9 Jul 2015 13:47:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8939161FD2; Thu, 9 Jul 2015 13:46:53 +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 1380861FD3; Thu, 9 Jul 2015 13:46:49 +0000 (UTC) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by lists.linaro.org (Postfix) with ESMTPS id 0CD2761F9E for ; Thu, 9 Jul 2015 13:46:37 +0000 (UTC) Received: by wgjx7 with SMTP id x7so223894270wgj.2 for ; Thu, 09 Jul 2015 06:46:36 -0700 (PDT) X-Received: by 10.180.231.40 with SMTP id td8mr88350633wic.9.1436449596162; Thu, 09 Jul 2015 06:46:36 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id df1sm8414627wib.12.2015.07.09.06.46.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 06:46:35 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 9 Jul 2015 16:46:16 +0300 Message-Id: <1436449585-23252-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436449585-23252-1-git-send-email-maxim.uvarov@linaro.org> References: <1436449585-23252-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Cc: Petri Savolainen Subject: [lng-odp] [PATCH 02/11] api: init: added thread type to local init X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Petri Savolainen User needs to select the thread type (worker or control) of the initialized thread. Implementation may reserve HW direct access only to worker threads, while control threads share HW access, etc. Signed-off-by: Petri Savolainen Signed-off-by: Maxim Uvarov Conflicts: helper/linux.c --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 2 +- helper/linux.c | 4 ++-- helper/test/odp_chksum.c | 2 +- helper/test/odp_process.c | 2 +- helper/test/odp_thread.c | 2 +- include/odp/api/init.h | 5 ++++- platform/linux-generic/odp_init.c | 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_pktio_perf.c | 2 +- test/performance/odp_scheduling.c | 2 +- test/validation/common/odp_cunit_common.c | 2 +- test/validation/crypto/crypto.c | 2 +- test/validation/synchronizers/synchronizers.c | 2 +- 17 files changed, 21 insertions(+), 18 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 643e16c..a716966 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -384,7 +384,7 @@ int main(int argc, char *argv[]) } /* Init this thread */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { EXAMPLE_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 0ff264c..76b6f42 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -599,7 +599,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { EXAMPLE_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 4928985..471a390 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1239,7 +1239,7 @@ main(int argc, char *argv[]) } /* Init this thread */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { EXAMPLE_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 0b4a8f1..a71b5d4 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -345,7 +345,7 @@ int main(int argc, char *argv[]) } /* Init this thread */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { EXAMPLE_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index f4af0e2..f184eda 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -355,7 +355,7 @@ int main(int argc, char *argv[]) } /* Init this thread. */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { printf("ODP local init failed.\n"); return -1; } diff --git a/helper/linux.c b/helper/linux.c index 46313f4..a2eacc1 100644 --- a/helper/linux.c +++ b/helper/linux.c @@ -58,7 +58,7 @@ static void *odp_run_start_routine(void *arg) odp_start_args_t *start_args = arg; /* ODP thread local init */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_WORKER)) { ODPH_ERR("Local init failed\n"); return NULL; } @@ -203,7 +203,7 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, return -2; } - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_WORKER)) { ODPH_ERR("Local init failed\n"); return -2; } diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c index dae2a5b..830ffe8 100644 --- a/helper/test/odp_chksum.c +++ b/helper/test/odp_chksum.c @@ -126,7 +126,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) exit(EXIT_FAILURE); } - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_WORKER)) { LOG_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/helper/test/odp_process.c b/helper/test/odp_process.c index 3483549..97f4669 100644 --- a/helper/test/odp_process.c +++ b/helper/test/odp_process.c @@ -33,7 +33,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) exit(EXIT_FAILURE); } - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { LOG_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c index 04c6b1e..634be96 100644 --- a/helper/test/odp_thread.c +++ b/helper/test/odp_thread.c @@ -34,7 +34,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) exit(EXIT_FAILURE); } - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { LOG_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 01faedc..0e940fc 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -30,6 +30,7 @@ extern "C" { #include #include +#include /** @defgroup odp_initialization ODP INITIALIZATION * Initialisation operations. @@ -174,10 +175,12 @@ int odp_term_global(void); * @sa odp_term_local() * @sa odp_init_global() which must have been called prior to this. * + * @param thr_type Thread type + * * @retval 0 on success * @retval <0 on failure */ -int odp_init_local(void); +int odp_init_local(odp_thread_type_t thr_type); /** diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index bf36e68..0b13a6d 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -121,7 +121,7 @@ int odp_term_global(void) return rc; } -int odp_init_local(void) +int odp_init_local(odp_thread_type_t thr_type ODP_UNUSED) { if (odp_shm_init_local()) { ODP_ERR("ODP shm local init failed.\n"); diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index dd0b4b1..3184147 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -367,7 +367,7 @@ int main(int argc, char *argv[]) } /* Init this thread */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { LOG_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 3a22f9d..c3cc54d 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -952,7 +952,7 @@ int main(int argc, char **argv) if (odp_init_global(NULL, NULL) != 0) LOG_ABORT("Failed global init.\n"); - if (odp_init_local() != 0) + if (odp_init_local(ODP_THREAD_CONTROL) != 0) LOG_ABORT("Failed local init.\n"); shm = odp_shm_reserve("test_globals", diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 99f0f9b..ee1c5da 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -860,7 +860,7 @@ int main(int argc, char *argv[]) * Init this thread. It makes also ODP calls when * setting up resources for worker threads. */ - if (odp_init_local()) { + if (odp_init_local(ODP_THREAD_CONTROL)) { LOG_ERR("ODP global init failed.\n"); return -1; } diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c index 67938f2..f7b7ea1 100644 --- a/test/validation/common/odp_cunit_common.c +++ b/test/validation/common/odp_cunit_common.c @@ -48,7 +48,7 @@ ODP_WEAK_SYMBOL int tests_global_init(void) fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } - if (0 != odp_init_local()) { + if (0 != odp_init_local(ODP_THREAD_CONTROL)) { fprintf(stderr, "error: odp_init_local() failed.\n"); return -1; } diff --git a/test/validation/crypto/crypto.c b/test/validation/crypto/crypto.c index 899fb51..9d8a02b 100644 --- a/test/validation/crypto/crypto.c +++ b/test/validation/crypto/crypto.c @@ -33,7 +33,7 @@ int tests_global_init(void) fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } - if (0 != odp_init_local()) { + if (0 != odp_init_local(ODP_THREAD_CONTROL)) { fprintf(stderr, "error: odp_init_local() failed.\n"); return -1; } diff --git a/test/validation/synchronizers/synchronizers.c b/test/validation/synchronizers/synchronizers.c index 61c6026..4f89366 100644 --- a/test/validation/synchronizers/synchronizers.c +++ b/test/validation/synchronizers/synchronizers.c @@ -1061,7 +1061,7 @@ int tests_global_init(void) fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } - if (0 != odp_init_local()) { + if (0 != odp_init_local(ODP_THREAD_CONTROL)) { fprintf(stderr, "error: odp_init_local() failed.\n"); return -1; }