Re: [lng-odp] [API-NEXT PATCH v4] timer: allow timer processing to run on worker cores

2017-06-27 Thread Kevin Wang
Hi Petri,
Could you let me know which platform are you using and what's the command
line of your l2_fwd test?

​Kevin​

2017-06-26 20:34 GMT+08:00 Maxim Uvarov :

> On 06/26/17 13:50, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> > When init params are set to defaults...
> >
> >   odp_init_param_init(&init);
> >
> >   odp_init_global(&instance, &init, NULL);
> >
> >
> > ... this patch causes -15% (about 1Mpps per cpu) packet rate degradation
> with l2fwd. The timer poll function shows up as the second highest CPU
> cycle consumer on perf. The defaults needs to be less aggressive: a
> tradeoff between somewhat improved timer accuracy for some timer using
> applications vs. performance degradation for all application using the
> scheduler (also with the default inits)...
> >
> > The patch actually disables the polling when passing NULL as init param.
> API defines that NULL and odp_init_param_init(&init) result the same config
> ("all defaults"). This implementation mismatch helps now when most
> applications pass NULL, and thus timer polling is kept disabled by default.
> >
> > When contributing to a central piece of data plane code, it would be
> really important to measure packet rate before and after the change...
> >
> >
> > -Petri
> >
>
> Thank Petri,
>
> I opened bug to track this:
> https://bugs.linaro.org/show_bug.cgi?id=3078
>
> Maxim.
>
>
> >
> >
> >
> >
> > From: Maxim Uvarov [mailto:maxim.uva...@linaro.org]
> > Sent: Friday, June 23, 2017 5:23 PM
> > To: Honnappa Nagarahalli 
> > Cc: Brian Brooks ; Savolainen, Petri (Nokia -
> FI/Espoo) ; lng-odp-forward <
> lng-odp@lists.linaro.org>
> > Subject: Re: [lng-odp] [API-NEXT PATCH v4] timer: allow timer processing
> to run on worker cores
> >
> > Merged to api-next.
> > I think this patch is clean and we can do further improvements / tuning
> later.
> > Regards,
> > Maxim.
> >
> > On 22 June 2017 at 21:48, Honnappa Nagarahalli  honnappa.nagaraha...@linaro.org> wrote:
> > On 22 June 2017 at 10:30, Maxim Uvarov 
> wrote:
> >> On 06/22/17 17:55, Brian Brooks wrote:
> >>> On 06/22 10:27:01, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>  I was asking to make sure that performance impact has been checked
> also when timers are not used, e.g. l2fwd performance before and after the
> change. It would be also appropriate to test impact in the worst case:
> l2fwd type application + a periodic 1sec timeout. Timer is on, but timeouts
> come very unfrequently (compared to packets).
> 
>  It seems that no performance tests were run, although the change
> affects performance of many applications (e.g. OFP has high packet rate
> with timers). Configuration options should be set with  defaults that are
> acceptable trade-off between packet processing performance and timeout
> accuracy.
> >>>
> >>> If timers are not used, the overhead is just checking a RO variable
> >>> (post global init). If timers are used, CONFIG_ parameters have been
> >>> provided. The defaults for these parameters came from the work to
> >>> drastically reduce jitter of timer processing which is documented
> >>> here [1] and presented at Linaro Connect here [2].
> >>>
> >>> If you speculate that these defaults might need to be changed, e.g.
> >>> l2fwd, we welcome collaboration and data. But, this is not a blocking
> >>> issue for this patch right now.
> >>>
> >>> [1] https://docs.google.com/document/d/1sY7rOxqCNu-
> bMqjBiT5_keAIohrX1ZW-eL0oGLAQ4OM/edit?usp=sharing
> >>> [2] http://connect.linaro.org/resource/bud17/bud17-320/
> >>>
> >>
> >> 1) we have all adjustable configs here
> >> ./platform/linux-generic/include/odp_config_internal.h
> >> that might be also needs to be there.
> >>
> > That file has all the global config values. These are internal to this
> > timer implementation, hence they do not need to be moved.
> >>
> >> 2) Do we need something special in CI to check different config values?
> >
> > Nope.
> >>
> >> 3) Why it's compile time config values and not run time?
> >
> > These config values are particular to this timer implementation.
> > Similar to config values in
> > ./platform/linux-generic/include/odp_config_internal.h, these also
> > will be compile time constants.
> >
> >>
> >> Maxim.
> >>
> >>
>  -Petri
> 
> 
>  From: Maxim Uvarov [mailto:mailto:maxim.uva...@linaro.org]
>  Sent: Thursday, June 22, 2017 11:22 AM
>  To: Honnappa Nagarahalli 
>  Cc: Savolainen, Petri (Nokia - FI/Espoo)  nokia.com>; lng-odp-forward 
>  Subject: Re: [lng-odp] [API-NEXT PATCH v4] timer: allow timer
> processing to run on worker cores
> 
>  Petri, do you want to test performance before patch inclusion?
>  Maxim.
> 
>  On 21 June 2017 at 21:52, Honnappa Nagarahalli  honnappa.nagaraha...@linaro.org> wrote:
>  We have not run any performance application. In our Linaro connec

[lng-odp] [Linaro/odp] 0a3e5b: linux-generic: packet: add functions to optimize m...

2017-06-27 Thread GitHub
  Branch: refs/heads/cloud-dev
  Home:   https://github.com/Linaro/odp
  Commit: 0a3e5be140e77167173b9af4b72cdad8451aff71
  
https://github.com/Linaro/odp/commit/0a3e5be140e77167173b9af4b72cdad8451aff71
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-05-23 (Tue, 23 May 2017)

  Changed paths:
M platform/linux-generic/include/odp_packet_internal.h
M platform/linux-generic/odp_packet.c

  Log Message:
  ---
  linux-generic: packet: add functions to optimize memset and memcmp paths

Add function implementing memset and memcmp on packet object.

Signed-off-by: Dmitry Eremin-Solenikov 
Reviewed-by: 
Signed-off-by: Maxim Uvarov 


  Commit: 599ac6802352c9c56eca33a6004824783becaa6e
  
https://github.com/Linaro/odp/commit/599ac6802352c9c56eca33a6004824783becaa6e
  Author: Maxim Uvarov 
  Date:   2017-05-23 (Tue, 23 May 2017)

  Changed paths:
M .travis.yml

  Log Message:
  ---
  travis: check compile and run from install

Verify that odp app can be compiled and run from installed
odp library and includes.

Signed-off-by: Maxim Uvarov 
eviewed-by: Bill Fischofer 


  Commit: 3faf025987a1640983080a2743e58fbb3cbac55e
  
https://github.com/Linaro/odp/commit/3faf025987a1640983080a2743e58fbb3cbac55e
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-05-23 (Tue, 23 May 2017)

  Changed paths:
M include/odp/api/spec/ipsec.h

  Log Message:
  ---
  api: ipsec: factor out IP protocol version parameter

Instead of using 'magic' numbers for ip version in SA params, define new
enum to distinguish between IPv4 and IPv6.

Signed-off-by: Dmitry Eremin-Solenikov 
Reviewed-by: Petri Savolainen 
Signed-off-by: Maxim Uvarov 


  Commit: f20dee9db3da9425d8764e414b04cdcbd41bece8
  
https://github.com/Linaro/odp/commit/f20dee9db3da9425d8764e414b04cdcbd41bece8
  Author: Maxim Uvarov 
  Date:   2017-05-23 (Tue, 23 May 2017)

  Changed paths:
M .travis.yml

  Log Message:
  ---
  Merge branch 'master' into api-next


  Commit: 60b9dd435bf1be55794e5be6ee24714d28a5b587
  
https://github.com/Linaro/odp/commit/60b9dd435bf1be55794e5be6ee24714d28a5b587
  Author: Matias Elo 
  Date:   2017-05-23 (Tue, 23 May 2017)

  Changed paths:
M platform/linux-generic/odp_packet_io.c
M platform/linux-generic/odp_queue.c
M platform/linux-generic/odp_schedule.c
M platform/linux-generic/odp_schedule_iquery.c

  Log Message:
  ---
  linux-gen: sched: fix ordered enqueue to pktout queue

Make sure packet order is maintained if enqueueing packets from an ordered
queue.

Fixes https://bugs.linaro.org/show_bug.cgi?id=3002

Signed-off-by: Matias Elo 
Reviewed-and-tested-by: Yi He 
Signed-off-by: Maxim Uvarov 


  Commit: ea134fe159c0d249e4bed12b7269e8236afa0262
  
https://github.com/Linaro/odp/commit/ea134fe159c0d249e4bed12b7269e8236afa0262
  Author: Bogdan Pricope 
  Date:   2017-05-24 (Wed, 24 May 2017)

  Changed paths:
M example/generator/odp_generator.c

  Log Message:
  ---
  test: generator: replace gettimeofday with ODP API calls

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=2416

Signed-off-by: Bogdan Pricope 
Reviewed-and-tested-by: Yi He 
Signed-off-by: Maxim Uvarov 


  Commit: 2e36f75db71b230021cd907a5aadf39559683d16
  
https://github.com/Linaro/odp/commit/2e36f75db71b230021cd907a5aadf39559683d16
  Author: Maxim Uvarov 
  Date:   2017-05-25 (Thu, 25 May 2017)

  Changed paths:
M .travis.yml

  Log Message:
  ---
  travis: add linking with libconfig

libconfig is needed for api-next branch to compile the app.

Signed-off-by: Maxim Uvarov 
Reviewed-by: Dmitry Eremin-Solenikov 


  Commit: c5eb1703fe9e7529ae12ecf1799b757e1a992afd
  
https://github.com/Linaro/odp/commit/c5eb1703fe9e7529ae12ecf1799b757e1a992afd
  Author: Dmitry Eremin-Solenikov 
  Date:   2017-05-25 (Thu, 25 May 2017)

  Changed paths:
M test/linux-generic/pktio_ipc/pktio_ipc_run.sh

  Log Message:
  ---
  test: linux-generic: stop dropping other ODP files in pktio_ipc test

Prevent pktio_ipc test from removing sockets and SHM files used by other
applications.

Signed-off-by: Dmitry Eremin-Solenikov 
Reviewed-by: Bill Fischofer 
Signed-off-by: Maxim Uvarov 


  Commit: 552817483e9d4b6a84d49960920f1de50029f111
  
https://github.com/Linaro/odp/commit/552817483e9d4b6a84d49960920f1de50029f111
  Author: Maxim Uvarov 
  Date:   2017-05-25 (Thu, 25 May 2017)

  Changed paths:
M example/generator/odp_generator.c
M platform/linux-generic/odp_packet_io.c
M platform/linux-generic/odp_queue.c
M platform/linux-generic/odp_schedule.c
M platform/linux-generic/odp_schedule_iquery.c
M test/linux-generic/pktio_ipc/pktio_ipc_run.sh

  Log Message:
  ---
  Merge branch 'master' into api-next


  Commit: ba6cad6319b917c078dd0c20cd6b011637195898
  
https://github.com/Linaro/odp/commit/ba6cad6319b917c078dd0c20cd6b011637195898
  Author: Matias Elo 
  Date:   2017-05-25 (Thu, 25 May 2017)

  Changed paths:
M platform/linux-gener

[lng-odp] [PATCHv2] linux-gen: scheduler: modular scheduler interface

2017-06-27 Thread Joyce Kong
The modular scheduler interface in odp_schedule_if.h includes functions
from pktio and queue. It needs to be cleaned out. The pktio/queue related
functions should be moved to pktio/queue internal header file.

