[lng-odp] [PATCH] Update schedule test for new odp_buffer_pool_create() API

2014-12-12 Thread Bill Fischofer
Necessary update for odp_schedule test to reflect buffer pool API changes
for ODP v0.5.  

Signed-off-by: Bill Fischofer 
---
 test/validation/odp_schedule.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
index 9d410e4..31be742 100644
--- a/test/validation/odp_schedule.c
+++ b/test/validation/odp_schedule.c
@@ -510,22 +510,18 @@ static int create_queues(void)
 static int schd_suite_init(void)
 {
odp_shm_t shm;
-   void *pool_base;
odp_buffer_pool_t pool;
test_globals_t *globals;
thread_args_t *thr_args;
+   odp_buffer_pool_param_t params;
 
-   shm = odp_shm_reserve(SHM_MSG_POOL_NAME, MSG_POOL_SIZE,
- ODP_CACHE_LINE_SIZE, 0);
-   pool_base = odp_shm_addr(shm);
-   if (pool_base == NULL) {
-   printf("Shared memory reserve failed.\n");
-   return -1;
-   }
+   params.buf_size  = BUF_SIZE;
+   params.buf_align = 0;
+   params.num_bufs  = MSG_POOL_SIZE/BUF_SIZE;
+   params.buf_type  = ODP_BUFFER_TYPE_RAW;
+
+   pool = odp_buffer_pool_create(MSG_POOL_NAME, ODP_SHM_NULL, ¶ms);
 
-   pool = odp_buffer_pool_create(MSG_POOL_NAME, pool_base, MSG_POOL_SIZE,
- BUF_SIZE, ODP_CACHE_LINE_SIZE,
- ODP_BUFFER_TYPE_RAW);
if (pool == ODP_BUFFER_POOL_INVALID) {
printf("Pool creation failed (msg).\n");
return -1;
-- 
1.8.3.2


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 975] odp_crypto.c linux_generic missing implimentations

2014-12-12 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=975

Taras Kondratiuk  changed:

   What|Removed |Added

 Status|CONFIRMED   |IN_PROGRESS

--- Comment #1 from Taras Kondratiuk  ---
Except missing functions there was a bug with IV handling.
Posted fixes:
http://lists.linaro.org/pipermail/lng-odp/2014-December/006394.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 3/3] linux-generic: crypto: implement odp_crypto_get_operation_compl_packet()

2014-12-12 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk 
---
 platform/linux-generic/include/odp_crypto_internal.h |  1 +
 platform/linux-generic/odp_crypto.c  | 13 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/include/odp_crypto_internal.h 
b/platform/linux-generic/include/odp_crypto_internal.h
index 6ecfe80..8a50d60 100644
--- a/platform/linux-generic/include/odp_crypto_internal.h
+++ b/platform/linux-generic/include/odp_crypto_internal.h
@@ -70,6 +70,7 @@ typedef struct odp_crypto_generic_op_result {
odp_crypto_compl_status_t cipher;
odp_crypto_compl_status_t auth;
void* op_context;
+   odp_packet_t out_pkt;
 } odp_crypto_generic_op_result_t;
 
 /**
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index e605d59..d611cc6 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -386,6 +386,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
result->cipher.hw_err = ODP_CRYPTO_HW_ERR_NONE;
result->auth.alg_err = rc_auth;
result->auth.hw_err = ODP_CRYPTO_HW_ERR_NONE;
+   result->out_pkt = params->out_pkt;
 
/* If specified during creation post event to completion queue */
if (ODP_QUEUE_INVALID != session->compl_queue) {
@@ -476,8 +477,14 @@ void
 }
 
 odp_packet_t
-odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event ODP_UNUSED)
+odp_crypto_get_operation_compl_packet(odp_buffer_t completion_event)
 {
-   ODP_UNIMPLEMENTED();
-   return ODP_PACKET_INVALID;
+   odp_crypto_generic_op_result_t *result;
+
+   result = get_op_result_from_buffer(completion_event);
+   ODP_ASSERT(OP_RESULT_MAGIC == result->magic, "Bad completion magic");
+   ODP_ASSERT(odp_buffer_type(completion_event == ODP_BUFFER_TYPE_PACKET),
+   "Completion is not a packet");
+
+   return result->out_pkt;
 }
-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 2/3] linux-generic: crypto: implement completion event context

2014-12-12 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk 
---
 .../linux-generic/include/odp_crypto_internal.h|  1 +
 platform/linux-generic/odp_crypto.c| 28 +-
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_crypto_internal.h 
b/platform/linux-generic/include/odp_crypto_internal.h
index 04db333..6ecfe80 100644
--- a/platform/linux-generic/include/odp_crypto_internal.h
+++ b/platform/linux-generic/include/odp_crypto_internal.h
@@ -69,6 +69,7 @@ typedef struct odp_crypto_generic_op_result {
uint32_t magic;
odp_crypto_compl_status_t cipher;
odp_crypto_compl_status_t auth;
+   void* op_context;
 } odp_crypto_generic_op_result_t;
 
 /**
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index a2d4ab8..e605d59 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -446,17 +446,33 @@ odp_crypto_get_operation_compl_status(odp_buffer_t 
completion_event,
 
 
 void
-odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED,
-  void *ctx ODP_UNUSED)
+odp_crypto_set_operation_compl_ctx(odp_buffer_t completion_event,
+  void *ctx)
 {
-   ODP_UNIMPLEMENTED();
+   odp_crypto_generic_op_result_t *result;
+
+   result = get_op_result_from_buffer(completion_event);
+   /*
+* Completion event magic can't be checked here, because it is filled
+* later in odp_crypto_operation() function.
+*/
+   ODP_ASSERT(odp_buffer_type(completion_event == ODP_BUFFER_TYPE_PACKET),
+   "Completion is not a packet");
+
+   result->op_context = ctx;
 }
 
 void
-*odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event ODP_UNUSED)
+*odp_crypto_get_operation_compl_ctx(odp_buffer_t completion_event)
 {
-   ODP_UNIMPLEMENTED();
-   return NULL;
+   odp_crypto_generic_op_result_t *result;
+
+   result = get_op_result_from_buffer(completion_event);
+   ODP_ASSERT(OP_RESULT_MAGIC == result->magic, "Bad completion magic");
+   ODP_ASSERT(odp_buffer_type(completion_event == ODP_BUFFER_TYPE_PACKET),
+   "Completion is not a packet");
+
+   return result->op_context;
 }
 
 odp_packet_t
-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 1/3] linux-generic: crypto: always make a copy of IV

2014-12-12 Thread Taras Kondratiuk
DES library modifies IV buffer in-place. Current code handles this
correctly only in case of encryption operation with session IV.
To prevent user buffer modifications always make a copy of a
provided IV.

