Re: [lng-odp] [RFC v2 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-17 Thread Bill Fischofer
On further analysis the make distcheck errors I reported for the parts of
this seem to be artifacts of check-odp.  I can't make them happen manually
so I'm not sure what the issue might be.  Anders: Can you take a look at
this and advise?

In any event, the patches apply cleanly and all tests pass, so for this
series:

Reviewed-and-tested-by: Bill Fischofer 

On Tue, Mar 17, 2015 at 5:10 AM, Jerin Jacob  wrote:

> Move the definition of odp syncronizers abstract types to platform
> from public headerfile.
> This will allow platform define odp syncronizers abstract type.
> Useful when native SDK has definition of the odp syncronizers and
> ODP implementation decides to reuses them.
>
> v1..v2 Corrected Doxygen documentation issues proposed by Petri
>
>
> Jerin Jacob (4):
>   spinlock: allow platform to override odp_spinlock_t
>   rwlock: allow platform to override odp_rwlock_t
>   ticketlock: allow platform to override odp_ticketlock_t
>   barrier: allow platform to override odp_barrier_t
>
>  include/odp/api/barrier.h  |  7 +---
>  include/odp/api/rwlock.h   | 11 +
>  include/odp/api/spinlock.h | 10 +
>  include/odp/api/ticketlock.h   | 12 +-
>  platform/linux-generic/include/odp/barrier.h   |  1 +
>  .../linux-generic/include/odp/plat/barrier_types.h | 47
> +
>  .../linux-generic/include/odp/plat/rwlock_types.h  | 48
> ++
>  .../include/odp/plat/spinlock_types.h  | 46
> +
>  .../include/odp/plat/ticketlock_types.h| 46
> +
>  platform/linux-generic/include/odp/rwlock.h|  2 +
>  platform/linux-generic/include/odp/spinlock.h  |  2 +
>  platform/linux-generic/include/odp/ticketlock.h|  2 +
>  12 files changed, 201 insertions(+), 33 deletions(-)
>  create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
>  create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
>  create mode 100644
> platform/linux-generic/include/odp/plat/spinlock_types.h
>  create mode 100644
> platform/linux-generic/include/odp/plat/ticketlock_types.h
>
> --
> 2.1.0
>
>
> ___
> 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] [RFC v2 4/4] barrier: allow platform to override odp_barrier_t

2015-03-17 Thread Bill Fischofer
This part fails make distcheck with error:

  CC   odp_barrier.lo
In file included from ../../../platform/linux-generic/odp_barrier.c:7:0:
../../../platform/linux-generic/include/odp/barrier.h:22:36: fatal error:
odp/plat/barrier_types.h: No such file or directory
 #include 
^
compilation terminated.
Makefile:665: recipe for target 'odp_barrier.lo' failed

On Tue, Mar 17, 2015 at 5:11 AM, Jerin Jacob  wrote:

> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/barrier.h  |  7 +---
>  platform/linux-generic/include/odp/barrier.h   |  1 +
>  .../linux-generic/include/odp/plat/barrier_types.h | 47
> ++
>  3 files changed, 49 insertions(+), 6 deletions(-)
>  create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
>
> diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
> index 35f0981..28310ba 100644
> --- a/include/odp/api/barrier.h
> +++ b/include/odp/api/barrier.h
> @@ -18,20 +18,15 @@
>  extern "C" {
>  #endif
>
> -
>  /** @addtogroup odp_synchronizers
>   *  Synchronize threads.
>   *  @{
>   */
>
>  /**
> + * @typedef odp_barrier_t
>   * ODP thread synchronization barrier
>   */
> -typedef struct odp_barrier_t {
> -   uint32_t count;  /**< @private Thread count */
> -   odp_atomic_u32_t bar;/**< @private Barrier counter */
> -} odp_barrier_t;
> -
>
>  /**
>   * Initialize barrier with thread count.
> diff --git a/platform/linux-generic/include/odp/barrier.h
> b/platform/linux-generic/include/odp/barrier.h
> index d63c219..7ea5a6b 100644
> --- a/platform/linux-generic/include/odp/barrier.h
> +++ b/platform/linux-generic/include/odp/barrier.h
> @@ -19,6 +19,7 @@ extern "C" {
>
>  #include 
>  #include 
> +#include 
>
>  /** @ingroup odp_synchronizers
>   *  @{
> diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h
> b/platform/linux-generic/include/odp/plat/barrier_types.h
> new file mode 100644
> index 000..c8c978d
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/barrier_types.h
> @@ -0,0 +1,47 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP barrier
> + */
> +
> +#ifndef ODP_BARRIER_TYPES_H_
> +#define ODP_BARRIER_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +
> +/**
> + * @internal
> + * ODP thread synchronization barrier
> + */
> +struct odp_barrier_s {
> +   uint32_t count;  /**< Thread count */
> +   odp_atomic_u32_t bar;/**< Barrier counter */
> +};
> +
> +/** @addtogroup odp_synchronizers
> + *  @{
> + */
> +
> +typedef struct odp_barrier_s odp_barrier_t;
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 2.1.0
>
>
> ___
> 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] [RFC v2 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-17 Thread Bill Fischofer
This part also fails make distcheck with error:

  CC   odp_buffer.lo
In file included from
../../../platform/linux-generic/include/odp_pool_internal.h:65:0,
 from ../../../platform/linux-generic/odp_buffer.c:8:
../../../platform/linux-generic/include/odp/ticketlock.h:20:39: fatal
error: odp/plat/ticketlock_types.h: No such file or directory
 #include 
   ^
compilation terminated.

On Tue, Mar 17, 2015 at 5:11 AM, Jerin Jacob  wrote:

> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/ticketlock.h   | 12 +-
>  .../include/odp/plat/ticketlock_types.h| 46
> ++
>  platform/linux-generic/include/odp/ticketlock.h|  2 +
>  3 files changed, 50 insertions(+), 10 deletions(-)
>  create mode 100644
> platform/linux-generic/include/odp/plat/ticketlock_types.h
>
> diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
> index e088e8b..e395ac4 100644
> --- a/include/odp/api/ticketlock.h
> +++ b/include/odp/api/ticketlock.h
> @@ -18,10 +18,6 @@
>  extern "C" {
>  #endif
>
> -
> -#include 
> -#include 
> -
>  /** @addtogroup odp_synchronizers
>   * Operations on ticket locks.
>   * Acquiring a ticket lock happens in two phases. First the threads takes
> a
> @@ -32,13 +28,9 @@ extern "C" {
>   */
>
>  /**
> - * ODP ticket lock
> + * @typedef odp_ticketlock_t
> + * ODP ticketlock
>   */
> -typedef struct odp_ticketlock_t {
> -   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
> -   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
> -} odp_ticketlock_t;
> -
>
>  /**
>   * Initialize ticket lock.
> diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h
> b/platform/linux-generic/include/odp/plat/ticketlock_types.h
> new file mode 100644
> index 000..be93085
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
> @@ -0,0 +1,46 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP ticketlock
> + */
> +
> +#ifndef ODP_TICKETLOCK_TYPES_H_
> +#define ODP_TICKETLOCK_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/**
> + * @internal
> + * ODP ticketlock
> + */
> +struct odp_ticketlock_s {
> +   odp_atomic_u32_t  next_ticket; /**< Next ticket */
> +   odp_atomic_u32_t  cur_ticket;  /**< Current ticket */
> +};
> +
> +/** @addtogroup odp_synchronizers
> + *  @{
> + */
> +
> +typedef struct odp_ticketlock_s odp_ticketlock_t;
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp/ticketlock.h
> b/platform/linux-generic/include/odp/ticketlock.h
> index fc7f438..658e27f 100644
> --- a/platform/linux-generic/include/odp/ticketlock.h
> +++ b/platform/linux-generic/include/odp/ticketlock.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
>
> +#include 
> +
>  /** @ingroup odp_synchronizers
>   *  Operations on ticket locks.
>   *  @{
> --
> 2.1.0
>
>
> ___
> 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] [RFC v2 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Bill Fischofer
This part also fails make distcheck with error:

  CC   odp_classification.lo
In file included from
../../../platform/linux-generic/include/odp_packet_io_internal.h:21:0,
 from
../../../platform/linux-generic/odp_classification.c:15:
../../../platform/linux-generic/include/odp/spinlock.h:20:37: fatal error:
odp/plat/spinlock_types.h: No such file or directory
 #include 
 ^
compilation terminated.

On Tue, Mar 17, 2015 at 5:11 AM, Jerin Jacob  wrote:

> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/rwlock.h   | 11 +
>  .../linux-generic/include/odp/plat/rwlock_types.h  | 48
> ++
>  platform/linux-generic/include/odp/rwlock.h|  2 +
>  3 files changed, 52 insertions(+), 9 deletions(-)
>  create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
>
> diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
> index 950b83a..d730a70 100644
> --- a/include/odp/api/rwlock.h
> +++ b/include/odp/api/rwlock.h
> @@ -13,8 +13,6 @@
>   * ODP RW Locks
>   */
>
> -#include 
> -
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
> @@ -29,14 +27,9 @@ extern "C" {
>   */
>
>  /**
> - * The odp_rwlock_t type.
> + * @typedef odp_rwlock_t
> + * ODP rwlock
>   */
> -typedef struct {
> -   odp_atomic_u32_t cnt; /**< @private lock count
> -   0 lock not taken
> -   -1 write lock taken
> -   >0 read lock(s) taken */
> -} odp_rwlock_t;
>
>
>  /**
> diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h
> b/platform/linux-generic/include/odp/plat/rwlock_types.h
> new file mode 100644
> index 000..bd46e57
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
> @@ -0,0 +1,48 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP rwlock
> + */
> +
> +#ifndef ODP_RWLOCK_TYPES_H_
> +#define ODP_RWLOCK_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/**
> + * @internal
> + * ODP rwlock
> + */
> +struct odp_rwlock_s {
> +   odp_atomic_u32_t cnt; /**< lock count
> +   0 lock not taken
> +   -1 write lock taken
> +   >0 read lock(s) taken */
> +};
> +
> +/** @addtogroup odp_synchronizers
> + *  @{
> + */
> +
> +typedef struct odp_rwlock_s odp_rwlock_t;
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp/rwlock.h
> b/platform/linux-generic/include/odp/rwlock.h
> index 06320f6..ca88ff7 100644
> --- a/platform/linux-generic/include/odp/rwlock.h
> +++ b/platform/linux-generic/include/odp/rwlock.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
>
> +#include 
> +
>  /** @ingroup odp_synchronizers
>   *  @{
>   */
> --
> 2.1.0
>
>
> ___
> 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] [RFC v2 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Bill Fischofer
This part fails make distcheck with error:

In file included from
../../../platform/linux-generic/include/odp_packet_io_internal.h:21:0,
 from
../../../platform/linux-generic/odp_classification.c:15:
../../../platform/linux-generic/include/odp/spinlock.h:20:37: fatal error:
odp/plat/spinlock_types.h: No such file or directory
 #include 
 ^
compilation terminated.

On Tue, Mar 17, 2015 at 5:10 AM, Jerin Jacob  wrote:

> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/spinlock.h | 10 +
>  .../include/odp/plat/spinlock_types.h  | 46
> ++
>  platform/linux-generic/include/odp/spinlock.h  |  2 +
>  3 files changed, 50 insertions(+), 8 deletions(-)
>  create mode 100644
> platform/linux-generic/include/odp/plat/spinlock_types.h
>
> diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
> index 5cde123..9a5a929 100644
> --- a/include/odp/api/spinlock.h
> +++ b/include/odp/api/spinlock.h
> @@ -18,21 +18,15 @@
>  extern "C" {
>  #endif
>
> -
> -#include 
> -
>  /** @addtogroup odp_synchronizers
>   *  Operations on spin locks.
>   *  @{
>   */
>
>  /**
> - * ODP spinlock type
> + * @typedef odp_spinlock_t
> + * ODP spinlock
>   */
> -typedef struct odp_spinlock_t {
> -   char lock;  /**< @private lock flag, should match
> odp_atomic_flag_t */
> -} odp_spinlock_t;
> -
>
>  /**
>   * Initialize spin lock.
> diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h
> b/platform/linux-generic/include/odp/plat/spinlock_types.h
> new file mode 100644
> index 000..83d306b
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
> @@ -0,0 +1,46 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP spinlock
> + */
> +
> +#ifndef ODP_SPINLOCK_TYPES_H_
> +#define ODP_SPINLOCK_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/**
> + * @internal
> + * ODP spinlock
> + */
> +struct odp_spinlock_s {
> +   char lock;  /**< lock flag, should match odp_atomic_flag_t */
> +};
> +
> +
> +/** @addtogroup odp_synchronizers
> + *  @{
> + */
> +
> +typedef struct odp_spinlock_s odp_spinlock_t;
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp/spinlock.h
> b/platform/linux-generic/include/odp/spinlock.h
> index e02df49..7dbb1c4 100644
> --- a/platform/linux-generic/include/odp/spinlock.h
> +++ b/platform/linux-generic/include/odp/spinlock.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
>
> +#include 
> +
>  /** @ingroup odp_synchronizers
>   *  @{
>   */
> --
> 2.1.0
>
>
> ___
> 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] [PATCHv2 0/3] Fixes for https://bugs.linaro.org/show_bug.cgi?id=1284

2015-03-17 Thread Bill Fischofer
For this series:

Reviewed-and-tested-by: Bill Fischofer 

On Tue, Mar 17, 2015 at 4:53 AM, Ciprian Barbu 
wrote:

> v2:
> - fixed patch 3
>
> Like in the previous RFC, the first patch is the fix.
> The second and third patch represent a proposed fix for freeing the
> ODP_QUEUE_TYPE_SCHED queues that were not removed from the internal
> priority
> queues because the scheduler did not know they were empty.
>
> Ciprian Barbu (3):
>   validation: schedule: free queues and pool
>   linux-generic: queue: add queue_is_destroyed internal call
>   linux-generic: schedule: make sure SCHED queues get freed by the
> scheduler
>
>  .../linux-generic/include/odp_queue_internal.h |  9 
>  platform/linux-generic/odp_schedule.c  | 25 +
>  test/validation/odp_schedule.c | 61
> +-
>  3 files changed, 93 insertions(+), 2 deletions(-)
>
> --
> 1.8.3.2
>
>
> ___
> 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] performance: odp_atomic: move atomic test from api_test to performance

2015-03-17 Thread Bill Fischofer
These changes do not seem to be a simple move as logic is being changed.  A
better commit message needed to say what's really happening perhaps?

On Tue, Mar 17, 2015 at 3:59 PM, Mike Holmes  wrote:

> Signed-off-by: Mike Holmes 
> ---
>  test/api_test/.gitignore   |   1 -
>  test/api_test/Makefile.am  |   6 +-
>  test/api_test/odp_atomic_test.h|  51 
>  test/api_test/odp_common.c |   2 +-
>  test/performance/.gitignore|   1 +
>  test/performance/Makefile.am   |   6 +-
>  .../odp_atomic_test.c => performance/odp_atomic.c} | 136
> -
>  7 files changed, 139 insertions(+), 64 deletions(-)
>  delete mode 100644 test/api_test/odp_atomic_test.h
>  rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c} (63%)
>
> diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
> index 84159e1..950f443 100644
> --- a/test/api_test/.gitignore
> +++ b/test/api_test/.gitignore
> @@ -1,3 +1,2 @@
> -odp_atomic
>  odp_ring
>  odp_shm
> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
> index 86e1bc2..f231fee 100644
> --- a/test/api_test/Makefile.am
> +++ b/test/api_test/Makefile.am
> @@ -1,21 +1,17 @@
>  include $(top_srcdir)/test/Makefile.inc
>
> -bin_PROGRAMS = odp_atomic odp_shm odp_ring
> +bin_PROGRAMS = odp_shm odp_ring
>
> -odp_atomic_CFLAGS = $(AM_CFLAGS)
>  odp_shm_CFLAGS = $(AM_CFLAGS)
>  odp_ring_CFLAGS = $(AM_CFLAGS)
>
> -odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>
>  noinst_HEADERS = \
> - $(top_srcdir)/test/api_test/odp_atomic_test.h \
>   $(top_srcdir)/test/api_test/odp_common.h \
>   $(top_srcdir)/test/api_test/odp_shm_test.h \
>   $(top_srcdir)/test/test_debug.h
>
> -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
> diff --git a/test/api_test/odp_atomic_test.h
> b/test/api_test/odp_atomic_test.h
> deleted file mode 100644
> index 89e7748..000
> --- a/test/api_test/odp_atomic_test.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/* Copyright (c) 2013, Linaro Limited
> - * All rights reserved.
> - *
> - * SPDX-License-Identifier: BSD-3-Clause
> - */
> -
> -#ifndef ODP_ATOMIC_TEST_H_
> -#define ODP_ATOMIC_TEST_H_
> -
> -#include 
> -#include 
> -
> -/**
> - * add_sub_cnt could be any valid value
> - * so to excercise explicit atomic_add/sub
> - * ops. For now using 5..
> - */
> -#define ADD_SUB_CNT5
> -
> -#defineCNT 50
> -#defineU32_INIT_VAL(1UL << 10)
> -#defineU64_INIT_VAL(1ULL << 33)
> -
> -typedef enum {
> -   TEST_MIX = 1, /* Must be first test case num */
> -   TEST_INC_DEC_U32,
> -   TEST_ADD_SUB_U32,
> -   TEST_INC_DEC_64,
> -   TEST_ADD_SUB_64,
> -   TEST_MAX,
> -} odp_test_atomic_t;
> -
> -
> -void test_atomic_inc_dec_u32(void);
> -void test_atomic_add_sub_u32(void);
> -void test_atomic_inc_dec_64(void);
> -void test_atomic_add_sub_64(void);
> -void test_atomic_inc_u32(void);
> -void test_atomic_dec_u32(void);
> -void test_atomic_add_u32(void);
> -void test_atomic_sub_u32(void);
> -void test_atomic_inc_64(void);
> -void test_atomic_dec_64(void);
> -void test_atomic_add_64(void);
> -void test_atomic_sub_64(void);
> -void test_atomic_init(void);
> -void test_atomic_basic(void);
> -void test_atomic_store(void);
> -int test_atomic_validate(void);
> -
> -#endif /* ODP_ATOMIC_TEST_H_ */
> diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
> index 5158d87..18b365e 100644
> --- a/test/api_test/odp_common.c
> +++ b/test/api_test/odp_common.c
> @@ -14,10 +14,10 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>
> +#define MAX_WORKERS   32/**< Max worker threads */
>
>  /* Globals */
>  static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads
> table*/
> diff --git a/test/performance/.gitignore b/test/performance/.gitignore
> index 9ccb102..1bdb90d 100644
> --- a/test/performance/.gitignore
> +++ b/test/performance/.gitignore
> @@ -1,3 +1,4 @@
>  *.log
>  *.trs
>  odp_scheduling
> +odp_atomic
> diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
> index 3be3721..63e4e23 100644
> --- a/test/performance/Makefile.am
> +++ b/test/performance/Makefile.am
> @@ -1,6 +1,6 @@
>  include $(top_srcdir)/test/Makefile.inc
>
> -EXECUTABLES =
> +EXECUTABLES = odp_atomic
>
>  COMPILE_ONLY = odp_scheduling
>
> @@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
>  odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
>
> +odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
> +
>  noinst_

