[lng-odp] [API-NEXT PATCHv3 0/4] api: packet reference count support

2015-09-16 Thread Maxim Uvarov
v3:
In linux-generic implementation:
- ref counters bit uses to create reference packet handle;
- atomic ref counter used to keep owner of packet segments;

Maxim Uvarov (4):
  api: packet reference count support
  linux-generic: packet reference count support
  linix-generic: _odp_pri account 64 bits
  validation: packet: test packet reference count

 include/odp/api/config.h   |  5 ++
 include/odp/api/packet.h   |  9 +++
 .../linux-generic/include/odp/plat/strong_types.h  |  2 +-
 .../linux-generic/include/odp_buffer_internal.h|  8 ++-
 .../linux-generic/include/odp_packet_internal.h| 18 ++
 platform/linux-generic/odp_packet.c| 65 --
 test/validation/packet/packet.c| 36 
 test/validation/packet/packet.h|  1 +
 8 files changed, 137 insertions(+), 7 deletions(-)

-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv3 3/4] linix-generic: _odp_pri account 64 bits

2015-09-16 Thread Maxim Uvarov
_odp_pri returns uint64_t value but actually accounts only 32 bit.
In my case that lead to return the same value for printed packets
with additional handle bits.

Signed-off-by: Maxim Uvarov 
---
 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 a53d763..843e2d2 100644
--- a/platform/linux-generic/include/odp/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/plat/strong_types.h
@@ -25,7 +25,7 @@
 #endif
 
 /** Internal macro to get value of an ODP handle */
-#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
+#define _odp_typeval(handle) ((uint64_t)(uintptr_t)(handle))
 
 /** Internal macro to get printable value of an ODP handle */
 #define _odp_pri(handle) ((uint64_t)_odp_typeval(handle))
-- 
1.9.1

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


Re: [lng-odp] [PATCH v2 0/2] Fix ODP_SCHED_NO_WAIT case for odp_schedule_wait_time

2015-09-16 Thread Ivan Khoronzhuk

Maxim,

On 16.09.15 11:05, Maxim Uvarov wrote:

On 09/15/15 18:03, Ivan Khoronzhuk wrote:

ping


are you planning v3 with removed

CU_ASSERT(wait_time > 0) ?

Maxim.


Not here.
It will be removed along with ODP-190 implementation.




On 10.09.15 19:18, Ivan Khoronzhuk wrote:

These patches corrects ODP_SCHED_NO_WAIT corner case when scheduler time
has resolution more then 1ns.

Since v2:
- linux-generic: odp_schedule: fix odp_schdule_wait_time
 Correct commit message

- validation: schedule: don't check schedule time on 0
 Don't remove check on wait_time = odp_schedule_wait_time(1);

Ivan Khoronzhuk (2):
   linux-generic: odp_schedule: fix odp_schdule_wait_time
   validation: schedule: don't check schedule time on 0

  platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
  platform/linux-generic/odp_schedule.c| 3 ---
  test/validation/scheduler/scheduler.c| 2 --
  3 files changed, 2 insertions(+), 7 deletions(-)







--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix potential overflow for burst_gap

2015-09-16 Thread Ivan Khoronzhuk

Petri,

On 16.09.15 10:02, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 5:07 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix
potential overflow for burst_gap

Petri,

On 15.09.15 16:01, Ivan Khoronzhuk wrote:



On 15.09.15 15:54, Ivan Khoronzhuk wrote:



On 15.09.15 15:45, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 3:08 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap



On 15.09.15 14:42, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On

Behalf Of

EXT Ivan Khoronzhuk
Sent: Friday, September 11, 2015 1:05 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap

The direct comparing of "cur_cycles" and "next_tx_cycles" is not
valid, as "next_tx_cycles" can be overflowed and comparison will
give wrong result. So use odp_time_diff_cycles() for that, as it
takes in account ticks overflow.

Signed-off-by: Ivan Khoronzhuk 
---
test/performance/odp_pktio_perf.c | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c
b/test/performance/odp_pktio_perf.c
index ac32b15..85ef2bc 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -303,7 +303,7 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-uint64_t next_tx_cycles, start_cycles, cur_cycles,

send_duration;

+uint64_t burst_start_cycles, start_cycles, cur_cycles,
send_duration;
uint64_t burst_gap_cycles;
uint32_t batch_len;
int unsent_pkts = 0;
@@ -334,11 +334,12 @@ static void *run_thread_tx(void *arg)

cur_cycles = odp_time_cycles();
start_cycles   = cur_cycles;
-next_tx_cycles = cur_cycles;
+burst_start_cycles = odp_time_diff_cycles(cur_cycles,
burst_gap_cycles);


Shouldn't this be:

burst_start_cycles = cur_cycles + burst_gap_cycles;

,which works as long as cycle count wraps at UINT64_MAX. Maybe we

need a cpu.h API for summing two values with correct wrapping.
It's initialization for burst gap, which is changing while
send_duration.
Current algorithm don't wait "burst gap" at first iteration, my
intention to not change it.
So I've used diff, in another case it waits one init gap.
In case of cur_cycles + burst_gap_cycles it waits 2 x burst_gap.

So

it's not correct.
I suppose here shouldn't be functional changes.
The cpu API doesn't have sum function and is not for this case, we

need

time here, that is
Time API is indented for. The new Time API is going to be added

after

this series and will
contain sum function which will replace "+" on odp_time_sum().

Current

API supposes that "+"
correctly handles UINT64_MAX wrap and doesn't contain sum

function.



For example:

burst_gap_cycles = 1k; // e.g. 1msec
cur_cycles = 1M;  // wraps at 10M

burst_start_cycles = odp_time_diff_cycles(cur_cycles,

burst_gap_cycles);



burst_start_cycles = 10M - 1M + 1k = 9 001 000



I've checked it some time ago and it was working, I remember I

corrected this, strange.

Seems I forgot it to swap.



Let me check it again.
And maybe I will revise loop a little.
I dislike this diff at init also.


Yes, I forgot to swap  burst_gap_cycles and cur_cycles.
so odp_time_diff_cycles(cur_cycles, burst_gap_cycles) ->
odp_time_diff_cycles(burst_gap_cycles, cur_cycles);
Are you OK with this? I will update it after some review of other
patches from this series.

Seems, it's simplest way to not wait at first iteration and not use
additional vars
or comparison with start time.



I think it works correctly only when cur_cycles > burst_gap_cycles (which is 
likely but there's no guarantees).


In case of cur_cycles < burst_gap_cycles it should work.

burst_start_cycles = MAX - gap + cur.

For instance:
gap = 100;
cur = 5;

burst_start_cycles = MAX - 100 + 5 = MAX - 95;
After MAX it wraps to 0 + 5, so 95 + 5 = 100; That's correct.
No matter we diff range or counter from cur_time,
it will be correct, second argument cannot wrap.

So, if you are OK, we can leave it as simplest fix.



-Petri




















while (odp_time_diff_cycles(start_cycles, cur_cycles) <
send_duration) {
unsigned alloc_cnt = 0, tx_cnt;

-if (cur_cycles < next_tx_cycles) {
+if (odp_time_diff_cycles(burst_start_cycles,

cur_cycles)

+< burst_gap_cycles) {


This spins back 

Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix potential overflow for burst_gap

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
> Sent: Wednesday, September 16, 2015 11:19 AM
> To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix
> potential overflow for burst_gap
> 
> Petri,
> 
> On 16.09.15 10:02, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> >
> >> -Original Message-
> >> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
> >> Sent: Tuesday, September 15, 2015 5:07 PM
> >> To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
> >> Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:
> fix
> >> potential overflow for burst_gap
> >>
> >> Petri,
> >>
> >> On 15.09.15 16:01, Ivan Khoronzhuk wrote:
> >>>
> >>>
> >>> On 15.09.15 15:54, Ivan Khoronzhuk wrote:
> 
> 
>  On 15.09.15 15:45, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> >
> >> -Original Message-
> >> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
> >> Sent: Tuesday, September 15, 2015 3:08 PM
> >> To: Savolainen, Petri (Nokia - FI/Espoo); lng-
> o...@lists.linaro.org
> >> Subject: Re: [lng-odp] [PATCH v2 5/5] performance:
> odp_pktio_perf:
> >> fix
> >> potential overflow for burst_gap
> >>
> >>
> >>
> >> On 15.09.15 14:42, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >>>
> >>>
>  -Original Message-
>  From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On
> >> Behalf Of
>  EXT Ivan Khoronzhuk
>  Sent: Friday, September 11, 2015 1:05 PM
>  To: lng-odp@lists.linaro.org
>  Subject: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:
> >> fix
>  potential overflow for burst_gap
> 
>  The direct comparing of "cur_cycles" and "next_tx_cycles" is
> not
>  valid, as "next_tx_cycles" can be overflowed and comparison
> will
>  give wrong result. So use odp_time_diff_cycles() for that, as
> it
>  takes in account ticks overflow.
> 
>  Signed-off-by: Ivan Khoronzhuk 
>  ---
>  test/performance/odp_pktio_perf.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
>  diff --git a/test/performance/odp_pktio_perf.c
>  b/test/performance/odp_pktio_perf.c
>  index ac32b15..85ef2bc 100644
>  --- a/test/performance/odp_pktio_perf.c
>  +++ b/test/performance/odp_pktio_perf.c
>  @@ -303,7 +303,7 @@ static void *run_thread_tx(void *arg)
>  int thr_id;
>  odp_queue_t outq;
>  pkt_tx_stats_t *stats;
>  -uint64_t next_tx_cycles, start_cycles, cur_cycles,
> >> send_duration;
>  +uint64_t burst_start_cycles, start_cycles, cur_cycles,
>  send_duration;
>  uint64_t burst_gap_cycles;
>  uint32_t batch_len;
>  int unsent_pkts = 0;
>  @@ -334,11 +334,12 @@ static void *run_thread_tx(void *arg)
> 
>  cur_cycles = odp_time_cycles();
>  start_cycles   = cur_cycles;
>  -next_tx_cycles = cur_cycles;
>  +burst_start_cycles = odp_time_diff_cycles(cur_cycles,
>  burst_gap_cycles);
> >>>
> >>> Shouldn't this be:
> >>>
> >>> burst_start_cycles = cur_cycles + burst_gap_cycles;
> >>>
> >>> ,which works as long as cycle count wraps at UINT64_MAX. Maybe
> we
> >> need a cpu.h API for summing two values with correct wrapping.
> >> It's initialization for burst gap, which is changing while
> >> send_duration.
> >> Current algorithm don't wait "burst gap" at first iteration, my
> >> intention to not change it.
> >> So I've used diff, in another case it waits one init gap.
> >> In case of cur_cycles + burst_gap_cycles it waits 2 x burst_gap.
> >> So
> >> it's not correct.
> >> I suppose here shouldn't be functional changes.
> >> The cpu API doesn't have sum function and is not for this case,
> we
> >> need
> >> time here, that is
> >> Time API is indented for. The new Time API is going to be added
> >> after
> >> this series and will
> >> contain sum function which will replace "+" on odp_time_sum().
> >> Current
> >> API supposes that "+"
> >> correctly handles UINT64_MAX wrap and doesn't contain sum
> >> function.
> >
> >
> > For example:
> >
> > burst_gap_cycles = 1k; // e.g. 1msec
> > cur_cycles = 1M;  // wraps at 10M
> >
> > burst_start_cycles = odp_time_diff_cycles(cur_cycles,
> >> burst_gap_cycles);
> >
> >
> > burst_start_cycles = 10M - 1M + 1k = 9 001 000
> >
> 
>  I've checked it some time ago and it was working, I remember I
> >> corrected this, strange.
>  Seems I forgot it to swap.

[lng-odp] [PATCH 0/4] add ability to mark tests as inactive

2015-09-16 Thread Stuart Haslam
This series adds the ability to skip individual test cases either at
compile time or conditionally at run time. There's no functional change
since none of the existing tests use this facility.

There are a few checkpatch warnings about camel case due to the names
of CUnit structure elements, but with those ignored it's clean.

Stuart Haslam (4):
  validation: add ability to mark tests inactive
  validation: add odp_cunit_update() to modify registered tests
  doc: implementers-guide: update names of test module libraries
  doc: implementers-guide: update section on skipping tests

 doc/implementers-guide/implementers-guide.adoc |  62 +--
 test/validation/buffer/buffer.c|  27 +--
 test/validation/buffer/buffer.h|   6 +-
 test/validation/classification/classification.c|  11 +-
 test/validation/classification/classification.h|   8 +-
 .../classification/odp_classification_basic.c  |  20 +--
 .../classification/odp_classification_tests.c  |  16 +-
 .../classification/odp_classification_testsuites.h |   7 +-
 test/validation/common/odp_cunit_common.c  | 186 -
 test/validation/common/odp_cunit_common.h  |  50 +-
 test/validation/cpumask/cpumask.c  |  53 +++---
 test/validation/cpumask/cpumask.h  |   6 +-
 test/validation/crypto/crypto.c|  22 ++-
 test/validation/crypto/crypto.h|   6 +-
 test/validation/crypto/odp_crypto_test_inp.c   |  14 +-
 test/validation/crypto/odp_crypto_test_inp.h   |   4 +-
 test/validation/errno/errno.c  |  19 ++-
 test/validation/errno/errno.h  |   6 +-
 test/validation/init/init.c|  66 +---
 test/validation/init/init.h|  14 +-
 test/validation/packet/packet.c|  53 +++---
 test/validation/packet/packet.h|   6 +-
 test/validation/pktio/pktio.c  |  62 +++
 test/validation/pktio/pktio.h  |   6 +-
 test/validation/pool/pool.c|  23 ++-
 test/validation/pool/pool.h|   6 +-
 test/validation/queue/queue.c  |  20 ++-
 test/validation/queue/queue.h  |   6 +-
 test/validation/random/random.c|  19 ++-
 test/validation/random/random.h|   6 +-
 test/validation/scheduler/scheduler.c  |  79 +
 test/validation/scheduler/scheduler.h  |   6 +-
 test/validation/shmem/shmem.c  |  19 ++-
 test/validation/shmem/shmem.h  |   6 +-
 test/validation/synchronizers/synchronizers.c  |  88 +-
 test/validation/synchronizers/synchronizers.h  |  16 +-
 test/validation/system/system.c|  31 ++--
 test/validation/system/system.h|   6 +-
 test/validation/thread/thread.c|  55 +++---
 test/validation/thread/thread.h|   6 +-
 test/validation/time/time.c|  23 ++-
 test/validation/time/time.h|   6 +-
 test/validation/timer/timer.c  |  25 +--
 test/validation/timer/timer.h  |   6 +-
 44 files changed, 770 insertions(+), 412 deletions(-)

-- 
2.1.1

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


[lng-odp] [PATCH 3/4] doc: implementers-guide: update names of test module libraries

2015-09-16 Thread Stuart Haslam
The name of the libraries generated by the test modules were recently
changed from lib.la to libtest.la

Signed-off-by: Stuart Haslam 
---
 doc/implementers-guide/implementers-guide.adoc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/implementers-guide/implementers-guide.adoc 
b/doc/implementers-guide/implementers-guide.adoc
index 32dbfea..090d4e5 100644
--- a/doc/implementers-guide/implementers-guide.adoc
+++ b/doc/implementers-guide/implementers-guide.adoc
@@ -77,7 +77,7 @@ Examples of modules includes "classification" (API functions 
dealing with ingres
 The complete module list can be seen at: 
http://docs.opendataplane.org/linux-generic-doxygen-html/modules.html[ODP 
Modules] +
 Within the platform agnostic area, the tests are also grouped by modules, 
matching the ODP API modules: '/test/validation/' mainly contains a 
list of directories matching each module name (as defined by the doxygen 
"@defgroup" or "@ingroup" statement present in each API ".h" file).
 
-Within each of these directories, a library (called "lib.la") and its 
associated ".h" file (called ".h") defines all the test functions for 
this module as well as few other functions to initialize, terminate, and group 
the tests.
+Within each of these directories, a library (called "libtest.la") and 
its associated ".h" file (called ".h") defines all the test functions 
for this module as well as few other functions to initialize, terminate, and 
group the tests.
 An executable called "_main*", is also built. It is permissible to 
generate more than one executable to cover the functionality in the test 
library for the module.
 These executable(s) shall call all the tests for this module. +
 See <> for more details.
@@ -130,7 +130,7 @@ Module test and naming convention
*_init*
*_term*
 
-All the above symbols are part of the generated lib.la libraries. The 
generated main executable(s) (named _+++main[_*]+++, where the optional 
suffix is used to distinguish the executables belonging to the same module, if 
many) simply call(s) the related _main+++[_*]+++ from the library.
+All the above symbols are part of the generated libtest.la libraries. 
The generated main executable(s) (named _+++main[_*]+++, where the 
optional suffix is used to distinguish the executables belonging to the same 
module, if many) simply call(s) the related _main+++[_*]+++ from the 
library.
 
 Platform specific
 ~
@@ -234,7 +234,7 @@ Sometimes, it may be necessary to call platform specific 
system calls to check s
 
 Skipping tests during development
 ^
-During ODP development, it may be useful to skip some test. This can be 
achieved by creating a new test executable (still on the platform side), 
picking up the required tests from the platform agnostic lib.la.
+During ODP development, it may be useful to skip some test. This can be 
achieved by creating a new test executable (still on the platform side), 
picking up the required tests from the platform agnostic libtest.la.
 
 The top Makefile would then call only the platform specific executable, hence 
skipping the tests which have been omitted.
 
-- 
2.1.1

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


Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix potential overflow for burst_gap

2015-09-16 Thread Ivan Khoronzhuk



On 16.09.15 10:02, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 5:07 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix
potential overflow for burst_gap

Petri,

On 15.09.15 16:01, Ivan Khoronzhuk wrote:



On 15.09.15 15:54, Ivan Khoronzhuk wrote:



On 15.09.15 15:45, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 3:08 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap



On 15.09.15 14:42, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On

Behalf Of

EXT Ivan Khoronzhuk
Sent: Friday, September 11, 2015 1:05 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap

The direct comparing of "cur_cycles" and "next_tx_cycles" is not
valid, as "next_tx_cycles" can be overflowed and comparison will
give wrong result. So use odp_time_diff_cycles() for that, as it
takes in account ticks overflow.

Signed-off-by: Ivan Khoronzhuk 
---
test/performance/odp_pktio_perf.c | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c
b/test/performance/odp_pktio_perf.c
index ac32b15..85ef2bc 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -303,7 +303,7 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-uint64_t next_tx_cycles, start_cycles, cur_cycles,

send_duration;

+uint64_t burst_start_cycles, start_cycles, cur_cycles,
send_duration;
uint64_t burst_gap_cycles;
uint32_t batch_len;
int unsent_pkts = 0;
@@ -334,11 +334,12 @@ static void *run_thread_tx(void *arg)

cur_cycles = odp_time_cycles();
start_cycles   = cur_cycles;
-next_tx_cycles = cur_cycles;
+burst_start_cycles = odp_time_diff_cycles(cur_cycles,
burst_gap_cycles);


Shouldn't this be:

burst_start_cycles = cur_cycles + burst_gap_cycles;

,which works as long as cycle count wraps at UINT64_MAX. Maybe we

need a cpu.h API for summing two values with correct wrapping.
It's initialization for burst gap, which is changing while
send_duration.
Current algorithm don't wait "burst gap" at first iteration, my
intention to not change it.
So I've used diff, in another case it waits one init gap.
In case of cur_cycles + burst_gap_cycles it waits 2 x burst_gap.

So

it's not correct.
I suppose here shouldn't be functional changes.
The cpu API doesn't have sum function and is not for this case, we

need

time here, that is
Time API is indented for. The new Time API is going to be added

after

this series and will
contain sum function which will replace "+" on odp_time_sum().

Current

API supposes that "+"
correctly handles UINT64_MAX wrap and doesn't contain sum

function.



For example:

burst_gap_cycles = 1k; // e.g. 1msec
cur_cycles = 1M;  // wraps at 10M

burst_start_cycles = odp_time_diff_cycles(cur_cycles,

burst_gap_cycles);



burst_start_cycles = 10M - 1M + 1k = 9 001 000



I've checked it some time ago and it was working, I remember I

corrected this, strange.

Seems I forgot it to swap.



Let me check it again.
And maybe I will revise loop a little.
I dislike this diff at init also.


Yes, I forgot to swap  burst_gap_cycles and cur_cycles.
so odp_time_diff_cycles(cur_cycles, burst_gap_cycles) ->
odp_time_diff_cycles(burst_gap_cycles, cur_cycles);
Are you OK with this? I will update it after some review of other
patches from this series.

Seems, it's simplest way to not wait at first iteration and not use
additional vars
or comparison with start time.



I think it works correctly only when cur_cycles > burst_gap_cycles (which is 
likely but there's no guarantees).
Would it be more robust to init burst_start_cycles = cur_cycles, and thus wait 
also in the first iteration.
Maybe iteration counting needs updating then, but the time calculation would be 
more robust.


It's not very good to miss first iteration.
It's supposed that during burst period we send some number of packets.
In case of first dummy gap it will simply wait, w/o sending.
The results of test can be used for comparison with some previous results
and can create additional questions. We shouldn't add even such small diff (or 
not small in some cases?)

What about to init to init burst_start_cycles = cur_cycles
and add some start = 1;

if (odp_time_diff(burst_start_time, cur_time) < burst_gap && start != 1) {
}

start = 0;


[lng-odp] [API-NEXT PATCHv3 1/4] api: packet reference count support

2015-09-16 Thread Maxim Uvarov
Add api for packet reference count support. Which is useful in case:
 - multicast support
 - TCP retransmission
 - traffic generator

Introduced new call: newpkt = odp_packet_create_ref(pkt) which creates
reference to original packet, but handles for reference packet and original
are different.

Signed-off-by: Maxim Uvarov 
---
 include/odp/api/config.h | 5 +
 include/odp/api/packet.h | 9 +
 2 files changed, 14 insertions(+)

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 302eaf5..2441f72 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -126,6 +126,11 @@ extern "C" {
  */
 #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
+/**
+ * Maximum packet references.
+ */
+#define ODP_CONFIG_PACKET_REFS 2
+
 /** Maximum number of shared memory blocks.
  *
  * This the the number of separate SHM areas that can be reserved concurrently
diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 5d46b7b..f9745fb 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -125,6 +125,15 @@ odp_packet_t odp_packet_from_event(odp_event_t ev);
  */
 odp_event_t odp_packet_to_event(odp_packet_t pkt);
 
+/**
+ * Create reference for packet handle
+ *
+ * @param pkt  Packet handle
+ *
+ * @return New packet handle
+ */
+odp_packet_t odp_packet_create_ref(odp_packet_t pkt);
+
 /*
  *
  * Pointers and lengths
-- 
1.9.1

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


Re: [lng-odp] [PATCH] validation: synchronizers: support a single worker

2015-09-16 Thread Maxim Uvarov

Merged,
Maxim.

On 09/12/15 03:18, Bill Fischofer wrote:



On Thu, Sep 10, 2015 at 3:33 AM, Nicolas Morey-Chaisemartin 
> wrote:


Ping?

On 08/26/2015 04:06 PM, Nicolas Morey-Chaisemartin wrote:
> no_barrier and no_lock tests are expected to fail but when
>  running a single worker, they do work
>
> Signed-off-by: Nicolas Morey-Chaisemartin >


Reviewed-by: Bill Fischofer >


> ---
>  test/validation/synchronizers/synchronizers.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/test/validation/synchronizers/synchronizers.c
b/test/validation/synchronizers/synchronizers.c
> index 0a31a40..6cb3699 100644
> --- a/test/validation/synchronizers/synchronizers.c
> +++ b/test/validation/synchronizers/synchronizers.c
> @@ -253,9 +253,10 @@ static void
*no_barrier_functional_test(void *arg UNUSED)
>   * Note that the following CU_ASSERT MAY appear incorrect,
but for the
>   * no_barrier test it should see barrier_errs or else there
is something
>   * wrong with the test methodology or the ODP thread
implementation.
> - * So this test PASSES only if it sees barrier_errs!
> + * So this test PASSES only if it sees barrier_errs or a single
> + * worker was used.
>   */
> - CU_ASSERT(barrier_errs != 0);
> + CU_ASSERT(barrier_errs != 0 || global_mem->g_num_threads
== 1);
>   thread_finalize(per_thread_mem);
>
>   return NULL;
> @@ -447,9 +448,10 @@ static void *no_lock_functional_test(void
*arg UNUSED)
>   /* Note that the following CU_ASSERT MAY appear incorrect,
but for the
>   * no_lock test it should see sync_failures or else there
is something
>   * wrong with the test methodology or the ODP thread
implementation.
> - * So this test PASSES only if it sees sync_failures
> + * So this test PASSES only if it sees sync_failures or a
single
> + * worker was used.
>   */
> - CU_ASSERT(sync_failures != 0);
> + CU_ASSERT(sync_failures != 0 || global_mem->g_num_threads
== 1);
>
>   thread_finalize(per_thread_mem);
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org 
> https://lists.linaro.org/mailman/listinfo/lng-odp

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




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


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


Re: [lng-odp] [API NEXT PATCH v5 08/17] api: sysinfo: revise odp_cpu_hz() to return current frequency

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)
This patch does not change the API. It changes implementation and should be 
named 


linux-generic: sysinfo: revise odp_cpu_hz() to return current frequency


-Petri


> -Original Message-
> From: EXT hongbo.zh...@freescale.com
> [mailto:hongbo.zh...@freescale.com]
> Sent: Tuesday, September 15, 2015 4:56 PM
> To: lng-odp@lists.linaro.org
> Cc: mike.hol...@linaro.org; stuart.has...@arm.com; Savolainen, Petri
> (Nokia - FI/Espoo); petri.savolai...@linaro.org;
> ivan.khoronz...@linaro.org; Hongbo Zhang
> Subject: [API NEXT PATCH v5 08/17] api: sysinfo: revise odp_cpu_hz() to
> return current frequency
> 
> From: Hongbo Zhang 
> 
> The odp_cpu_hz_max() is added to returm maximum frequency of CPU,
> while the odp_cpu_hz(), as shown by its name, should return current
> frequency of CPU, this patch revise odp_cpu_hz() for this purpose.
> 
> Signed-off-by: Hongbo Zhang 
> ---
>  platform/linux-generic/odp_system_info.c | 56
> +++-
>  1 file changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-
> generic/odp_system_info.c
> index 8532fa0..ed61d36 100644
> --- a/platform/linux-generic/odp_system_info.c
> +++ b/platform/linux-generic/odp_system_info.c
> @@ -146,6 +146,42 @@ static int cpuinfo_x86(FILE *file,
> odp_system_info_t *sysinfo)
>   return 0;
>  }
> 
> +static uint64_t arch_cpu_hz_current(int id)
> +{
> + char str[1024];
> + FILE *file;
> + int cpu;
> + char *pos;
> + double mhz = 0.0;
> +
> + file = fopen("/proc/cpuinfo", "rt");
> +
> + /* find the correct processor instance */
> + while (fgets(str, sizeof(str), file) != NULL) {
> + pos = strstr(str, "processor");
> + if (pos) {
> + sscanf(pos, "processor : %d", );
> + if (cpu == id)
> + break;
> + }
> + }
> +
> + /* extract the cpu current speed */
> + while (fgets(str, sizeof(str), file) != NULL) {
> + pos = strstr(str, "cpu MHz");
> + if (pos) {
> + sscanf(pos, "cpu MHz : %lf", );
> + break;
> + }
> + }
> +
> + fclose(file);
> + if (mhz)
> + return (uint64_t)(mhz * 100.0);
> +
> + return -1;
> +}
> +
>  #elif defined __arm__ || defined __aarch64__
> 
>  static int cpuinfo_arm(FILE *file ODP_UNUSED,
> @@ -154,6 +190,11 @@ odp_system_info_t *sysinfo ODP_UNUSED)
>   return 0;
>  }
> 
> +static uint64_t arch_cpu_hz_current(int id)
> +{
> + return -1;
> +}
> +
>  #elif defined __OCTEON__
> 
>  static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
> @@ -195,6 +236,12 @@ static int cpuinfo_octeon(FILE *file,
> odp_system_info_t *sysinfo)
> 
>   return 0;
>  }
> +
> +static uint64_t arch_cpu_hz_current(int id)
> +{
> + return -1;
> +}
> +
>  #elif defined __powerpc__
>  static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
>  {
> @@ -236,6 +283,11 @@ static int cpuinfo_powerpc(FILE *file,
> odp_system_info_t *sysinfo)
>   return 0;
>  }
> 
> +static uint64_t arch_cpu_hz_current(int id)
> +{
> + return -1;
> +}
> +
>  #else
>   #error GCC target not found
>  #endif
> @@ -368,7 +420,9 @@ int odp_system_info_init(void)
>   */
>  uint64_t odp_cpu_hz(void)
>  {
> - return odp_global_data.system_info.cpu_hz[0];
> + int id = sched_getcpu();
> +
> + return arch_cpu_hz_current(id);
>  }
> 
>  uint64_t odp_cpu_hz_max(void)
> --
> 1.9.1

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


Re: [lng-odp] [API NEXT PATCH v5 03/17] api: sysinfo: move CPU model API to cpu.h

2015-09-16 Thread Hongbo Zhang
Ivan,
or did you mean another thing that, I changed api name in this patch,
but update all the calling functions in later separate patches, so
after applying this patch while the following patches are not applied,
there must be build error at this stage, but this has to happen for
convenience of patch review.


On 16 September 2015 at 17:48, Hongbo Zhang  wrote:
> Ivan,
> Which kind of built error?
> In fact, when validation codes are enabled, there was already an build
> error exist in the test/validation/crypto code, this error isn't
> introduced by my patches, if you compile validation without my
> patches, you'll see this error again. I didn't spend time to research
> why, just simply disable the crypto codes in Mikefile.
> Another error may be default compiling treat warnings as errors, so I
> use this command to config:
> ./configure  --enable-test-vald  CFLAGS="-O0 -g -Wno-error"
>
> Are these the errors you met?
>
>
> On 15 September 2015 at 22:30, Mike Holmes  wrote:
>>
>>
>> On 15 September 2015 at 10:18, Ivan Khoronzhuk 
>> wrote:
>>>
>>> Hi, Hongbo
>>>
>>> Can it be built after this change? Should it be build-able at least?
>>
>>
>> All series should be build-able - if the check-odp  apply-and-build script
>> does not pass it cannot be committed.
>>
>>>
>>>
>>>
>>> On 15.09.15 16:55, hongbo.zh...@freescale.com wrote:

 From: Hongbo Zhang 

 This patch moves odp_sys_cpu_model_str() to cpu.h, all the calling
 functions will be updated in later separate patch.

 Signed-off-by: Hongbo Zhang 
 ---
   include/odp/api/cpu.h| 9 +
   include/odp/api/system_info.h| 7 ---
   platform/linux-generic/odp_system_info.c | 2 +-
   3 files changed, 10 insertions(+), 8 deletions(-)

 diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
 index c389093..78c3ffc 100644
 --- a/include/odp/api/cpu.h
 +++ b/include/odp/api/cpu.h
 @@ -44,6 +44,15 @@ int odp_cpu_id(void);
   int odp_cpu_count(void);

   /**
 + * CPU model name of this CPU
 + *
 + * Returns the CPU model name of this CPU.
 + *
 + * @return Pointer to CPU model name string
 + */
 +const char *odp_cpu_model_str(void);
 +
 +/**
* @}
*/

 diff --git a/include/odp/api/system_info.h
 b/include/odp/api/system_info.h
 index e55ff6d..1cd883f 100644
 --- a/include/odp/api/system_info.h
 +++ b/include/odp/api/system_info.h
 @@ -45,13 +45,6 @@ uint64_t odp_sys_huge_page_size(void);
   uint64_t odp_sys_page_size(void);

   /**
 - * CPU model name
 - *
 - * @return Pointer to CPU model name string
 - */
 -const char *odp_sys_cpu_model_str(void);
 -
 -/**
* Cache line size in bytes
*
* @return CPU cache line size in bytes
 diff --git a/platform/linux-generic/odp_system_info.c
 b/platform/linux-generic/odp_system_info.c
 index 83226f8..ed6b515 100644
 --- a/platform/linux-generic/odp_system_info.c
 +++ b/platform/linux-generic/odp_system_info.c
 @@ -389,7 +389,7 @@ uint64_t odp_sys_page_size(void)
 return odp_global_data.system_info.page_size;
   }

 -const char *odp_sys_cpu_model_str(void)
 +const char *odp_cpu_model_str(void)
   {
 return odp_global_data.system_info.model_str[0];
   }

>>>
>>> --
>>> Regards,
>>> Ivan Khoronzhuk
>>
>>
>>
>>
>> --
>> Mike Holmes
>> Technical Manager - Linaro Networking Group
>> Linaro.org │ Open source software for ARM SoCs
>>
>>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv3 2/4] linux-generic: packet reference count support

2015-09-16 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 .../linux-generic/include/odp_buffer_internal.h|  8 ++-
 .../linux-generic/include/odp_packet_internal.h| 18 ++
 platform/linux-generic/odp_packet.c| 65 --
 3 files changed, 85 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 4cacca1..7ab53c6 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -65,7 +65,11 @@ _ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX %
 
 #define ODP_BUFFER_POOL_BITS   ODP_BITSIZE(ODP_CONFIG_POOLS)
 #define ODP_BUFFER_SEG_BITSODP_BITSIZE(ODP_BUFFER_MAX_SEG)
-#define ODP_BUFFER_INDEX_BITS  (32 - ODP_BUFFER_POOL_BITS - 
ODP_BUFFER_SEG_BITS)
+#define ODP_PACKET_REFS_BITS  ODP_BITSIZE(ODP_CONFIG_PACKET_REFS)
+
+#define ODP_BUFFER_INDEX_BITS  (32 - ODP_BUFFER_POOL_BITS - \
+ODP_BUFFER_SEG_BITS - \
+ODP_PACKET_REFS_BITS)
 #define ODP_BUFFER_PREFIX_BITS (ODP_BUFFER_POOL_BITS + ODP_BUFFER_INDEX_BITS)
 #define ODP_BUFFER_MAX_POOLS   (1 << ODP_BUFFER_POOL_BITS)
 #define ODP_BUFFER_MAX_BUFFERS (1 << ODP_BUFFER_INDEX_BITS)
@@ -79,6 +83,7 @@ typedef union odp_buffer_bits_t {
uint32_t u32;
struct {
 #if ODP_BYTE_ORDER == ODP_BIG_ENDIAN
+   uint32_t ref:ODP_PACKET_REFS_BITS;
uint32_t pool_id:ODP_BUFFER_POOL_BITS;
uint32_t index:ODP_BUFFER_INDEX_BITS;
uint32_t seg:ODP_BUFFER_SEG_BITS;
@@ -86,6 +91,7 @@ typedef union odp_buffer_bits_t {
uint32_t seg:ODP_BUFFER_SEG_BITS;
uint32_t index:ODP_BUFFER_INDEX_BITS;
uint32_t pool_id:ODP_BUFFER_POOL_BITS;
+   uint32_t ref:ODP_PACKET_REFS_BITS;
 #endif
};
 
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index ba2cd7e..2d6b58f 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -272,12 +272,30 @@ odp_packet_t _odp_packet_alloc(odp_pool_t pool_hdl);
 
 int _odp_packet_parse(odp_packet_hdr_t *pkt_hdr);
 
+void _odp_packet_init(odp_packet_t pkt);
+void _odp_packet_get(odp_packet_t pkt);
+uint32_t _odp_packet_put(odp_packet_t pkt);
+
 /* Convert a packet handle to a buffer handle */
 odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt);
 
 /* Convert a buffer handle to a packet handle */
 odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf);
 