Signed-off-by: Joyce Kong 
---
 platform/linux-generic/include/odp_packet_io_internal.h |  5 +
 platform/linux-generic/include/odp_queue_internal.h | 12 +++-
 platform/linux-generic/include/odp_schedule_if.h| 15 ---
 platform/linux-generic/odp_schedule.c   |  2 +-
 platform/linux-generic/odp_schedule_iquery.c|  2 +-
 platform/linux-generic/odp_schedule_sp.c|  2 ++
 6 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 89bb6f3..70bc44d 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -262,6 +262,11 @@ int single_recv_queue(pktio_entry_t *entry, int index, 
odp_packet_t packets[],
 int single_send_queue(pktio_entry_t *entry, int index,
  const odp_packet_t packets[], int num);
 
+/* Interface for the scheduler */
+int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[]);
+void sched_cb_pktio_stop_finalize(int pktio_index);
+int sched_cb_num_pktio(void);
+
 extern const pktio_if_ops_t netmap_pktio_ops;
 extern const pktio_if_ops_t dpdk_pktio_ops;
 extern const pktio_if_ops_t sock_mmsg_pktio_ops;
diff --git a/platform/linux-generic/include/odp_queue_internal.h 
b/platform/linux-generic/include/odp_queue_internal.h
index 560f826..452ecab 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -20,7 +20,6 @@ extern "C" {
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -94,6 +93,17 @@ int queue_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t 
*buf_hdr[], int num);
 void queue_lock(queue_entry_t *queue);
 void queue_unlock(queue_entry_t *queue);
 