[lng-odp] [PATCH] performance: odp_atomic: move atomic test from api_test to performance

2015-03-17 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 test/api_test/.gitignore   |   1 -
 test/api_test/Makefile.am  |   6 +-
 test/api_test/odp_atomic_test.h|  51 
 test/api_test/odp_common.c |   2 +-
 test/performance/.gitignore|   1 +
 test/performance/Makefile.am   |   6 +-
 .../odp_atomic_test.c => performance/odp_atomic.c} | 136 -
 7 files changed, 139 insertions(+), 64 deletions(-)
 delete mode 100644 test/api_test/odp_atomic_test.h
 rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c} (63%)

diff --git a/test/api_test/.gitignore b/test/api_test/.gitignore
index 84159e1..950f443 100644
--- a/test/api_test/.gitignore
+++ b/test/api_test/.gitignore
@@ -1,3 +1,2 @@
-odp_atomic
 odp_ring
 odp_shm
diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
index 86e1bc2..f231fee 100644
--- a/test/api_test/Makefile.am
+++ b/test/api_test/Makefile.am
@@ -1,21 +1,17 @@
 include $(top_srcdir)/test/Makefile.inc
 
-bin_PROGRAMS = odp_atomic odp_shm odp_ring
+bin_PROGRAMS = odp_shm odp_ring
 
-odp_atomic_CFLAGS = $(AM_CFLAGS)
 odp_shm_CFLAGS = $(AM_CFLAGS)
 odp_ring_CFLAGS = $(AM_CFLAGS)
 
-odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
 odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
 odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
 
 noinst_HEADERS = \
- $(top_srcdir)/test/api_test/odp_atomic_test.h \
  $(top_srcdir)/test/api_test/odp_common.h \
  $(top_srcdir)/test/api_test/odp_shm_test.h \
  $(top_srcdir)/test/test_debug.h
 
-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
diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h
deleted file mode 100644
index 89e7748..000
--- a/test/api_test/odp_atomic_test.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef ODP_ATOMIC_TEST_H_
-#define ODP_ATOMIC_TEST_H_
-
-#include 
-#include 
-
-/**
- * add_sub_cnt could be any valid value
- * so to excercise explicit atomic_add/sub
- * ops. For now using 5..
- */
-#define ADD_SUB_CNT5
-
-#defineCNT 50
-#defineU32_INIT_VAL(1UL << 10)
-#defineU64_INIT_VAL(1ULL << 33)
-
-typedef enum {
-   TEST_MIX = 1, /* Must be first test case num */
-   TEST_INC_DEC_U32,
-   TEST_ADD_SUB_U32,
-   TEST_INC_DEC_64,
-   TEST_ADD_SUB_64,
-   TEST_MAX,
-} odp_test_atomic_t;
-
-
-void test_atomic_inc_dec_u32(void);
-void test_atomic_add_sub_u32(void);
-void test_atomic_inc_dec_64(void);
-void test_atomic_add_sub_64(void);
-void test_atomic_inc_u32(void);
-void test_atomic_dec_u32(void);
-void test_atomic_add_u32(void);
-void test_atomic_sub_u32(void);
-void test_atomic_inc_64(void);
-void test_atomic_dec_64(void);
-void test_atomic_add_64(void);
-void test_atomic_sub_64(void);
-void test_atomic_init(void);
-void test_atomic_basic(void);
-void test_atomic_store(void);
-int test_atomic_validate(void);
-
-#endif /* ODP_ATOMIC_TEST_H_ */
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 5158d87..18b365e 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -14,10 +14,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
+#define MAX_WORKERS   32/**< Max worker threads */
 
 /* Globals */
 static odph_linux_pthread_t thread_tbl[MAX_WORKERS]; /**< worker threads 
table*/
diff --git a/test/performance/.gitignore b/test/performance/.gitignore
index 9ccb102..1bdb90d 100644
--- a/test/performance/.gitignore
+++ b/test/performance/.gitignore
@@ -1,3 +1,4 @@
 *.log
 *.trs
 odp_scheduling
+odp_atomic
diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index 3be3721..63e4e23 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -1,6 +1,6 @@
 include $(top_srcdir)/test/Makefile.inc
 
-EXECUTABLES =
+EXECUTABLES = odp_atomic
 
 COMPILE_ONLY = odp_scheduling
 
@@ -15,7 +15,11 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
 odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
 
+odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
+odp_atomic_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
+
 noinst_HEADERS = \
  $(top_srcdir)/test/test_debug.h
 
 dist_odp_scheduling_SOURCES = odp_scheduling.c
+dist_odp_atomic_SOURCES = odp_atomic.c
diff --git a/test/api_test/odp_atomic_test.c b/test/performance/odp_atomic.c
similarity index 63%
rename from test/api_test/odp_atomic_test.c
rename to test/performance/odp_atomic.c
index 6ccdc35..241295c 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/performance/odp_atomic.c
@@ -6,14 +6,68 @@
 
 #include 
 #include 
-#

[lng-odp] [PATCH] move odp_atomic from api_test to performance directory

2015-03-17 Thread Mike Holmes
The odp_atomic test can form the basis for testing the scalability of the atomic
api. Move it so that the api_test dir may be deleted and the odp_atomic test
can be run as part of test/performance


Mike Holmes (1):
  performance: odp_atomic: move atomic test from api_test to performance

 test/api_test/.gitignore   |   1 -
 test/api_test/Makefile.am  |   6 +-
 test/api_test/odp_atomic_test.h|  51 
 test/api_test/odp_common.c |   2 +-
 test/performance/.gitignore|   1 +
 test/performance/Makefile.am   |   6 +-
 .../odp_atomic_test.c => performance/odp_atomic.c} | 136 -
 7 files changed, 139 insertions(+), 64 deletions(-)
 delete mode 100644 test/api_test/odp_atomic_test.h
 rename test/{api_test/odp_atomic_test.c => performance/odp_atomic.c} (63%)

-- 
2.1.0


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


Re: [lng-odp] [PATCH] doc: doxygen: add declaring variables

2015-03-17 Thread Bill Fischofer
On Tue, Mar 17, 2015 at 1:57 PM, Mike Holmes  wrote:

> Signed-off-by: Mike Holmes 
>

Reviewed-by: Bill Fischofer 


> ---
>  doc/api_guide_lines.dox | 15 +++
>  1 file changed, 15 insertions(+)
>
> diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
> index 4cfe088..2bc63a1 100644
> --- a/doc/api_guide_lines.dox
> +++ b/doc/api_guide_lines.dox
> @@ -149,6 +149,21 @@ When an interface is defined in a header file and is
> intended to to be reused in
>  - Be prefixed with an underscore "_".
>  - All the required definitions for the API are to use an underscore, this
> includes MACROS, typedefs, enums and function names.
>
> +@subsection variables Declaring variables
> +- Variables shall be declared at the begining of scope, for example :-
> +@code
> +int start_of_global_scope;
> +
> +main () {
> +  int start_of_function_scope;
> +  ...
> +  if (foo == bar) {
> +int start_of_block_scope;
> +...
> +  }
> +}
> +@endcode
> +
>  @section implementation Implementation Considerations
>  To support application portability and preserve implementation
> flexibility, ODP APIs MUST be designed with several guiding principles in
> mind.
>
> --
> 2.1.0
>
>
> ___
> 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] doc: doxygen: add declaring variables

2015-03-17 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 doc/api_guide_lines.dox | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
index 4cfe088..2bc63a1 100644
--- a/doc/api_guide_lines.dox
+++ b/doc/api_guide_lines.dox
@@ -149,6 +149,21 @@ When an interface is defined in a header file and is 
intended to to be reused in
 - Be prefixed with an underscore "_".
 - All the required definitions for the API are to use an underscore, this 