+/*  Internal debug function to check if packet has references
+ *
+ * @param pkt  Packet handle
+ * @retval 0   Packet does not have references
+ * @retval 1   Packet has references
+*/
+static inline int _odp_packet_refcheck(odp_packet_t pkt)
+{
+   odp_buffer_t buf = _odp_packet_to_buffer(pkt);
+   odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
+
+   return odp_atomic_load_u32(>ref_count) - 1;
+}
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 209a6e6..f6c5509 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -28,28 +28,34 @@
 odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t len)
 {
pool_entry_t *pool = odp_pool_to_entry(pool_hdl);
+   odp_packet_t pkt = ODP_PACKET_INVALID;
 
if (pool->s.params.type != ODP_POOL_PACKET)
return ODP_PACKET_INVALID;
 
/* Handle special case for zero-length packets */
if (len == 0) {
-   odp_packet_t pkt =
+   pkt =
(odp_packet_t)buffer_alloc(pool_hdl,
   pool->s.params.buf.size);
-   if (pkt != ODP_PACKET_INVALID)
+   if (pkt != ODP_PACKET_INVALID) {
pull_tail(odp_packet_hdr(pkt),
  pool->s.params.buf.size);
-
+   _odp_packet_init(pkt);
+   }
return pkt;
}
 
-   return (odp_packet_t)buffer_alloc(pool_hdl, len);
+   pkt = (odp_packet_t)buffer_alloc(pool_hdl, len);
+   if (pkt != ODP_PACKET_INVALID)
+   _odp_packet_init(pkt);
+   return pkt;
 }
 
 void odp_packet_free(odp_packet_t pkt)
 {
-   odp_buffer_free((odp_buffer_t)pkt);
+   if (!_odp_packet_put(pkt))
+   odp_buffer_free((odp_buffer_t)pkt);
 }
 
 int odp_packet_reset(odp_packet_t pkt, uint32_t len)
@@ -85,6 +91,46 @@ odp_event_t odp_packet_to_event(odp_packet_t pkt)
return (odp_event_t)pkt;
 }
 
+void _odp_packet_init(odp_packet_t pkt)
+{
+   odp_buffer_t buf = _odp_packet_to_buffer(pkt);
+   odp_buffer_hdr_t 

Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix potential overflow for burst_gap

2015-09-16 Thread Ivan Khoronzhuk



On 16.09.15 10:52, Ivan Khoronzhuk wrote:



On 16.09.15 10:02, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 5:07 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix
potential overflow for burst_gap

Petri,

On 15.09.15 16:01, Ivan Khoronzhuk wrote:



On 15.09.15 15:54, Ivan Khoronzhuk wrote:



On 15.09.15 15:45, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Tuesday, September 15, 2015 3:08 PM
To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap



On 15.09.15 14:42, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On

Behalf Of

EXT Ivan Khoronzhuk
Sent: Friday, September 11, 2015 1:05 PM
To: lng-odp@lists.linaro.org
Subject: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:

fix

potential overflow for burst_gap

The direct comparing of "cur_cycles" and "next_tx_cycles" is not
valid, as "next_tx_cycles" can be overflowed and comparison will
give wrong result. So use odp_time_diff_cycles() for that, as it
takes in account ticks overflow.

Signed-off-by: Ivan Khoronzhuk 
---
test/performance/odp_pktio_perf.c | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c
b/test/performance/odp_pktio_perf.c
index ac32b15..85ef2bc 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -303,7 +303,7 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-uint64_t next_tx_cycles, start_cycles, cur_cycles,

send_duration;

+uint64_t burst_start_cycles, start_cycles, cur_cycles,
send_duration;
uint64_t burst_gap_cycles;
uint32_t batch_len;
int unsent_pkts = 0;
@@ -334,11 +334,12 @@ static void *run_thread_tx(void *arg)

cur_cycles = odp_time_cycles();
start_cycles   = cur_cycles;
-next_tx_cycles = cur_cycles;
+burst_start_cycles = odp_time_diff_cycles(cur_cycles,
burst_gap_cycles);


Shouldn't this be:

burst_start_cycles = cur_cycles + burst_gap_cycles;

,which works as long as cycle count wraps at UINT64_MAX. Maybe we

need a cpu.h API for summing two values with correct wrapping.
It's initialization for burst gap, which is changing while
send_duration.
Current algorithm don't wait "burst gap" at first iteration, my
intention to not change it.
So I've used diff, in another case it waits one init gap.
In case of cur_cycles + burst_gap_cycles it waits 2 x burst_gap.

So

it's not correct.
I suppose here shouldn't be functional changes.
The cpu API doesn't have sum function and is not for this case, we

need

time here, that is
Time API is indented for. The new Time API is going to be added

after

this series and will
contain sum function which will replace "+" on odp_time_sum().

Current

API supposes that "+"
correctly handles UINT64_MAX wrap and doesn't contain sum

function.



For example:

burst_gap_cycles = 1k; // e.g. 1msec
cur_cycles = 1M;  // wraps at 10M

burst_start_cycles = odp_time_diff_cycles(cur_cycles,

burst_gap_cycles);



burst_start_cycles = 10M - 1M + 1k = 9 001 000



I've checked it some time ago and it was working, I remember I

corrected this, strange.

Seems I forgot it to swap.



Let me check it again.
And maybe I will revise loop a little.
I dislike this diff at init also.


Yes, I forgot to swap  burst_gap_cycles and cur_cycles.
so odp_time_diff_cycles(cur_cycles, burst_gap_cycles) ->
odp_time_diff_cycles(burst_gap_cycles, cur_cycles);
Are you OK with this? I will update it after some review of other
patches from this series.

Seems, it's simplest way to not wait at first iteration and not use
additional vars
or comparison with start time.



I think it works correctly only when cur_cycles > burst_gap_cycles (which is 
likely but there's no guarantees).
Would it be more robust to init burst_start_cycles = cur_cycles, and thus wait 
also in the first iteration.
Maybe iteration counting needs updating then, but the time calculation would be 
more robust.


It's not very good to miss first iteration.
It's supposed that during burst period we send some number of packets.
In case of first dummy gap it will simply wait, w/o sending.
The results of test can be used for comparison with some previous results
and can create additional questions. We shouldn't add even such small diff (or 
not small in some cases?)

What about to init to init burst_start_cycles = cur_cycles
and add some start = 1;

if (odp_time_diff(burst_start_time, cur_time) 

[lng-odp] [API-NEXT PATCHv3 4/4] validation: packet: test packet reference count

2015-09-16 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 test/validation/packet/packet.c | 36 
 test/validation/packet/packet.h |  1 +
 2 files changed, 37 insertions(+)

diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index 0c749c3..94d03e0 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -778,6 +778,41 @@ void packet_test_offset(void)
CU_ASSERT_PTR_NOT_NULL(ptr);
 }
 
+void packet_test_ref(void)
+{
+   odp_packet_t pkt = test_packet;
+   odp_packet_t pkt_ref;
+   uint32_t pkt_len = odp_packet_len(pkt);
+   uint8_t *data_buf1;
+   uint8_t *data_buf2;
+
+   data_buf1 = malloc(pkt_len);
+   CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf1);
+   data_buf2 = malloc(pkt_len);
+   CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf2);
+
+   pkt_ref = odp_packet_create_ref(pkt);
+   /* Handles should be different */
+   CU_ASSERT(pkt != pkt_ref);
+   /* Debug print also should have refcount bits */
+   CU_ASSERT(odp_packet_to_u64(pkt) !=
+ odp_packet_to_u64(pkt_ref));
+
+   /* Check that packet data is the same for pkt and pkt_ref */
+   CU_ASSERT(!odp_packet_copydata_out(pkt, 0, pkt_len, data_buf1));
+   CU_ASSERT(!odp_packet_copydata_out(pkt_ref, 0, pkt_len, data_buf2));
+   CU_ASSERT(!memcmp(data_buf1, data_buf2, pkt_len));
+
+   odp_packet_free(pkt_ref);
+
+   /* Check original packet data after free reference. */
+   CU_ASSERT(!odp_packet_copydata_out(pkt, 0, pkt_len, data_buf2));
+   CU_ASSERT(!memcmp(data_buf1, data_buf2, pkt_len));
+
+   free(data_buf1);
+   free(data_buf2);
+}
+
 CU_TestInfo packet_suite[] = {
_CU_TEST_INFO(packet_test_alloc_free),
_CU_TEST_INFO(packet_test_alloc_segmented),
@@ -797,6 +832,7 @@ CU_TestInfo packet_suite[] = {
_CU_TEST_INFO(packet_test_copy),
_CU_TEST_INFO(packet_test_copydata),
_CU_TEST_INFO(packet_test_offset),
+   _CU_TEST_INFO(packet_test_ref),
CU_TEST_INFO_NULL,
 };
 
diff --git a/test/validation/packet/packet.h b/test/validation/packet/packet.h
index f8a16a8..d1feff8 100644
--- a/test/validation/packet/packet.h
+++ b/test/validation/packet/packet.h
@@ -28,6 +28,7 @@ void packet_test_add_rem_data(void);
 void packet_test_copy(void);
 void packet_test_copydata(void);
 void packet_test_offset(void);
+void packet_test_ref(void);
 
 /* test arrays: */
 extern CU_TestInfo packet_suite[];
-- 
1.9.1

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


Re: [lng-odp] [PATCH] checkpatch: allow comparison to NULL

2015-09-16 Thread Maxim Uvarov

Merged,
Maxim.

On 09/16/15 05:34, Bill Fischofer wrote:



On Tue, Sep 15, 2015 at 7:01 AM, Petri Savolainen 
> wrote:


Allow comparison to NULL since ODP API calls may return NULL
and test applications should be able to compare against that,
instead of forced to compare against 0 (!ptr).

Signed-off-by: Petri Savolainen >


Reviewed-by: Bill Fischofer >


---
 .checkpatch.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.checkpatch.conf b/.checkpatch.conf
index c9f2896..69af101 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -3,5 +3,6 @@
 --ignore=SPLIT_STRING
 --ignore=NEW_TYPEDEFS
 --ignore=DEPRECATED_VARIABLE
+--ignore=COMPARISON_TO_NULL
 --codespell
 --codespellfile=/usr/share/codespell/dictionary.txt
--
2.5.2

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




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


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


Re: [lng-odp] [PATCH v2 0/2] Fix ODP_SCHED_NO_WAIT case for odp_schedule_wait_time

2015-09-16 Thread Maxim Uvarov

On 09/16/15 11:07, Ivan Khoronzhuk wrote:

Maxim,

On 16.09.15 11:05, Maxim Uvarov wrote:

On 09/15/15 18:03, Ivan Khoronzhuk wrote:

ping


are you planning v3 with removed

CU_ASSERT(wait_time > 0) ?

Maxim.


Not here.
It will be removed along with ODP-190 implementation.


ok, will merge then.

Maxim.





On 10.09.15 19:18, Ivan Khoronzhuk wrote:
These patches corrects ODP_SCHED_NO_WAIT corner case when scheduler 
time

has resolution more then 1ns.

Since v2:
- linux-generic: odp_schedule: fix odp_schdule_wait_time
 Correct commit message

- validation: schedule: don't check schedule time on 0
 Don't remove check on wait_time = odp_schedule_wait_time(1);

Ivan Khoronzhuk (2):
   linux-generic: odp_schedule: fix odp_schdule_wait_time
   validation: schedule: don't check schedule time on 0

  platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
  platform/linux-generic/odp_schedule.c| 3 ---
  test/validation/scheduler/scheduler.c| 2 --
  3 files changed, 2 insertions(+), 7 deletions(-)









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


Re: [lng-odp] [API NEXT PATCH v5 00/17] api: sysinfo: CPU frequency API clean up

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)
Hi,