+/* Interface for the scheduler */
+int sched_cb_num_queues(void);
+int sched_cb_queue_prio(uint32_t queue_index);
+int sched_cb_queue_grp(uint32_t queue_index);
+int sched_cb_queue_is_ordered(uint32_t queue_index);
+int sched_cb_queue_is_atomic(uint32_t queue_index);
+odp_queue_t sched_cb_queue_handle(uint32_t queue_index);
+void sched_cb_queue_destroy_finalize(uint32_t queue_index);
+int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num);
+int sched_cb_queue_empty(uint32_t queue_index);
+
 static inline uint32_t queue_to_id(odp_queue_t handle)
 {
return _odp_typeval(handle) - 1;
diff --git a/platform/linux-generic/include/odp_schedule_if.h 
b/platform/linux-generic/include/odp_schedule_if.h
index 530d157..8dae081 100644
--- a/platform/linux-generic/include/odp_schedule_if.h
+++ b/platform/linux-generic/include/odp_schedule_if.h
@@ -11,7 +11,6 @@
 extern "C" {
 #endif
 
-#include 
 #include 
 #include 
 
@@ -60,20 +59,6 @@ typedef struct schedule_fn_t {
 /* Interface towards the scheduler */
 extern const schedule_fn_t *sched_fn;
 
-/* Interface for the scheduler */
-int sched_cb_pktin_poll(int pktio_index, int num_queue, int index[]);
-void sched_cb_pktio_stop_finalize(int pktio_index);
-int sched_cb_num_pktio(void);
-int sched_cb_num_queues(void);
-int sched_cb_queue_prio(uint32_t queue_index);
-int sched_cb_queue_grp(uint32_t queue_index);
-int sched_cb_queue_is_ordered(uint32_t queue_index);
-int sched_cb_queue_is_atomic(uint32_t queue_index);
-odp_queue_t sched_cb_queue_handle(uint32_t queue_index);
-void sched_cb_queue_destroy_finalize(uint32_t queue_index);
-int sched_cb_queue_deq_multi(uint32_t queue_index, odp_event_t ev[], int num);
-int sched_cb_queue_empty(uint32_t queue_index);
-
 /* API functions */
 typedef struct {
uint64_t (*schedule_wait_time)(uint64_t);
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index c4567d8..d33fac2 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -6,7 +6,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -23,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Number of priority levels  */
 #define NUM_PRIO 8
diff --git a/platform/linux-generic/odp_schedule_iquery.c 
b/platform/linux-generic/odp_schedule_iquery.c
index 75470af..7d1991f 100644
--- a/platform/linux-generic/odp_schedule_iquery.c
+++ b/platform/linux-generic/odp_schedule_iquery.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -13,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/platform/linux-generic/odp_schedule_sp.c 
b/platform/linux-generic/odp_schedule_sp.c
index 0fd4d87..0719844 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -15,6 +15,8

Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Dmitry Eremin-Solenikov
On 27.06.2017 18:51, Maxim Uvarov wrote:
> On 06/27/17 16:17, Dmitry Eremin-Solenikov wrote:
>> On 27.06.2017 16:15, Maxim Uvarov wrote:
>>> On 06/27/17 16:00, Github ODP bot wrote:
 +  - env echo -e 'Provides\x3a multiarch-support, 
 debconf, debconf-2.0' > dummy
>>> typo
>>
>> Where?
>>
> what is "\x3a" ?

See the comment above. Travis responds badly to colon in the command
line, so I had to use hex escape sequence.

-- 
With best wishes
Dmitry


[lng-odp] [PATCH] build: fix 64-bit atomics detection

2017-06-27 Thread Brian Brooks
Use uint64_t instead of int type.

This resolves ipfragreass build breakage with clang on 32-bit systems.

Signed-off-by: Brian Brooks 
---
 platform/linux-generic/m4/configure.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index e1197f60..c8164b8c 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -34,10 +34,11 @@ use_libatomic=no
 AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
 AC_LINK_IFELSE(
   [AC_LANG_SOURCE([[
-static int loc;
+#include 
+static uint64_t loc;
 int main(void)
 {
-int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
 return 0;
 }
 ]])],
-- 
2.13.1



Re: [lng-odp] [PATCH] linux-gen: time: use true hz

2017-06-27 Thread Brian Brooks
On 06/27 07:43:19, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> 
> 
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Brian
> > Brooks
> > Sent: Monday, June 26, 2017 9:21 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] linux-gen: time: use true hz
> > 
> > Use true hz value instead of dividing by 10.
> > 
> > The architected timer in ARM SoCs generally have a lower
> > frequency than IA TSC. It is detrimental to divide the
> > hertz by ten in this case. This is causing time validation
> > failures on ARM systems where the architected timer runs
> > at 50MHz.
> > 
> > Signed-off-by: Brian Brooks 
> > ---
> >  platform/linux-generic/odp_time.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> > generic/odp_time.c
> > index 2bbe5666..a831cc51 100644
> > --- a/platform/linux-generic/odp_time.c
> > +++ b/platform/linux-generic/odp_time.c
> > @@ -102,9 +102,7 @@ static inline odp_time_t time_hw_cur(void)
> > 
> >  static inline uint64_t time_hw_res(void)
> >  {
> > -   /* Promise a bit lower resolution than average cycle counter
> > -* frequency */
> > -   return global.hw_freq_hz / 10;
> > +   return global.hw_freq_hz;
> >  }
> > 
> >  static inline uint64_t time_hw_to_ns(odp_time_t time)
> > --
> > 2.13.1
> 
> 
> Did you test this change on x86? This should cause test failures on x86.

Yes, tests passed on x86 2.8GHz.

> You should fix the time test suite also. The suite converts Hz resolution to 
> ns resolution here:
> 
> static void time_test_res(time_res_cb time_res, uint64_t *res)
> {
>   uint64_t rate;
> 
>   rate = time_res();
>   CU_ASSERT(rate > MIN_TIME_RATE);
>   CU_ASSERT(rate < MAX_TIME_RATE);
> 
>   *res = ODP_TIME_SEC_IN_NS / rate;
>   if (ODP_TIME_SEC_IN_NS % rate)
>   (*res)++;
> }
> 
> When TSC resolution is >1GHz, the ns resolution is zero and there is no 
> margin for rounding errors. 

Actually, ns resolution is one.

> static void time_test_conversion(time_from_ns_cb time_from_ns, uint64_t res)
> {
>   uint64_t ns1, ns2;
>   odp_time_t time;
>   uint64_t upper_limit, lower_limit;
> 
>   ns1 = 100;
>   time = time_from_ns(ns1);
> 
>   ns2 = odp_time_to_ns(time);
> 
>   /* need to check within arithmetic tolerance that the same
>* value in ns is returned after conversions */
>   upper_limit = ns1 + res;
>   lower_limit = ns1 - res;
>   CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit)); 
> 
> 
> The error margin needs to be changed from ns resolution to something else. I 
> think it should be just a percentage from the original value (floating point 
> math) e.g. +-20% throughout the test suite.

As long as the tick values read from the CPU are converted to nanoseconds
using the true frequency of the tick counter (true for code in odp_time.c)
I think reporting a resolution 1ns for >1GHz might be fine.

> -Petri
> 
> 


Re: [lng-odp] [PATCH] build: fix 64-bit atomics detection

2017-06-27 Thread Maxim Uvarov
On 27 June 2017 at 22:58, Brian Brooks  wrote:

> Use uint64_t instead of int type.
>
> This resolves ipfragreass build breakage with clang on 32-bit systems.
>
> Change-Id: I23b9b6a46cbfaeff99116dac9c22e86629cbdf24
>


looks ok for me, but please remove change-id and add sign-off.

Maxim.


> ---
>  platform/linux-generic/m4/configure.m4 | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/m4/configure.m4
> b/platform/linux-generic/m4/configure.m4
> index e1197f60..c8164b8c 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -34,10 +34,11 @@ use_libatomic=no
>  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
>  AC_LINK_IFELSE(
>[AC_LANG_SOURCE([[
> -static int loc;
> +#include 
> +static uint64_t loc;
>  int main(void)
>  {
> -int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
>  return 0;
>  }
>  ]])],
> --
> 2.13.1
>
>


[lng-odp] [PATCH] build: fix 64-bit atomics detection

2017-06-27 Thread Brian Brooks
Use uint64_t instead of int type.

This resolves ipfragreass build breakage with clang on 32-bit systems.

Change-Id: I23b9b6a46cbfaeff99116dac9c22e86629cbdf24
---
 platform/linux-generic/m4/configure.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index e1197f60..c8164b8c 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -34,10 +34,11 @@ use_libatomic=no
 AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
 AC_LINK_IFELSE(
   [AC_LANG_SOURCE([[
-static int loc;
+#include 
+static uint64_t loc;
 int main(void)
 {
-int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
 return 0;
 }
 ]])],
-- 
2.13.1



Re: [lng-odp] [PATCH] build: better atomics detection

2017-06-27 Thread Brian Brooks
On 06/27 07:51:30, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> 
> 
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Brian
> > Brooks
> > Sent: Monday, June 26, 2017 9:21 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] build: better atomics detection
> > 
> > Do not optimize away the result of an atomic operation
> > during atomics detection in configure stage of build.
> > 
> > This resolves ipfragreass build breakage with clang on
> > 32-bit systems.
> > 
> > Signed-off-by: Brian Brooks 
> > ---
> >  platform/linux-generic/m4/configure.m4 | 9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-
> > generic/m4/configure.m4
> > index e1197f60..af645e05 100644
> > --- a/platform/linux-generic/m4/configure.m4
> > +++ b/platform/linux-generic/m4/configure.m4
> > @@ -34,10 +34,13 @@ use_libatomic=no
> >  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
> >  AC_LINK_IFELSE(
> >[AC_LANG_SOURCE([[
> > -static int loc;
> > +#include 
> > +static uint64_t loc;
> >  int main(void)
> >  {
> > -int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> > +uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> 
> Wouldn't volatile work. I'd avoid inline asm here if it can be avoided.

Actually, just the type change int -> u64 is all that is needed.

I added the memory clobber first, which prevented the opt. And then
noticed there was an issue with the type. Clang doesn't opt if the
type is u64 and clobber removed.

Perhaps it has something to do with not optimizing away a call to
outside the translation unit (since it could have side effects) even
if the return value is not used.

We really just want to check for whether a call to __atomic_xxx()
exists or not. If not, then the atomics are supported without needing
-latomic, and it doesn't matter if the code is optimized away.

> volatile uint64_t prev = ...;
> 
> -Petri
> 
> 


[lng-odp] [Linaro/odp] c6a309: configure: remove dependency of autoconf-archive

2017-06-27 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/Linaro/odp
  Commit: c6a309f00f882fabe70fa535ebe8b765f6e9bd11
  
https://github.com/Linaro/odp/commit/c6a309f00f882fabe70fa535ebe8b765f6e9bd11
  Author: Maxim Uvarov 
  Date:   2017-06-27 (Tue, 27 Jun 2017)

  Changed paths:
M .travis.yml
M DEPENDENCIES
A m4/ax_check_compile_flag.m4

  Log Message:
  ---
  configure: remove dependency of autoconf-archive

autoconf-archive is not available on some build environment
Number of projects simple have local copy of this file.
Do the same thing.

Signed-off-by: Maxim Uvarov 
Reviewed-by: Dmitry Eremin-Solenikov 




Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Maxim Uvarov
On 06/27/17 16:17, Dmitry Eremin-Solenikov wrote:
> On 27.06.2017 16:15, Maxim Uvarov wrote:
>> On 06/27/17 16:00, Github ODP bot wrote:
>>> +  - env echo -e 'Provides\x3a multiarch-support, 
>>> debconf, debconf-2.0' > dummy
>> typo
> 
> Where?
> 
what is "\x3a" ?

Maxim.



Re: [lng-odp] [API-NEXT PATCH v3] api: pool: additional packet length configuration

2017-06-27 Thread Bala Manoharan
Regards,
Bala

On 15 June 2017 at 19:51, Petri Savolainen 
wrote:

> Added packet pool parameters for more fine grained pool
> configuration. The basic usage of the parameters is not changed,
> except that implementation may now round up 'num' by default.
> Application can limit the round up with new 'max_num' parameter.
> Another new parameter (opt) allows application give hints and
> requirements about e.g. memory to be used for a pool (or parts
> of the pool).
>
> Additionally, pool configuration may be extended with a table of
> num/len/opt values. This gives application more flexibility to
> specify requirements for various packet sizes.
>
> For example, the new specification allows to create this kind of
> pool:
>
> ^
> |
> max_num | - - - - - - - -
> |
> |   *
> NUM |   * *
> |   * * *
> | o * * * *
> | o * * * * *
> +--->
>   LEN
>
> o == small number of short packets into fast memory
> * == all other packets into DDR
>
> Signed-off-by: Petri Savolainen 
> ---
>  include/odp/api/spec/pool.h | 132 ++
> +-
>  1 file changed, 118 insertions(+), 14 deletions(-)
>
> diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
> index 6fc5b6b4..6b4e7495 100644
> --- a/include/odp/api/spec/pool.h
> +++ b/include/odp/api/spec/pool.h
> @@ -41,6 +41,9 @@ extern "C" {
>   * Maximum pool name length in chars including null char
>   */
>
> +/** Maximum number of packet pool subparameters */
> +#define ODP_POOL_PKT_SUB_MAX  7
> +
>  /**
>   * Pool capabilities
>   */
> @@ -156,6 +159,30 @@ typedef struct odp_pool_capability_t {
>  int odp_pool_capability(odp_pool_capability_t *capa);
>
>  /**
> + * Pool memory type
> + */
> +typedef enum odp_pool_mem_type_t {
> +   /** Default memory type */
> +   ODP_POOL_MEM_DEFAULT = 0,
> +
> +   /** Fast memory. Some implementations may have a restricted amount
> of
> +*  (e.g. chip internal) pool memory that is faster access than the
> +*  default memory type. */
> +   ODP_POOL_MEM_FAST
> +
> +} odp_pool_mem_type_t;
>

We need to add this to capability for implementations to expose which is
supported.

> +
> +/**
> + * Additional options for packet pool creation
> + */
> +typedef struct odp_pool_pkt_opt_t {
> +   /** Pool memory type. Hint which memory type should be used for the
> +*  pool or a subset of the pool. */
> +   odp_pool_mem_type_t mem_type;
> +
> +} odp_pool_pkt_opt_t;
> +
> +/**
>   * Pool parameters
>   * Used to communicate pool creation options.
>   * @note A single thread may not be able to allocate all 'num' elements
> @@ -185,35 +212,96 @@ typedef struct odp_pool_param_t {
>
> /** Parameters for packet pools */
> struct {
> -   /** The number of packets that the pool must
> provide
> -   that are packet length 'len' bytes or smaller.
> -   The maximum value is defined by pool capability
> -   pkt.max_num. */
> +   /** The minimum number of packets that are packet
> length
> +*  'len' bytes or smaller. The maximum value is
> defined
> +*  by pool capability pkt.max_num. An
> implementation
> +*  may round up the value, as long as the
> 'max_num'
> +*  parameter below is not violated.
> +*/
> uint32_t num;
>
> -   /** Minimum packet length that the pool must
> provide
> -   'num' packets. The number of packets may be
> less
> -   than 'num' when packets are larger than 'len'.
> -   The maximum value is defined by pool capability
> -   pkt.max_len. Use 0 for default. */
> +   /** The minimum packet length that at least 'num'
> +*  packets are required. The maximum value is
> defined
> +*  by pool capability pkt.max_len. Use 0 for
> default.
> +*/
> uint32_t len;
>
> +   /** Packet pool options
> +*
> +*  Options contain additional hints and
> requirements,
> +*  which quide implementation e.g. to select
> correct
> +*  memory type for the pool.
> +*/
> +   odp_pool_pkt_opt_t opt;
>

 If lets say the implementation does not support MEM_FAST then it could be
documented saying it will revert to DEFAULT memory type.

+
> +   /** Number of subparameters
> +*
> +*  The number of subparameter table (pkt.sub[])
> entries
> + 

Re: [lng-odp] [API-NEXT, PATCH v4 1/1] comp: compression API

2017-06-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: shally verma [mailto:shallyvermacav...@gmail.com]
> Sent: Tuesday, June 27, 2017 12:31 PM
> To: Savolainen, Petri (Nokia - FI/Espoo) 
> Cc: lng-odp-forward ; Mahipal Challa
> ; pathr...@cavium.com; Shally Verma
> 
> Subject: Re: [lng-odp] [API-NEXT, PATCH v4 1/1] comp: compression API
> 
> On Tue, Jun 27, 2017 at 2:51 PM, Savolainen, Petri (Nokia - FI/Espoo)
>  wrote:
> >> > diff --git a/platform/linux-
> generic/include/odp/api/plat/event_types.h
> >> b/platform/linux-generic/include/odp/api/plat/event_types.h
> >> > index 0f51783..adf2c31 100644
> >> > --- a/platform/linux-generic/include/odp/api/plat/event_types.h
> >> > +++ b/platform/linux-generic/include/odp/api/plat/event_types.h
> >> > @@ -4,7 +4,6 @@
> >> >   * SPDX-License-Identifier: BSD-3-Clause
> >> >   */
> >> >
> >> > -
> >> >  /**
> >> >   * @file
> >> >   *
> >> > @@ -39,7 +38,9 @@ typedef enum odp_event_type_t {
> >> > ODP_EVENT_PACKET   = 2,
> >> > ODP_EVENT_TIMEOUT  = 3,
> >> > ODP_EVENT_CRYPTO_COMPL = 4,
> >> > -   ODP_EVENT_IPSEC_RESULT = 5
> >> > +   ODP_EVENT_IPSEC_RESULT = 5,
> >> > +   ODP_EVENT_COMP_COMPL   = 6,
> >> > +   ODP_EVENT_DECOMP_COMPL = 7
> >> >  } odp_event_type_t;
> >
> > Event subtypes are now in api-next. This needs to be rebased on top of
> that. Part of the rebase is definition of results as ODP_EVENT_PACKET type
> + ODP_EVENT_PACKET_COMP subtype (not as COMP_COMPL events). Only one
> subtype for comp, the same way as IPsec has ODP_EVENT_PACKET_IPSEC subtype
> which is for both in- and outbound IPsec. It would be preferable to align
> comp API to IPsec API also in other parts.
> 
> So you mean if application has both compression and decompression
> ongoing simultaneously, onus is on application to track whether event
> is from compress_enq() or decomp_enq() call ?
>

Application may use e.g. different destination queues for comp and decomp 
events. Also events may have metadata (session handle, direction enum, user 
written context, etc) which tells which direction results has been received. 
There are many options, but only single event subtype should be reserved, 
otherwise application's switch-case gets large (if ipsec/crypto/comp/... define 
multiple types).

-Petri



Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Maxim Uvarov
On 06/27/17 16:18, Dmitry Eremin-Solenikov wrote:
> On 27.06.2017 16:13, Maxim Uvarov wrote:
>> On 06/27/17 16:00, Github ODP bot wrote:
>>> -- ./bootstrap
>>> -- ./configure --enable-debug --enable-automated --enable-basic 
>>> --enable-console --enable-examples --enable-test
>>> +- libtoolize --force --copy
>>> +- aclocal
>>> +- autoheader
>>> +- automake --add-missing --include-deps --copy
>>> +- autoconf
>>> +- ./configure --enable-debug --enable-automated --enable-basic 
>>> --enable-console --enable-examples --enable-test $CROSS || cat config.log
>>>  - make
>>>  - sudo make install
>>>  - popd
>>>  - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
>>
>> I really would like that these lines match documentation. If in README
>> we say to run ./bootstrap it has to be here also.
> 
> It won't work, because bootstrap calls configure with improper
> arguments. E.g. I did not find a way to pass --host to it. So
> compilation of CUnit fails.
> 
ah, it's not odp, it's Cunit. Then we do not care. My comment was only
for ODP. Sorry for confusing..

Maxim.


[lng-odp] [API-NEXT PATCH 4/5] linux-gen: queue: combine queue interface functions

2017-06-27 Thread Petri Savolainen
Combine enqueue and dequeue function pointer set functions into
pktin/pktout calls so that queue interface size gets smaller and
code more readable. Also provide single call for TM.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/include/odp_queue_if.h | 30 +
 platform/linux-generic/odp_packet_io.c| 44 -
 platform/linux-generic/odp_queue.c| 46 +--
 platform/linux-generic/odp_traffic_mngr.c |  6 ++--
 4 files changed, 61 insertions(+), 65 deletions(-)

diff --git a/platform/linux-generic/include/odp_queue_if.h 
b/platform/linux-generic/include/odp_queue_if.h
index b5cbd515..ad807d75 100644
--- a/platform/linux-generic/include/odp_queue_if.h
+++ b/platform/linux-generic/include/odp_queue_if.h
@@ -61,17 +61,22 @@ typedef int (*queue_enq_multi_fn_t)(queue_t q_int, 
odp_buffer_hdr_t **, int);
 typedef odp_buffer_hdr_t *(*queue_deq_fn_t)(queue_t q_int);
 typedef int (*queue_deq_multi_fn_t)(queue_t q_int, odp_buffer_hdr_t **, int);
 typedef odp_pktout_queue_t (*queue_get_pktout_fn_t)(queue_t q_int);
-typedef void (*queue_set_pktout_fn_t)(queue_t q_int, odp_pktio_t pktio,
- int index);
 typedef odp_pktin_queue_t (*queue_get_pktin_fn_t)(queue_t q_int);
-typedef void (*queue_set_pktin_fn_t)(queue_t q_int, odp_pktio_t pktio,
-int index);
-typedef void (*queue_set_enq_fn_t)(queue_t q_int, queue_enq_fn_t func);
-typedef void (*queue_set_enq_multi_fn_t)(queue_t q_int,
-queue_enq_multi_fn_t func);
-typedef void (*queue_set_deq_fn_t)(queue_t q_int, queue_deq_fn_t func);
-typedef void (*queue_set_deq_multi_fn_t)(queue_t q_int,
-queue_deq_multi_fn_t func);
+typedef void (*queue_set_pktin_fn_t)(odp_queue_t handle, odp_pktio_t pktio,
+int idx,
+queue_enq_fn_t enq,
+queue_enq_multi_fn_t enq_multi,
+queue_deq_fn_t deq,
+queue_deq_multi_fn_t deq_multi);
+typedef void (*queue_set_pktout_fn_t)(odp_queue_t handle, odp_pktio_t pktio,
+ int idx,
+ queue_enq_fn_t enq,
+ queue_enq_multi_fn_t enq_multi,
+ queue_deq_fn_t deq,
+ queue_deq_multi_fn_t deq_multi);
+typedef void (*queue_set_enq_fn_t)(queue_t q_int,
+  queue_enq_fn_t enq,
+  queue_enq_multi_fn_t enq_multi);
 typedef void (*queue_set_type_fn_t)(queue_t q_int, odp_queue_type_t type);
 
 /* Queue functions towards other internal components */
@@ -90,10 +95,7 @@ typedef struct {
queue_set_pktout_fn_t set_pktout;
queue_get_pktin_fn_t get_pktin;
queue_set_pktin_fn_t set_pktin;
-   queue_set_enq_fn_t set_enq_fn;
-   queue_set_enq_multi_fn_t set_enq_multi_fn;
-   queue_set_deq_fn_t set_deq_fn;
-   queue_set_deq_multi_fn_t set_deq_multi_fn;
+   queue_set_enq_fn_t set_enq;
queue_set_type_fn_t set_type;
 } queue_fn_t;
 
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index f230db01..a48bbafb 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1156,30 +1156,30 @@ int odp_pktio_stats_reset(odp_pktio_t pktio)
return ret;
 }
 
-static int pktin_enqueue(queue_t q_int ODP_UNUSED,
-odp_buffer_hdr_t *buf_hdr ODP_UNUSED)
+static int abort_pktin_enqueue(queue_t q_int ODP_UNUSED,
+  odp_buffer_hdr_t *buf_hdr ODP_UNUSED)
 {
ODP_ABORT("attempted enqueue to a pktin queue");
return -1;
 }
 
-static int pktin_enq_multi(queue_t q_int ODP_UNUSED,
-  odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
-  int num ODP_UNUSED)
+static int abort_pktin_enq_multi(queue_t q_int ODP_UNUSED,
+odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
+int num ODP_UNUSED)
 {
ODP_ABORT("attempted enqueue to a pktin queue");
return 0;
 }
 
-static odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED)
+static odp_buffer_hdr_t *abort_pktout_dequeue(queue_t q_int ODP_UNUSED)
 {
ODP_ABORT("attempted dequeue from a pktout queue");
return NULL;
 }
 
-static int pktout_deq_multi(queue_t q_int ODP_UNUSED,
-   odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
-   int num ODP_UNUSED)
+static int abort_pktout_deq_multi(queue_t q_int ODP_UNUSED,
+ odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
+ int num ODP_UNUSED)
 {
ODP_ABORT("

[lng-odp] [API-NEXT PATCH 2/5] linux-gen: pktio: clean up and avoid conversion

2017-06-27 Thread Petri Savolainen
Remove references to qentry as it's not visible in this file
anymore. Avoid API handle to internal queue conversion on fast
path (sched_cb_pktin_poll()).

Signed-off-by: Petri Savolainen 
---
 .../linux-generic/include/odp_packet_io_internal.h |  3 +
 platform/linux-generic/odp_packet_io.c | 81 --
 2 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 89bb6f3a..17239444 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -24,6 +24,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -165,11 +166,13 @@ struct pktio_entry {
 
struct {
odp_queue_tqueue;
+   queue_tqueue_int;
odp_pktin_queue_t  pktin;
} in_queue[PKTIO_MAX_QUEUES];
 
struct {
odp_queue_tqueue;
+   queue_tqueue_int;
odp_pktout_queue_t pktout;
} out_queue[PKTIO_MAX_QUEUES];
 };
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 6ff35046..aa03495f 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -128,6 +128,7 @@ static void init_in_queues(pktio_entry_t *entry)
 
for (i = 0; i < PKTIO_MAX_QUEUES; i++) {
entry->s.in_queue[i].queue = ODP_QUEUE_INVALID;
+   entry->s.in_queue[i].queue_int = QUEUE_NULL;
entry->s.in_queue[i].pktin = PKTIN_INVALID;
}
 }
@@ -138,6 +139,7 @@ static void init_out_queues(pktio_entry_t *entry)
 
for (i = 0; i < PKTIO_MAX_QUEUES; i++) {
entry->s.out_queue[i].queue  = ODP_QUEUE_INVALID;
+   entry->s.out_queue[i].queue_int = QUEUE_NULL;
entry->s.out_queue[i].pktout = PKTOUT_INVALID;
}
 }
@@ -305,6 +307,7 @@ static void destroy_in_queues(pktio_entry_t *entry, int num)
if (entry->s.in_queue[i].queue != ODP_QUEUE_INVALID) {
odp_queue_destroy(entry->s.in_queue[i].queue);
entry->s.in_queue[i].queue = ODP_QUEUE_INVALID;
+   entry->s.in_queue[i].queue_int = QUEUE_NULL;
}
}
 }
@@ -318,6 +321,7 @@ static void destroy_out_queues(pktio_entry_t *entry, int 
num)
rc = odp_queue_destroy(entry->s.out_queue[i].queue);
ODP_ASSERT(rc == 0);
entry->s.out_queue[i].queue = ODP_QUEUE_INVALID;
+   entry->s.out_queue[i].queue_int = QUEUE_NULL;
}
}
 }
@@ -578,42 +582,42 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,
return num_rx;
 }
 
-int pktout_enqueue(queue_t qentry, odp_buffer_hdr_t *buf_hdr)
+int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr)
 {
odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);
int len = 1;
int nbr;
 
-   if (sched_fn->ord_enq_multi(qentry, (void **)buf_hdr, len, &nbr))
+   if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, len, &nbr))
return (nbr == len ? 0 : -1);
 
-   nbr = odp_pktout_send(queue_fn->get_pktout(qentry), &pkt, len);
+   nbr = odp_pktout_send(queue_fn->get_pktout(q_int), &pkt, len);
return (nbr == len ? 0 : -1);
 }
 
-odp_buffer_hdr_t *pktout_dequeue(queue_t qentry ODP_UNUSED)
+odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED)
 {
ODP_ABORT("attempted dequeue from a pktout queue");
return NULL;
 }
 