includes MACROS, typedefs, enums and function names.
 
+@subsection variables Declaring variables
+- Variables shall be declared at the begining of scope, for example :-
+@code
+int start_of_global_scope;
+
+main () {
+  int start_of_function_scope;
+  ...
+  if (foo == bar) {
+int start_of_block_scope;
+...
+  }
+}
+@endcode
+
 @section implementation Implementation Considerations
 To support application portability and preserve implementation flexibility, 
ODP APIs MUST be designed with several guiding principles in mind.
 
-- 
2.1.0


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


Re: [lng-odp] [PATCH] doc: move api guidelines to API doc

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/17/15 15:51, Mike Holmes wrote:

ping

On 11 March 2015 at 14:43, Bill Fischofer > wrote:




On Wed, Mar 11, 2015 at 1:24 PM, Mike Holmes
mailto:mike.hol...@linaro.org>> wrote:

This documentation was moved from the architecture doc to this
API doc.

Signed-off-by: Mike Holmes mailto:mike.hol...@linaro.org>>


Reviewed-by: Bill Fischofer mailto:bill.fischo...@linaro.org>>

---
 doc/api_guide_lines.dox | 178

 1 file changed, 178 insertions(+)
 create mode 100644 doc/api_guide_lines.dox

diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
new file mode 100644
index 000..4cfe088
--- /dev/null
+++ b/doc/api_guide_lines.dox
@@ -0,0 +1,178 @@
+/* Copyright (c) 2014, Linaro Limited
+
+ * All rights reserved
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+
+@page api_guide_lines  API Guide Lines
+
+@tableofcontents
+
+@section introduction Introduction
+ODP APIs are implemented as callable C functions that often
return a typed value.
+This document describes the approach to handling return
values and error indications expected of conforming ODP
implementations.
+As such it should be regarded as providing guidelines for how
to create new ODP APIs.
+
+@section functional Functional Definition
+This section defines the use of data types, calling
conventions, and return codes used by ODP APIs.
+All ODP APIs MUST follow these conventions as part of their
design.
+
+@subsection naming Naming Conventions
+All ODP APIs begin with the prefix odp_ and those that
describe an action to be performed on an object follow the
naming convention of object followed by action.
+The advantage of this approach is that an alphabetical list
of APIs for an object all sort together since they all have
names of the form odp_object_action().
+
+So for example the API call to allocate a buffer is named
odp_buffer_alloc() rather than odp_alloc_buffer().
+
+@subsection data_types Data Types and Use of typedef
+ODP is designed to allow broad variability in how APIs are
implemented on various platforms.
+To support this, most APIs operate on abstract data types
that are defined via typedef on a per-implementation basis.
+These abstract types follow the naming convention of
odp_object_t.
+
+Typedefs that encapsulate C structs follow the convention:
+
+@code
+typedef struct odp__s {
+...
+} odp__t;
+@endcode
+
+The use of typedef allows implementations to choose
underlying data representations that map efficiently to
platform capabilities while providing accessor functions to
provide structured access to implementation information in a
portable manner
+Similarly, the use of enum is RECOMMENDED to provide value
abstraction for API parameters while enabling the
implementation to choose code points that map well to platform
native values.
+
+Several native C types are used conventionally within ODP and
SHOULD be employed in API design:
+
+type | Correct use
+ |---| :-
+void | SHOULD be used for APIs that do not return a value
+void*| SHOULD be used for APIs that return a pointer intended
to be used by the caller. For example, a routine that returns
the address of an application context area SHOULD use a void *
return type
+odp_bool_t  | SHOULD be used for APIs that return a @ref
boolean value.
+int  | SHOULD be used for success and failure indications,
with 0 indicating a success. Errno may be set
+
+@subsection parameters Parameter Structure and Validation
+ODP is a framework for use in the data plane.
+Data plane applications typically have extreme performance
requirements mandating very strict attention to path length
considerations in the design of all ODP APIs, with the
exception of those designed to be used infrequently such as
only during initialization or termination processing.
+
+Minimizing pathlength in API design involves several
considerations:
+ - The number of parameters passed to a call.
+   In general, ODP APIs designed for frequent use SHOULD have
few parameters.
+   Limiting parameter count to one or two well-chosen
paramet

[lng-odp] [PATCHv3] example: l2fwd print packets per second

2015-03-17 Thread Maxim Uvarov
Current print in l2fwd is not useful with slow links and
also it's hard to say how fast does it work. Print pps
and packets drops.

Signed-off-by: Maxim Uvarov 
---
 v3: alloc memory for counter in worker threads to avoid cache misses.

 This patch is independent of 'make check' script. Sending it separately now.

 example/l2fwd/odp_l2fwd.c | 111 +-
 1 file changed, 81 insertions(+), 30 deletions(-)

diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index d062a72..f533088 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -65,6 +65,14 @@
 /** Get rid of path in filename - only for unix-type paths using '/' */
 #define NO_PATH(file_name) (strrchr((file_name), '/') ? \
strrchr((file_name), '/') + 1 : (file_name))
+
+
+/* speed and stats */
+typedef struct {
+   uint64_t packets;
+   uint64_t drops;
+} stats_t;
+
 /**
  * Parsed command line application arguments
  */
@@ -73,13 +81,18 @@ typedef struct {
int if_count;   /**< Number of interfaces to be used */
char **if_names;/**< Array of pointers to interface names */
int mode;   /**< Packet IO mode */
+   int time;   /**< Time in seconds to run. */
+   int accuracy;   /**< Number of seconds to get and print 
statistics */
 } appl_args_t;
 
+static int exit_threads;
+
 /**
  * Thread specific arguments
  */
 typedef struct {
int src_idx;/**< Source interface identifier */
+   stats_t **stats;/**< Per thread packet stats */
 } thread_args_t;
 
 /**
@@ -115,24 +128,24 @@ static void *pktio_queue_thread(void *arg)
odp_queue_t outq_def;
odp_packet_t pkt;
odp_event_t ev;
-   unsigned long pkt_cnt = 0;
-   unsigned long err_cnt = 0;
+   thread_args_t *thr_args = arg;
 
-   (void)arg;
+   stats_t *stats = calloc(1, sizeof(stats_t));
+   *thr_args->stats = stats;
 
thr = odp_thread_id();
 
printf("[%02i] QUEUE mode\n", thr);
 
/* Loop packets */
-   for (;;) {
+   while (!exit_threads) {
/* Use schedule to get buf from any input queue */
ev  = odp_schedule(NULL, ODP_SCHED_WAIT);
pkt = odp_packet_from_event(ev);
 
/* Drop packets with errors */
if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) {
-   EXAMPLE_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt);
+   stats->drops += 1;
continue;
}
 
@@ -141,14 +154,10 @@ static void *pktio_queue_thread(void *arg)
/* Enqueue the packet for output */
odp_queue_enq(outq_def, ev);
 
-   /* Print packet counts every once in a while */
-   if (odp_unlikely(pkt_cnt++ % 10 == 0)) {
-   printf("  [%02i] pkt_cnt:%lu\n", thr, pkt_cnt);
-   fflush(NULL);
-   }
+   stats->packets += 1;
}
 
-/* unreachable */
+   free(stats);
return NULL;
 }
 
@@ -186,15 +195,15 @@ static void *pktio_ifburst_thread(void *arg)
thread_args_t *thr_args;
int pkts, pkts_ok;
odp_packet_t pkt_tbl[MAX_PKT_BURST];
-   unsigned long pkt_cnt = 0;
-   unsigned long err_cnt = 0;
-   unsigned long tmp = 0;
int src_idx, dst_idx;
odp_pktio_t pktio_src, pktio_dst;
 
thr = odp_thread_id();
thr_args = arg;
 
+   stats_t *stats = calloc(1, sizeof(stats_t));
+   *thr_args->stats = stats;
+
src_idx = thr_args->src_idx;
dst_idx = (src_idx % 2 == 0) ? src_idx+1 : src_idx-1;
pktio_src = gbl_args->pktios[src_idx];
@@ -208,7 +217,7 @@ static void *pktio_ifburst_thread(void *arg)
   odp_pktio_to_u64(pktio_src), odp_pktio_to_u64(pktio_dst));
 