Signed-off-by: Taras Kondratiuk 
---
 platform/linux-generic/odp_crypto.c | 50 +
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index d3cdec7..a2d4ab8 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -147,30 +147,25 @@ enum crypto_alg_err des_encrypt(odp_crypto_op_params_t 
*params,
 {
uint8_t *data  = odp_packet_addr(params->out_pkt);
uint32_t len   = params->cipher_range.length;
-   DES_cblock *iv = NULL;
-   DES_cblock iv_temp;
+   DES_cblock iv;
+   void *iv_ptr;
+
+   if (params->override_iv_ptr)
+   iv_ptr = params->override_iv_ptr;
+   else if (session->cipher.iv.data)
+   iv_ptr = session->cipher.iv.data;
+   else
+   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
 
/*
 * Create a copy of the IV.  The DES library modifies IV
 * and if we are processing packets on parallel threads
 * we could get corruption.
 */
-   if (session->cipher.iv.data) {
-   memcpy(iv_temp, session->cipher.iv.data, sizeof(iv_temp));
-   iv = &iv_temp;
-   }
+   memcpy(iv, iv_ptr, sizeof(iv));
 
/* Adjust pointer for beginning of area to cipher */
data += params->cipher_range.offset;
-
-   /* Override IV if requested */
-   if (params->override_iv_ptr)
-   iv = (DES_cblock *)params->override_iv_ptr;
-
-   /* No session or operation IV */
-   if (!iv)
-   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
-
/* Encrypt it */
DES_ede3_cbc_encrypt(data,
 data,
@@ -178,7 +173,7 @@ enum crypto_alg_err des_encrypt(odp_crypto_op_params_t 
*params,
 &session->cipher.data.des.ks1,
 &session->cipher.data.des.ks2,
 &session->cipher.data.des.ks3,
-iv,
+&iv,
 1);
 
return ODP_CRYPTO_ALG_ERR_NONE;
@@ -190,15 +185,26 @@ enum crypto_alg_err des_decrypt(odp_crypto_op_params_t 
*params,
 {
uint8_t *data  = odp_packet_addr(params->out_pkt);
uint32_t len   = params->cipher_range.length;
-   DES_cblock *iv = (DES_cblock *)session->cipher.iv.data;
+   DES_cblock iv;
+   void *iv_ptr;
+
+   if (params->override_iv_ptr)
+   iv_ptr = params->override_iv_ptr;
+   else if (session->cipher.iv.data)
+   iv_ptr = session->cipher.iv.data;
+   else
+   return ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER;
+
+   /*
+* Create a copy of the IV.  The DES library modifies IV
+* and if we are processing packets on parallel threads
+* we could get corruption.
+*/
+   memcpy(iv, iv_ptr, sizeof(iv));
 
/* Adjust pointer for beginning of area to cipher */
data += params->cipher_range.offset;
 
-   /* Override IV if requested */
-   if (params->override_iv_ptr)
-   iv = (DES_cblock *)params->override_iv_ptr;
-
/* Decrypt it */
DES_ede3_cbc_encrypt(data,
 data,
@@ -206,7 +212,7 @@ enum crypto_alg_err des_decrypt(odp_crypto_op_params_t 
*params,
 &session->cipher.data.des.ks1,
 &session->cipher.data.des.ks2,
 &session->cipher.data.des.ks3,
-iv,
+&iv,
 0);
 
return ODP_CRYPTO_ALG_ERR_NONE;
-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 0/3] linux-generic: crypto: fix validation tests failures

2014-12-12 Thread Taras Kondratiuk
This series fixes all crypto tests failures.

Suite: odp_crypto_sync_inp
  Test: ENC_ALG_3DES_CBC ...passed
  Test: DEC_ALG_3DES_CBC ...passed
  Test: ENC_ALG_3DES_CBC_OVR_IV ...passed
  Test: DEC_ALG_3DES_CBC_OVR_IV ...passed
  Test: ALG_HMAC_MD5 ...passed
Suite: odp_crypto_async_inp
  Test: ENC_ALG_3DES_CBC ...passed
  Test: DEC_ALG_3DES_CBC ...passed
  Test: ENC_ALG_3DES_CBC_OVR_IV ...passed
  Test: DEC_ALG_3DES_CBC_OVR_IV ...passed
  Test: ALG_HMAC_MD5 ...passed
  Test: ENC_ALG_3DES_CBC_COMPL_NEW ...passed
Suite: ODP_CRYPTO_RNG
  Test: RNG_GET_SIZE ...passed

Run Summary:Type  TotalRan Passed Failed Inactive
  suites  3  3n/a  00
   tests 12 12 12  00
 asserts299299299  0  n/a

Taras Kondratiuk (3):
  linux-generic: crypto: always make a copy of IV
  linux-generic: crypto: implement completion event context
  linux-generic: crypto: implement odp_crypto_get_operation_compl_packet()

 .../linux-generic/include/odp_crypto_internal.h|  2 +
 platform/linux-generic/odp_crypto.c| 91 ++
 2 files changed, 62 insertions(+), 31 deletions(-)

-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Ola Liljedahl
On 12 December 2014 at 16:59, Mike Holmes  wrote:
>
>
> On 12 December 2014 at 10:51, Maxim Uvarov  wrote:
>>
>> On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:
>>>
>>> On 12/12/2014 05:03 PM, Maxim Uvarov wrote:

 Odp atomic operations based on compiler build-ins. Make
 sure that compiler supports such operation at configure
 stage.
>>>
>>> This check should be limited to platforms that use gcc atomics.
>>
>> Do we have such platforms?
>
>
> __OCTEON__ directly swappes out gcc, infact that pre processor switch
> affects other files in linux-generic too.
>
> static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom)
> {
> #if defined __OCTEON__
>>---uint32_t ret;
>>---__asm__ __volatile__ ("syncws");
>>---__asm__ __volatile__ ("lai %0,(%2)" : "=r" (ret), "+m" (atom) :
>>--->--->---  "r" (atom));
>>---return ret;
> #else
>>---return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED);
> #endif
> }
This is an OCTEON-special for just one function. I didn't want to
remove it. But I am not sure it is actually needed. Shouldn't the
compiler be able to generate the appropriate OCTEON-specific
instructions (e.g. laa(d), saa(d), lai(d), lad(d) etc), gcc has
supported OCTEON since version 4.4? Also I don't understand the reason
for the syncw *before* the lai (load-atomic-increment) but perhaps the
load-atomic instructions (which shouldn't linger in the write buffer
like stores) need to be treated differently.

I think this OCTEON-fix should either be removed or there should be
specials for most if not all of the functions in odp_atomic.h
>
>
>>
>>
>>
>> Maxim.
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> --
> Mike Holmes
> Linaro  Sr Technical Manager
> LNG - ODP
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH v2] validation: add odp_system test

2014-12-12 Thread Mike Holmes
Add tests for ODP system_info interface

Signed-off-by: Mike Holmes 
---

This api has poor documentaion, these testis attempt to do something sensible
against linux-generic in its present form.

 test/validation/.gitignore   |  1 +
 test/validation/Makefile.am  |  4 ++-
 test/validation/odp_system.c | 73 
 3 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/odp_system.c

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 32834ae..a388488 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -5,3 +5,4 @@ odp_queue
 odp_crypto
 odp_schedule
 odp_shm
+odp_system
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index d0b5426..98376b9 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,7 +6,7 @@ AM_LDFLAGS += -static
 if ODP_CUNIT_ENABLED
 TESTS = ${bin_PROGRAMS}
 check_PROGRAMS = ${bin_PROGRAMS}
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
 odp_init_LDFLAGS = $(AM_LDFLAGS)
 odp_queue_LDFLAGS = $(AM_LDFLAGS)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
@@ -15,6 +15,7 @@ odp_shm_CFLAGS = $(AM_CFLAGS)
 odp_shm_LDFLAGS = $(AM_LDFLAGS)
 odp_schedule_CFLAGS = $(AM_CFLAGS)
 odp_schedule_LDFLAGS = $(AM_LDFLAGS)
+odp_system_LDFLAGS = $(AM_LDFLAGS)
 endif
 
 dist_odp_init_SOURCES = odp_init.c
@@ -25,6 +26,7 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
+dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
 
 #For Linux generic the unimplemented crypto API functions break the
 #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
new file mode 100644
index 000..dfad677
--- /dev/null
+++ b/test/validation/odp_system.c
@@ -0,0 +1,73 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "odp.h"
+#include "odp_cunit_common.h"
+
+static void test_odp_sys_core_count(void)
+{
+   int cores;
+
+   cores = odp_sys_core_count();
+   CU_ASSERT(0 < cores);
+}
+
+static void test_odp_sys_cache_line_size(void)
+{
+   int cache_size;
+
+   cache_size = odp_sys_cache_line_size();
+   CU_ASSERT(0 < cache_size);
+}
+
+static void test_odp_sys_cpu_model_str(void)
+{
+   char model[128];
+
+   snprintf(model, 128, "%s", odp_sys_cpu_model_str());
+   CU_ASSERT(strlen(model) <= 127);
+   CU_ASSERT_PTR_NOT_NULL(odp_sys_cpu_model_str());
+}
+
+static void test_odp_sys_page_size(void)
+{
+   uint64_t page;
+
+   page = odp_sys_page_size();
+   CU_ASSERT(0 < page);
+}
+
+static void test_odp_sys_huge_page_size(void)
+{
+   uint64_t page;
+
+   page = odp_sys_huge_page_size();
+   CU_ASSERT(0 < page || 0 == page);
+}
+
+static void test_odp_sys_cpu_hz(void)
+{
+   uint64_t hz;
+
+   hz = odp_sys_cpu_hz();
+   CU_ASSERT(0 < hz);
+}
+
+CU_TestInfo test_odp_system[] = {
+   {"odp_sys_core_count",  test_odp_sys_core_count},
+   {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
+   {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
+   {"odp_sys_page_size",  test_odp_sys_page_size},
+   {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
+   {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
+   CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo odp_testsuites[] = {
+   {"System Info", NULL, NULL, NULL, NULL,
+test_odp_system},
+CU_SUITE_INFO_NULL,
+};
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] example/odp_pktio parse args before odp init

2014-12-12 Thread Mike Holmes
On 12 December 2014 at 06:12, Maxim Uvarov  wrote:
>
> No need to init odp if example args are not valid.
> https://bugs.linaro.org/show_bug.cgi?id=856
>
> Signed-off-by: Maxim Uvarov 
>

Reviewed-by: Mike Holmes 


> ---
>  example/packet/odp_pktio.c | 24 ++--
>  1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index eceee15..607ecbf 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -337,6 +337,15 @@ int main(int argc, char *argv[])
> int core_count;
> odp_shm_t shm;
>
> +   args = calloc(1, sizeof(args_t));
> +   if (args == NULL) {
> +   EXAMPLE_ERR("Error: args mem alloc failed.\n");
> +   exit(EXIT_FAILURE);
> +   }
> +
> +   /* Parse and store the application arguments */
> +   parse_args(argc, argv, &args->appl);
> +
> /* Init ODP before calling anything else */
> if (odp_init_global(NULL, NULL)) {
> EXAMPLE_ERR("Error: ODP global init failed.\n");
> @@ -349,20 +358,6 @@ int main(int argc, char *argv[])
> exit(EXIT_FAILURE);
> }
>
> -   /* Reserve memory for args from shared mem */
> -   shm = odp_shm_reserve("shm_args", sizeof(args_t),
> - ODP_CACHE_LINE_SIZE, 0);
> -   args = odp_shm_addr(shm);
> -
> -   if (args == NULL) {
> -   EXAMPLE_ERR("Error: shared mem alloc failed.\n");
> -   exit(EXIT_FAILURE);
> -   }
> -   memset(args, 0, sizeof(*args));
> -
> -   /* Parse and store the application arguments */
> -   parse_args(argc, argv, &args->appl);
> -
> /* Print both system and application information */
> print_info(NO_PATH(argv[0]), &args->appl);
>
> @@ -441,6 +436,7 @@ int main(int argc, char *argv[])
> /* Master thread waits for other threads to exit */
> odph_linux_pthread_join(thread_tbl, num_workers);
>
> +   free(args);
> printf("Exit\n\n");
>
> return 0;
> --
> 1.8.5.1.163.gd7aced9
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>


-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation:add atomic test in odp syncronizers

2014-12-12 Thread Mike Holmes
Synchronize with Mario, but we don't want to lose any extra functionality
in combining all the work.

I assume that test/validation/sync  (synchronizers)  will contain one test
suite each for for atomics, rwlock, spin lock and ticket lock and all of
those test suites will be called from a top level test/validation/odp_sync
test.

Mike

On 12 December 2014 at 03:43, yan.songm...@linaro.org <
yan.songm...@linaro.org> wrote:
>
> Mike,
> I think Barry's patch is cover the lock, and my patch cover the atomic.
>
> But I still have some cards about the rwlock, spin lock and ticket lock.
>
> So ,should  I write a new one accord Barry's patch or just use his code
> and change it suitable for our  sunny day test if necessary  ?
> I prefer the second.
>
> Thanks,
> Yan
> --
> yan.songm...@linaro.org
>
>
> *From:* Mike Holmes 
> *Date:* 2014-12-12 03:09
> *To:* Ola Liljedahl 
> *CC:* Yan Sonming ; Barry Spinney
> ; lng-odp 
> *Subject:* Re: [lng-odp] [PATCH] validation:add atomic test in odp
> syncronizers
>
>
> On 11 December 2014 at 04:36, Ola Liljedahl 
> wrote:
>
>> Are these cunit tests for odp_atomic.h only?
>> Are there any cunit tests for plain spin locks, ticket locks, rwlocks etc?
>>
>
> Yes, Mario has Barrys code as the basis.
>
>
>>
>> -- Ola
>>
>>
>> On 10 December 2014 at 20:42, Mike Holmes  wrote:
>> > I think odp_syne would be better as odp_sync  throughout the patch
>> >
>> > Does Barrys patch cover atomics in an overlapping way, or do we have
>> both as
>> > separate suites ? I think this one is much more sunny day as we had
>> > originally planned.
>> > Mario were you able to make the final changes to create a patch for tip
>> from
>> > Barrys files, do we need to wait until we can see that patch along side
>> this
>> > one ?
>> >
>> > Mike
>> >
>> >
>> > On 9 December 2014 at 22:19, Yan Sonming 
>> wrote:
>> >>
>> >> Remove odp_atomic_test in test/api_test and  add the odp_atomic_test
>> >> to test/validation as one part of odp syncronizers test
>> >
>> >
>> > syncronizers
>> >
>> >>
>> >>
>> >> Signed-off-by: Yan Songming 
>> >> ---
>> >>  test/api_test/Makefile.am  |   5 +-
>> >>  test/api_test/odp_atomic_test.c| 299
>> >> -
>> >>  test/api_test/odp_atomic_test.h|  51 --
>> >>  test/api_test/odp_common.c |   1 -
>> >>  test/validation/.gitignore |   1 +
>> >>  test/validation/Makefile.am|   6 +-
>> >>  test/validation/odp_syne.c |  15 ++
>> >>  test/validation/syne/odp_test_atomic.c | 258
>> 
>> >>  test/validation/syne/odp_test_atomic.h |  14 ++
>> >>  9 files changed, 294 insertions(+), 356 deletions(-)
>> >>  delete mode 100644 test/api_test/odp_atomic_test.c
>> >>  delete mode 100644 test/api_test/odp_atomic_test.h
>> >>  create mode 100644 test/validation/odp_syne.c
>> >>  create mode 100644 test/validation/syne/odp_test_atomic.c
>> >>  create mode 100644 test/validation/syne/odp_test_atomic.h
>> >>
>> >> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
>> >> index 74e8612..ce301ce 100644
>> >> --- a/test/api_test/Makefile.am
>> >> +++ b/test/api_test/Makefile.am
>> >> @@ -1,18 +1,15 @@
>> >>  include $(top_srcdir)/test/Makefile.inc
>> >>
>> >> -bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping
>> >> +bin_PROGRAMS = odp_shm odp_ring odp_timer_ping
>> >>
>> >> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>> >>  odp_shm_CFLAGS = $(AM_CFLAGS)
>> >>  odp_ring_CFLAGS = $(AM_CFLAGS)
>> >>  odp_timer_ping_CFLAGS = $(AM_CFLAGS)
>> >>
>> >> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>> >>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>> >>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>> >>  odp_timer_ping_LDFLAGS = $(AM_LDFLAGS) -static
>> >>
>> >> -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>> >>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>> >>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
>> >>  dist_odp_timer_ping_SOURCES = odp_timer_ping.c odp_common.c
>> >> diff --git a/test/api_test/odp_atomic_test.c
>> >> b/test/api_test/odp_atomic_test.c
>> >> deleted file mode 100644
>> >> index 5563606..000
>> >> --- a/test/api_test/odp_atomic_test.c
>> >> +++ /dev/null
>> >> @@ -1,299 +0,0 @@
>> >> -/* Copyright (c) 2013, Linaro Limited
>> >> - * All rights reserved.
>> >> - *
>> >> - * SPDX-License-Identifier: BSD-3-Clause
>> >> - */
>> >> -
>> >> -#include 
>> >> -#include 
>> >> -#include 
>> >> -#include 
>> >> -#include 
>> >> -
>> >> -static odp_atomic_u32_t a32u;
>> >> -static odp_atomic_u64_t a64u;
>> >> -
>> >> -static odp_barrier_t barrier;
>> >> -
>> >> -static const char * const test_name[] = {
>> >> -   "dummy",
>> >> -   "test atomic all (add/sub/inc/dec) on 32- and 64-bit atomic
>> ints",
>> >> -   "test atomic inc/dec of 32-bit atomic int",
>> >> -   "test atomic add/sub of 32-bit atomic int",
>> >> -   "test atomic inc/dec of 64-bit atomic int",
>> >> -  

[lng-odp] [PATCH 2/3] example: odp_timer_test: delete bad example

2014-12-12 Thread Mike Holmes
The timer example is actually named odp_timer_test indicating it is not an
example. It is widely regarded as a poor example and not a great test.
It now attempts to use odp_schedule_one which has been removed from the API.

This test should be removed and replaced with a better example written
from scratch.

Signed-off-by: Mike Holmes 
---
 example/Makefile.am|   2 +-
 example/timer/.gitignore   |   1 -
 example/timer/Makefile.am  |   7 -
 example/timer/odp_timer_test.c | 389 -
 4 files changed, 1 insertion(+), 398 deletions(-)
 delete mode 100644 example/timer/.gitignore
 delete mode 100644 example/timer/Makefile.am
 delete mode 100644 example/timer/odp_timer_test.c

diff --git a/example/Makefile.am b/example/Makefile.am
index b2a22a3..b933653 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -1 +1 @@
-SUBDIRS = generator ipsec l2fwd odp_example packet timer
+SUBDIRS = generator ipsec l2fwd odp_example packet
diff --git a/example/timer/.gitignore b/example/timer/.gitignore
deleted file mode 100644
index eb59265..000
--- a/example/timer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-odp_timer_test
diff --git a/example/timer/Makefile.am b/example/timer/Makefile.am
deleted file mode 100644
index dffd4eb..000
--- a/example/timer/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_srcdir)/example/Makefile.inc
-
-bin_PROGRAMS = odp_timer_test
-odp_timer_test_LDFLAGS = $(AM_LDFLAGS) -static
-odp_timer_test_CFLAGS = $(AM_CFLAGS) -I../
-
-dist_odp_timer_test_SOURCES = odp_timer_test.c
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
deleted file mode 100644
index 9968bfe..000
--- a/example/timer/odp_timer_test.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/**
- * @file
- *
- * @example  odp_timer_test.c ODP timer example application
- */
-
-#include 
-#include 
-
-#include 
-
-/* ODP main header */
-#include 
-
-/* ODP helper for Linux apps */
-#include 
-
-/* GNU lib C */
-#include 
-
-
-#define MAX_WORKERS   32/**< Max worker threads */
-#define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */
-
-
-/** Test arguments */
-typedef struct {
-   int core_count;/**< Core count*/
-   int resolution_us; /**< Timeout resolution in usec*/
-   int min_us;/**< Minimum timeout in usec*/
-   int max_us;/**< Maximum timeout in usec*/
-   int period_us; /**< Timeout period in usec*/
-   int tmo_count; /**< Timeout count*/
-} test_args_t;
-
-
-/** @private Barrier for test synchronisation */
-static odp_barrier_t test_barrier;
-
-/** @private Timer handle*/
-static odp_timer_t test_timer;
-
-
-/** @private test timeout */
-static void test_abs_timeouts(int thr, test_args_t *args)
-{
-   uint64_t tick;
-   uint64_t period;
-   uint64_t period_ns;
-   odp_queue_t queue;
-   odp_buffer_t buf;
-   int num;
-
-   EXAMPLE_DBG("  [%i] test_timeouts\n", thr);
-
-   queue = odp_queue_lookup("timer_queue");
-
-   period_ns = args->period_us*ODP_TIME_USEC;
-   period= odp_timer_ns_to_tick(test_timer, period_ns);
-
-   EXAMPLE_DBG("  [%i] period %"PRIu64" ticks,  %"PRIu64" ns\n", thr,
-   period, period_ns);
-
-   tick = odp_timer_current_tick(test_timer);
-
-   EXAMPLE_DBG("  [%i] current tick %"PRIu64"\n", thr, tick);
-
-   tick += period;
-
-   if (odp_timer_absolute_tmo(test_timer, tick, queue, ODP_BUFFER_INVALID)
-   == ODP_TIMER_TMO_INVALID){
-   EXAMPLE_DBG("Timeout request failed\n");
-   return;
-   }
-
-   num = args->tmo_count;
-
-   while (1) {
-   odp_timeout_t tmo;
-
-   buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
-
-   tmo  = odp_timeout_from_buffer(buf);
-   tick = odp_timeout_tick(tmo);
-
-   EXAMPLE_DBG("  [%i] timeout, tick %"PRIu64"\n", thr, tick);
-
-   odp_buffer_free(buf);
-
-   num--;
-
-   if (num == 0)
-   break;
-
-   tick += period;
-
-   odp_timer_absolute_tmo(test_timer, tick,
-  queue, ODP_BUFFER_INVALID);
-   }
-
-   if (odp_queue_sched_type(queue) == ODP_SCHED_SYNC_ATOMIC)
-   odp_schedule_release_atomic();
-}
-
-
-/**
- * @internal Worker thread
- *
- * @param ptr  Pointer to test arguments
- *
- * @return Pointer to exit status
- */
-static void *run_thread(void *ptr)
-{
-   int thr;
-   odp_buffer_pool_t msg_pool;
-   test_args_t *args;
-
-   args = ptr;
-   thr  = odp_thread_id();
-
-   printf("Thread %i starts on core %i\n", thr, odp_thread_core());
-
-   /*
-* Find the buffer pool
-*/
-   msg_pool = odp_buffer_pool_lookup("msg_pool");
-

[lng-odp] [PATCH 3/3] api: schedule: remove odp_schedule_one

2014-12-12 Thread Mike Holmes
For the initial realease this api has been removed from the
specification.

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/include/api/odp_schedule.h | 25 ---
 platform/linux-generic/odp_schedule.c | 12 ---
 2 files changed, 37 deletions(-)

diff --git a/platform/linux-generic/include/api/odp_schedule.h 
b/platform/linux-generic/include/api/odp_schedule.h
index 91fec10..cdf6705 100644
--- a/platform/linux-generic/include/api/odp_schedule.h
+++ b/platform/linux-generic/include/api/odp_schedule.h
@@ -64,31 +64,6 @@ uint64_t odp_schedule_wait_time(uint64_t ns);
 odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait);
 
 /**
- * Schedule one buffer
- *
- * Like odp_schedule(), but is quaranteed to schedule only one buffer at a 
time.
- * Each call will perform global scheduling and will reserve one buffer per
- * thread in maximum. When called after other schedule functions, returns
- * locally stored buffers (if any) first, and then continues in the global
- * scheduling mode.
- *
- * This function optimises priority scheduling (over throughput).
- *
- * User can exit the schedule loop without first calling odp_schedule_pause().
- *
- * @param fromOutput parameter for the source queue (where the buffer was
- *dequeued from). Ignored if NULL.
- * @param waitMinimum time to wait for a buffer. Waits infinitely, if set 
to
- *ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT.
- *Use odp_schedule_wait_time() to convert time to other wait
- *values.
- *
- * @return Next highest priority buffer, or ODP_BUFFER_INVALID
- */
-odp_buffer_t odp_schedule_one(odp_queue_t *from, uint64_t wait);
-
-
-/**
  * Schedule multiple buffers
  *
  * Like odp_schedule(), but returns multiple buffers from a queue.
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 7c09c23..0ee8d75 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -385,18 +385,6 @@ odp_buffer_t odp_schedule(odp_queue_t *out_queue, uint64_t 
wait)
 }
 
 
-odp_buffer_t odp_schedule_one(odp_queue_t *out_queue, uint64_t wait)
-{
-   odp_buffer_t buf;
-
-   buf = ODP_BUFFER_INVALID;
-
-   schedule_loop(out_queue, wait, &buf, 1, 1);
-
-   return buf;
-}
-
-
 int odp_schedule_multi(odp_queue_t *out_queue, uint64_t wait,
   odp_buffer_t out_buf[], unsigned int num)
 {
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 0/3] Remove odp_schedule_one for 1.0 compliance

2014-12-12 Thread Mike Holmes
The 1.0 API delta doc specifies that odp_schedule_one should be removed.
This series does that. In doing so it is expedient to just delete the timer
example because it is a poor example and there are patches under consideration
that improve the timer implementation and replace this bad example.

Mike Holmes (3):
  example: odp_example: remove use of odp_schdule_one
  example: odp_timer_test: delete bad example
  api: schedule: remove odp_schedule_one

 example/Makefile.am   |   2 +-
 example/odp_example/odp_example.c | 140 
 example/timer/.gitignore  |   1 -
 example/timer/Makefile.am |   7 -
 example/timer/odp_timer_test.c| 389 --
 platform/linux-generic/include/api/odp_schedule.h |  25 --
 platform/linux-generic/odp_schedule.c |  12 -
 7 files changed, 1 insertion(+), 575 deletions(-)
 delete mode 100644 example/timer/.gitignore
 delete mode 100644 example/timer/Makefile.am
 delete mode 100644 example/timer/odp_timer_test.c

-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 1/3] example: odp_example: remove use of odp_schdule_one

2014-12-12 Thread Mike Holmes
The api odp_schedule_one has been removed, the examples should
not attempt to call it.

Signed-off-by: Mike Holmes 
---
 example/odp_example/odp_example.c | 140 --
 1 file changed, 140 deletions(-)

diff --git a/example/odp_example/odp_example.c 
b/example/odp_example/odp_example.c
index 96a2912..b28bb00 100644
--- a/example/odp_example/odp_example.c
+++ b/example/odp_example/odp_example.c
@@ -310,124 +310,6 @@ static int test_poll_queue(int thr, odp_buffer_pool_t 
msg_pool)
return 0;
 }
 
-/**
- * @internal Test scheduling of a single queue - with odp_schedule_one()
- *
- * Enqueue a buffer to the shared queue. Schedule and enqueue the received
- * buffer back into the queue.
- *
- * @param str  Test case name string
- * @param thr  Thread
- * @param msg_pool Buffer pool
- * @param prio Priority
- * @param barrier  Barrier
- *
- * @return 0 if successful
- */
-static int test_schedule_one_single(const char *str, int thr,
-   odp_buffer_pool_t msg_pool,
-   int prio, odp_barrier_t *barrier)
-{
-   odp_buffer_t buf;
-   odp_queue_t queue;
-   uint64_t t1, t2, cycles, ns;
-   uint32_t i;
-   uint32_t tot = 0;
-
-   if (create_queue(thr, msg_pool, prio))
-   return -1;
-
-   t1 = odp_time_cycles();
-
-   for (i = 0; i < QUEUE_ROUNDS; i++) {
-   buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
-
-   if (odp_queue_enq(queue, buf)) {
-   EXAMPLE_ERR("  [%i] Queue enqueue failed.\n", thr);
-   return -1;
-   }
-   }
-
-   if (odp_queue_sched_type(queue) == ODP_SCHED_SYNC_ATOMIC)
-   odp_schedule_release_atomic();
-
-   t2 = odp_time_cycles();
-   cycles = odp_time_diff_cycles(t1, t2);
-   ns = odp_time_cycles_to_ns(cycles);
-   tot= i;
-
-   odp_barrier_wait(barrier);
-   clear_sched_queues();
-
-   cycles = cycles/tot;
-   ns = ns/tot;
-
-   printf("  [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n",
-  thr, str, cycles, ns);
-
-   return 0;
-}
-
-/**
- * @internal Test scheduling of multiple queues - with odp_schedule_one()
- *
- * Enqueue a buffer to each queue. Schedule and enqueue the received
- * buffer back into the queue it came from.
- *
- * @param str  Test case name string
- * @param thr  Thread
- * @param msg_pool Buffer pool
- * @param prio Priority
- * @param barrier  Barrier
- *
- * @return 0 if successful
- */
-static int test_schedule_one_many(const char *str, int thr,
- odp_buffer_pool_t msg_pool,
- int prio, odp_barrier_t *barrier)
-{
-   odp_buffer_t buf;
-   odp_queue_t queue;
-   uint64_t t1 = 0;
-   uint64_t t2 = 0;
-   uint64_t cycles, ns;
-   uint32_t i;
-   uint32_t tot = 0;
-
-   if (create_queues(thr, msg_pool, prio))
-   return -1;
-
-   /* Start sched-enq loop */
-   t1 = odp_time_cycles();
-
-   for (i = 0; i < QUEUE_ROUNDS; i++) {
-   buf = odp_schedule_one(&queue, ODP_SCHED_WAIT);
-
-   if (odp_queue_enq(queue, buf)) {
-   EXAMPLE_ERR("  [%i] Queue enqueue failed.\n", thr);
-   return -1;
-   }
-   }
-
-   if (odp_queue_sched_type(queue) == ODP_SCHED_SYNC_ATOMIC)
-   odp_schedule_release_atomic();
-
-   t2 = odp_time_cycles();
-   cycles = odp_time_diff_cycles(t1, t2);
-   ns = odp_time_cycles_to_ns(cycles);
-   tot= i;
-
-   odp_barrier_wait(barrier);
-   clear_sched_queues();
-
-   cycles = cycles/tot;
-   ns = ns/tot;
-
-   printf("  [%i] %s enq+deq %"PRIu64" cycles, %"PRIu64" ns\n",
-  thr, str, cycles, ns);
-
-   return 0;
-}
 
 /**
  * @internal Test scheduling of a single queue - with odp_schedule()
@@ -763,22 +645,12 @@ static void *run_thread(void *arg)
 
odp_barrier_wait(barrier);
 
-   if (test_schedule_one_single("sched_one_s_lo", thr, msg_pool,
-ODP_SCHED_PRIO_LOWEST, barrier))
-   return NULL;
-
-   odp_barrier_wait(barrier);
-
if (test_schedule_single("sched_s_lo", thr, msg_pool,
 ODP_SCHED_PRIO_LOWEST, barrier))
return NULL;
 
odp_barrier_wait(barrier);
 
-   if (test_schedule_one_many("sched_one_m_lo", thr, msg_pool,
-  ODP_SCHED_PRIO_LOWEST, barrier))
-   return NULL;
-
odp_barrier_wait(barrier);
 
if (test_schedule_many("sched_m_lo", thr, msg_pool,
@@ -795,24 +667,12 @@ static void *run_thread(void *arg)
 
odp_barrier_wait(barrier);
 
-   if (test_schedule_one_single("sched_one_s_hi", thr, msg_pool,
-ODP_SC

[lng-odp] [PATCHv2] validation: pktio: initial pktio tests

2014-12-12 Thread Stuart Haslam
This is primarily sunny day basic functional testing, all tests are
single threaded.

On platforms other than linux-generic testing will be performend using
the "loop" interface by default.

For linux-generic, since we don't have a working "loop" device, a
wrapper script is run that attempts to create a pair of virtual
Ethernet interfaces for testing. If creating the interfaces fails
the test is skipped and "make check" reports it as such.

Signed-off-by: Stuart Haslam 
---
Updates in v2:

 - now based on the updated packet and buffer pool APIs, so depends on;

   http://lists.linaro.org/pipermail/lng-odp/2014-December/006336.html
   http://lists.linaro.org/pipermail/lng-odp/2014-December/006337.html

 - removed USE_MACADDR_HACK as the API is now available

 - more graceful handling for some types of failure

Notes:

There are a couple of test failures against current linux-generic.

 - Packets get lost, apply this to resolve;

   http://lists.linaro.org/pipermail/lng-odp/2014-December/006383.html

 - the test for odp_pktio_inq_remdef() is failing, but that's genuinely
   broken, fix pending.

 test/validation/.gitignore|   1 +
 test/validation/Makefile.am   |   9 +-
 test/validation/odp_pktio.c   | 489 ++
 test/validation/odp_pktio_run | 126 +++
 4 files changed, 623 insertions(+), 2 deletions(-)
 create mode 100644 test/validation/odp_pktio.c
 create mode 100755 test/validation/odp_pktio_run

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 32834ae..c727223 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -5,3 +5,4 @@ odp_queue
 odp_crypto
 odp_schedule
 odp_shm
+odp_pktio
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index d0b5426..71f89c7 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -2,11 +2,14 @@ include $(top_srcdir)/test/Makefile.inc
 
 AM_CFLAGS += -I$(srcdir)/common
 AM_LDFLAGS += -static
+AM_CFLAGS += -I$(CUNIT_PATH)/include
+AM_LDFLAGS += -L$(CUNIT_PATH)/lib -static -lcunit
+AM_TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
 
 if ODP_CUNIT_ENABLED
-TESTS = ${bin_PROGRAMS}
+TESTS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio_run
 check_PROGRAMS = ${bin_PROGRAMS}
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_pktio
 odp_init_LDFLAGS = $(AM_LDFLAGS)
 odp_queue_LDFLAGS = $(AM_LDFLAGS)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
@@ -15,6 +18,7 @@ odp_shm_CFLAGS = $(AM_CFLAGS)
 odp_shm_LDFLAGS = $(AM_LDFLAGS)
 odp_schedule_CFLAGS = $(AM_CFLAGS)
 odp_schedule_LDFLAGS = $(AM_LDFLAGS)
+odp_pktio_LDFLAGS = $(AM_LDFLAGS)
 endif
 
 dist_odp_init_SOURCES = odp_init.c
@@ -25,6 +29,7 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
+dist_odp_pktio_SOURCES = odp_pktio.c common/odp_cunit_common.c
 
 #For Linux generic the unimplemented crypto API functions break the
 #regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
new file mode 100644
index 000..0ba9938
--- /dev/null
+++ b/test/validation/odp_pktio.c
@@ -0,0 +1,489 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#define SHM_PKT_POOL_SIZE  (32*2048)
+#define SHM_PKT_POOL_BUF_SIZE  1856
+#define MAX_NUM_IFACES 2
+#define TEST_SEQ_INVALID   ((uint32_t)~0)
+#define TEST_SEQ_MAGIC 0x92749451
+
+/** interface names used for testing */
+static const char *iface_name[MAX_NUM_IFACES];
+
+/** number of interfaces being used (1=loopback, 2=pair) */
+static int num_ifaces;
+
+/** local container for pktio attributes */
+typedef struct {
+   const char *name;
+   odp_pktio_t id;
+   odp_queue_t outq;
+   odp_queue_t inq;
+} pktio_info_t;
+
+/** structure of test packet UDP payload */
+typedef struct {
+   uint32be_t magic;
+   uint32be_t seq;
+} pkt_test_data_t;
+
+/** default packet pool */
+odp_buffer_pool_t default_pkt_pool = ODP_BUFFER_POOL_INVALID;
+
+/** sequence number of IP packets */
+odp_atomic_u32_t ip_seq;
+
+static void pktio_pkt_set_macs(odp_packet_t pkt,
+  pktio_info_t *src, pktio_info_t *dst)
+{
+   uint32_t len;
+   odph_ethhdr_t *eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, &len);
+   int ret;
+
+   ret = odp_pktio_mac_addr(src->id, ð->src, sizeof(eth->src));
+   CU_ASSERT(ret == ODPH_ETHADDR_LEN);
+
+   ret = odp_pktio_mac_addr(dst->id, ð->dst, sizeof(eth->dst));
+   CU_ASSERT(ret == ODPH_ETHADDR_LEN);
+}
+
+static int pktio

Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Ciprian Barbu
On Fri, Dec 12, 2014 at 6:45 PM, Mike Holmes  wrote:
> I just checked the Delta doc, you are correct, I will send a patch for that.
>
> On 12 December 2014 at 11:43, Bill Fischofer 
> wrote:
>>
>> I recall Petri indicated that odp_schedule_one() was being dropped from
>> v1.0.
>>
>> On Fri, Dec 12, 2014 at 10:40 AM, Mike Holmes 
>> wrote:
>>>
>>> That improved things :)
>>>
>>>
>>> http://docs.opendataplane.org/linux-generic-gcov-html/linux-generic/odp_schedule.c.func.html
>>>
>>> But still missing:
>>>
>>> odp_schedule_one
>>> odp_schedule_pause
>>> odp_schedule_resume

I can add pause and resume, it shouldn't be hard. But at least I got
something merged in, to get things going.

>>>
>>>
>>> On 12 December 2014 at 11:15, Maxim Uvarov 
>>> wrote:

 Merged,
 Maxim.


 On 12/11/2014 06:43 PM, Ciprian Barbu wrote:
>
> Signed-off-by: Ciprian Barbu 
> ---
> v4:
>   - fixes after Jerin's comments
>   - removed tests_global_init and made it suite init function
> v3:
>   - changes after Mike's review
>   - removed duplicate check of end of test in schedule_common_
> v2:
>   - rebased against ODP tip
>   - fixed some bugs
>   - added some defines to clearly see the testcase parameters
>
>   test/validation/.gitignore |   1 +
>   test/validation/Makefile.am|   5 +-
>   test/validation/odp_schedule.c | 607
> +
>   3 files changed, 612 insertions(+), 1 deletion(-)
>   create mode 100644 test/validation/odp_schedule.c
>
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 37e2594..32834ae 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -3,4 +3,5 @@
>   odp_init
>   odp_queue
>   odp_crypto
> +odp_schedule
>   odp_shm
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 8547085..3670c76 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
>   if ODP_CUNIT_ENABLED
>   TESTS = ${bin_PROGRAMS}
>   check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>   odp_init_LDFLAGS = $(AM_LDFLAGS)
>   odp_queue_LDFLAGS = $(AM_LDFLAGS)
>   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>   odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>   odp_shm_CFLAGS = $(AM_CFLAGS)
>   odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_schedule_CFLAGS = $(AM_CFLAGS)
> +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
>   endif
> dist_odp_init_SOURCES = odp_init.c
> @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES =
> crypto/odp_crypto_test_async_inp.c \
>   crypto/odp_crypto_test_rng.c \
>   odp_crypto.c common/odp_cunit_common.c
>   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_schedule.c
> b/test/validation/odp_schedule.c
> new file mode 100644
> index 000..9d410e4
> --- /dev/null
> +++ b/test/validation/odp_schedule.c
> @@ -0,0 +1,607 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include "odp_cunit_common.h"
> +
> +#define MAX_WORKERS_THREADS32
> +#define MSG_POOL_SIZE  (4*1024*1024)
> +#define QUEUES_PER_PRIO16
> +#define BUF_SIZE   64
> +#define TEST_NUM_BUFS  100
> +#define BURST_BUF_SIZE 4
> +#define TEST_NUM_BUFS_EXCL 1
> +
> +#define GLOBALS_SHM_NAME   "test_globals"
> +#define MSG_POOL_NAME  "msg_pool"
> +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
> +#define SHM_THR_ARGS_NAME  "shm_thr_args"
> +
> +#define ONE_Q  1
> +#define MANY_QSQUEUES_PER_PRIO
> +
> +#define ONE_PRIO   1
> +
> +#define SCHD_ONE   0
> +#define SCHD_MULTI 1
> +
> +#define DISABLE_EXCL_ATOMIC0
> +#define ENABLE_EXCL_ATOMIC 1
> +
> +
> +/* Test global variables */
> +typedef struct {
> +   int core_count;
> +   odp_barrier_t barrier;
> +   odp_schedule_prio_t current_prio;
> +   int prio_buf_count;
> +   odp_ticketlock_t count_lock;
> +   odp_spinlock_t atomic_lock;
> +} test_globals_t;
> +
> +typedef struct ODP_PACKED {
> +   pthrd_arg thrdarg;
> +   odp_schedule_sync_t sync;
> +   int num_queues;
> +   int num_prio;
> +   int num_bufs;
> + 

[lng-odp] [PATCHv2] linux-generic: pktio: prevent pktin_dequeue storing returned buffer

2014-12-12 Thread Stuart Haslam
The buffer being returned shouldn't be enqueued as this will cause it to
be returned again on the next dequeue, by which point it may have been
freed via the returned reference.

Signed-off-by: Stuart Haslam 
---
Changes in v2 - rebased as it conflicted with the classification changes.

 platform/linux-generic/odp_packet_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index a03eeb1..aa37179 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -483,8 +483,8 @@ odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry)
tmp_hdr_tbl[j++] = buf_hdr;
}
 
-   if (j)
-   queue_enq_multi(qentry, tmp_hdr_tbl, j);
+   if (j > 1)
+   queue_enq_multi(qentry, &tmp_hdr_tbl[1], j-1);
buf_hdr = tmp_hdr_tbl[0];
return buf_hdr;
 }
-- 
2.1.1



___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Taras Kondratiuk
On 12/12/2014 06:50 PM, Bill Fischofer wrote:
> Just as an FYI, if I remove the restriction on packets not supporting
> segmentation (a one liner) all of your tests pass except for
> packet_alloc_segmented().  However, that's a test-case issue because you
> try to allocate a buffer of size BUFFER * 10 without checking whether
> that exceeds the ODP_CONFIG_PACKET_BUF_LEN_MAX var (which in this case
> it does).  If I change that to BUFFER * 5, which is within the limit,
> then that test passes too.

That's nice.
Will update tests to take these configuration values into account.

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Bill Fischofer
Just as an FYI, if I remove the restriction on packets not supporting
segmentation (a one liner) all of your tests pass except for
packet_alloc_segmented().  However, that's a test-case issue because you
try to allocate a buffer of size BUFFER * 10 without checking whether that
exceeds the ODP_CONFIG_PACKET_BUF_LEN_MAX var (which in this case it
does).  If I change that to BUFFER * 5, which is within the limit, then
that test passes too.

Bill

On Fri, Dec 12, 2014 at 10:42 AM, Taras Kondratiuk <
taras.kondrat...@linaro.org> wrote:
>
> On 12/12/2014 06:38 PM, Taras Kondratiuk wrote:
> > Initial version of sunny day buffer pool, buffer and packet API tests.
> > Based on Bill's buffer & packets patches for v0.5.
> >
> > linux-generic doesn't support segmented packets in v0.5, so two tests are
> > failing.
>
> Ugh. This duplicated message is from temporary file.
>
> --
> Taras Kondratiuk
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Mike Holmes
I just checked the Delta doc, you are correct, I will send a patch for that.

On 12 December 2014 at 11:43, Bill Fischofer 
wrote:
>
> I recall Petri indicated that odp_schedule_one() was being dropped from
> v1.0.
>
> On Fri, Dec 12, 2014 at 10:40 AM, Mike Holmes 
> wrote:
>>
>> That improved things :)
>>
>>
>> http://docs.opendataplane.org/linux-generic-gcov-html/linux-generic/odp_schedule.c.func.html
>>
>> But still missing:
>>
>> odp_schedule_one
>> 
>> odp_schedule_pause
>> 
>> odp_schedule_resume
>> 
>>
>>
>> On 12 December 2014 at 11:15, Maxim Uvarov 
>> wrote:
>>>
>>> Merged,
>>> Maxim.
>>>
>>>
>>> On 12/11/2014 06:43 PM, Ciprian Barbu wrote:
>>>
 Signed-off-by: Ciprian Barbu 
 ---
 v4:
   - fixes after Jerin's comments
   - removed tests_global_init and made it suite init function
 v3:
   - changes after Mike's review
   - removed duplicate check of end of test in schedule_common_
 v2:
   - rebased against ODP tip
   - fixed some bugs
   - added some defines to clearly see the testcase parameters

   test/validation/.gitignore |   1 +
   test/validation/Makefile.am|   5 +-
   test/validation/odp_schedule.c | 607 ++
 +++
   3 files changed, 612 insertions(+), 1 deletion(-)
   create mode 100644 test/validation/odp_schedule.c

 diff --git a/test/validation/.gitignore b/test/validation/.gitignore
 index 37e2594..32834ae 100644
 --- a/test/validation/.gitignore
 +++ b/test/validation/.gitignore
 @@ -3,4 +3,5 @@
   odp_init
   odp_queue
   odp_crypto
 +odp_schedule
   odp_shm
 diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
 index 8547085..3670c76 100644
 --- a/test/validation/Makefile.am
 +++ b/test/validation/Makefile.am
 @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
   if ODP_CUNIT_ENABLED
   TESTS = ${bin_PROGRAMS}
   check_PROGRAMS = ${bin_PROGRAMS}
 -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
 +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
   odp_init_LDFLAGS = $(AM_LDFLAGS)
   odp_queue_LDFLAGS = $(AM_LDFLAGS)
   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
   odp_crypto_LDFLAGS = $(AM_LDFLAGS)
   odp_shm_CFLAGS = $(AM_CFLAGS)
   odp_shm_LDFLAGS = $(AM_LDFLAGS)
 +odp_schedule_CFLAGS = $(AM_CFLAGS)
 +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
   endif
 dist_odp_init_SOURCES = odp_init.c
 @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES =
 crypto/odp_crypto_test_async_inp.c \
   crypto/odp_crypto_test_rng.c \
   odp_crypto.c common/odp_cunit_common.c
   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
 diff --git a/test/validation/odp_schedule.c b/test/validation/odp_
 schedule.c
 new file mode 100644
 index 000..9d410e4
 --- /dev/null
 +++ b/test/validation/odp_schedule.c
 @@ -0,0 +1,607 @@
 +/* Copyright (c) 2014, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +#include 
 +#include "odp_cunit_common.h"
 +
 +#define MAX_WORKERS_THREADS32
 +#define MSG_POOL_SIZE  (4*1024*1024)
 +#define QUEUES_PER_PRIO16
 +#define BUF_SIZE   64
 +#define TEST_NUM_BUFS  100
 +#define BURST_BUF_SIZE 4
 +#define TEST_NUM_BUFS_EXCL 1
 +
 +#define GLOBALS_SHM_NAME   "test_globals"
 +#define MSG_POOL_NAME  "msg_pool"
 +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
 +#define SHM_THR_ARGS_NAME  "shm_thr_args"
 +
 +#define ONE_Q  1
 +#define MANY_QSQUEUES_PER_PRIO
 +
 +#define ONE_PRIO   1
 +
 +#define SCHD_ONE   0
 +#define SCHD_MULTI 1
 +
 +#define DISABLE_EXCL_ATOMIC0
 +#define ENABLE_EXCL_ATOMIC 1
 +
 +
 +/* Test global variables */
 +typedef struct {
 +   int core_count;
 +   odp_barrier_t barrier;
 +   odp_schedule_prio_t current_prio;
 +   int prio_buf_count;
 +   odp_ticketlock_t count_lock;
 +   odp_spinlock_t atomic_lock;
 +} test_globals_t;
 +
 +typedef struct ODP_PACKED {
 +   pthrd_arg thrdarg;
 +   odp_schedule_sync_t sync;
 +   int num_queues;
 +   int num_prio;
 +   int num_bufs;
 +   int nu

Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Bill Fischofer
I recall Petri indicated that odp_schedule_one() was being dropped from
v1.0.

On Fri, Dec 12, 2014 at 10:40 AM, Mike Holmes 
wrote:
>
> That improved things :)
>
>
> http://docs.opendataplane.org/linux-generic-gcov-html/linux-generic/odp_schedule.c.func.html
>
> But still missing:
>
> odp_schedule_one
> 
> odp_schedule_pause
> 
> odp_schedule_resume
> 
>
>
> On 12 December 2014 at 11:15, Maxim Uvarov 
> wrote:
>>
>> Merged,
>> Maxim.
>>
>>
>> On 12/11/2014 06:43 PM, Ciprian Barbu wrote:
>>
>>> Signed-off-by: Ciprian Barbu 
>>> ---
>>> v4:
>>>   - fixes after Jerin's comments
>>>   - removed tests_global_init and made it suite init function
>>> v3:
>>>   - changes after Mike's review
>>>   - removed duplicate check of end of test in schedule_common_
>>> v2:
>>>   - rebased against ODP tip
>>>   - fixed some bugs
>>>   - added some defines to clearly see the testcase parameters
>>>
>>>   test/validation/.gitignore |   1 +
>>>   test/validation/Makefile.am|   5 +-
>>>   test/validation/odp_schedule.c | 607 ++
>>> +++
>>>   3 files changed, 612 insertions(+), 1 deletion(-)
>>>   create mode 100644 test/validation/odp_schedule.c
>>>
>>> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
>>> index 37e2594..32834ae 100644
>>> --- a/test/validation/.gitignore
>>> +++ b/test/validation/.gitignore
>>> @@ -3,4 +3,5 @@
>>>   odp_init
>>>   odp_queue
>>>   odp_crypto
>>> +odp_schedule
>>>   odp_shm
>>> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
>>> index 8547085..3670c76 100644
>>> --- a/test/validation/Makefile.am
>>> +++ b/test/validation/Makefile.am
>>> @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
>>>   if ODP_CUNIT_ENABLED
>>>   TESTS = ${bin_PROGRAMS}
>>>   check_PROGRAMS = ${bin_PROGRAMS}
>>> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
>>> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>>>   odp_init_LDFLAGS = $(AM_LDFLAGS)
>>>   odp_queue_LDFLAGS = $(AM_LDFLAGS)
>>>   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>>>   odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>>>   odp_shm_CFLAGS = $(AM_CFLAGS)
>>>   odp_shm_LDFLAGS = $(AM_LDFLAGS)
>>> +odp_schedule_CFLAGS = $(AM_CFLAGS)
>>> +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
>>>   endif
>>> dist_odp_init_SOURCES = odp_init.c
>>> @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES = 
>>> crypto/odp_crypto_test_async_inp.c
>>> \
>>>   crypto/odp_crypto_test_rng.c \
>>>   odp_crypto.c common/odp_cunit_common.c
>>>   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>>> +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
>>> diff --git a/test/validation/odp_schedule.c b/test/validation/odp_
>>> schedule.c
>>> new file mode 100644
>>> index 000..9d410e4
>>> --- /dev/null
>>> +++ b/test/validation/odp_schedule.c
>>> @@ -0,0 +1,607 @@
>>> +/* Copyright (c) 2014, Linaro Limited
>>> + * All rights reserved.
>>> + *
>>> + * SPDX-License-Identifier: BSD-3-Clause
>>> + */
>>> +
>>> +#include 
>>> +#include "odp_cunit_common.h"
>>> +
>>> +#define MAX_WORKERS_THREADS32
>>> +#define MSG_POOL_SIZE  (4*1024*1024)
>>> +#define QUEUES_PER_PRIO16
>>> +#define BUF_SIZE   64
>>> +#define TEST_NUM_BUFS  100
>>> +#define BURST_BUF_SIZE 4
>>> +#define TEST_NUM_BUFS_EXCL 1
>>> +
>>> +#define GLOBALS_SHM_NAME   "test_globals"
>>> +#define MSG_POOL_NAME  "msg_pool"
>>> +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
>>> +#define SHM_THR_ARGS_NAME  "shm_thr_args"
>>> +
>>> +#define ONE_Q  1
>>> +#define MANY_QSQUEUES_PER_PRIO
>>> +
>>> +#define ONE_PRIO   1
>>> +
>>> +#define SCHD_ONE   0
>>> +#define SCHD_MULTI 1
>>> +
>>> +#define DISABLE_EXCL_ATOMIC0
>>> +#define ENABLE_EXCL_ATOMIC 1
>>> +
>>> +
>>> +/* Test global variables */
>>> +typedef struct {
>>> +   int core_count;
>>> +   odp_barrier_t barrier;
>>> +   odp_schedule_prio_t current_prio;
>>> +   int prio_buf_count;
>>> +   odp_ticketlock_t count_lock;
>>> +   odp_spinlock_t atomic_lock;
>>> +} test_globals_t;
>>> +
>>> +typedef struct ODP_PACKED {
>>> +   pthrd_arg thrdarg;
>>> +   odp_schedule_sync_t sync;
>>> +   int num_queues;
>>> +   int num_prio;
>>> +   int num_bufs;
>>> +   int num_cores;
>>> +   int enable_schd_multi;
>>> +   int enable_excl_atomic;
>>> +} thread_args_t;
>>> +
>>> +odp_buffer_pool_t pool;
>>> +
>>> +static void test_schedule_wait_time(void)
>>> +{
>>> +   uint64_t wait_time;
>>> +
>>> +   wait_time = odp_schedule_wait

Re: [lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Taras Kondratiuk
On 12/12/2014 06:38 PM, Taras Kondratiuk wrote:
> Initial version of sunny day buffer pool, buffer and packet API tests.
> Based on Bill's buffer & packets patches for v0.5.
> 
> linux-generic doesn't support segmented packets in v0.5, so two tests are
> failing.

Ugh. This duplicated message is from temporary file.

-- 
Taras Kondratiuk

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Bill Fischofer
For this patch series:

Reviewed-and-Tested-by: Bill Fischofer 

On Fri, Dec 12, 2014 at 10:38 AM, Taras Kondratiuk <
taras.kondrat...@linaro.org> wrote:
>
> Initial version of sunny day buffer pool, buffer and packet API tests.
> Based on Bill's buffer & packets patches for v0.5.
>
> linux-generic doesn't support segmented packets in v0.5, so two tests are
> failing.
>
>
>
> Taras Kondratiuk (3):
>   validation: buffer: add initial buffer pool tests
>   validation: buffer: add initial buffer tests
>   validation: buffer: add initial packet tests
>
>  test/validation/.gitignore |   1 +
>  test/validation/Makefile.am|   8 +-
>  test/validation/buffer/odp_buffer_pool_test.c  | 212 
>  test/validation/buffer/odp_buffer_test.c   |  52 ++
>  test/validation/buffer/odp_buffer_testsuites.h |  29 ++
>  test/validation/buffer/odp_packet_test.c   | 659
> +
>  test/validation/odp_buffer.c   |  24 +
>  7 files changed, 984 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/buffer/odp_buffer_pool_test.c
>  create mode 100644 test/validation/buffer/odp_buffer_test.c
>  create mode 100644 test/validation/buffer/odp_buffer_testsuites.h
>  create mode 100644 test/validation/buffer/odp_packet_test.c
>  create mode 100644 test/validation/odp_buffer.c
>
> --
> 1.9.1
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Mike Holmes
That improved things :)

http://docs.opendataplane.org/linux-generic-gcov-html/linux-generic/odp_schedule.c.func.html

But still missing:

odp_schedule_one

odp_schedule_pause

odp_schedule_resume



On 12 December 2014 at 11:15, Maxim Uvarov  wrote:
>
> Merged,
> Maxim.
>
>
> On 12/11/2014 06:43 PM, Ciprian Barbu wrote:
>
>> Signed-off-by: Ciprian Barbu 
>> ---
>> v4:
>>   - fixes after Jerin's comments
>>   - removed tests_global_init and made it suite init function
>> v3:
>>   - changes after Mike's review
>>   - removed duplicate check of end of test in schedule_common_
>> v2:
>>   - rebased against ODP tip
>>   - fixed some bugs
>>   - added some defines to clearly see the testcase parameters
>>
>>   test/validation/.gitignore |   1 +
>>   test/validation/Makefile.am|   5 +-
>>   test/validation/odp_schedule.c | 607 ++
>> +++
>>   3 files changed, 612 insertions(+), 1 deletion(-)
>>   create mode 100644 test/validation/odp_schedule.c
>>
>> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
>> index 37e2594..32834ae 100644
>> --- a/test/validation/.gitignore
>> +++ b/test/validation/.gitignore
>> @@ -3,4 +3,5 @@
>>   odp_init
>>   odp_queue
>>   odp_crypto
>> +odp_schedule
>>   odp_shm
>> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
>> index 8547085..3670c76 100644
>> --- a/test/validation/Makefile.am
>> +++ b/test/validation/Makefile.am
>> @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
>>   if ODP_CUNIT_ENABLED
>>   TESTS = ${bin_PROGRAMS}
>>   check_PROGRAMS = ${bin_PROGRAMS}
>> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
>> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>>   odp_init_LDFLAGS = $(AM_LDFLAGS)
>>   odp_queue_LDFLAGS = $(AM_LDFLAGS)
>>   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>>   odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>>   odp_shm_CFLAGS = $(AM_CFLAGS)
>>   odp_shm_LDFLAGS = $(AM_LDFLAGS)
>> +odp_schedule_CFLAGS = $(AM_CFLAGS)
>> +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
>>   endif
>> dist_odp_init_SOURCES = odp_init.c
>> @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES = 
>> crypto/odp_crypto_test_async_inp.c
>> \
>>   crypto/odp_crypto_test_rng.c \
>>   odp_crypto.c common/odp_cunit_common.c
>>   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>> +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
>> diff --git a/test/validation/odp_schedule.c b/test/validation/odp_
>> schedule.c
>> new file mode 100644
>> index 000..9d410e4
>> --- /dev/null
>> +++ b/test/validation/odp_schedule.c
>> @@ -0,0 +1,607 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + */
>> +
>> +#include 
>> +#include "odp_cunit_common.h"
>> +
>> +#define MAX_WORKERS_THREADS32
>> +#define MSG_POOL_SIZE  (4*1024*1024)
>> +#define QUEUES_PER_PRIO16
>> +#define BUF_SIZE   64
>> +#define TEST_NUM_BUFS  100
>> +#define BURST_BUF_SIZE 4
>> +#define TEST_NUM_BUFS_EXCL 1
>> +
>> +#define GLOBALS_SHM_NAME   "test_globals"
>> +#define MSG_POOL_NAME  "msg_pool"
>> +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
>> +#define SHM_THR_ARGS_NAME  "shm_thr_args"
>> +
>> +#define ONE_Q  1
>> +#define MANY_QSQUEUES_PER_PRIO
>> +
>> +#define ONE_PRIO   1
>> +
>> +#define SCHD_ONE   0
>> +#define SCHD_MULTI 1
>> +
>> +#define DISABLE_EXCL_ATOMIC0
>> +#define ENABLE_EXCL_ATOMIC 1
>> +
>> +
>> +/* Test global variables */
>> +typedef struct {
>> +   int core_count;
>> +   odp_barrier_t barrier;
>> +   odp_schedule_prio_t current_prio;
>> +   int prio_buf_count;
>> +   odp_ticketlock_t count_lock;
>> +   odp_spinlock_t atomic_lock;
>> +} test_globals_t;
>> +
>> +typedef struct ODP_PACKED {
>> +   pthrd_arg thrdarg;
>> +   odp_schedule_sync_t sync;
>> +   int num_queues;
>> +   int num_prio;
>> +   int num_bufs;
>> +   int num_cores;
>> +   int enable_schd_multi;
>> +   int enable_excl_atomic;
>> +} thread_args_t;
>> +
>> +odp_buffer_pool_t pool;
>> +
>> +static void test_schedule_wait_time(void)
>> +{
>> +   uint64_t wait_time;
>> +
>> +   wait_time = odp_schedule_wait_time(0);
>> +
>> +   wait_time = odp_schedule_wait_time(1);
>> +   CU_ASSERT(wait_time > 0);
>> +
>> +   wait_time = odp_schedule_wait_time((uint64_t)-1LL);
>> +   CU_ASSERT(wait_time > 0);
>> +}
>> +
>> +static void test_schedule_num_prio(void)
>> +{
>> +   int prio;
>> +
>>

[lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Taras Kondratiuk
Initial version of sunny day buffer pool, buffer and packet API tests.
Based on Bill's buffer & packets patches for v0.5.

linux-generic doesn't support segmented packets in v0.5, so two tests are
failing. Test results:

Suite: buffer Pool tests
  Test: pool_create_destroy_raw ...passed
  Test: pool_create_destroy_packet ...passed
  Test: pool_create_destroy_timeout ...passed
  Test: pool_create_destroy_any ...passed
  Test: pool_create_destroy_raw_shm ...passed
  Test: pool_lookup_info_print ...passed
  Test: pool_alloc_buffer_raw ...passed
  Test: pool_alloc_buffer_packet ...passed
  Test: pool_alloc_buffer_timeout ...passed
  Test: pool_alloc_buffer_any ...passed
  Test: pool_free_buffer ...passed
Suite: buffer tests
  Test: buffer_management_basic ...passed
Suite: packet tests
  Test: packet_alloc_free ...passed
  Test: packet_alloc_segmented ...FAILED
1. ../../../../odp/test/validation/buffer/odp_packet_test.c:75  - pkt != 
ODP_PACKET_INVALID
  Test: packet_basic_metadata ...passed
  Test: packet_debug ...passed
  Test: packet_length ...passed
  Test: packet_headroom ...passed
  Test: packet_tailroom ...passed
  Test: packet_context ...passed
  Test: packet_buffer_conversion ...passed
  Test: packet_layer_offsets ...passed
  Test: packet_segments ...passed
  Test: packet_segment_last ...passed
  Test: packet_in_flags ...passed
  Test: packet_out_flags ...passed
  Test: packet_error_flags ...passed
  Test: packet_add_rem_data ...FAILED
1. ../../../../odp/test/validation/buffer/odp_packet_test.c:440  - new_pkt 
!= ODP_PACKET_INVALID
  Test: packet_copy ...passed
  Test: packet_copydata ...passed
  Test: packet_offset ...passed

Run Summary:Type  TotalRan Passed Failed Inactive
  suites  3  3n/a  00
   tests 31 31 29  20
 asserts238238236  2  n/a

Taras Kondratiuk (3):
  validation: buffer: add initial buffer pool tests
  validation: buffer: add initial buffer tests
  validation: buffer: add initial packet tests

 test/validation/.gitignore |   1 +
 test/validation/Makefile.am|   8 +-
 test/validation/buffer/odp_buffer_pool_test.c  | 212 
 test/validation/buffer/odp_buffer_test.c   |  52 ++
 test/validation/buffer/odp_buffer_testsuites.h |  29 ++
 test/validation/buffer/odp_packet_test.c   | 659 +
 test/validation/odp_buffer.c   |  24 +
 7 files changed, 984 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/buffer/odp_buffer_pool_test.c
 create mode 100644 test/validation/buffer/odp_buffer_test.c
 create mode 100644 test/validation/buffer/odp_buffer_testsuites.h
 create mode 100644 test/validation/buffer/odp_packet_test.c
 create mode 100644 test/validation/odp_buffer.c

-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 2/3] validation: buffer: add initial buffer tests

2014-12-12 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk 
---
 test/validation/Makefile.am|  1 +
 test/validation/buffer/odp_buffer_test.c   | 52 ++
 test/validation/buffer/odp_buffer_testsuites.h |  4 ++
 test/validation/odp_buffer.c   |  5 +++
 4 files changed, 62 insertions(+)
 create mode 100644 test/validation/buffer/odp_buffer_test.c

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 81fd933..41c48ec 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -25,4 +25,5 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
+ buffer/odp_buffer_test.c \
  odp_buffer.c common/odp_cunit_common.c
diff --git a/test/validation/buffer/odp_buffer_test.c 
b/test/validation/buffer/odp_buffer_test.c
new file mode 100644
index 000..73ae4cb
--- /dev/null
+++ b/test/validation/buffer/odp_buffer_test.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include "odp_buffer_testsuites.h"
+
+static odp_buffer_pool_t raw_pool;
+static odp_buffer_t raw_buffer = ODP_BUFFER_INVALID;
+static const size_t raw_buffer_size = 1500;
+
+int buffer_testsuite_init(void)
+{
+   odp_buffer_pool_param_t params = {
+   .buf_size  = raw_buffer_size,
+   .buf_align = ODP_CACHE_LINE_SIZE,
+   .num_bufs  = 100,
+   .buf_type  = ODP_BUFFER_TYPE_RAW,
+   };
+
+   raw_pool = odp_buffer_pool_create("raw_pool", ODP_SHM_INVALID, ¶ms);
+   if (raw_pool == ODP_BUFFER_POOL_INVALID)
+   return -1;
+   raw_buffer = odp_buffer_alloc(raw_pool);
+   if (raw_buffer == ODP_BUFFER_INVALID)
+   return -1;
+   return 0;
+}
+
+int buffer_testsuite_finalize(void)
+{
+   odp_buffer_free(raw_buffer);
+   if (odp_buffer_pool_destroy(raw_pool) != 0)
+   return -1;
+   return 0;
+}
+
+static void buffer_management_basic(void)
+{
+   CU_ASSERT(odp_buffer_is_valid(raw_buffer) == 1);
+   CU_ASSERT(odp_buffer_pool(raw_buffer) != ODP_BUFFER_POOL_INVALID);
+   CU_ASSERT(odp_buffer_type(raw_buffer) == ODP_BUFFER_TYPE_RAW);
+   CU_ASSERT(odp_buffer_size(raw_buffer) >= raw_buffer_size);
+   CU_ASSERT(odp_buffer_addr(raw_buffer) != NULL);
+   odp_buffer_print(raw_buffer);
+}
+
+CU_TestInfo buffer_tests[] = {
+   _CU_TEST_INFO(buffer_management_basic),
+   CU_TEST_INFO_NULL,
+};
diff --git a/test/validation/buffer/odp_buffer_testsuites.h 
b/test/validation/buffer/odp_buffer_testsuites.h
index 08fb4e0..ca42c2d 100644
--- a/test/validation/buffer/odp_buffer_testsuites.h
+++ b/test/validation/buffer/odp_buffer_testsuites.h
@@ -15,6 +15,10 @@
 #define _CU_TEST_INFO(test_func) {#test_func, test_func}
 
 extern CU_TestInfo buffer_pool_tests[];
+extern CU_TestInfo buffer_tests[];
+
+extern int buffer_testsuite_init(void);
+extern int buffer_testsuite_finalize(void);
 
 odp_buffer_pool_t pool_create(int buf_num, int buf_size, int buf_type);
 
diff --git a/test/validation/odp_buffer.c b/test/validation/odp_buffer.c
index bfd9f6d..8aa61a9 100644
--- a/test/validation/odp_buffer.c
+++ b/test/validation/odp_buffer.c
@@ -10,5 +10,10 @@ CU_SuiteInfo odp_testsuites[] = {
{ .pName = "buffer Pool tests",
.pTests = buffer_pool_tests,
},
+   { .pName = "buffer tests",
+   .pTests = buffer_tests,
+   .pInitFunc = buffer_testsuite_init,
+   .pCleanupFunc = buffer_testsuite_finalize,
+   },
CU_SUITE_INFO_NULL,
 };
-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 0/3] validation: buffer: add initial tests

2014-12-12 Thread Taras Kondratiuk
Initial version of sunny day buffer pool, buffer and packet API tests.
Based on Bill's buffer & packets patches for v0.5.

linux-generic doesn't support segmented packets in v0.5, so two tests are
failing.



Taras Kondratiuk (3):
  validation: buffer: add initial buffer pool tests
  validation: buffer: add initial buffer tests
  validation: buffer: add initial packet tests

 test/validation/.gitignore |   1 +
 test/validation/Makefile.am|   8 +-
 test/validation/buffer/odp_buffer_pool_test.c  | 212 
 test/validation/buffer/odp_buffer_test.c   |  52 ++
 test/validation/buffer/odp_buffer_testsuites.h |  29 ++
 test/validation/buffer/odp_packet_test.c   | 659 +
 test/validation/odp_buffer.c   |  24 +
 7 files changed, 984 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/buffer/odp_buffer_pool_test.c
 create mode 100644 test/validation/buffer/odp_buffer_test.c
 create mode 100644 test/validation/buffer/odp_buffer_testsuites.h
 create mode 100644 test/validation/buffer/odp_packet_test.c
 create mode 100644 test/validation/odp_buffer.c

-- 
1.9.1


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH 1/3] validation: buffer: add initial buffer pool tests

2014-12-12 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk 
---
 test/validation/.gitignore |   1 +
 test/validation/Makefile.am|   6 +-
 test/validation/buffer/odp_buffer_pool_test.c  | 212 +
 test/validation/buffer/odp_buffer_testsuites.h |  21 +++
 test/validation/odp_buffer.c   |  14 ++
 5 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/buffer/odp_buffer_pool_test.c
 create mode 100644 test/validation/buffer/odp_buffer_testsuites.h
 create mode 100644 test/validation/odp_buffer.c

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 37e2594..6bf11bd 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -4,3 +4,4 @@ odp_init
 odp_queue
 odp_crypto
 odp_shm
+odp_buffer
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 8547085..81fd933 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,13 +6,15 @@ AM_LDFLAGS += -static
 if ODP_CUNIT_ENABLED
 TESTS = ${bin_PROGRAMS}
 check_PROGRAMS = ${bin_PROGRAMS}
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_buffer
 odp_init_LDFLAGS = $(AM_LDFLAGS)
 odp_queue_LDFLAGS = $(AM_LDFLAGS)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
 odp_crypto_LDFLAGS = $(AM_LDFLAGS)
 odp_shm_CFLAGS = $(AM_CFLAGS)
 odp_shm_LDFLAGS = $(AM_LDFLAGS)
+odp_buffer_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/buffer
+odp_buffer_LDFLAGS = $(AM_LDFLAGS)
 endif
 
 dist_odp_init_SOURCES = odp_init.c
@@ -22,3 +24,5 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  crypto/odp_crypto_test_rng.c \
  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
+dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
+ odp_buffer.c common/odp_cunit_common.c
diff --git a/test/validation/buffer/odp_buffer_pool_test.c 
b/test/validation/buffer/odp_buffer_pool_test.c
new file mode 100644
index 000..b41fe4d
--- /dev/null
+++ b/test/validation/buffer/odp_buffer_pool_test.c
@@ -0,0 +1,212 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include "odp_buffer_testsuites.h"
+
+static int pool_name_number = 1;
+static const int default_buffer_size = 1500;
+static const int default_buffer_num = 1000;
+
+odp_buffer_pool_t pool_create(int buf_num, int buf_size, int buf_type)
+{
+   odp_buffer_pool_t pool;
+   char pool_name[ODP_BUFFER_POOL_NAME_LEN];
+   odp_buffer_pool_param_t params = {
+   .buf_size  = buf_size,
+   .buf_align = ODP_CACHE_LINE_SIZE,
+   .num_bufs  = buf_num,
+   .buf_type  = buf_type,
+   };
+
+   snprintf(pool_name, sizeof(pool_name),
+"test_buffer_pool-%d", pool_name_number++);
+
+   pool = odp_buffer_pool_create(pool_name, ODP_SHM_INVALID, ¶ms);
+   CU_ASSERT_FATAL(pool != ODP_BUFFER_POOL_INVALID);
+
+   return pool;
+}
+
+static void pool_create_destroy_type(int type)
+{
+   odp_buffer_pool_t pool;
+   pool = pool_create(default_buffer_num, default_buffer_size, type);
+
+   CU_ASSERT(odp_buffer_pool_destroy(pool) == 0);
+}
+
+static void pool_create_destroy_raw(void)
+{
+   pool_create_destroy_type(ODP_BUFFER_TYPE_RAW);
+}
+
+static void pool_create_destroy_packet(void)
+{
+   pool_create_destroy_type(ODP_BUFFER_TYPE_PACKET);
+}
+
+static void pool_create_destroy_timeout(void)
+{
+   pool_create_destroy_type(ODP_BUFFER_TYPE_TIMEOUT);
+}
+
+static void pool_create_destroy_any(void)
+{
+   pool_create_destroy_type(ODP_BUFFER_TYPE_ANY);
+}
+
+static void pool_create_destroy_raw_shm(void)
+{
+   odp_buffer_pool_t pool;
+   odp_shm_t test_shm;
+   odp_buffer_pool_param_t params = {
+   .buf_size  = 1500,
+   .buf_align = ODP_CACHE_LINE_SIZE,
+   .num_bufs  = 10,
+   .buf_type  = ODP_BUFFER_TYPE_RAW,
+   };
+
+   test_shm = odp_shm_reserve("test_shm",
+  params.buf_size * params.num_bufs * 2,
+  ODP_CACHE_LINE_SIZE,
+  0);
+   CU_ASSERT_FATAL(test_shm != ODP_SHM_INVALID);
+
+   pool = odp_buffer_pool_create("test_shm_pool", test_shm, ¶ms);
+   CU_ASSERT_FATAL(pool != ODP_BUFFER_POOL_INVALID);
+
+   CU_ASSERT(odp_buffer_pool_destroy(pool) == 0);
+   CU_ASSERT(odp_shm_free(test_shm) == 0);
+}
+
+static void pool_lookup_info_print(void)
+{
+   odp_buffer_pool_t pool;
+   const char pool_name[] = "pool_for_lookup_test";
+   odp_buffer_pool_info_t info;
+   odp_buffer_pool_param_t params = {
+   .buf_size  = default_buffer_size,
+   .bu

[lng-odp] [PATCH 3/3] validation: buffer: add initial packet tests

2014-12-12 Thread Taras Kondratiuk
Signed-off-by: Taras Kondratiuk 
---
 test/validation/Makefile.am|   1 +
 test/validation/buffer/odp_buffer_testsuites.h |   4 +
 test/validation/buffer/odp_packet_test.c   | 659 +
 test/validation/odp_buffer.c   |   5 +
 4 files changed, 669 insertions(+)
 create mode 100644 test/validation/buffer/odp_packet_test.c

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 41c48ec..2ceb27a 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -26,4 +26,5 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_buffer_SOURCES = buffer/odp_buffer_pool_test.c \
  buffer/odp_buffer_test.c \
+ buffer/odp_packet_test.c \
  odp_buffer.c common/odp_cunit_common.c
diff --git a/test/validation/buffer/odp_buffer_testsuites.h 
b/test/validation/buffer/odp_buffer_testsuites.h
index ca42c2d..715d9ac 100644
--- a/test/validation/buffer/odp_buffer_testsuites.h
+++ b/test/validation/buffer/odp_buffer_testsuites.h
@@ -16,10 +16,14 @@
 
 extern CU_TestInfo buffer_pool_tests[];
 extern CU_TestInfo buffer_tests[];
+extern CU_TestInfo packet_tests[];
 
 extern int buffer_testsuite_init(void);
 extern int buffer_testsuite_finalize(void);
 
+extern int packet_testsuite_init(void);
+extern int packet_testsuite_finalize(void);
+
 odp_buffer_pool_t pool_create(int buf_num, int buf_size, int buf_type);
 
 #endif /* ODP_BUFFER_TESTSUITES_H_ */
diff --git a/test/validation/buffer/odp_packet_test.c 
b/test/validation/buffer/odp_packet_test.c
new file mode 100644
index 000..fbce0df
--- /dev/null
+++ b/test/validation/buffer/odp_packet_test.c
@@ -0,0 +1,659 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+#include "odp_buffer_testsuites.h"
+#include 
+
+#define BUFFER_LENGTH  1500
+static odp_buffer_pool_t packet_pool;
+static const uint32_t packet_len = BUFFER_LENGTH;
+
+odp_packet_t test_packet;
+
+int packet_testsuite_init(void)
+{
+   odp_buffer_pool_param_t params = {
+   .buf_size  = BUFFER_LENGTH + ODP_CONFIG_PACKET_HEADROOM,
+   .buf_align = ODP_CACHE_LINE_SIZE,
+   .num_bufs  = 100,
+   .buf_type  = ODP_BUFFER_TYPE_PACKET,
+   };
+
+   packet_pool = odp_buffer_pool_create("packet_pool", ODP_SHM_INVALID,
+¶ms);
+   if (packet_pool == ODP_BUFFER_POOL_INVALID)
+   return -1;
+
+   test_packet = odp_packet_alloc(packet_pool, packet_len);
+   if (odp_packet_is_valid(test_packet) == 0)
+   return -1;
+
+   return 0;
+}
+
+int packet_testsuite_finalize(void)
+{
+   odp_packet_free(test_packet);
+   if (odp_buffer_pool_destroy(packet_pool) != 0)
+   return -1;
+   return 0;
+}
+
+static void packet_alloc_free(void)
+{
+   odp_buffer_pool_t pool;
+   odp_packet_t packet;
+   const uint32_t length = 64;
+   pool = pool_create(1, length + ODP_CONFIG_PACKET_HEADROOM,
+  ODP_BUFFER_TYPE_PACKET);
+
+   /* Allocate the only buffer from the pool */
+   packet = odp_packet_alloc(pool, length);
+   CU_ASSERT_FATAL(packet != ODP_PACKET_INVALID);
+   CU_ASSERT(odp_packet_len(packet) == length);
+   /** @todo: is it correct to assume the pool had only one buffer? */
+   CU_ASSERT_FATAL(odp_packet_alloc(pool, length) == ODP_PACKET_INVALID)
+
+   odp_packet_free(packet);
+
+   /* Check that the buffer was returned back to the pool */
+   packet = odp_packet_alloc(pool, length);
+   CU_ASSERT_FATAL(packet != ODP_PACKET_INVALID);
+   CU_ASSERT(odp_packet_len(packet) == length);
+
+   odp_packet_free(packet);
+   CU_ASSERT(odp_buffer_pool_destroy(pool) == 0);
+}
+
+static void packet_alloc_segmented(void)
+{
+   odp_packet_t pkt;
+   pkt = odp_packet_alloc(packet_pool, BUFFER_LENGTH * 10);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
+   odp_packet_free(pkt);
+}
+
+static void packet_buffer_conversion(void)
+{
+   odp_packet_t pkt = test_packet;
+   odp_packet_t tmp_pkt;
+   odp_buffer_t buf;
+
+   buf = odp_packet_to_buffer(pkt);
+   CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID);
+   CU_ASSERT(odp_buffer_type(buf) == ODP_BUFFER_TYPE_PACKET);
+   CU_ASSERT(odp_buffer_size(buf) == odp_packet_buf_len(pkt));
+
+   tmp_pkt = odp_packet_from_buffer(buf);
+   CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID);
+   /** @todo: Need an API to compare packets */
+}
+
+static void packet_basic_metadata(void)
+{
+   odp_packet_t pkt = test_packet;
+   CU_ASSERT(odp_packet_head(pkt) != NULL);
+   CU_ASSERT(odp_packet_data(pkt) != NULL);
+
+   CU_ASSERT(odp_packet_pool(pkt) != ODP_BUFFER_POOL_INVALID);
+   /* Pa

Re: [lng-odp] [PATCH] validation: XFAIL crypto until API is implemented

2014-12-12 Thread Maxim Uvarov

Merged,
Maxim.

On 12/09/2014 11:05 PM, Mike Holmes wrote:

Works around https://bugs.linaro.org/show_bug.cgi?id=975

Signed-off-by: Mike Holmes 
---
  test/validation/Makefile.am | 4 
  1 file changed, 4 insertions(+)

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 3670c76..d0b5426 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -25,3 +25,7 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  odp_crypto.c common/odp_cunit_common.c
  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
  dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
+
+#For Linux generic the unimplemented crypto API functions break the
+#regression TODO: https://bugs.linaro.org/show_bug.cgi?id=975
+XFAIL_TESTS=odp_crypto



___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Maxim Uvarov

Merged,
Maxim.

On 12/11/2014 06:43 PM, Ciprian Barbu wrote:

Signed-off-by: Ciprian Barbu 
---
v4:
  - fixes after Jerin's comments
  - removed tests_global_init and made it suite init function
v3:
  - changes after Mike's review
  - removed duplicate check of end of test in schedule_common_
v2:
  - rebased against ODP tip
  - fixed some bugs
  - added some defines to clearly see the testcase parameters

  test/validation/.gitignore |   1 +
  test/validation/Makefile.am|   5 +-
  test/validation/odp_schedule.c | 607 +
  3 files changed, 612 insertions(+), 1 deletion(-)
  create mode 100644 test/validation/odp_schedule.c

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 37e2594..32834ae 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -3,4 +3,5 @@
  odp_init
  odp_queue
  odp_crypto
+odp_schedule
  odp_shm
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 8547085..3670c76 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,13 +6,15 @@ AM_LDFLAGS += -static
  if ODP_CUNIT_ENABLED
  TESTS = ${bin_PROGRAMS}
  check_PROGRAMS = ${bin_PROGRAMS}
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
  odp_init_LDFLAGS = $(AM_LDFLAGS)
  odp_queue_LDFLAGS = $(AM_LDFLAGS)
  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
  odp_shm_CFLAGS = $(AM_CFLAGS)
  odp_shm_LDFLAGS = $(AM_LDFLAGS)
+odp_schedule_CFLAGS = $(AM_CFLAGS)
+odp_schedule_LDFLAGS = $(AM_LDFLAGS)
  endif
  
  dist_odp_init_SOURCES = odp_init.c

@@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
  crypto/odp_crypto_test_rng.c \
  odp_crypto.c common/odp_cunit_common.c
  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
+dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
new file mode 100644
index 000..9d410e4
--- /dev/null
+++ b/test/validation/odp_schedule.c
@@ -0,0 +1,607 @@
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include "odp_cunit_common.h"
+
+#define MAX_WORKERS_THREADS32
+#define MSG_POOL_SIZE  (4*1024*1024)
+#define QUEUES_PER_PRIO16
+#define BUF_SIZE   64
+#define TEST_NUM_BUFS  100
+#define BURST_BUF_SIZE 4
+#define TEST_NUM_BUFS_EXCL 1
+
+#define GLOBALS_SHM_NAME   "test_globals"
+#define MSG_POOL_NAME  "msg_pool"
+#define SHM_MSG_POOL_NAME  "shm_msg_pool"
+#define SHM_THR_ARGS_NAME  "shm_thr_args"
+
+#define ONE_Q  1
+#define MANY_QSQUEUES_PER_PRIO
+
+#define ONE_PRIO   1
+
+#define SCHD_ONE   0
+#define SCHD_MULTI 1
+
+#define DISABLE_EXCL_ATOMIC0
+#define ENABLE_EXCL_ATOMIC 1
+
+
+/* Test global variables */
+typedef struct {
+   int core_count;
+   odp_barrier_t barrier;
+   odp_schedule_prio_t current_prio;
+   int prio_buf_count;
+   odp_ticketlock_t count_lock;
+   odp_spinlock_t atomic_lock;
+} test_globals_t;
+
+typedef struct ODP_PACKED {
+   pthrd_arg thrdarg;
+   odp_schedule_sync_t sync;
+   int num_queues;
+   int num_prio;
+   int num_bufs;
+   int num_cores;
+   int enable_schd_multi;
+   int enable_excl_atomic;
+} thread_args_t;
+
+odp_buffer_pool_t pool;
+
+static void test_schedule_wait_time(void)
+{
+   uint64_t wait_time;
+
+   wait_time = odp_schedule_wait_time(0);
+
+   wait_time = odp_schedule_wait_time(1);
+   CU_ASSERT(wait_time > 0);
+
+   wait_time = odp_schedule_wait_time((uint64_t)-1LL);
+   CU_ASSERT(wait_time > 0);
+}
+
+static void test_schedule_num_prio(void)
+{
+   int prio;
+
+   prio = odp_schedule_num_prio();
+
+   CU_ASSERT(prio > 0);
+   CU_ASSERT(prio == odp_schedule_num_prio());
+}
+
+static void *schedule_common_(void *arg)
+{
+   thread_args_t *args = (thread_args_t *)arg;
+   odp_schedule_sync_t sync;
+   int num_queues, num_prio, num_bufs, num_cores;
+   odp_shm_t shm;
+   test_globals_t *globals;
+
+   sync = args->sync;
+   num_queues = args->num_queues;
+   num_prio = args->num_prio;
+   num_bufs = args->num_bufs;
+   num_cores = args->num_cores;
+
+   shm = odp_shm_lookup(GLOBALS_SHM_NAME);
+   CU_ASSERT_FATAL(shm != ODP_SHM_INVALID);
+   globals = odp_shm_addr(shm);
+   CU_ASSERT_FATAL(globals != NULL);
+
+
+   if (num_cores == globals->core_count)
+   odp_barrier_wait(&globals->barrier);
+
+   while (1) {
+   odp_buffer_t buf;
+   odp_queue_t from;
+   int num = 0;
+   int locked

Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Maxim Uvarov

On 12/12/2014 06:57 PM, Taras Kondratiuk wrote:

On 12/12/2014 05:51 PM, Maxim Uvarov wrote:

On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:

On 12/12/2014 05:03 PM, Maxim Uvarov wrote:

Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.

This check should be limited to platforms that use gcc atomics.

Do we have such platforms?

I assume you question was: do we have platform that *don't* use gcc
atomics? Currently all public platform do use gcc atomics, but we
shouldn't assume this for other platforms. Some of them may use older
version of gcc which doesn't have these built-ins.
Can this check be done/enabled per platform?

Ok, might be need platform/linux-x/configure.ac which will be included 
from main configure.ac.
In that case internal checks for compilers, bsp and etc will be in 
platform specific place.


Maxim.



___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Mike Holmes
On 12 December 2014 at 10:51, Maxim Uvarov  wrote:
>
> On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:
>
>> On 12/12/2014 05:03 PM, Maxim Uvarov wrote:
>>
>>> Odp atomic operations based on compiler build-ins. Make
>>> sure that compiler supports such operation at configure
>>> stage.
>>>
>> This check should be limited to platforms that use gcc atomics.
>>
> Do we have such platforms?


__OCTEON__ directly swappes out gcc, infact that pre processor switch
affects other files in linux-generic too.

static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom)
{
#if defined __OCTEON__
>---uint32_t ret;
>---__asm__ __volatile__ ("syncws");
>---__asm__ __volatile__ ("lai %0,(%2)" : "=r" (ret), "+m" (atom) :
>--->--->---  "r" (atom));
>---return ret;
#else
>---return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED);
#endif
}



>
>
> Maxim.
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>


-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Taras Kondratiuk
On 12/12/2014 05:51 PM, Maxim Uvarov wrote:
> On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:
>> On 12/12/2014 05:03 PM, Maxim Uvarov wrote:
>>> Odp atomic operations based on compiler build-ins. Make
>>> sure that compiler supports such operation at configure
>>> stage.
>> This check should be limited to platforms that use gcc atomics.
> Do we have such platforms?

I assume you question was: do we have platform that *don't* use gcc
atomics? Currently all public platform do use gcc atomics, but we
shouldn't assume this for other platforms. Some of them may use older
version of gcc which doesn't have these built-ins.
Can this check be done/enabled per platform?

-- 
Taras Kondratiuk

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Maxim Uvarov

On 12/12/2014 06:47 PM, Taras Kondratiuk wrote:

On 12/12/2014 05:03 PM, Maxim Uvarov wrote:

Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.

This check should be limited to platforms that use gcc atomics.

Do we have such platforms?

Maxim.

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Taras Kondratiuk
On 12/12/2014 05:03 PM, Maxim Uvarov wrote:
> Odp atomic operations based on compiler build-ins. Make
> sure that compiler supports such operation at configure
> stage.

This check should be limited to platforms that use gcc atomics.

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: initial pktio tests

2014-12-12 Thread Stuart Haslam
On Fri, Dec 12, 2014 at 03:37:13PM +, Maxim Uvarov wrote:
> On 12/03/2014 03:11 PM, Stuart Haslam wrote:
> > +   for (i = 0; i < 2; ++i) {
> > +   pktio[i] = create_pktio(iface_name[0]);
> > +   CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID);
> Stuart can you please chech that loop.  iface_name[0] for both cases?
> 
> Maxim.
> 

That's intentional, it's verifying that the sequence open->close->open
on the same interface works.

-- 
Stuart.


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: initial pktio tests

2014-12-12 Thread Maxim Uvarov

On 12/03/2014 03:11 PM, Stuart Haslam wrote:

+   for (i = 0; i < 2; ++i) {
+   pktio[i] = create_pktio(iface_name[0]);
+   CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID);

Stuart can you please chech that loop.  iface_name[0] for both cases?

Maxim.

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCHv2] configure.ac check for atomic operations support

2014-12-12 Thread Maxim Uvarov
Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.

Signed-off-by: Maxim Uvarov 
---
 configure.ac | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 8dbad4b..7bd2a47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,25 @@ AC_TYPE_INT32_T
 AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 
+AC_MSG_CHECKING(for GCC atomic builtins)
+AC_LINK_IFELSE(
+[AC_LANG_SOURCE(
+  [[#include 
+int main() {
+volatile uint32_t v = 1;
+__atomic_fetch_add(&v, 1, __ATOMIC_RELAXED);
+__atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED);
+__atomic_store_n(&v, 1, __ATOMIC_RELAXED);
+__atomic_load_n(&v, __ATOMIC_RELAXED);
+return 0;
+}
+]])],
+AC_MSG_RESULT(yes),
+AC_MSG_RESULT(no)
+echo "Atomic operation are not supported by your compiller."
+echo "Use newer version. For gcc > 4.7.3"
+exit -1)
+
 ##
 # Determine which platform to build for
 ##
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs

