From patchwork Wed Sep 10 13:22:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 37204 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B16820BF9 for ; Wed, 10 Sep 2014 13:21:23 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id m8sf1300760obr.11 for ; Wed, 10 Sep 2014 06:21:23 -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:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=7FeNF7vJxik6mX9wt3Kldcuo9S9yDtw86Qe5yWMz4X0=; b=j+yzlJ0iTzHJWOCHRrxpi8bUD9b3SNKx9jLo0Y76kYK65HY5NZdEEC/3dj+o7f2NgR lDc/3pPoe1Yj1MIP4zG15671c64/Jkvf81B9GvXTkOH05KJ8qPErxBd14iPCkMLpp8Nf tXuxXfei29pb5+pRrJf/123m54PFuylAQY0P2DUXL1Vr/ijdkmiIrDDli8OotS+ja6OP tWI+3bqXacIIgBf4dd7V7EL8tT6YF5myFq3DNLW0wskP4rvhTwJU1AtUXBpmhN1BrI5o hgd2/Vksz7T5ALViAaqMgYj4dD0CRWovgmYqNwW4BCMC1em+oBF702IlzjwQH0wAs9Bs 18aA== X-Gm-Message-State: ALoCoQmGi5UfP3in7X8uelLui9oqnbYxWy3PaUoPUSW59SXPLAFCGSQY3m0DAem3W+QNz0WHvJ7+ X-Received: by 10.50.117.10 with SMTP id ka10mr20772101igb.1.1410355283036; Wed, 10 Sep 2014 06:21:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.67 with SMTP id d61ls115371qga.94.gmail; Wed, 10 Sep 2014 06:21:22 -0700 (PDT) X-Received: by 10.52.38.134 with SMTP id g6mr17347339vdk.34.1410355282947; Wed, 10 Sep 2014 06:21:22 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id rx9si6890851vdc.64.2014.09.10.06.21.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 06:21:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so4861569vcb.31 for ; Wed, 10 Sep 2014 06:21:22 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr406138vcb.71.1410355282802; Wed, 10 Sep 2014 06:21:22 -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.221.45.67 with SMTP id uj3csp436540vcb; Wed, 10 Sep 2014 06:21:22 -0700 (PDT) X-Received: by 10.224.96.198 with SMTP id i6mr60779117qan.43.1410355281667; Wed, 10 Sep 2014 06:21:21 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id t5si18641682qat.73.2014.09.10.06.21.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Sep 2014 06:21:21 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XRhpo-0002Nq-63; Wed, 10 Sep 2014 13:21:20 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XRhpg-0002NM-F2 for lng-odp@lists.linaro.org; Wed, 10 Sep 2014 13:21:12 +0000 Received: by mail-qa0-f49.google.com with SMTP id i13so2358311qae.22 for ; Wed, 10 Sep 2014 06:21:07 -0700 (PDT) X-Received: by 10.229.231.68 with SMTP id jp4mr60007028qcb.4.1410355267221; Wed, 10 Sep 2014 06:21:07 -0700 (PDT) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id i110sm12285306qgf.29.2014.09.10.06.21.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 06:21:05 -0700 (PDT) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 10 Sep 2014 16:22:23 +0300 Message-Id: <1410355344-2938-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410355344-2938-1-git-send-email-petri.savolainen@linaro.org> References: <1410355344-2938-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/3] Use shm handle in tests X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@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.220.172 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 Tests updated to use shm handle and new addr function. Signed-off-by: Petri Savolainen --- example/generator/odp_generator.c | 13 +++++++++---- example/l2fwd/odp_l2fwd.c | 13 +++++++++---- example/odp_example/odp_example.c | 12 ++++++++++-- example/packet/odp_pktio.c | 13 +++++++++---- example/timer/odp_timer_test.c | 6 ++++-- test/api_test/odp_shm_test.c | 10 +++++++--- test/api_test/odp_timer_ping.c | 6 ++++-- 7 files changed, 52 insertions(+), 21 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 10c7b31..27fc868 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -523,6 +523,7 @@ int main(int argc, char *argv[]) int i; int first_core; int core_count; + odp_shm_t shm; /* Init ODP before calling anything else */ if (odp_init_global()) { @@ -537,8 +538,10 @@ int main(int argc, char *argv[]) odp_atomic_init_u64(&counters.icmp); /* Reserve memory for args from shared mem */ - args = odp_shm_reserve("shm_args", sizeof(args_t), - ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_args", sizeof(args_t), + ODP_CACHE_LINE_SIZE, 0); + args = odp_shm_addr(shm); + if (args == NULL) { ODP_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); @@ -582,8 +585,10 @@ int main(int argc, char *argv[]) odp_init_local(thr_id); /* Create packet pool */ - pool_base = odp_shm_reserve("shm_packet_pool", - SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_packet_pool", + SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + pool_base = odp_shm_addr(shm); + if (pool_base == NULL) { ODP_ERR("Error: packet pool mem alloc failed.\n"); exit(EXIT_FAILURE); diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index e19aa94..6c1d64a 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -321,6 +321,7 @@ int main(int argc, char *argv[]) int first_core; int core_count; odp_pktio_t pktio; + odp_shm_t shm; /* Init ODP before calling anything else */ if (odp_init_global()) { @@ -329,8 +330,10 @@ int main(int argc, char *argv[]) } /* Reserve memory for args from shared mem */ - gbl_args = odp_shm_reserve("shm_args", sizeof(args_t), - ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_args", sizeof(args_t), + ODP_CACHE_LINE_SIZE, 0); + gbl_args = odp_shm_addr(shm); + if (gbl_args == NULL) { ODP_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); @@ -380,8 +383,10 @@ int main(int argc, char *argv[]) odp_init_local(thr_id); /* Create packet pool */ - pool_base = odp_shm_reserve("shm_packet_pool", - SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_packet_pool", + SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + pool_base = odp_shm_addr(shm); + if (pool_base == NULL) { ODP_ERR("Error: packet pool mem alloc failed.\n"); exit(EXIT_FAILURE); diff --git a/example/odp_example/odp_example.c b/example/odp_example/odp_example.c index e99df85..c80dbbc 100644 --- a/example/odp_example/odp_example.c +++ b/example/odp_example/odp_example.c @@ -943,6 +943,7 @@ int main(int argc, char *argv[]) int i, j; int prios; int first_core; + odp_shm_t shm; printf("\nODP example starts\n"); @@ -1003,8 +1004,15 @@ int main(int argc, char *argv[]) /* * Create message pool */ - pool_base = odp_shm_reserve("msg_pool", - MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("msg_pool", + MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + + pool_base = odp_shm_addr(shm); + + if (pool_base == NULL) { + ODP_ERR("Shared memory reserve failed.\n"); + return -1; + } pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE, sizeof(test_message_t), diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 7f2d43f..41315f7 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -309,6 +309,7 @@ int main(int argc, char *argv[]) int i; int first_core; int core_count; + odp_shm_t shm; /* Init ODP before calling anything else */ if (odp_init_global()) { @@ -317,8 +318,10 @@ int main(int argc, char *argv[]) } /* Reserve memory for args from shared mem */ - args = odp_shm_reserve("shm_args", sizeof(args_t), - ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_args", sizeof(args_t), + ODP_CACHE_LINE_SIZE, 0); + args = odp_shm_addr(shm); + if (args == NULL) { ODP_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); @@ -358,8 +361,10 @@ int main(int argc, char *argv[]) odp_init_local(thr_id); /* Create packet pool */ - pool_base = odp_shm_reserve("shm_packet_pool", - SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("shm_packet_pool", + SHM_PKT_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + pool_base = odp_shm_addr(shm); + if (pool_base == NULL) { ODP_ERR("Error: packet pool mem alloc failed.\n"); exit(EXIT_FAILURE); diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index fd46f16..6e1715d 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -248,6 +248,7 @@ int main(int argc, char *argv[]) int first_core; uint64_t cycles, ns; odp_queue_param_t param; + odp_shm_t shm; printf("\nODP timer example starts\n"); @@ -310,8 +311,9 @@ int main(int argc, char *argv[]) /* * Create message pool */ - pool_base = odp_shm_reserve("msg_pool", - MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("msg_pool", + MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + pool_base = odp_shm_addr(shm); pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE, 0, diff --git a/test/api_test/odp_shm_test.c b/test/api_test/odp_shm_test.c index 376b06f..6208e78 100644 --- a/test/api_test/odp_shm_test.c +++ b/test/api_test/odp_shm_test.c @@ -19,6 +19,7 @@ static void *run_thread(void *arg) { pthrd_arg *parg = (pthrd_arg *)arg; int thr; + odp_shm_t shm; thr = odp_thread_id(); @@ -26,7 +27,8 @@ static void *run_thread(void *arg) switch (parg->testcase) { case ODP_SHM_TEST: - test_shared_data = odp_shm_lookup("test_shared_data"); + shm = odp_shm_lookup("test_shared_data"); + test_shared_data = odp_shm_addr(shm); printf(" [%i] shared data at %p\n", thr, test_shared_data); break; default: @@ -40,14 +42,16 @@ static void *run_thread(void *arg) int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { pthrd_arg thrdarg; + odp_shm_t shm; if (odp_test_global_init() != 0) return -1; odp_print_system_info(); - test_shared_data = odp_shm_reserve("test_shared_data", - sizeof(test_shared_data_t), 128, 0); + shm = odp_shm_reserve("test_shared_data", + sizeof(test_shared_data_t), 128, 0); + test_shared_data = odp_shm_addr(shm); memset(test_shared_data, 0, sizeof(test_shared_data_t)); printf("test shared data at %p\n\n", test_shared_data); diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c index a31567a..5ae379f 100644 --- a/test/api_test/odp_timer_ping.c +++ b/test/api_test/odp_timer_ping.c @@ -315,6 +315,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) odp_buffer_pool_t pool; void *pool_base; int i; + odp_shm_t shm; if (odp_test_global_init() != 0) return -1; @@ -327,8 +328,9 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) /* * Create message pool */ - pool_base = odp_shm_reserve("msg_pool", - MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + shm = odp_shm_reserve("msg_pool", + MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE, 0); + pool_base = odp_shm_addr(shm); pool = odp_buffer_pool_create("msg_pool", pool_base, MSG_POOL_SIZE, BUF_SIZE,