/* Loop packets */
-   for (;;) {
+   while (!exit_threads) {
pkts = odp_pktio_recv(pktio_src, pkt_tbl, MAX_PKT_BURST);
if (pkts <= 0)
continue;
@@ -218,26 +227,16 @@ static void *pktio_ifburst_thread(void *arg)
if (pkts_ok > 0)
odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
 
-   if (odp_unlikely(pkts_ok != pkts)) {
-   err_cnt += pkts-pkts_ok;
-   EXAMPLE_ERR("Dropped frames:%u - err_cnt:%lu\n",
-   pkts-pkts_ok, err_cnt);
-   }
+   if (odp_unlikely(pkts_ok != pkts))
+   stats->drops += pkts - pkts_ok;
 
if (pkts_ok == 0)
continue;
 
-   /* Print packet counts every once in a while */
-   tmp += pkts_ok;
-   if (odp_unlikely(tmp >= 10 || pkt_cnt == 0)) {
-   pkt_cnt += tmp;
-   tmp =

[lng-odp] UberConference Reminder

2015-03-17 Thread UberConference
UberConference Reminder___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] ipc for odp

2015-03-17 Thread Ciprian Barbu
On Tue, Mar 17, 2015 at 1:44 PM, Maxim Uvarov  wrote:
> On 03/17/15 14:30, Ciprian Barbu wrote:
>>
>> On Fri, Mar 13, 2015 at 5:30 PM, Ola Liljedahl 
>> wrote:
>>>
>>> On 13 March 2015 at 13:35, Maxim Uvarov  wrote:

 On 03/13/15 13:43, Ciprian Barbu wrote:
>
> On Fri, Mar 13, 2015 at 11:34 AM, Ola Liljedahl
>  wrote:
>>
>> When I think about IPC, it is message passing between different
>> programs
>> (different processes, different address spaces, possibly even
>> different
>> machines). IPC provides services like address resolution (some form of
>> name
>> lookup), being able to respond to messages, a model for message typing
>> (so
>> you can parse and understand messages from different senders). One of
>> the
>> main use cases for IPC would be between the control plane (which does
>> not
>> use ODP) and the data plane (which would be implemented using ODP).
>>
>> Synchronization between threads using the same address space can be
>> done
>> in
>> many way (e.g. by posting ODP buffers to queues). What kind of generic
>> helpers are needed here?
>
> I agree with Ola here. The problem you have seems to only apply to
> linux-generic, on some real HW platforms it should be possible to
> "transfer" packets from one process to another trough globally visible
> queue ids, indistinctly from the two entities being different ODP
> applications or different threads of the same ODP application.
>
> I think we need to first define better the visibility scope of pools
> and queues for ODP in general and see how it applies to linux-generic
> in particular. If needed linux-generic should make the queue ids and
> buffer ids globally visible transparently, not necessarily with best
> performance, the ODP design should first and foremost be clear and
> linux-generic is a reference software implementation.
>
> As for IPC, as Ola said, it should be a service that provides a form
> of communication framework between different ODP "workers", with the
> possibility of being able to synchronize on different message types.
> ENEA has had an IPC framework for a long time that works this way and
> provides transparent, reliable, scalable IPC, not only between
> processes on the same system, but between different nodes in a
> network. The protocol is even open sourced and available for Linux
> distributions. I think at the very least ODP should incorporate some
> of the design aspects, like for example defining new event types to be
> used for IPC and define an IPC API for exchanging messages between the
> different ODP instances.
>
> /Ciprian

 Actually I do not understand the reason of that "messages". And why it
 has
 to be in ODP.
 Say for example if you have some odp packet and you want to send it to
 other node, just
 do it in software. Hardware here can not help you.
>>>
>>> There has to be some form of support in ODP because some of the endpoints
>>> (consumers, perhaps producers of the messages) will be ODP (dataplane)
>>> threads. Possibly IPC has to be integrated with queues and scheduling
>>> because that is how the dataplane threads are assigned work (events).
>>>
 I understand my use case. It it to have best performance on exchanging
 packets between different
>>>
>>> Exchanging packets in shared memory does not sound like IPC to me.
>>>
 processes which can share memory on the same machine. Taras some time
 ago
 said that if that
 sort of IPC will be on pktio level then TI KS2 can do exchanging packets
 in hardware not related if
>>>
>>> Keystone can automatically copy buffers between different pools as the
>>> buffer is enqueued on specific queues. That's a nice feature. The primary
>>> use case for this was probably to do managed prefetch between the
>>> different
>>> layers of memory hierarchy of the KS DSP's (which have per-core SRAM,
>>> shared
>>> on-chip SRAM and SDRAM).
>>>
 it's same pool or not. One of initial version of patch was bases on
 queue
 abstraction, while after
 we decided to go with pktio abstraction.
>>>
>>> I don't remember why this was changed. Queues seems like a better
>>> abstraction for exchanging messages (which are just another form of
>>> events).
>>> But pktio can be accessed through queues?
>>>
 If I understand right Ola and Ciprian speak more about connection
 protocol
 between data plane and control plane.
 That is not IPC, as I see this. It's connection protocol. IPC is for
 communication on the same node between different processes.
>>
>> The concept of IPC in general is not limited to the widely known
>> System V IPC, IPC is any form of sharing data between multiple
>> processes, possibly across network boundaries, using communication
>> protocols. Socket based communication is also I

[lng-odp] [Bug 1365] New: Lock-up following sendmmsg failure

2015-03-17 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1365

Bug ID: 1365
   Summary: Lock-up following sendmmsg failure
   Product: OpenDataPlane
   Version: 1.0
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: Packet IO
  Assignee: maxim.uva...@linaro.org
  Reporter: stuart.has...@linaro.org
CC: lng-odp@lists.linaro.org

When using ODP_PKTIO_TYPE_SOCKET_MMSG if you attempt to send a packet which is
larger than the MTU of the underlying interface, the code gets stuck in an
infinite loop. This is because the possible errnos returned by sendmmsg aren't
handled correctly.

Generally, error handling in the pktio linux-generic transmit code is not
great.

-- 
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


Re: [lng-odp] [PATCH] doc: move api guidelines to API doc

2015-03-17 Thread Mike Holmes
ping

On 11 March 2015 at 14:43, Bill Fischofer  wrote:

>
>
> On Wed, Mar 11, 2015 at 1:24 PM, Mike Holmes 
> wrote:
>
>> This documentation was moved from the architecture doc to this API doc.
>>
>> Signed-off-by: Mike Holmes 
>>
>
> Reviewed-by: Bill Fischofer 
>
>
>> ---
>>  doc/api_guide_lines.dox | 178
>> 
>>  1 file changed, 178 insertions(+)
>>  create mode 100644 doc/api_guide_lines.dox
>>
>> diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
>> new file mode 100644
>> index 000..4cfe088
>> --- /dev/null
>> +++ b/doc/api_guide_lines.dox
>> @@ -0,0 +1,178 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> +
>> + * All rights reserved
>> + *
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + */
>> +
>> +/**
>> +
>> +@page api_guide_lines  API Guide Lines
>> +
>> +@tableofcontents
>> +
>> +@section introduction Introduction
>> +ODP APIs are implemented as callable C functions that often return a
>> typed value.
>> +This document describes the approach to handling return values and error
>> indications expected of conforming ODP implementations.
>> +As such it should be regarded as providing guidelines for how to create
>> new ODP APIs.
>> +
>> +@section functional Functional Definition
>> +This section defines the use of data types, calling conventions, and
>> return codes used by ODP APIs.
>> +All ODP APIs MUST follow these conventions as part of their design.
>> +
>> +@subsection naming Naming Conventions
>> +All ODP APIs begin with the prefix odp_ and those that describe an
>> action to be performed on an object follow the naming convention of object
>> followed by action.
>> +The advantage of this approach is that an alphabetical list of APIs for
>> an object all sort together since they all have names of the form
>> odp_object_action().
>> +
>> +So for example the API call to allocate a buffer is named
>> odp_buffer_alloc() rather than odp_alloc_buffer().
>> +
>> +@subsection data_types Data Types and Use of typedef
>> +ODP is designed to allow broad variability in how APIs are implemented
>> on various platforms.
>> +To support this, most APIs operate on abstract data types that are
>> defined via typedef on a per-implementation basis.
>> +These abstract types follow the naming convention of odp_object_t.
>> +
>> +Typedefs that encapsulate C structs follow the convention:
>> +
>> +@code
>> +typedef struct odp__s {
>> +...
>> +} odp__t;
>> +@endcode
>> +
>> +The use of typedef allows implementations to choose underlying data
>> representations that map efficiently to platform capabilities while
>> providing accessor functions to provide structured access to implementation
>> information in a portable manner
>> +Similarly, the use of enum is RECOMMENDED to provide value abstraction
>> for API parameters while enabling the implementation to choose code points
>> that map well to platform native values.
>> +
>> +Several native C types are used conventionally within ODP and SHOULD be
>> employed in API design:
>> +
>> +type | Correct use
>> + |---| :-
>> +void | SHOULD be used for APIs that do not return a value
>> +void*| SHOULD be used for APIs that return a pointer intended to be used
>> by the caller. For example, a routine that returns the address of an
>> application context area SHOULD use a void * return type
>> +odp_bool_t  | SHOULD be used for APIs that return a @ref boolean value.
>> +int  | SHOULD be used for success and failure indications, with 0
>> indicating a success. Errno may be set
>> +
>> +@subsection parameters Parameter Structure and Validation
>> +ODP is a framework for use in the data plane.
>> +Data plane applications typically have extreme performance requirements
>> mandating very strict attention to path length considerations in the design
>> of all ODP APIs, with the exception of those designed to be used
>> infrequently such as only during initialization or termination processing.
>> +
>> +Minimizing pathlength in API design involves several considerations:
>> + - The number of parameters passed to a call.
>> +   In general, ODP APIs designed for frequent use SHOULD have few
>> parameters.
>> +   Limiting parameter count to one or two well-chosen parameters SHOULD
>> be the goal for APIs designed for frequent use.
>> +   If a call requires more complex parameter data then it is RECOMMENDED
>> that instead of multiple parameters a single pointer to a struct that can
>> be statically templated and modified by the caller be used.
>> + - The use of macros and inlining.
>> +   ODP APIs MAY be implemented as preprocessor macros and/or inline
>> functions.
>> +   This is especially true for accessor functions that are designed to
>> provide getters/setters for object meta data.
>> + - Limiting parameter validation and error-checking processing.
>> +   While useful for development and debugging, providing “bullet-proof”
>> APIs that perform extensive parameter validation and error checking is
>> often inap

Re: [lng-odp] [PATCH] doc: move api guidelines to API doc

2015-03-17 Thread Mike Holmes
ping

On 11 March 2015 at 14:43, Bill Fischofer  wrote:

>
>
> On Wed, Mar 11, 2015 at 1:24 PM, Mike Holmes 
> wrote:
>
>> This documentation was moved from the architecture doc to this API doc.
>>
>> Signed-off-by: Mike Holmes 
>>
>
> Reviewed-by: Bill Fischofer 
>
>
>> ---
>>  doc/api_guide_lines.dox | 178
>> 
>>  1 file changed, 178 insertions(+)
>>  create mode 100644 doc/api_guide_lines.dox
>>
>> diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
>> new file mode 100644
>> index 000..4cfe088
>> --- /dev/null
>> +++ b/doc/api_guide_lines.dox
>> @@ -0,0 +1,178 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> +
>> + * All rights reserved
>> + *
>> + * SPDX-License-Identifier: BSD-3-Clause
>> + */
>> +
>> +/**
>> +
>> +@page api_guide_lines  API Guide Lines
>> +
>> +@tableofcontents
>> +
>> +@section introduction Introduction
>> +ODP APIs are implemented as callable C functions that often return a
>> typed value.
>> +This document describes the approach to handling return values and error
>> indications expected of conforming ODP implementations.
>> +As such it should be regarded as providing guidelines for how to create
>> new ODP APIs.
>> +
>> +@section functional Functional Definition
>> +This section defines the use of data types, calling conventions, and
>> return codes used by ODP APIs.
>> +All ODP APIs MUST follow these conventions as part of their design.
>> +
>> +@subsection naming Naming Conventions
>> +All ODP APIs begin with the prefix odp_ and those that describe an
>> action to be performed on an object follow the naming convention of object
>> followed by action.
>> +The advantage of this approach is that an alphabetical list of APIs for
>> an object all sort together since they all have names of the form
>> odp_object_action().
>> +
>> +So for example the API call to allocate a buffer is named
>> odp_buffer_alloc() rather than odp_alloc_buffer().
>> +
>> +@subsection data_types Data Types and Use of typedef
>> +ODP is designed to allow broad variability in how APIs are implemented
>> on various platforms.
>> +To support this, most APIs operate on abstract data types that are
>> defined via typedef on a per-implementation basis.
>> +These abstract types follow the naming convention of odp_object_t.
>> +
>> +Typedefs that encapsulate C structs follow the convention:
>> +
>> +@code
>> +typedef struct odp__s {
>> +...
>> +} odp__t;
>> +@endcode
>> +
>> +The use of typedef allows implementations to choose underlying data
>> representations that map efficiently to platform capabilities while
>> providing accessor functions to provide structured access to implementation
>> information in a portable manner
>> +Similarly, the use of enum is RECOMMENDED to provide value abstraction
>> for API parameters while enabling the implementation to choose code points
>> that map well to platform native values.
>> +
>> +Several native C types are used conventionally within ODP and SHOULD be
>> employed in API design:
>> +
>> +type | Correct use
>> + |---| :-
>> +void | SHOULD be used for APIs that do not return a value
>> +void*| SHOULD be used for APIs that return a pointer intended to be used
>> by the caller. For example, a routine that returns the address of an
>> application context area SHOULD use a void * return type
>> +odp_bool_t  | SHOULD be used for APIs that return a @ref boolean value.
>> +int  | SHOULD be used for success and failure indications, with 0
>> indicating a success. Errno may be set
>> +
>> +@subsection parameters Parameter Structure and Validation
>> +ODP is a framework for use in the data plane.
>> +Data plane applications typically have extreme performance requirements
>> mandating very strict attention to path length considerations in the design
>> of all ODP APIs, with the exception of those designed to be used
>> infrequently such as only during initialization or termination processing.
>> +
>> +Minimizing pathlength in API design involves several considerations:
>> + - The number of parameters passed to a call.
>> +   In general, ODP APIs designed for frequent use SHOULD have few
>> parameters.
>> +   Limiting parameter count to one or two well-chosen parameters SHOULD
>> be the goal for APIs designed for frequent use.
>> +   If a call requires more complex parameter data then it is RECOMMENDED
>> that instead of multiple parameters a single pointer to a struct that can
>> be statically templated and modified by the caller be used.
>> + - The use of macros and inlining.
>> +   ODP APIs MAY be implemented as preprocessor macros and/or inline
>> functions.
>> +   This is especially true for accessor functions that are designed to
>> provide getters/setters for object meta data.
>> + - Limiting parameter validation and error-checking processing.
>> +   While useful for development and debugging, providing “bullet-proof”
>> APIs that perform extensive parameter validation and error checking is
>> often inap

Re: [lng-odp] ipc for odp

2015-03-17 Thread Maxim Uvarov

On 03/17/15 14:30, Ciprian Barbu wrote:

On Fri, Mar 13, 2015 at 5:30 PM, Ola Liljedahl  wrote:

On 13 March 2015 at 13:35, Maxim Uvarov  wrote:

On 03/13/15 13:43, Ciprian Barbu wrote:

On Fri, Mar 13, 2015 at 11:34 AM, Ola Liljedahl
 wrote:

When I think about IPC, it is message passing between different programs
(different processes, different address spaces, possibly even different
machines). IPC provides services like address resolution (some form of
name
lookup), being able to respond to messages, a model for message typing
(so
you can parse and understand messages from different senders). One of
the
main use cases for IPC would be between the control plane (which does
not
use ODP) and the data plane (which would be implemented using ODP).

Synchronization between threads using the same address space can be done
in
many way (e.g. by posting ODP buffers to queues). What kind of generic
helpers are needed here?

I agree with Ola here. The problem you have seems to only apply to
linux-generic, on some real HW platforms it should be possible to
"transfer" packets from one process to another trough globally visible
queue ids, indistinctly from the two entities being different ODP
applications or different threads of the same ODP application.

I think we need to first define better the visibility scope of pools
and queues for ODP in general and see how it applies to linux-generic
in particular. If needed linux-generic should make the queue ids and
buffer ids globally visible transparently, not necessarily with best
performance, the ODP design should first and foremost be clear and
linux-generic is a reference software implementation.

As for IPC, as Ola said, it should be a service that provides a form
of communication framework between different ODP "workers", with the
possibility of being able to synchronize on different message types.
ENEA has had an IPC framework for a long time that works this way and
provides transparent, reliable, scalable IPC, not only between
processes on the same system, but between different nodes in a
network. The protocol is even open sourced and available for Linux
distributions. I think at the very least ODP should incorporate some
of the design aspects, like for example defining new event types to be
used for IPC and define an IPC API for exchanging messages between the
different ODP instances.

/Ciprian

Actually I do not understand the reason of that "messages". And why it has
to be in ODP.
Say for example if you have some odp packet and you want to send it to
other node, just
do it in software. Hardware here can not help you.

There has to be some form of support in ODP because some of the endpoints
(consumers, perhaps producers of the messages) will be ODP (dataplane)
threads. Possibly IPC has to be integrated with queues and scheduling
because that is how the dataplane threads are assigned work (events).


I understand my use case. It it to have best performance on exchanging
packets between different

Exchanging packets in shared memory does not sound like IPC to me.


processes which can share memory on the same machine. Taras some time ago
said that if that
sort of IPC will be on pktio level then TI KS2 can do exchanging packets
in hardware not related if

Keystone can automatically copy buffers between different pools as the
buffer is enqueued on specific queues. That's a nice feature. The primary
use case for this was probably to do managed prefetch between the different
layers of memory hierarchy of the KS DSP's (which have per-core SRAM, shared
on-chip SRAM and SDRAM).


it's same pool or not. One of initial version of patch was bases on queue
abstraction, while after
we decided to go with pktio abstraction.

I don't remember why this was changed. Queues seems like a better
abstraction for exchanging messages (which are just another form of events).
But pktio can be accessed through queues?


If I understand right Ola and Ciprian speak more about connection protocol
between data plane and control plane.
That is not IPC, as I see this. It's connection protocol. IPC is for
communication on the same node between different processes.

The concept of IPC in general is not limited to the widely known
System V IPC, IPC is any form of sharing data between multiple
processes, possibly across network boundaries, using communication
protocols. Socket based communication is also IPC in that sense, so is
message passing:
http://en.wikipedia.org/wiki/Inter-process_communication#Approaches

At the very least I think it's wrong to call your mechanism THE IPC.


Ciprian and Ola if you have ideas for requirement can you came up with 
some API proposal?

I think it will save time and you can discuss your solution.

My approach is based on shared memory because it only case to have good 
performance on systems
which can not do packet exchanging in software. Does not matter how it's 
named. It might be 'shared memory pktio'.

But I need it for specific reason.

In your case it look

Re: [lng-odp] ipc for odp

2015-03-17 Thread Ciprian Barbu
On Fri, Mar 13, 2015 at 5:30 PM, Ola Liljedahl  wrote:
> On 13 March 2015 at 13:35, Maxim Uvarov  wrote:
>>
>> On 03/13/15 13:43, Ciprian Barbu wrote:
>>>
>>> On Fri, Mar 13, 2015 at 11:34 AM, Ola Liljedahl
>>>  wrote:

 When I think about IPC, it is message passing between different programs
 (different processes, different address spaces, possibly even different
 machines). IPC provides services like address resolution (some form of
 name
 lookup), being able to respond to messages, a model for message typing
 (so
 you can parse and understand messages from different senders). One of
 the
 main use cases for IPC would be between the control plane (which does
 not
 use ODP) and the data plane (which would be implemented using ODP).

 Synchronization between threads using the same address space can be done
 in
 many way (e.g. by posting ODP buffers to queues). What kind of generic
 helpers are needed here?
>>>
>>> I agree with Ola here. The problem you have seems to only apply to
>>> linux-generic, on some real HW platforms it should be possible to
>>> "transfer" packets from one process to another trough globally visible
>>> queue ids, indistinctly from the two entities being different ODP
>>> applications or different threads of the same ODP application.
>>>
>>> I think we need to first define better the visibility scope of pools
>>> and queues for ODP in general and see how it applies to linux-generic
>>> in particular. If needed linux-generic should make the queue ids and
>>> buffer ids globally visible transparently, not necessarily with best
>>> performance, the ODP design should first and foremost be clear and
>>> linux-generic is a reference software implementation.
>>>
>>> As for IPC, as Ola said, it should be a service that provides a form
>>> of communication framework between different ODP "workers", with the
>>> possibility of being able to synchronize on different message types.
>>> ENEA has had an IPC framework for a long time that works this way and
>>> provides transparent, reliable, scalable IPC, not only between
>>> processes on the same system, but between different nodes in a
>>> network. The protocol is even open sourced and available for Linux
>>> distributions. I think at the very least ODP should incorporate some
>>> of the design aspects, like for example defining new event types to be
>>> used for IPC and define an IPC API for exchanging messages between the
>>> different ODP instances.
>>>
>>> /Ciprian
>>
>> Actually I do not understand the reason of that "messages". And why it has
>> to be in ODP.
>> Say for example if you have some odp packet and you want to send it to
>> other node, just
>> do it in software. Hardware here can not help you.
>
> There has to be some form of support in ODP because some of the endpoints
> (consumers, perhaps producers of the messages) will be ODP (dataplane)
> threads. Possibly IPC has to be integrated with queues and scheduling
> because that is how the dataplane threads are assigned work (events).
>
>>
>> I understand my use case. It it to have best performance on exchanging
>> packets between different
>
> Exchanging packets in shared memory does not sound like IPC to me.
>
>>
>> processes which can share memory on the same machine. Taras some time ago
>> said that if that
>> sort of IPC will be on pktio level then TI KS2 can do exchanging packets
>> in hardware not related if
>
> Keystone can automatically copy buffers between different pools as the
> buffer is enqueued on specific queues. That's a nice feature. The primary
> use case for this was probably to do managed prefetch between the different
> layers of memory hierarchy of the KS DSP's (which have per-core SRAM, shared
> on-chip SRAM and SDRAM).
>
>> it's same pool or not. One of initial version of patch was bases on queue
>> abstraction, while after
>> we decided to go with pktio abstraction.
>
> I don't remember why this was changed. Queues seems like a better
> abstraction for exchanging messages (which are just another form of events).
> But pktio can be accessed through queues?
>
>>
>> If I understand right Ola and Ciprian speak more about connection protocol
>> between data plane and control plane.
>> That is not IPC, as I see this. It's connection protocol. IPC is for
>> communication on the same node between different processes.

The concept of IPC in general is not limited to the widely known
System V IPC, IPC is any form of sharing data between multiple
processes, possibly across network boundaries, using communication
protocols. Socket based communication is also IPC in that sense, so is
message passing:
http://en.wikipedia.org/wiki/Inter-process_communication#Approaches

At the very least I think it's wrong to call your mechanism THE IPC.

>
> You would not be able to make a phone call without this kind of IPC between
> different control plane processes (lots of them) and also data plane. That's
> how te

Re: [lng-odp] [PATCH 1/2] validation: timer: use ODP_SHM_NULL

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/06/15 20:30, Mike Holmes wrote:



On 6 March 2015 at 09:30, Petri Savolainen > wrote:


Use ODP_SHM_NULL to select default shm memory in odp_pool_create(),
instead of ODP_SHM_INVALID.

Signed-off-by: Petri Savolainen mailto:petri.savolai...@nokia.com>>


Reviewed & Tested-by: Mike Holmes >

arm & x86

Docs say
http://docs.opendataplane.org/odp/html/group__odp__buffer.html#ga4136c6b8dca5d6dfac533acfde5f4e1b

Parameters
nameName of the pool, max ODP_POOL_NAME_LEN-1 chars. May be
specified as NULL for anonymous pools.
shm The shared memory object in which to create the pool. Use
ODP_SHM_NULL to reserve default memory type for the pool type.
params  Pool parameters.


---
 test/validation/odp_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 88af61b..2ef3b39 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -64,7 +64,7 @@ static void test_timeout_pool_alloc(void)
.type  = ODP_POOL_TIMEOUT,
};

-   pool = odp_pool_create("timeout_pool_alloc",
ODP_SHM_INVALID, ¶ms);
+   pool = odp_pool_create("timeout_pool_alloc", ODP_SHM_NULL,
¶ms);
odp_pool_print(pool);

/* Try to allocate num items from the pool */
@@ -104,7 +104,7 @@ static void test_timeout_pool_free(void)
.type  = ODP_POOL_TIMEOUT,
};