2014-12-12 Thread Bill Fischofer
It sounds like the only issues you're having is with the wording of the
comments in the .h file.  In the interest of time, would it be reasonable
to just merge the patch as-is and then you can post an update to change the
wording as you want?  Or just send me the file you'd like to include in
this patch and I'll replace it wholesale.

Bill

On Fri, Dec 12, 2014 at 7:42 AM, Savolainen, Petri (NSN - FI/Espoo) <
petri.savolai...@nsn.com> wrote:
>
>
>
>
>
> *From:* ext Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Thursday, December 11, 2014 6:51 PM
> *To:* Savolainen, Petri (NSN - FI/Espoo)
> *Cc:* lng-odp@lists.linaro.org
> *Subject:* Re: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs
>
>
>
>
>
>
>
> On Thu, Dec 11, 2014 at 9:52 AM, Savolainen, Petri (NSN - FI/Espoo) <
> petri.savolai...@nsn.com> wrote:
>
>
>
> > -Original Message-
> > From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
> > boun...@lists.linaro.org] On Behalf Of ext Bill Fischofer
> > Sent: Thursday, December 11, 2014 7:00 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> > v4 Removes RFC, incorporates doxygen change recommended by Anders and
> > PEtri
> > and incorporates bug fixes that enable it to pass Taras' buffer tests.
> >
>
>
> Note that size_t odp_buffer_size(odp_buffer_t buf) will be changed to
> uint32_t odp_buffer_len(odp_buffer_t buf), so that's in align with the
> packet API. It can be done in a separate patch.
>
>
>
> This patch reflects API changes to odp_buffer_pool.h.  Once it's merged a
> separate patch for API updates to odp_buffer.h should be done.  This one is
> big enough already, so best to do that in separate steps.
>
>
>
> OK, just noted the terminology change.
>
>
>
>
>
>
> >   */
> >  size_t odp_buffer_size(odp_buffer_t buf);
>
> >
> > +/**
> > + * Buffer pool parameters
> > + * Used to communicate buffer pool creation options.
> > + */
> > +typedef struct odp_buffer_pool_param_t {
> > + uint32_t buf_size;  /**< Buffer size in bytes.  The maximum
> > +number of bytes application will
> > +store in each buffer. For packets, this
> > +is the maximum packet data length, and
> > +configured headroom and tailroom will be
> > +added to this number */
>
>  This could be renamed to buf_len, so that's in align with the packet API.
>
> This could be specified as the minimum available buffer space in bytes.
> Implementation can allocate and give access to (odp_buffer_len() >=
> param.buf_len) larger buffer space, if it fits better for implementation
> alignment rules, etc.
>
> For example:
> - application can ask param.buf_len = 256
> - implementation can allocate 512 bytes and fill in first 32 bytes with
> its internal headers
> - odp_buffer_len() or odp_packet_seg_buf_len() would return 480 bytes
> - for the first segment packet input HW may
>   - leave 66 bytes of headroom (if default min headroom is 64 bytes)
>   - fill in 384 bytes of packet data
>   - leave last 32 bytes unused, and continue packet data in the next
> segment, ...
>
> So head/tailroom are included into buf_len in the first/last segments.
>
>
>
>
>
> Again, I think these changes would best be done as a follow-on patch after
> this one is merged.  Possibly in v0.6?
>
>
>
> As an aside, we should not specify how implementations store or maintain
> metadata.  That's not relevant to the ODP APIs that the application sees.
>
>
>
>
>
> > + uint32_t buf_size;  /**< Buffer size in bytes.  *The maximum*
> > +*number of bytes application will*
> > +*store in each buffer. For packets, this*
> > +
> *is the maximum packet data length, and *> +
> *configured
> headroom and tailroom will be*
> > +*added to this number* */
>
>
>
> The point is that this should be specified as: minimum odp_buffer_len()
> for raw buffers, and minimum odp_packet_seg_len() /
> odp_packet_seg_buf_len() in case of packets (those include possible
> head/tailrooms). This is all specified in v0.5 draft api and slides.
>
>
>
>
>
> > If no shared memory object was passed
> > as
> > + * part of the create call, then this routine will destroy any internal
> > shared
> > + * memory objects associated with the buffer pool.
>
>   This sentence is not needed, since it should free any resource that was
> reserved in create call.
>
>
>
> I thought the clarification was worthwhile, to contrast the behavior with
> what happens for pools that were created with a user-specified shm handle.
>
>
>
> I think it’s redundant. Internal memory objects may be or may not be shm –
> in any case implementation will clean up any HW resources allocated
> previously.
>
>
>
>
>
>
>
> > Results are undefined
> > if
> > + * an attempt is mad

[lng-odp] [PATCH] configure.ac check for atomic operations support

2014-12-12 Thread Maxim Uvarov
Odp atomic operations based on compiler build-ins. Make
sure that compiler supports such operation at configure
stage.

Signed-off-by: Maxim Uvarov 
---
 configure.ac | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 8dbad4b..29387ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,25 @@ AC_TYPE_INT32_T
 AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 
+AC_MSG_CHECKING(for MAX GCC atomic builtins)
+AC_LINK_IFELSE(
+[AC_LANG_SOURCE(
+  [[#include 
+int main() {
+volatile uint32_t v = 1;
+__atomic_fetch_add(&v, 1, __ATOMIC_RELAXED);
+__atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED);
+__atomic_store_n(&v, 1, __ATOMIC_RELAXED);
+__atomic_load_n(&v, __ATOMIC_RELAXED);
+return 0;
+}
+]])],
+AC_MSG_RESULT(yes),
+AC_MSG_RESULT(no)
+echo "Atomic operation are not supported by your compiller."
+echo "Use newer version. For gcc > 4.7.3"
+exit -1)
+
 ##
 # Determine which platform to build for
 ##
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] turn on -std=c99