As Ivan pointed out, build must not be broken on any patch. It's good practice 
to do one API change per patch, but when renaming an API function also the code 
using that function must be updated in the same patch. So, patches 3 and 14, 
... should be combined, as well as 4 and 15, 
 
Patch naming:
* patch 8 does not include an API change: api: ... -> linux-generic: ...
* patches 5, 6, 7 and 9 add new APIs to cpu.h. Those should be named "api: cpu: 
...", instead of "api: sysinfo"


API spec is OK. Just need to revise the split into patches and patch naming.


-Petri



> -Original Message-
> From: EXT hongbo.zh...@freescale.com
> [mailto:hongbo.zh...@freescale.com]
> Sent: Tuesday, September 15, 2015 4:55 PM
> To: lng-odp@lists.linaro.org
> Cc: mike.hol...@linaro.org; stuart.has...@arm.com; Savolainen, Petri
> (Nokia - FI/Espoo); petri.savolai...@linaro.org;
> ivan.khoronz...@linaro.org; Hongbo Zhang
> Subject: [API NEXT PATCH v5 00/17] api: sysinfo: CPU frequency API
> clean up
> 
> From: Hongbo Zhang 
> 
> v4 -> v5 changes:
> - most obvious change is split some patches into even smaller patches
> and re-arange the sequency for convenience of review
> - change odp_cpu_id_*() to odp_cpu_*_id()
> 
> v3 -> v4 changes:
> - rebase to latest odp version
> - add odp_cpumask_available() to iterate each cpu
> 
> v2 -> v3 changes:
> - move all CPU related API declaration into cpu.h
> - refine tests for per-CPU APIs
> - revise API for getting current frequency
> 
> v1 -> v2 changes:
> - separate original 1/3 patch to two
> - add validation patch to test new APIs
> - other minor updates upon review comments
> 
> v1 notes:
> The current API of getting CPU frequency is really ambiguous.
> CPU has its max frequency, and if enabled, the current frequency may be
> scaled from time to time, what's more, on some AMP platforms, cores are
> heterogenous, they have different max and current frequencies.
> 
> This patch set cleans up these above issues.
> Patch 1/3 makes cpu_hz and model_str to be per-CPU data, then on AMP
> system, it is possible to acquire data for each different CPU.
> Patch 2/3 makes it clear that the cpu_hz stands for max CPU frequency
> Patch 3/3 adds new API to get the current CPU frequency if needed.
> 
> Due to lack of test platform, only x86 platform is implemented right
> now,
> the others should follow up if this patch set is accepted.
> 
> Hongbo Zhang (17):
>   linux-generic: sysinfo: make the model_str per-CPU data
>   linux-generic: sysinfo: make the cpu_hz per-CPU data
>   api: sysinfo: move CPU model API to cpu.h
>   api: sysinfo: move CPU Hz API to cpu.h
>   api: sysinfo: add new API to get per-CPU model string
>   api: sysinfo: add new API to get CPU max frequency
>   api: sysinfo: add new API to get per-CPU max frequency
>   api: sysinfo: revise odp_cpu_hz() to return current frequency
>   api: sysinfo: add new API to get per-CPU current frequency
>   api: cpumask: add API odp_cpumask_all_available()
>   validation: system: update legacy CPU API names
>   validation: system: add validation for new CPU APIs
>   example: update CPU model string calling functions
>   test: update CPU model string calling functions
>   example: update CPU Hz calling functions
>   test: update CPU Hz calling functions
>   linux-generic: update CPU Hz calling functions
> 
>  example/classifier/odp_classifier.c|   4 +-
>  example/generator/odp_generator.c  |   2 +-
>  example/ipsec/odp_ipsec.c  |   2 +-
>  example/packet/odp_pktio.c |   2 +-
>  example/timer/odp_timer_test.c |   6 +-
>  include/odp/api/cpu.h  |  60 +
>  include/odp/api/cpumask.h  |  10 ++
>  include/odp/api/system_info.h  |  14 ---
>  .../linux-generic/arch/linux/odp_time_cycles.c |   3 +-
>  platform/linux-generic/include/odp_internal.h  |   6 +-
>  platform/linux-generic/odp_cpumask_task.c  |  11 ++
>  platform/linux-generic/odp_system_info.c   | 136
> -
>  platform/linux-generic/odp_time.c  |   5 +-
>  test/api_test/odp_common.c |   4 +-
>  test/performance/odp_atomic.c  |   4 +-
>  test/performance/odp_l2fwd.c   |   2 +-
>  test/performance/odp_scheduling.c  |   4 +-
>  test/validation/system/system.c|  74 ++-
>  test/validation/system/system.h|   8 +-
>  19 files changed, 283 insertions(+), 74 deletions(-)
> 
> --
> 1.9.1

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


Re: [lng-odp] [API NEXT PATCH v5 03/17] api: sysinfo: move CPU model API to cpu.h

2015-09-16 Thread Hongbo Zhang
Ivan,
Which kind of built error?
In fact, when validation codes are enabled, there was already an build
error exist in the test/validation/crypto code, this error isn't
introduced by my patches, if you compile validation without my
patches, you'll see this error again. I didn't spend time to research
why, just simply disable the crypto codes in Mikefile.
Another error may be default compiling treat warnings as errors, so I
use this command to config:
./configure  --enable-test-vald  CFLAGS="-O0 -g -Wno-error"

Are these the errors you met?