-   pool = odp_pool_create("timeout_pool_free",
ODP_SHM_INVALID, ¶ms);
+   pool = odp_pool_create("timeout_pool_free", ODP_SHM_NULL,
¶ms);
odp_pool_print(pool);

/* Allocate the only timeout from the pool */
@@ -356,7 +356,7 @@ static void test_odp_timer_all(void)
/* Create timeout pools */
params.tmo.num = (NTIMERS + 1) * num_workers;
params.type= ODP_POOL_TIMEOUT;
-   tbp = odp_pool_create("tmo_pool", ODP_SHM_INVALID, ¶ms);
+   tbp = odp_pool_create("tmo_pool", ODP_SHM_NULL, ¶ms);
if (tbp == ODP_POOL_INVALID)
CU_FAIL_FATAL("Timeout pool create failed");

--
2.3.1


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




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM SoCs



___
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] [PATCHv2 2/2] tests: performance add l2fwd to run script

2015-03-17 Thread Stuart Haslam
On Mon, Mar 16, 2015 at 06:56:19PM +0300, Maxim Uvarov wrote:
> On 03/16/15 14:09, Stuart Haslam wrote:
> >On Fri, Mar 13, 2015 at 06:03:47PM +0300, Maxim Uvarov wrote:
> >>Move common pktio linux-generic functions to setup virtual net to
> >>linux-generic folder and add running l2fwd test for make check.
> >>
> >>Signed-off-by: Maxim Uvarov 
> >>---
> >>  platform/linux-generic/test/pktio_env  | 90 
> >> ++
> >>  test/performance/Makefile.am   |  4 +-
> >>  test/performance/odp_example_l2fwd_run | 31 
> >>  test/validation/odp_pktio_run  | 83 
> >> +++
> >>  4 files changed, 132 insertions(+), 76 deletions(-)
> >>  create mode 100755 platform/linux-generic/test/pktio_env
> >>  create mode 100755 test/performance/odp_example_l2fwd_run
> >>
> >>diff --git a/platform/linux-generic/test/pktio_env 
> >>b/platform/linux-generic/test/pktio_env
> >>new file mode 100755
> >>index 000..a6d0597
> >>--- /dev/null
> >>+++ b/platform/linux-generic/test/pktio_env
> >>@@ -0,0 +1,90 @@
> >>+#!/bin/sh
> >>+#
> >>+# Test script wrapper for running ODP pktio tests on linux-generic.
> >>+#
> >>+# For platforms other than linux-generic this script does nothing other
> >>+# than running the odp_pktio binary, odp_pktio will then attempt to
> >>+# open and use the special device named "loop" for testing.
> >This comment and some others below aren't valid now.
> 
> Ah, yes. Not sure what is better move in one patch and fix in second
> patch. Or move and fix in one patch.
> 

I think it's best to fix up the comments with the initial move,
otherwise it's confusing in the interim.

> 
> >>+#
> >>+# For linux-generic the default behaviour is to create a pair of
> >>+# virtual Ethernet interfaces and provide the names of these via
> >>+# environment variables to odp_pktio, the interfaces will be removed
> >>+# before the script exits. Note that the creation of virtual Ethernet
> >>+# devices depends on having CONFIG_VETH enabled in the kernel, if not
> >>+# enabled the test will be skipped.
> >>+#
> >>+# The evironment variable ODP_PLATFORM is used to determine the
> >>+# platform under test, when this script is invoked via 'make check'
> >>+# this variable is set automatically.
> >>+#
> >>+# It's also possible to split up the steps, which makes it easier when
> >>+# debugging, for example;
> >>+#
> >>+# export ODP_PLATFORM=linux-generic
> >>+# odp_pktio_run setup
> >>+# wireshark -i pktio-p0 -k &
> >>+# odp_pktio_run
> >>+# (repeat running test multiple times..)
> >>+# odp_pktio_run cleanup
> >>+#
> >>+TEST_DIR=$(dirname $0)
> >>+# Network set up
> >>+# IF0 <---> IF1
> >>+# IF2 <---> IF3
> >>+IF0=pktio-p0-p1
> >>+IF1=pktio-p1-p0
> >>+IF2=pktio-p2-p3
> >>+IF3=pktio-p3-p2
> >>+
> >>+# exit codes expected by automake for skipped tests
> >>+TEST_SKIPPED=77
> >>+
> >>+setup_env1()
> >>+{
> >>+   ip link show $IF0 2> /dev/null
> >>+   if [ $? = 0 ]; then
> >>+   ip link show $IF1 2> /dev/null
> >>+   if [ $? = 0 ]; then
> >>+   echo "pktio: interfaces $IF0 and $IF1 already exist"
> >What about the other 2 interfaces?
> good catch. And more likely that cascading if's are not needed here.
> 
> >>+   return
> >>+   fi
> >>+   fi
> >>+
> >>+   echo "pktio: setting up test interfaces $IF0, $IF1, $IF2, $IF3."
> >>+
> >>+   if [ "$1" = "clean" ]; then
> >>+   trap cleanup_env1 EXIT
> >>+   fi
> >>+
> >>+   ip link add $IF0 type veth peer name $IF1
> >>+   if [ $? != 0 ]; then
> >>+   echo "pktio: error: unable to create veth pair"
> >>+   exit $TEST_SKIPPED
> >>+   fi
> >>+   ip link add $IF2 type veth peer name $IF3
> >>+   if [ $? != 0 ]; then
> >>+   echo "pktio: error: unable to create veth pair"
> >>+   exit $TEST_SKIPPED
> >>+   fi
> >>+
> >>+   ip link set $IF0 mtu 9216 up
> >>+   ip link set $IF1 mtu 9216 up
> >>+   ip link set $IF2 mtu 9216 up
> >>+   ip link set $IF3 mtu 9216 up
> >>+   ifconfig $IF0 -arp
> >>+   ifconfig $IF1 -arp
> >>+   ifconfig $IF2 -arp
> >>+   ifconfig $IF3 -arp
> >>+
> >>+   # network needs a little time to come up
> >>+   sleep 1
> >>+}
> >>+
> >>+cleanup_env1()
> >>+{
> >>+   echo "pktio: removing test interfaces $IF0 - $IF3"
> >>+   ip link del $IF0 2> /dev/null
> >>+   ip link del $IF1 2> /dev/null
> >>+   ip link del $IF2 2> /dev/null
> >>+   ip link del $IF3 2> /dev/null
> >>+}
> >>diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
> >>index 3be3721..4f480c3 100644
> >>--- a/test/performance/Makefile.am
> >>+++ b/test/performance/Makefile.am
> >>@@ -1,10 +1,12 @@
> >>  include $(top_srcdir)/test/Makefile.inc
> >>+TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
> >>+
> >>  EXECUTABLES =
> >>  COMPILE_ONLY = odp_scheduling
> >>-TESTSCRIPTS = odp_scheduling_run
> >>+TESTSCRIPTS = odp_scheduling_run odp_example_l2fwd_run
> >>  if test_perf
> >>  TESTS = $(EXECUTABLES) $(TESTSCRIPTS)
> >>diff --git a/test