2014-12-12 Thread Bill Fischofer
The problem with adding _BSD_SOURCE globally is that it's too easy for
people to not be aware of their use of non-compliant routines unless they
get a per-module warning which they can then document by including such
overrides themselves.  So I agree that we want c99 to be set globally, but
I'd prefer to see the overrides done on  per-module basis.

On Fri, Dec 12, 2014 at 7:02 AM, Mike Holmes  wrote:
>
>
>
> On 12 December 2014 at 07:48, Maxim Uvarov 
> wrote:
>>
>> On 12/12/2014 03:38 PM, Bill Fischofer wrote:
>>
>>> Are we really ready to do this?  I thought the idea was we were going to
>>> have each routine that needed it include the BSD/POSIX #defines so that
>>> they document their need for this on a case-by-case basis.
>>>
>>
>> Might be it was better to send this as RFC as discussion patch.
>>
>
> I think we need to wait until the code catches up and this CI job
> 
> runs clean, then turning on c99 will enforce it going forward.
>
> If we want to change what our future flags will be, lets add them to this
> job first.
>
> Obviously  -std=c99  is a no brainer addition and it there already,
> however the blanket adding of _BSD_SOURCE may not be the best idea.
> I think I saw a way on a forum somewhere that we can add this flags effect
> per API used - that way we would better document what we depend on for
> linux-generic - if there is no such mechanism lets add _BSD_SOURCE to the
> CI job.
>
>
>> Most of linux-generic implementation will need posix defines. I'm not
>> sure if that 2 options overlap each other or not. But I think all code
>> should follow the same posix standard.
>>
>
>> Maxim.
>>
>>
>>> On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov >> > wrote:
>>>
>>> Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
>>> system calls and turn on -std=c99.
>>>
>>> Signed-off-by: Maxim Uvarov >> >
>>> ---
>>> configure.ac  | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/configure.ac  b/configure.ac
>>> 
>>> index 2f27261..d9167a5 100644
>>> --- a/configure.ac 
>>> +++ b/configure.ac 
>>> @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
>>> -Wold-style-definition -Wpointer-
>>>  ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>>> -Wformat-nonliteral"
>>>  ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>>>
>>> +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
>>> -D_POSIX_C_SOURCE=200809L"
>>> +
>>>  
>>> ##
>>>  # Default include setup
>>>  
>>> ##
>>> --
>>> 1.8.5.1.163.gd7aced9
>>>
>>>
>>> ___
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org 
>>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>>
>>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv3] odp version script