On 15 September 2015 at 22:30, Mike Holmes  wrote:
>
>
> On 15 September 2015 at 10:18, Ivan Khoronzhuk 
> wrote:
>>
>> Hi, Hongbo
>>
>> Can it be built after this change? Should it be build-able at least?
>
>
> All series should be build-able - if the check-odp  apply-and-build script
> does not pass it cannot be committed.
>
>>
>>
>>
>> On 15.09.15 16:55, hongbo.zh...@freescale.com wrote:
>>>
>>> From: Hongbo Zhang 
>>>
>>> This patch moves odp_sys_cpu_model_str() to cpu.h, all the calling
>>> functions will be updated in later separate patch.
>>>
>>> Signed-off-by: Hongbo Zhang 
>>> ---
>>>   include/odp/api/cpu.h| 9 +
>>>   include/odp/api/system_info.h| 7 ---
>>>   platform/linux-generic/odp_system_info.c | 2 +-
>>>   3 files changed, 10 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
>>> index c389093..78c3ffc 100644
>>> --- a/include/odp/api/cpu.h
>>> +++ b/include/odp/api/cpu.h
>>> @@ -44,6 +44,15 @@ int odp_cpu_id(void);
>>>   int odp_cpu_count(void);
>>>
>>>   /**
>>> + * CPU model name of this CPU
>>> + *
>>> + * Returns the CPU model name of this CPU.
>>> + *
>>> + * @return Pointer to CPU model name string
>>> + */
>>> +const char *odp_cpu_model_str(void);
>>> +
>>> +/**
>>>* @}
>>>*/
>>>
>>> diff --git a/include/odp/api/system_info.h
>>> b/include/odp/api/system_info.h
>>> index e55ff6d..1cd883f 100644
>>> --- a/include/odp/api/system_info.h
>>> +++ b/include/odp/api/system_info.h
>>> @@ -45,13 +45,6 @@ uint64_t odp_sys_huge_page_size(void);
>>>   uint64_t odp_sys_page_size(void);
>>>
>>>   /**
>>> - * CPU model name
>>> - *
>>> - * @return Pointer to CPU model name string
>>> - */
>>> -const char *odp_sys_cpu_model_str(void);
>>> -
>>> -/**
>>>* Cache line size in bytes
>>>*
>>>* @return CPU cache line size in bytes
>>> diff --git a/platform/linux-generic/odp_system_info.c
>>> b/platform/linux-generic/odp_system_info.c
>>> index 83226f8..ed6b515 100644
>>> --- a/platform/linux-generic/odp_system_info.c
>>> +++ b/platform/linux-generic/odp_system_info.c
>>> @@ -389,7 +389,7 @@ uint64_t odp_sys_page_size(void)
>>> return odp_global_data.system_info.page_size;
>>>   }
>>>
>>> -const char *odp_sys_cpu_model_str(void)
>>> +const char *odp_cpu_model_str(void)
>>>   {
>>> return odp_global_data.system_info.model_str[0];
>>>   }
>>>
>>
>> --
>> Regards,
>> Ivan Khoronzhuk
>
>
>
>
> --
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org │ Open source software for ARM SoCs
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix potential overflow for burst_gap

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
> Sent: Tuesday, September 15, 2015 5:07 PM
> To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf: fix
> potential overflow for burst_gap
> 
> Petri,
> 
> On 15.09.15 16:01, Ivan Khoronzhuk wrote:
> >
> >
> > On 15.09.15 15:54, Ivan Khoronzhuk wrote:
> >>
> >>
> >> On 15.09.15 15:45, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >>>
> >>>
>  -Original Message-
>  From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
>  Sent: Tuesday, September 15, 2015 3:08 PM
>  To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
>  Subject: Re: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:
> fix
>  potential overflow for burst_gap
> 
> 
> 
>  On 15.09.15 14:42, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> >
> >> -Original Message-
> >> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On
> Behalf Of
> >> EXT Ivan Khoronzhuk
> >> Sent: Friday, September 11, 2015 1:05 PM
> >> To: lng-odp@lists.linaro.org
> >> Subject: [lng-odp] [PATCH v2 5/5] performance: odp_pktio_perf:
> fix
> >> potential overflow for burst_gap
> >>
> >> The direct comparing of "cur_cycles" and "next_tx_cycles" is not
> >> valid, as "next_tx_cycles" can be overflowed and comparison will
> >> give wrong result. So use odp_time_diff_cycles() for that, as it
> >> takes in account ticks overflow.
> >>
> >> Signed-off-by: Ivan Khoronzhuk 
> >> ---
> >>test/performance/odp_pktio_perf.c | 9 +
> >>1 file changed, 5 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/test/performance/odp_pktio_perf.c
> >> b/test/performance/odp_pktio_perf.c
> >> index ac32b15..85ef2bc 100644
> >> --- a/test/performance/odp_pktio_perf.c
> >> +++ b/test/performance/odp_pktio_perf.c
> >> @@ -303,7 +303,7 @@ static void *run_thread_tx(void *arg)
> >>int thr_id;
> >>odp_queue_t outq;
> >>pkt_tx_stats_t *stats;
> >> -uint64_t next_tx_cycles, start_cycles, cur_cycles,
> send_duration;
> >> +uint64_t burst_start_cycles, start_cycles, cur_cycles,
> >> send_duration;
> >>uint64_t burst_gap_cycles;
> >>uint32_t batch_len;
> >>int unsent_pkts = 0;
> >> @@ -334,11 +334,12 @@ static void *run_thread_tx(void *arg)
> >>
> >>cur_cycles = odp_time_cycles();
> >>start_cycles   = cur_cycles;
> >> -next_tx_cycles = cur_cycles;
> >> +burst_start_cycles = odp_time_diff_cycles(cur_cycles,
> >> burst_gap_cycles);
> >
> > Shouldn't this be:
> >
> > burst_start_cycles = cur_cycles + burst_gap_cycles;
> >
> > ,which works as long as cycle count wraps at UINT64_MAX. Maybe we
>  need a cpu.h API for summing two values with correct wrapping.
>  It's initialization for burst gap, which is changing while
>  send_duration.
>  Current algorithm don't wait "burst gap" at first iteration, my
>  intention to not change it.
>  So I've used diff, in another case it waits one init gap.
>  In case of cur_cycles + burst_gap_cycles it waits 2 x burst_gap.
> So
>  it's not correct.
>  I suppose here shouldn't be functional changes.
>  The cpu API doesn't have sum function and is not for this case, we
> need
>  time here, that is
>  Time API is indented for. The new Time API is going to be added
> after
>  this series and will
>  contain sum function which will replace "+" on odp_time_sum().
> Current
>  API supposes that "+"
>  correctly handles UINT64_MAX wrap and doesn't contain sum
> function.
> >>>
> >>>
> >>> For example:
> >>>
> >>> burst_gap_cycles = 1k; // e.g. 1msec
> >>> cur_cycles = 1M;  // wraps at 10M
> >>>
> >>> burst_start_cycles = odp_time_diff_cycles(cur_cycles,
> burst_gap_cycles);
> >>>
> >>>
> >>> burst_start_cycles = 10M - 1M + 1k = 9 001 000
> >>>
> >>
> >> I've checked it some time ago and it was working, I remember I
> corrected this, strange.
> >> Seems I forgot it to swap.
> >>
> >
> > Let me check it again.
> > And maybe I will revise loop a little.
> > I dislike this diff at init also.
> 
> Yes, I forgot to swap  burst_gap_cycles and cur_cycles.
> so odp_time_diff_cycles(cur_cycles, burst_gap_cycles) ->
> odp_time_diff_cycles(burst_gap_cycles, cur_cycles);
> Are you OK with this? I will update it after some review of other
> patches from this series.
> 
> Seems, it's simplest way to not wait at first iteration and not use
> additional vars
> or comparison with start time.


I think it works correctly only when cur_cycles > burst_gap_cycles (which is 
likely but there's no guarantees). Would it be more robust to init 
burst_start_cycles = 

[lng-odp] [PATCH 1/4] validation: add ability to mark tests inactive

2015-09-16 Thread Stuart Haslam
Add the ability for individual test cases to be marked as inactive,
either unconditionally or based on the result of a check function which
is called at test init time. Inactive tests are registered with CUnit
and are reported as inactive in test reports without being executed.

All uses of CU_TestInfo have been replaced with odp_testinfo_t in order
to carry the conditional function pointer in addition to the CU_TestInfo
struct, and some new macros added to make things a bit easier;

_CU_TEST_INFO() is renamed to ODP_TEST_INFO() but remains functionally
the same, these tests will be run unconditionally.

ODP_TEST_INFO_INACTIVE() can be used to define an inactive test case.
There's no good reason to do this in any of the modules under
test/validation/ but the intention is to allow this to be done on a
per-platform basis from within the platform//test/ tree.

ODP_TEST_INFO_CONDITIONAL() takes an additional parameter which is a
pointer to a function to call at test suite initialisation time to
determine whether that test should be marked as inactive.

Signed-off-by: Stuart Haslam 
---
 test/validation/buffer/buffer.c| 20 +++---
 test/validation/buffer/buffer.h|  6 +-
 test/validation/classification/classification.c|  4 +-
 test/validation/classification/classification.h|  8 +--
 .../classification/odp_classification_basic.c  | 20 +++---
 .../classification/odp_classification_tests.c  | 16 ++---
 .../classification/odp_classification_testsuites.h |  7 +-
 test/validation/common/odp_cunit_common.c  | 83 +-
 test/validation/common/odp_cunit_common.h  | 39 --
 test/validation/cpumask/cpumask.c  | 46 ++--
 test/validation/cpumask/cpumask.h  |  6 +-
 test/validation/crypto/crypto.c| 12 ++--
 test/validation/crypto/crypto.h|  6 +-
 test/validation/crypto/odp_crypto_test_inp.c   | 14 ++--
 test/validation/crypto/odp_crypto_test_inp.h   |  4 +-
 test/validation/errno/errno.c  | 12 ++--
 test/validation/errno/errno.h  |  6 +-
 test/validation/init/init.c| 37 +-
 test/validation/init/init.h| 14 ++--
 test/validation/packet/packet.c| 46 ++--
 test/validation/packet/packet.h|  6 +-
 test/validation/pktio/pktio.c  | 55 +++---
 test/validation/pktio/pktio.h  |  6 +-
 test/validation/pool/pool.c| 16 ++---
 test/validation/pool/pool.h|  6 +-
 test/validation/queue/queue.c  | 13 ++--
 test/validation/queue/queue.h  |  6 +-
 test/validation/random/random.c| 12 ++--
 test/validation/random/random.h|  6 +-
 test/validation/scheduler/scheduler.c  | 72 +--
 test/validation/scheduler/scheduler.h  |  6 +-
 test/validation/shmem/shmem.c  | 12 ++--
 test/validation/shmem/shmem.h  |  6 +-
 test/validation/synchronizers/synchronizers.c  | 78 ++--
 test/validation/synchronizers/synchronizers.h  | 16 ++---
 test/validation/system/system.c| 24 +++
 test/validation/system/system.h|  6 +-
 test/validation/thread/thread.c| 48 ++---
 test/validation/thread/thread.h|  6 +-
 test/validation/time/time.c| 16 ++---
 test/validation/time/time.h|  6 +-
 test/validation/timer/timer.c  | 18 ++---
 test/validation/timer/timer.h  |  6 +-
 43 files changed, 477 insertions(+), 375 deletions(-)

diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c
index c62938d..4600e59 100644
--- a/test/validation/buffer/buffer.c
+++ b/test/validation/buffer/buffer.c
@@ -139,20 +139,16 @@ void buffer_test_management_basic(void)
CU_ASSERT(odp_event_to_u64(ev) != odp_event_to_u64(ODP_EVENT_INVALID));
 }
 
-CU_TestInfo buffer_suite[] = {
-   _CU_TEST_INFO(buffer_test_pool_alloc),
-   _CU_TEST_INFO(buffer_test_pool_free),
-   _CU_TEST_INFO(buffer_test_management_basic),
-   CU_TEST_INFO_NULL,
+odp_testinfo_t buffer_suite[] = {
+   ODP_TEST_INFO(buffer_test_pool_alloc),
+   ODP_TEST_INFO(buffer_test_pool_free),
+   ODP_TEST_INFO(buffer_test_management_basic),
+   ODP_TEST_INFO_NULL,
 };
 
-CU_SuiteInfo buffer_suites[] = {
-   { .pName = "buffer tests",
-   .pTests = buffer_suite,
-   .pInitFunc = buffer_suite_init,
-   .pCleanupFunc = buffer_suite_term,
-   },
-   CU_SUITE_INFO_NULL,
+odp_suiteinfo_t buffer_suites[] = {
+   {"buffer 

Re: [lng-odp] [PATCH v2 0/2] Fix ODP_SCHED_NO_WAIT case for odp_schedule_wait_time

2015-09-16 Thread Maxim Uvarov

On 09/15/15 18:03, Ivan Khoronzhuk wrote:

ping


are you planning v3 with removed

CU_ASSERT(wait_time > 0) ?

Maxim.


On 10.09.15 19:18, Ivan Khoronzhuk wrote:

These patches corrects ODP_SCHED_NO_WAIT corner case when scheduler time
has resolution more then 1ns.

Since v2:
- linux-generic: odp_schedule: fix odp_schdule_wait_time
 Correct commit message

- validation: schedule: don't check schedule time on 0
 Don't remove check on wait_time = odp_schedule_wait_time(1);

Ivan Khoronzhuk (2):
   linux-generic: odp_schedule: fix odp_schdule_wait_time
   validation: schedule: don't check schedule time on 0

  platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
  platform/linux-generic/odp_schedule.c| 3 ---
  test/validation/scheduler/scheduler.c| 2 --
  3 files changed, 2 insertions(+), 7 deletions(-)





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


Re: [lng-odp] [PATCH] api: split documentation from definitions

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)

I'd do this in api-next branch to avoid conflicts between api-next and master. 
Api-next is currently modifying config.h. See another comment under, otherwise 
OK.


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> EXT Mike Holmes
> Sent: Tuesday, September 15, 2015 7:48 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] api: split documentation from definitions
> 
> Defines in config.h should be defined by the platform appropriately and
> then possibly be exposed by APIs.
> Start the clean up process by moving the API Doxygen documentation away
> from the per platform definition.
> 
> Signed-off-by: Mike Holmes 
> ---
>  include/odp/api/config.h| 30 ++---
> 
>  platform/linux-generic/include/odp/config.h | 17 +++-
>  2 files changed, 31 insertions(+), 16 deletions(-)
> 
> diff --git a/include/odp/api/config.h b/include/odp/api/config.h
> index 302eaf5..40789a1 100644
> --- a/include/odp/api/config.h
> +++ b/include/odp/api/config.h
> @@ -24,52 +24,53 @@ extern "C" {
>   */
> 
>  /**
> + * @def ODP_CONFIG_MAX_THREADS
>   * Maximum number of threads
>   */
> -#define ODP_CONFIG_MAX_THREADS  128
> 
>  /**
> + * @def ODP_CONFIG_POOLS
>   * Maximum number of pools
>   */
> -#define ODP_CONFIG_POOLS16
> 
>  /**
> + * @def ODP_CONFIG_QUEUES
>   * Maximum number of queues
>   */
> -#define ODP_CONFIG_QUEUES   1024
> 
>  /**
> + * @def ODP_CONFIG_SCHED_PRIOS
>   * Number of scheduling priorities
>   */
> -#define ODP_CONFIG_SCHED_PRIOS  8
> 
>  /**
> + * @def ODP_CONFIG_SCHED_GRPS
>   * Number of scheduling groups
>   */
> -#define ODP_CONFIG_SCHED_GRPS  16
> 
>  /**
> + * @def ODP_CONFIG_PKTIO_ENTRIES
>   * Maximum number of packet IO resources
>   */
> -#define ODP_CONFIG_PKTIO_ENTRIES 64
> 
>  /**
> + * @def ODP_CONFIG_BUFFER_ALIGN_MIN
>   * Minimum buffer alignment
>   *
>   * This defines the minimum supported buffer alignment. Requests for
> values
>   * below this will be rounded up to this value.
>   */
> -#define ODP_CONFIG_BUFFER_ALIGN_MIN 16
> 
>  /**
> + * @def ODP_CONFIG_BUFFER_ALIGN_MAX
>   * Maximum buffer alignment
>   *
>   * This defines the maximum supported buffer alignment. Requests for
> values
>   * above this will fail.
>   */
> -#define ODP_CONFIG_BUFFER_ALIGN_MAX (4*1024)
> 
>  /**
> + * @def ODP_CONFIG_PACKET_HEADROOM
>   * Default packet headroom
>   *
>   * This defines the minimum number of headroom bytes that newly
> created packets
> @@ -81,9 +82,9 @@ extern "C" {



>   * The default value (66) allows a 1500-byte packet to be received
> into a single
>   * segment with Ethernet offset alignment and room for some header
> expansion.



This chunk is linux-generic specific comment and should be now moved into 
linux-generic/config.h

-Petri

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


Re: [lng-odp] [PATCH v2 0/2] Fix ODP_SCHED_NO_WAIT case for odp_schedule_wait_time

2015-09-16 Thread Maxim Uvarov

Merged,

Thanks,
Maxim.

On 09/10/15 19:18, Ivan Khoronzhuk wrote:

These patches corrects ODP_SCHED_NO_WAIT corner case when scheduler time
has resolution more then 1ns.

Since v2:
- linux-generic: odp_schedule: fix odp_schdule_wait_time
 Correct commit message

- validation: schedule: don't check schedule time on 0
 Don't remove check on wait_time = odp_schedule_wait_time(1);

Ivan Khoronzhuk (2):
   linux-generic: odp_schedule: fix odp_schdule_wait_time
   validation: schedule: don't check schedule time on 0

  platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
  platform/linux-generic/odp_schedule.c| 3 ---
  test/validation/scheduler/scheduler.c| 2 --
  3 files changed, 2 insertions(+), 7 deletions(-)



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


[lng-odp] [PATCH 2/4] validation: add odp_cunit_update() to modify registered tests

2015-09-16 Thread Stuart Haslam
Add an odp_cunit_update() function to allow some attributes of previously
registered tests to be modified, such as whether it's active or not.

Previously, registering and running tests was done in a single step;

odp_cunit_run(testsuites);

But this is now split;

odp_cunit_register(testsuites);
odp_cunit_update(testsuites_updates);
odp_cunit_run();

The odp_cunit_update() is optional and none of the currently defined
tests use it, so there's no functional change in this patch.

Signed-off-by: Stuart Haslam 
---
 test/validation/buffer/buffer.c |   7 +-
 test/validation/classification/classification.c |   7 +-
 test/validation/common/odp_cunit_common.c   | 107 ++--
 test/validation/common/odp_cunit_common.h   |  11 ++-
 test/validation/cpumask/cpumask.c   |   7 +-
 test/validation/crypto/crypto.c |  10 ++-
 test/validation/errno/errno.c   |   7 +-
 test/validation/init/init.c |  29 ++-
 test/validation/packet/packet.c |   7 +-
 test/validation/pktio/pktio.c   |   7 +-
 test/validation/pool/pool.c |   7 +-
 test/validation/queue/queue.c   |   7 +-
 test/validation/random/random.c |   7 +-
 test/validation/scheduler/scheduler.c   |   7 +-
 test/validation/shmem/shmem.c   |   7 +-
 test/validation/synchronizers/synchronizers.c   |  10 ++-
 test/validation/system/system.c |   7 +-
 test/validation/thread/thread.c |   7 +-
 test/validation/time/time.c |   7 +-
 test/validation/timer/timer.c   |   7 +-
 20 files changed, 245 insertions(+), 27 deletions(-)

diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c
index 4600e59..257e95c 100644
--- a/test/validation/buffer/buffer.c
+++ b/test/validation/buffer/buffer.c
@@ -153,5 +153,10 @@ odp_suiteinfo_t buffer_suites[] = {
 
 int buffer_main(void)
 {
-   return odp_cunit_run(buffer_suites);
+   int ret = odp_cunit_register(buffer_suites);
+
+   if (ret == 0)
+   odp_cunit_run();
+
+   return ret;
 }
diff --git a/test/validation/classification/classification.c 
b/test/validation/classification/classification.c
index b868c61..fe9a827 100644
--- a/test/validation/classification/classification.c
+++ b/test/validation/classification/classification.c
@@ -23,5 +23,10 @@ odp_suiteinfo_t classification_suites[] = {
 
 int classification_main(void)
 {
-   return odp_cunit_run(classification_suites);
+   int ret = odp_cunit_register(classification_suites);
+
+   if (ret == 0)
+   ret = odp_cunit_run();
+
+   return ret;
 }
diff --git a/test/validation/common/odp_cunit_common.c 
b/test/validation/common/odp_cunit_common.c
index d63e87e..8b62370 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -164,16 +164,99 @@ static int cunit_register_suites(odp_suiteinfo_t 
testsuites[])
return 0;
 }
 
+static int cunit_update_test(odp_suiteinfo_t *sinfo,
+odp_testinfo_t *updated_tinfo)
+{
+   odp_testinfo_t *tinfo;
+
+   for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++)
+   if (strcmp(tinfo->testinfo.pName,
+  updated_tinfo->testinfo.pName) == 0)
+   break;
+
+   if (!tinfo || !tinfo->testinfo.pName)
+   return -1;
+
+   tinfo->check_active = updated_tinfo->check_active;
+
+   return 0;
+}
+
+static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo)
+{
+   CU_pSuite suite;
+   CU_pTest test;
+   odp_suiteinfo_t *sinfo;
+   odp_testinfo_t *tinfo;
+
+   /* find previously registered suite with matching name */
+   for (sinfo = global_testsuites; sinfo->pName; sinfo++)
+   if (strcmp(sinfo->pName, updated_sinfo->pName) == 0)
+   break;
+
+   if (!sinfo || !sinfo->pName) {
+   fprintf(stderr, "%s: unable to add new suite: %s\n",
+   __func__, updated_sinfo->pName);
+   return -1;
+   }
+
+   /* lookup the associated CUnit suite */
+   suite = CU_get_suite_by_name(sinfo->pName, CU_get_registry());
+   if (!suite) {
+   fprintf(stderr, "%s: can't find registered suite %s\n",
+   __func__, sinfo->pName);
+   return CU_get_error();
+   }
+
+   sinfo->pInitFunc = updated_sinfo->pInitFunc;
+   sinfo->pCleanupFunc = updated_sinfo->pCleanupFunc;
+
+   CU_set_suite_cleanupfunc(suite, updated_sinfo->pCleanupFunc);
+
+   for (tinfo = updated_sinfo->pTests; tinfo->testinfo.pName; tinfo++) {
+   test = CU_get_test(suite, tinfo->testinfo.pName);
+
+   if (test) {
+   CU_ErrorCode err = 

[lng-odp] [PATCH 4/4] doc: implementers-guide: update section on skipping tests

2015-09-16 Thread Stuart Haslam
Update sections describing how a specific platform may skip tests by
marking them as inactive.

Signed-off-by: Stuart Haslam 
---
 doc/implementers-guide/implementers-guide.adoc | 58 +-
 1 file changed, 48 insertions(+), 10 deletions(-)

diff --git a/doc/implementers-guide/implementers-guide.adoc 
b/doc/implementers-guide/implementers-guide.adoc
index 090d4e5..181d5c2 100644
--- a/doc/implementers-guide/implementers-guide.adoc
+++ b/doc/implementers-guide/implementers-guide.adoc
@@ -110,7 +110,7 @@ Module test and naming convention
*_test_+++*+++* +
where the suffix idendify the test.
 
-* Test arrays, i.e. arrays of CU_TestInfo, listing the test functions 
belonging to a suite, are called:
+* Test arrays, i.e. arrays of odp_testinfo_t, listing the test functions 
belonging to a suite, are called:
*_suite+++[_*]+++* +
where the possible suffix can be used if many suites are declared.
 
@@ -118,7 +118,7 @@ Module test and naming convention
*+++_suite[_*]_init()+++* and *+++_suite[_*]_term()+++* 
respectively. +
where the possible extra middle pattern can be used if many suites are 
declared.
 
-* Suite arrays, i.e. arrays of CU_SuiteInfo used in executables (C_UNIT 
registry) are called:
+* Suite arrays, i.e. arrays of odp_suiteinfo_t used in executables (C_UNIT 
registry) are called:
*+++_suites[_*]+++* +
where the possible suffix identifies the executable using it, if many.
 
@@ -232,14 +232,52 @@ Defining platform specific tests
 Sometimes, it may be necessary to call platform specific system calls to check 
some functionality: For instance, testing odp_cpumask_* could involve checking 
the underlying system CPU mask. On linux, such a test would require using the 
CPU_ISSET macro, which is linux specific. Such a test would be written in 
'/cpumask/...' The contents of this directory would be very 
similar to the contents of the platform agnostic side cpu_mask tests (including 
a Makefile.am...), but platform specific test would be written there.
 '/Makefile.am' would then trigger the building of the 
platform specific tests (by listing their module name in SUBDIRS and therefore 
calling the appropriate Makefile.am) and then it would call both the platform 
agnostic executable(s) and the platform specific test executable.
 
-Skipping tests during development
-^
-During ODP development, it may be useful to skip some test. This can be 
achieved by creating a new test executable (still on the platform side), 
picking up the required tests from the platform agnostic libtest.la.
+Marking tests as inactive
+^
+The general policy is that a full run of the validation suite (a "make check") 
must pass at all times. However a particular platform may have one or more test 
cases that are known to be unimplemented either during development or 
permanently, so to avoid these test cases being reported as failures it's 
useful to be able to skip them. This can be achieved by creating a new test 
executable (still on the platform side), giving the platform specific 
initialisation code the opportunity to modify the registered tests in order to 
mark unwanted tests as inactive while leaving the remaining tests active. It's 
important that the unwanted tests are still registered with the test framework 
to allow the fact that they're not being tested to be recorded.
+
+The odp_cunit_update() function is intended for this purpose, it is used to 
modify the properties of previously registered tests, for example to mark them 
as inactive. Inactive tests are registered with the test framework but aren't 
executed and will be recorded as inactive in test reports.
+
+In 'test/validation/foo/foo.c', define all tests for the 'foo' module;
+
+[source,c]
+--
+odp_testinfo_t foo_tests[] = {
+   ODP_TEST_INFO(foo_test_a),
+   ODP_TEST_INFO(foo_test_b),
+   ODP_TEST_INFO_NULL
+};
+
+odp_suiteinfo_t foo_suites[] = {
+   {"Foo", foo_suite_init, foo_suite_term, foo_tests},
+   ODP_SUITE_INFO_NULL
+};
+--
+
+In 'platform//test/foo/foo_main.c', register all the tests defined 
in the 'foo' module, then mark a single specific test case as inactive;
+
+[source,c]
+--
+static odp_testinfo_t foo_tests_updates[] = {
+   ODP_TEST_INFO_INACTIVE(foo_test_b),
+   ODP_TEST_INFO_NULL
+};
+
+static odp_suiteinfo_t foo_suites_updates[] = {
+   {"Foo", foo_suite_init, foo_suite_term, foo_tests_updates},
+   ODP_SUITE_INFO_NULL
+};
+
+int pktio_main(void)
+{
+   int ret = odp_cunit_register(foo_suites);
 
-The top Makefile would then call only the platform specific executable, hence 
skipping the tests which have been omitted.
+   if (ret == 0)
+   ret = odp_cuint_update(foo_suites_updates);
 
-TIP: You probably want to copy the platform-agnostic module main function and 
prune it from the undesired tests when writing 

[lng-odp] [PATCH] validation: pktio: don't call CU_FAIL() from init

2015-09-16 Thread Stuart Haslam
The CU_* macros can't be used from initialisation functions.

Signed-off-by: Stuart Haslam 
---
 test/validation/pktio/pktio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 5c0799b..1c034bd 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -790,7 +790,8 @@ static int create_pool(const char *iface, int num)
 
pool[num] = odp_pool_create(pool_name, );
if (ODP_POOL_INVALID == pool[num]) {
-   CU_FAIL("unable to create pool");
+   fprintf(stderr, "%s: unable to create pool: %d\n",
+   __func__, odp_errno());
return -1;
}
 
-- 
2.1.1

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


[lng-odp] [API-NEXT PATCHv3 5/5] api: schedule: revise definition of ordered locks

2015-09-16 Thread Bill Fischofer
Revise the definition of odp_schedule_order_lock() and
odp_schedule_order_unlock(). These APIs now take as an argument the
index value of the ordered lock within the current context to be locked
or unlocked. Because the API is changed, this patch also updates the
linux-generic implementation of these APIs as well as the scheduler
validation test that uses them.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/schedule.h | 44 ++-
 .../include/odp/plat/schedule_types.h  |  2 -
 .../linux-generic/include/odp_buffer_internal.h|  2 +-
 .../linux-generic/include/odp_queue_internal.h | 19 ---
 platform/linux-generic/odp_queue.c | 66 ++
 platform/linux-generic/odp_schedule.c  | 15 +++--
 test/validation/scheduler/scheduler.c  | 61 +++-
 7 files changed, 141 insertions(+), 68 deletions(-)

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index 11f85ad..55191f9 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -31,11 +31,6 @@ extern "C" {
  */
 
 /**
- * @typedef odp_schedule_order_lock_t
- * Scheduler ordered context lock
- */
-
-/**
  * @def ODP_SCHED_WAIT
  * Wait infinitely
  */
@@ -299,15 +294,31 @@ int odp_schedule_group_thrmask(odp_schedule_group_t group,
 /**
  * Acquire ordered context lock
  *
- * This call is valid only when holding an ordered synchronization context. The
- * lock is used to protect a critical section that is executed within an
- * ordered context. Threads enter the critical section in the order determined
- * by the context (source queue). Lock ordering is automatically skipped for
- * threads that release the context instead of calling the lock.
- *
- * @param lockOrdered context lock
+ * This call is valid only when holding an ordered synchronization context.
+ * Ordered locks are used to protect critical sections that are executed
+ * within an ordered context. Threads enter the critical section in the order
+ * determined by the context (source queue). Lock ordering is automatically
+ * skipped for threads that release the context instead of using the lock.
+ *
+ * The number of ordered locks available is set by the lock_count parameter of
+ * the schedule parameters passed to odp_queue_create(), which must be less
+ * than or equal to the ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE configuration
+ * option. If this routine is called outside of an ordered context or with a
+ * lock_index that exceeds the number of available ordered locks in this
+ * context results are undefined. The number of ordered locks associated with
+ * a given ordered queue may be queried by the odp_queue_lock_count() API.
+ *
+ * Each ordered lock may be used only once per ordered context. If events
+ * are to be processed with multiple ordered critical sections, each should
+ * be protected by its own ordered lock. This promotes maximum parallelism by
+ * allowing order to maintained on a more granular basis. If an ordered lock
+ * is used multiple times in the same ordered context results are undefined.
+ *
+ * @param lock_index Index of the ordered lock in the current context to be
+ *   acquired. Must be in the range 0..odp_queue_lock_count()
+ *   - 1
  */
-void odp_schedule_order_lock(odp_schedule_order_lock_t *lock);
+void odp_schedule_order_lock(unsigned lock_index);
 
 /**
  * Release ordered context lock
@@ -315,9 +326,12 @@ void odp_schedule_order_lock(odp_schedule_order_lock_t 
*lock);
  * This call is valid only when holding an ordered synchronization context.
  * Release a previously locked ordered context lock.
  *
- * @param lockOrdered context lock
+ * @param lock_index Index of the ordered lock in the current context to be
+ *   released. Results are undefined if the caller does not
+ *   hold this lock. Must be in the range
+ *   0..odp_queue_lock_count() - 1
  */
-void odp_schedule_order_unlock(odp_schedule_order_lock_t *lock);
+void odp_schedule_order_unlock(unsigned lock_index);
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h 
b/platform/linux-generic/include/odp/plat/schedule_types.h
index c48b652..2189cbb 100644
--- a/platform/linux-generic/include/odp/plat/schedule_types.h
+++ b/platform/linux-generic/include/odp/plat/schedule_types.h
@@ -51,8 +51,6 @@ typedef int odp_schedule_group_t;
 
 #define ODP_SCHED_GROUP_NAME_LEN 32
 
-typedef int odp_schedule_order_lock_t;
-
 /**
  * @}
  */
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 4cacca1..f063c4c 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -137,7 +137,7 @@ struct odp_buffer_hdr_t {
queue_entry_t   *origin_qe;  /* ordered queue 

Re: [lng-odp] [PATCH v2 3/5] linux-generic: odp_time: reutrn 0 if t2 = t1 instead of MAX for diff

2015-09-16 Thread Ivan Khoronzhuk

Petri,

What about this fix? It's similar to to CPU API.

On 11.09.15 13:04, Ivan Khoronzhuk wrote:

It's better to describe by example:

cur = 15;
start = 15;
diff = 2;
while (odp_time_cycles_diff(start, cur) < diff) {
cur = odp_time_cycles();
}

This example has to work. It's possible only when t2 - t1 = 0 if t2 = t1.
The validation test on it will be added later.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/odp_time.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index a08833d..a007d69 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -14,7 +14,7 @@

  uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
  {
-   if (odp_likely(t2 > t1))
+   if (odp_likely(t2 >= t1))
return t2 - t1;

return t2 + (UINT64_MAX - t1);



But I have additional proposition. Maybe I'm wrong, but
one cycle can be lost here (equal as in CPU api, I'm ready to fix it also)

For instance:

start = MAX - 2;
cur = 1

res = MAX - MAX + 2 + 1 = 3;
It's correct. But in real it will be:

(MAX - 2)
  -> 1 cycle
(MAX - 1)
  -> 2 cycle
MAX
  -> 3 cycle
0
  -> 4 cycle
1

The function returns 3 cycles difference,
but due to 0, physically, timer counts 4 cycles.

Not sure, but I should send +1 patch that corrects it to:

return t2 + (UINT64_MAX - t1) + 1;

due to counter in continuous mode is reset to 0, then continues counting.

Can we apply this on cycle counter? (then I need correct CPU API implementation 
also)
Is it reseted to zero or wraps to 1 for all arches?


--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count to odp_schedule_param_t

2015-09-16 Thread Bill Fischofer
The lock_count is used to specify the number of ordered locks to be
available for an ordered queue at odp_queue_create() time.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/schedule_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/odp/api/schedule_types.h b/include/odp/api/schedule_types.h
index f7526ee..96d9028 100644
--- a/include/odp/api/schedule_types.h
+++ b/include/odp/api/schedule_types.h
@@ -131,6 +131,8 @@ typedef struct odp_schedule_param_t {
odp_schedule_sync_t  sync;
/** Thread group */
odp_schedule_group_t group;
+   /** Lock group */
+   unsigned lock_count; /**< Ordered lock count for this queue */
 } odp_schedule_param_t;
 
 /**
-- 
2.1.4

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


Re: [lng-odp] [API NEXT PATCH v5 00/17] api: sysinfo: CPU frequency API clean up

2015-09-16 Thread Hongbo Zhang
On 16 September 2015 at 17:42, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
> Hi,
>
>
> As Ivan pointed out, build must not be broken on any patch. It's good 
> practice to do one API change per patch, but when renaming an API function 
> also the code using that function must be updated in the same patch. So, 
> patches 3 and 14, ... should be combined, as well as 4 and 15, 
>

Oops
In my previous v4 patch series, there was no such error, both
api-changing and calling-function-updating are in one long patch, but
Ivan mentioned it should be split, I misunderstood...

> Patch naming:
> * patch 8 does not include an API change: api: ... -> linux-generic: ...
> * patches 5, 6, 7 and 9 add new APIs to cpu.h. Those should be named "api: 
> cpu: ...", instead of "api: sysinfo"
>
>
> API spec is OK. Just need to revise the split into patches and patch naming.
>
>
> -Petri
>
>
>
>> -Original Message-
>> From: EXT hongbo.zh...@freescale.com
>> [mailto:hongbo.zh...@freescale.com]
>> Sent: Tuesday, September 15, 2015 4:55 PM
>> To: lng-odp@lists.linaro.org
>> Cc: mike.hol...@linaro.org; stuart.has...@arm.com; Savolainen, Petri
>> (Nokia - FI/Espoo); petri.savolai...@linaro.org;
>> ivan.khoronz...@linaro.org; Hongbo Zhang
>> Subject: [API NEXT PATCH v5 00/17] api: sysinfo: CPU frequency API
>> clean up
>>
>> From: Hongbo Zhang 
>>
>> v4 -> v5 changes:
>> - most obvious change is split some patches into even smaller patches
>> and re-arange the sequency for convenience of review
>> - change odp_cpu_id_*() to odp_cpu_*_id()
>>
>> v3 -> v4 changes:
>> - rebase to latest odp version
>> - add odp_cpumask_available() to iterate each cpu
>>
>> v2 -> v3 changes:
>> - move all CPU related API declaration into cpu.h
>> - refine tests for per-CPU APIs
>> - revise API for getting current frequency
>>
>> v1 -> v2 changes:
>> - separate original 1/3 patch to two
>> - add validation patch to test new APIs
>> - other minor updates upon review comments
>>
>> v1 notes:
>> The current API of getting CPU frequency is really ambiguous.
>> CPU has its max frequency, and if enabled, the current frequency may be
>> scaled from time to time, what's more, on some AMP platforms, cores are
>> heterogenous, they have different max and current frequencies.
>>
>> This patch set cleans up these above issues.
>> Patch 1/3 makes cpu_hz and model_str to be per-CPU data, then on AMP
>> system, it is possible to acquire data for each different CPU.
>> Patch 2/3 makes it clear that the cpu_hz stands for max CPU frequency
>> Patch 3/3 adds new API to get the current CPU frequency if needed.
>>
>> Due to lack of test platform, only x86 platform is implemented right
>> now,
>> the others should follow up if this patch set is accepted.
>>
>> Hongbo Zhang (17):
>>   linux-generic: sysinfo: make the model_str per-CPU data
>>   linux-generic: sysinfo: make the cpu_hz per-CPU data
>>   api: sysinfo: move CPU model API to cpu.h
>>   api: sysinfo: move CPU Hz API to cpu.h
>>   api: sysinfo: add new API to get per-CPU model string
>>   api: sysinfo: add new API to get CPU max frequency
>>   api: sysinfo: add new API to get per-CPU max frequency
>>   api: sysinfo: revise odp_cpu_hz() to return current frequency
>>   api: sysinfo: add new API to get per-CPU current frequency
>>   api: cpumask: add API odp_cpumask_all_available()
>>   validation: system: update legacy CPU API names
>>   validation: system: add validation for new CPU APIs
>>   example: update CPU model string calling functions
>>   test: update CPU model string calling functions
>>   example: update CPU Hz calling functions
>>   test: update CPU Hz calling functions
>>   linux-generic: update CPU Hz calling functions
>>
>>  example/classifier/odp_classifier.c|   4 +-
>>  example/generator/odp_generator.c  |   2 +-
>>  example/ipsec/odp_ipsec.c  |   2 +-
>>  example/packet/odp_pktio.c |   2 +-
>>  example/timer/odp_timer_test.c |   6 +-
>>  include/odp/api/cpu.h  |  60 +
>>  include/odp/api/cpumask.h  |  10 ++
>>  include/odp/api/system_info.h  |  14 ---
>>  .../linux-generic/arch/linux/odp_time_cycles.c |   3 +-
>>  platform/linux-generic/include/odp_internal.h  |   6 +-
>>  platform/linux-generic/odp_cpumask_task.c  |  11 ++
>>  platform/linux-generic/odp_system_info.c   | 136
>> -
>>  platform/linux-generic/odp_time.c  |   5 +-
>>  test/api_test/odp_common.c |   4 +-
>>  test/performance/odp_atomic.c  |   4 +-
>>  test/performance/odp_l2fwd.c   |   2 +-
>>  test/performance/odp_scheduling.c  |   4 +-
>>  test/validation/system/system.c|  74 ++-
>>  test/validation/system/system.h 

[lng-odp] [API-NEXT PATCHv3 0/5] Revised Ordered Lock APIs

2015-09-16 Thread Bill Fischofer
Changes in v3:
- Change types of lock_count and lock indices from uint32_t to unsigned

---
Changes in v2:
- Incorporate Petri review comments

---
Revise the ordered lock APIs per recent ARCH discussions. Ordered locks
are now specified via the new lock_count parameter within the
odp_schedule_param_t section of the odp_queue_param_t passed to
odp_queue_create(). As a result odp_schedule_order_lock_init() is
deprecated and removed. Implementations specify the maximum number
of ordered locks per queue they support via the new config.h entry
ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE. Implementations SHOULD support
at least one ordered lock and MAY support more than one.

To query the lock count for an ordered queue the new API odp_queue_lock_count()
is added.

odp_schedule_order_lock() and odp_schedule_order_unlock() now take a
single argument: the index [0..odp_queue_lock_count()-1] of the ordered
lock to be locked or unlocked. Ordered locks may only be used once per
event. If processing an event requires multiple ordered criticial sections,
each should be protected by a separate ordered lock. Trying to obtain
an ordered lock when not running in an ordered context, or referencing a lock
index that is out of range for that context results in undefined behavior.

Note that part 5 of this patch is large because changing the ordered lock APIs
requires that their linux-generic implementation as well as the scheduler
validation test be changed simulataneously to preserve incremental
compilability.  Part 5 also contains a spurious checkpatch warning relating
to quoted split strings. This should disappear with the expected revision of
the ODP checkpatch rules to allow this convention, as previously agreed.

Bill Fischofer (5):
  api: config: add config option for max ordered locks per queue
  api: queue: add odp_queue_lock_count() API
  api: schedule: add lock_count to odp_schedule_param_t
  api: schedule: remove odp_schedule_order_lock_init() API
  api: schedule: revise definition of ordered locks

 include/odp/api/config.h   |  5 ++
 include/odp/api/queue.h| 13 +
 include/odp/api/schedule.h | 62 ++--
 include/odp/api/schedule_types.h   |  2 +
 .../include/odp/plat/schedule_types.h  |  2 -
 .../linux-generic/include/odp_buffer_internal.h|  2 +-
 .../linux-generic/include/odp_queue_internal.h | 19 ---
 platform/linux-generic/odp_queue.c | 66 ++
 platform/linux-generic/odp_schedule.c  | 15 +++--
 test/validation/scheduler/scheduler.c  | 63 +++--
 10 files changed, 159 insertions(+), 90 deletions(-)

-- 
2.1.4

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


[lng-odp] [API-NEXT PATCHv3 1/5] api: config: add config option for max ordered locks per queue

2015-09-16 Thread Bill Fischofer
Specify implementation-defined maximum number of ordered locks that
are available per ordered queue.

Signed-off-by: Bill Fischofer 
---
 include/odp/api/config.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 302eaf5..f417b8b 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -39,6 +39,11 @@ extern "C" {
 #define ODP_CONFIG_QUEUES   1024
 
 /**
+ * Maximum number of ordered locks per queue
+ */
+#define ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE  2
+
+/**
  * Number of scheduling priorities
  */
 #define ODP_CONFIG_SCHED_PRIOS  8
-- 
2.1.4

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


Re: [lng-odp] [PATCH v2 3/5] linux-generic: odp_time: reutrn 0 if t2 = t1 instead of MAX for diff

2015-09-16 Thread Ivan Khoronzhuk



On 16.09.15 14:39, Savolainen, Petri (Nokia - FI/Espoo) wrote:




-Original Message-
From: EXT Ivan Khoronzhuk [mailto:ivan.khoronz...@linaro.org]
Sent: Wednesday, September 16, 2015 1:47 PM
To: lng-odp@lists.linaro.org; Savolainen, Petri (Nokia - FI/Espoo)
Subject: Re: [lng-odp] [PATCH v2 3/5] linux-generic: odp_time: reutrn 0
if t2 = t1 instead of MAX for diff

On 16.09.15 13:23, Ivan Khoronzhuk wrote:

Petri,

What about this fix? It's similar to to CPU API.

On 11.09.15 13:04, Ivan Khoronzhuk wrote:

It's better to describe by example:

cur = 15;
start = 15;
diff = 2;
while (odp_time_cycles_diff(start, cur) < diff) {
 cur = odp_time_cycles();
}

This example has to work. It's possible only when t2 - t1 = 0 if t2

= t1.

The validation test on it will be added later.

Signed-off-by: Ivan Khoronzhuk 
---
   platform/linux-generic/odp_time.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_time.c b/platform/linux-

generic/odp_time.c

index a08833d..a007d69 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -14,7 +14,7 @@

   uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
   {
-if (odp_likely(t2 > t1))
+if (odp_likely(t2 >= t1))
   return t2 - t1;

   return t2 + (UINT64_MAX - t1);



But I have additional proposition. Maybe I'm wrong, but
one cycle can be lost here (equal as in CPU api, I'm ready to fix it

also)


For instance:

start = MAX - 2;
cur = 1

res = MAX - MAX + 2 + 1 = 3;
It's correct. But in real it will be:

(MAX - 2)
-> 1 cycle
(MAX - 1)
-> 2 cycle
MAX
-> 3 cycle
0
-> 4 cycle
1

The function returns 3 cycles difference,
but due to 0, physically, timer counts 4 cycles.

Not sure, but I should send +1 patch that corrects it to:

return t2 + (UINT64_MAX - t1) + 1;

due to counter in continuous mode is reset to 0, then continues

counting.


Can we apply this on cycle counter? (then I need correct CPU API

implementation also)

Is it reseted to zero or wraps to 1 for all arches?




For instance, from here
http://download.intel.com/design/intelxscale/27347302.pdf,
(Intel XScale(r) Core) CCNT behaves like:

"When CCNT reaches its maximum value 0x,, the next clock
cycle will cause it to roll over to zero"

But I'm not sure about other arches hidden under linux-generic.
I tend to believe that it's applicable for all cases.

--
Regards,
Ivan Khoronzhuk



uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
{
if (odp_unlikely(t2 == t1))
return 0;

if (odp_likely(t2 > t1))
return t2 - t1;


Sorry, but why not
if (odp_likely(t2 >= t1))
return t2 - t1;

as in patch.



return t2 + (UINT64_MAX - t1) + 1;
}


t1 = MAX

t2 = MAX - 1, diff = MAX - 1 + MAX - MAX + 1 = MAX

True, as we count +1 cycle in real.
Ok.


t2 = MAX, diff = 0

True.


t2 = 0,   diff = 0 + MAX - MAX + 1 = 1

Also true. As for count from MAX to 0 we need 1 cycle.
Ok.




t1 = MAX - 1
t2 = MAX - 2, diff = MAX - 2 + MAX - MAX + 1 + 1 = MAX

True and OK.


t2 = MAX - 1, diff = 0

True and OK.


t2 = MAX, diff = MAX - MAX + 1 = 1

True and OK.


t2 = 0,   diff = 0 + MAX - MAX + 1 + 1 = 2

True, as we need 2 cycles to reach 0.
Ok.


t2 = 1,   diff = 1 + MAX - MAX + 1 + 1 = 3

True, as we need 3 cycles to reach 1.
Ok.




It's very likely that when t1 == t2, the correct result is 0.

Yep, I'm not proposing to change this patch. I propose to send additional patch 
later.
It will be rather series, as I want to correct cpu API also.

 Let's catch that first. Wrap around case can have then the extra +1.
Right, that is I worry about. But seems on current arches it's applicable.
Also we can limit it to arches we are sure, as -1 cycle it's obvious error now 
and
it adds additional error in accuracy +-2 cycles instead of 1. In case of bad 
cycle counter
resolution, say 64, it can have valuable impact, especially if it's multiplied 
on some value.




-Petri






--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API NEXT PATCH v5 08/17] api: sysinfo: revise odp_cpu_hz() to return current frequency

2015-09-16 Thread Hongbo Zhang
On 16 September 2015 at 17:21, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
> This patch does not change the API. It changes implementation and should be 
> named
>
>
> linux-generic: sysinfo: revise odp_cpu_hz() to return current frequency
>
OK

>
> -Petri
>
>
>> -Original Message-
>> From: EXT hongbo.zh...@freescale.com
>> [mailto:hongbo.zh...@freescale.com]
>> Sent: Tuesday, September 15, 2015 4:56 PM
>> To: lng-odp@lists.linaro.org
>> Cc: mike.hol...@linaro.org; stuart.has...@arm.com; Savolainen, Petri
>> (Nokia - FI/Espoo); petri.savolai...@linaro.org;
>> ivan.khoronz...@linaro.org; Hongbo Zhang
>> Subject: [API NEXT PATCH v5 08/17] api: sysinfo: revise odp_cpu_hz() to
>> return current frequency
>>
>> From: Hongbo Zhang 
>>
>> The odp_cpu_hz_max() is added to returm maximum frequency of CPU,
>> while the odp_cpu_hz(), as shown by its name, should return current
>> frequency of CPU, this patch revise odp_cpu_hz() for this purpose.
>>
>> Signed-off-by: Hongbo Zhang 
>> ---
>>  platform/linux-generic/odp_system_info.c | 56
>> +++-
>>  1 file changed, 55 insertions(+), 1 deletion(-)
>>
>> diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-
>> generic/odp_system_info.c
>> index 8532fa0..ed61d36 100644
>> --- a/platform/linux-generic/odp_system_info.c
>> +++ b/platform/linux-generic/odp_system_info.c
>> @@ -146,6 +146,42 @@ static int cpuinfo_x86(FILE *file,
>> odp_system_info_t *sysinfo)
>>   return 0;
>>  }
>>
>> +static uint64_t arch_cpu_hz_current(int id)
>> +{
>> + char str[1024];
>> + FILE *file;
>> + int cpu;
>> + char *pos;
>> + double mhz = 0.0;
>> +
>> + file = fopen("/proc/cpuinfo", "rt");
>> +
>> + /* find the correct processor instance */
>> + while (fgets(str, sizeof(str), file) != NULL) {
>> + pos = strstr(str, "processor");
>> + if (pos) {
>> + sscanf(pos, "processor : %d", );
>> + if (cpu == id)
>> + break;
>> + }
>> + }
>> +
>> + /* extract the cpu current speed */
>> + while (fgets(str, sizeof(str), file) != NULL) {
>> + pos = strstr(str, "cpu MHz");
>> + if (pos) {
>> + sscanf(pos, "cpu MHz : %lf", );
>> + break;
>> + }
>> + }
>> +
>> + fclose(file);
>> + if (mhz)
>> + return (uint64_t)(mhz * 100.0);
>> +
>> + return -1;
>> +}
>> +
>>  #elif defined __arm__ || defined __aarch64__
>>
>>  static int cpuinfo_arm(FILE *file ODP_UNUSED,
>> @@ -154,6 +190,11 @@ odp_system_info_t *sysinfo ODP_UNUSED)
>>   return 0;
>>  }
>>
>> +static uint64_t arch_cpu_hz_current(int id)
>> +{
>> + return -1;
>> +}
>> +
>>  #elif defined __OCTEON__
>>
>>  static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
>> @@ -195,6 +236,12 @@ static int cpuinfo_octeon(FILE *file,
>> odp_system_info_t *sysinfo)
>>
>>   return 0;
>>  }
>> +
>> +static uint64_t arch_cpu_hz_current(int id)
>> +{
>> + return -1;
>> +}
>> +
>>  #elif defined __powerpc__
>>  static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
>>  {
>> @@ -236,6 +283,11 @@ static int cpuinfo_powerpc(FILE *file,
>> odp_system_info_t *sysinfo)
>>   return 0;
>>  }
>>
>> +static uint64_t arch_cpu_hz_current(int id)
>> +{
>> + return -1;
>> +}
>> +
>>  #else
>>   #error GCC target not found
>>  #endif
>> @@ -368,7 +420,9 @@ int odp_system_info_init(void)
>>   */
>>  uint64_t odp_cpu_hz(void)
>>  {
>> - return odp_global_data.system_info.cpu_hz[0];
>> + int id = sched_getcpu();
>> +
>> + return arch_cpu_hz_current(id);
>>  }
>>
>>  uint64_t odp_cpu_hz_max(void)
>> --
>> 1.9.1
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v2 3/5] linux-generic: odp_time: reutrn 0 if t2 = t1 instead of MAX for diff

2015-09-16 Thread Ivan Khoronzhuk

On 16.09.15 13:23, Ivan Khoronzhuk wrote:

Petri,

What about this fix? It's similar to to CPU API.

On 11.09.15 13:04, Ivan Khoronzhuk wrote:

It's better to describe by example:

cur = 15;
start = 15;
diff = 2;
while (odp_time_cycles_diff(start, cur) < diff) {
cur = odp_time_cycles();
}

This example has to work. It's possible only when t2 - t1 = 0 if t2 = t1.
The validation test on it will be added later.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/odp_time.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index a08833d..a007d69 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -14,7 +14,7 @@

  uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
  {
-if (odp_likely(t2 > t1))
+if (odp_likely(t2 >= t1))
  return t2 - t1;

  return t2 + (UINT64_MAX - t1);



But I have additional proposition. Maybe I'm wrong, but
one cycle can be lost here (equal as in CPU api, I'm ready to fix it also)

For instance:

start = MAX - 2;
cur = 1

res = MAX - MAX + 2 + 1 = 3;
It's correct. But in real it will be:

(MAX - 2)
   -> 1 cycle
(MAX - 1)
   -> 2 cycle
MAX
   -> 3 cycle
0
   -> 4 cycle
1

The function returns 3 cycles difference,
but due to 0, physically, timer counts 4 cycles.

Not sure, but I should send +1 patch that corrects it to:

return t2 + (UINT64_MAX - t1) + 1;

due to counter in continuous mode is reset to 0, then continues counting.

Can we apply this on cycle counter? (then I need correct CPU API implementation 
also)
Is it reseted to zero or wraps to 1 for all arches?




For instance, from here 
http://download.intel.com/design/intelxscale/27347302.pdf,
(Intel XScale® Core) CCNT behaves like:

"When CCNT reaches its maximum value 0x,, the next clock
cycle will cause it to roll over to zero"

But I'm not sure about other arches hidden under linux-generic.
I tend to believe that it's applicable for all cases.

--
Regards,
Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [API-NEXT PATCHv3 4/5] api: schedule: remove odp_schedule_order_lock_init() API

2015-09-16 Thread Bill Fischofer
 Remove deprecated API. This has been superseded by the lock_count
 parameter passed to odp_queue_create().

Signed-off-by: Bill Fischofer 
---
 include/odp/api/schedule.h| 18 --
 test/validation/scheduler/scheduler.c |  6 --
 2 files changed, 24 deletions(-)

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index b0b7425..11f85ad 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -297,24 +297,6 @@ int odp_schedule_group_thrmask(odp_schedule_group_t group,
   odp_thrmask_t *thrmask);
 
 /**
- * Initialize ordered context lock
- *
- * Initialize an ordered queue context lock. The lock can be associated only
- * with ordered queues and used only within an ordered synchronization context.
- *
- * @param lockOrdered context lock
- * @param queue   Ordered queue
- *
- * @retval 0 on success
- * @retval <0 on failure
- *
- * @note At present a thread may only use a single ordered lock. Attempts to
- * use multiple ordered locks within an order context are undefined.
- */
-int odp_schedule_order_lock_init(odp_schedule_order_lock_t *lock,
-odp_queue_t queue);
-
-/**
  * Acquire ordered context lock
  *
  * This call is valid only when holding an ordered synchronization context. The
diff --git a/test/validation/scheduler/scheduler.c 
b/test/validation/scheduler/scheduler.c
index 1874889..8cde985 100644
--- a/test/validation/scheduler/scheduler.c
+++ b/test/validation/scheduler/scheduler.c
@@ -964,12 +964,6 @@ static int create_queues(void)
qctx->ctx_handle = queue_ctx_buf;
qctx->sequence = 0;
qctx->lock_sequence = 0;
-   rc = odp_schedule_order_lock_init(>order_lock, q);
-
-   if (rc != 0) {
-   printf("Ordered lock init failed\n");
-   return -1;
-   }
 
rc = odp_queue_context_set(q, qctx);
 
-- 
2.1.4

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


Re: [lng-odp] [API-NEXT PATCH 5/5] api: schedule: revise definition of ordered locks

2015-09-16 Thread Bill Fischofer
OK.  I've posted v3 with these changes.

On Wed, Sep 16, 2015 at 6:11 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> Hi,
>
>
>
> I think still that since we need to prepare only for few locks per queue
> (32k should be more than enough) and types should reflect that. Specific
> widths (uintxx_t) should be reserved for use cases which actually need
> those. I propose to use ‘unsigned’ for the index type. It’s at least 16
> bits as well as int is.
>
>
>
> /** Lock count */
>
> unsigned lock_count; /**< Ordered lock count for this ordered queue */
>
>
>
> int odp_queue_lock_count(odp_queue_t queue);
>
> void odp_schedule_order_lock(unsigned lock_index);
>
> void odp_schedule_order_unlock(unsigned lock_index);
>
>
>
>
>
> An typical use case is:
>
>
>
> sched.lock_count = 2;
>
>
>
>
>
> odp_schedule_order_lock(0);
>
> foo++;
>
> odp_schedule_order_unlock(0);
>
>
>
> odp_schedule_order_lock(1);
>
> bar++;
>
> odp_schedule_order_unlock(1);
>
>
>
>
>
>
>
> What comes to the binary compatibility. One binary image need to be
> compatible only within one ABI spec (the one it was compiled against). E.g.
> when I  compile a Linux app for ARMv8, I expect it to run on Linux on any
> ARMv8 SoCs - but not e.g. on x86, or on baremetal of a ARMv8 SoC.
>
>
>
>
>
> -Petri
>
>
>
>
>
>
>
>
>
> *From:* EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
> *Sent:* Saturday, September 12, 2015 7:16 AM
> *To:* Savolainen, Petri (Nokia - FI/Espoo)
> *Cc:* lng-odp@lists.linaro.org
> *Subject:* Re: [lng-odp] [API-NEXT PATCH 5/5] api: schedule: revise
> definition of ordered locks
>
>
>
> I've posted a v2 of the patch to reflect incorporation of these suggested
> changes.  In particular odp_queue_lock_count() now returns an int rather
> than uint32_t as suggested, however I believe the lock/unlock calls should
> still take a uint32_t as lock indexes can never be negative and there's no
> need to add additional checking code for this. It's an ODP convention to
> specify parameter widths explicitly for potential ABI compatibility
> reasons, so it's better to say something precise like uint32_t than
> unsigned int whose width may vary across platforms.
>
>
>
> On Thu, Sep 10, 2015 at 9:22 AM, Savolainen, Petri (Nokia - FI/Espoo) <
> petri.savolai...@nokia.com> wrote:
>
>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> > ext Bill Fischofer
> > Sent: Sunday, September 06, 2015 5:50 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH 5/5] api: schedule: revise
> > definition of ordered locks
> >
> > Revise the definition of odp_schedule_order_lock() and
> > odp_schedule_order_unlock(). These APIs now take as an argument the
> > index value of the ordered lock within the current context to be locked
> > or unlocked. Because the API is changed, this patch also updates the
> > linux-generic implementation of these APIs as well as the scheduler
> > validation test that uses them.
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  include/odp/api/schedule.h | 44 ++
> > -
> >  .../include/odp/plat/schedule_types.h  |  2 -
> >  .../linux-generic/include/odp_buffer_internal.h|  2 +-
> >  .../linux-generic/include/odp_queue_internal.h | 19 ---
> >  platform/linux-generic/odp_queue.c | 66
> > ++
> >  platform/linux-generic/odp_schedule.c  | 15 +++--
> >  test/validation/scheduler/scheduler.c  | 61
> > +++-
> >  7 files changed, 141 insertions(+), 68 deletions(-)
> >
> > diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
> > index 11f85ad..679d5b8 100644
> > --- a/include/odp/api/schedule.h
> > +++ b/include/odp/api/schedule.h
> > @@ -31,11 +31,6 @@ extern "C" {
> >   */
> >
> >  /**
> > - * @typedef odp_schedule_order_lock_t
> > - * Scheduler ordered context lock
> > - */
> > -
> > -/**
> >   * @def ODP_SCHED_WAIT
> >   * Wait infinitely
> >   */
> > @@ -299,15 +294,31 @@ int
> > odp_schedule_group_thrmask(odp_schedule_group_t group,
> >  /**
> >   * Acquire ordered context lock
> >   *
> > - * This call is valid only when holding an ordered synchronization
> > context. The
> > - * lock is used to protect a critical section that is executed within
> > an
> > - * ordered context. Threads enter the critical section in the order
> > determined
> > - * by the context (source queue). Lock ordering is automatically
> > skipped for
> > - * threads that release the context instead of calling the lock.
> > - *
> > - * @param lockOrdered context lock
> > + * This call is valid only when holding an ordered synchronization
> > context.
> > + * Ordered locks are used to protect critical sections that are
> > executed
> > + * within an ordered context. Threads enter the critical section in
> > the order
> > + * determined by the context (source queue). Lock 

Re: [lng-odp] [PATCH] api: tm: add api definitions for egress traffic manager

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> ext Mike Holmes
> Sent: Monday, August 24, 2015 11:12 PM
> To: bala.manoha...@linaro.org; lng-odp@lists.linaro.org
> Cc: Barry Spinney
> Subject: [lng-odp] [PATCH] api: tm: add api definitions for egress
> traffic manager
> 
> From: Barry Spinney 
> 
> This introduces an API for configuring and using Traffic Management
> systems.
> 
> The purpose of this API is as a general packet scheduling system that
> accepts
> packets from input queues and applies strict priority scheduling,
> weighted fair
> queuing scheduling and/or bandwidth controls to decide which input
> packet
> should be chosen as the next output packet and when this output packet
> can be
> sent onwards.
> 
> Signed-off-by: Barry Spinney 
> Signed-off-by: Mike Holmes 
> Signed-off-by: Bill Fischofer 
> ---
> 
> This patch is the header file definition for the new traffic manager
> API, the
> implementation and the example remain at
> https://github.com/mike-holmes-linaro/odp
> 
> This patch will have Doxygen warnings because the platform specific
> defines are
> not included.
> 
>  include/odp/api/traffic_mngr.h | 1613
> 
>  platform/linux-generic/Makefile.am |1 +
>  2 files changed, 1614 insertions(+)
>  create mode 100644 include/odp/api/traffic_mngr.h
> 
> diff --git a/include/odp/api/traffic_mngr.h
> b/include/odp/api/traffic_mngr.h
> new file mode 100644
> index 000..7e37a84
> --- /dev/null
> +++ b/include/odp/api/traffic_mngr.h
> @@ -0,0 +1,1613 @@
> +/** Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +#ifndef ODP_TRAFFIC_MNGR_H_
> +#define ODP_TRAFFIC_MNGR_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 

No need to include this since it should be visible through .




> +#include 
> +#include 
> +
> +/**
> + * @file
> + *
> + */
> +
> +/** @defgroup odp_traffic_mngr ODP TRAFFIC MNGR
> + * @{
> + *
> + * An API for configuring and using Traffic Management systems
> + *
> + * This file forms a simple interface for creating, configuring and
> using
> + * Traffic Management (TM) subsystems.  By TM subsystem it is meant a
> general
> + * packet scheduling system that accepts packets from input queues and
> applies
> + * strict priority scheduling, weighted fair queuing scheduling and/or
> + * bandwidth controls to decide which input packet should be chosen as
> the
> + * next output packet and when this output packet can be sent onwards.
> + *
> + * A given platform supporting this TM API could support one or more
> pure
> + * hardware based packet scheduling systems, one or more pure software
> + * based systems or one or more hybrid systems - where because of
> + * hardware constraints some of the packet scheduling is done in
> hardware
> + * and some is done in software.  In addition, there may also be
> additional
> + * API's beyond those described here for (a) controlling advanced
> capabilities
> + * supported by specific hardware, software or hybrid subsystems or
> (b)
> + * dealing with constraints and limitations of specific
> implementations.
> + * The intention here is to be the simplest API that covers the vast
> majority
> + * of packet scheduling requirements.
> + *
> + * Often a TM subsystem's output(s) will be directly connected
> + * to a device's physical (or virtual) output interfaces/links, in
> which case
> + * sometimes such a system will be called an Egress Packet Scheduler
> or an
> + * Output Link Shaper, etc..  While the TM subsystems configured by
> this API
> + * can be used in such a way, this API equally well supports the
> ability to
> + * have the TM subsystem's outputs connect to other TM subsystem input
> queues
> + * or general software queues or even some combination of these three
> cases.
> + *
> + * TM Algorithms
> + *
> + * The packet scheduling/dropping techniques that can be applied to
> input
> + * traffic include any mixture of the following:
> + * 
> + *  Strict Priority scheduling.
> + *  Weighted Fair Queueing scheduling (WFQ).
> + *  Bandwidth Shaping.
> + *  Weighted Random Early Discard (WRED).
> + * 
> + * Note that Bandwidth Shaping is the only feature that can cause
> packets
> + * to be "delayed", and Weighted Random Early Discard is the only
> feature
> + * (other than input queues becoming full) that can cause packets to
> be
> + * dropped.
> + *
> + * Strict Priority Scheduling
> + * Strict Priority Scheduling (or just priority for short), is a
> technique
> + * where input queues and the packets from them, are assigned a
> priority
> + * value in the range 0 .. ODP_TM_MAX_PRIORITIES - 1.  At all times
> packets
> + * the the smallest priority value will be chosen ahead of packets
> with a
> + * numerically larger priority value.  This is called 

Re: [lng-odp] [API-NEXT PATCHv3 0/5] Revised Ordered Lock APIs

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)
Reviewed-by: Petri Savolainen 


Just clean the documentation in patch 3 during merge.



+ /** Lock group */
+ unsigned lock_count; /**< Ordered lock count for this queue */


Should be like this:

+ /** Ordered lock count for this queue */
+ unsigned lock_count;




> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> EXT Bill Fischofer
> Sent: Wednesday, September 16, 2015 2:52 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCHv3 0/5] Revised Ordered Lock APIs
> 
> Changes in v3:
> - Change types of lock_count and lock indices from uint32_t to unsigned
> 
> ---
> Changes in v2:
> - Incorporate Petri review comments
> 
> ---
> Revise the ordered lock APIs per recent ARCH discussions. Ordered locks
> are now specified via the new lock_count parameter within the
> odp_schedule_param_t section of the odp_queue_param_t passed to
> odp_queue_create(). As a result odp_schedule_order_lock_init() is
> deprecated and removed. Implementations specify the maximum number
> of ordered locks per queue they support via the new config.h entry
> ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE. Implementations SHOULD support
> at least one ordered lock and MAY support more than one.
> 
> To query the lock count for an ordered queue the new API
> odp_queue_lock_count()
> is added.
> 
> odp_schedule_order_lock() and odp_schedule_order_unlock() now take a
> single argument: the index [0..odp_queue_lock_count()-1] of the ordered
> lock to be locked or unlocked. Ordered locks may only be used once per
> event. If processing an event requires multiple ordered criticial
> sections,
> each should be protected by a separate ordered lock. Trying to obtain
> an ordered lock when not running in an ordered context, or referencing
> a lock
> index that is out of range for that context results in undefined
> behavior.
> 
> Note that part 5 of this patch is large because changing the ordered
> lock APIs
> requires that their linux-generic implementation as well as the
> scheduler
> validation test be changed simulataneously to preserve incremental
> compilability.  Part 5 also contains a spurious checkpatch warning
> relating
> to quoted split strings. This should disappear with the expected
> revision of
> the ODP checkpatch rules to allow this convention, as previously
> agreed.
> 
> Bill Fischofer (5):
>   api: config: add config option for max ordered locks per queue
>   api: queue: add odp_queue_lock_count() API
>   api: schedule: add lock_count to odp_schedule_param_t
>   api: schedule: remove odp_schedule_order_lock_init() API
>   api: schedule: revise definition of ordered locks
> 
>  include/odp/api/config.h   |  5 ++
>  include/odp/api/queue.h| 13 +
>  include/odp/api/schedule.h | 62 ++
> --
>  include/odp/api/schedule_types.h   |  2 +
>  .../include/odp/plat/schedule_types.h  |  2 -
>  .../linux-generic/include/odp_buffer_internal.h|  2 +-
>  .../linux-generic/include/odp_queue_internal.h | 19 ---
>  platform/linux-generic/odp_queue.c | 66
> ++
>  platform/linux-generic/odp_schedule.c  | 15 +++--
>  test/validation/scheduler/scheduler.c  | 63
> +++--
>  10 files changed, 159 insertions(+), 90 deletions(-)
> 
> --
> 2.1.4
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count to odp_schedule_param_t

2015-09-16 Thread Savolainen, Petri (Nokia - FI/Espoo)
> + /** Lock group */
> + unsigned lock_count; /**< Ordered lock count for this queue */



From: EXT Bill Fischofer [mailto:bill.fischo...@linaro.org]
Sent: Wednesday, September 16, 2015 4:40 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count to 
odp_schedule_param_t

I don't see where the double documentation is that you refer to.

On Wed, Sep 16, 2015 at 8:35 AM, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:


> -Original Message-
> From: lng-odp 
> [mailto:lng-odp-boun...@lists.linaro.org]
>  On Behalf Of
> EXT Bill Fischofer
> Sent: Wednesday, September 16, 2015 2:52 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count
> to odp_schedule_param_t
>
> The lock_count is used to specify the number of ordered locks to be
> available for an ordered queue at odp_queue_create() time.
>
> Signed-off-by: Bill Fischofer 
> >
> ---
>  include/odp/api/schedule_types.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/odp/api/schedule_types.h
> b/include/odp/api/schedule_types.h
> index f7526ee..96d9028 100644
> --- a/include/odp/api/schedule_types.h
> +++ b/include/odp/api/schedule_types.h
> @@ -131,6 +131,8 @@ typedef   struct odp_schedule_param_t {
>   odp_schedule_sync_t  sync;
>   /** Thread group */
>   odp_schedule_group_t group;
> + /** Lock group */
> + unsigned lock_count; /**< Ordered lock count for this queue */


Lock_count is double doxygen documented. Sorry to not highlight that on 
previous mail. Maybe Maxim can delete "Lock group" during merge.

-Petri



>  } odp_schedule_param_t;
>
>  /**
> --
> 2.1.4
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp

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


Re: [lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count to odp_schedule_param_t

2015-09-16 Thread Bill Fischofer
I don't see where the double documentation is that you refer to.

On Wed, Sep 16, 2015 at 8:35 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> > EXT Bill Fischofer
> > Sent: Wednesday, September 16, 2015 2:52 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCHv3 3/5] api: schedule: add lock_count
> > to odp_schedule_param_t
> >
> > The lock_count is used to specify the number of ordered locks to be
> > available for an ordered queue at odp_queue_create() time.
> >
> > Signed-off-by: Bill Fischofer 
> > ---
> >  include/odp/api/schedule_types.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/include/odp/api/schedule_types.h
> > b/include/odp/api/schedule_types.h
> > index f7526ee..96d9028 100644
> > --- a/include/odp/api/schedule_types.h
> > +++ b/include/odp/api/schedule_types.h
> > @@ -131,6 +131,8 @@ typedef   struct odp_schedule_param_t {
> >   odp_schedule_sync_t  sync;
> >   /** Thread group */
> >   odp_schedule_group_t group;
> > + /** Lock group */
> > + unsigned lock_count; /**< Ordered lock count for this queue */
>
>
> Lock_count is double doxygen documented. Sorry to not highlight that on
> previous mail. Maybe Maxim can delete "Lock group" during merge.
>
> -Petri
>
>
>
> >  } odp_schedule_param_t;
> >
> >  /**
> > --
> > 2.1.4
> >
> > ___
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] test: l2fwd: fill correct source ethernet address

2015-09-16 Thread Stuart Haslam
On Tue, Sep 15, 2015 at 10:09:12AM +0300, Matias Elo wrote:
> When running l2fwd in a VM using SR-IOV the host may drop
> packets if the source MAC address is not the same as that
> of the VF NIC. Modify test application so that the source
> MAC address is always filled correctly.
> 

Patch looks good generally, just one nit below.

> Signed-off-by: Matias Elo 
> ---
>  test/performance/odp_l2fwd.c | 75 
> +++-
>  1 file changed, 60 insertions(+), 15 deletions(-)
> 
> diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
> index 64fc1b2..db08ac9 100644
> --- a/test/performance/odp_l2fwd.c
> +++ b/test/performance/odp_l2fwd.c
> @@ -105,6 +105,10 @@ typedef struct {
>   thread_args_t thread[MAX_WORKERS];
>   /** Table of pktio handles */
>   odp_pktio_t pktios[ODP_CONFIG_PKTIO_ENTRIES];
> + /** Table of port ethernet addresses */
> + odph_ethaddr_t port_eth_addr[ODP_CONFIG_PKTIO_ENTRIES];
> + /** Table of port default output queues */
> + odp_queue_t outq_def[ODP_CONFIG_PKTIO_ENTRIES];
>  } args_t;
>  
>  /** Global pointer to args */
> @@ -113,8 +117,10 @@ static args_t *gbl_args;
>  static odp_barrier_t barrier;
>  
>  /* helper funcs */
> -static inline odp_queue_t lookup_dest_q(odp_packet_t pkt);
> +static inline int lookup_dest_port(odp_packet_t pkt);
>  static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len);
> +static void fill_src_eth_addrs(odp_packet_t pkt_tbl[], unsigned num,
> +int dst_port);
>  static void parse_args(int argc, char *argv[], appl_args_t *appl_args);
>  static void print_info(char *progname, appl_args_t *appl_args);
>  static void usage(char *progname);
> @@ -126,7 +132,7 @@ static void usage(char *progname);
>   */
>  static void *pktio_queue_thread(void *arg)
>  {
> - int thr;
> + int thr, dst_port;
>   odp_queue_t outq_def;
>   odp_packet_t pkt;
>   odp_event_t ev;
> @@ -152,9 +158,12 @@ static void *pktio_queue_thread(void *arg)
>   continue;
>   }
>  
> - outq_def = lookup_dest_q(pkt);
> + dst_port = lookup_dest_port(pkt);
> +
> + fill_src_eth_addrs(, 1, dst_port);
>  
>   /* Enqueue the packet for output */
> + outq_def = gbl_args->outq_def[dst_port];
>   if (odp_queue_enq(outq_def, ev)) {
>   printf("  [%i] Queue enqueue failed.\n", thr);
>   odp_packet_free(pkt);
> @@ -169,12 +178,12 @@ static void *pktio_queue_thread(void *arg)
>  }
>  
>  /**
> - * Lookup the destination pktio for a given packet
> + * Lookup the destination port for a given packet
>   */
> -static inline odp_queue_t lookup_dest_q(odp_packet_t pkt)
> +static inline int lookup_dest_port(odp_packet_t pkt)
>  {
> - int i, src_idx, dst_idx;
> - odp_pktio_t pktio_src, pktio_dst;
> + int i, src_idx;
> + odp_pktio_t pktio_src;
>  
>   pktio_src = odp_packet_input(pkt);
>  
> @@ -185,10 +194,7 @@ static inline odp_queue_t lookup_dest_q(odp_packet_t pkt)
>   if (src_idx == -1)
>   LOG_ABORT("Failed to determine pktio input\n");
>  
> - dst_idx = (src_idx % 2 == 0) ? src_idx+1 : src_idx-1;
> - pktio_dst = gbl_args->pktios[dst_idx];
> -
> - return odp_pktio_outq_getdef(pktio_dst);
> + return (src_idx % 2 == 0) ? src_idx + 1 : src_idx - 1;
>  }
>  
>  /**
> @@ -233,6 +239,8 @@ static void *pktio_ifburst_thread(void *arg)
>   /* Drop packets with errors */
>   pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>   if (pkts_ok > 0) {
> + fill_src_eth_addrs(pkt_tbl, pkts_ok, dst_idx);
> +
>   int sent = odp_pktio_send(pktio_dst, pkt_tbl, pkts_ok);
>  
>   sent = sent > 0 ? sent : 0;
> @@ -380,6 +388,7 @@ int main(int argc, char *argv[])
>   odp_shm_t shm;
>   odp_cpumask_t cpumask;
>   char cpumaskstr[ODP_CPUMASK_STR_SIZE];
> + odp_pktio_t pktio;
>   odp_pool_param_t params;
>   int ret;
>  
> @@ -452,12 +461,24 @@ int main(int argc, char *argv[])
>   odp_pool_print(pool);
>  
>   for (i = 0; i < gbl_args->appl.if_count; ++i) {
> - gbl_args->pktios[i] = create_pktio(gbl_args->appl.if_names[i],
> -pool, gbl_args->appl.mode);
> - if (gbl_args->pktios[i] == ODP_PKTIO_INVALID)
> + pktio = create_pktio(gbl_args->appl.if_names[i],
> +  pool, gbl_args->appl.mode);
> + if (pktio == ODP_PKTIO_INVALID)
>   exit(EXIT_FAILURE);
> + gbl_args->pktios[i] = pktio;
>  
> - ret = odp_pktio_start(gbl_args->pktios[i]);
> + /* Save interface ethernet address */
> + if (odp_pktio_mac_addr(pktio, gbl_args->port_eth_addr[i].addr,
> +

Re: [lng-odp] [PATCH 3/4] doc: implementers-guide: update names of test module libraries

2015-09-16 Thread Christophe Milard
On 2015-09-16 10:42, Stuart Haslam wrote:
> The name of the libraries generated by the test modules were recently
> changed from lib.la to libtest.la
> 
> Signed-off-by: Stuart Haslam 

Reviewed-by: Christophe Milard 

> ---
>  doc/implementers-guide/implementers-guide.adoc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/implementers-guide/implementers-guide.adoc 
> b/doc/implementers-guide/implementers-guide.adoc
> index 32dbfea..090d4e5 100644
> --- a/doc/implementers-guide/implementers-guide.adoc
> +++ b/doc/implementers-guide/implementers-guide.adoc
> @@ -77,7 +77,7 @@ Examples of modules includes "classification" (API 
> functions dealing with ingres
>  The complete module list can be seen at: 
> http://docs.opendataplane.org/linux-generic-doxygen-html/modules.html[ODP 
> Modules] +
>  Within the platform agnostic area, the tests are also grouped by modules, 
> matching the ODP API modules: '/test/validation/' mainly contains a 
> list of directories matching each module name (as defined by the doxygen 
> "@defgroup" or "@ingroup" statement present in each API ".h" file).
>  
> -Within each of these directories, a library (called "lib.la") and 
> its associated ".h" file (called ".h") defines all the test functions 
> for this module as well as few other functions to initialize, terminate, and 
> group the tests.
> +Within each of these directories, a library (called "libtest.la") 
> and its associated ".h" file (called ".h") defines all the test 
> functions for this module as well as few other functions to initialize, 
> terminate, and group the tests.
>  An executable called "_main*", is also built. It is permissible to 
> generate more than one executable to cover the functionality in the test 
> library for the module.
>  These executable(s) shall call all the tests for this module. +
>  See <> for more details.
> @@ -130,7 +130,7 @@ Module test and naming convention
> *_init*
> *_term*
>  
> -All the above symbols are part of the generated lib.la libraries. 
> The generated main executable(s) (named _+++main[_*]+++, where the 
> optional suffix is used to distinguish the executables belonging to the same 
> module, if many) simply call(s) the related _main+++[_*]+++ from the 
> library.
> +All the above symbols are part of the generated libtest.la 
> libraries. The generated main executable(s) (named _+++main[_*]+++, 
> where the optional suffix is used to distinguish the executables belonging to 
> the same module, if many) simply call(s) the related _main+++[_*]+++ 
> from the library.
>  
>  Platform specific
>  ~
> @@ -234,7 +234,7 @@ Sometimes, it may be necessary to call platform specific 
> system calls to check s
>  
>  Skipping tests during development
>  ^
> -During ODP development, it may be useful to skip some test. This can be 
> achieved by creating a new test executable (still on the platform side), 
> picking up the required tests from the platform agnostic lib.la.
> +During ODP development, it may be useful to skip some test. This can be 
> achieved by creating a new test executable (still on the platform side), 
> picking up the required tests from the platform agnostic libtest.la.
>  
>  The top Makefile would then call only the platform specific executable, 
> hence skipping the tests which have been omitted.
>  
> -- 
> 2.1.1
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 1/4] validation: add ability to mark tests inactive

2015-09-16 Thread Christophe Milard
On 2015-09-16 10:42, Stuart Haslam wrote:
> Add the ability for individual test cases to be marked as inactive,
> either unconditionally or based on the result of a check function which
> is called at test init time. Inactive tests are registered with CUnit
> and are reported as inactive in test reports without being executed.
> 
> All uses of CU_TestInfo have been replaced with odp_testinfo_t in order
> to carry the conditional function pointer in addition to the CU_TestInfo
> struct, and some new macros added to make things a bit easier;
> 
> _CU_TEST_INFO() is renamed to ODP_TEST_INFO() but remains functionally
> the same, these tests will be run unconditionally.
> 
> ODP_TEST_INFO_INACTIVE() can be used to define an inactive test case.
> There's no good reason to do this in any of the modules under
> test/validation/ but the intention is to allow this to be done on a
> per-platform basis from within the platform//test/ tree.
> 
> ODP_TEST_INFO_CONDITIONAL() takes an additional parameter which is a
> pointer to a function to call at test suite initialisation time to
> determine whether that test should be marked as inactive.
> 
> Signed-off-by: Stuart Haslam 

Reviewed-by: Christophe Milard 

> ---
>  test/validation/buffer/buffer.c| 20 +++---
>  test/validation/buffer/buffer.h|  6 +-
>  test/validation/classification/classification.c|  4 +-
>  test/validation/classification/classification.h|  8 +--
>  .../classification/odp_classification_basic.c  | 20 +++---
>  .../classification/odp_classification_tests.c  | 16 ++---
>  .../classification/odp_classification_testsuites.h |  7 +-
>  test/validation/common/odp_cunit_common.c  | 83 
> +-
>  test/validation/common/odp_cunit_common.h  | 39 --
>  test/validation/cpumask/cpumask.c  | 46 ++--
>  test/validation/cpumask/cpumask.h  |  6 +-
>  test/validation/crypto/crypto.c| 12 ++--
>  test/validation/crypto/crypto.h|  6 +-
>  test/validation/crypto/odp_crypto_test_inp.c   | 14 ++--
>  test/validation/crypto/odp_crypto_test_inp.h   |  4 +-
>  test/validation/errno/errno.c  | 12 ++--
>  test/validation/errno/errno.h  |  6 +-
>  test/validation/init/init.c| 37 +-
>  test/validation/init/init.h| 14 ++--
>  test/validation/packet/packet.c| 46 ++--
>  test/validation/packet/packet.h|  6 +-
>  test/validation/pktio/pktio.c  | 55 +++---
>  test/validation/pktio/pktio.h  |  6 +-
>  test/validation/pool/pool.c| 16 ++---
>  test/validation/pool/pool.h|  6 +-
>  test/validation/queue/queue.c  | 13 ++--
>  test/validation/queue/queue.h  |  6 +-
>  test/validation/random/random.c| 12 ++--
>  test/validation/random/random.h|  6 +-
>  test/validation/scheduler/scheduler.c  | 72 +--
>  test/validation/scheduler/scheduler.h  |  6 +-
>  test/validation/shmem/shmem.c  | 12 ++--
>  test/validation/shmem/shmem.h  |  6 +-
>  test/validation/synchronizers/synchronizers.c  | 78 ++--
>  test/validation/synchronizers/synchronizers.h  | 16 ++---
>  test/validation/system/system.c| 24 +++
>  test/validation/system/system.h|  6 +-
>  test/validation/thread/thread.c| 48 ++---
>  test/validation/thread/thread.h|  6 +-
>  test/validation/time/time.c| 16 ++---
>  test/validation/time/time.h|  6 +-
>  test/validation/timer/timer.c  | 18 ++---
>  test/validation/timer/timer.h  |  6 +-
>  43 files changed, 477 insertions(+), 375 deletions(-)
> 
> diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c
> index c62938d..4600e59 100644
> --- a/test/validation/buffer/buffer.c
> +++ b/test/validation/buffer/buffer.c
> @@ -139,20 +139,16 @@ void buffer_test_management_basic(void)
>   CU_ASSERT(odp_event_to_u64(ev) != odp_event_to_u64(ODP_EVENT_INVALID));
>  }
>  
> -CU_TestInfo buffer_suite[] = {
> - _CU_TEST_INFO(buffer_test_pool_alloc),
> - _CU_TEST_INFO(buffer_test_pool_free),
> - _CU_TEST_INFO(buffer_test_management_basic),
> - CU_TEST_INFO_NULL,
> +odp_testinfo_t buffer_suite[] = {
> + ODP_TEST_INFO(buffer_test_pool_alloc),
> + ODP_TEST_INFO(buffer_test_pool_free),
> + ODP_TEST_INFO(buffer_test_management_basic),
> + ODP_TEST_INFO_NULL,
>  };
>  
> -CU_SuiteInfo buffer_suites[] = {
> - { .pName = 

Re: [lng-odp] [PATCH 2/4] validation: add odp_cunit_update() to modify registered tests

2015-09-16 Thread Christophe Milard
On 2015-09-16 10:42, Stuart Haslam wrote:
> Add an odp_cunit_update() function to allow some attributes of previously
> registered tests to be modified, such as whether it's active or not.
> 
> Previously, registering and running tests was done in a single step;
> 
> odp_cunit_run(testsuites);
> 
> But this is now split;
> 
> odp_cunit_register(testsuites);
> odp_cunit_update(testsuites_updates);
> odp_cunit_run();
> 
> The odp_cunit_update() is optional and none of the currently defined
> tests use it, so there's no functional change in this patch.
> 
> Signed-off-by: Stuart Haslam 
> ---
>  test/validation/buffer/buffer.c |   7 +-
>  test/validation/classification/classification.c |   7 +-
>  test/validation/common/odp_cunit_common.c   | 107 
> ++--
>  test/validation/common/odp_cunit_common.h   |  11 ++-
>  test/validation/cpumask/cpumask.c   |   7 +-
>  test/validation/crypto/crypto.c |  10 ++-
>  test/validation/errno/errno.c   |   7 +-
>  test/validation/init/init.c |  29 ++-
>  test/validation/packet/packet.c |   7 +-
>  test/validation/pktio/pktio.c   |   7 +-
>  test/validation/pool/pool.c |   7 +-
>  test/validation/queue/queue.c   |   7 +-
>  test/validation/random/random.c |   7 +-
>  test/validation/scheduler/scheduler.c   |   7 +-
>  test/validation/shmem/shmem.c   |   7 +-
>  test/validation/synchronizers/synchronizers.c   |  10 ++-
>  test/validation/system/system.c |   7 +-
>  test/validation/thread/thread.c |   7 +-
>  test/validation/time/time.c |   7 +-
>  test/validation/timer/timer.c   |   7 +-
>  20 files changed, 245 insertions(+), 27 deletions(-)
> 
> diff --git a/test/validation/buffer/buffer.c b/test/validation/buffer/buffer.c
> index 4600e59..257e95c 100644
> --- a/test/validation/buffer/buffer.c
> +++ b/test/validation/buffer/buffer.c
> @@ -153,5 +153,10 @@ odp_suiteinfo_t buffer_suites[] = {
>  
>  int buffer_main(void)
>  {
> - return odp_cunit_run(buffer_suites);
> + int ret = odp_cunit_register(buffer_suites);
> +
> + if (ret == 0)
> + odp_cunit_run();
> +
> + return ret;
>  }
> diff --git a/test/validation/classification/classification.c 
> b/test/validation/classification/classification.c
> index b868c61..fe9a827 100644
> --- a/test/validation/classification/classification.c
> +++ b/test/validation/classification/classification.c
> @@ -23,5 +23,10 @@ odp_suiteinfo_t classification_suites[] = {
>  
>  int classification_main(void)
>  {
> - return odp_cunit_run(classification_suites);
> + int ret = odp_cunit_register(classification_suites);
> +
> + if (ret == 0)
> + ret = odp_cunit_run();
> +
> + return ret;
>  }
> diff --git a/test/validation/common/odp_cunit_common.c 
> b/test/validation/common/odp_cunit_common.c
> index d63e87e..8b62370 100644
> --- a/test/validation/common/odp_cunit_common.c
> +++ b/test/validation/common/odp_cunit_common.c
> @@ -164,16 +164,99 @@ static int cunit_register_suites(odp_suiteinfo_t 
> testsuites[])
>   return 0;
>  }
>  
> +static int cunit_update_test(odp_suiteinfo_t *sinfo,
> +  odp_testinfo_t *updated_tinfo)
> +{
> + odp_testinfo_t *tinfo;
> +
> + for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++)
> + if (strcmp(tinfo->testinfo.pName,
> +updated_tinfo->testinfo.pName) == 0)
> + break;
> +
> + if (!tinfo || !tinfo->testinfo.pName)
> + return -1;
> +
> + tinfo->check_active = updated_tinfo->check_active;
> +
> + return 0;
> +}

Is the above function meant to update the tests or the test activity?
It looks like it only update the test activity...

> +
> +static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo)
> +{
> + CU_pSuite suite;
> + CU_pTest test;
> + odp_suiteinfo_t *sinfo;
> + odp_testinfo_t *tinfo;
> +
> + /* find previously registered suite with matching name */
> + for (sinfo = global_testsuites; sinfo->pName; sinfo++)
> + if (strcmp(sinfo->pName, updated_sinfo->pName) == 0)
> + break;
> +
> + if (!sinfo || !sinfo->pName) {
> + fprintf(stderr, "%s: unable to add new suite: %s\n",

shouldn't it say "unable to find existing suite with matching name"?

> + __func__, updated_sinfo->pName);
> + return -1;
> + }
> +
> + /* lookup the associated CUnit suite */
> + suite = CU_get_suite_by_name(sinfo->pName, CU_get_registry());
> + if (!suite) {
> + fprintf(stderr, "%s: can't find registered suite %s\n",

shouldn't it say "unable to find existing suite with matching name in 
registery"?

> + 

Re: [lng-odp] [PATCH 4/4] doc: implementers-guide: update section on skipping tests

2015-09-16 Thread Christophe Milard
On 2015-09-16 10:42, Stuart Haslam wrote:
> Update sections describing how a specific platform may skip tests by
> marking them as inactive.
> 
> Signed-off-by: Stuart Haslam 
> ---
>  doc/implementers-guide/implementers-guide.adoc | 58 
> +-
>  1 file changed, 48 insertions(+), 10 deletions(-)
> 
> diff --git a/doc/implementers-guide/implementers-guide.adoc 
> b/doc/implementers-guide/implementers-guide.adoc
> index 090d4e5..181d5c2 100644
> --- a/doc/implementers-guide/implementers-guide.adoc
> +++ b/doc/implementers-guide/implementers-guide.adoc
> @@ -110,7 +110,7 @@ Module test and naming convention
> *_test_+++*+++* +
> where the suffix idendify the test.
>  
> -* Test arrays, i.e. arrays of CU_TestInfo, listing the test functions 
> belonging to a suite, are called:
> +* Test arrays, i.e. arrays of odp_testinfo_t, listing the test functions 
> belonging to a suite, are called:
> *_suite+++[_*]+++* +
> where the possible suffix can be used if many suites are declared.
>  
> @@ -118,7 +118,7 @@ Module test and naming convention
> *+++_suite[_*]_init()+++* and *+++_suite[_*]_term()+++* 
> respectively. +
> where the possible extra middle pattern can be used if many suites are 
> declared.
>  
> -* Suite arrays, i.e. arrays of CU_SuiteInfo used in executables (C_UNIT 
> registry) are called:
> +* Suite arrays, i.e. arrays of odp_suiteinfo_t used in executables (C_UNIT 
> registry) are called:
> *+++_suites[_*]+++* +
> where the possible suffix identifies the executable using it, if many.
>  
> @@ -232,14 +232,52 @@ Defining platform specific tests
>  Sometimes, it may be necessary to call platform specific system calls to 
> check some functionality: For instance, testing odp_cpumask_* could involve 
> checking the underlying system CPU mask. On linux, such a test would require 
> using the CPU_ISSET macro, which is linux specific. Such a test would be 
> written in '/cpumask/...' The contents of this directory 
> would be very similar to the contents of the platform agnostic side cpu_mask 
> tests (including a Makefile.am...), but platform specific test would be 
> written there.
>  '/Makefile.am' would then trigger the building of the 
> platform specific tests (by listing their module name in SUBDIRS and 
> therefore calling the appropriate Makefile.am) and then it would call both 
> the platform agnostic executable(s) and the platform specific test executable.
>  
> -Skipping tests during development
> -^
> -During ODP development, it may be useful to skip some test. This can be 
> achieved by creating a new test executable (still on the platform side), 
> picking up the required tests from the platform agnostic libtest.la.
> +Marking tests as inactive
> +^
> +The general policy is that a full run of the validation suite (a "make 
> check") must pass at all times. However a particular platform may have one or 
> more test cases that are known to be unimplemented either during development 
> or permanently, so to avoid these test cases being reported as failures it's 
> useful to be able to skip them. This can be achieved by creating a new test 
> executable (still on the platform side), giving the platform specific 
> initialisation code the opportunity to modify the registered tests in order 
> to mark unwanted tests as inactive while leaving the remaining tests active. 
> It's important that the unwanted tests are still registered with the test 
> framework to allow the fact that they're not being tested to be recorded.
> +
> +The odp_cunit_update() function is intended for this purpose, it is used to 
> modify the properties of previously registered tests, for example to mark 
> them as inactive. Inactive tests are registered with the test framework but 
> aren't executed and will be recorded as inactive in test reports.
> +
> +In 'test/validation/foo/foo.c', define all tests for the 'foo' module;
> +
> +[source,c]
> +--
> +odp_testinfo_t foo_tests[] = {
> + ODP_TEST_INFO(foo_test_a),
> + ODP_TEST_INFO(foo_test_b),
> + ODP_TEST_INFO_NULL
> +};
> +
> +odp_suiteinfo_t foo_suites[] = {
> + {"Foo", foo_suite_init, foo_suite_term, foo_tests},
> + ODP_SUITE_INFO_NULL
> +};
> +--
> +
> +In 'platform//test/foo/foo_main.c', register all the tests defined 
> in the 'foo' module, then mark a single specific test case as inactive;
> +
> +[source,c]
> +--
> +static odp_testinfo_t foo_tests_updates[] = {
> + ODP_TEST_INFO_INACTIVE(foo_test_b),
> + ODP_TEST_INFO_NULL
> +};
> +
> +static odp_suiteinfo_t foo_suites_updates[] = {
> + {"Foo", foo_suite_init, foo_suite_term, foo_tests_updates},
> + ODP_SUITE_INFO_NULL
> +};
> +
> +int pktio_main(void)

should be foo_main

> +{
> + int ret = odp_cunit_register(foo_suites);
>  
> -The top Makefile would then call only the platform specific 

Re: [lng-odp] [PATCH 0/4] add ability to mark tests as inactive

2015-09-16 Thread Christophe Milard
On 2015-09-16 10:41, Stuart Haslam wrote:
> This series adds the ability to skip individual test cases either at
> compile time or conditionally at run time. There's no functional change
> since none of the existing tests use this facility.
> 
> There are a few checkpatch warnings about camel case due to the names
> of CUnit structure elements, but with those ignored it's clean.

I like this patch series. I am not sure whether you want to allow the update 
functions to
change the test itself, but if not, it should be relflected in the name, as 
commented on patch 2.
Allowing this would give flexibility, consitency in the "update", but give more 
room for "cheating"...
I am personally positive to allow test pointer modification: we have to assume 
people don't want to cheat.

Also there is a little README file in test/validation which needs to be updated 
with the new types.

Thanks,
Christophe

> 
> Stuart Haslam (4):
>   validation: add ability to mark tests inactive
>   validation: add odp_cunit_update() to modify registered tests
>   doc: implementers-guide: update names of test module libraries
>   doc: implementers-guide: update section on skipping tests
> 
>  doc/implementers-guide/implementers-guide.adoc |  62 +--
>  test/validation/buffer/buffer.c|  27 +--
>  test/validation/buffer/buffer.h|   6 +-
>  test/validation/classification/classification.c|  11 +-
>  test/validation/classification/classification.h|   8 +-
>  .../classification/odp_classification_basic.c  |  20 +--
>  .../classification/odp_classification_tests.c  |  16 +-
>  .../classification/odp_classification_testsuites.h |   7 +-
>  test/validation/common/odp_cunit_common.c  | 186 
> -
>  test/validation/common/odp_cunit_common.h  |  50 +-
>  test/validation/cpumask/cpumask.c  |  53 +++---
>  test/validation/cpumask/cpumask.h  |   6 +-
>  test/validation/crypto/crypto.c|  22 ++-
>  test/validation/crypto/crypto.h|   6 +-
>  test/validation/crypto/odp_crypto_test_inp.c   |  14 +-
>  test/validation/crypto/odp_crypto_test_inp.h   |   4 +-
>  test/validation/errno/errno.c  |  19 ++-
>  test/validation/errno/errno.h  |   6 +-
>  test/validation/init/init.c|  66 +---
>  test/validation/init/init.h|  14 +-
>  test/validation/packet/packet.c|  53 +++---
>  test/validation/packet/packet.h|   6 +-
>  test/validation/pktio/pktio.c  |  62 +++
>  test/validation/pktio/pktio.h  |   6 +-
>  test/validation/pool/pool.c|  23 ++-
>  test/validation/pool/pool.h|   6 +-
>  test/validation/queue/queue.c  |  20 ++-
>  test/validation/queue/queue.h  |   6 +-
>  test/validation/random/random.c|  19 ++-
>  test/validation/random/random.h|   6 +-
>  test/validation/scheduler/scheduler.c  |  79 +
>  test/validation/scheduler/scheduler.h  |   6 +-
>  test/validation/shmem/shmem.c  |  19 ++-
>  test/validation/shmem/shmem.h  |   6 +-
>  test/validation/synchronizers/synchronizers.c  |  88 +-
>  test/validation/synchronizers/synchronizers.h  |  16 +-
>  test/validation/system/system.c|  31 ++--
>  test/validation/system/system.h|   6 +-
>  test/validation/thread/thread.c|  55 +++---
>  test/validation/thread/thread.h|   6 +-
>  test/validation/time/time.c|  23 ++-
>  test/validation/time/time.h|   6 +-
>  test/validation/timer/timer.c  |  25 +--
>  test/validation/timer/timer.h  |   6 +-
>  44 files changed, 770 insertions(+), 412 deletions(-)
> 
> -- 
> 2.1.1
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/4] validation: add odp_cunit_update() to modify registered tests

2015-09-16 Thread Christophe Milard
On 16 September 2015 at 18:07, Stuart Haslam 
wrote:

> On Wed, Sep 16, 2015 at 05:03:38PM +0200, Christophe Milard wrote:
> > On 2015-09-16 10:42, Stuart Haslam wrote:
> > > Add an odp_cunit_update() function to allow some attributes of
> previously
> > > registered tests to be modified, such as whether it's active or not.
> > >
> > > Previously, registering and running tests was done in a single step;
> > >
> > > odp_cunit_run(testsuites);
> > >
> > > But this is now split;
> > >
> > > odp_cunit_register(testsuites);
> > > odp_cunit_update(testsuites_updates);
> > > odp_cunit_run();
> > >
> > > The odp_cunit_update() is optional and none of the currently defined
> > > tests use it, so there's no functional change in this patch.
> > >
> > > Signed-off-by: Stuart Haslam 
> > > ---
> > >  test/validation/buffer/buffer.c |   7 +-
> > >  test/validation/classification/classification.c |   7 +-
> > >  test/validation/common/odp_cunit_common.c   | 107
> ++--
> > >  test/validation/common/odp_cunit_common.h   |  11 ++-
> > >  test/validation/cpumask/cpumask.c   |   7 +-
> > >  test/validation/crypto/crypto.c |  10 ++-
> > >  test/validation/errno/errno.c   |   7 +-
> > >  test/validation/init/init.c |  29 ++-
> > >  test/validation/packet/packet.c |   7 +-
> > >  test/validation/pktio/pktio.c   |   7 +-
> > >  test/validation/pool/pool.c |   7 +-
> > >  test/validation/queue/queue.c   |   7 +-
> > >  test/validation/random/random.c |   7 +-
> > >  test/validation/scheduler/scheduler.c   |   7 +-
> > >  test/validation/shmem/shmem.c   |   7 +-
> > >  test/validation/synchronizers/synchronizers.c   |  10 ++-
> > >  test/validation/system/system.c |   7 +-
> > >  test/validation/thread/thread.c |   7 +-
> > >  test/validation/time/time.c |   7 +-
> > >  test/validation/timer/timer.c   |   7 +-
> > >  20 files changed, 245 insertions(+), 27 deletions(-)
> > >
> > > diff --git a/test/validation/buffer/buffer.c
> b/test/validation/buffer/buffer.c
> > > index 4600e59..257e95c 100644
> > > --- a/test/validation/buffer/buffer.c
> > > +++ b/test/validation/buffer/buffer.c
> > > @@ -153,5 +153,10 @@ odp_suiteinfo_t buffer_suites[] = {
> > >
> > >  int buffer_main(void)
> > >  {
> > > -   return odp_cunit_run(buffer_suites);
> > > +   int ret = odp_cunit_register(buffer_suites);
> > > +
> > > +   if (ret == 0)
> > > +   odp_cunit_run();
> > > +
> > > +   return ret;
> > >  }
> > > diff --git a/test/validation/classification/classification.c
> b/test/validation/classification/classification.c
> > > index b868c61..fe9a827 100644
> > > --- a/test/validation/classification/classification.c
> > > +++ b/test/validation/classification/classification.c
> > > @@ -23,5 +23,10 @@ odp_suiteinfo_t classification_suites[] = {
> > >
> > >  int classification_main(void)
> > >  {
> > > -   return odp_cunit_run(classification_suites);
> > > +   int ret = odp_cunit_register(classification_suites);
> > > +
> > > +   if (ret == 0)
> > > +   ret = odp_cunit_run();
> > > +
> > > +   return ret;
> > >  }
> > > diff --git a/test/validation/common/odp_cunit_common.c
> b/test/validation/common/odp_cunit_common.c
> > > index d63e87e..8b62370 100644
> > > --- a/test/validation/common/odp_cunit_common.c
> > > +++ b/test/validation/common/odp_cunit_common.c
> > > @@ -164,16 +164,99 @@ static int cunit_register_suites(odp_suiteinfo_t
> testsuites[])
> > > return 0;
> > >  }
> > >
> > > +static int cunit_update_test(odp_suiteinfo_t *sinfo,
> > > +odp_testinfo_t *updated_tinfo)
> > > +{
> > > +   odp_testinfo_t *tinfo;
> > > +
> > > +   for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++)
> > > +   if (strcmp(tinfo->testinfo.pName,
> > > +  updated_tinfo->testinfo.pName) == 0)
> > > +   break;
> > > +
> > > +   if (!tinfo || !tinfo->testinfo.pName)
> > > +   return -1;
> > > +
> > > +   tinfo->check_active = updated_tinfo->check_active;
> > > +
> > > +   return 0;
> > > +}
> >
> > Is the above function meant to update the tests or the test activity?
> > It looks like it only update the test activity...
> >
>
> This is just updating the local properties of the test (i.e. stuff
> that's in odp_testinfo_t but not in CU_TestInfo). The test function
> itself is modified by the call to CU_set_test_func() before this
> function is called. I'll rework it a little to make that clearer
> though.
>

Yes please... I understood from the code, but I felt the code did not match
the function name.
Why not calling it ...update_properties?

>
> > > +
> > > +static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo)
> > > +{
> > > +   

Re: [lng-odp] [PATCH 2/4] validation: add odp_cunit_update() to modify registered tests

2015-09-16 Thread Stuart Haslam
On Wed, Sep 16, 2015 at 05:03:38PM +0200, Christophe Milard wrote:
> On 2015-09-16 10:42, Stuart Haslam wrote:
> > Add an odp_cunit_update() function to allow some attributes of previously
> > registered tests to be modified, such as whether it's active or not.
> > 
> > Previously, registering and running tests was done in a single step;
> > 
> > odp_cunit_run(testsuites);
> > 
> > But this is now split;
> > 
> > odp_cunit_register(testsuites);
> > odp_cunit_update(testsuites_updates);
> > odp_cunit_run();
> > 
> > The odp_cunit_update() is optional and none of the currently defined
> > tests use it, so there's no functional change in this patch.
> > 
> > Signed-off-by: Stuart Haslam 
> > ---
> >  test/validation/buffer/buffer.c |   7 +-
> >  test/validation/classification/classification.c |   7 +-
> >  test/validation/common/odp_cunit_common.c   | 107 
> > ++--
> >  test/validation/common/odp_cunit_common.h   |  11 ++-
> >  test/validation/cpumask/cpumask.c   |   7 +-
> >  test/validation/crypto/crypto.c |  10 ++-
> >  test/validation/errno/errno.c   |   7 +-
> >  test/validation/init/init.c |  29 ++-
> >  test/validation/packet/packet.c |   7 +-
> >  test/validation/pktio/pktio.c   |   7 +-
> >  test/validation/pool/pool.c |   7 +-
> >  test/validation/queue/queue.c   |   7 +-
> >  test/validation/random/random.c |   7 +-
> >  test/validation/scheduler/scheduler.c   |   7 +-
> >  test/validation/shmem/shmem.c   |   7 +-
> >  test/validation/synchronizers/synchronizers.c   |  10 ++-
> >  test/validation/system/system.c |   7 +-
> >  test/validation/thread/thread.c |   7 +-
> >  test/validation/time/time.c |   7 +-
> >  test/validation/timer/timer.c   |   7 +-
> >  20 files changed, 245 insertions(+), 27 deletions(-)
> > 
> > diff --git a/test/validation/buffer/buffer.c 
> > b/test/validation/buffer/buffer.c
> > index 4600e59..257e95c 100644
> > --- a/test/validation/buffer/buffer.c
> > +++ b/test/validation/buffer/buffer.c
> > @@ -153,5 +153,10 @@ odp_suiteinfo_t buffer_suites[] = {
> >  
> >  int buffer_main(void)
> >  {
> > -   return odp_cunit_run(buffer_suites);
> > +   int ret = odp_cunit_register(buffer_suites);
> > +
> > +   if (ret == 0)
> > +   odp_cunit_run();
> > +
> > +   return ret;
> >  }
> > diff --git a/test/validation/classification/classification.c 
> > b/test/validation/classification/classification.c
> > index b868c61..fe9a827 100644
> > --- a/test/validation/classification/classification.c
> > +++ b/test/validation/classification/classification.c
> > @@ -23,5 +23,10 @@ odp_suiteinfo_t classification_suites[] = {
> >  
> >  int classification_main(void)
> >  {
> > -   return odp_cunit_run(classification_suites);
> > +   int ret = odp_cunit_register(classification_suites);
> > +
> > +   if (ret == 0)
> > +   ret = odp_cunit_run();
> > +
> > +   return ret;
> >  }
> > diff --git a/test/validation/common/odp_cunit_common.c 
> > b/test/validation/common/odp_cunit_common.c
> > index d63e87e..8b62370 100644
> > --- a/test/validation/common/odp_cunit_common.c
> > +++ b/test/validation/common/odp_cunit_common.c
> > @@ -164,16 +164,99 @@ static int cunit_register_suites(odp_suiteinfo_t 
> > testsuites[])
> > return 0;
> >  }
> >  
> > +static int cunit_update_test(odp_suiteinfo_t *sinfo,
> > +odp_testinfo_t *updated_tinfo)
> > +{
> > +   odp_testinfo_t *tinfo;
> > +
> > +   for (tinfo = sinfo->pTests; tinfo->testinfo.pName; tinfo++)
> > +   if (strcmp(tinfo->testinfo.pName,
> > +  updated_tinfo->testinfo.pName) == 0)
> > +   break;
> > +
> > +   if (!tinfo || !tinfo->testinfo.pName)
> > +   return -1;
> > +
> > +   tinfo->check_active = updated_tinfo->check_active;
> > +
> > +   return 0;
> > +}
> 
> Is the above function meant to update the tests or the test activity?
> It looks like it only update the test activity...
> 

This is just updating the local properties of the test (i.e. stuff
that's in odp_testinfo_t but not in CU_TestInfo). The test function
itself is modified by the call to CU_set_test_func() before this
function is called. I'll rework it a little to make that clearer
though.

> > +
> > +static int cunit_update_suite(odp_suiteinfo_t *updated_sinfo)
> > +{
> > +   CU_pSuite suite;
> > +   CU_pTest test;
> > +   odp_suiteinfo_t *sinfo;
> > +   odp_testinfo_t *tinfo;
> > +
> > +   /* find previously registered suite with matching name */
> > +   for (sinfo = global_testsuites; sinfo->pName; sinfo++)
> > +   if (strcmp(sinfo->pName, updated_sinfo->pName) == 0)
> > +   break;
> > +
> > +   if (!sinfo || !sinfo->pName) {
> > +   fprintf(stderr, "%s: 

[lng-odp] [API-NEXT PATCH v2] api: split documentation from definitions

2015-09-16 Thread Mike Holmes
Defines in config.h should be defined by the platform appropriately and
then possibly be exposed by APIs.
Start the clean up process by moving the API Doxygen documentation away
from the per platform definition.

Signed-off-by: Mike Holmes 
---
 include/odp/api/config.h| 21 -
 platform/linux-generic/include/odp/config.h | 27 ++-
 2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index bf88be8..cbf14d8 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -26,27 +26,22 @@ extern "C" {
 /**
  * Maximum number of pools
  */
-#define ODP_CONFIG_POOLS16
 
 /**
  * Maximum number of queues
  */
-#define ODP_CONFIG_QUEUES   1024
 
 /**
  * Number of scheduling priorities
  */
-#define ODP_CONFIG_SCHED_PRIOS  8
 
 /**
  * Number of scheduling groups
  */
-#define ODP_CONFIG_SCHED_GRPS  16
 
 /**
  * Maximum number of packet IO resources
  */
-#define ODP_CONFIG_PKTIO_ENTRIES 64
 
 /**
  * Minimum buffer alignment
@@ -54,7 +49,6 @@ extern "C" {
  * This defines the minimum supported buffer alignment. Requests for values
  * below this will be rounded up to this value.
  */
-#define ODP_CONFIG_BUFFER_ALIGN_MIN 16
 
 /**
  * Maximum buffer alignment
@@ -62,7 +56,6 @@ extern "C" {
  * This defines the maximum supported buffer alignment. Requests for values
  * above this will fail.
  */
-#define ODP_CONFIG_BUFFER_ALIGN_MAX (4*1024)
 
 /**
  * Default packet headroom
@@ -71,12 +64,7 @@ extern "C" {
  * have by default. The default apply to both ODP packet input and user
  * allocated packets. Implementations may reserve a larger than minimum 
headroom
  * size e.g. due to HW or a protocol specific alignment requirement.
- *
- * @internal In linux-generic implementation:
- * The default value (66) allows a 1500-byte packet to be received into a 
single
- * segment with Ethernet offset alignment and room for some header expansion.
  */
-#define ODP_CONFIG_PACKET_HEADROOM 66
 
 /**
  * Default packet tailroom
@@ -87,7 +75,6 @@ extern "C" {
  * without restriction. Note that most implementations will automatically
  * consider any unused portion of the last segment of a packet as tailroom
  */
-#define ODP_CONFIG_PACKET_TAILROOM 0
 
 /**
  * Minimum packet segment length
@@ -96,7 +83,6 @@ extern "C" {
  * defined segment length (seg_len in odp_pool_param_t) will be rounded up into
  * this value.
  */
-#define ODP_CONFIG_PACKET_SEG_LEN_MIN (1598)
 
 /**
  * Maximum packet segment length
@@ -105,7 +91,6 @@ extern "C" {
  * defined segment length (seg_len in odp_pool_param_t) must not be larger than
  * this.
  */
-#define ODP_CONFIG_PACKET_SEG_LEN_MAX (64*1024)
 
 /**
  * Maximum packet buffer length
@@ -114,18 +99,12 @@ extern "C" {
  * (maximum return value of odp_packet_buf_len()). Attempts to allocate
  * (including default head- and tailrooms) or extend packets to sizes larger
  * than this limit will fail.
- *
- * @internal In linux-generic implementation:
- * - The value MUST be an integral number of segments
- * - The value SHOULD be large enough to accommodate jumbo packets (9K)
  */
-#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6)
 
 /** Maximum number of shared memory blocks.
  *
  * This the the number of separate SHM areas that can be reserved concurrently
  */
-#define ODP_CONFIG_SHM_BLOCKS (ODP_CONFIG_POOLS + 48)
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp/config.h 
b/platform/linux-generic/include/odp/config.h
index 6fecd38..76018a6 100644
--- a/platform/linux-generic/include/odp/config.h
+++ b/platform/linux-generic/include/odp/config.h
@@ -7,7 +7,7 @@
 /**
  * @file
  *
- * ODP configuration
+ * ODP platform specific configuration for public API definitions
  */
 
 #ifndef ODP_PLAT_CONFIG_H_
@@ -19,6 +19,31 @@ extern "C" {
 
 #include 
 
+#define ODP_CONFIG_MAX_THREADS  128
+#define ODP_CONFIG_POOLS16
+#define ODP_CONFIG_QUEUES   1024
+#define ODP_CONFIG_SCHED_PRIOS  8
+#define ODP_CONFIG_SCHED_GRPS  16
+#define ODP_CONFIG_PKTIO_ENTRIES 64
+#define ODP_CONFIG_BUFFER_ALIGN_MIN 1
+#define ODP_CONFIG_BUFFER_ALIGN_MAX (4 * 1024)
+/*
+ * @internal In linux-generic implementation:
+ * The default value (66) allows a 1500-byte packet to be received into a 
single
+ * segment with Ethernet offset alignment and room for some header expansion.
+ */
+#define ODP_CONFIG_PACKET_HEADROOM 66
+#define ODP_CONFIG_PACKET_TAILROOM 0
+#define ODP_CONFIG_PACKET_SEG_LEN_MIN (1598)
+#define ODP_CONFIG_PACKET_SEG_LEN_MAX (64 * 1024)
+/*
+ * @internal In linux-generic implementation:
+ * - The value MUST be an integral number of segments
+ * - The value SHOULD be large enough to accommodate jumbo packets (9K)
+ */
+#define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN * 6)
+#define ODP_CONFIG_SHM_BLOCKS (ODP_CONFIG_POOLS + 48)
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.1.4


[lng-odp] [API-NEXT] linux-generic: makefile: fix distcheck failure

2015-09-16 Thread Mike Holmes
Fixes https://bugs.linaro.org/show_bug.cgi?id=1813

make distcheck results in
../../../platform/linux-generic/include/odp_buffer_internal.h:33:33:
fatal error: odp_config_internal.h: No such file or director

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 65a78da..202ec6a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -126,6 +126,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_classification_datamodel.h \
  ${srcdir}/include/odp_classification_inlines.h \
  ${srcdir}/include/odp_classification_internal.h \
+ ${srcdir}/include/odp_config_internal.h \
  ${srcdir}/include/odp_crypto_internal.h \
  ${srcdir}/include/odp_debug_internal.h \
  ${srcdir}/include/odp_forward_typedefs_internal.h \
-- 
2.1.4

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


[lng-odp] [PATCH] linux-generic: makefile: fix distcheck failure

2015-09-16 Thread Mike Holmes
Fixes https://bugs.linaro.org/show_bug.cgi?id=1813

make distcheck results in
../../../platform/linux-generic/include/odp_buffer_internal.h:33:33:
fatal error: odp_config_internal.h: No such file or director

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 65a78da..202ec6a 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -126,6 +126,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_classification_datamodel.h \
  ${srcdir}/include/odp_classification_inlines.h \
  ${srcdir}/include/odp_classification_internal.h \
+ ${srcdir}/include/odp_config_internal.h \
  ${srcdir}/include/odp_crypto_internal.h \
  ${srcdir}/include/odp_debug_internal.h \
  ${srcdir}/include/odp_forward_typedefs_internal.h \
-- 
2.1.4

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


[lng-odp] [Bug 1813] API-NEXT make distcheck fails

2015-09-16 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1813

--- Comment #1 from Mike Holmes  ---
Patch sent http://patches.opendataplane.org/patch/3101/

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


[lng-odp] [Bug 1813] New: API-NEXT make distcheck fails

2015-09-16 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1813

Bug ID: 1813
   Summary: API-NEXT make distcheck fails
   Product: OpenDataPlane - linux- generic reference
   Version: 1.3
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: Build system
  Assignee: anders.rox...@linaro.org
  Reporter: mike.hol...@linaro.org
CC: lng-odp@lists.linaro.org

make distcheck

make[1]: Entering directory '/home/mike/git/odp/opendataplane-1.3.0.0/_build'
Making all in platform/linux-generic
make[2]: Entering directory
'/home/mike/git/odp/opendataplane-1.3.0.0/_build/platform/linux-generic'
  CC   odp_barrier.lo
  CC   odp_buffer.lo
In file included from
../../../platform/linux-generic/include/odp_pool_internal.h:25:0,
 from ../../../platform/linux-generic/odp_buffer.c:8:
../../../platform/linux-generic/include/odp_buffer_internal.h:33:33: fatal
error: odp_config_internal.h: No such file or directory
 #include 
 ^
compilation terminated.
Makefile:729: recipe for target 'odp_buffer.lo' failed

Was added to api-next without a full test using make distcheck

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


Re: [lng-odp] [API-NEXT] linux-generic: makefile: fix distcheck failure

2015-09-16 Thread Bill Fischofer
On Wed, Sep 16, 2015 at 2:48 PM, Mike Holmes  wrote:

> Fixes https://bugs.linaro.org/show_bug.cgi?id=1813
>
> make distcheck results in
> ../../../platform/linux-generic/include/odp_buffer_internal.h:33:33:
> fatal error: odp_config_internal.h: No such file or director
>
> Signed-off-by: Mike Holmes 
>

Reviewed-by: Bill Fischofer 


> ---
>  platform/linux-generic/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/platform/linux-generic/Makefile.am
> b/platform/linux-generic/Makefile.am
> index 65a78da..202ec6a 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -126,6 +126,7 @@ noinst_HEADERS = \
>   ${srcdir}/include/odp_classification_datamodel.h \
>   ${srcdir}/include/odp_classification_inlines.h \
>   ${srcdir}/include/odp_classification_internal.h \
> + ${srcdir}/include/odp_config_internal.h \
>   ${srcdir}/include/odp_crypto_internal.h \
>   ${srcdir}/include/odp_debug_internal.h \
>   ${srcdir}/include/odp_forward_typedefs_internal.h \
> --
> 2.1.4
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1813] API-NEXT make distcheck fails

2015-09-16 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1813

Mike Holmes  changed:

   What|Removed |Added

   Assignee|anders.rox...@linaro.org|mike.hol...@linaro.org
 Status|UNCONFIRMED |IN_PROGRESS
 CC||maxim.uva...@linaro.org,
   ||petri.savolai...@linaro.org
 Ever confirmed|0   |1

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


Re: [lng-odp] [PATCH 4/4] doc: implementers-guide: update section on skipping tests

2015-09-16 Thread Stuart Haslam
On Wed, Sep 16, 2015 at 05:19:28PM +0200, Christophe Milard wrote:
> On 2015-09-16 10:42, Stuart Haslam wrote:
> > Update sections describing how a specific platform may skip tests by
> > marking them as inactive.
> > 
> > Signed-off-by: Stuart Haslam 
> > ---
> >  doc/implementers-guide/implementers-guide.adoc | 58 
> > +-
> >  1 file changed, 48 insertions(+), 10 deletions(-)
> > 
> > diff --git a/doc/implementers-guide/implementers-guide.adoc 
> > b/doc/implementers-guide/implementers-guide.adoc
> > index 090d4e5..181d5c2 100644
> > --- a/doc/implementers-guide/implementers-guide.adoc
> > +++ b/doc/implementers-guide/implementers-guide.adoc
> > @@ -110,7 +110,7 @@ Module test and naming convention
> > *_test_+++*+++* +
> > where the suffix idendify the test.
> >  
> > -* Test arrays, i.e. arrays of CU_TestInfo, listing the test functions 
> > belonging to a suite, are called:
> > +* Test arrays, i.e. arrays of odp_testinfo_t, listing the test functions 
> > belonging to a suite, are called:
> > *_suite+++[_*]+++* +
> > where the possible suffix can be used if many suites are declared.
> >  
> > @@ -118,7 +118,7 @@ Module test and naming convention
> > *+++_suite[_*]_init()+++* and *+++_suite[_*]_term()+++* 
> > respectively. +
> > where the possible extra middle pattern can be used if many suites are 
> > declared.
> >  
> > -* Suite arrays, i.e. arrays of CU_SuiteInfo used in executables (C_UNIT 
> > registry) are called:
> > +* Suite arrays, i.e. arrays of odp_suiteinfo_t used in executables (C_UNIT 
> > registry) are called:
> > *+++_suites[_*]+++* +
> > where the possible suffix identifies the executable using it, if many.
> >  
> > @@ -232,14 +232,52 @@ Defining platform specific tests
> >  Sometimes, it may be necessary to call platform specific system calls to 
> > check some functionality: For instance, testing odp_cpumask_* could involve 
> > checking the underlying system CPU mask. On linux, such a test would 
> > require using the CPU_ISSET macro, which is linux specific. Such a test 
> > would be written in '/cpumask/...' The contents of this 
> > directory would be very similar to the contents of the platform agnostic 
> > side cpu_mask tests (including a Makefile.am...), but platform specific 
> > test would be written there.
> >  '/Makefile.am' would then trigger the building of the 
> > platform specific tests (by listing their module name in SUBDIRS and 
> > therefore calling the appropriate Makefile.am) and then it would call both 
> > the platform agnostic executable(s) and the platform specific test 
> > executable.
> >  
> > -Skipping tests during development
> > -^
> > -During ODP development, it may be useful to skip some test. This can be 
> > achieved by creating a new test executable (still on the platform side), 
> > picking up the required tests from the platform agnostic libtest.la.
> > +Marking tests as inactive
> > +^
> > +The general policy is that a full run of the validation suite (a "make 
> > check") must pass at all times. However a particular platform may have one 
> > or more test cases that are known to be unimplemented either during 
> > development or permanently, so to avoid these test cases being reported as 
> > failures it's useful to be able to skip them. This can be achieved by 
> > creating a new test executable (still on the platform side), giving the 
> > platform specific initialisation code the opportunity to modify the 
> > registered tests in order to mark unwanted tests as inactive while leaving 
> > the remaining tests active. It's important that the unwanted tests are 
> > still registered with the test framework to allow the fact that they're not 
> > being tested to be recorded.
> > +
> > +The odp_cunit_update() function is intended for this purpose, it is used 
> > to modify the properties of previously registered tests, for example to 
> > mark them as inactive. Inactive tests are registered with the test 
> > framework but aren't executed and will be recorded as inactive in test 
> > reports.
> > +
> > +In 'test/validation/foo/foo.c', define all tests for the 'foo' module;
> > +
> > +[source,c]
> > +--
> > +odp_testinfo_t foo_tests[] = {
> > +   ODP_TEST_INFO(foo_test_a),
> > +   ODP_TEST_INFO(foo_test_b),
> > +   ODP_TEST_INFO_NULL
> > +};
> > +
> > +odp_suiteinfo_t foo_suites[] = {
> > +   {"Foo", foo_suite_init, foo_suite_term, foo_tests},
> > +   ODP_SUITE_INFO_NULL
> > +};
> > +--
> > +
> > +In 'platform//test/foo/foo_main.c', register all the tests 
> > defined in the 'foo' module, then mark a single specific test case as 
> > inactive;
> > +
> > +[source,c]
> > +--
> > +static odp_testinfo_t foo_tests_updates[] = {
> > +   ODP_TEST_INFO_INACTIVE(foo_test_b),
> > +   ODP_TEST_INFO_NULL
> > +};
> > +
> > +static odp_suiteinfo_t foo_suites_updates[] = {