Re: [lng-odp] [PATCH] linux-generic: strongtypes: add dummy struct var to keep c++ happy

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/13/15 22:29, Mike Holmes wrote:



On 12 March 2015 at 17:36, Bill Fischofer > wrote:


C++ doesn't like null structs so add a dummy variable to make it
happy.
Note that we only use these types as pseudo-pointers for strong typing
so the contents of what they apparently point to is irrelevant since
we never reference it.

This addresses Bug https://bugs.linaro.org/show_bug.cgi?id=1267

Signed-off-by: Bill Fischofer mailto:bill.fischo...@linaro.org>>


Reviewed-and-tested-by: Mike Holmes >


---
 platform/linux-generic/include/odp/plat/strong_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git
a/platform/linux-generic/include/odp/plat/strong_types.h
b/platform/linux-generic/include/odp/plat/strong_types.h
index 7fe73d8..72db7c4 100644
--- a/platform/linux-generic/include/odp/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/plat/strong_types.h
@@ -16,7 +16,7 @@
 #define STRONG_TYPES_H_

 /** Use strong typing for ODP types */
-#define odp_handle_t struct {} *
+#define odp_handle_t struct { uint8_t unused_dummy_var; } *

 /** Internal macro to get value of an ODP handle */
 #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
--
2.1.0




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org ***│ *Open source software for ARM SoCs



___
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] [PATCHv2 1/3] validation: pktio: add support for VPATH builds

2015-03-17 Thread Stuart Haslam
Running "make check" in a VPATH build fails as the odp_pktio_run script
incorrectly assumes that the odp_pktio binary is in the same directory.
Resolve this by passing the path to the test binary to the script via
the TESTS_ENVIRONMENT variable.

Signed-off-by: Stuart Haslam 
---
 test/validation/Makefile.am   | 4 +++-
 test/validation/odp_pktio_run | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 0833181..e695e07 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/test/Makefile.inc
 AM_CFLAGS += -I$(srcdir)/common
 AM_LDFLAGS += -static
 
-TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform}
+TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} TEST_DIR=${builddir}
 
 EXECUTABLES = odp_buffer \
  odp_classification \
@@ -31,6 +31,8 @@ if test_vald
 TESTS = $(EXECUTABLES) $(TESTSCRIPTS)
 endif
 
+dist_bin_SCRIPTS = odp_pktio_run
+
 bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 
 ODP_CU_COMMON=common/odp_cunit_common.c
diff --git a/test/validation/odp_pktio_run b/test/validation/odp_pktio_run
index 6177caa..856dfac 100755
--- a/test/validation/odp_pktio_run
+++ b/test/validation/odp_pktio_run
@@ -27,7 +27,7 @@
 # (repeat running test multiple times..)
 # odp_pktio_run cleanup
 #
-TEST_DIR=$(dirname $0)
+TEST_DIR="${TEST_DIR:-$(dirname $0)}"
 IF0=pktio-p0
 IF1=pktio-p1
 
-- 
2.1.1


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


[lng-odp] [PATCHv2 3/3] performance: scheduling: add support for VPATH builds

2015-03-17 Thread Stuart Haslam
Pass the test executable path to the test script to avoid the assumption
that they're both in the same directory.

Signed-off-by: Stuart Haslam 
---
Change in v2; correct name of executable

 test/performance/Makefile.am| 2 ++
 test/performance/odp_scheduling_run | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am
index 3be3721..54cf529 100644
--- a/test/performance/Makefile.am
+++ b/test/performance/Makefile.am
@@ -1,5 +1,7 @@
 include $(top_srcdir)/test/Makefile.inc
 
+TESTS_ENVIRONMENT = TEST_DIR=${builddir}
+
 EXECUTABLES =
 
 COMPILE_ONLY = odp_scheduling
diff --git a/test/performance/odp_scheduling_run 
b/test/performance/odp_scheduling_run
index a96a3d2..b64a79d 100755
--- a/test/performance/odp_scheduling_run
+++ b/test/performance/odp_scheduling_run
@@ -3,6 +3,7 @@
 # Script that passes command line arguments to odp_scheduling test when
 # launched by 'make check'
 
+TEST_DIR="${TEST_DIR:-$(dirname $0)}"
 ret=0
 
 run()
@@ -10,7 +11,7 @@ run()
echo odp_scheduling_run starts with $1 worker threads
echo ===
 
-   ./odp_scheduling -c $1 || ret=1
+   $TEST_DIR/odp_scheduling -c $1 || ret=1
 }
 
 run 1
-- 
2.1.1


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


[lng-odp] [PATCHv2 2/3] performance: scheduling: catch exit codes

2015-03-17 Thread Stuart Haslam
odp_scheduling_run always exits with code 0 so "make check" will never
report failures.

Signed-off-by: Stuart Haslam 
---
Change in v2; correct name of executable

 test/performance/odp_scheduling_run | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/performance/odp_scheduling_run 
b/test/performance/odp_scheduling_run
index 28b0ce5..a96a3d2 100755
--- a/test/performance/odp_scheduling_run
+++ b/test/performance/odp_scheduling_run
@@ -3,13 +3,17 @@
 # Script that passes command line arguments to odp_scheduling test when
 # launched by 'make check'
 
+ret=0
+
 run()
 {
echo odp_scheduling_run starts with $1 worker threads
echo ===
 
-   ./odp_scheduling -c $1
+   ./odp_scheduling -c $1 || ret=1
 }
 
 run 1
 run 8
+
+exit $ret
-- 
2.1.1


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


Re: [lng-odp] [PATCHv2] validation: timer: added cancel test

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/17/15 04:38, Bill Fischofer wrote:

For the additions:

Reviewed-by: Bill Fischofer >


On Mon, Mar 16, 2015 at 8:55 AM, Ola Liljedahl 
mailto:ola.liljed...@linaro.org>> wrote:


On 12 March 2015 at 17:03, Ola Liljedahl mailto:ola.liljed...@linaro.org>> wrote:

Add basic timer cancel test that checks that everything is OK when
a timer is reset and then cancelled before expiration.

Signed-off-by: Petri Savolainen mailto:petri.savolai...@nokia.com>>
Signed-off-by: Ola Liljedahl mailto:ola.liljed...@linaro.org>>

Reviewed-by:  Ola Liljedahl mailto:ola.liljed...@linaro.org>>
(Petri's original code, my (minor) additions not independently
reviewed, any volunteers?).

---
v2:
Enabled test of odp_timeout_user_ptr().
Added test of odp_timeout_timer().
Rephrased commit message.

 test/validation/odp_timer.c | 85
+
 1 file changed, 85 insertions(+)

diff --git a/test/validation/odp_timer.c
b/test/validation/odp_timer.c
index b625b80..10dd10f 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -124,6 +124,90 @@ static void test_timeout_pool_free(void)
CU_ASSERT(odp_pool_destroy(pool) == 0);
 }