2014-12-12 Thread Anders Roxell
On 12 December 2014 at 14:13, Mike Holmes  wrote:
>
>
> On 12 December 2014 at 07:43, Maxim Uvarov  wrote:
>>
>> Update odp version in one place (C code), and use it for doxygen also.
>>
>> Signed-off-by: Maxim Uvarov 
>
>
> Reviewed-and-tested-by: Mike Holmes 

Reviewed-by: Anders Roxell 

>
>>
>> ---
>>  configure.ac   | 2 +-
>>  doc/doxygen.cfg| 2 +-
>>  m4/ax_prog_doxygen.m4  | 2 +-
>>  scripts/odp_version.sh | 9 +
>>  4 files changed, 12 insertions(+), 3 deletions(-)
>>  create mode 100755 scripts/odp_version.sh
>>
>> diff --git a/configure.ac b/configure.ac
>> index 2f27261..8dbad4b 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -1,5 +1,5 @@
>>  AC_PREREQ([2.5])
>> -AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
>> +AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh),
>> [lng-odp@lists.linaro.org])
>>  AM_INIT_AUTOMAKE([subdir-objects])
>>  AC_CONFIG_SRCDIR([helper/config.h.in])
>>  AM_CONFIG_HEADER([helper/config.h])
>> diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
>> index 03bcc20..050c94a 100644
>> --- a/doc/doxygen.cfg
>> +++ b/doc/doxygen.cfg
>> @@ -1,5 +1,5 @@
>>  PROJECT_NAME = "API Reference Manual"
>> -PROJECT_NUMBER = 0.4.0
>> +PROJECT_NUMBER = $(VERSION)
>>  PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
>>  QUIET = YES
>>  OUTPUT_DIRECTORY = $(DOCDIR)
>> diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
>> index aa4acc2..0f58b3e 100644
>> --- a/m4/ax_prog_doxygen.m4
>> +++ b/m4/ax_prog_doxygen.m4
>> @@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc,
>> [$3])])
>>  DX_ENV_APPEND(SRCDIR, $srcdir)
>>  DX_ENV_APPEND(PROJECT, $DX_PROJECT)
>>  DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
>> -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
>> +DX_ENV_APPEND(VERSION, $VERSION)
>>
>>  # Doxygen itself:
>>  DX_ARG_ABLE(doc, [generate any doxygen documentation],
>> diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
>> new file mode 100755
>> index 000..72ae404
>> --- /dev/null
>> +++ b/scripts/odp_version.sh
>> @@ -0,0 +1,9 @@
>> +#!/bin/bash
>> +
>> +VFILE="platform/linux-generic/include/api/odp_version.h"
>> +
>> +GEN=`grep "define ODP_VERSION_API_GENERATION"  ${VFILE} | cut -d ' ' -f
>> 3`
>> +MAJ=`grep "define ODP_VERSION_API_MAJOR"   ${VFILE} | cut -d ' ' -f
>> 3`
>> +MIN=`grep "define ODP_VERSION_API_MINOR"   ${VFILE} | cut -d ' ' -f
>> 3`
>> +
>> +echo -n $GEN.$MAJ.$MIN
>> --
>> 1.8.5.1.163.gd7aced9
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> --
> Mike Holmes
> Linaro  Sr Technical Manager
> LNG - ODP
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs

2014-12-12 Thread Savolainen, Petri (NSN - FI/Espoo)


From: ext Bill Fischofer [mailto:bill.fischo...@linaro.org]
Sent: Thursday, December 11, 2014 6:51 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs



On Thu, Dec 11, 2014 at 9:52 AM, Savolainen, Petri (NSN - FI/Espoo) 
mailto:petri.savolai...@nsn.com>> wrote:


> -Original Message-
> From: 
> lng-odp-boun...@lists.linaro.org 
> [mailto:lng-odp-
> boun...@lists.linaro.org] On Behalf Of ext 
> Bill Fischofer
> Sent: Thursday, December 11, 2014 7:00 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCHv4] Implement v0.5 buffer pool APIs
>
> Signed-off-by: Bill Fischofer 
> mailto:bill.fischo...@linaro.org>>
> ---
> v4 Removes RFC, incorporates doxygen change recommended by Anders and
> PEtri
> and incorporates bug fixes that enable it to pass Taras' buffer tests.
>