-int pktout_enq_multi(queue_t qentry, odp_buffer_hdr_t *buf_hdr[], int num)
+int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num)
 {
odp_packet_t pkt_tbl[QUEUE_MULTI_MAX];
int nbr;
int i;
 
-   if (sched_fn->ord_enq_multi(qentry, (void **)buf_hdr, num, &nbr))
+   if (sched_fn->ord_enq_multi(q_int, (void **)buf_hdr, num, &nbr))
return nbr;
 
for (i = 0; i < num; ++i)
pkt_tbl[i] = packet_from_buf_hdr(buf_hdr[i]);
 
-   nbr = odp_pktout_send(queue_fn->get_pktout(qentry), pkt_tbl, num);
+   nbr = odp_pktout_send(queue_fn->get_pktout(q_int), pkt_tbl, num);
return nbr;
 }
 
-int pktout_deq_multi(queue_t qentry ODP_UNUSED,
+int pktout_deq_multi(queue_t q_int ODP_UNUSED,
 odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
 int num ODP_UNUSED)
 {
@@ -621,49 +625,49 @@ int pktout_deq_multi(queue_t qentry ODP_UNUSED,
return 0;
 }
 
-int pktin_enqueue(queue_t qentry ODP_UNUSED,
+int pktin_enqueue(queue_t q_int ODP_UNUSED,
  odp_buffer_hdr_t *buf_hdr ODP_UNUSED)
 {
ODP_ABORT("attempted enqueue to a pktin queue");
return -1;
 }
 
-odp_buffer_hdr_t *pktin_dequeue(queue_t q

[lng-odp] [API-NEXT PATCH 3/5] linux-gen: pktio: remove unused header file

2017-06-27 Thread Petri Savolainen
odp_packet_io_queue.h is not needed anymore as the queue
interface has replaced it.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/Makefile.am |  1 -
 .../linux-generic/include/odp_packet_io_queue.h| 48 
 platform/linux-generic/odp_packet_io.c | 66 +++---
 platform/linux-generic/odp_queue.c |  1 -
 4 files changed, 33 insertions(+), 83 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_packet_io_queue.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 2293f7f0..2dda785f 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -172,7 +172,6 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_internal.h \
  ${srcdir}/include/odp_packet_io_internal.h \
  ${srcdir}/include/odp_packet_io_ipc_internal.h \
- ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_io_ring_internal.h \
  ${srcdir}/include/odp_packet_netmap.h \
  ${srcdir}/include/odp_packet_dpdk.h \
diff --git a/platform/linux-generic/include/odp_packet_io_queue.h 
b/platform/linux-generic/include/odp_packet_io_queue.h
deleted file mode 100644
index 71333ddc..
--- a/platform/linux-generic/include/odp_packet_io_queue.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-
-/**
- * @file
- *
- * ODP packet IO - implementation internal
- */
-
-#ifndef ODP_PACKET_IO_QUEUE_H_
-#define ODP_PACKET_IO_QUEUE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-#include 
-#include 
-
-/** Max nbr of pkts to receive in one burst (keep same as QUEUE_MULTI_MAX) */
-#define ODP_PKTIN_QUEUE_MAX_BURST CONFIG_BURST_SIZE
-/* pktin_deq_multi() depends on the condition: */
-ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX,
- "ODP_PKTIN_DEQ_MULTI_MAX_ERROR");
-
-int pktin_enqueue(queue_t queue, odp_buffer_hdr_t *buf_hdr);
-odp_buffer_hdr_t *pktin_dequeue(queue_t queue);
-
-int pktin_enq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num);
-int pktin_deq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num);
-
-
-int pktout_enqueue(queue_t queue, odp_buffer_hdr_t *buf_hdr);
-odp_buffer_hdr_t *pktout_dequeue(queue_t queue);
-
-int pktout_enq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num);
-int pktout_deq_multi(queue_t queue, odp_buffer_hdr_t *buf_hdr[], int num);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index aa03495f..f230db01 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -7,7 +7,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -582,7 +581,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,
return num_rx;
 }
 
-int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr)
+static int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t *buf_hdr)
 {
odp_packet_t pkt = packet_from_buf_hdr(buf_hdr);
int len = 1;
@@ -595,13 +594,7 @@ int pktout_enqueue(queue_t q_int, odp_buffer_hdr_t 
*buf_hdr)
return (nbr == len ? 0 : -1);
 }
 
-odp_buffer_hdr_t *pktout_dequeue(queue_t q_int ODP_UNUSED)
-{
-   ODP_ABORT("attempted dequeue from a pktout queue");
-   return NULL;
-}
-
-int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num)
+static int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int 
num)
 {
odp_packet_t pkt_tbl[QUEUE_MULTI_MAX];
int nbr;
@@ -617,22 +610,7 @@ int pktout_enq_multi(queue_t q_int, odp_buffer_hdr_t 
*buf_hdr[], int num)
return nbr;
 }
 