+static void test_odp_timer_cancel(void)
+{
+   odp_pool_t pool;
+   odp_pool_param_t params;
+   odp_timer_pool_param_t tparam;
+   odp_timer_pool_t tp;
+   odp_queue_t queue;
+   odp_timer_t tim;
+   odp_event_t ev;
+   odp_timeout_t tmo;
+   odp_timer_set_t rc;
+   uint64_t tick;
+
+   params.tmo.num = 1;
+   params.type= ODP_POOL_TIMEOUT;
+   pool = odp_pool_create("tmo_pool_for_cancel",
ODP_SHM_NULL, ¶ms);
+
+   if (pool == ODP_POOL_INVALID)
+   CU_FAIL_FATAL("Timeout pool create failed");
+
+   tparam.res_ns = 100 * ODP_TIME_MSEC;
+   tparam.min_tmo= 1   * ODP_TIME_SEC;
+   tparam.max_tmo= 10  * ODP_TIME_SEC;
+   tparam.num_timers = 1;
+   tparam.priv   = 0;
+   tparam.clk_src= ODP_CLOCK_CPU;
+   tp = odp_timer_pool_create("timer_pool0", &tparam);
+   if (tp == ODP_TIMER_POOL_INVALID)
+   CU_FAIL_FATAL("Timer pool create failed");
+
+   /* Start all created timer pools */
+   odp_timer_pool_start();
+
+   queue = odp_queue_create("timer_queue",
ODP_QUEUE_TYPE_POLL, NULL);
+   if (queue == ODP_QUEUE_INVALID)
+   CU_FAIL_FATAL("Queue create failed");
+
+   #define USER_PTR ((void *)0xdead)
+   tim = odp_timer_alloc(tp, queue, USER_PTR);
+   if (tim == ODP_TIMER_INVALID)
+   CU_FAIL_FATAL("Failed to allocate timer");
+
+   ev = odp_timeout_to_event(odp_timeout_alloc(pool));
+   if (ev == ODP_EVENT_INVALID)
+   CU_FAIL_FATAL("Failed to allocate timeout");
+
+   tick = odp_timer_ns_to_tick(tp, 2 * ODP_TIME_SEC);
+
+   rc = odp_timer_set_rel(tim, tick, &ev);
+   if (rc != ODP_TIMER_SUCCESS)
+   CU_FAIL_FATAL("Failed to set timer (relative
time)");
+
+   ev = ODP_EVENT_INVALID;
+   if (odp_timer_cancel(tim, &ev) != 0)
+   CU_FAIL_FATAL("Failed to cancel timer
(relative time)");
+
+   if (ev == ODP_EVENT_INVALID)
+   CU_FAIL_FATAL("Cancel did not return event");
+
+   tmo = odp_timeout_from_event(ev);
+   if (tmo == ODP_TIMEOUT_INVALID)
+   CU_FAIL_FATAL("Cancel did not return timeout");
+
+   if (odp_timeout_timer(tmo) != tim)
+   CU_FAIL("Cancel invalid tmo.timer");
+
+   if (odp_timeout_user_ptr(tmo) != USER_PTR)
+   CU_FAIL("Cancel invalid tmo.user_ptr");
+
+   odp_timeout_free(tmo);
+
+   ev = odp_timer_free(tim);
+   if (ev != ODP_EVENT_INVALID)
+   CU_FAIL_FATAL("Free returned event");
+
+   odp_timer_pool_destroy(tp);
+
+   if (odp_queue_destroy(queue) != 0)
+   CU_FAIL_FATAL("Failed to destroy queue");
+
+   if (odp_pool_destroy(pool) != 0)
+   CU_FAIL_FATAL("Failed to destroy pool");
+}
+
 /* @private Handle a received (timeout) event */
 

Re: [lng-odp] [PATCH 2/3] performance: scheduling: catch exit codes

2015-03-17 Thread Stuart Haslam
On Tue, Mar 17, 2015 at 11:44:10AM +0200, Ciprian Barbu wrote:
> On Mon, Mar 16, 2015 at 1:48 PM, Stuart Haslam  
> wrote:
> > odp_scheduling_run always exits with code 0 so "make check" will never
> > report failures.
> >
> > Signed-off-by: Stuart Haslam 
> > ---
> >  test/performance/odp_scheduling_run | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/test/performance/odp_scheduling_run 
> > b/test/performance/odp_scheduling_run
> > index 28b0ce5..738963e 100755
> > --- a/test/performance/odp_scheduling_run
> > +++ b/test/performance/odp_scheduling_run
> > @@ -3,13 +3,17 @@
> >  # Script that passes command line arguments to odp_scheduling test when
> >  # launched by 'make check'
> >
> > +ret=0
> > +
> >  run()
> >  {
> > echo odp_scheduling_run starts with $1 worker threads
> > echo ===
> >
> > -   ./odp_scheduling -c $1
> > +   ./odp_schedling -c $1 || ret=1
> 
> Mistyped scheduling?
> 

Eek, yes, well spotted. It was actually a deliberate negative test that
I ran locally but obviously was not meant to be checked in. The next
patch in this series fixes it, but I'll resend the series with it tidied
up.

-- 
Stuart.

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


Re: [lng-odp] [PATCH] linux-generic: queue: fix potential queue leak

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/17/15 04:40, Bill Fischofer wrote:



On Mon, Mar 16, 2015 at 8:58 AM, Stuart Haslam 
mailto:stuart.has...@linaro.org>> wrote:


If schedule buffer allocation fails during odp_queue_create(), a
scheduled or pktin queue may be incorrectly left in an allocated
state.

Signed-off-by: Stuart Haslam mailto:stuart.has...@linaro.org>>


Reviewed-by: Bill Fischofer >


---
 platform/linux-generic/odp_queue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/platform/linux-generic/odp_queue.c
b/platform/linux-generic/odp_queue.c
index 477b5e3..4bb8b9b 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -226,6 +226,7 @@ odp_queue_t odp_queue_create(const char *name,
odp_queue_type_t type,

buf = odp_schedule_buffer_alloc(handle);
if (buf == ODP_BUFFER_INVALID) {
+   queue->s.status = QUEUE_STATUS_FREE;
ODP_ERR("queue_init: sched buf alloc
failed\n");
return ODP_QUEUE_INVALID;
}
--
2.1.1


___
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 mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [RFC v2 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/rwlock.h   | 11 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 3 files changed, 52 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..d730a70 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -29,14 +27,9 @@ extern "C" {
  */
 
 /**
- * The odp_rwlock_t type.
+ * @typedef odp_rwlock_t
+ * ODP rwlock
  */
-typedef struct {
-   odp_atomic_u32_t cnt; /**< @private lock count
-   0 lock not taken
-   -1 write lock taken
-   >0 read lock(s) taken */
-} odp_rwlock_t;
 
 
 /**
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..bd46e57
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP rwlock
+ */
+struct odp_rwlock_s {
+   odp_atomic_u32_t cnt; /**< lock count
+   0 lock not taken
+   -1 write lock taken
+   >0 read lock(s) taken */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_rwlock_s odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


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


[lng-odp] [RFC v2 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/ticketlock.h   | 12 +-
 .../include/odp/plat/ticketlock_types.h| 46 ++
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 3 files changed, 50 insertions(+), 10 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
index e088e8b..e395ac4 100644
--- a/include/odp/api/ticketlock.h
+++ b/include/odp/api/ticketlock.h
@@ -18,10 +18,6 @@
 extern "C" {
 #endif
 
-
-#include 
-#include 
-
 /** @addtogroup odp_synchronizers
  * Operations on ticket locks.
  * Acquiring a ticket lock happens in two phases. First the threads takes a
@@ -32,13 +28,9 @@ extern "C" {
  */
 
 /**
- * ODP ticket lock
+ * @typedef odp_ticketlock_t
+ * ODP ticketlock
  */
-typedef struct odp_ticketlock_t {
-   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
-   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
-} odp_ticketlock_t;
-
 
 /**
  * Initialize ticket lock.
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h 
b/platform/linux-generic/include/odp/plat/ticketlock_types.h
new file mode 100644
index 000..be93085
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ticketlock
+ */
+
+#ifndef ODP_TICKETLOCK_TYPES_H_
+#define ODP_TICKETLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP ticketlock
+ */
+struct odp_ticketlock_s {
+   odp_atomic_u32_t  next_ticket; /**< Next ticket */
+   odp_atomic_u32_t  cur_ticket;  /**< Current ticket */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_ticketlock_s odp_ticketlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/ticketlock.h 
b/platform/linux-generic/include/odp/ticketlock.h
index fc7f438..658e27f 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  Operations on ticket locks.
  *  @{
-- 
2.1.0


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


[lng-odp] [RFC v2 4/4] barrier: allow platform to override odp_barrier_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/barrier.h  |  7 +---
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 ++
 3 files changed, 49 insertions(+), 6 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h

diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 35f0981..28310ba 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,20 +18,15 @@
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_synchronizers
  *  Synchronize threads.
  *  @{
  */
 
 /**
+ * @typedef odp_barrier_t
  * ODP thread synchronization barrier
  */
-typedef struct odp_barrier_t {
-   uint32_t count;  /**< @private Thread count */
-   odp_atomic_u32_t bar;/**< @private Barrier counter */
-} odp_barrier_t;
-
 
 /**
  * Initialize barrier with thread count.
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index d63c219..7ea5a6b 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_synchronizers
  *  @{
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h 
b/platform/linux-generic/include/odp/plat/barrier_types.h
new file mode 100644
index 000..c8c978d
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP barrier
+ */
+
+#ifndef ODP_BARRIER_TYPES_H_
+#define ODP_BARRIER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/**
+ * @internal
+ * ODP thread synchronization barrier
+ */
+struct odp_barrier_s {
+   uint32_t count;  /**< Thread count */
+   odp_atomic_u32_t bar;/**< Barrier counter */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_barrier_s odp_barrier_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.1.0


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


[lng-odp] [RFC v2 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-17 Thread Jerin Jacob
Move the definition of odp syncronizers abstract types to platform
from public headerfile.
This will allow platform define odp syncronizers abstract type.
Useful when native SDK has definition of the odp syncronizers and
ODP implementation decides to reuses them.

v1..v2 Corrected Doxygen documentation issues proposed by Petri


Jerin Jacob (4):
  spinlock: allow platform to override odp_spinlock_t
  rwlock: allow platform to override odp_rwlock_t
  ticketlock: allow platform to override odp_ticketlock_t
  barrier: allow platform to override odp_barrier_t

 include/odp/api/barrier.h  |  7 +---
 include/odp/api/rwlock.h   | 11 +
 include/odp/api/spinlock.h | 10 +
 include/odp/api/ticketlock.h   | 12 +-
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 47 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 .../include/odp/plat/spinlock_types.h  | 46 +
 .../include/odp/plat/ticketlock_types.h| 46 +
 platform/linux-generic/include/odp/rwlock.h|  2 +
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 12 files changed, 201 insertions(+), 33 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

-- 
2.1.0


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


[lng-odp] [RFC v2 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/spinlock.h | 10 +
 .../include/odp/plat/spinlock_types.h  | 46 ++
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 3 files changed, 50 insertions(+), 8 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h

diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 5cde123..9a5a929 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,21 +18,15 @@
 extern "C" {
 #endif
 
-
-#include 
-
 /** @addtogroup odp_synchronizers
  *  Operations on spin locks.
  *  @{
  */
 
 /**
- * ODP spinlock type
+ * @typedef odp_spinlock_t
+ * ODP spinlock
  */
-typedef struct odp_spinlock_t {
-   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
-} odp_spinlock_t;
-
 
 /**
  * Initialize spin lock.
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h 
b/platform/linux-generic/include/odp/plat/spinlock_types.h
new file mode 100644
index 000..83d306b
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP spinlock
+ */
+
+#ifndef ODP_SPINLOCK_TYPES_H_
+#define ODP_SPINLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/**
+ * @internal
+ * ODP spinlock
+ */
+struct odp_spinlock_s {
+   char lock;  /**< lock flag, should match odp_atomic_flag_t */
+};
+
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_spinlock_s odp_spinlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h 
b/platform/linux-generic/include/odp/spinlock.h
index e02df49..7dbb1c4 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


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


Re: [lng-odp] [PATCHv2] validation: pktio: prevent race when using veth pair

2015-03-17 Thread Maxim Uvarov

Merged,
Maxim.

On 03/16/15 15:27, Stuart Haslam wrote:

There's a potential race condition whereby the test case could start
running before the virtual ethernet interfaces are fully brought up.
So replace the the arbitrary delay with a check for the interface's
operational state before kicking off the test.

Signed-off-by: Stuart Haslam 
---
Changes in v2; rebased and fixed non-POSIX shell arithmetic expansion

  test/validation/odp_pktio_run | 32 ++--
  1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/test/validation/odp_pktio_run b/test/validation/odp_pktio_run
index 6177caa..204b440 100755
--- a/test/validation/odp_pktio_run
+++ b/test/validation/odp_pktio_run
@@ -34,6 +34,28 @@ IF1=pktio-p1
  # exit codes expected by automake for skipped tests
  TEST_SKIPPED=77
  
+# wait for a network interface's operational state to be "up"

+wait_for_iface_up()
+{
+   iface=$1
+   cnt=0
+
+   while [ $cnt -lt 50 ]; do
+   read operstate < /sys/class/net/$iface/operstate
+
+   if [ $? != 0 ]; then
+   break
+   elif [ "$operstate" = "up" ]; then
+   return 0
+   fi
+
+   sleep 0.1
+   cnt=`expr $cnt + 1`
+   done
+
+   return 1
+}
+
  setup_env1()
  {
ip link show $IF0 2> /dev/null
@@ -61,8 +83,14 @@ setup_env1()
ifconfig $IF0 -arp
ifconfig $IF1 -arp
  
-	# network needs a little time to come up

-   sleep 1
+   # check that the interface has come up before starting the test
+   for iface in $IF0 $IF1; do
+   wait_for_iface_up $iface
+   if [ $? != 0 ]; then
+   echo "pktio: interface $iface failed to come up"
+   exit 1
+   fi
+   done
  }
  
  cleanup_env1()



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


[lng-odp] [PATCHv2 0/3] Fixes for https://bugs.linaro.org/show_bug.cgi?id=1284

2015-03-17 Thread Ciprian Barbu
v2:
- fixed patch 3

Like in the previous RFC, the first patch is the fix.
The second and third patch represent a proposed fix for freeing the
ODP_QUEUE_TYPE_SCHED queues that were not removed from the internal priority
queues because the scheduler did not know they were empty.

Ciprian Barbu (3):
  validation: schedule: free queues and pool
  linux-generic: queue: add queue_is_destroyed internal call
  linux-generic: schedule: make sure SCHED queues get freed by the
scheduler

 .../linux-generic/include/odp_queue_internal.h |  9 
 platform/linux-generic/odp_schedule.c  | 25 +
 test/validation/odp_schedule.c | 61 +-
 3 files changed, 93 insertions(+), 2 deletions(-)

-- 
1.8.3.2


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


[lng-odp] [PATCHv2 2/3] linux-generic: queue: add queue_is_destroyed internal call

2015-03-17 Thread Ciprian Barbu
Signed-off-by: Ciprian Barbu 
---
 platform/linux-generic/include/odp_queue_internal.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/platform/linux-generic/include/odp_queue_internal.h 
b/platform/linux-generic/include/odp_queue_internal.h
index 65aae14..9a0e94f 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -139,6 +139,15 @@ static inline int queue_is_sched(odp_queue_t handle)
return ((queue->s.status == QUEUE_STATUS_SCHED) &&
(queue->s.pktin != ODP_PKTIO_INVALID));
 }
+
+static inline int queue_is_destroyed(odp_queue_t handle)
+{
+   queue_entry_t *queue;
+
+   queue = queue_to_qentry(handle);
+
+   return (queue->s.status == QUEUE_STATUS_DESTROYED);
+}
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.3.2


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


[lng-odp] [PATCHv2 1/3] validation: schedule: free queues and pool

2015-03-17 Thread Ciprian Barbu
With the implementation of termination APIs it is now necessarry to cleanup all
allocated resources, queues and pool in this case.
Fixes https://bugs.linaro.org/show_bug.cgi?id=1284

Signed-off-by: Ciprian Barbu 
---
 test/validation/odp_schedule.c | 56 --
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
index a9369c5..b86f997 100644
--- a/test/validation/odp_schedule.c
+++ b/test/validation/odp_schedule.c
@@ -624,7 +624,58 @@ static int schd_suite_init(void)
return 0;
 }
 
-struct CU_TestInfo test_odp_schedule[] = {
+static int destroy_queue(const char *name)
+{
+   odp_queue_t q;
+
+   q = odp_queue_lookup(name);
+
+   if (q == ODP_QUEUE_INVALID)
+   return -1;
+
+   return odp_queue_destroy(q);
+}
+
+static int destroy_queues(void)
+{
+   int i, j, prios;
+
+   prios = odp_schedule_num_prio();
+
+   for (i = 0; i < prios; i++) {
+   for (j = 0; j < QUEUES_PER_PRIO; j++) {
+   char name[32];
+
+   snprintf(name, sizeof(name), "sched_%d_%d_n", i, j);
+   if (destroy_queue(name))
+   return -1;
+
+   snprintf(name, sizeof(name), "sched_%d_%d_a", i, j);
+   if (destroy_queue(name))
+   return -1;
+
+   snprintf(name, sizeof(name), "sched_%d_%d_o", i, j);
+   if (destroy_queue(name))
+   return -1;
+   }
+   }
+
+   return 0;
+}
+
+static int schd_suite_term(void)
+{
+   odp_pool_t pool;
+
+   destroy_queues();
+   pool = odp_pool_lookup(MSG_POOL_NAME);
+   if (odp_pool_destroy(pool) != 0)
+   fprintf(stderr, "error: failed to destroy pool\n");
+
+   return 0;
+}
+
+struct CU_TestInfo schd_tests[] = {
{"schedule_wait_time",  test_schedule_wait_time},
{"schedule_num_prio",   test_schedule_num_prio},
{"schedule_1q_1t_n",test_schedule_1q_1t_n},
@@ -658,6 +709,7 @@ struct CU_TestInfo test_odp_schedule[] = {
 };
 
 CU_SuiteInfo odp_testsuites[] = {
-   {"Scheduler", schd_suite_init, NULL, NULL, NULL, test_odp_schedule},
+   {"Scheduler",
+   schd_suite_init, schd_suite_term, NULL, NULL, schd_tests},
CU_SUITE_INFO_NULL,
 };
-- 
1.8.3.2


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


[lng-odp] [PATCHv2 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler

2015-03-17 Thread Ciprian Barbu
ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be
removed from the pri_queues of the linux-generic scheduler

Signed-off-by: Ciprian Barbu 
---
v2:
- removed #if 1 and trailing whitespaces

 platform/linux-generic/odp_schedule.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index dd65168..18513da 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -153,6 +153,28 @@ int odp_schedule_term_global(void)
 
for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
for (j = 0; j < QUEUES_PER_PRIO; j++) {
+   odp_queue_t pri_q = sched->pri_queue[i][j];
+
+   for (;;) {
+   odp_event_t ev = odp_queue_deq(pri_q);
+   odp_buffer_t desc_buf;
+   queue_desc_t *desc;
+   odp_queue_t queue;
+
+   desc_buf = odp_buffer_from_event(ev);
+   if (desc_buf == ODP_BUFFER_INVALID)
+   break;
+
+   desc  = odp_buffer_addr(desc_buf);
+   queue = desc->queue;
+   /* Let deq_multi_destroy do the job */
+   if (queue_is_destroyed(queue)) {
+   odp_queue_deq_multi(queue,
+   sched_local.ev,
+   MAX_DEQ);
+   }
+   }
+
if (odp_queue_destroy(sched->pri_queue[i][j])) {
ODP_ERR("Sched term: Queue destroy fail.\n");
rc = -1;
-- 
1.8.3.2


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


Re: [lng-odp] [PATCH 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler

2015-03-17 Thread Ciprian Barbu
On Tue, Mar 17, 2015 at 3:43 AM, Bill Fischofer
 wrote:
> Code should not have #if 0 or #if 1 in them.  Leftover from debugging?

Yup, sorry about that.

>
> On Mon, Mar 16, 2015 at 10:16 AM, Maxim Uvarov 
> wrote:
>>
>> On 03/16/15 17:51, Ciprian Barbu wrote:
>>>
>>> ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be
>>> removed from the pri_queues of the linux-generic scheduler
>>>
>>> Signed-off-by: Ciprian Barbu 
>>> ---
>>>   platform/linux-generic/odp_schedule.c | 25 +
>>>   1 file changed, 25 insertions(+)
>>>
>>> diff --git a/platform/linux-generic/odp_schedule.c
>>> b/platform/linux-generic/odp_schedule.c
>>> index dd65168..8429bb9 100644
>>> --- a/platform/linux-generic/odp_schedule.c
>>> +++ b/platform/linux-generic/odp_schedule.c
>>> @@ -153,6 +153,31 @@ int odp_schedule_term_global(void)
>>> for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
>>> for (j = 0; j < QUEUES_PER_PRIO; j++) {
>>> +#if 1
>>
>>
>> if 1?
>>
>>
>>> +   odp_queue_t pri_q = sched->pri_queue[i][j];
>>> +
>>> +   for (;;) {
>>> +   odp_event_t ev = odp_queue_deq(pri_q);
>>> +   odp_buffer_t desc_buf;
>>> +   queue_desc_t *desc;
>>> +   odp_queue_t queue;
>>> +
>>> +   desc_buf = odp_buffer_from_event(ev);
>>> +   if (desc_buf == ODP_BUFFER_INVALID) {
>>> +   break;
>>> +   }
>>> +
>>> +   desc  = odp_buffer_addr(desc_buf);
>>> +   queue = desc->queue;
>>> +   /* Let deq_multi_destroy do the job */
>>> +   if (queue_is_destroyed(queue)) {
>>> +   odp_queue_deq_multi(queue,
>>> +
>>> sched_local.ev,
>>> +   MAX_DEQ);
>>> +   }
>>> +   }
>>> +#endif
>>> +
>>> if (odp_queue_destroy(sched->pri_queue[i][j])) {
>>> ODP_ERR("Sched term: Queue destroy
>>> fail.\n");
>>> rc = -1;
>>
>>
>>
>> ___
>> 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 mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/3] performance: scheduling: catch exit codes

2015-03-17 Thread Ciprian Barbu
On Mon, Mar 16, 2015 at 1:48 PM, Stuart Haslam  wrote:
> odp_scheduling_run always exits with code 0 so "make check" will never
> report failures.
>
> Signed-off-by: Stuart Haslam 
> ---
>  test/performance/odp_scheduling_run | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/test/performance/odp_scheduling_run 
> b/test/performance/odp_scheduling_run
> index 28b0ce5..738963e 100755
> --- a/test/performance/odp_scheduling_run
> +++ b/test/performance/odp_scheduling_run
> @@ -3,13 +3,17 @@
>  # Script that passes command line arguments to odp_scheduling test when
>  # launched by 'make check'
>
> +ret=0
> +
>  run()
>  {
> echo odp_scheduling_run starts with $1 worker threads
> echo ===
>
> -   ./odp_scheduling -c $1
> +   ./odp_schedling -c $1 || ret=1

Mistyped scheduling?

>  }
>
>  run 1
>  run 8
> +
> +exit $ret
> --
> 2.1.1
>
>
> ___
> 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] [RFC 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Savolainen, Petri (Nokia - FI/Espoo)
All these changes are needed. Just copy the mechanism from other abstract 
typedefs we have already. See comments under.

> -Original Message-
> From: lng-odp-boun...@lists.linaro.org [mailto:lng-odp-
> boun...@lists.linaro.org] On Behalf Of ext Jerin Jacob
> Sent: Tuesday, March 17, 2015 9:26 AM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [RFC 1/4] spinlock: allow platform to override
> odp_spinlock_t
> 
> Signed-off-by: Jerin Jacob 
> ---
>  include/odp/api/spinlock.h | 10 --
>  .../include/odp/plat/spinlock_types.h  | 42
> ++
>  platform/linux-generic/include/odp/spinlock.h  |  2 ++
>  3 files changed, 44 insertions(+), 10 deletions(-)
>  create mode 100644 platform/linux-
> generic/include/odp/plat/spinlock_types.h
> 
> diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
> index 5cde123..9288034 100644
> --- a/include/odp/api/spinlock.h
> +++ b/include/odp/api/spinlock.h
> @@ -18,21 +18,11 @@
>  extern "C" {
>  #endif
> 
> -
> -#include 
> -
>  /** @addtogroup odp_synchronizers
>   *  Operations on spin locks.
>   *  @{
>   */
> 
> -/**
> - * ODP spinlock type
> - */
> -typedef struct odp_spinlock_t {
> - char lock;  /**< @private lock flag, should match odp_atomic_flag_t
> */
> -} odp_spinlock_t;
> -

/**
 * @typedef odp_spinlock_t
 * ODP spinlock
 */

Doxygen documentation has to be in the public header.


> 
>  /**
>   * Initialize spin lock.
> diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h
> b/platform/linux-generic/include/odp/plat/spinlock_types.h
> new file mode 100644
> index 000..edb752f
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
> @@ -0,0 +1,42 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP spinlock
> + */
> +
> +#ifndef ODP_SPINLOCK_TYPES_H_
> +#define ODP_SPINLOCK_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +
> +/** @addtogroup odp_synchronizers
> + *  @{
> + */
> +
> +/**
> + * ODP spinlock type
> + */

Remove Doxygen tagging from implementation.

> +typedef struct odp_spinlock_t {
> + char lock;  /**< @private lock flag, should match odp_atomic_flag_t

This can be a normal comment. No doxygen tagging here.

-Petri


> */
> +} odp_spinlock_t;
> +
> +/**
> + * @}
> + */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp/spinlock.h
> b/platform/linux-generic/include/odp/spinlock.h
> index e02df49..7dbb1c4 100644
> --- a/platform/linux-generic/include/odp/spinlock.h
> +++ b/platform/linux-generic/include/odp/spinlock.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
> 
> +#include 
> +
>  /** @ingroup odp_synchronizers
>   *  @{
>   */
> --
> 2.1.0
> 
> 
> ___
> 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] [RFC 3/4] ticketlock: allow platform to override odp_ticketlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/ticketlock.h   | 12 --
 .../include/odp/plat/ticketlock_types.h| 43 ++
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 3 files changed, 45 insertions(+), 12 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

diff --git a/include/odp/api/ticketlock.h b/include/odp/api/ticketlock.h
index e088e8b..40ac00f 100644
--- a/include/odp/api/ticketlock.h
+++ b/include/odp/api/ticketlock.h
@@ -18,10 +18,6 @@
 extern "C" {
 #endif
 
-
-#include 
-#include 
-
 /** @addtogroup odp_synchronizers
  * Operations on ticket locks.
  * Acquiring a ticket lock happens in two phases. First the threads takes a
@@ -31,14 +27,6 @@ extern "C" {
  *  @{
  */
 
-/**
- * ODP ticket lock
- */
-typedef struct odp_ticketlock_t {
-   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
-   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
-} odp_ticketlock_t;
-
 
 /**
  * Initialize ticket lock.
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h 
b/platform/linux-generic/include/odp/plat/ticketlock_types.h
new file mode 100644
index 000..3cb76cb
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP ticketlock
+ */
+
+#ifndef ODP_TICKETLOCK_TYPES_H_
+#define ODP_TICKETLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP ticket lock
+ */
+typedef struct odp_ticketlock_t {
+   odp_atomic_u32_t  next_ticket; /**< @private Next ticket */
+   odp_atomic_u32_t  cur_ticket;  /**< @private Current ticket */
+} odp_ticketlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/ticketlock.h 
b/platform/linux-generic/include/odp/ticketlock.h
index fc7f438..658e27f 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  Operations on ticket locks.
  *  @{
-- 
2.1.0


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


[lng-odp] [RFC 4/4] barrier: allow platform to override odp_barrier_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/barrier.h  |  9 -
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 44 ++
 3 files changed, 45 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h

diff --git a/include/odp/api/barrier.h b/include/odp/api/barrier.h
index 35f0981..0e79e02 100644
--- a/include/odp/api/barrier.h
+++ b/include/odp/api/barrier.h
@@ -18,20 +18,11 @@
 extern "C" {
 #endif
 
-
 /** @addtogroup odp_synchronizers
  *  Synchronize threads.
  *  @{
  */
 
-/**
- * ODP thread synchronization barrier
- */
-typedef struct odp_barrier_t {
-   uint32_t count;  /**< @private Thread count */
-   odp_atomic_u32_t bar;/**< @private Barrier counter */
-} odp_barrier_t;
-
 
 /**
  * Initialize barrier with thread count.
diff --git a/platform/linux-generic/include/odp/barrier.h 
b/platform/linux-generic/include/odp/barrier.h
index d63c219..7ea5a6b 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -19,6 +19,7 @@ extern "C" {
 
 #include 
 #include 
+#include 
 
 /** @ingroup odp_synchronizers
  *  @{
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h 
b/platform/linux-generic/include/odp/plat/barrier_types.h
new file mode 100644
index 000..614b9b1
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP barrier
+ */
+
+#ifndef ODP_BARRIER_TYPES_H_
+#define ODP_BARRIER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP thread synchronization barrier
+ */
+typedef struct odp_barrier_t {
+   uint32_t count;  /**< @private Thread count */
+   odp_atomic_u32_t bar;/**< @private Barrier counter */
+} odp_barrier_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.1.0


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


[lng-odp] [RFC 0/4] Move the definition of odp syncronizers abstract types to platform

2015-03-17 Thread Jerin Jacob
Move the definition of odp syncronizers abstract types to platform
from public headerfile.
This will allow platform define odp syncronizers abstract type.
Useful when native SDK has definition of the odp syncronizers and
ODP implementation decides to reuses them.

Jerin Jacob (4):
  spinlock: allow platform to override odp_spinlock_t
  rwlock: allow platform to override odp_rwlock_t
  ticketlock: allow platform to override odp_ticketlock_t
  barrier: allow platform to override odp_barrier_t

 include/odp/api/barrier.h  |  9 -
 include/odp/api/rwlock.h   | 12 --
 include/odp/api/spinlock.h | 10 -
 include/odp/api/ticketlock.h   | 12 --
 platform/linux-generic/include/odp/barrier.h   |  1 +
 .../linux-generic/include/odp/plat/barrier_types.h | 44 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 45 ++
 .../include/odp/plat/spinlock_types.h  | 42 
 .../include/odp/plat/ticketlock_types.h| 43 +
 platform/linux-generic/include/odp/rwlock.h|  2 +
 platform/linux-generic/include/odp/spinlock.h  |  2 +
 platform/linux-generic/include/odp/ticketlock.h|  2 +
 12 files changed, 181 insertions(+), 43 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/barrier_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h
 create mode 100644 platform/linux-generic/include/odp/plat/ticketlock_types.h

-- 
2.1.0


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


[lng-odp] [RFC 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/rwlock.h   | 12 --
 .../linux-generic/include/odp/plat/rwlock_types.h  | 45 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 3 files changed, 47 insertions(+), 12 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..233e471 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -28,16 +26,6 @@ extern "C" {
  *  @{
  */
 
-/**
- * The odp_rwlock_t type.
- */
-typedef struct {
-   odp_atomic_u32_t cnt; /**< @private lock count
-   0 lock not taken
-   -1 write lock taken
-   >0 read lock(s) taken */
-} odp_rwlock_t;
-
 
 /**
  * Initialize a reader/writer lock.
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..0adae5a
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * The odp_rwlock_t type.
+ */
+typedef struct {
+   odp_atomic_u32_t cnt; /**< @private lock count
+   0 lock not taken
+   -1 write lock taken
+   >0 read lock(s) taken */
+} odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


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


[lng-odp] [RFC 1/4] spinlock: allow platform to override odp_spinlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob 
---
 include/odp/api/spinlock.h | 10 --
 .../include/odp/plat/spinlock_types.h  | 42 ++
 platform/linux-generic/include/odp/spinlock.h  |  2 ++
 3 files changed, 44 insertions(+), 10 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/spinlock_types.h

diff --git a/include/odp/api/spinlock.h b/include/odp/api/spinlock.h
index 5cde123..9288034 100644
--- a/include/odp/api/spinlock.h
+++ b/include/odp/api/spinlock.h
@@ -18,21 +18,11 @@
 extern "C" {
 #endif
 
-
-#include 
-
 /** @addtogroup odp_synchronizers
  *  Operations on spin locks.
  *  @{
  */
 
-/**
- * ODP spinlock type
- */
-typedef struct odp_spinlock_t {
-   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
-} odp_spinlock_t;
-
 
 /**
  * Initialize spin lock.
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h 
b/platform/linux-generic/include/odp/plat/spinlock_types.h
new file mode 100644
index 000..edb752f
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP spinlock
+ */
+
+#ifndef ODP_SPINLOCK_TYPES_H_
+#define ODP_SPINLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+/**
+ * ODP spinlock type
+ */
+typedef struct odp_spinlock_t {
+   char lock;  /**< @private lock flag, should match odp_atomic_flag_t */
+} odp_spinlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h 
b/platform/linux-generic/include/odp/spinlock.h
index e02df49..7dbb1c4 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


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