Note that size_t odp_buffer_size(odp_buffer_t buf) will be changed to
uint32_t odp_buffer_len(odp_buffer_t buf), so that's in align with the packet 
API. It can be done in a separate patch.

This patch reflects API changes to odp_buffer_pool.h.  Once it's merged a 
separate patch for API updates to odp_buffer.h should be done.  This one is big 
enough already, so best to do that in separate steps.

OK, just noted the terminology change.



>   */
>  size_t odp_buffer_size(odp_buffer_t buf);
>
> +/**
> + * Buffer pool parameters
> + * Used to communicate buffer pool creation options.
> + */
> +typedef struct odp_buffer_pool_param_t {
> + uint32_t buf_size;  /**< Buffer size in bytes.  The maximum
> +number of bytes application will
> +store in each buffer. For packets, this
> +is the maximum packet data length, and
> +configured headroom and tailroom will be
> +added to this number */
This could be renamed to buf_len, so that's in align with the packet API.

This could be specified as the minimum available buffer space in bytes. 
Implementation can allocate and give access to (odp_buffer_len() >= 
param.buf_len) larger buffer space, if it fits better for implementation 
alignment rules, etc.

For example:
- application can ask param.buf_len = 256
- implementation can allocate 512 bytes and fill in first 32 bytes with its 
internal headers
- odp_buffer_len() or odp_packet_seg_buf_len() would return 480 bytes
- for the first segment packet input HW may
  - leave 66 bytes of headroom (if default min headroom is 64 bytes)
  - fill in 384 bytes of packet data
  - leave last 32 bytes unused, and continue packet data in the next segment, 
...

So head/tailroom are included into buf_len in the first/last segments.


Again, I think these changes would best be done as a follow-on patch after this 
one is merged.  Possibly in v0.6?

As an aside, we should not specify how implementations store or maintain 
metadata.  That's not relevant to the ODP APIs that the application sees.


> + uint32_t buf_size;  /**< Buffer size in bytes.  The maximum
> +number of bytes application will
> +store in each buffer. For packets, this
> +is the maximum packet data length, and
> +configured headroom and tailroom will be
> +added to this number */

The point is that this should be specified as: minimum odp_buffer_len() for raw 
buffers, and minimum odp_packet_seg_len() / odp_packet_seg_buf_len() in case of 
packets (those include possible head/tailrooms). This is all specified in v0.5 
draft api and slides.



> If no shared memory object was passed
> as
> + * part of the create call, then this routine will destroy any internal
> shared
> + * memory objects associated with the buffer pool.

This sentence is not needed, since it should free any resource that was 
reserved in create call.

I thought the clarification was worthwhile, to contrast the behavior with what 
happens for pools that were created with a user-specified shm handle.

I think it’s redundant. Internal memory objects may be or may not be shm – in 
any case implementation will clean up any HW resources allocated previously.




> Results are undefined
> if
> + * an attempt is made to destroy a buffer pool that contains allocated or
> + * otherwise active buffers.
> + */
> +int odp_buffer_pool_destroy(odp_buffer_pool_t pool);
>
>  /**
>   * Find a buffer pool by name
>   *
>   * @param name  Name of the pool
>   *
> - * @return Buffer pool handle, or ODP_BUFFER_POOL_INVALID if not found.
> + * @return Buffer pool handle on success, ODP_BUFFER_POOL_INVALID on
> failure
> + *
> + * @note This routine cannot be used to look up an anonymous pool (one
> created
> + * with no name).
>   */
>  odp_buffer_p

Re: [lng-odp] [PATCH v2] validation:add atomic test in odp syncronizers

2014-12-12 Thread Anders Roxell
On 2014-12-12 02:30, Yan Sonming wrote:
> Remove odp_atomic_test in test/api_test and  add the odp_atomic_test
> to test/validation as one part of odp syncronizers
> 
> Signed-off-by: Yan Songming 
> ---
>  test/api_test/Makefile.am  |   5 +-
>  test/api_test/odp_atomic_test.c| 299 
> -
>  test/api_test/odp_atomic_test.h|  51 --
>  test/api_test/odp_common.c |   1 -

Remove the api_test should be in its own commit.

>  test/validation/.gitignore |   1 +
>  test/validation/Makefile.am|   6 +-
>  test/validation/odp_syne.c |  15 ++

what is "syne" it doesn't make sence!
think it should be "sync"

>  test/validation/syne/odp_test_atomic.c | 258 
>  test/validation/syne/odp_test_atomic.h |  14 ++

drop the _test from the filename.

>  9 files changed, 294 insertions(+), 356 deletions(-)
>  delete mode 100644 test/api_test/odp_atomic_test.c
>  delete mode 100644 test/api_test/odp_atomic_test.h
>  create mode 100644 test/validation/odp_syne.c
>  create mode 100644 test/validation/syne/odp_test_atomic.c
>  create mode 100644 test/validation/syne/odp_test_atomic.h
> 

[...]

> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 37e2594..22c867a 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -4,3 +4,4 @@ odp_init
>  odp_queue
>  odp_crypto
>  odp_shm
> +odp_syne
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 8547085..073e72b 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_syne
>  odp_init_LDFLAGS = $(AM_LDFLAGS)
>  odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>  odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_syne_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/syne
> +odp_syne_LDFLAGS = $(AM_LDFLAGS)
>  endif
>  
>  dist_odp_init_SOURCES = odp_init.c
> @@ -22,3 +24,5 @@ dist_odp_crypto_SOURCES = 
> crypto/odp_crypto_test_async_inp.c \
> crypto/odp_crypto_test_rng.c \
> odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> +dist_odp_syne_SOURCES = odp_syne.c   syne/odp_test_atomic.c\
> + common/odp_cunit_common.c
> diff --git a/test/validation/odp_syne.c b/test/validation/odp_syne.c
> new file mode 100644
> index 000..9a39740
> --- /dev/null
> +++ b/test/validation/odp_syne.c
> @@ -0,0 +1,15 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include 
> +#include "odp_test_atomic.h"
> +
> +CU_SuiteInfo odp_testsuites[] = {
> + {"ODP_ATOMIC", NULL, NULL, NULL, NULL, test_odp_atomic},
> + /* {"ODP_LOCK", NULL, NULL, NULL, NULL, test_odp_lock},*/
> + CU_SUITE_INFO_NULL,
> +};
> diff --git a/test/validation/syne/odp_test_atomic.c 
> b/test/validation/syne/odp_test_atomic.c
> new file mode 100644
> index 000..3f983fa
> --- /dev/null
> +++ b/test/validation/syne/odp_test_atomic.c
> @@ -0,0 +1,258 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +static odp_atomic_u32_t a32u;
> +static odp_atomic_u64_t a64u;
> +
> +
> +#define ADD_SUB_CNT  5
> +
> +#define  CNT 10
> +#define  U32_INIT_VAL(1UL << 10)
> +#define  U64_INIT_VAL(1ULL << 33)
> +
> +
> +static void test_atomic_inc_u32(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_inc_u32(&a32u);
> +}
> +
> +static void test_atomic_inc_64(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_inc_u64(&a64u);
> +}
> +
> +static void test_atomic_dec_u32(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_dec_u32(&a32u);
> +}
> +
> +static void test_atomic_dec_64(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_dec_u64(&a64u);
> +}
> +static void test_atomic_fetch_inc_u32(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_fetch_inc_u32(&a32u);
> +}
> +
> +static void test_atomic_fetch_inc_64(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_fetch_inc_u64(&a64u);
> +}
> +
> +static void test_atomic_fetch_dec_u32(void)
> +{
> + int i;
> +
> + for (i = 0; i < CNT; i++)
> + odp_atomic_fetch_dec_u32(&a32u);
> +}
> +
> +static void test_atomic_fetch_dec_64(v

Re: [lng-odp] [PATCHv4] validation: schedule: initial testcases

2014-12-12 Thread Jerin Jacob
On Thu, Dec 11, 2014 at 01:07:26PM -0500, Mike Holmes wrote:
> On 11 December 2014 at 10:43, Ciprian Barbu 
> wrote:
> 
> > Signed-off-by: Ciprian Barbu 
> >

Reviewed-and-Tested-by: Jerin Jacob 

> 
> Reviewed-by: Mike Holmes 
> 
> My issues are covered, we will need to implement the clean up to compliment
>  schd_suite_init, once those APIs are in the repo.
> 
> Mike
> 
> 
> 
> > ---
> > v4:
> >  - fixes after Jerin's comments
> >  - removed tests_global_init and made it suite init function
> > v3:
> >  - changes after Mike's review
> >  - removed duplicate check of end of test in schedule_common_
> > v2:
> >  - rebased against ODP tip
> >  - fixed some bugs
> >  - added some defines to clearly see the testcase parameters
> >
> >  test/validation/.gitignore |   1 +
> >  test/validation/Makefile.am|   5 +-
> >  test/validation/odp_schedule.c | 607
> > +
> >  3 files changed, 612 insertions(+), 1 deletion(-)
> >  create mode 100644 test/validation/odp_schedule.c
> >
> > diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> > index 37e2594..32834ae 100644
> > --- a/test/validation/.gitignore
> > +++ b/test/validation/.gitignore
> > @@ -3,4 +3,5 @@
> >  odp_init
> >  odp_queue
> >  odp_crypto
> > +odp_schedule
> >  odp_shm
> > diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> > index 8547085..3670c76 100644
> > --- a/test/validation/Makefile.am
> > +++ b/test/validation/Makefile.am
> > @@ -6,13 +6,15 @@ AM_LDFLAGS += -static
> >  if ODP_CUNIT_ENABLED
> >  TESTS = ${bin_PROGRAMS}
> >  check_PROGRAMS = ${bin_PROGRAMS}
> > -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm
> > +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> >  odp_init_LDFLAGS = $(AM_LDFLAGS)
> >  odp_queue_LDFLAGS = $(AM_LDFLAGS)
> >  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >  odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> >  odp_shm_CFLAGS = $(AM_CFLAGS)
> >  odp_shm_LDFLAGS = $(AM_LDFLAGS)
> > +odp_schedule_CFLAGS = $(AM_CFLAGS)
> > +odp_schedule_LDFLAGS = $(AM_LDFLAGS)
> >  endif
> >
> >  dist_odp_init_SOURCES = odp_init.c
> > @@ -22,3 +24,4 @@ dist_odp_crypto_SOURCES =
> > crypto/odp_crypto_test_async_inp.c \
> >   crypto/odp_crypto_test_rng.c \
> >   odp_crypto.c common/odp_cunit_common.c
> >  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> > +dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> > diff --git a/test/validation/odp_schedule.c
> > b/test/validation/odp_schedule.c
> > new file mode 100644
> > index 000..9d410e4
> > --- /dev/null
> > +++ b/test/validation/odp_schedule.c
> > @@ -0,0 +1,607 @@
> > +/* Copyright (c) 2014, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +#include 
> > +#include "odp_cunit_common.h"
> > +
> > +#define MAX_WORKERS_THREADS32
> > +#define MSG_POOL_SIZE  (4*1024*1024)
> > +#define QUEUES_PER_PRIO16
> > +#define BUF_SIZE   64
> > +#define TEST_NUM_BUFS  100
> > +#define BURST_BUF_SIZE 4
> > +#define TEST_NUM_BUFS_EXCL 1
> > +
> > +#define GLOBALS_SHM_NAME   "test_globals"
> > +#define MSG_POOL_NAME  "msg_pool"
> > +#define SHM_MSG_POOL_NAME  "shm_msg_pool"
> > +#define SHM_THR_ARGS_NAME  "shm_thr_args"
> > +
> > +#define ONE_Q  1
> > +#define MANY_QSQUEUES_PER_PRIO
> > +
> > +#define ONE_PRIO   1
> > +
> > +#define SCHD_ONE   0
> > +#define SCHD_MULTI 1
> > +
> > +#define DISABLE_EXCL_ATOMIC0
> > +#define ENABLE_EXCL_ATOMIC 1
> > +
> > +
> > +/* Test global variables */
> > +typedef struct {
> > +   int core_count;
> > +   odp_barrier_t barrier;
> > +   odp_schedule_prio_t current_prio;
> > +   int prio_buf_count;
> > +   odp_ticketlock_t count_lock;
> > +   odp_spinlock_t atomic_lock;
> > +} test_globals_t;
> > +
> > +typedef struct ODP_PACKED {
> > +   pthrd_arg thrdarg;
> > +   odp_schedule_sync_t sync;
> > +   int num_queues;
> > +   int num_prio;
> > +   int num_bufs;
> > +   int num_cores;
> > +   int enable_schd_multi;
> > +   int enable_excl_atomic;
> > +} thread_args_t;
> > +
> > +odp_buffer_pool_t pool;
> > +
> > +static void test_schedule_wait_time(void)
> > +{
> > +   uint64_t wait_time;
> > +
> > +   wait_time = odp_schedule_wait_time(0);
> > +
> > +   wait_time = odp_schedule_wait_time(1);
> > +   CU_ASSERT(wait_time > 0);
> > +
> > +   wait_time = odp_schedule_wait_time((uint64_t)-1LL);
> > +   CU_ASSERT(wait_time > 0);
> > +}
> > +
> > +static void test_schedule_num_prio(void)
> > +{
> > +   int prio;
> > +
> > +   prio = odp_schedule_num_prio();
> > +
> > +   CU_ASSERT(prio > 0);
> > +   CU_ASSERT(prio == odp_schedule_num_prio());
> > +}
> > +
> > +static void 

Re: [lng-odp] [PATCHv3] odp version script

2014-12-12 Thread Mike Holmes
On 12 December 2014 at 07:43, Maxim Uvarov  wrote:
>
> Update odp version in one place (C code), and use it for doxygen also.
>
> Signed-off-by: Maxim Uvarov 
>

Reviewed-and-tested-by: Mike Holmes 


> ---
>  configure.ac   | 2 +-
>  doc/doxygen.cfg| 2 +-
>  m4/ax_prog_doxygen.m4  | 2 +-
>  scripts/odp_version.sh | 9 +
>  4 files changed, 12 insertions(+), 3 deletions(-)
>  create mode 100755 scripts/odp_version.sh
>
> diff --git a/configure.ac b/configure.ac
> index 2f27261..8dbad4b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,5 +1,5 @@
>  AC_PREREQ([2.5])
> -AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
> +AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), [
> lng-odp@lists.linaro.org])
>  AM_INIT_AUTOMAKE([subdir-objects])
>  AC_CONFIG_SRCDIR([helper/config.h.in])
>  AM_CONFIG_HEADER([helper/config.h])
> diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
> index 03bcc20..050c94a 100644
> --- a/doc/doxygen.cfg
> +++ b/doc/doxygen.cfg
> @@ -1,5 +1,5 @@
>  PROJECT_NAME = "API Reference Manual"
> -PROJECT_NUMBER = 0.4.0
> +PROJECT_NUMBER = $(VERSION)
>  PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
>  QUIET = YES
>  OUTPUT_DIRECTORY = $(DOCDIR)
> diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
> index aa4acc2..0f58b3e 100644
> --- a/m4/ax_prog_doxygen.m4
> +++ b/m4/ax_prog_doxygen.m4
> @@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc,
> [$3])])
>  DX_ENV_APPEND(SRCDIR, $srcdir)
>  DX_ENV_APPEND(PROJECT, $DX_PROJECT)
>  DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
> -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
> +DX_ENV_APPEND(VERSION, $VERSION)
>
>  # Doxygen itself:
>  DX_ARG_ABLE(doc, [generate any doxygen documentation],
> diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
> new file mode 100755
> index 000..72ae404
> --- /dev/null
> +++ b/scripts/odp_version.sh
> @@ -0,0 +1,9 @@
> +#!/bin/bash
> +
> +VFILE="platform/linux-generic/include/api/odp_version.h"
> +
> +GEN=`grep "define ODP_VERSION_API_GENERATION"  ${VFILE} | cut -d ' ' -f 3`
> +MAJ=`grep "define ODP_VERSION_API_MAJOR"   ${VFILE} | cut -d ' ' -f 3`
> +MIN=`grep "define ODP_VERSION_API_MINOR"   ${VFILE} | cut -d ' ' -f 3`
> +
> +echo -n $GEN.$MAJ.$MIN
> --
> 1.8.5.1.163.gd7aced9
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>


-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] turn on -std=c99