-int pktout_deq_multi(queue_t q_int ODP_UNUSED,
-odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED,
-int num ODP_UNUSED)
-{
-   ODP_ABORT("attempted dequeue from a pktout queue");
-   return 0;
-}
-
-int pktin_enqueue(queue_t q_int ODP_UNUSED,
- odp_buffer_hdr_t *buf_hdr ODP_UNUSED)
-{
-   ODP_ABORT("attempted enqueue to a pktin queue");
-   return -1;
-}
-
-odp_buffer_hdr_t *pktin_dequeue(queue_t q_int)
+static odp_buffer_hdr_t *pktin_dequeue(queue_t q_int)
 {
odp_buffer_hdr_t *buf_hdr;
odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX];
@@ -654,14 +632,7 @@ odp_buffer_hdr_t *pktin_dequeue(queue_t q_int)
return buf_hdr;
 }
 
-int pktin_enq_multi(queue_t q_int ODP_UNUSED,
-   odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, int num ODP_UNUSED)
-{
-   ODP_ABORT("attempted enqueue to a pktin queue");
-   return 0;
-}
-
-int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num)
+static int pktin_deq_multi(queue_t q_int, odp_buffer_hdr_t *buf_hdr[], int num)
 {
int

[lng-odp] [API-NEXT PATCH 0/5] Queue interface clean up

2017-06-27 Thread Petri Savolainen
Clean up queue interface definitions and usage. Remove unneccesary conversions,
accesses and functions. Remove unused header file. Don't use qentry as
a variable name when type is queue_t. Don't let TM to change queue type, 
since current API specifies only plain and sched queues as queue types.

Petri Savolainen (5):
  linux-gen: cls: avoid queue conversions
  linux-gen: pktio: clean up and avoid conversion
  linux-gen: pktio: remove unused header file
  linux-gen: queue: combine queue interface functions
  linux-gen: queue: remove type set from interface

 platform/linux-generic/Makefile.am |   1 -
 .../linux-generic/include/odp_packet_internal.h|   3 +-
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 .../linux-generic/include/odp_packet_io_queue.h|  48 
 platform/linux-generic/include/odp_queue_if.h  |  34 ++---
 platform/linux-generic/odp_classification.c|  10 +-
 platform/linux-generic/odp_packet_io.c | 137 ++---
 platform/linux-generic/odp_queue.c |  53 
 platform/linux-generic/odp_traffic_mngr.c  |  10 +-
 9 files changed, 121 insertions(+), 178 deletions(-)
 delete mode 100644 platform/linux-generic/include/odp_packet_io_queue.h

-- 
2.13.0



[lng-odp] [API-NEXT PATCH 1/5] linux-gen: cls: avoid queue conversions

2017-06-27 Thread Petri Savolainen
Use internal queue type instead of API handle. This way per
packet queue conversions are avoided.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/include/odp_packet_internal.h |  3 ++-
 platform/linux-generic/include/odp_queue_if.h|  2 ++
 platform/linux-generic/odp_classification.c  | 10 +-
 platform/linux-generic/odp_packet_io.c   |  4 +---
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index cdd139bb..d513f05e 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -27,6 +27,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 /** Minimum segment length expected by packet_parse_common() */
 #define PACKET_PARSE_SEG_LEN 96
@@ -126,7 +127,7 @@ typedef struct {
odp_time_t timestamp;
 
/* Classifier destination queue */
-   odp_queue_t dst_queue;
+   queue_t dst_queue;
 
/* Result for crypto */
odp_crypto_generic_op_result_t op_result;
diff --git a/platform/linux-generic/include/odp_queue_if.h 
b/platform/linux-generic/include/odp_queue_if.h
index 168d0e9e..b5cbd515 100644
--- a/platform/linux-generic/include/odp_queue_if.h
+++ b/platform/linux-generic/include/odp_queue_if.h
@@ -48,6 +48,8 @@ typedef struct {
 typedef struct { char dummy; } _queue_t;
 typedef _queue_t *queue_t;
 
+#define QUEUE_NULL ((queue_t)NULL)
+
 typedef int (*queue_init_global_fn_t)(void);
 typedef int (*queue_term_global_fn_t)(void);
 typedef int (*queue_init_local_fn_t)(void);
diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index 5f153e73..cc08b9f4 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -162,7 +162,7 @@ odp_cos_t odp_cls_cos_create(const char *name, 
odp_cls_cos_param_t *param)
 
/* Packets are dropped if Queue or Pool is invalid*/
if (param->queue == ODP_QUEUE_INVALID)
-   queue = NULL;
+   queue = QUEUE_NULL;
else
queue = queue_fn->from_ext(param->queue);
 
@@ -264,7 +264,7 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t 
queue_id)
/* Locking is not required as intermittent stale
data during CoS modification is acceptable*/
if (queue_id == ODP_QUEUE_INVALID)
-   cos->s.queue = NULL;
+   cos->s.queue = QUEUE_NULL;
else
cos->s.queue = queue_fn->from_ext(queue_id);
return 0;
@@ -279,7 +279,7 @@ odp_queue_t odp_cos_queue(odp_cos_t cos_id)
return ODP_QUEUE_INVALID;
}
 
-   if (!cos->s.queue)
+   if (cos->s.queue == QUEUE_NULL)
return ODP_QUEUE_INVALID;
 
return queue_fn->to_ext(cos->s.queue);
@@ -841,12 +841,12 @@ int cls_classify_packet(pktio_entry_t *entry, const 
uint8_t *base,
if (cos == NULL)
return -EINVAL;
 
-   if (cos->s.queue == NULL || cos->s.pool == ODP_POOL_INVALID)
+   if (cos->s.queue == QUEUE_NULL || cos->s.pool == ODP_POOL_INVALID)
return -EFAULT;
 
*pool = cos->s.pool;
pkt_hdr->p.input_flags.dst_queue = 1;
-   pkt_hdr->dst_queue = queue_fn->to_ext(cos->s.queue);
+   pkt_hdr->dst_queue = cos->s.queue;
 
return 0;
 }
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 4dd28549..6ff35046 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -566,11 +566,9 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue,
buf_hdr = packet_to_buf_hdr(pkt);
 
if (pkt_hdr->p.input_flags.dst_queue) {
-   queue_t dst_queue;
int ret;
 
-   dst_queue = queue_fn->from_ext(pkt_hdr->dst_queue);
-   ret = queue_fn->enq(dst_queue, buf_hdr);
+   ret = queue_fn->enq(pkt_hdr->dst_queue, buf_hdr);
if (ret < 0)
odp_packet_free(pkt);
continue;
-- 
2.13.0



[lng-odp] [API-NEXT PATCH 5/5] linux-gen: queue: remove type set from interface

2017-06-27 Thread Petri Savolainen
TM should not modify queue type, thus the interface function
is not needed for that.

Signed-off-by: Petri Savolainen 
---
 platform/linux-generic/include/odp_queue_if.h | 2 --
 platform/linux-generic/odp_queue.c| 8 +---
 platform/linux-generic/odp_traffic_mngr.c | 4 
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/platform/linux-generic/include/odp_queue_if.h 
b/platform/linux-generic/include/odp_queue_if.h
index ad807d75..604bb25a 100644
--- a/platform/linux-generic/include/odp_queue_if.h
+++ b/platform/linux-generic/include/odp_queue_if.h
@@ -77,7 +77,6 @@ typedef void (*queue_set_pktout_fn_t)(odp_queue_t handle, 
odp_pktio_t pktio,
 typedef void (*queue_set_enq_fn_t)(queue_t q_int,
   queue_enq_fn_t enq,
   queue_enq_multi_fn_t enq_multi);
-typedef void (*queue_set_type_fn_t)(queue_t q_int, odp_queue_type_t type);
 
 /* Queue functions towards other internal components */
 typedef struct {
@@ -96,7 +95,6 @@ typedef struct {
queue_get_pktin_fn_t get_pktin;
queue_set_pktin_fn_t set_pktin;
queue_set_enq_fn_t set_enq;
-   queue_set_type_fn_t set_type;
 } queue_fn_t;
 
 extern const queue_fn_t *queue_fn;
diff --git a/platform/linux-generic/odp_queue.c 
b/platform/linux-generic/odp_queue.c
index 6cbf1040..81e37822 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -823,11 +823,6 @@ static void queue_set_enq(queue_t q_int,
qentry->s.enqueue_multi = enq_multi;
 }
 
-static void queue_set_type(queue_t q_int, odp_queue_type_t type)
-{
-   qentry_from_int(q_int)->s.type = type;
-}
-
 static queue_t queue_from_ext(odp_queue_t handle)
 {
return qentry_to_int(handle_to_qentry(handle));
@@ -876,6 +871,5 @@ queue_fn_t queue_default_fn = {
.set_pktout = queue_set_pktout,
.get_pktin = queue_get_pktin,
.set_pktin = queue_set_pktin,
-   .set_enq = queue_set_enq,
-   .set_type = queue_set_type
+   .set_enq = queue_set_enq
 };
diff --git a/platform/linux-generic/odp_traffic_mngr.c 
b/platform/linux-generic/odp_traffic_mngr.c
index 04239884..c8ff0d07 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -37,9 +37,6 @@ static const pkt_desc_t EMPTY_PKT_DESC = { .word = 0 };
 #define MAX_PRIORITIES ODP_TM_MAX_PRIORITIES
 #define NUM_SHAPER_COLORS ODP_NUM_SHAPER_COLORS
 
-/* Traffic manager queue */
-#define QUEUE_TYPE_TM  4
-
 static tm_prop_t basic_prop_tbl[MAX_PRIORITIES][NUM_SHAPER_COLORS] = {
[0] = {
[ODP_TM_SHAPER_GREEN] = { 0, DECR_BOTH },
@@ -3926,7 +3923,6 @@ odp_tm_queue_t odp_tm_queue_create(odp_tm_t odp_tm,
return ODP_TM_INVALID;
}
tm_queue_obj->tm_qentry = queue_fn->from_ext(queue);
-   queue_fn->set_type(tm_queue_obj->tm_qentry, QUEUE_TYPE_TM);
queue_fn->set_enq(tm_queue_obj->tm_qentry,
  queue_tm_reenq,
  queue_tm_reenq_multi);
-- 
2.13.0



Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Dmitry Eremin-Solenikov
On 27.06.2017 16:13, Maxim Uvarov wrote:
> On 06/27/17 16:00, Github ODP bot wrote:
>> -- ./bootstrap
>> -- ./configure --enable-debug --enable-automated --enable-basic 
>> --enable-console --enable-examples --enable-test
>> +- libtoolize --force --copy
>> +- aclocal
>> +- autoheader
>> +- automake --add-missing --include-deps --copy
>> +- autoconf
>> +- ./configure --enable-debug --enable-automated --enable-basic 
>> --enable-console --enable-examples --enable-test $CROSS || cat config.log
>>  - make
>>  - sudo make install
>>  - popd
>>  - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
> 
> I really would like that these lines match documentation. If in README
> we say to run ./bootstrap it has to be here also.

It won't work, because bootstrap calls configure with improper
arguments. E.g. I did not find a way to pass --host to it. So
compilation of CUnit fails.

-- 
With best wishes
Dmitry


Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Dmitry Eremin-Solenikov
On 27.06.2017 16:15, Maxim Uvarov wrote:
> On 06/27/17 16:00, Github ODP bot wrote:
>> +  - env echo -e 'Provides\x3a multiarch-support, 
>> debconf, debconf-2.0' > dummy
> typo

Where?

-- 
With best wishes
Dmitry


Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Maxim Uvarov
On 06/27/17 16:00, Github ODP bot wrote:
> +  - env echo -e 'Provides\x3a multiarch-support, 
> debconf, debconf-2.0' > dummy
typo


Re: [lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Maxim Uvarov
On 06/27/17 16:00, Github ODP bot wrote:
> -- ./bootstrap
> -- ./configure --enable-debug --enable-automated --enable-basic 
> --enable-console --enable-examples --enable-test
> +- libtoolize --force --copy
> +- aclocal
> +- autoheader
> +- automake --add-missing --include-deps --copy
> +- autoconf
> +- ./configure --enable-debug --enable-automated --enable-basic 
> --enable-console --enable-examples --enable-test $CROSS || cat config.log
>  - make
>  - sudo make install
>  - popd
>  - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"

I really would like that these lines match documentation. If in README
we say to run ./bootstrap it has to be here also.

Maxim.


Re: [lng-odp] [PATCH v1 1/2] build: better atomics detection

2017-06-27 Thread Maxim Uvarov
On 06/27/17 16:00, Github ODP bot wrote:
> From: Brian Brooks 
> 
> Do not optimize away the result of an atomic operation
> during atomics detection in configure stage of build.
> 
> This resolves ipfragreass build breakage with clang on
> 32-bit systems.
> 
> [DES: fix check to stop using inline assembly]
> 
> Signed-off-by: Brian Brooks 
> Signed-off-by: Dmitry Eremin-Solenikov 
> ---
> /** Email created from pull request 60 (lumag:cross)
>  ** https://github.com/Linaro/odp/pull/60
>  ** Patch: https://github.com/Linaro/odp/pull/60.patch
>  ** Base sha: a4add29291572219143dc667db4e8a7832a5692b
>  ** Merge commit sha: 8dd9c8beb459d65838212e3d7bbba49762c50b4b
>  **/
>  platform/linux-generic/m4/configure.m4 | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/platform/linux-generic/m4/configure.m4 
> b/platform/linux-generic/m4/configure.m4
> index e1197f60..ed72c039 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -34,11 +34,12 @@ use_libatomic=no
>  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
>  AC_LINK_IFELSE(
>[AC_LANG_SOURCE([[
> -static int loc;
> +#include 
> +static uint64_t loc;
>  int main(void)
>  {
> -int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> -return 0;
> +uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +return prev & 0xff;
>  }
>  ]])],
>[AC_MSG_RESULT(no)],
> @@ -57,6 +58,8 @@ AC_LINK_IFELSE(
>  {
>  __int128 prev;
>  prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +// Do not optimize away prev
> +__asm__ volatile("" : : "g"(&prev) : "memory");

here the same return prev & 0xff also has to work.

Maxim.
>  return 0;
>  }
>  ]])],
> 



[lng-odp] [PATCH v1 2/2] travis: add cross-compilation checks

2017-06-27 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Include setup to cross-compile ODP for ARM hard float, ARM64 and PowerPC
targets.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 60 (lumag:cross)
 ** https://github.com/Linaro/odp/pull/60
 ** Patch: https://github.com/Linaro/odp/pull/60.patch
 ** Base sha: a4add29291572219143dc667db4e8a7832a5692b
 ** Merge commit sha: 8dd9c8beb459d65838212e3d7bbba49762c50b4b
 **/
 .travis.yml | 100 +++-
 1 file changed, 86 insertions(+), 14 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2cc8caf7..27be7d48 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,12 +38,15 @@ addons:
 apt:
 sources:
 - ubuntu-toolchain-r-test
-- llvm-toolchain-precise-3.8
 packages:
 - gcc
 - clang-3.8
 - automake autoconf autoconf-archive libtool 
libssl-dev graphviz mscgen doxygen
 - libpcap-dev
+- dpkg-cross equivs
+- gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu 
libc6-dev-arm64-cross
+- gcc-arm-linux-gnueabihf 
pkg-config-arm-linux-gnueabihf libc6-dev-armhf-cross
+- gcc-powerpc-linux-gnu pkg-config-powerpc-linux-gnu 
libc6-dev-powerpc-cross
 #coverity_scan:
 #project:
 #name: "$TRAVIS_REPO_SLUG"
@@ -62,30 +65,35 @@ env:
 - CONF="--enable-schedule-sp"
 - CONF="--enable-schedule-iquery"
 
-install:
-- echo 1000 | sudo tee /proc/sys/vm/nr_hugepages
-- sudo mkdir -p /mnt/huge
-- sudo mount -t hugetlbfs nodev /mnt/huge
-
-- sudo apt-get -qq update
-- sudo apt-get install linux-headers-`uname -r`
-- sudo pip install coverage
-- gem install asciidoctor
-- PATH=${PATH//:\.\/node_modules\/\.bin/}
-
+before_install:
 #   Install cunit for the validation tests because distro version is too 
old and fails C99 compile
 - sudo apt-get remove libcunit1-dev libcunit1
 - export CUNIT_VERSION=2.1-3
 - curl -sSOL 
https://github.com/Linaro/libcunit/releases/download/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2
 - tar -jxf *.bz2
 - pushd CUnit*
-- ./bootstrap
-- ./configure --enable-debug --enable-automated --enable-basic 
--enable-console --enable-examples --enable-test
+- libtoolize --force --copy
+- aclocal
+- autoheader
+- automake --add-missing --include-deps --copy
+- autoconf
+- ./configure --enable-debug --enable-automated --enable-basic 
--enable-console --enable-examples --enable-test $CROSS || cat config.log
 - make
 - sudo make install
 - popd
 - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
 
+install:
+- echo 1000 | sudo tee /proc/sys/vm/nr_hugepages
+- sudo mkdir -p /mnt/huge
+- sudo mount -t hugetlbfs nodev /mnt/huge
+
+- sudo apt-get -qq update
+- sudo apt-get install linux-headers-`uname -r`
+- sudo pip install coverage
+- gem install asciidoctor
+- PATH=${PATH//:\.\/node_modules\/\.bin/}
+
 #  DPDK pktio
 - TARGET=${TARGET:-"x86_64-native-linuxapp-gcc"}
 - git -c advice.detachedHead=false clone -q --depth=1 --single-branch 
--branch=v17.02 http://dpdk.org/git/dpdk dpdk
@@ -125,6 +133,69 @@ script:
 jobs:
 include:
 - stage: test
+  compiler: aarch64-linux-gnu-gcc
+  env: TEST="aarch64-linux-gnu" 
CROSS="--host=aarch64-linux-gnu --prefix=/usr/aarch64-linux-gnu"
+  install: true
+  script:
+  - mkdir cross
+  - pushd cross
+# one can not include colon in the command or bad 
things will happen, so mimic it
+  - env echo -e 'Provides\x3a multiarch-support, 
debconf, debconf-2.0' > dummy
+  - equivs-build -a arm64 dummy
+  - wget
+
http://ports.ubuntu.com/pool/main/o/openssl/libssl-dev_1.0.1f-1ubuntu2.22_arm64.deb
+
http://ports.ubuntu.com/pool/main/o/openssl/libssl1.0.0_1.0.1f-1ubuntu2.22_arm64.deb
+
http://ports.ubuntu.com/pool/main/z/zlib/zlib1g-dev_1.2.8.dfsg-1ubuntu1_arm64.deb
+
http://ports.ubuntu.com/pool/main/z/zlib/zlib1g_1.2.8.dfsg-1ubuntu1_arm64.deb
+  - sudo dpkg-cross -i -M -A -a arm64 *.deb
+  - popd
+  - ./bootstrap
+  - ./configure --prefix=$HOME/odp-install $CROSS
+--disable-test-cpp --enable-test-va

[lng-odp] [PATCH v1 1/2] build: better atomics detection

2017-06-27 Thread Github ODP bot
From: Brian Brooks 

Do not optimize away the result of an atomic operation
during atomics detection in configure stage of build.

This resolves ipfragreass build breakage with clang on
32-bit systems.

[DES: fix check to stop using inline assembly]

Signed-off-by: Brian Brooks 
Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 60 (lumag:cross)
 ** https://github.com/Linaro/odp/pull/60
 ** Patch: https://github.com/Linaro/odp/pull/60.patch
 ** Base sha: a4add29291572219143dc667db4e8a7832a5692b
 ** Merge commit sha: 8dd9c8beb459d65838212e3d7bbba49762c50b4b
 **/
 platform/linux-generic/m4/configure.m4 | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index e1197f60..ed72c039 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -34,11 +34,12 @@ use_libatomic=no
 AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
 AC_LINK_IFELSE(
   [AC_LANG_SOURCE([[
-static int loc;
+#include 
+static uint64_t loc;
 int main(void)
 {
-int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
-return 0;
+uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+return prev & 0xff;
 }
 ]])],
   [AC_MSG_RESULT(no)],
@@ -57,6 +58,8 @@ AC_LINK_IFELSE(
 {
 __int128 prev;
 prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+// Do not optimize away prev
+__asm__ volatile("" : : "g"(&prev) : "memory");
 return 0;
 }
 ]])],



[lng-odp] [PATCH v1 0/2] Add cross compilation checks

2017-06-27 Thread Github ODP bot
Add cross compilation checks. Compile using gcc for ARM-HF, ARM64 and PowerPC. 
MIPS64 is left away, because Trusty doesn't provide necessary packets.

github
/** Email created from pull request 60 (lumag:cross)
 ** https://github.com/Linaro/odp/pull/60
 ** Patch: https://github.com/Linaro/odp/pull/60.patch
 ** Base sha: a4add29291572219143dc667db4e8a7832a5692b
 ** Merge commit sha: 8dd9c8beb459d65838212e3d7bbba49762c50b4b
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 23 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 138 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


Re: [lng-odp] [API-NEXT, PATCH v4 1/1] comp: compression API

2017-06-27 Thread shally verma
On Tue, Jun 27, 2017 at 2:51 PM, Savolainen, Petri (Nokia - FI/Espoo)
 wrote:
>> > diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h
>> b/platform/linux-generic/include/odp/api/plat/event_types.h
>> > index 0f51783..adf2c31 100644
>> > --- a/platform/linux-generic/include/odp/api/plat/event_types.h
>> > +++ b/platform/linux-generic/include/odp/api/plat/event_types.h
>> > @@ -4,7 +4,6 @@
>> >   * SPDX-License-Identifier: BSD-3-Clause
>> >   */
>> >
>> > -
>> >  /**
>> >   * @file
>> >   *
>> > @@ -39,7 +38,9 @@ typedef enum odp_event_type_t {
>> > ODP_EVENT_PACKET   = 2,
>> > ODP_EVENT_TIMEOUT  = 3,
>> > ODP_EVENT_CRYPTO_COMPL = 4,
>> > -   ODP_EVENT_IPSEC_RESULT = 5
>> > +   ODP_EVENT_IPSEC_RESULT = 5,
>> > +   ODP_EVENT_COMP_COMPL   = 6,
>> > +   ODP_EVENT_DECOMP_COMPL = 7
>> >  } odp_event_type_t;
>
> Event subtypes are now in api-next. This needs to be rebased on top of that. 
> Part of the rebase is definition of results as ODP_EVENT_PACKET type + 
> ODP_EVENT_PACKET_COMP subtype (not as COMP_COMPL events). Only one subtype 
> for comp, the same way as IPsec has ODP_EVENT_PACKET_IPSEC subtype which is 
> for both in- and outbound IPsec. It would be preferable to align comp API to 
> IPsec API also in other parts.

So you mean if application has both compression and decompression
ongoing simultaneously, onus is on application to track whether event
is from compress_enq() or decomp_enq() call ?

Shally
>
> -Petri


Re: [lng-odp] [API-NEXT, PATCH v4 1/1] comp: compression API

2017-06-27 Thread Savolainen, Petri (Nokia - FI/Espoo)
> > diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h
> b/platform/linux-generic/include/odp/api/plat/event_types.h
> > index 0f51783..adf2c31 100644
> > --- a/platform/linux-generic/include/odp/api/plat/event_types.h
> > +++ b/platform/linux-generic/include/odp/api/plat/event_types.h
> > @@ -4,7 +4,6 @@
> >   * SPDX-License-Identifier: BSD-3-Clause
> >   */
> >
> > -
> >  /**
> >   * @file
> >   *
> > @@ -39,7 +38,9 @@ typedef enum odp_event_type_t {
> > ODP_EVENT_PACKET   = 2,
> > ODP_EVENT_TIMEOUT  = 3,
> > ODP_EVENT_CRYPTO_COMPL = 4,
> > -   ODP_EVENT_IPSEC_RESULT = 5
> > +   ODP_EVENT_IPSEC_RESULT = 5,
> > +   ODP_EVENT_COMP_COMPL   = 6,
> > +   ODP_EVENT_DECOMP_COMPL = 7
> >  } odp_event_type_t;

Event subtypes are now in api-next. This needs to be rebased on top of that. 
Part of the rebase is definition of results as ODP_EVENT_PACKET type + 
ODP_EVENT_PACKET_COMP subtype (not as COMP_COMPL events). Only one subtype for 
comp, the same way as IPsec has ODP_EVENT_PACKET_IPSEC subtype which is for 
both in- and outbound IPsec. It would be preferable to align comp API to IPsec 
API also in other parts.

-Petri


Re: [lng-odp] [API-NEXT, PATCH v4 1/1] comp: compression API

2017-06-27 Thread shally verma
Ping. Reminder to review.

Thanks
Shally

On Tue, Jun 20, 2017 at 5:05 PM, Shally Verma
 wrote:
> API patch to enable compression/decompression support in ODP
>
> Changes from RFC v3:
> Added separate function for compression and decompression.
> Added separate event ODP_EVENT_COMP_COMPL/ODP_EVENT_DECOMP_COMPL for
> compression and decompression completion status in async mode of operation.
>
> Signed-off-by: Shally Verma 
> Signed-off-by: Mahipal Challa 
> ---
>  include/odp/api/spec/comp.h| 810 
> +
>  include/odp/api/spec/event.h   |   3 +-
>  include/odp/arch/arm32-linux/odp/api/abi/comp.h|   7 +
>  include/odp/arch/arm64-linux/odp/api/abi/comp.h|   7 +
>  include/odp/arch/default/api/abi/comp.h|  36 +
>  include/odp/arch/mips64-linux/odp/api/abi/comp.h   |   7 +
>  include/odp/arch/power64-linux/odp/api/abi/comp.h  |   7 +
>  include/odp/arch/x86_32-linux/odp/api/abi/comp.h   |   7 +
>  include/odp/arch/x86_64-linux/odp/api/abi/comp.h   |   7 +
>  platform/linux-generic/include/odp/api/comp.h  |  41 ++
>  .../include/odp/api/plat/comp_types.h  |  44 ++
>  .../include/odp/api/plat/event_types.h |   5 +-
>  platform/linux-generic/include/odp_comp_internal.h |  62 ++
>  .../linux-generic/include/odp_packet_internal.h|   5 +-
>  14 files changed, 1043 insertions(+), 5 deletions(-)
>
> diff --git a/include/odp/api/spec/comp.h b/include/odp/api/spec/comp.h
> new file mode 100644
> index 000..ef11802
> --- /dev/null
> +++ b/include/odp/api/spec/comp.h
> @@ -0,0 +1,810 @@
> +/*
> + */
> +
> +/**
> + * @file
> + *
> + * ODP Compression
> + */
> +
> +#ifndef ODP_API_COMP_H_
> +#define ODP_API_COMP_H_
> +
> +#include 
> +#include 
> +#include 
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/** @defgroup odp_compression ODP COMP
> + *  ODP Compression defines API set to compress/decompress along with hash
> + *  operations on data. Hash is calculated on plaintext.
> + *
> + *  if opcode = ODP_COMP_COMPRESS, then it will Compress and apply hash,
> + *  if opcode = ODP_COMP_DECOMPRESS, then it will Decompress and apply
> + *  hash.
> + *  Independent hash-only operations are not supported. Implementation should
> + *  perform hash along with valid compression algo.
> + *  Macros, enums, types and operations to utilize compression.
> + *  @{
> + */
> +
> +/**
> + * @def ODP_COMP_SESSION_INVALID
> + * Invalid session handle
> + */
> +
> +/**
> + * @typedef odp_comp_session_t
> + * Compression/Decompression session handle
> + */
> +
> +/**
> + * @typedef odp_comp_compl_t
> +* Compression/Decompression completion event handle
> +*/
> +
> +/**
> + * Compression API operation mode
> + */
> +typedef enum {
> +   /** Synchronous, return results immediately */
> +   ODP_COMP_SYNC,
> +   /** Asynchronous, return results via event queue */
> +   ODP_COMP_ASYNC
> +} odp_comp_op_mode_t;
> +
> +/**
> + * Comp API operation type.
> + *
> + */
> +typedef enum {
> +   /** Compress  */
> +   ODP_COMP_OP_COMPRESS,
> +   /** Decompress */
> +   ODP_COMP_OP_DECOMPRESS
> +} odp_comp_op_t;
> +
> +/**
> + * Comp API hash algorithm
> + *
> + */
> +typedef enum {
> +   /** ODP_COMP_HASH_ALG_NONE*/
> +   ODP_COMP_HASH_ALG_NONE,
> +   /** ODP_COMP_HASH_ALG_SHA1*/
> +   ODP_COMP_HASH_ALG_SHA1,
> +   /**  ODP_COMP_HASH_ALG_SHA256*/
> +   ODP_COMP_HASH_ALG_SHA256
> +} odp_comp_hash_alg_t;
> +
> +/**
> + * Comp API compression algorithm
> + *
> + */
> +typedef enum {
> +   /** No algorithm specified.
> +   * Means no compression, output == input.
> +   * if provided, no operation (compression/decompression or hash)
> +   * applied on input. Added for testing purpose.
> +   */
> +   ODP_COMP_ALG_NULL,
> +   /** DEFLATE - RFC1951 */
> +   ODP_COMP_ALG_DEFLATE,
> +   /** ZLIB - RFC1950 */
> +   ODP_COMP_ALG_ZLIB,
> +   /** LZS */
> +   ODP_COMP_ALG_LZS
> +} odp_comp_alg_t;
> +
> +/**
> + * Comp API session creation return code
> + *
> + */
> +typedef enum {
> +   /** Session created */
> +   ODP_COMP_SES_CREATE_ERR_NONE,
> +   /** Creation failed, no resources */
> +   ODP_COMP_SES_CREATE_ERR_ENOMEM,
> +   /** Creation failed, bad compression params */
> +   ODP_COMP_SES_CREATE_ERR_INV_COMP,
> +   /** Creation failed, bad hash params */
> +   ODP_COMP_SES_CREATE_ERR_INV_HASH,
> +   /** Creation failed,requested configuration not supported*/
> +   ODP_COMP_SES_CREATE_ERR_NOT_SUPPORTED
> +} odp_comp_ses_create_err_t;
> +
> +/**
> + * Comp API operation return codes
> + *
> + */
> +typedef enum {
> +   /** Operation completed successfully*/
> +   ODP_COMP_ERR_NONE,
> +   /** Invalid user data pointers*/
> +   ODP_COMP_ERR_DATA_PTR,
> +   /** Invalid input data size*/
> +   ODP_COMP_ERR_DATA_SIZE,
> +   /**  Compression and/or hash Algo failure*/
> + 

[lng-odp] [RFC] ddf: example: build module with dpdk support

2017-06-27 Thread Bogdan Pricope
Signed-off-by: Bogdan Pricope 
---
 example/ddf_app/odp_ddf_app.c|  14 +++-
 example/ddf_ifs/Makefile.am  |   9 ++-
 example/ddf_ifs/ddf_ifs_enumr_dpdk.c | 126 ++-
 example/m4/configure.m4  |   2 +
 example/m4/example_dpdk.m4   |  57 
 scripts/build-example-ddf-dpdk   |  33 +
 6 files changed, 237 insertions(+), 4 deletions(-)
 create mode 100644 example/m4/example_dpdk.m4
 create mode 100755 scripts/build-example-ddf-dpdk

diff --git a/example/ddf_app/odp_ddf_app.c b/example/ddf_app/odp_ddf_app.c
index af864ee..18c6994 100644
--- a/example/ddf_app/odp_ddf_app.c
+++ b/example/ddf_app/odp_ddf_app.c
@@ -20,9 +20,12 @@
 int main(int argc, char *argv[])
 {
odp_instance_t instance;
+   odp_pktio_t pktio = ODP_PKTIO_INVALID;
 
-   (void)argc;
-   (void)argv;
+   if (argc == 1 || argc > 2) {
+   printf("Error: invalid parameter.\nUsage:\n\t%s \n", 
argv[0]);
+   exit(0);
+   }
 
EXAMPLE_DBG("Start DDF Application...\n");
 
@@ -40,6 +43,13 @@ int main(int argc, char *argv[])
/* Print ddf objects*/
odpdrv_print_all();
 
+   /* Open pktio*/
+   /*odp_pktio_open();*/
+
+   /* Close pktio*/
+   if (odp_pktio_close(pktio))
+   EXAMPLE_ERR("Error: Failed to close pktio \"%s\".\n", argv[1]);
+
/* Terminate ODP */
odp_term_local();
odp_term_global(instance);
diff --git a/example/ddf_ifs/Makefile.am b/example/ddf_ifs/Makefile.am
index aa892ac..77e56e6 100644
--- a/example/ddf_ifs/Makefile.am
+++ b/example/ddf_ifs/Makefile.am
@@ -3,7 +3,14 @@ LIB   = $(top_builddir)/lib
 AM_CPPFLAGS +=  -I$(srcdir) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@
+   -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
+   -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
+   -I$(top_builddir)/include
+
+if EXAMPLE_DPDK_SUPPORT 
+AM_CPPFLAGS += @EXAMPLE_DPDK_CPPFLAGS@
+AM_LDFLAGS += @EXAMPLE_DPDK_LDFLAGS@
+endif
 
 lib_LTLIBRARIES = $(LIB)/libddf_ifs.la
 
diff --git a/example/ddf_ifs/ddf_ifs_enumr_dpdk.c 
b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c
index 782f7b7..25585dc 100644
--- a/example/ddf_ifs/ddf_ifs_enumr_dpdk.c
+++ b/example/ddf_ifs/ddf_ifs_enumr_dpdk.c
@@ -4,12 +4,27 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include 
+
 #include 
+#include 
+#include 
+#include 
+
 #include "odp_drv.h"
 #include "ddf_ifs_api.h"
 #include "ddf_ifs_enumr_dpdk.h"
 #include "ddf_ifs_dev_dpdk.h"
 
+/*#include */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
 static odpdrv_enumr_t dpdk_enumr;
 
 #define TEST_DPDK_DEV_CNT 3
@@ -17,6 +32,106 @@ static odpdrv_enumr_t dpdk_enumr;
 
 static odpdrv_device_t dpdk_dev[DDF_DPDK_DEV_MAX];
 static int dpdk_dev_cnt;
+
+#define DPDK_MEMORY_MB 512
+static int dpdk_pktio_init(void)
+{
+   int dpdk_argc;
+   int i;
+   odp_cpumask_t mask;
+   char mask_str[ODP_CPUMASK_STR_SIZE];
+   const char *cmdline;
+   int32_t masklen;
+   int mem_str_len;
+   int cmd_len;
+   cpu_set_t original_cpuset;
+   struct rte_config *cfg;
+
+   /**
+* DPDK init changes the affinity of the calling thread, so after it
+* returns the original affinity is restored. Only the first active
+* core is passed to rte_eal_init(), as the rest would be used for
+* DPDK's special lcore threads, which are only available through
+* rte_eal_[mp_]remote_launch(), but not through ODP API's.
+* Nevertheless, odp_local_init() makes sure for the rest of
+* the DPDK libraries ODP threads look like proper DPDK threads.
+*/
+   CPU_ZERO(&original_cpuset);
+   i = pthread_getaffinity_np(pthread_self(),
+  sizeof(original_cpuset), &original_cpuset);
+   if (i != 0) {
+   printf("Failed to read thread affinity: %d\n", i);
+   return -1;
+   }
+
+   odp_cpumask_zero(&mask);
+   for (i = 0; i < CPU_SETSIZE; i++) {
+   if (CPU_ISSET(i, &original_cpuset)) {
+   odp_cpumask_set(&mask, i);
+   break;
+   }
+   }
+   masklen = odp_cpumask_to_str(&mask, mask_str, ODP_CPUMASK_STR_SIZE);
+
+   if (masklen < 0) {
+   printf("CPU mask error: %d\n", masklen);
+   return -1;
+   }
+
+   mem_str_len = snprintf(NULL, 0, "%d", DPDK_MEMORY_MB);
+
+   cmdline = getenv("ODP_PKTIO_DPDK_PARAMS");
+   if (cmdline == NULL)
+   cmdline = "";
+
+   /* masklen includes the terminating null as well */
+   cmd_len = strlen("ddfdpdk -c -m ") + masklen + mem_str_len +
+   strlen(cmdline) + strlen("  ");
+
+   char full_cmd[cmd_len];
+
+

[lng-odp] [RFC] ddf: examples: module with dpdk support

2017-06-27 Thread Bogdan Pricope
This RFC shows how to build a DDF module with DPDK support while application
and odp have no DPDK support.

Step 1: Run 'build-example-ddf-dpdk' script.
e.g:
$ ./scripts/build-example-ddf-dpdk

This will:
 - clone dpdk
 - configure dpdk to build as shared libs
 - build dpdk
 - build odp with 'with-example-dpdk-path' option: this path to dpdk install
 folder will be used by examples applications (if needed)

Only 'ddf_ifs' is built with dpdk support.

Step 2: Set LD_LIBRARY_PATH
 # export LD_LIBRARY_PATH=/odp/lib/.libs:/odp/dpdk/x86_64-native-linuxapp-gcc/lib

Step 3: Run the application 
 # ODP_SYSCONFIG_FILE=/odp/example/ddf_ifs/odp.conf 
./example/ddf_app/.libs/odp_ddf_app ddf_pktio_name

Note: rte_eal_init() runs OK; yet, rte_eth_dev_count() returns 0... it may 
still need some work.

Bogdan Pricope (1):
  ddf: example: build module with dpdk support

 example/ddf_app/odp_ddf_app.c|  14 +++-
 example/ddf_ifs/Makefile.am  |   9 ++-
 example/ddf_ifs/ddf_ifs_enumr_dpdk.c | 126 ++-
 example/m4/configure.m4  |   2 +
 example/m4/example_dpdk.m4   |  57 
 scripts/build-example-ddf-dpdk   |  33 +
 6 files changed, 237 insertions(+), 4 deletions(-)
 create mode 100644 example/m4/example_dpdk.m4
 create mode 100755 scripts/build-example-ddf-dpdk

-- 
1.9.1



Re: [lng-odp] [PATCH] build: better atomics detection

2017-06-27 Thread Maxim Uvarov
maybe return something like (prev & 0xff) ?

On 27 June 2017 at 10:51, 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
> Brian
> > Brooks
> > Sent: Monday, June 26, 2017 9:21 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] build: better atomics detection
> >
> > Do not optimize away the result of an atomic operation
> > during atomics detection in configure stage of build.
> >
> > This resolves ipfragreass build breakage with clang on
> > 32-bit systems.
> >
> > Signed-off-by: Brian Brooks 
> > ---
> >  platform/linux-generic/m4/configure.m4 | 9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-
> > generic/m4/configure.m4
> > index e1197f60..af645e05 100644
> > --- a/platform/linux-generic/m4/configure.m4
> > +++ b/platform/linux-generic/m4/configure.m4
> > @@ -34,10 +34,13 @@ use_libatomic=no
> >  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
> >  AC_LINK_IFELSE(
> >[AC_LANG_SOURCE([[
> > -static int loc;
> > +#include 
> > +static uint64_t loc;
> >  int main(void)
> >  {
> > -int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> > +uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
>
> Wouldn't volatile work. I'd avoid inline asm here if it can be avoided.
>
> volatile uint64_t prev = ...;
>
> -Petri
>
>
>


[lng-odp] [Linaro/odp] c460b6: ddf: examples: add ddf module skeleton and ddf app...

2017-06-27 Thread GitHub
  Branch: refs/heads/cloud-dev
  Home:   https://github.com/Linaro/odp
  Commit: c460b6fbaeae6c60d75e8e5a60c34a6260b9e4fa
  
https://github.com/Linaro/odp/commit/c460b6fbaeae6c60d75e8e5a60c34a6260b9e4fa
  Author: Bogdan Pricope 
  Date:   2017-06-27 (Tue, 27 Jun 2017)

  Changed paths:
M example/Makefile.am
A example/ddf_app/Makefile.am
A example/ddf_app/odp_ddf_app.c
A example/ddf_ifs/Makefile.am
A example/ddf_ifs/ddf_ifs.c
A example/ddf_ifs/ddf_ifs.h
A example/ddf_ifs/ddf_ifs_api.h
A example/ddf_ifs/ddf_ifs_dev_dpdk.c
A example/ddf_ifs/ddf_ifs_dev_dpdk.h
A example/ddf_ifs/ddf_ifs_devio_direct.c
A example/ddf_ifs/ddf_ifs_devio_direct.h
A example/ddf_ifs/ddf_ifs_driver.c
A example/ddf_ifs/ddf_ifs_driver.h
A example/ddf_ifs/ddf_ifs_enumr_class.c
A example/ddf_ifs/ddf_ifs_enumr_class.h
A example/ddf_ifs/ddf_ifs_enumr_dpdk.c
A example/ddf_ifs/ddf_ifs_enumr_dpdk.h
A example/ddf_ifs/ddf_ifs_enumr_generic.c
A example/ddf_ifs/ddf_ifs_enumr_generic.h
A example/ddf_ifs/odp.conf
M example/m4/configure.m4

  Log Message:
  ---
  ddf: examples: add ddf module skeleton and ddf application

Signed-off-by: Bogdan Pricope 
Reviewed-and-tested-by: Yi He 
Signed-off-by: Yi He 




[lng-odp] PKTIO statistics validation test

2017-06-27 Thread Liron Himi
Hi,

I'm running 'pktio_test_statistics_counters' and it failed on 'in_octets' check.
The root cause for the failure related to the FCS bytes.
My counter adds those bytes whereas the validation test check for the original 
packet length.
According to the API those counters should count the whole packet length 
including FCS.
Maybe I'm missing something here, but either:

1.   The transmit packet length is already with FCS, but I didn't see in 
the code where the FCS is calculated.

2.   The transmit packet length is without FCS and the check on receive 
should add FCS in order to compare it to in_octets.

Please advise what is the correct situation here.

Regards,
Liron



Re: [lng-odp] [PATCH] build: better atomics detection

2017-06-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Brian
> Brooks
> Sent: Monday, June 26, 2017 9:21 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] build: better atomics detection
> 
> Do not optimize away the result of an atomic operation
> during atomics detection in configure stage of build.
> 
> This resolves ipfragreass build breakage with clang on
> 32-bit systems.
> 
> Signed-off-by: Brian Brooks 
> ---
>  platform/linux-generic/m4/configure.m4 | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-
> generic/m4/configure.m4
> index e1197f60..af645e05 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -34,10 +34,13 @@ use_libatomic=no
>  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
>  AC_LINK_IFELSE(
>[AC_LANG_SOURCE([[
> -static int loc;
> +#include 
> +static uint64_t loc;
>  int main(void)
>  {
> -int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);

Wouldn't volatile work. I'd avoid inline asm here if it can be avoided.

volatile uint64_t prev = ...;

-Petri




Re: [lng-odp] [PATCH] linux-gen: time: use true hz

2017-06-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Brian
> Brooks
> Sent: Monday, June 26, 2017 9:21 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [PATCH] linux-gen: time: use true hz
> 
> Use true hz value instead of dividing by 10.
> 
> The architected timer in ARM SoCs generally have a lower
> frequency than IA TSC. It is detrimental to divide the
> hertz by ten in this case. This is causing time validation
> failures on ARM systems where the architected timer runs
> at 50MHz.
> 
> Signed-off-by: Brian Brooks 
> ---
>  platform/linux-generic/odp_time.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> generic/odp_time.c
> index 2bbe5666..a831cc51 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -102,9 +102,7 @@ static inline odp_time_t time_hw_cur(void)
> 
>  static inline uint64_t time_hw_res(void)
>  {
> - /* Promise a bit lower resolution than average cycle counter
> -  * frequency */
> - return global.hw_freq_hz / 10;
> + return global.hw_freq_hz;
>  }
> 
>  static inline uint64_t time_hw_to_ns(odp_time_t time)
> --
> 2.13.1


Did you test this change on x86? This should cause test failures on x86.

You should fix the time test suite also. The suite converts Hz resolution to ns 
resolution here:

static void time_test_res(time_res_cb time_res, uint64_t *res)
{
uint64_t rate;

rate = time_res();
CU_ASSERT(rate > MIN_TIME_RATE);
CU_ASSERT(rate < MAX_TIME_RATE);

*res = ODP_TIME_SEC_IN_NS / rate;
if (ODP_TIME_SEC_IN_NS % rate)
(*res)++;
}

When TSC resolution is >1GHz, the ns resolution is zero and there is no margin 
for rounding errors. 

static void time_test_conversion(time_from_ns_cb time_from_ns, uint64_t res)
{
uint64_t ns1, ns2;
odp_time_t time;
uint64_t upper_limit, lower_limit;

ns1 = 100;
time = time_from_ns(ns1);

ns2 = odp_time_to_ns(time);

/* need to check within arithmetic tolerance that the same
 * value in ns is returned after conversions */
upper_limit = ns1 + res;
lower_limit = ns1 - res;
CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit)); 


The error margin needs to be changed from ns resolution to something else. I 
think it should be just a percentage from the original value (floating point 
math) e.g. +-20% throughout the test suite.

-Petri




Re: [lng-odp] [PATCH] linux-gen: scheduler: modular scheduler interface

2017-06-27 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Joyce
> Kong
> Sent: Tuesday, June 27, 2017 5:29 AM
> To: lng-odp@lists.linaro.org
> Cc: Joyce Kong 
> Subject: [lng-odp] [PATCH] linux-gen: scheduler: modular scheduler
> interface
> 
> Signed-off-by: Joyce Kong 
 
You need to have some rationale in the git log entry, which answers the 
questions: "Why this change is needed ?", "What this changes tries to 
accomplish ?", etc

-Petri