2014-12-12 Thread Mike Holmes
On 12 December 2014 at 07:48, Maxim Uvarov  wrote:
>
> On 12/12/2014 03:38 PM, Bill Fischofer wrote:
>
>> Are we really ready to do this?  I thought the idea was we were going to
>> have each routine that needed it include the BSD/POSIX #defines so that
>> they document their need for this on a case-by-case basis.
>>
>
> Might be it was better to send this as RFC as discussion patch.
>

I think we need to wait until the code catches up and this CI job

runs clean, then turning on c99 will enforce it going forward.

If we want to change what our future flags will be, lets add them to this
job first.

Obviously  -std=c99  is a no brainer addition and it there already, however
the blanket adding of _BSD_SOURCE may not be the best idea.
I think I saw a way on a forum somewhere that we can add this flags effect
per API used - that way we would better document what we depend on for
linux-generic - if there is no such mechanism lets add _BSD_SOURCE to the
CI job.


> Most of linux-generic implementation will need posix defines. I'm not sure
> if that 2 options overlap each other or not. But I think all code should
> follow the same posix standard.
>

> Maxim.
>
>
>> On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov > > wrote:
>>
>> Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
>> system calls and turn on -std=c99.
>>
>> Signed-off-by: Maxim Uvarov > >
>> ---
>> configure.ac  | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/configure.ac  b/configure.ac
>> 
>> index 2f27261..d9167a5 100644
>> --- a/configure.ac 
>> +++ b/configure.ac 
>> @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
>> -Wold-style-definition -Wpointer-
>>  ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>> -Wformat-nonliteral"
>>  ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>>
>> +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
>> -D_POSIX_C_SOURCE=200809L"
>> +
>>  
>> ##
>>  # Default include setup
>>  
>> ##
>> --
>> 1.8.5.1.163.gd7aced9
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org 
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>


-- 
*Mike Holmes*
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] turn on -std=c99

2014-12-12 Thread Maxim Uvarov

On 12/12/2014 03:38 PM, Bill Fischofer wrote:
Are we really ready to do this?  I thought the idea was we were going 
to have each routine that needed it include the BSD/POSIX #defines so 
that they document their need for this on a case-by-case basis.


Might be it was better to send this as RFC as discussion patch.

Most of linux-generic implementation will need posix defines. I'm not 
sure if that 2 options overlap each other or not. But I think all code 
should follow the same posix standard.


Maxim.



On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov > wrote:


Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
system calls and turn on -std=c99.

Signed-off-by: Maxim Uvarov mailto:maxim.uva...@linaro.org>>
---
configure.ac  | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure.ac  b/configure.ac

index 2f27261..d9167a5 100644
--- a/configure.ac 
+++ b/configure.ac 
@@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
-Wold-style-definition -Wpointer-
 ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
-Wformat-nonliteral"
 ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"

+ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE
-D_POSIX_C_SOURCE=200809L"
+
 ##
 # Default include setup
 ##
--
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org 
http://lists.linaro.org/mailman/listinfo/lng-odp




___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCHv3] odp version script

2014-12-12 Thread Maxim Uvarov
Update odp version in one place (C code), and use it for doxygen also.

Signed-off-by: Maxim Uvarov 
---
 configure.ac   | 2 +-
 doc/doxygen.cfg| 2 +-
 m4/ax_prog_doxygen.m4  | 2 +-
 scripts/odp_version.sh | 9 +
 4 files changed, 12 insertions(+), 3 deletions(-)
 create mode 100755 scripts/odp_version.sh

diff --git a/configure.ac b/configure.ac
index 2f27261..8dbad4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.5])
-AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
+AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), 
[lng-odp@lists.linaro.org])
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_CONFIG_SRCDIR([helper/config.h.in])
 AM_CONFIG_HEADER([helper/config.h])
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index 03bcc20..050c94a 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -1,5 +1,5 @@
 PROJECT_NAME = "API Reference Manual"
-PROJECT_NUMBER = 0.4.0
+PROJECT_NUMBER = $(VERSION)
 PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
 QUIET = YES
 OUTPUT_DIRECTORY = $(DOCDIR)
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
index aa4acc2..0f58b3e 100644
--- a/m4/ax_prog_doxygen.m4
+++ b/m4/ax_prog_doxygen.m4
@@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
 DX_ENV_APPEND(SRCDIR, $srcdir)
 DX_ENV_APPEND(PROJECT, $DX_PROJECT)
 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+DX_ENV_APPEND(VERSION, $VERSION)
 
 # Doxygen itself:
 DX_ARG_ABLE(doc, [generate any doxygen documentation],
diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
new file mode 100755
index 000..72ae404
--- /dev/null
+++ b/scripts/odp_version.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+VFILE="platform/linux-generic/include/api/odp_version.h"
+
+GEN=`grep "define ODP_VERSION_API_GENERATION"  ${VFILE} | cut -d ' ' -f 3`
+MAJ=`grep "define ODP_VERSION_API_MAJOR"   ${VFILE} | cut -d ' ' -f 3`
+MIN=`grep "define ODP_VERSION_API_MINOR"   ${VFILE} | cut -d ' ' -f 3`
+
+echo -n $GEN.$MAJ.$MIN
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] turn on -std=c99

2014-12-12 Thread Bill Fischofer
Are we really ready to do this?  I thought the idea was we were going to
have each routine that needed it include the BSD/POSIX #defines so that
they document their need for this on a case-by-case basis.

On Fri, Dec 12, 2014 at 6:31 AM, Maxim Uvarov 
wrote:
>
> Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
> system calls and turn on -std=c99.
>
> Signed-off-by: Maxim Uvarov 
> ---
>  configure.ac | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 2f27261..d9167a5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations
> -Wold-style-definition -Wpointer-
>  ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
> -Wformat-nonliteral"
>  ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>
> +ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L"
> +
>  ##
>  # Default include setup
>  ##
> --
> 1.8.5.1.163.gd7aced9
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] turn on -std=c99

2014-12-12 Thread Maxim Uvarov
Define _POSIX_C_SOURCE and _BSD_SOURCE to make gcc accept
system calls and turn on -std=c99.

Signed-off-by: Maxim Uvarov 
---
 configure.ac | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure.ac b/configure.ac
index 2f27261..d9167a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,6 +179,8 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations 
-Wold-style-definition -Wpointer-
 ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual 
-Wformat-nonliteral"
 ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
 
+ODP_CFLAGS="$ODP_CFLAGS -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L"
+
 ##
 # Default include setup
 ##
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] api: doxygen: test_odp_sys_cpu_model_str

2014-12-12 Thread Savolainen, Petri (NSN - FI/Espoo)


From: ext Mike Holmes [mailto:mike.hol...@linaro.org]
Sent: Thursday, December 11, 2014 9:03 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH] api: doxygen: test_odp_sys_cpu_model_str


On 11 December 2014 at 07:13, Savolainen, Petri (NSN - FI/Espoo) 
mailto:petri.savolai...@nsn.com>> wrote:

> -Original Message-
> From: 
> lng-odp-boun...@lists.linaro.org 
> [mailto:lng-odp-
> boun...@lists.linaro.org] On Behalf Of ext 
> Mike Holmes
> Sent: Thursday, December 11, 2014 12:01 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] api: doxygen: test_odp_sys_cpu_model_str
>
> Specify more clearly the behaviour of the function.
>
> Signed-off-by: Mike Holmes 
> mailto:mike.hol...@linaro.org>>
> ---
>  platform/linux-generic/include/api/odp_system_info.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_system_info.h
> b/platform/linux-generic/include/api/odp_system_info.h
> index bcd08d7..bf5896c 100644
> --- a/platform/linux-generic/include/api/odp_system_info.h
> +++ b/platform/linux-generic/include/api/odp_system_info.h
> @@ -48,6 +48,8 @@ uint64_t odp_sys_page_size(void);
>
>  /**
>   * CPU model name
> + * The string is 128 chars long and will be NULL terminatied.
> + * The pointer will never be NULL, but it may be an empty string.
>   *
>   * @return Pointer to CPU model name string
>   */

While 128 chars would be reasonable limit, I think we need not restrict the 
length. Application can copy or print only subset of that (into a log entry, 
etc). I'd change it like this:

For 1.0 ?
If so there are a lot more details we need to look at in system_into besides 
this I think.
Is it better to document the reality of what we have now and make changes later?
Possibly better still delete the system_info APIs altogether for 1.0 because 
they have some strong assumptions that are not clear in the API definition and 
ODP should abstract network acceleration functionality and not OS calls - maybe 
these should be in odph if they are there at all ?

It’s good information for error/performance test/crash log reporting. Which Soc 
or cpu model/revision/core speed/memory speed/etc. Some vendors may have good 
reasons to output 129 chars…


Back to this case
Are you proposing that if you need to copy the string as you mention above you 
have to call the function, then get the string length, malloc space and then 
copy it ? feels like a lot of effort for a string used in debug messages that 
is not likely to be very long and impacted very much by a limit.

For example, if application would not care about the string length it would 
just …

printf(“%s”, odp_sys_cpu_model_str());

and if it would care about the length …

char model[MAX_LEN];
snprintf(model, MAX_LEN, “%s”, odp_sys_cpu_model_str());

The first example would print out all available information, the second would 
clip it if needed.


Also can we assume the string never changes ?  What if you start on CPU 0 and 
then run on CPU7 on big/little is the string constant ? I don't  know 
big/little behaviour, for some of the other system_into APIs this is more 
serious like CPU freq.

It depends on the implementation. I wouldn’t change it on the fly. It would 
just confuse when comparing logs, etc.

-Petri





/**
 * CPU model name
 *
 * Returns pointer to a null terminated string describing the CPU
 * or SoC model. The pointer will never be NULL, but the string
 * may be empty.
 *
 * @return Pointer to CPU model name string
 */

-Petri



> --
> 2.1.0
>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp



--
Mike Holmes
Linaro  Sr Technical Manager
LNG - ODP
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] ODP handles comparison

2014-12-12 Thread Bill Fischofer
We discussed having xxx_is_equal() type calls in the past and there didn't
seem to be a lot of interest at the time.  I agree this can be useful and
because ODP types are abstract such comparisons SHOULD be via explicit
comparator functions.  Using == in C++ is fine since operators can be
overridden in that language, but it's not a good idea in C.

Perhaps an opportunity to discuss these again as well as how to make
explicitly inline/macro based APIs available since these sort of calls are
a natural for this.

On Fri, Dec 12, 2014 at 4:16 AM, Taras Kondratiuk <
taras.kondrat...@linaro.org> wrote:
>
> Hi
>
> It seems to be useful to be able to compare two ODP handles. For example
> compare odp_packet_pool() return value with previously created
> pool to check that packet is from that pool.
>
> ODP types are opaques handles, so comparing them directly with == may
> give a wrong results. For example handles that point to the same object
> (queue, pool, etc) can have generation number in it, so direct
> comparison will return false.
>
> Do we need to add corresponding comparison API for each handle type? Or
> we just say that any two handles of the same ODP object should be equal
> and == is enough?
>
> --
> Taras Kondratiuk
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv2] odp version script

2014-12-12 Thread Anders Roxell
On 2014-12-12 13:30, Maxim Uvarov wrote:
> Update odp version in one place (C code), and use it for doxygen also.
> 
> Signed-off-by: Maxim Uvarov 
> ---
>  v2: changed DOC_VERSION to VERSION.
> 
>  Anders also talked that it will be worth to put script to variable.
>  I have not idea how to do that in configure.ac. Actually there is no
>  big reason for that due to it's used only once.
> 
>  BR,
>  Maxim.
> 
>  configure.ac   | 2 +-
>  doc/doxygen.cfg| 2 +-
>  m4/ax_prog_doxygen.m4  | 2 +-
>  scripts/odp_version.sh | 7 +++
>  4 files changed, 10 insertions(+), 3 deletions(-)
>  create mode 100755 scripts/odp_version.sh
> 
> diff --git a/configure.ac b/configure.ac
> index 2f27261..8dbad4b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1,5 +1,5 @@
>  AC_PREREQ([2.5])
> -AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
> +AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), 
> [lng-odp@lists.linaro.org])
>  AM_INIT_AUTOMAKE([subdir-objects])
>  AC_CONFIG_SRCDIR([helper/config.h.in])
>  AM_CONFIG_HEADER([helper/config.h])
> diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
> index 03bcc20..050c94a 100644
> --- a/doc/doxygen.cfg
> +++ b/doc/doxygen.cfg
> @@ -1,5 +1,5 @@
>  PROJECT_NAME = "API Reference Manual"
> -PROJECT_NUMBER = 0.4.0
> +PROJECT_NUMBER = $(VERSION)
>  PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
>  QUIET = YES
>  OUTPUT_DIRECTORY = $(DOCDIR)
> diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
> index aa4acc2..0f58b3e 100644
> --- a/m4/ax_prog_doxygen.m4
> +++ b/m4/ax_prog_doxygen.m4
> @@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, 
> [$3])])
>  DX_ENV_APPEND(SRCDIR, $srcdir)
>  DX_ENV_APPEND(PROJECT, $DX_PROJECT)
>  DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
> -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
> +DX_ENV_APPEND(VERSION, $VERSION)
>  
>  # Doxygen itself:
>  DX_ARG_ABLE(doc, [generate any doxygen documentation],
> diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
> new file mode 100755
> index 000..357f017
> --- /dev/null
> +++ b/scripts/odp_version.sh
> @@ -0,0 +1,7 @@
> +#!/bin/bash
> +
> +GEN=`grep "define ODP_VERSION_API_GENERATION" 
> platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
> +MAJ=`grep "define ODP_VERSION_API_MAJOR" 
> platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
> +MIN=`grep "define ODP_VERSION_API_MINOR" 
> platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`

Factorise out the common parts.

Cheers,
Anders

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] example/odp_pktio parse args before odp init

2014-12-12 Thread Maxim Uvarov
No need to init odp if example args are not valid.
https://bugs.linaro.org/show_bug.cgi?id=856

Signed-off-by: Maxim Uvarov 
---
 example/packet/odp_pktio.c | 24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index eceee15..607ecbf 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -337,6 +337,15 @@ int main(int argc, char *argv[])
int core_count;
odp_shm_t shm;
 
+   args = calloc(1, sizeof(args_t));
+   if (args == NULL) {
+   EXAMPLE_ERR("Error: args mem alloc failed.\n");
+   exit(EXIT_FAILURE);
+   }
+
+   /* Parse and store the application arguments */
+   parse_args(argc, argv, &args->appl);
+
/* Init ODP before calling anything else */
if (odp_init_global(NULL, NULL)) {
EXAMPLE_ERR("Error: ODP global init failed.\n");
@@ -349,20 +358,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
 
-   /* Reserve memory for args from shared mem */
-   shm = odp_shm_reserve("shm_args", sizeof(args_t),
- ODP_CACHE_LINE_SIZE, 0);
-   args = odp_shm_addr(shm);
-
-   if (args == NULL) {
-   EXAMPLE_ERR("Error: shared mem alloc failed.\n");
-   exit(EXIT_FAILURE);
-   }
-   memset(args, 0, sizeof(*args));
-
-   /* Parse and store the application arguments */
-   parse_args(argc, argv, &args->appl);
-
/* Print both system and application information */
print_info(NO_PATH(argv[0]), &args->appl);
 
@@ -441,6 +436,7 @@ int main(int argc, char *argv[])
/* Master thread waits for other threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);
 
+   free(args);
printf("Exit\n\n");
 
return 0;
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCHv2] odp version script

2014-12-12 Thread Maxim Uvarov
Update odp version in one place (C code), and use it for doxygen also.

Signed-off-by: Maxim Uvarov 
---
 v2: changed DOC_VERSION to VERSION.

 Anders also talked that it will be worth to put script to variable.
 I have not idea how to do that in configure.ac. Actually there is no
 big reason for that due to it's used only once.

 BR,
 Maxim.

 configure.ac   | 2 +-
 doc/doxygen.cfg| 2 +-
 m4/ax_prog_doxygen.m4  | 2 +-
 scripts/odp_version.sh | 7 +++
 4 files changed, 10 insertions(+), 3 deletions(-)
 create mode 100755 scripts/odp_version.sh

diff --git a/configure.ac b/configure.ac
index 2f27261..8dbad4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.5])
-AC_INIT([OpenDataPlane], [0.4.0], [lng-odp@lists.linaro.org])
+AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), 
[lng-odp@lists.linaro.org])
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_CONFIG_SRCDIR([helper/config.h.in])
 AM_CONFIG_HEADER([helper/config.h])
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
index 03bcc20..050c94a 100644
--- a/doc/doxygen.cfg
+++ b/doc/doxygen.cfg
@@ -1,5 +1,5 @@
 PROJECT_NAME = "API Reference Manual"
-PROJECT_NUMBER = 0.4.0
+PROJECT_NUMBER = $(VERSION)
 PROJECT_LOGO = $(SRCDIR)/doc/images/ODP-Logo-HQ.png
 QUIET = YES
 OUTPUT_DIRECTORY = $(DOCDIR)
diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4
index aa4acc2..0f58b3e 100644
--- a/m4/ax_prog_doxygen.m4
+++ b/m4/ax_prog_doxygen.m4
@@ -407,7 +407,7 @@ AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
 DX_ENV_APPEND(SRCDIR, $srcdir)
 DX_ENV_APPEND(PROJECT, $DX_PROJECT)
 DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+DX_ENV_APPEND(VERSION, $VERSION)
 
 # Doxygen itself:
 DX_ARG_ABLE(doc, [generate any doxygen documentation],
diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh
new file mode 100755
index 000..357f017
--- /dev/null
+++ b/scripts/odp_version.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+GEN=`grep "define ODP_VERSION_API_GENERATION" 
platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+MAJ=`grep "define ODP_VERSION_API_MAJOR" 
platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+MIN=`grep "define ODP_VERSION_API_MINOR" 
platform/linux-generic/include/api/odp_version.h| cut -d ' ' -f 3`
+
+echo -n $GEN.$MAJ.$MIN
-- 
1.8.5.1.163.gd7aced9


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] ODP handles comparison

2014-12-12 Thread Taras Kondratiuk
Hi

It seems to be useful to be able to compare two ODP handles. For example
compare odp_packet_pool() return value with previously created
pool to check that packet is from that pool.

ODP types are opaques handles, so comparing them directly with == may
give a wrong results. For example handles that point to the same object
(queue, pool, etc) can have generation number in it, so direct
comparison will return false.

Do we need to add corresponding comparison API for each handle type? Or
we just say that any two handles of the same ODP object should be equal
and == is enough?

-- 
Taras Kondratiuk

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv2 1/2] api: queue: add odp_queue_destroy()

2014-12-12 Thread Savolainen, Petri (NSN - FI/Espoo)
Reviewed-by: Petri Savolainen 

> -Original Message-
> From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
> boun...@lists.linaro.org] On Behalf Of ext Taras Kondratiuk
> Sent: Tuesday, December 02, 2014 5:47 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCHv2 1/2] api: queue: add odp_queue_destroy()
> 
> Signed-off-by: Taras Kondratiuk 
> ---
>  platform/linux-generic/include/api/odp_queue.h |   14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/platform/linux-generic/include/api/odp_queue.h
> b/platform/linux-generic/include/api/odp_queue.h
> index b8ac4bb..b994c20 100644
> --- a/platform/linux-generic/include/api/odp_queue.h
> +++ b/platform/linux-generic/include/api/odp_queue.h
> @@ -124,6 +124,20 @@ odp_queue_t odp_queue_create(const char *name,
> odp_queue_type_t type,
>odp_queue_param_t *param);
> 
>  /**
> + * Destroy ODP queue
> + *
> + * Destroys ODP queue. The queue must be empty and detached from other
> + * ODP API (crypto, pktio, etc). Application must ensure that no other
> + * operations on this queue are invoked in parallel. Otherwise behavior
> + * is undefined.
> + *
> + * @param queueQueue handle
> + *
> + * @return 0 if successful
> + */
> +int odp_queue_destroy(odp_queue_t queue);
> +
> +/**
>   * Find a queue by name
>   *
>   * @param nameQueue name
> --
> 1.7.9.5
> 
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation:add atomic test in odp syncronizers

2014-12-12 Thread yan.songm...@linaro.org
Mike,
I think Barry's patch is cover the lock, and my patch cover the atomic.

But I still have some cards about the rwlock, spin lock and ticket lock.

So ,should  I write a new one accord Barry's patch or just use his code and 
change it suitable for our  sunny day test if necessary  ?
I prefer the second.

Thanks,
Yan


yan.songm...@linaro.org
 
From: Mike Holmes
Date: 2014-12-12 03:09
To: Ola Liljedahl
CC: Yan Sonming; Barry Spinney; lng-odp
Subject: Re: [lng-odp] [PATCH] validation:add atomic test in odp syncronizers


On 11 December 2014 at 04:36, Ola Liljedahl  wrote:
Are these cunit tests for odp_atomic.h only?
Are there any cunit tests for plain spin locks, ticket locks, rwlocks etc?

Yes, Mario has Barrys code as the basis.
 

-- Ola


On 10 December 2014 at 20:42, Mike Holmes  wrote:
> I think odp_syne would be better as odp_sync  throughout the patch
>
> Does Barrys patch cover atomics in an overlapping way, or do we have both as
> separate suites ? I think this one is much more sunny day as we had
> originally planned.
> Mario were you able to make the final changes to create a patch for tip from
> Barrys files, do we need to wait until we can see that patch along side this
> one ?
>
> Mike
>
>
> On 9 December 2014 at 22:19, Yan Sonming  wrote:
>>
>> Remove odp_atomic_test in test/api_test and  add the odp_atomic_test
>> to test/validation as one part of odp syncronizers test
>
>
> syncronizers
>
>>
>>
>> Signed-off-by: Yan Songming 
>> ---
>>  test/api_test/Makefile.am  |   5 +-
>>  test/api_test/odp_atomic_test.c| 299
>> -
>>  test/api_test/odp_atomic_test.h|  51 --
>>  test/api_test/odp_common.c |   1 -
>>  test/validation/.gitignore |   1 +
>>  test/validation/Makefile.am|   6 +-
>>  test/validation/odp_syne.c |  15 ++
>>  test/validation/syne/odp_test_atomic.c | 258 
>>  test/validation/syne/odp_test_atomic.h |  14 ++
>>  9 files changed, 294 insertions(+), 356 deletions(-)
>>  delete mode 100644 test/api_test/odp_atomic_test.c
>>  delete mode 100644 test/api_test/odp_atomic_test.h
>>  create mode 100644 test/validation/odp_syne.c
>>  create mode 100644 test/validation/syne/odp_test_atomic.c
>>  create mode 100644 test/validation/syne/odp_test_atomic.h
>>
>> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
>> index 74e8612..ce301ce 100644
>> --- a/test/api_test/Makefile.am
>> +++ b/test/api_test/Makefile.am
>> @@ -1,18 +1,15 @@
>>  include $(top_srcdir)/test/Makefile.inc
>>
>> -bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping
>> +bin_PROGRAMS = odp_shm odp_ring odp_timer_ping
>>
>> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>>  odp_shm_CFLAGS = $(AM_CFLAGS)
>>  odp_ring_CFLAGS = $(AM_CFLAGS)
>>  odp_timer_ping_CFLAGS = $(AM_CFLAGS)
>>
>> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>>  odp_timer_ping_LDFLAGS = $(AM_LDFLAGS) -static
>>
>> -dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
>>  dist_odp_timer_ping_SOURCES = odp_timer_ping.c odp_common.c
>> diff --git a/test/api_test/odp_atomic_test.c
>> b/test/api_test/odp_atomic_test.c
>> deleted file mode 100644
>> index 5563606..000
>> --- a/test/api_test/odp_atomic_test.c
>> +++ /dev/null
>> @@ -1,299 +0,0 @@
>> -/* Copyright (c) 2013, Linaro Limited
>> - * All rights reserved.
>> - *
>> - * SPDX-License-Identifier: BSD-3-Clause
>> - */
>> -
>> -#include 
>> -#include 
>> -#include 
>> -#include 
>> -#include 
>> -
>> -static odp_atomic_u32_t a32u;
>> -static odp_atomic_u64_t a64u;
>> -
>> -static odp_barrier_t barrier;
>> -
>> -static const char * const test_name[] = {
>> -   "dummy",
>> -   "test atomic all (add/sub/inc/dec) on 32- and 64-bit atomic ints",
>> -   "test atomic inc/dec of 32-bit atomic int",
>> -   "test atomic add/sub of 32-bit atomic int",
>> -   "test atomic inc/dec of 64-bit atomic int",
>> -   "test atomic add/sub of 64-bit atomic int"
>> -};
>> -
>> -static struct timeval tv0[MAX_WORKERS], tv1[MAX_WORKERS];
>> -
>> -static void usage(void)
>> -{
>> -   printf("\n./odp_atomic -t  [-n ]\n\n"
>> -  "\t is\n"
>> -  "\t\t1 - Test all (inc/dec/add/sub on 32/64-bit atomic
>> ints)\n"
>> -  "\t\t2 - Test inc/dec of 32-bit atomic int\n"
>> -  "\t\t3 - Test add/sub of 32-bit atomic int\n"
>> -  "\t\t4 - Test inc/dec of 64-bit atomic int\n"
>> -  "\t\t5 - Test add/sub of 64-bit atomic int\n"
>> -  "\t\t-n <1 - 31> - no of threads to start\n"
>> -  "\t\tif user doesn't specify this option, then\n"
>> -  "\t\tno of threads created is equivalent to no of cores\n"
>> -  "\t\tavailable in the system\n"
>> -