Re: [lng-odp] [API-NEXT PATCHv4 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)
For both patches:

Reviewed-by: Petri Savolainen 


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Tuesday, December 15, 2015 7:40 AM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [API-NEXT PATCHv4 1/2] linux-generic:adding the
> platform_init structure
> 
> odp_platform_init structure is platform specific data, it is up
> to the platform specific implementation to define it.
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  platform/linux-generic/Makefile.am |  1 +
>  platform/linux-generic/include/odp/init.h  |  2 ++
>  .../linux-generic/include/odp/plat/init_types.h| 30
> ++
>  3 files changed, 33 insertions(+)
>  create mode 100644 platform/linux-generic/include/odp/plat/init_types.h
> 
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> generic/Makefile.am
> index 70bd8fe..d5a1f57 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -59,6 +59,7 @@ odpplatinclude_HEADERS = \
> $(srcdir)/include/odp/plat/cpumask_types.h \
> $(srcdir)/include/odp/plat/crypto_types.h \
> $(srcdir)/include/odp/plat/event_types.h \
> +   $(srcdir)/include/odp/plat/init_types.h \
> $(srcdir)/include/odp/plat/packet_types.h \
> $(srcdir)/include/odp/plat/packet_io_types.h \
> $(srcdir)/include/odp/plat/pool_types.h \
> diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-
> generic/include/odp/init.h
> index 950a4f8..3233e36 100644
> --- a/platform/linux-generic/include/odp/init.h
> +++ b/platform/linux-generic/include/odp/init.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
> 
> +#include 
> +
>  /** @ingroup odp_initialization
>   *  @{
>   */
> diff --git a/platform/linux-generic/include/odp/plat/init_types.h
> b/platform/linux-generic/include/odp/plat/init_types.h
> new file mode 100644
> index 000..ce33b67
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/init_types.h
> @@ -0,0 +1,30 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP initialization.
> + */
> +
> +#ifndef ODP_INIT_TYPES_H_
> +#define ODP_INIT_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * @intenal platform specific init data
> + */
> +typedef struct odp_platform_init_t {
> +} odp_platform_init_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 1.9.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


[lng-odp] [PATCH v2 5/6] test:performance:update the thread create proto

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/performance/odp_atomic.c | 2 +-
 test/performance/odp_l2fwd.c  | 3 ++-
 test/performance/odp_pktio_perf.c | 4 ++--
 test/performance/odp_scheduling.c | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
index 1402a0c..054f653 100644
--- a/test/performance/odp_atomic.c
+++ b/test/performance/odp_atomic.c
@@ -286,7 +286,7 @@ int odp_test_thread_create(void *func_ptr(void *), 
pthrd_arg *arg)
/* Create and init additional threads */
odp_cpumask_default_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
- (void *)arg);
+ (void *)arg, ODP_THREAD_WORKER);
 
return 0;
 }
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 3941c50..481fb01 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -598,7 +598,8 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  thr_run_func,
- &gbl_args->thread[i]);
+ &gbl_args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index ffe9844..82dcf19 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -629,7 +629,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
/* start receiver threads first */
args_rx.batch_len = gbl_args->args.rx_batch_len;
odph_linux_pthread_create(&thd_tbl[0], thd_mask_rx,
- run_thread_rx, &args_rx);
+ run_thread_rx, &args_rx, ODP_THREAD_WORKER);
odp_barrier_wait(&gbl_args->rx_barrier);
num_rx_workers = odp_cpumask_count(thd_mask_rx);
 
@@ -639,7 +639,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
args_tx.duration  = gbl_args->args.duration;
args_tx.batch_len = gbl_args->args.tx_batch_len;
odph_linux_pthread_create(&thd_tbl[num_rx_workers], thd_mask_tx,
- run_thread_tx, &args_tx);
+ run_thread_tx, &args_tx, ODP_THREAD_WORKER);
odp_barrier_wait(&gbl_args->tx_barrier);
 
/* wait for transmitter threads to terminate */
diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index cb865b3..971d19b 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -995,7 +995,7 @@ int main(int argc, char *argv[])
} else {
/* Create and launch worker threads */
odph_linux_pthread_create(thread_tbl, &cpumask,
- run_thread, NULL);
+ run_thread, NULL, ODP_THREAD_WORKER);
 
/* Wait for worker threads to terminate */
odph_linux_pthread_join(thread_tbl, num_workers);
-- 
1.9.1

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


[lng-odp] [PATCH v2 6/6] test:validation:common: update the thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/validation/common/odp_cunit_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/validation/common/odp_cunit_common.c 
b/test/validation/common/odp_cunit_common.c
index bc786ec..a886f10 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -33,7 +33,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg 
*arg)
odp_cpumask_default_worker(&cpumask, arg->numthrds);
 
return odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
-(void *)arg);
+(void *)arg, ODP_THREAD_WORKER);
 }
 
 /** exit from test thread */
-- 
1.9.1

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


[lng-odp] [PATCH v2 3/6] helper:test:update the prototype for thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 helper/test/odp_thread.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c
index 592f856..65b5778 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/odp_thread.c
@@ -61,7 +61,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
printf("new cpu mask:   %s\n", cpumaskstr);
printf("new num worker threads: %i\n\n", num_workers);
 
-   odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL);
+   odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL,
+   ODP_THREAD_WORKER);
 
odph_linux_pthread_join(thread_tbl, num_workers);
 
-- 
1.9.1

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


[lng-odp] [PATCH v2 4/6] test:api_test:update the thread create prototype

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/api_test/odp_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 681d915..cebaa12 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -76,7 +76,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg 
*arg)
/* Create and init additional threads */
odp_cpumask_default_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
- (void *)arg);
+ (void *)arg, ODP_THREAD_WORKER);
 
return 0;
 }
-- 
1.9.1

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


[lng-odp] [PATCH v2 2/6] example: update the prototype for thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 example/classifier/odp_classifier.c | 2 +-
 example/generator/odp_generator.c   | 9 ++---
 example/ipsec/odp_ipsec.c   | 2 +-
 example/packet/odp_pktio.c  | 3 ++-
 example/timer/odp_timer_test.c  | 2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 81e6bf0..6cf4596 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -533,7 +533,7 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  pktio_receive_thread,
- args);
+ args, ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 01807a0..f156497 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -784,7 +784,8 @@ int main(int argc, char *argv[])
abort();
args->thread[1].mode = args->appl.mode;
odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
- gen_recv_thread, &args->thread[1]);
+ gen_recv_thread, &args->thread[1],
+ ODP_THREAD_WORKER);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
@@ -804,7 +805,8 @@ int main(int argc, char *argv[])
odp_cpumask_zero(&cpu_mask);
odp_cpumask_set(&cpu_mask, cpu_next);
odph_linux_pthread_create(&thread_tbl[0], &cpu_mask,
- gen_send_thread, &args->thread[0]);
+ gen_send_thread, &args->thread[0],
+ ODP_THREAD_WORKER);
 
} else {
int cpu = odp_cpumask_first(&cpumask);
@@ -849,7 +851,8 @@ int main(int argc, char *argv[])
odph_linux_pthread_create(&thread_tbl[i],
  &thd_mask,
  thr_run_func,
- &args->thread[i]);
+ &args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
 
}
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index f0ff2c9..fab1035 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1333,7 +1333,7 @@ main(int argc, char *argv[])
 * Create and init worker threads
 */
odph_linux_pthread_create(thread_tbl, &cpumask,
- pktio_thread, NULL);
+ pktio_thread, NULL, ODP_THREAD_WORKER);
 
/*
 * If there are streams attempt to verify them else
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 239c1b0..c42331b 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -442,7 +442,8 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  thr_run_func,
- &args->thread[i]);
+ &args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 8796b66..b7a4fd2 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -479,7 +479,7 @@ int main(int argc, char *argv[])
 
/* Create and launch worker threads */
odph_linux_pthread_create(thread_tbl, &cpumask,
- run_thread, gbls);
+ run_thread, gbls, ODP_THREAD_WORKER);
 
/* Wait for worker threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);
-- 
1.9.1

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


[lng-odp] [PATCH v2 1/6] linux:add thread type in odph_linux_pthread_create

2015-12-14 Thread Hemant Agrawal
The exisiting helper routine only create the worker threads.
However there is a need to use the same for creating the control thread as 
well. e.g. CLI thread.

Signed-off-by: Hemant Agrawal 
---
 helper/include/odp/helper/linux.h | 5 -
 helper/linux.c| 6 --
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/helper/include/odp/helper/linux.h 
b/helper/include/odp/helper/linux.h
index ce61fdf..16b5c65 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/include/odp/helper/linux.h
@@ -31,6 +31,7 @@ extern "C" {
 typedef struct {
void *(*start_routine) (void *); /**< The function to run */
void *arg; /**< The functions arguemnts */
+   odp_thread_type_t thr_type; /**< The thread type */
 } odp_start_args_t;
 
 /** Linux pthread state information */
@@ -59,12 +60,14 @@ typedef struct {
  * @param mask  CPU mask
  * @param start_routine Thread start function
  * @param arg   Thread argument
+ * @param thr_type  Thread type
  *
  * @return Number of threads created
  */
 int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
   const odp_cpumask_t *mask,
-  void *(*start_routine) (void *), void *arg);
+  void *(*start_routine) (void *), void *arg,
+  odp_thread_type_t thr_type);
 
 /**
  * Waits pthreads to exit
diff --git a/helper/linux.c b/helper/linux.c
index 4a8e8b3..7904d5c 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -28,7 +28,7 @@ static void *odp_run_start_routine(void *arg)
odp_start_args_t *start_args = arg;
 
/* ODP thread local init */
-   if (odp_init_local(ODP_THREAD_WORKER)) {
+   if (odp_init_local(start_args->thr_type)) {
ODPH_ERR("Local init failed\n");
return NULL;
}
@@ -46,7 +46,8 @@ static void *odp_run_start_routine(void *arg)
 
 int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
  const odp_cpumask_t *mask_in,
- void *(*start_routine)(void *), void *arg)
+ void *(*start_routine)(void *), void *arg,
+ odp_thread_type_t thr_type)
 {
int i;
int num;
@@ -88,6 +89,7 @@ int odph_linux_pthread_create(odph_linux_pthread_t 
*thread_tbl,
 
thread_tbl[i].start_args->start_routine = start_routine;
thread_tbl[i].start_args->arg   = arg;
+   thread_tbl[i].start_args->thr_type  = thr_type;
 
ret = pthread_create(&thread_tbl[i].thread,
 &thread_tbl[i].attr,
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv4 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Hemant Agrawal
odp_platform_init structure is platform specific data, it is up
to the platform specific implementation to define it.

Signed-off-by: Hemant Agrawal 
---
 platform/linux-generic/Makefile.am |  1 +
 platform/linux-generic/include/odp/init.h  |  2 ++
 .../linux-generic/include/odp/plat/init_types.h| 30 ++
 3 files changed, 33 insertions(+)
 create mode 100644 platform/linux-generic/include/odp/plat/init_types.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 70bd8fe..d5a1f57 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -59,6 +59,7 @@ odpplatinclude_HEADERS = \
  $(srcdir)/include/odp/plat/cpumask_types.h \
  $(srcdir)/include/odp/plat/crypto_types.h \
  $(srcdir)/include/odp/plat/event_types.h \
+ $(srcdir)/include/odp/plat/init_types.h \
  $(srcdir)/include/odp/plat/packet_types.h \
  $(srcdir)/include/odp/plat/packet_io_types.h \
  $(srcdir)/include/odp/plat/pool_types.h \
diff --git a/platform/linux-generic/include/odp/init.h 
b/platform/linux-generic/include/odp/init.h
index 950a4f8..3233e36 100644
--- a/platform/linux-generic/include/odp/init.h
+++ b/platform/linux-generic/include/odp/init.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_initialization
  *  @{
  */
diff --git a/platform/linux-generic/include/odp/plat/init_types.h 
b/platform/linux-generic/include/odp/plat/init_types.h
new file mode 100644
index 000..ce33b67
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/init_types.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP initialization.
+ */
+
+#ifndef ODP_INIT_TYPES_H_
+#define ODP_INIT_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @intenal platform specific init data 
+ */
+typedef struct odp_platform_init_t {
+} odp_platform_init_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv4 2/2] api: init: removed platform_init struct definition

2015-12-14 Thread Hemant Agrawal
odp_platform_init defination in standard API will conflict with
platform specific defination. better to keep it in the linux-generic
or other platform init header file

Signed-off-by: Hemant Agrawal 
---
 include/odp/api/init.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 737ff6d..b11f642 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -125,6 +125,7 @@ typedef struct odp_init_t {
 } odp_init_t;
 
 /**
+ * @typedef odp_platform_init_t
  * ODP platform initialization data
  *
  * @note ODP API does nothing with this data. It is the underlying
@@ -132,8 +133,6 @@ typedef struct odp_init_t {
  * It is required that the application takes care of identifying and
  * passing any required platform specific data.
  */
-typedef struct odp_platform_init_t {
-} odp_platform_init_t;
 
 
 /**
-- 
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 PATCHv3] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Maxim Uvarov

On 12/15/2015 01:15, Bill Fischofer wrote:

v3 posted to fix doxygen issues.

On Mon, Dec 14, 2015 at 4:14 PM, Bill Fischofer 
mailto:bill.fischo...@linaro.org>> wrote:


The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an
indirection
mechanism so that these dependencies do not "bleed through" the
ODP API.
This means that ODP applications can be independent of _POSIX_C_SOURCE
level.

Signed-off-by: Bill Fischofer mailto:bill.fischo...@linaro.org>>
---
 .../linux-generic/include/odp/plat/time_types.h| 14 +++---
 platform/linux-generic/odp_time.c  | 30
+++---
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/platform/linux-generic/include/odp/plat/time_types.h
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..6269e40 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,11 +21,17 @@ extern "C" {
  *  @{
  **/

-typedef struct timespec odp_time_t;
-
-odp_time_t odp_time_null(void);
+/**
+ * Time structure
+ * Used to isolate linux-generic implementation from the linux
+ * timespec structure, which is dependent on _POSIX_C_SOURCE level.
+ */
+typedef struct odp_time_t {
+   int64_t tv_sec;  /**< Seconds */
+   int64_t tv_nsec; /**< Nanoseconds */
+} odp_time_t;



should fields or struct have @internal tag? Did you review generated html?

Maxim.



-#define ODP_TIME_NULL  odp_time_null()
+#define ODP_TIME_NULL ((odp_time_t){0, 0})

 /**
  * @}
diff --git a/platform/linux-generic/odp_time.c
b/platform/linux-generic/odp_time.c
index 1c7c214..9b64b37 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,7 +11,12 @@
 #include 
 #include 

-static struct timespec start_time;
+typedef union {
+   odp_time_t  ex;
+   struct timespec in;
+} _odp_time_t;
+
+static odp_time_t start_time;

 static inline
 uint64_t time_to_ns(odp_time_t time)
@@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
 static inline
 odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
 {
-   struct timespec time;
+   odp_time_t time;

time.tv_sec = t2.tv_sec - t1.tv_sec;
time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
@@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
 odp_time_t odp_time_local(void)
 {
int ret;
-   struct timespec time;
+   _odp_time_t time;

-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in
);
if (odp_unlikely(ret != 0))
ODP_ABORT("clock_gettime failed\n");

-   return time_diff(time, start_time);
+   return time_diff(time.ex, start_time);
 }

 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
@@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)

 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   struct timespec time;
+   odp_time_t time;

time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
@@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)

 odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
 {
-   struct timespec time;
+   odp_time_t time;

time.tv_sec = t2.tv_sec + t1.tv_sec;
time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
@@ -113,18 +118,13 @@ uint64_t odp_time_to_u64(odp_time_t time)
return time_to_ns(time) / resolution;
 }

-odp_time_t odp_time_null(void)
-{
-   return (struct timespec) {0, 0};
-}
-
 int odp_time_global_init(void)
 {
int ret;
-   struct timespec time;
+   _odp_time_t time;

-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
-   start_time = ret ? odp_time_null() : time;
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in
);
+   start_time = ret ? ODP_TIME_NULL : time.ex;

return ret;
 }
--
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] doc/users-guide: add helpers section

2015-12-14 Thread Mike Holmes
On 14 December 2015 at 17:36, Bill Fischofer 
wrote:

>
> On Mon, Dec 14, 2015 at 4:28 PM, Mike Holmes 
> wrote:
>
>>
>>
>> On 12 December 2015 at 10:13, Bill Fischofer 
>> wrote:
>>
>>>
>>>
>>> On Fri, Dec 11, 2015 at 1:52 PM, Mike Holmes 
>>> wrote:
>>>
 Signed-off-by: Mike Holmes 
 ---
  doc/users-guide/users-guide.adoc | 161
 +++
  1 file changed, 161 insertions(+)

 diff --git a/doc/users-guide/users-guide.adoc
 b/doc/users-guide/users-guide.adoc
 index cf77fa0..d2e1a16 100644
 --- a/doc/users-guide/users-guide.adoc
 +++ b/doc/users-guide/users-guide.adoc
 @@ -431,6 +431,167 @@ Applications only include the 'include/odp.h file
 which includes the 'platform/<
  The doxygen documentation defining the behavior of the ODP API is all
 contained in the public API files, and the actual definitions for an
 implementation will be found in the per platform directories.
  Per-platform data that might normally be a #define can be recovered
 via the appropriate access function if the #define is not directly visible
 to the application.

 +== Helpers

>>>
>>> Calling this section Helpers is confusing since we're already using that
>>> for the ODP helper functions (odph prefix). These are really separate
>>> sections that are awkwardly under a "Miscellaneous" heading.  Better to
>>> promote them to first level sections that cover a wider theme rather than
>>> just enumerating.  For example "Core Management and Isolation", "Memory and
>>> Cache Management", "Synchronization", etc.
>>>
>>
>> This comes from our original overview docs, and fleshes out not much more
>> than place holders for the sections, will sync with you and see what we can
>> do.  I think we need to get in  some initial guidance on how to do things
>> like atomics etc and agree the lists need to expand into real pros on the
>> subject.  I think we can add detail to them one at a time if we flash out
>>  how they will fit in, basically the same as you just did by filling in the
>> queues and adding real meat.
>>
>>
>
> Agree.  I just think we shouldn't call this section "Helpers" as that's
> confusing as these are ODP_ functions, not ODPH_ functions.
>

Will fix


>
>
>
>>
>>>
 +Many small helper functions and definitions are needed to enable ODP
 +applications to be hardware optimized but not tied to a particular
 hardware or
 +execution environment. These are typically implemented with inline
 functions,
 +preprocessor macros, or compiler built­in features. Thus API
 definitions are
 +normally inline when possible.
 +
 +=== Core enumeration
 +Application or middleware need to handle physical and/or logical core
 IDs, core
 +counts and core masks quite often. Core enumeration has to remain
 consistent
 +even when core deployment may change during application execution
 (e.g., due to
 +adaptation to changing traffic profile, etc).
 +
 +* +odp_cpumask_from_str()+
 +* +odp_cpumask_to_str()+
 +* +odp_cpumask_zero()+
 +* +odp_cpumask_set()+
 +* +odp_cpumask_setall()+
 +* +odp_cpumask_clr()+
 +* +odp_cpumask_isset()+
 +* +odp_cpumask_count()+
 +* +odp_cpumask_and()+
 +* +odp_cpumask_or()+
 +* +odp_cpumask_xor()+
 +* +odp_cpumask_equal()+
 +* +odp_cpumask_copy()+
 +* +odp_cpumask_first()+
 +* +odp_cpumask_last()+
 +* +odp_cpumask_next()+
 +* +odp_cpumask_default_worker()+
 +* +odp_cpumask_default_control()+

>>>
>>> Good start, but we want to do more than just enumerate functions here
>>> (you can get that from the API reference).  The User's Guide should cover
>>> why and how these functions should be used and factored into application
>>> design. OK for now as a skeleton, but we need to expand here.
>>>
>>>
 +
 +=== Memory alignments
 +For optimal performance and scalability (e.g., to avoid false sharing
 and cache
 +line aliasing), some application data structures need to be aligned to
 cache
 +(cache line) and/or memory subsystem (page, DRAM burst) alignments.
 NUMA
 +systems also support location­awareness and potentially different
 cache line
 +sizes on a per­memory basis. Static memory allocation Serves
 application needs
 +for portable definitions for global and core/thread local data.
 +
 +* +ODP_ALIGNED+
 +* +ODP_PACKED+
 +* +ODP_OFFSETOF+
 +* +ODP_FIELD_SIZEOF+
 +* +ODP_CACHE_LINE_SIZE+
 +* +ODP_PAGE_SIZE+
 +* +ODP_ALIGNED_CACHE+
 +* +ODP_ALIGNED_PAGE+
 +
 +=== Compiler hints
 +The compiler and linker can do better optimizations if code includes
 hints on
 +expected application  behavior.  Examples of these are classification
 of
 +branches with likely/unlikely hints, or marking  code with hot
 (optimize for
 +speed) or cold (optimize for size) tags.
 +

Re: [lng-odp] [PATCH] doc/users-guide: add helpers section

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 4:28 PM, Mike Holmes  wrote:

>
>
> On 12 December 2015 at 10:13, Bill Fischofer 
> wrote:
>
>>
>>
>> On Fri, Dec 11, 2015 at 1:52 PM, Mike Holmes 
>> wrote:
>>
>>> Signed-off-by: Mike Holmes 
>>> ---
>>>  doc/users-guide/users-guide.adoc | 161
>>> +++
>>>  1 file changed, 161 insertions(+)
>>>
>>> diff --git a/doc/users-guide/users-guide.adoc
>>> b/doc/users-guide/users-guide.adoc
>>> index cf77fa0..d2e1a16 100644
>>> --- a/doc/users-guide/users-guide.adoc
>>> +++ b/doc/users-guide/users-guide.adoc
>>> @@ -431,6 +431,167 @@ Applications only include the 'include/odp.h file
>>> which includes the 'platform/<
>>>  The doxygen documentation defining the behavior of the ODP API is all
>>> contained in the public API files, and the actual definitions for an
>>> implementation will be found in the per platform directories.
>>>  Per-platform data that might normally be a #define can be recovered via
>>> the appropriate access function if the #define is not directly visible to
>>> the application.
>>>
>>> +== Helpers
>>>
>>
>> Calling this section Helpers is confusing since we're already using that
>> for the ODP helper functions (odph prefix). These are really separate
>> sections that are awkwardly under a "Miscellaneous" heading.  Better to
>> promote them to first level sections that cover a wider theme rather than
>> just enumerating.  For example "Core Management and Isolation", "Memory and
>> Cache Management", "Synchronization", etc.
>>
>
> This comes from our original overview docs, and fleshes out not much more
> than place holders for the sections, will sync with you and see what we can
> do.  I think we need to get in  some initial guidance on how to do things
> like atomics etc and agree the lists need to expand into real pros on the
> subject.  I think we can add detail to them one at a time if we flash out
>  how they will fit in, basically the same as you just did by filling in the
> queues and adding real meat.
>
>

Agree.  I just think we shouldn't call this section "Helpers" as that's
confusing as these are ODP_ functions, not ODPH_ functions.



>
>>
>>> +Many small helper functions and definitions are needed to enable ODP
>>> +applications to be hardware optimized but not tied to a particular
>>> hardware or
>>> +execution environment. These are typically implemented with inline
>>> functions,
>>> +preprocessor macros, or compiler built­in features. Thus API
>>> definitions are
>>> +normally inline when possible.
>>> +
>>> +=== Core enumeration
>>> +Application or middleware need to handle physical and/or logical core
>>> IDs, core
>>> +counts and core masks quite often. Core enumeration has to remain
>>> consistent
>>> +even when core deployment may change during application execution
>>> (e.g., due to
>>> +adaptation to changing traffic profile, etc).
>>> +
>>> +* +odp_cpumask_from_str()+
>>> +* +odp_cpumask_to_str()+
>>> +* +odp_cpumask_zero()+
>>> +* +odp_cpumask_set()+
>>> +* +odp_cpumask_setall()+
>>> +* +odp_cpumask_clr()+
>>> +* +odp_cpumask_isset()+
>>> +* +odp_cpumask_count()+
>>> +* +odp_cpumask_and()+
>>> +* +odp_cpumask_or()+
>>> +* +odp_cpumask_xor()+
>>> +* +odp_cpumask_equal()+
>>> +* +odp_cpumask_copy()+
>>> +* +odp_cpumask_first()+
>>> +* +odp_cpumask_last()+
>>> +* +odp_cpumask_next()+
>>> +* +odp_cpumask_default_worker()+
>>> +* +odp_cpumask_default_control()+
>>>
>>
>> Good start, but we want to do more than just enumerate functions here
>> (you can get that from the API reference).  The User's Guide should cover
>> why and how these functions should be used and factored into application
>> design. OK for now as a skeleton, but we need to expand here.
>>
>>
>>> +
>>> +=== Memory alignments
>>> +For optimal performance and scalability (e.g., to avoid false sharing
>>> and cache
>>> +line aliasing), some application data structures need to be aligned to
>>> cache
>>> +(cache line) and/or memory subsystem (page, DRAM burst) alignments.
>>> NUMA
>>> +systems also support location­awareness and potentially different cache
>>> line
>>> +sizes on a per­memory basis. Static memory allocation Serves
>>> application needs
>>> +for portable definitions for global and core/thread local data.
>>> +
>>> +* +ODP_ALIGNED+
>>> +* +ODP_PACKED+
>>> +* +ODP_OFFSETOF+
>>> +* +ODP_FIELD_SIZEOF+
>>> +* +ODP_CACHE_LINE_SIZE+
>>> +* +ODP_PAGE_SIZE+
>>> +* +ODP_ALIGNED_CACHE+
>>> +* +ODP_ALIGNED_PAGE+
>>> +
>>> +=== Compiler hints
>>> +The compiler and linker can do better optimizations if code includes
>>> hints on
>>> +expected application  behavior.  Examples of these are classification of
>>> +branches with likely/unlikely hints, or marking  code with hot
>>> (optimize for
>>> +speed) or cold (optimize for size) tags.
>>> +
>>> +* +odp_likely()+
>>> +* +odp_unlikely()+
>>> +* +odp_prefetch()+
>>> +* +odp_prefetch_store()+
>>> +
>>> +=== Atomic operations
>>> +Modern ISAs offers various atomic instructions to access/manipulate data
>>>

Re: [lng-odp] [PATCH] doc/users-guide: add helpers section

2015-12-14 Thread Mike Holmes
On 12 December 2015 at 10:13, Bill Fischofer 
wrote:

>
>
> On Fri, Dec 11, 2015 at 1:52 PM, Mike Holmes 
> wrote:
>
>> Signed-off-by: Mike Holmes 
>> ---
>>  doc/users-guide/users-guide.adoc | 161
>> +++
>>  1 file changed, 161 insertions(+)
>>
>> diff --git a/doc/users-guide/users-guide.adoc
>> b/doc/users-guide/users-guide.adoc
>> index cf77fa0..d2e1a16 100644
>> --- a/doc/users-guide/users-guide.adoc
>> +++ b/doc/users-guide/users-guide.adoc
>> @@ -431,6 +431,167 @@ Applications only include the 'include/odp.h file
>> which includes the 'platform/<
>>  The doxygen documentation defining the behavior of the ODP API is all
>> contained in the public API files, and the actual definitions for an
>> implementation will be found in the per platform directories.
>>  Per-platform data that might normally be a #define can be recovered via
>> the appropriate access function if the #define is not directly visible to
>> the application.
>>
>> +== Helpers
>>
>
> Calling this section Helpers is confusing since we're already using that
> for the ODP helper functions (odph prefix). These are really separate
> sections that are awkwardly under a "Miscellaneous" heading.  Better to
> promote them to first level sections that cover a wider theme rather than
> just enumerating.  For example "Core Management and Isolation", "Memory and
> Cache Management", "Synchronization", etc.
>

This comes from our original overview docs, and fleshes out not much more
than place holders for the sections, will sync with you and see what we can
do.  I think we need to get in  some initial guidance on how to do things
like atomics etc and agree the lists need to expand into real pros on the
subject.  I think we can add detail to them one at a time if we flash out
 how they will fit in, basically the same as you just did by filling in the
queues and adding real meat.


>
>
>> +Many small helper functions and definitions are needed to enable ODP
>> +applications to be hardware optimized but not tied to a particular
>> hardware or
>> +execution environment. These are typically implemented with inline
>> functions,
>> +preprocessor macros, or compiler built­in features. Thus API definitions
>> are
>> +normally inline when possible.
>> +
>> +=== Core enumeration
>> +Application or middleware need to handle physical and/or logical core
>> IDs, core
>> +counts and core masks quite often. Core enumeration has to remain
>> consistent
>> +even when core deployment may change during application execution (e.g.,
>> due to
>> +adaptation to changing traffic profile, etc).
>> +
>> +* +odp_cpumask_from_str()+
>> +* +odp_cpumask_to_str()+
>> +* +odp_cpumask_zero()+
>> +* +odp_cpumask_set()+
>> +* +odp_cpumask_setall()+
>> +* +odp_cpumask_clr()+
>> +* +odp_cpumask_isset()+
>> +* +odp_cpumask_count()+
>> +* +odp_cpumask_and()+
>> +* +odp_cpumask_or()+
>> +* +odp_cpumask_xor()+
>> +* +odp_cpumask_equal()+
>> +* +odp_cpumask_copy()+
>> +* +odp_cpumask_first()+
>> +* +odp_cpumask_last()+
>> +* +odp_cpumask_next()+
>> +* +odp_cpumask_default_worker()+
>> +* +odp_cpumask_default_control()+
>>
>
> Good start, but we want to do more than just enumerate functions here (you
> can get that from the API reference).  The User's Guide should cover why
> and how these functions should be used and factored into application
> design. OK for now as a skeleton, but we need to expand here.
>
>
>> +
>> +=== Memory alignments
>> +For optimal performance and scalability (e.g., to avoid false sharing
>> and cache
>> +line aliasing), some application data structures need to be aligned to
>> cache
>> +(cache line) and/or memory subsystem (page, DRAM burst) alignments.  NUMA
>> +systems also support location­awareness and potentially different cache
>> line
>> +sizes on a per­memory basis. Static memory allocation Serves application
>> needs
>> +for portable definitions for global and core/thread local data.
>> +
>> +* +ODP_ALIGNED+
>> +* +ODP_PACKED+
>> +* +ODP_OFFSETOF+
>> +* +ODP_FIELD_SIZEOF+
>> +* +ODP_CACHE_LINE_SIZE+
>> +* +ODP_PAGE_SIZE+
>> +* +ODP_ALIGNED_CACHE+
>> +* +ODP_ALIGNED_PAGE+
>> +
>> +=== Compiler hints
>> +The compiler and linker can do better optimizations if code includes
>> hints on
>> +expected application  behavior.  Examples of these are classification of
>> +branches with likely/unlikely hints, or marking  code with hot (optimize
>> for
>> +speed) or cold (optimize for size) tags.
>> +
>> +* +odp_likely()+
>> +* +odp_unlikely()+
>> +* +odp_prefetch()+
>> +* +odp_prefetch_store()+
>> +
>> +=== Atomic operations
>> +Modern ISAs offers various atomic instructions to access/manipulate data
>> +concurrently from multiple cores. Well scalable multicore software is
>> possible
>> +only through correct usage (and combination) of hardware acceleration and
>> +atomic instructions. Applications use atomic operations to update global
>> +statistics, sequence counters, quotas, etc., and to build concurrent data
>> +structures.
>> +

Re: [lng-odp] [API-NEXT PATCHv3] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Bill Fischofer
v3 posted to fix doxygen issues.

On Mon, Dec 14, 2015 at 4:14 PM, Bill Fischofer 
wrote:

> The linux-generic implementation of odp_time_t makes use of POSIX
> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
> mechanism so that these dependencies do not "bleed through" the ODP API.
> This means that ODP applications can be independent of _POSIX_C_SOURCE
> level.
>
> Signed-off-by: Bill Fischofer 
> ---
>  .../linux-generic/include/odp/plat/time_types.h| 14 +++---
>  platform/linux-generic/odp_time.c  | 30
> +++---
>  2 files changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
> b/platform/linux-generic/include/odp/plat/time_types.h
> index e5765ec..6269e40 100644
> --- a/platform/linux-generic/include/odp/plat/time_types.h
> +++ b/platform/linux-generic/include/odp/plat/time_types.h
> @@ -21,11 +21,17 @@ extern "C" {
>   *  @{
>   **/
>
> -typedef struct timespec odp_time_t;
> -
> -odp_time_t odp_time_null(void);
> +/**
> + * Time structure
> + * Used to isolate linux-generic implementation from the linux
> + * timespec structure, which is dependent on _POSIX_C_SOURCE level.
> + */
> +typedef struct odp_time_t {
> +   int64_t tv_sec;  /**< Seconds */
> +   int64_t tv_nsec; /**< Nanoseconds */
> +} odp_time_t;
>
> -#define ODP_TIME_NULL  odp_time_null()
> +#define ODP_TIME_NULL ((odp_time_t){0, 0})
>
>  /**
>   * @}
> diff --git a/platform/linux-generic/odp_time.c
> b/platform/linux-generic/odp_time.c
> index 1c7c214..9b64b37 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -11,7 +11,12 @@
>  #include 
>  #include 
>
> -static struct timespec start_time;
> +typedef union {
> +   odp_time_t  ex;
> +   struct timespec in;
> +} _odp_time_t;
> +
> +static odp_time_t start_time;
>
>  static inline
>  uint64_t time_to_ns(odp_time_t time)
> @@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
>  static inline
>  odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>  {
> -   struct timespec time;
> +   odp_time_t time;
>
> time.tv_sec = t2.tv_sec - t1.tv_sec;
> time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
> @@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>  odp_time_t odp_time_local(void)
>  {
> int ret;
> -   struct timespec time;
> +   _odp_time_t time;
>
> -   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
> if (odp_unlikely(ret != 0))
> ODP_ABORT("clock_gettime failed\n");
>
> -   return time_diff(time, start_time);
> +   return time_diff(time.ex, start_time);
>  }
>
>  odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
> @@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
>
>  odp_time_t odp_time_local_from_ns(uint64_t ns)
>  {
> -   struct timespec time;
> +   odp_time_t time;
>
> time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
> time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
> @@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
>
>  odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
>  {
> -   struct timespec time;
> +   odp_time_t time;
>
> time.tv_sec = t2.tv_sec + t1.tv_sec;
> time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
> @@ -113,18 +118,13 @@ uint64_t odp_time_to_u64(odp_time_t time)
> return time_to_ns(time) / resolution;
>  }
>
> -odp_time_t odp_time_null(void)
> -{
> -   return (struct timespec) {0, 0};
> -}
> -
>  int odp_time_global_init(void)
>  {
> int ret;
> -   struct timespec time;
> +   _odp_time_t time;
>
> -   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
> -   start_time = ret ? odp_time_null() : time;
> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
> +   start_time = ret ? ODP_TIME_NULL : time.ex;
>
> return ret;
>  }
> --
> 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] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Bill Fischofer
The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
mechanism so that these dependencies do not "bleed through" the ODP API.
This means that ODP applications can be independent of _POSIX_C_SOURCE
level.

Signed-off-by: Bill Fischofer 
---
 .../linux-generic/include/odp/plat/time_types.h| 14 +++---
 platform/linux-generic/odp_time.c  | 30 +++---
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/platform/linux-generic/include/odp/plat/time_types.h 
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..6269e40 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,11 +21,17 @@ extern "C" {
  *  @{
  **/
 
-typedef struct timespec odp_time_t;
-
-odp_time_t odp_time_null(void);
+/**
+ * Time structure
+ * Used to isolate linux-generic implementation from the linux
+ * timespec structure, which is dependent on _POSIX_C_SOURCE level.
+ */
+typedef struct odp_time_t {
+   int64_t tv_sec;  /**< Seconds */
+   int64_t tv_nsec; /**< Nanoseconds */
+} odp_time_t;
 
-#define ODP_TIME_NULL  odp_time_null()
+#define ODP_TIME_NULL ((odp_time_t){0, 0})
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index 1c7c214..9b64b37 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,7 +11,12 @@
 #include 
 #include 
 
-static struct timespec start_time;
+typedef union {
+   odp_time_t  ex;
+   struct timespec in;
+} _odp_time_t;
+
+static odp_time_t start_time;
 
 static inline
 uint64_t time_to_ns(odp_time_t time)
@@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
 static inline
 odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
 {
-   struct timespec time;
+   odp_time_t time;
 
time.tv_sec = t2.tv_sec - t1.tv_sec;
time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
@@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
 odp_time_t odp_time_local(void)
 {
int ret;
-   struct timespec time;
+   _odp_time_t time;
 
-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
if (odp_unlikely(ret != 0))
ODP_ABORT("clock_gettime failed\n");
 
-   return time_diff(time, start_time);
+   return time_diff(time.ex, start_time);
 }
 
 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
@@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
 
 odp_time_t odp_time_local_from_ns(uint64_t ns)
 {
-   struct timespec time;
+   odp_time_t time;
 
time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
@@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
 
 odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
 {
-   struct timespec time;
+   odp_time_t time;
 
time.tv_sec = t2.tv_sec + t1.tv_sec;
time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
@@ -113,18 +118,13 @@ uint64_t odp_time_to_u64(odp_time_t time)
return time_to_ns(time) / resolution;
 }
 
-odp_time_t odp_time_null(void)
-{
-   return (struct timespec) {0, 0};
-}
-
 int odp_time_global_init(void)
 {
int ret;
-   struct timespec time;
+   _odp_time_t time;
 
-   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
-   start_time = ret ? odp_time_null() : time;
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
+   start_time = ret ? ODP_TIME_NULL : time.ex;
 
return ret;
 }
-- 
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 v2] helper: add cuckoo hash implementation

2015-12-14 Thread Mike Holmes
Added to Tuesday agenda

On 12 December 2015 at 22:18, HePeng  wrote:

> Ping.
>
> So what is your decision on this.
>
> 在 2015年12月10日,下午1:06,HePeng  写道:
>
>
> 在 2015年12月9日,下午6:49,Ola Liljedahl  写道:
>
> On 9 December 2015 at 06:31, HePeng  wrote:
>
>>
>> 在 2015年12月8日,下午9:34,Ola Liljedahl  写道:
>>
>> On 8 December 2015 at 12:42, Bill Fischofer 
>> wrote:
>>
>>> This is an interesting topic.  I'd like to discuss this a bit during
>>> today's ODP public call.
>>>
>>> I think the issue is that while a ring is a very useful implementation
>>> construct its semantics are very SW centric.
>>>
>> But isn't the use case here SW centric?
>>
>>
>>> Perhaps there's opportunity here for a new Queue type that would permit
>>> an implementation to implement the queue API as a ring for additional
>>> performance?
>>>
>> I think it is a bad idea to overload the ODP queue with another type of
>> usage and implied implementation. Better to define a new ODP object.
>>
>> What are the real requirements of the "ring" as used by the cuckoo hash
>> design? Enqueue/dequeue operations. Fixed size is OK? Storing arbitrary
>> objects (not just ODP events)?
>>
>>
>> The real requirement is use the ring as a sort of container.
>> Fixed Size is OK. And the ring should be used to
>> store any ODP events, since it is used as a container,
>> like vector in C++ STL.
>>
> What if I would like to store objects that are not ODP events in the
> cuckoo hash table? E.g. arbitrary pointers (to memory that is managed in
> some other way).
>
> Yes, that is currently ring’s implementation.
>
>
>
>>
>>
>>
>>
>>>   The scheduler itself could use this since its use of queues is subject
>>> to the same issues.
>>>
>>> On Mon, Dec 7, 2015 at 11:39 PM, HePeng  wrote:
>>>
 Hi Maxim,
 I implement a new version of cuckoo hash based on the ODP
 buffer/pool.

 As I’ve mentioned earlier, the use of ring in cuckoo hash is
 like to the use of
 a container, e.g. a queue in C++ STL.  In current ODP implementation, I
 found that
 the ODP queue is implemented more likely a facility for transmitting
 objects, not
 a container to store objects. Look at the ODP queue enqueue interface:

 int odp_queue_enq(odp_queue_t queue, odp_event_t ev);

 the *odp_event_t* is related to the events, but I only want to use
 odp_queue to
 storing and retrieving objects, any objects.


 So I use ODP buffer/pool interfaces instead of ODP queue
 for the new cuckoo hash implementation.

 However, compared to the previous implementation based on ring,
 this version
 suffers a serious performance degradation. The evaluation is carried
 out on a Intel
 servers. I test lookup time for 1000 lookups on a table storing 1
 million items.
 The ODP buffer/pool version suffers at least a 2x performance
 degradation.

 This is the buffer/pool version, for 1M insert, and 1000 lookup time:

 Average insert time = 2.383836, lookup time = 0.000353,

 This is the ring version.

 Average insert time = 1.629115, lookup time = 0.98

 This performance degradation stems from the heavy
 implementation of
  ODP buffer/pool. In the ring based one, all the key is stored in a big
 array, and
 the ring only stores the array indexes of each key. Keys are retrieved
 using array indexes.
 In the new one, I use ODP buffer to store the key content. Keys are
 retrieved by
 dereferencing a *odp_buffer_t*  handle.

 With this high performance degradation, I suggest moving ring
 into the odp/api
 as a container implementation, and use the previous implementation of
 cuckoo hash.






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


-- 
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] helper: hashtable: include only needed odp headers

2015-12-14 Thread Ivan Khoronzhuk



On 14.12.15 21:15, Mike Holmes wrote:



On 3 December 2015 at 06:27, Ivan Khoronzhuk mailto:ivan.khoronz...@linaro.org>> wrote:

No need to include all headers in hashtable and lineartable.
rwlock and shared_memory is enough. It allows to see which odp
parts are used.


To make all of the helpers lib clean of the general odp.h  we also need to fix
include/odp/helper/linux.h:#include 

Presumably the tests are considered applications and they only include odp.h
test/odp_chksum.c:#include 
test/odp_process.c:#include 
test/odp_table.c:#include 
test/odp_thread.c:#include 



Yep


Signed-off-by: Ivan Khoronzhuk mailto:ivan.khoronz...@linaro.org>>

---
  helper/hashtable.c   | 3 ++-
  helper/lineartable.c | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/helper/hashtable.c b/helper/hashtable.c
index 1121beb..07f4c59 100644
--- a/helper/hashtable.c
+++ b/helper/hashtable.c
@@ -10,7 +10,8 @@
  #include "odph_hashtable.h"
  #include "odph_list_internal.h"
  #include "odph_debug.h"
-#include 
+#include 
+#include 

  #defineODPH_SUCCESS0
  #defineODPH_FAIL   -1
diff --git a/helper/lineartable.c b/helper/lineartable.c
index b0759f9..133f70d 100644
--- a/helper/lineartable.c
+++ b/helper/lineartable.c
@@ -10,7 +10,8 @@

  #include "odph_lineartable.h"
  #include "odph_debug.h"
-#include 
+#include 
+#include 

  #define ODPH_SUCCESS   0
  #define ODPH_FAIL  -1
--
1.9.1

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




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

__




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


Re: [lng-odp] [PATCH] helper: hashtable: include only needed odp headers

2015-12-14 Thread Mike Holmes
On 3 December 2015 at 06:27, Ivan Khoronzhuk 
wrote:

> No need to include all headers in hashtable and lineartable.
> rwlock and shared_memory is enough. It allows to see which odp
> parts are used.
>
>
To make all of the helpers lib clean of the general odp.h  we also need to
fix
include/odp/helper/linux.h:#include 

Presumably the tests are considered applications and they only include odp.h
test/odp_chksum.c:#include 
test/odp_process.c:#include 
test/odp_table.c:#include 
test/odp_thread.c:#include 


> Signed-off-by: Ivan Khoronzhuk 

---
>  helper/hashtable.c   | 3 ++-
>  helper/lineartable.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/helper/hashtable.c b/helper/hashtable.c
> index 1121beb..07f4c59 100644
> --- a/helper/hashtable.c
> +++ b/helper/hashtable.c
> @@ -10,7 +10,8 @@
>  #include "odph_hashtable.h"
>  #include "odph_list_internal.h"
>  #include "odph_debug.h"
> -#include 
> +#include 
> +#include 
>
>  #defineODPH_SUCCESS0
>  #defineODPH_FAIL   -1
> diff --git a/helper/lineartable.c b/helper/lineartable.c
> index b0759f9..133f70d 100644
> --- a/helper/lineartable.c
> +++ b/helper/lineartable.c
> @@ -10,7 +10,8 @@
>
>  #include "odph_lineartable.h"
>  #include "odph_debug.h"
> -#include 
> +#include 
> +#include 
>
>  #define ODPH_SUCCESS   0
>  #define ODPH_FAIL  -1
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>



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


[lng-odp] [API-NEXT PATCH 0/6] api: time: add rate and delay APIs

2015-12-14 Thread Ivan Khoronzhuk
This series adds odp_time_local_rate() and odp_time_delay() calls to
time API and it's validation tests and usage.

Ivan Khoronzhuk (6):
  api: time: add rate and delay API calls
  performance: pktio_perf: use odp_time_delay() function instead of
looping
  validation: time: test time constants in ns
  validation: time: add test convertsion on 0
  validation: time: add test for odp_time_local_rate() and use
resolution
  validation: time: add test for odp_time_delay()

 include/odp/api/time.h| 12 ++
 platform/linux-generic/odp_time.c | 21 ++
 test/performance/odp_pktio_perf.c | 17 +---
 test/validation/time/time.c   | 86 ---
 test/validation/time/time.h   |  3 ++
 5 files changed, 109 insertions(+), 30 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 PATCH 3/6] validation: time: test time constants in ns

2015-12-14 Thread Ivan Khoronzhuk
Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 10 ++
 test/validation/time/time.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 50d9bdc..4040b9f 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -12,6 +12,15 @@
 #define BUSY_LOOP_CNT  3000/* used for t > min resolution */
 #define BUSY_LOOP_CNT_LONG 120 /* used for t > 4 sec */
 
+void time_test_odp_constants(void)
+{
+   uint64_t ns;
+
+   ns = ODP_TIME_SEC_IN_NS / 1000;
+   CU_ASSERT(ns == ODP_TIME_MSEC_IN_NS);
+   ns /= 1000;
+   CU_ASSERT(ns == ODP_TIME_USEC_IN_NS);
+}
 
 /* check that related conversions come back to the same value */
 void time_test_odp_conversion(void)
@@ -242,6 +251,7 @@ void time_test_odp_to_u64(void)
 }
 
 odp_testinfo_t time_suite_time[] = {
+   ODP_TEST_INFO(time_test_odp_constants),
ODP_TEST_INFO(time_test_odp_conversion),
ODP_TEST_INFO(time_test_monotony),
ODP_TEST_INFO(time_test_odp_cmp),
diff --git a/test/validation/time/time.h b/test/validation/time/time.h
index b0c67b7..3407138 100644
--- a/test/validation/time/time.h
+++ b/test/validation/time/time.h
@@ -10,6 +10,7 @@
 #include 
 
 /* test functions: */
+void time_test_odp_constants(void);
 void time_test_odp_conversion(void);
 void time_test_monotony(void);
 void time_test_odp_cmp(void);
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH 4/6] validation: time: add test convertsion on 0

2015-12-14 Thread Ivan Khoronzhuk
Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 4040b9f..cef 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -50,6 +50,10 @@ void time_test_odp_conversion(void)
upper_limit = ns1 + TOLERANCE;
lower_limit = ns1 - TOLERANCE;
CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
+
+   /* test on 0 */
+   ns1 = odp_time_to_ns(ODP_TIME_NULL);
+   CU_ASSERT(ns1 == 0);
 }
 
 void time_test_monotony(void)
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH 2/6] performance: pktio_perf: use odp_time_delay() function instead of looping

2015-12-14 Thread Ivan Khoronzhuk
Now odp_time_delay() can be used instead of own implementation.

Signed-off-by: Ivan Khoronzhuk 
---
 test/performance/odp_pktio_perf.c | 17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index 8737bc8..32758c1 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -591,20 +591,6 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
 }
 
 /*
- * Busy loop for specified length of time.
- */
-static void busy_loop_ns(uint64_t wait_ns)
-{
-   odp_time_t wait = odp_time_local_from_ns(wait_ns);
-   odp_time_t cur = odp_time_local();
-   odp_time_t end_time = odp_time_sum(cur, wait);
-
-   do {
-   cur = odp_time_local();
-   } while (odp_time_cmp(end_time, cur) > 0);
-}
-
-/*
  * Run a single instance of the throughput test. When attempting to determine
  * the maximum packet rate this will be invoked multiple times with the only
  * difference between runs being the target PPS rate.
@@ -617,6 +603,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
thread_args_t args_tx, args_rx;
uint64_t expected_tx_cnt;
int num_tx_workers, num_rx_workers;
+   odp_time_t shutdown_delay = odp_time_local_from_ns(SHUTDOWN_DELAY_NS);
 
odp_atomic_store_u32(&shutdown, 0);
 
@@ -647,7 +634,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
num_tx_workers);
 
/* delay to allow transmitted packets to reach the receivers */
-   busy_loop_ns(SHUTDOWN_DELAY_NS);
+   odp_time_delay(shutdown_delay);
 
/* indicate to the receivers to exit */
odp_atomic_store_u32(&shutdown, 1);
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH 1/6] api: time: add rate and delay API calls

2015-12-14 Thread Ivan Khoronzhuk
This patch adds odp_time_local_rate() and odp_time_delay() APIs.

Signed-off-by: Ivan Khoronzhuk 
---
 include/odp/api/time.h| 12 
 platform/linux-generic/odp_time.c | 21 +
 2 files changed, 33 insertions(+)

diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index 9865d81..75644ca 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -101,6 +101,18 @@ odp_time_t odp_time_local_from_ns(uint64_t ns);
 int odp_time_cmp(odp_time_t t2, odp_time_t t1);
 
 /**
+ * Get local time rate
+ */
+uint64_t odp_time_local_rate(void);
+
+/**
+ * Wait on for specified length of time
+ *
+ * @param delaytime to wait
+ */
+void odp_time_delay(odp_time_t delay);
+
+/**
  * Get printable value for an odp_time_t
  *
  * @param time time to be printed
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index 1c7c214..182522d 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -98,6 +98,27 @@ odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
return time;
 }
 
+uint64_t odp_time_local_rate(void)
+{
+   int ret;
+   struct timespec tres;
+
+   ret = clock_getres(CLOCK_MONOTONIC_RAW, &tres);
+   if (odp_unlikely(ret != 0))
+   ODP_ABORT("clock_getres failed\n");
+
+   return ODP_TIME_SEC_IN_NS / (uint64_t)tres.tv_nsec;
+}
+
+void odp_time_delay(odp_time_t delay)
+{
+   odp_time_t cur = odp_time_local();
+   odp_time_t end_time = odp_time_sum(cur, delay);
+
+   while (odp_time_cmp(end_time, cur) > 0)
+   cur = odp_time_local();
+}
+
 uint64_t odp_time_to_u64(odp_time_t time)
 {
int ret;
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH 6/6] validation: time: add test for odp_time_delay()

2015-12-14 Thread Ivan Khoronzhuk
This patch adds validation test for odp_time_delay(). Also it visually
demonstrates 5 second count.

Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 26 ++
 test/validation/time/time.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 8b77fea..8d9fe5c 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -12,6 +12,7 @@
 #define BUSY_LOOP_CNT_LONG 120 /* used for t > 4 sec */
 #define MIN_TIME_RATE  32000
 #define MAX_TIME_RATE  150
+#define DELAY_TOLERANCE50  /* deviation for delay */
 
 static uint64_t res;
 
@@ -244,6 +245,30 @@ void time_test_odp_sum(void)
CU_ASSERT(odp_time_cmp(t2, sum) == 0);
 }
 
+void time_test_delay(void)
+{
+   int i;
+   odp_time_t start_time, end_time, diff;
+   odp_time_t lower_limit, upper_limit, tolerance;
+   odp_time_t second = odp_time_local_from_ns(ODP_TIME_SEC_IN_NS);
+
+   start_time = odp_time_local();
+   for (i = 1; i < 6; i++) {
+   odp_time_delay(second);
+   printf("%d..", i);
+   }
+   end_time = odp_time_local();
+
+   diff = odp_time_diff(end_time, start_time);
+   tolerance = odp_time_local_from_ns(DELAY_TOLERANCE);
+
+   lower_limit = odp_time_diff(diff, tolerance);
+   upper_limit = odp_time_sum(diff, tolerance);
+
+   CU_ASSERT(odp_time_cmp(diff, lower_limit) >= 0);
+   CU_ASSERT(odp_time_cmp(diff, upper_limit) <= 0);
+}
+
 void time_test_odp_to_u64(void)
 {
volatile int count = 0;
@@ -277,6 +302,7 @@ odp_testinfo_t time_suite_time[] = {
ODP_TEST_INFO(time_test_odp_cmp),
ODP_TEST_INFO(time_test_odp_diff),
ODP_TEST_INFO(time_test_odp_sum),
+   ODP_TEST_INFO(time_test_delay),
ODP_TEST_INFO(time_test_odp_to_u64),
ODP_TEST_INFO_NULL
 };
diff --git a/test/validation/time/time.h b/test/validation/time/time.h
index c275b39..72eea1b 100644
--- a/test/validation/time/time.h
+++ b/test/validation/time/time.h
@@ -17,6 +17,7 @@ void time_test_monotony(void);
 void time_test_odp_cmp(void);
 void time_test_odp_diff(void);
 void time_test_odp_sum(void);
+void time_test_delay(void);
 void time_test_odp_to_u64(void);
 
 /* test arrays: */
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCH 5/6] validation: time: add test for odp_time_local_rate() and use resolution

2015-12-14 Thread Ivan Khoronzhuk
This function is used to get resolution, that test uses to check
other APIs.

Signed-off-by: Ivan Khoronzhuk 
---
 test/validation/time/time.c | 46 ++---
 test/validation/time/time.h |  1 +
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index cef..8b77fea 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -8,9 +8,12 @@
 #include "odp_cunit_common.h"
 #include "time.h"
 
-#define TOLERANCE 1
 #define BUSY_LOOP_CNT  3000/* used for t > min resolution */
 #define BUSY_LOOP_CNT_LONG 120 /* used for t > 4 sec */
+#define MIN_TIME_RATE  32000
+#define MAX_TIME_RATE  150
+
+static uint64_t res;
 
 void time_test_odp_constants(void)
 {
@@ -22,6 +25,18 @@ void time_test_odp_constants(void)
CU_ASSERT(ns == ODP_TIME_USEC_IN_NS);
 }
 
+void time_test_rate(void)
+{
+   uint64_t rate;
+
+   rate = odp_time_local_rate();
+   CU_ASSERT(rate > MIN_TIME_RATE);
+   CU_ASSERT(rate < MAX_TIME_RATE);
+
+   res = ODP_TIME_SEC_IN_NS / rate;
+   res = res ? res : 1;
+}
+
 /* check that related conversions come back to the same value */
 void time_test_odp_conversion(void)
 {
@@ -36,8 +51,8 @@ void time_test_odp_conversion(void)
 
/* need to check within arithmetic tolerance that the same
 * value in ns is returned after conversions */
-   upper_limit = ns1 + TOLERANCE;
-   lower_limit = ns1 - TOLERANCE;
+   upper_limit = ns1 + res;
+   lower_limit = ns1 - res;
CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
 
ns1 = 60 * 11 * ODP_TIME_SEC_IN_NS;
@@ -47,8 +62,8 @@ void time_test_odp_conversion(void)
 
/* need to check within arithmetic tolerance that the same
 * value in ns is returned after conversions */
-   upper_limit = ns1 + TOLERANCE;
-   lower_limit = ns1 - TOLERANCE;
+   upper_limit = ns1 + res;
+   lower_limit = ns1 - res;
CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
 
/* test on 0 */
@@ -151,8 +166,8 @@ void time_test_odp_diff(void)
ns = ns2 - ns1;
nsdiff = odp_time_to_ns(diff);
 
-   upper_limit = ns + TOLERANCE;
-   lower_limit = ns - TOLERANCE;
+   upper_limit = ns + res;
+   lower_limit = ns - res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
 
/* test timestamp and interval diff */
@@ -164,8 +179,8 @@ void time_test_odp_diff(void)
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
nsdiff = odp_time_to_ns(diff);
 
-   upper_limit = ns + TOLERANCE;
-   lower_limit = ns - TOLERANCE;
+   upper_limit = ns + res;
+   lower_limit = ns - res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
 
/* test interval diff */
@@ -177,8 +192,8 @@ void time_test_odp_diff(void)
CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
nsdiff = odp_time_to_ns(diff);
 
-   upper_limit = ns + TOLERANCE;
-   lower_limit = ns - TOLERANCE;
+   upper_limit = ns + res;
+   lower_limit = ns - res;
CU_ASSERT((nsdiff <= upper_limit) && (nsdiff >= lower_limit));
 
/* same time has to diff to 0 */
@@ -207,8 +222,8 @@ void time_test_odp_sum(void)
CU_ASSERT(odp_time_cmp(sum, ODP_TIME_NULL) > 0);
nssum = odp_time_to_ns(sum);
 
-   upper_limit = ns + TOLERANCE;
-   lower_limit = ns - TOLERANCE;
+   upper_limit = ns + res;
+   lower_limit = ns - res;
CU_ASSERT((nssum <= upper_limit) && (nssum >= lower_limit));
 
/* sum intervals */
@@ -220,8 +235,8 @@ void time_test_odp_sum(void)
CU_ASSERT(odp_time_cmp(sum, ODP_TIME_NULL) > 0);
nssum = odp_time_to_ns(sum);
 
-   upper_limit = ns + TOLERANCE;
-   lower_limit = ns - TOLERANCE;
+   upper_limit = ns + res;
+   lower_limit = ns - res;
CU_ASSERT((nssum <= upper_limit) && (nssum >= lower_limit));
 
/* test on 0 */
@@ -256,6 +271,7 @@ void time_test_odp_to_u64(void)
 
 odp_testinfo_t time_suite_time[] = {
ODP_TEST_INFO(time_test_odp_constants),
+   ODP_TEST_INFO(time_test_rate),
ODP_TEST_INFO(time_test_odp_conversion),
ODP_TEST_INFO(time_test_monotony),
ODP_TEST_INFO(time_test_odp_cmp),
diff --git a/test/validation/time/time.h b/test/validation/time/time.h
index 3407138..c275b39 100644
--- a/test/validation/time/time.h
+++ b/test/validation/time/time.h
@@ -11,6 +11,7 @@
 
 /* test functions: */
 void time_test_odp_constants(void);
+void time_test_rate(void);
 void time_test_odp_conversion(void);
 void time_test_monotony(void);
 void time_test_odp_cmp(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 2/7] api: pktio: added multiple pktio input queues

2015-12-14 Thread Zoltan Kiss

Hi,

I wanted to raise some questions about this, unfortunately it fell off 
the radar for a while.


On 26/11/15 08:35, Petri Savolainen wrote:

Added input queue configuration parameters and functions
to setup multiple input queue and hashing. Added also
functions to query the number of queues and queue handles.
Direct receive does use new odp_pktin_queue_t handle type.

Signed-off-by: Petri Savolainen 
---
  include/odp/api/packet_io.h| 136 +
  .../include/odp/plat/packet_io_types.h |   2 +
  2 files changed, 138 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 264fa75..26c9be5 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -19,6 +19,7 @@ extern "C" {
  #endif

  #include 
+#include 

  /** @defgroup odp_packet_io ODP PACKET IO
   *  Operations on a packet Input/Output interface.
@@ -42,6 +43,11 @@ extern "C" {
   */

  /**
+ * @typedef odp_pktin_queue_t
+ * Direct packet input queue handle


What's the difference between a ODP_PKTIN_MODE_RECV and a 
ODP_PKTIN_MODE_POLL queue? Apart from using different functions for receive?




+ */
+
+/**
   * @def ODP_PKTIO_INVALID
   * Invalid packet IO handle
   */
@@ -85,6 +91,66 @@ typedef enum odp_pktio_output_mode_t {
  } odp_pktio_output_mode_t;

  /**
+ * Packet input hash protocols
+ *
+ * The list of protocol header field combinations, which are included into
+ * packet input hash calculation.


What happens if a platform doesn't support a particular field to be 
hashed? I guess that means the platform has to emulate that bit from 
software, right? Maybe worth to indicate that somehow? Or give a way for 
the app to query what fields the platform can include in the hash?



+ */
+typedef union odp_pktin_hash_proto_t {
+   /** Protocol header fields for hashing */
+   struct {
+   /** IPv4 addresses and UDP port numbers */
+   uint32_t ipv4_udp : 1;
+   /** IPv4 addresses and TCP port numbers */
+   uint32_t ipv4_tcp : 1;
+   /** IPv4 addresses */
+   uint32_t ipv4 : 1;
+   /** IPv6 addresses and UDP port numbers */
+   uint32_t ipv6_udp : 1;
+   /** IPv6 addresses and TCP port numbers */
+   uint32_t ipv6_tcp : 1;
+   /** IPv6 addresses */
+   uint32_t ipv6 : 1;
+   } proto;
+
+   /** All bits of the bit field structure */
+   uint32_t all_bits;
+} odp_pktin_hash_proto_t;
+
+/**
+ * Packet input queue parameters
+ */
+typedef struct odp_pktio_input_queue_param_t {
+   /** Single thread per queue. Enable performance optimization when each
+ * queue has only single user.
+ * 0: Queue is multi-thread safe
+ * 1: Queue is used by single thread only */
+   odp_bool_t single_user;
+
+   /** Enable flow hashing
+ * 0: Do not hash flows
+ * 1: Hash flows to input queues */
+   odp_bool_t hash_enable;
+
+   /** Protocol field selection for hashing. Multiple protocols can be
+ * selected. */
+   odp_pktin_hash_proto_t hash_proto;
+
+   /** Number of input queues to be created. More than one input queue
+ * require input hashing or classifier setup. Hash_proto is ignored
+ * when hash_enable is zero or num_queues is one. This value must be


OVS use the hashes even with one queue, it's useful for fast lookup in 
flow tables. Is there any reason to automatically disable it?




+ * between 1 and interface capability. Queue type is defined by the
+ * input mode. */
+   unsigned num_queues;
+
+   /** Queue parameters for creating input queues in ODP_PKTIN_MODE_POLL
+ * or ODP_PKTIN_MODE_SCHED modes. Scheduler parameters are considered
+ * only in ODP_PKTIN_MODE_SCHED mode. */
+   odp_queue_param_t queue_param;
+
+} odp_pktio_input_queue_param_t;
+
+/**
   * Packet IO parameters
   *
   * In minimum, user must select input and output modes. Use 0 for defaults.
@@ -158,6 +224,67 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t 
pool,
  int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa);

  /**
+ * Configure packet input queues
+ *
+ * Setup a number of packet input queues and configure those. The maximum 
number
+ * of queues is platform dependent and can be queried with
+ * odp_pktio_capability(). Queue handles for input queues can be requested with
+ * odp_pktio_in_queues() or odp_pktio_pktin_queues() after this call. All
+ * requested queues are setup on success, no queues are setup on failure.


Maybe worth to spell out that you can only call this on a stopped 
interface, and if it's not the first time since you opened the pktio, 
previous queue handles become invalid.



+ *
+ * @param pktioPacket IO handle
+ * @param paramPacket input queue configuration parameters
+ *
+ * @retval 0 on success
+ *

Re: [lng-odp] Does ODP support DPDK flow director feature APIs?

2015-12-14 Thread Mike Holmes
CCing ODP-DPDK list


On 14 December 2015 at 05:00, Krishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> including odp team.
>
> /Krishna
>
> On 13 December 2015 at 20:40, Dapeng Liu  wrote:
>
>> Hi Wenxian,
>>
>> I checked the API document but failed to find a exact matching function.
>> Just share my understanding with you.
>>
>> ODP has an event distribution model working as below:
>> 1) packet classified to COS(class of service),
>> 2) COS associated to queue
>> 3) queue associated to worker thread.
>> Although the worker thread could be created with pinned CPU with
>> odph_linux_pthread_create. The problem is that packet classification at the
>> first step is based on some certain fields in the frame, which is either IP
>> or port or something else but hard to be the combination unless with some
>> carefully defined offset and mask. Moreover user has to specify the desired
>> matched value. So seemingly it is hard to achieve the flow(5-tuples) based
>> distribution where we never specify the matched value.
>>
>> If it indeed turns out to be a missing function, I think it could be a
>> good candidate feature in the future for ODP.
>> However given the shallow understanding of ODP, I am probably wrong :)
>>
>> Let's wait for experts' comments.
>>
>> Best Regards,
>> Dapeng
>>
>> ​
>>
>
>


-- 
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] linux-generic: fix tap compilation

2015-12-14 Thread Maxim Uvarov

Merged,
Maxim.

On 12/14/2015 18:31, Bill Fischofer wrote:



On Mon, Dec 14, 2015 at 9:26 AM, Maxim Uvarov > wrote:


pktio/tap.c:267:21: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
   } else if (retval != pkt_len) {

Cc: Ilya Maximets mailto:i.maxim...@samsung.com>>
Signed-off-by: Maxim Uvarov mailto:maxim.uva...@linaro.org>>


Reviewed-by: Bill Fischofer >


---
 platform/linux-generic/pktio/tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/tap.c
b/platform/linux-generic/pktio/tap.c
index 7ecb300..99e15ce 100644
--- a/platform/linux-generic/pktio/tap.c
+++ b/platform/linux-generic/pktio/tap.c
@@ -264,7 +264,7 @@ static int tap_pktio_send(pktio_entry_t
*pktio_entry, odp_packet_t pkts[],
return -1;
}
break;
-   } else if (retval != pkt_len) {
+   } else if ((uint32_t)retval != pkt_len) {
ODP_ERR("sent partial ethernet packet\n");
if (i == 0) {
__odp_errno = EMSGSIZE;
--
1.9.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] linux-generic: fix tap compilation

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 9:26 AM, Maxim Uvarov 
wrote:

> pktio/tap.c:267:21: error: comparison between signed and
> unsigned integer expressions [-Werror=sign-compare]
>} else if (retval != pkt_len) {
>
> Cc: Ilya Maximets 
> Signed-off-by: Maxim Uvarov 
>

Reviewed-by: Bill Fischofer 


> ---
>  platform/linux-generic/pktio/tap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/pktio/tap.c
> b/platform/linux-generic/pktio/tap.c
> index 7ecb300..99e15ce 100644
> --- a/platform/linux-generic/pktio/tap.c
> +++ b/platform/linux-generic/pktio/tap.c
> @@ -264,7 +264,7 @@ static int tap_pktio_send(pktio_entry_t *pktio_entry,
> odp_packet_t pkts[],
> return -1;
> }
> break;
> -   } else if (retval != pkt_len) {
> +   } else if ((uint32_t)retval != pkt_len) {
> ODP_ERR("sent partial ethernet packet\n");
> if (i == 0) {
> __odp_errno = EMSGSIZE;
> --
> 1.9.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] linux-generic: init: return -1 when system_info is failed

2015-12-14 Thread Ivan Khoronzhuk

ping

On 03.12.15 14:58, Ivan Khoronzhuk wrote:

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/odp_init.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index 5e19d86..087bfdf 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -25,7 +25,10 @@ int odp_init_global(const odp_init_t *params,
}


-   odp_system_info_init();
+   if (odp_system_info_init()) {
+   ODP_ERR("ODP shm init failed.\n");
+   return -1;
+   }

if (odp_shm_init_global()) {
ODP_ERR("ODP shm init failed.\n");



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


Re: [lng-odp] [PATCH] example: timer: free resources while termination

2015-12-14 Thread Ivan Khoronzhuk

ping

On 19.11.15 12:54, Ivan Khoronzhuk wrote:

Example should free resources in right order when terminates.
Also it should have correct error path.

Signed-off-by: Ivan Khoronzhuk 
---
  example/timer/odp_timer_test.c | 46 ++
  1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 94619e4..2d74e4c 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -331,18 +331,21 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
odp_shm_t shm;
test_globals_t  *gbls;
+   int err = 0;

printf("\nODP timer example starts\n");

if (odp_init_global(NULL, NULL)) {
+   err = 1;
printf("ODP global init failed.\n");
-   return -1;
+   goto err;
}

/* Init this thread. */
if (odp_init_local(ODP_THREAD_CONTROL)) {
+   err = 1;
printf("ODP local init failed.\n");
-   return -1;
+   goto err_global;
}

printf("\n");
@@ -360,14 +363,16 @@ int main(int argc, char *argv[])
shm = odp_shm_reserve("shm_test_globals", sizeof(test_globals_t),
  ODP_CACHE_LINE_SIZE, 0);
if (ODP_SHM_INVALID == shm) {
+   err = 1;
EXAMPLE_ERR("Error: shared mem reserve failed.\n");
-   return -1;
+   goto err_local;
}

gbls = odp_shm_addr(shm);
if (NULL == gbls) {
+   err = 1;
EXAMPLE_ERR("Error: shared mem alloc failed.\n");
-   return -1;
+   goto err_shm;
}
memset(gbls, 0, sizeof(test_globals_t));

@@ -404,8 +409,9 @@ int main(int argc, char *argv[])
gbls->pool = odp_pool_create("msg_pool", ¶ms);

if (gbls->pool == ODP_POOL_INVALID) {
+   err = 1;
EXAMPLE_ERR("Pool create failed.\n");
-   return -1;
+   goto err_shm;
}

tparams.res_ns = gbls->args.resolution_us*ODP_TIME_USEC;
@@ -416,8 +422,9 @@ int main(int argc, char *argv[])
tparams.clk_src = ODP_CLOCK_CPU;
gbls->tp = odp_timer_pool_create("timer_pool", &tparams);
if (gbls->tp == ODP_TIMER_POOL_INVALID) {
+   err = 1;
EXAMPLE_ERR("Timer pool create failed.\n");
-   return -1;
+   goto err_msg_pool;
}
odp_timer_pool_start();

@@ -442,8 +449,9 @@ int main(int argc, char *argv[])
queue = odp_queue_create("timer_queue", ODP_QUEUE_TYPE_SCHED, ¶m);

if (queue == ODP_QUEUE_INVALID) {
+   err = 1;
EXAMPLE_ERR("Timer queue create failed.\n");
-   return -1;
+   goto err_timer_pool;
}

printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
@@ -481,7 +489,29 @@ int main(int argc, char *argv[])
/* Wait for worker threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);

-   printf("ODP timer test complete\n\n");
+   /* free resources */
+   if (odp_queue_destroy(queue))
+   err = 1;
+err_timer_pool:
+   odp_timer_pool_destroy(gbls->tp);
+err_msg_pool:
+   if (odp_pool_destroy(gbls->pool))
+   err = 1;
+err_shm:
+   if (odp_shm_free(shm))
+   err = 1;
+err_local:
+   if (odp_term_local())
+   err = 1;
+err_global:
+   if (odp_term_global())
+   err = 1;
+err:
+   if (err) {
+   printf("Err: ODP timer test failed\n\n");
+   return -1;
+   }

+   printf("ODP timer test complete\n\n");
return 0;
  }



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


Re: [lng-odp] [PATCH] linux-generic: fix tap compilation

2015-12-14 Thread Ilya Maximets
Thanks.

Reviewed-by: Ilya Maximets 

On 14.12.2015 18:26, Maxim Uvarov wrote:
> pktio/tap.c:267:21: error: comparison between signed and
> unsigned integer expressions [-Werror=sign-compare]
>} else if (retval != pkt_len) {
> 
> Cc: Ilya Maximets 
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/pktio/tap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/platform/linux-generic/pktio/tap.c 
> b/platform/linux-generic/pktio/tap.c
> index 7ecb300..99e15ce 100644
> --- a/platform/linux-generic/pktio/tap.c
> +++ b/platform/linux-generic/pktio/tap.c
> @@ -264,7 +264,7 @@ static int tap_pktio_send(pktio_entry_t *pktio_entry, 
> odp_packet_t pkts[],
>   return -1;
>   }
>   break;
> - } else if (retval != pkt_len) {
> + } else if ((uint32_t)retval != pkt_len) {
>   ODP_ERR("sent partial ethernet packet\n");
>   if (i == 0) {
>   __odp_errno = EMSGSIZE;
> 
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] helper: hashtable: include only needed odp headers

2015-12-14 Thread Ivan Khoronzhuk

ping

On 03.12.15 13:27, Ivan Khoronzhuk wrote:

No need to include all headers in hashtable and lineartable.
rwlock and shared_memory is enough. It allows to see which odp
parts are used.

Signed-off-by: Ivan Khoronzhuk 
---
  helper/hashtable.c   | 3 ++-
  helper/lineartable.c | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/helper/hashtable.c b/helper/hashtable.c
index 1121beb..07f4c59 100644
--- a/helper/hashtable.c
+++ b/helper/hashtable.c
@@ -10,7 +10,8 @@
  #include "odph_hashtable.h"
  #include "odph_list_internal.h"
  #include "odph_debug.h"
-#include 
+#include 
+#include 

  #defineODPH_SUCCESS   0
  #defineODPH_FAIL  -1
diff --git a/helper/lineartable.c b/helper/lineartable.c
index b0759f9..133f70d 100644
--- a/helper/lineartable.c
+++ b/helper/lineartable.c
@@ -10,7 +10,8 @@

  #include "odph_lineartable.h"
  #include "odph_debug.h"
-#include 
+#include 
+#include 

  #define ODPH_SUCCESS  0
  #define ODPH_FAIL -1



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


[lng-odp] [PATCH] linux-generic: fix tap compilation

2015-12-14 Thread Maxim Uvarov
pktio/tap.c:267:21: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
   } else if (retval != pkt_len) {

Cc: Ilya Maximets 
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/tap.c 
b/platform/linux-generic/pktio/tap.c
index 7ecb300..99e15ce 100644
--- a/platform/linux-generic/pktio/tap.c
+++ b/platform/linux-generic/pktio/tap.c
@@ -264,7 +264,7 @@ static int tap_pktio_send(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
return -1;
}
break;
-   } else if (retval != pkt_len) {
+   } else if ((uint32_t)retval != pkt_len) {
ODP_ERR("sent partial ethernet packet\n");
if (i == 0) {
__odp_errno = EMSGSIZE;
-- 
1.9.1

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


Re: [lng-odp] [PATCH 1/6] linux:add thread type in odph_linux_pthread_create

2015-12-14 Thread Zoltan Kiss



On 14/12/15 07:55, Hemant Agrawal wrote:

The exisiting helper routine only create the worker threads.
However there is a need to use the same for creating the control thread as 
well. e.g. CLI thread.

Signed-off-by: Hemant Agrawal 
---
  helper/include/odp/helper/linux.h |  4 +++-
  helper/linux.c| 31 +++
  2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/helper/include/odp/helper/linux.h 
b/helper/include/odp/helper/linux.h
index ce61fdf..72f8f10 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/include/odp/helper/linux.h
@@ -59,12 +59,14 @@ typedef struct {
   * @param mask  CPU mask
   * @param start_routine Thread start function
   * @param arg   Thread argument
+ * @param thr_type  Thread type
   *
   * @return Number of threads created
   */
  int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
   const odp_cpumask_t *mask,
-  void *(*start_routine) (void *), void *arg);
+  void *(*start_routine) (void *), void *arg,
+  odp_thread_type_t thr_type);

  /**
   * Waits pthreads to exit
diff --git a/helper/linux.c b/helper/linux.c
index 4a8e8b3..497bd8c 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -44,9 +44,31 @@ static void *odp_run_start_routine(void *arg)
return ret_ptr;
  }

+static void *odp_run_start_contorl_routine(void *arg)
+{
+   odp_start_args_t *start_args = arg;
+
+   /* ODP thread local init for control thread */
+   if (odp_init_local(ODP_THREAD_CONTROL)) {


The above function parameter is the only real difference between this 
function and odp_run_start_routine(). I would rather make this thread 
type a part of start_args, and pass it from the caller. That would avoid 
a lot of code duplication ...




+   ODPH_ERR("Local init failed for control\n");
+   return NULL;
+   }
+
+   void *ret_ptr = start_args->start_routine(start_args->arg);
+   int ret = odp_term_local();
+
+   if (ret < 0)
+   ODPH_ERR("Local term failed for control\n");
+   else if (ret == 0 && odp_term_global())
+   ODPH_ERR("Global term failed for control\n");
+
+   return ret_ptr;
+}
+
  int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
  const odp_cpumask_t *mask_in,
- void *(*start_routine)(void *), void *arg)
+ void *(*start_routine)(void *), void *arg,
+ odp_thread_type_t thr_type)
  {
int i;
int num;
@@ -90,9 +112,10 @@ int odph_linux_pthread_create(odph_linux_pthread_t 
*thread_tbl,
thread_tbl[i].start_args->arg   = arg;

ret = pthread_create(&thread_tbl[i].thread,
-&thread_tbl[i].attr,
-odp_run_start_routine,
-thread_tbl[i].start_args);
+   &thread_tbl[i].attr,
+   thr_type == ODP_THREAD_WORKER ?
+   odp_run_start_routine : odp_run_start_contorl_routine,


... and you could avoid this complicated parameter passing.


+   thread_tbl[i].start_args);
if (ret != 0) {
ODPH_ERR("Failed to start thread on cpu #%d\n", cpu);
free(thread_tbl[i].start_args);


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


[lng-odp] [PATCH 2/2] validation: removing synchronizers tests

2015-12-14 Thread Christophe Milard
Now redundant with atomic, barrier and lock tests.

Signed-off-by: Christophe Milard 
---
 configure.ac   |1 -
 platform/linux-generic/test/Makefile.am|1 -
 test/validation/Makefile.am|1 -
 test/validation/synchronizers/.gitignore   |1 -
 test/validation/synchronizers/Makefile.am  |   10 -
 test/validation/synchronizers/synchronizers.c  | 1626 
 test/validation/synchronizers/synchronizers.h  |   53 -
 test/validation/synchronizers/synchronizers_main.c |   12 -
 8 files changed, 1705 deletions(-)
 delete mode 100644 test/validation/synchronizers/.gitignore
 delete mode 100644 test/validation/synchronizers/Makefile.am
 delete mode 100644 test/validation/synchronizers/synchronizers.c
 delete mode 100644 test/validation/synchronizers/synchronizers.h
 delete mode 100644 test/validation/synchronizers/synchronizers_main.c

diff --git a/configure.ac b/configure.ac
index 7a05574..9b3ecd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -368,7 +368,6 @@ AC_CONFIG_FILES([Makefile
 test/validation/random/Makefile
 test/validation/scheduler/Makefile
 test/validation/std_clib/Makefile
-test/validation/synchronizers/Makefile
 test/validation/thread/Makefile
 test/validation/time/Makefile
 test/validation/timer/Makefile
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index aa246d2..db923b8 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -25,7 +25,6 @@ TESTS = pktio/pktio_run \
${top_builddir}/test/validation/random/random_main$(EXEEXT) \
${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \
${top_builddir}/test/validation/std_clib/std_clib_main$(EXEEXT) \
-   
${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \
${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \
${top_builddir}/test/validation/time/time_main$(EXEEXT) \
${top_builddir}/test/validation/timer/timer_main$(EXEEXT) \
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 9a5bbff..90d32ea 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -16,7 +16,6 @@ ODP_MODULES = atomic \
  random \
  scheduler \
  std_clib \
- synchronizers \
  thread \
  time \
  timer \
diff --git a/test/validation/synchronizers/.gitignore 
b/test/validation/synchronizers/.gitignore
deleted file mode 100644
index 6aad9df..000
--- a/test/validation/synchronizers/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-synchronizers_main
diff --git a/test/validation/synchronizers/Makefile.am 
b/test/validation/synchronizers/Makefile.am
deleted file mode 100644
index dd504d5..000
--- a/test/validation/synchronizers/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-include ../Makefile.inc
-
-noinst_LTLIBRARIES = libtestsynchronizers.la
-libtestsynchronizers_la_SOURCES = synchronizers.c
-
-test_PROGRAMS = synchronizers_main$(EXEEXT)
-dist_synchronizers_main_SOURCES = synchronizers_main.c
-synchronizers_main_LDADD = libtestsynchronizers.la $(LIBCUNIT_COMMON) $(LIBODP)
-
-EXTRA_DIST = synchronizers.h
diff --git a/test/validation/synchronizers/synchronizers.c 
b/test/validation/synchronizers/synchronizers.c
deleted file mode 100644
index cebe0d2..000
--- a/test/validation/synchronizers/synchronizers.c
+++ /dev/null
@@ -1,1626 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "synchronizers.h"
-
-#define VERBOSE0
-#define MAX_ITERATIONS 1000
-#define BARRIER_ITERATIONS 64
-
-#define SLOW_BARRIER_DELAY 400
-#define BASE_DELAY 6
-#define MIN_DELAY  1
-
-#define NUM_TEST_BARRIERS  BARRIER_ITERATIONS
-#define NUM_RESYNC_BARRIERS100
-
-#define ADD_SUB_CNT5
-
-#define CNT10
-#define BARRIER_DELAY  10
-#define U32_INIT_VAL   (1UL << 10)
-#define U64_INIT_VAL   (1ULL << 33)
-
-#define GLOBAL_SHM_NAME"GlobalLockTest"
-
-#define UNUSED __attribute__((__unused__))
-
-static odp_atomic_u32_t a32u;
-static odp_atomic_u64_t a64u;
-
-typedef __volatile uint32_t volatile_u32_t;
-typedef __volatile uint64_t volatile_u64_t;
-
-typedef struct {
-   odp_atomic_u32_t wait_cnt;
-} custom_barrier_t;
-
-typedef struct {
-   /* Global variables */
-   uint32_t g_num_threads;
-   uint32_t g_iterations;
-   uint32_t g_verbose;
-   uint32_t g_max_num_cores;
-
-   odp_barrier_t test_barriers[NUM_TEST_BARRIERS];
-   custom_barrier_t custom_b

[lng-odp] [PATCH 1/2] validation: synchro tests split into 3 groups

2015-12-14 Thread Christophe Milard
No functionnal changes: just code reordering to match the ODP modules.

Signed-off-by: Christophe Milard 
---
 configure.ac|3 +
 platform/linux-generic/test/Makefile.am |3 +
 test/validation/Makefile.am |5 +-
 test/validation/atomic/.gitignore   |1 +
 test/validation/atomic/Makefile.am  |   10 +
 test/validation/atomic/atomic.c |  441 
 test/validation/atomic/atomic.h |   33 +
 test/validation/atomic/atomic_main.c|   12 +
 test/validation/barrier/.gitignore  |1 +
 test/validation/barrier/Makefile.am |   10 +
 test/validation/barrier/barrier.c   |  370 ++
 test/validation/barrier/barrier.h   |   28 +
 test/validation/barrier/barrier_main.c  |   12 +
 test/validation/lock/.gitignore |1 +
 test/validation/lock/Makefile.am|   10 +
 test/validation/lock/lock.c | 1135 +++
 test/validation/lock/lock.h |   45 ++
 test/validation/lock/lock_main.c|   12 +
 18 files changed, 2131 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/atomic/.gitignore
 create mode 100644 test/validation/atomic/Makefile.am
 create mode 100644 test/validation/atomic/atomic.c
 create mode 100644 test/validation/atomic/atomic.h
 create mode 100644 test/validation/atomic/atomic_main.c
 create mode 100644 test/validation/barrier/.gitignore
 create mode 100644 test/validation/barrier/Makefile.am
 create mode 100644 test/validation/barrier/barrier.c
 create mode 100644 test/validation/barrier/barrier.h
 create mode 100644 test/validation/barrier/barrier_main.c
 create mode 100644 test/validation/lock/.gitignore
 create mode 100644 test/validation/lock/Makefile.am
 create mode 100644 test/validation/lock/lock.c
 create mode 100644 test/validation/lock/lock.h
 create mode 100644 test/validation/lock/lock_main.c

diff --git a/configure.ac b/configure.ac
index 4f89f03..7a05574 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,6 +349,8 @@ AC_CONFIG_FILES([Makefile
 test/api_test/Makefile
 test/performance/Makefile
 test/validation/Makefile
+test/validation/atomic/Makefile
+test/validation/barrier/Makefile
 test/validation/buffer/Makefile
 test/validation/classification/Makefile
 test/validation/config/Makefile
@@ -358,6 +360,7 @@ AC_CONFIG_FILES([Makefile
 test/validation/errno/Makefile
 test/validation/hash/Makefile
 test/validation/init/Makefile
+test/validation/lock/Makefile
 test/validation/packet/Makefile
 test/validation/pktio/Makefile
 test/validation/pool/Makefile
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index e629872..aa246d2 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -6,6 +6,8 @@ ODP_MODULES = pktio
 if test_vald
 TESTS = pktio/pktio_run \
pktio/pktio_run_tap \
+   ${top_builddir}/test/validation/atomic/atomic_main$(EXEEXT) \
+   ${top_builddir}/test/validation/barrier/barrier_main$(EXEEXT) \
${top_builddir}/test/validation/buffer/buffer_main$(EXEEXT) \

${top_builddir}/test/validation/classification/classification_main$(EXEEXT) \
${top_builddir}/test/validation/config/config_main$(EXEEXT) \
@@ -16,6 +18,7 @@ TESTS = pktio/pktio_run \
${top_builddir}/test/validation/init/init_main_ok$(EXEEXT) \
${top_builddir}/test/validation/init/init_main_abort$(EXEEXT) \
${top_builddir}/test/validation/init/init_main_log$(EXEEXT) \
+   ${top_builddir}/test/validation/lock/lock_main$(EXEEXT) \
${top_builddir}/test/validation/packet/packet_main$(EXEEXT) \
${top_builddir}/test/validation/pool/pool_main$(EXEEXT) \
${top_builddir}/test/validation/queue/queue_main$(EXEEXT) \
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 1711b93..9a5bbff 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -1,4 +1,6 @@
-ODP_MODULES = buffer \
+ODP_MODULES = atomic \
+ barrier \
+ buffer \
  classification \
  config \
  cpumask \
@@ -6,6 +8,7 @@ ODP_MODULES = buffer \
  errno \
  hash \
  init \
+ lock \
  queue \
  packet \
  pktio \
diff --git a/test/validation/atomic/.gitignore 
b/test/validation/atomic/.gitignore
new file mode 100644
index 000..610ffea
--- /dev/null
+++ b/test/validation/atomic/.gitignore
@@ -0,0 +1 @@
+atomic_main
diff --git a/test/validation/atomic/Makefile.am 
b/test/validation/atomic/Makefile.am
new file mode 100644
index 000..9b6bd63
--- /dev/null
+++ b/test/validation/atomic/Makefile.am
@@ -0,

Re: [lng-odp] [API-NEXT PATCHv3 2/2] api: init: removed platform_init struct definition

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)
This patch is OK. The other has issues.

Reviewed-by: Petri Savolainen 


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Monday, December 14, 2015 3:06 PM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [API-NEXT PATCHv3 2/2] api: init: removed platform_init
> struct definition
> 
> odp_platform_init defination in standard API will conflict with
> platform specific defination. better to keep it in the linux-generic
> or other platform init header file
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  include/odp/api/init.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 737ff6d..b11f642 100644
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -125,6 +125,7 @@ typedef struct odp_init_t {
>  } odp_init_t;
> 
>  /**
> + * @typedef odp_platform_init_t
>   * ODP platform initialization data
>   *
>   * @note ODP API does nothing with this data. It is the underlying
> @@ -132,8 +133,6 @@ typedef struct odp_init_t {
>   * It is required that the application takes care of identifying and
>   * passing any required platform specific data.
>   */
> -typedef struct odp_platform_init_t {
> -} odp_platform_init_t;
> 
> 
>  /**
> --
> 1.9.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] [API-NEXT PATCHv3 1/2] linux-generic: add the platform_init structure

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Monday, December 14, 2015 3:06 PM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [API-NEXT PATCHv3 1/2] linux-generic: add the
> platform_init structure
> 
> odp_platform_init structure is platform specific data, it is up
> to the platform specific implementation to define it.
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  platform/linux-generic/include/odp/init.h  |  2 ++
>  .../linux-generic/include/odp/plat/init_types.h| 35
> ++
>  2 files changed, 37 insertions(+)
>  create mode 100644 platform/linux-generic/include/odp/plat/init_types.h
> 
> diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-
> generic/include/odp/init.h
> index 950a4f8..3233e36 100644
> --- a/platform/linux-generic/include/odp/init.h
> +++ b/platform/linux-generic/include/odp/init.h
> @@ -17,6 +17,8 @@
>  extern "C" {
>  #endif
> 
> +#include 
> +

I think you need to add the new file also into 
platform/linux-generic/Makefile.am



>  /** @ingroup odp_initialization
>   *  @{
>   */
> diff --git a/platform/linux-generic/include/odp/plat/init_types.h
> b/platform/linux-generic/include/odp/plat/init_types.h
> new file mode 100644
> index 000..abcbe83
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/plat/init_types.h
> @@ -0,0 +1,35 @@
> +/* Copyright (c) 2015, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * ODP initialization.
> + */
> +
> +#ifndef ODP_INIT_TYPES_H_
> +#define ODP_INIT_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * ODP platform initialization data
> + *
> + * @note ODP API does nothing with this data. It is the underlying
> + * implementation that requires it and any data passed here is not
> portable.
> + * It is required that the application takes care of identifying and
> + * passing any required platform specific data.

Remove this doxygen documentation. It's redundant (public API file documents it 
already).

If doxygen complains you can add empty/short @internal documentation instead.

-Petri


> + */
> +typedef struct odp_platform_init_t {
> +} odp_platform_init_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 1.9.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] [API-NEXT/PATCHv1 1/4] api: classification: add class of serivce create api

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: EXT Balasubramanian Manoharan [mailto:bala.manoha...@linaro.org]
> Sent: Tuesday, December 08, 2015 12:22 PM
> To: lng-odp@lists.linaro.org
> Cc: Savolainen, Petri (Nokia - FI/Espoo); Balasubramanian Manoharan
> Subject: [API-NEXT/PATCHv1 1/4] api: classification: add class of serivce
> create api
> 
> class of service create function now takes pool, queue, drop policy and
> name as input parameters.
> Adds class of service parameter structure odp_cls_cos_param_t and
> initialization function odp_cls_cos_param_init()
> 
> Signed-off-by: Balasubramanian Manoharan 
> ---
>  include/odp/api/classification.h | 31 ++-
>  1 file changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/include/odp/api/classification.h
> b/include/odp/api/classification.h
> index 725e1ab..18572ad 100644
> --- a/include/odp/api/classification.h
> +++ b/include/odp/api/classification.h
> @@ -37,7 +37,7 @@ extern "C" {
> 
>  /**
>   * @def ODP_COS_INVALID
> - * This value is returned from odp_cos_create() on failure,
> + * This value is returned from odp_cls_cos_create() on failure,
>   * May also be used as a sink class of service that
>   * results in packets being discarded.
>   */
> @@ -60,9 +60,9 @@ extern "C" {
>   */
> 
>  /**
> - * Class-of-service packet drop policies
> + * class of service packet drop policies
>   */
> -typedef enum odp_cos_drop {
> +typedef enum odp_cls_drop {
>   ODP_COS_DROP_POOL,/**< Follow buffer pool drop policy */
>   ODP_COS_DROP_NEVER,/**< Never drop, ignoring buffer pool policy
> */
>  } odp_drop_e;


This type could be renamed to odp_cls_drop_t. odp_drop_e is pretty generic type 
name. All odp_xxx_e types should be renamed to odp_xxx_t to be consistent with 
type naming. This can be done now or in a later patch set.



> @@ -89,14 +89,35 @@ typedef enum odp_cos_hdr_flow_fields {
>  } odp_cos_hdr_flow_fields_e;
> 
>  /**
> + * Class of service parameters
> + * Used to communicate class of service creation options
> + */
> +typedef struct odp_cls_cos_param {
> + odp_queue_t queue;  /**< Queue associated with CoS */
> + odp_pool_t pool;/**< Pool associated with CoS */
> + odp_drop_e drop_policy; /**< Drop policy associated with CoS */
> +} odp_cls_cos_param_t;
> +
> +/**
> + * Initialize class of service parameters
> + *
> + * Initialize an odp_cls_cos_param_t to its default value for all fields
> + *
> + * @param param   Address of the odp_cls_cos_param_t to be initialized
> + */
> +void odp_cls_cos_param_init(odp_cls_cos_param_t *param);
> +
> +/**
>   * Create a class-of-service
>   *

The function documentation needs some words about parameter usage. E.g. can 
user pass ODP_QUEUE_INVALID and on which conditions?  The implementation seems 
to accept it and it's a valid input when defining a drop policy CoS...


>   * @param[in]  name  String intended for debugging purposes.

[in] not needed.

>   *
> - * @return   Class of service instance identifier
> + * @param[in]param   class of service parameters

[in] not needed. Could remove [in] throughout the entire header file in one 
patch (in the beginning of the series).


-Petri


> + *
> + * @retval   class of service handle
>   * @retval   ODP_COS_INVALID on failure.
>   */
> -odp_cos_t odp_cos_create(const char *name);
> +odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t
> *param);
> 
>  /**
>   * Discard a class-of-service along with all its associated resources
> --
> 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 2/2] api: init: removed platform_init struct definition

2015-12-14 Thread Hemant Agrawal
odp_platform_init defination in standard API will conflict with
platform specific defination. better to keep it in the linux-generic
or other platform init header file

Signed-off-by: Hemant Agrawal 
---
 include/odp/api/init.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 737ff6d..b11f642 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -125,6 +125,7 @@ typedef struct odp_init_t {
 } odp_init_t;
 
 /**
+ * @typedef odp_platform_init_t
  * ODP platform initialization data
  *
  * @note ODP API does nothing with this data. It is the underlying
@@ -132,8 +133,6 @@ typedef struct odp_init_t {
  * It is required that the application takes care of identifying and
  * passing any required platform specific data.
  */
-typedef struct odp_platform_init_t {
-} odp_platform_init_t;
 
 
 /**
-- 
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 1/2] linux-generic: add the platform_init structure

2015-12-14 Thread Hemant Agrawal
odp_platform_init structure is platform specific data, it is up
to the platform specific implementation to define it.

Signed-off-by: Hemant Agrawal 
---
 platform/linux-generic/include/odp/init.h  |  2 ++
 .../linux-generic/include/odp/plat/init_types.h| 35 ++
 2 files changed, 37 insertions(+)
 create mode 100644 platform/linux-generic/include/odp/plat/init_types.h

diff --git a/platform/linux-generic/include/odp/init.h 
b/platform/linux-generic/include/odp/init.h
index 950a4f8..3233e36 100644
--- a/platform/linux-generic/include/odp/init.h
+++ b/platform/linux-generic/include/odp/init.h
@@ -17,6 +17,8 @@
 extern "C" {
 #endif
 
+#include 
+
 /** @ingroup odp_initialization
  *  @{
  */
diff --git a/platform/linux-generic/include/odp/plat/init_types.h 
b/platform/linux-generic/include/odp/plat/init_types.h
new file mode 100644
index 000..abcbe83
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/init_types.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP initialization.
+ */
+
+#ifndef ODP_INIT_TYPES_H_
+#define ODP_INIT_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * ODP platform initialization data
+ *
+ * @note ODP API does nothing with this data. It is the underlying
+ * implementation that requires it and any data passed here is not portable.
+ * It is required that the application takes care of identifying and
+ * passing any required platform specific data.
+ */
+typedef struct odp_platform_init_t {
+} odp_platform_init_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
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: classification: check return value of pktio stop

2015-12-14 Thread Maxim Uvarov

Merged,
Maxim.

On 12/14/2015 15:29, Bill Fischofer wrote:



On Mon, Dec 14, 2015 at 6:00 AM, Balasubramanian Manoharan 
mailto:bala.manoha...@linaro.org>> wrote:


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

Signed-off-by: Balasubramanian Manoharan
mailto:bala.manoha...@linaro.org>>


Reviewed-by: Bill Fischofer >


---
 test/validation/classification/odp_classification_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git
a/test/validation/classification/odp_classification_common.c
b/test/validation/classification/odp_classification_common.c
index 665e67c..a56c017 100644
--- a/test/validation/classification/odp_classification_common.c
+++ b/test/validation/classification/odp_classification_common.c
@@ -29,7 +29,8 @@ int destroy_inq(odp_pktio_t pktio)
return -1;
}

-   odp_pktio_stop(pktio);
+   if (0 > odp_pktio_stop(pktio))
+   return -1;

if (0 > odp_pktio_inq_remdef(pktio))
return -1;
--
1.9.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


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


Re: [lng-odp] [API-NEXT PATCHv2] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 6:40 AM, Maxim Uvarov 
wrote:

> On 12/14/2015 14:39, Bill Fischofer wrote:
>
>>
>>
>> On Mon, Dec 14, 2015 at 3:24 AM, Maxim Uvarov > > wrote:
>>
>> On 12/11/2015 16:22, Bill Fischofer wrote:
>>
>> The linux-generic implementation of odp_time_t makes use of POSIX
>> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an
>> indirection
>> mechanism so that these dependencies do not "bleed through"
>> the ODP API.
>> This means that ODP applications can be independent of
>> _POSIX_C_SOURCE
>> level.
>>
>> Signed-off-by: Bill Fischofer > >
>> ---
>>   .../linux-generic/include/odp/plat/time_types.h |  9 ---
>>   platform/linux-generic/odp_time.c  | 30
>> +++---
>>   2 files changed, 20 insertions(+), 19 deletions(-)
>>
>> diff --git
>> a/platform/linux-generic/include/odp/plat/time_types.h
>> b/platform/linux-generic/include/odp/plat/time_types.h
>> index e5765ec..e999beb 100644
>> --- a/platform/linux-generic/include/odp/plat/time_types.h
>> +++ b/platform/linux-generic/include/odp/plat/time_types.h
>> @@ -21,11 +21,12 @@ extern "C" {
>>*  @{
>>**/
>>   -typedef struct timespec odp_time_t;
>> +typedef struct {
>> +   int64_t tv_sec;
>> +   int64_t tv_nsec;
>> +} odp_time_t;
>>
>>
>> Looks like that struct should be moved to ./include/odp/api/time.h
>> Overwise apps will relay on different time structures which
>> platforms can redifine.
>>
>>
>> odp_time_t, like other ODP types, expects a platform-dependent
>> definition.  There's no need to define the type as part of the ODP time
>> APIs.  I'll add this topic to today's arch call discussions.
>>
>
> In that case you need to add accessors and getters to time fields. I.e.
> apps can not directly relay on struct members.
> odp_time_sec(odp_time_t time)
> odp_time_sec_set(odp_time_t time)
> odp_time_nsec(odp_time_t time)
> odp_time_nsec_set(odp_time_t time)
>
> which looks ugly for me. It's better to define some common struct which
> apps can use directly.
>

That might not be a bad extension, but they are not currently part of the
API.  The only manipulations on odp_time_t currently defined are the
ability to convert an odp_time_t to and from nanoseconds, the ability to
get the current time, and the ability to add, subtract, and compare two
odp_time_t values.

>
> Maxim.
>
>
>> Also doxygen notes are missing:
>> /opt/Linaro/check-odp.git/build/odp-apply/include/odp/api/time.h:32:
>> warning: documented symbol `odp_time_t' was not declared or defined.
>>
>> /opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:25:
>> warning: Member tv_sec (variable) of class odp_time_t is not
>> documented.
>>
>> /opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:26:
>> warning: Member tv_nsec (variable) of class odp_time_t is not
>> documented.
>>
>> Maxim.
>>
>>
>>   -odp_time_t odp_time_null(void);
>> -
>> -#define ODP_TIME_NULL  odp_time_null()
>> +#define ODP_TIME_NULL ((odp_time_t){0, 0})
>> /**
>>* @}
>> diff --git a/platform/linux-generic/odp_time.c
>> b/platform/linux-generic/odp_time.c
>> index 1c7c214..9b64b37 100644
>> --- a/platform/linux-generic/odp_time.c
>> +++ b/platform/linux-generic/odp_time.c
>> @@ -11,7 +11,12 @@
>>   #include 
>>   #include 
>>   -static struct timespec start_time;
>> +typedef union {
>> +   odp_time_t  ex;
>> +   struct timespec in;
>> +} _odp_time_t;
>> +
>> +static odp_time_t start_time;
>> static inline
>>   uint64_t time_to_ns(odp_time_t time)
>> @@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
>>   static inline
>>   odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>>   {
>> -   struct timespec time;
>> +   odp_time_t time;
>> time.tv_sec = t2.tv_sec - t1.tv_sec;
>> time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
>> @@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2,
>> odp_time_t t1)
>>   odp_time_t odp_time_local(void)
>>   {
>> int ret;
>> -   struct timespec time;
>> +   _odp_time_t time;
>>   - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
>> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in
>> );
>>
>> if (odp_unlikely(ret != 0))
>> ODP_ABORT("clock_gettime failed\

Re: [lng-odp] [API-NEXT PATCHv2 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Monday, December 14, 2015 2:34 PM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [API-NEXT PATCHv2 1/2] linux-generic:adding the
> platform_init structure
> 
> odp_platform_init structure is platform specific data, it is up
> to the platform specific implementation to define it.
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  platform/linux-generic/include/odp/init.h | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/platform/linux-generic/include/odp/init.h b/platform/linux-
> generic/include/odp/init.h
> index 950a4f8..afa543c 100644
> --- a/platform/linux-generic/include/odp/init.h
> +++ b/platform/linux-generic/include/odp/init.h
> @@ -22,6 +22,17 @@ extern "C" {
>   */
> 
>  /**
> + * ODP platform initialization data
> + *
> + * @note ODP API does nothing with this data. It is the underlying
> + * implementation that requires it and any data passed here is not
> portable.
> + * It is required that the application takes care of identifying and
> + * passing any required platform specific data.

Should not repeat doxygen documentation here (on a platform specific header). 
When the public header file has the @typedef tag, entire doxygen comment can be 
removed from here.

-Petri


> + */
> +typedef struct odp_platform_init_t {
> +} odp_platform_init_t;
> +
> +/**
>   * @}
>   */
> 
> --
> 1.8.2.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] [API-NEXT PATCHv2 2/2] api:removing-the-platform_init-defination

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)

The mail subject line becomes the git log entry. It should not contain dashes 
and should define the API (init) modified. So, something like this:

[API-NEXT PATCHv2 2/2] api: init: removed platform_init struct definition


The @typedef doxygen tag needs to be added. See under. Also try 'make 
doxygen-html' to see that the change does not cause new doxygen warnings (e.g. 
not missing a doxygen tag).

/**
+ * @typedef odp_platform_init_t
 * ODP platform initialization data
 *
 * @note ODP API does nothing with this data. It is the underlying
 * implementation that requires it and any data passed here is not portable.
 * It is required that the application takes care of identifying and
 * passing any required platform specific data.
 */
- typedef struct odp_platform_init_t {
- } odp_platform_init_t;


-Petri


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Monday, December 14, 2015 2:34 PM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [API-NEXT PATCHv2 2/2] api:removing-the-platform_init-
> defination
> 
> odp_plaform_init defination in standard API will conflict with
> platform specific defination. better to keep it in the linux-generic
> or other platform init header file
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  include/odp/api/init.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 4ac5216..199c504 100644
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -132,9 +132,6 @@ typedef struct odp_init_t {
>   * It is required that the application takes care of identifying and
>   * passing any required platform specific data.
>   */
> -typedef struct odp_platform_init_t {
> -} odp_platform_init_t;
> -
> 
>  /**
>   * Global ODP initialization
> --
> 1.8.2.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] [API-NEXT PATCHv2] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Maxim Uvarov

On 12/14/2015 14:39, Bill Fischofer wrote:



On Mon, Dec 14, 2015 at 3:24 AM, Maxim Uvarov > wrote:


On 12/11/2015 16:22, Bill Fischofer wrote:

The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an
indirection
mechanism so that these dependencies do not "bleed through"
the ODP API.
This means that ODP applications can be independent of
_POSIX_C_SOURCE
level.

Signed-off-by: Bill Fischofer mailto:bill.fischo...@linaro.org>>
---
  .../linux-generic/include/odp/plat/time_types.h |  9 ---
  platform/linux-generic/odp_time.c  | 30
+++---
  2 files changed, 20 insertions(+), 19 deletions(-)

diff --git
a/platform/linux-generic/include/odp/plat/time_types.h
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..e999beb 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,11 +21,12 @@ extern "C" {
   *  @{
   **/
  -typedef struct timespec odp_time_t;
+typedef struct {
+   int64_t tv_sec;
+   int64_t tv_nsec;
+} odp_time_t;


Looks like that struct should be moved to ./include/odp/api/time.h
Overwise apps will relay on different time structures which
platforms can redifine.


odp_time_t, like other ODP types, expects a platform-dependent 
definition.  There's no need to define the type as part of the ODP 
time APIs.  I'll add this topic to today's arch call discussions.


In that case you need to add accessors and getters to time fields. I.e. 
apps can not directly relay on struct members.

odp_time_sec(odp_time_t time)
odp_time_sec_set(odp_time_t time)
odp_time_nsec(odp_time_t time)
odp_time_nsec_set(odp_time_t time)

which looks ugly for me. It's better to define some common struct which 
apps can use directly.


Maxim.



Also doxygen notes are missing:
/opt/Linaro/check-odp.git/build/odp-apply/include/odp/api/time.h:32:
warning: documented symbol `odp_time_t' was not declared or defined.

/opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:25:
warning: Member tv_sec (variable) of class odp_time_t is not
documented.

/opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:26:
warning: Member tv_nsec (variable) of class odp_time_t is not
documented.

Maxim.


  -odp_time_t odp_time_null(void);
-
-#define ODP_TIME_NULL  odp_time_null()
+#define ODP_TIME_NULL ((odp_time_t){0, 0})
/**
   * @}
diff --git a/platform/linux-generic/odp_time.c
b/platform/linux-generic/odp_time.c
index 1c7c214..9b64b37 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,7 +11,12 @@
  #include 
  #include 
  -static struct timespec start_time;
+typedef union {
+   odp_time_t  ex;
+   struct timespec in;
+} _odp_time_t;
+
+static odp_time_t start_time;
static inline
  uint64_t time_to_ns(odp_time_t time)
@@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
  static inline
  odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
  {
-   struct timespec time;
+   odp_time_t time;
time.tv_sec = t2.tv_sec - t1.tv_sec;
time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
@@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2,
odp_time_t t1)
  odp_time_t odp_time_local(void)
  {
int ret;
-   struct timespec time;
+   _odp_time_t time;
  - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in
);
if (odp_unlikely(ret != 0))
ODP_ABORT("clock_gettime failed\n");
  - return time_diff(time, start_time);
+   return time_diff(time.ex, start_time);
  }
odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
@@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
odp_time_t odp_time_local_from_ns(uint64_t ns)
  {
-   struct timespec time;
+   odp_time_t time;
time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
@@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
  {
- 

Re: [lng-odp] [PATCH 2/2] api: removing the platform_init defination

2015-12-14 Thread Agrawal Hemant
Thanks! 

Submitted the updated patch

Regards,
Hemant

-Original Message-
From: Savolainen, Petri (Nokia - FI/Espoo) [mailto:petri.savolai...@nokia.com] 
Sent: Monday, December 14, 2015 4:21 PM
To: Agrawal Hemant-B10814 ; lng-odp@lists.linaro.org
Subject: RE: [lng-odp] [PATCH 2/2] api: removing the platform_init defination

Copy-paste error, @typedef line should have been...

/**
  * @typedef odp_platform_init_t
  * ODP platform initialization data


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of 
> EXT Savolainen, Petri (Nokia - FI/Espoo)
> Sent: Monday, December 14, 2015 12:49 PM
> To: EXT Hemant Agrawal; lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH 2/2] api: removing the platform_init 
> defination
> 
> 
> API modifying patches must be targeted to "api-next" branch, and 
> labeled with "API-NEXT PATCH" prefix:
> 
> [API-NEXT PATCH 2/2] api: init: moved platform_init struct definition
> 
> 
> Also, you need to leave the doxygen documentation of the type to the 
> public API header file. The typedef code can be moved, but the 
> documentation must stay here...
> 
> /**
>  * @typedef odp_queue_t
>  * ODP platform initialization data
>  *
>  * @note ODP API does nothing with this data. It is the underlying
>  * implementation that requires it and any data passed here is not 
> portable.
>  * It is required that the application takes care of identifying and
>  * passing any required platform specific data.
>  */
> 
> -Petri
> 
> 
> 
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of 
> > EXT Hemant Agrawal
> > Sent: Monday, December 14, 2015 12:06 PM
> > To: lng-odp@lists.linaro.org
> > Cc: Hemant Agrawal
> > Subject: [lng-odp] [PATCH 2/2] api: removing the platform_init
> defination
> >
> > odp_plaform_init defination in standard API will conflict with 
> > platform specific defination. better to keep it in the linux-generic 
> > or other platform init header file.
> >
> > Signed-off-by: Hemant Agrawal 
> > ---
> >  include/odp/api/init.h | 12 
> >  1 file changed, 12 deletions(-)
> >
> > diff --git a/include/odp/api/init.h b/include/odp/api/init.h index 
> > 737ff6d..cf92f38 100644
> > --- a/include/odp/api/init.h
> > +++ b/include/odp/api/init.h
> > @@ -125,18 +125,6 @@ typedef struct odp_init_t {  } odp_init_t;
> >
> >  /**
> > - * ODP platform initialization data
> > - *
> > - * @note ODP API does nothing with this data. It is the underlying
> > - * implementation that requires it and any data passed here is not 
> > portable.
> > - * It is required that the application takes care of identifying 
> > and
> > - * passing any required platform specific data.
> > - */
> > -typedef struct odp_platform_init_t { -} odp_platform_init_t;
> > -
> > -
> > -/**
> >   * Global ODP initialization
> >   *
> >   * This function must be called once before calling any other ODP 
> > API
> > --
> > 1.9.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
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 4:06 AM, Hemant Agrawal 
wrote:

> odp_platform_init structure is platform specific data, it is up
> to the platform specific implementation to define it.
>
> Signed-off-by: Hemant Agrawal 
> ---
>  platform/linux-generic/include/odp/init.h | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/platform/linux-generic/include/odp/init.h
> b/platform/linux-generic/include/odp/init.h
> index 950a4f8..afa543c 100644
> --- a/platform/linux-generic/include/odp/init.h
> +++ b/platform/linux-generic/include/odp/init.h
> @@ -22,6 +22,17 @@ extern "C" {
>   */
>
>  /**
> + * ODP platform initialization data
> + *
> + * @note ODP API does nothing with this data. It is the underlying
> + * implementation that requires it and any data passed here is not
> portable.
> + * It is required that the application takes care of identifying and
> + * passing any required platform specific data.
> + */
> +typedef struct odp_platform_init_t {
> +} odp_platform_init_t;
>

This should be in platform/linux-generic/include/odp/plat/init_types.h for
consistency with other type definition placements.


> +
> +/**
>   * @}
>   */
>
> --
> 1.9.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


[lng-odp] [API-NEXT PATCHv2 2/2] api:removing-the-platform_init-defination

2015-12-14 Thread Hemant Agrawal
odp_plaform_init defination in standard API will conflict with
platform specific defination. better to keep it in the linux-generic
or other platform init header file

Signed-off-by: Hemant Agrawal 
---
 include/odp/api/init.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 4ac5216..199c504 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -132,9 +132,6 @@ typedef struct odp_init_t {
  * It is required that the application takes care of identifying and
  * passing any required platform specific data.
  */
-typedef struct odp_platform_init_t {
-} odp_platform_init_t;
-
 
 /**
  * Global ODP initialization
-- 
1.8.2.1

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


[lng-odp] [API-NEXT PATCHv2 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Hemant Agrawal
odp_platform_init structure is platform specific data, it is up
to the platform specific implementation to define it.

Signed-off-by: Hemant Agrawal 
---
 platform/linux-generic/include/odp/init.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/platform/linux-generic/include/odp/init.h 
b/platform/linux-generic/include/odp/init.h
index 950a4f8..afa543c 100644
--- a/platform/linux-generic/include/odp/init.h
+++ b/platform/linux-generic/include/odp/init.h
@@ -22,6 +22,17 @@ extern "C" {
  */
 
 /**
+ * ODP platform initialization data
+ *
+ * @note ODP API does nothing with this data. It is the underlying
+ * implementation that requires it and any data passed here is not portable.
+ * It is required that the application takes care of identifying and
+ * passing any required platform specific data.
+ */
+typedef struct odp_platform_init_t {
+} odp_platform_init_t;
+
+/**
  * @}
  */
 
-- 
1.8.2.1

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


Re: [lng-odp] [PATCH] validation: classification: check return value of pktio stop

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 6:00 AM, Balasubramanian Manoharan <
bala.manoha...@linaro.org> wrote:

> Fixes https://bugs.linaro.org/show_bug.cgi?id=1937
>
> Signed-off-by: Balasubramanian Manoharan 
>

Reviewed-by: Bill Fischofer 


> ---
>  test/validation/classification/odp_classification_common.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/classification/odp_classification_common.c
> b/test/validation/classification/odp_classification_common.c
> index 665e67c..a56c017 100644
> --- a/test/validation/classification/odp_classification_common.c
> +++ b/test/validation/classification/odp_classification_common.c
> @@ -29,7 +29,8 @@ int destroy_inq(odp_pktio_t pktio)
> return -1;
> }
>
> -   odp_pktio_stop(pktio);
> +   if (0 > odp_pktio_stop(pktio))
> +   return -1;
>
> if (0 > odp_pktio_inq_remdef(pktio))
> return -1;
> --
> 1.9.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] [PATCHv6] helper : Fix UDP checksum computation

2015-12-14 Thread Ion Grigore
Hi Ilya,

I checked the changes you suggested. It's Ok.  I sent a new patch(v7).

Tkanks,
Grig

-Original Message-
From: Grigore Ion-B17953 
Sent: Friday, December 11, 2015 5:57 PM
To: 'Ilya Maximets' ; Maxim Uvarov 
; lng-odp@lists.linaro.org
Subject: RE: [PATCHv6] helper : Fix UDP checksum computation

Ok. I'll check your proposal on BE/LE.

-Original Message-
From: Ilya Maximets [mailto:i.maxim...@samsung.com] 
Sent: Friday, December 11, 2015 5:54 PM
To: Grigore Ion-B17953 ; Maxim Uvarov 
; lng-odp@lists.linaro.org
Subject: Re: [PATCHv6] helper : Fix UDP checksum computation

On 11.12.2015 18:47, Ion Grigore wrote:
> A more precise question. Did you check on a LE platform ?

Yes. On my LE i7.

> - /* Fold sum to 16 bits: add carrier to result */
> - while (sum >> 16)
> - sum = (sum & 0x) + (sum >> 16);
> -
> + (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
> + u8_pad_to_u16(iph->proto, 1) + udph->length;
 I meant something like:

 union {
uint8_t v8[2];
uint16_t v16;
 } val;

 val.v8[0] = 0;
 val.v8[1] = iph->proto;

>>>
>>> The val.val16 must be swapped on LE platforms. 
>>
>> NO.
>>
>> Did you checked this ?
> 
> And you?
> 
>>
>>>
>>>
 sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
(iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
val.v16 + udph->length;

> + udplen = odp_be_to_cpu_16(udph->length);
> + buf = (uint16_t *)((void *)udph);
> + /* 32-bit sum of UDP header (checksum field cleared) and UDP data */
> + for ( ; udplen > 1; udplen -= 2)
> + sum += *buf++;
> + /* Length is not a multiple of 2 bytes */
> + if (udplen)
> + sum += u8_pad_to_u16(*buf, 0);
 val.v8[0] = *buf;
 val.v8[1] = 0;

 sum += val.v16;

 Isn't it more understandable, then artificial byte swapping?

>>>
>>> The val.val16 must be swapped on LE platforms.
>>
>> NO.
>>
>> Did you checked this ?
> 
> And you?
> 
> P.S. Just to be honest, I checked this a few minutes ago.
>  Helper test below works.
> 
> Yes on BE/LE platforms, but not with the change you proposed.


So why you talking that val.val16 must be swapped if you do not understand how 
it works and you have not tested it?
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1937] CID 155811: Error handling issues odp_classification_common.c

2015-12-14 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1937

--- Comment #1 from Bala Manoharan  ---
V1 submitted: https://patches.linaro.org/58448/

-- 
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] [PATCH] validation: classification: check return value of pktio stop

2015-12-14 Thread Balasubramanian Manoharan
Fixes https://bugs.linaro.org/show_bug.cgi?id=1937

Signed-off-by: Balasubramanian Manoharan 
---
 test/validation/classification/odp_classification_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/validation/classification/odp_classification_common.c 
b/test/validation/classification/odp_classification_common.c
index 665e67c..a56c017 100644
--- a/test/validation/classification/odp_classification_common.c
+++ b/test/validation/classification/odp_classification_common.c
@@ -29,7 +29,8 @@ int destroy_inq(odp_pktio_t pktio)
return -1;
}
 
-   odp_pktio_stop(pktio);
+   if (0 > odp_pktio_stop(pktio))
+   return -1;
 
if (0 > odp_pktio_inq_remdef(pktio))
return -1;
-- 
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 PATCHv2] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Bill Fischofer
On Mon, Dec 14, 2015 at 3:24 AM, Maxim Uvarov 
wrote:

> On 12/11/2015 16:22, Bill Fischofer wrote:
>
>> The linux-generic implementation of odp_time_t makes use of POSIX
>> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
>> mechanism so that these dependencies do not "bleed through" the ODP API.
>> This means that ODP applications can be independent of _POSIX_C_SOURCE
>> level.
>>
>> Signed-off-by: Bill Fischofer 
>> ---
>>   .../linux-generic/include/odp/plat/time_types.h|  9 ---
>>   platform/linux-generic/odp_time.c  | 30
>> +++---
>>   2 files changed, 20 insertions(+), 19 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
>> b/platform/linux-generic/include/odp/plat/time_types.h
>> index e5765ec..e999beb 100644
>> --- a/platform/linux-generic/include/odp/plat/time_types.h
>> +++ b/platform/linux-generic/include/odp/plat/time_types.h
>> @@ -21,11 +21,12 @@ extern "C" {
>>*  @{
>>**/
>>   -typedef struct timespec odp_time_t;
>> +typedef struct {
>> +   int64_t tv_sec;
>> +   int64_t tv_nsec;
>> +} odp_time_t;
>>
>
> Looks like that struct should be moved to ./include/odp/api/time.h
> Overwise apps will relay on different time structures which platforms can
> redifine.
>

odp_time_t, like other ODP types, expects a platform-dependent definition.
There's no need to define the type as part of the ODP time APIs.  I'll add
this topic to today's arch call discussions.


>
> Also doxygen notes are missing:
> /opt/Linaro/check-odp.git/build/odp-apply/include/odp/api/time.h:32:
> warning: documented symbol `odp_time_t' was not declared or defined.
> /opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:25:
> warning: Member tv_sec (variable) of class odp_time_t is not documented.
> /opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:26:
> warning: Member tv_nsec (variable) of class odp_time_t is not documented.
>
> Maxim.
>
>
>   -odp_time_t odp_time_null(void);
>> -
>> -#define ODP_TIME_NULL  odp_time_null()
>> +#define ODP_TIME_NULL ((odp_time_t){0, 0})
>> /**
>>* @}
>> diff --git a/platform/linux-generic/odp_time.c
>> b/platform/linux-generic/odp_time.c
>> index 1c7c214..9b64b37 100644
>> --- a/platform/linux-generic/odp_time.c
>> +++ b/platform/linux-generic/odp_time.c
>> @@ -11,7 +11,12 @@
>>   #include 
>>   #include 
>>   -static struct timespec start_time;
>> +typedef union {
>> +   odp_time_t  ex;
>> +   struct timespec in;
>> +} _odp_time_t;
>> +
>> +static odp_time_t start_time;
>> static inline
>>   uint64_t time_to_ns(odp_time_t time)
>> @@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
>>   static inline
>>   odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>>   {
>> -   struct timespec time;
>> +   odp_time_t time;
>> time.tv_sec = t2.tv_sec - t1.tv_sec;
>> time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
>> @@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>>   odp_time_t odp_time_local(void)
>>   {
>> int ret;
>> -   struct timespec time;
>> +   _odp_time_t time;
>>   - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
>> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
>> if (odp_unlikely(ret != 0))
>> ODP_ABORT("clock_gettime failed\n");
>>   - return time_diff(time, start_time);
>> +   return time_diff(time.ex, start_time);
>>   }
>> odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
>> @@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
>> odp_time_t odp_time_local_from_ns(uint64_t ns)
>>   {
>> -   struct timespec time;
>> +   odp_time_t time;
>> time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
>> time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
>> @@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
>> odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
>>   {
>> -   struct timespec time;
>> +   odp_time_t time;
>> time.tv_sec = t2.tv_sec + t1.tv_sec;
>> time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
>> @@ -113,18 +118,13 @@ uint64_t odp_time_to_u64(odp_time_t time)
>> return time_to_ns(time) / resolution;
>>   }
>>   -odp_time_t odp_time_null(void)
>> -{
>> -   return (struct timespec) {0, 0};
>> -}
>> -
>>   int odp_time_global_init(void)
>>   {
>> int ret;
>> -   struct timespec time;
>> +   _odp_time_t time;
>>   - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);
>> -   start_time = ret ? odp_time_null() : time;
>> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
>> +   start_time = ret ? ODP_TIME_NULL : time.ex;
>> return ret;
>>   }
>>
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___

[lng-odp] [PATCHv7] helper : Fix UDP checksum computation

2015-12-14 Thread ion.grigore
From: Grigore Ion 

This patch fixes the following problems:
- checksum computation for LE platforms
- checksum is computed in the CPU endianness. The returned result
must be converted to the BE ordering when it is used to update
the UDP checksum in a packet.
- checksum computation for packets having the UDP length not a
multiple of 2
- fixes the UDP checksum associated validation test

Signed-off-by: Grigore Ion 
---
 v7:
 - Make code simpler and more understandable as it was
 sugessted by Ilya Maximets
 v6:
 - Make code more understandable. Not done as it was
 sugessted by Ilya Maximets.
 v5:
 - Checksum in CPU endianness fix added (Ilya Maximets)
 v4:
 - Verify checksum in CPU endianness in the associated test
 (Ilya Maximets)
 v3:
 - fix the UDP checksum computation in the associated test
 (Maxim Uvarov)
 v2:
 - patch updated to the last master (Maxim Uvarov)
 v1:
 - Move variables declaration on top of block. (Maxim Uvarov)
 - Check patch with checkpatch script.  (Maxim Uvarov)
 - L3 header presence is tested twice. (Alexandru Badicioiu)
 - Remove unnecessary check for L3 header presence. (Bill Fischofer)
 - Modify check of odp_packet_l4_offset() return. (Bill Fischofer)

 helper/include/odp/helper/udp.h | 65 +
 helper/test/odp_chksum.c|  4 +--
 2 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/helper/include/odp/helper/udp.h b/helper/include/odp/helper/udp.h
index 06c439b..f43fa54 100644
--- a/helper/include/odp/helper/udp.h
+++ b/helper/include/odp/helper/udp.h
@@ -4,7 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-
 /**
  * @file
  *
@@ -22,7 +21,6 @@ extern "C" {
 #include 
 #include 
 
-
 /** @addtogroup odph_header ODPH HEADER
  *  @{
  */
@@ -44,46 +42,49 @@ typedef struct ODP_PACKED {
  * This function uses odp packet to calc checksum
  *
  * @param pkt  calculate chksum for pkt
- * @return  checksum value
+ * @return  checksum value in CPU endianness
  */
 static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt)
 {
-   uint32_t sum = 0;
-   odph_udphdr_t *udph;
-   odph_ipv4hdr_t *iph;
-   uint16_t udplen;
-   uint8_t *buf;
-
-   if (!odp_packet_l3_offset(pkt))
+   odph_ipv4hdr_t  *iph;
+   odph_udphdr_t   *udph;
+   uint32_tsum;
+   uint16_tudplen, *buf;
+   union {
+   uint8_t v8[2];
+   uint16_t v16;
+   } val;
+
+   if (odp_packet_l4_offset(pkt) == ODP_PACKET_OFFSET_INVALID)
return 0;
-
-   if (!odp_packet_l4_offset(pkt))
-   return 0;
-
iph = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
udph = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
-   udplen = odp_be_to_cpu_16(udph->length);
-
-   /* 32-bit sum of all 16-bit words covered by UDP chksum */
+   /* 32-bit sum of UDP pseudo-header */
sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
- (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
- (uint16_t)iph->proto + udplen;
-   for (buf = (uint8_t *)udph; udplen > 1; udplen -= 2) {
-   sum += ((*buf << 8) + *(buf + 1));
-   buf += 2;
+   (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
+   udph->length;
+   val.v8[0] = 0;
+   val.v8[1] = iph->proto;
+   sum += val.v16;
+   /* 32-bit sum of UDP header (checksum field cleared) and UDP data */
+   udplen = odp_be_to_cpu_16(udph->length);
+   buf = (uint16_t *)((void *)udph);
+   for ( ; udplen > 1; udplen -= 2)
+   sum += *buf++;
+   /* Length is not a multiple of 2 bytes */
+   if (udplen) {
+   val.v8[0] = *buf;
+   val.v8[1] = 0;
+   sum += val.v16;
}
-
-   /* Fold sum to 16 bits: add carrier to result */
-   while (sum >> 16)
-   sum = (sum & 0x) + (sum >> 16);
-
+   /* Fold sum to 16 bits */
+   sum = (sum & 0x) + (sum >> 16);
+   /* Add carrier (0/1) to result */
+   sum += (sum >> 16);
/* 1's complement */
sum = ~sum;
-
-   /* set computation result */
-   sum = (sum == 0x0) ? 0x : sum;
-
-   return sum;
+   /* Return checksum in CPU endianness */
+   return (sum == 0x0) ? 0x : odp_be_to_cpu_16(sum);
 }
 
 /** @internal Compile time assert */
diff --git a/helper/test/odp_chksum.c b/helper/test/odp_chksum.c
index 1d417a8..152018a 100644
--- a/helper/test/odp_chksum.c
+++ b/helper/test/odp_chksum.c
@@ -189,14 +189,14 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
udp->dst_port = 0;
udp->length = odp_cpu_to_be_16(udat_size + ODPH_UDPHDR_LEN);
udp->chksum = 0;
-   udp->chksum = odph_ipv4_udp_chksum(test_packet);
+   udp->chksum = odp_cpu_to_be_16(odph_ipv4_udp_chksum(test_packet));
 
if (udp->chksum == 0)
return -1;
 
printf("chksum = 0x%x\n", udp

Re: [lng-odp] [PATCH 2/2] api: removing the platform_init defination

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)
Copy-paste error, @typedef line should have been...

/**
  * @typedef odp_platform_init_t
  * ODP platform initialization data


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Savolainen, Petri (Nokia - FI/Espoo)
> Sent: Monday, December 14, 2015 12:49 PM
> To: EXT Hemant Agrawal; lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH 2/2] api: removing the platform_init
> defination
> 
> 
> API modifying patches must be targeted to "api-next" branch, and labeled
> with "API-NEXT PATCH" prefix:
> 
> [API-NEXT PATCH 2/2] api: init: moved platform_init struct definition
> 
> 
> Also, you need to leave the doxygen documentation of the type to the
> public API header file. The typedef code can be moved, but the
> documentation must stay here...
> 
> /**
>  * @typedef odp_queue_t
>  * ODP platform initialization data
>  *
>  * @note ODP API does nothing with this data. It is the underlying
>  * implementation that requires it and any data passed here is not
> portable.
>  * It is required that the application takes care of identifying and
>  * passing any required platform specific data.
>  */
> 
> -Petri
> 
> 
> 
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> > Hemant Agrawal
> > Sent: Monday, December 14, 2015 12:06 PM
> > To: lng-odp@lists.linaro.org
> > Cc: Hemant Agrawal
> > Subject: [lng-odp] [PATCH 2/2] api: removing the platform_init
> defination
> >
> > odp_plaform_init defination in standard API will conflict with platform
> > specific defination. better to keep it in the linux-generic or other
> > platform init header file.
> >
> > Signed-off-by: Hemant Agrawal 
> > ---
> >  include/odp/api/init.h | 12 
> >  1 file changed, 12 deletions(-)
> >
> > diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> > index 737ff6d..cf92f38 100644
> > --- a/include/odp/api/init.h
> > +++ b/include/odp/api/init.h
> > @@ -125,18 +125,6 @@ typedef struct odp_init_t {
> >  } odp_init_t;
> >
> >  /**
> > - * ODP platform initialization data
> > - *
> > - * @note ODP API does nothing with this data. It is the underlying
> > - * implementation that requires it and any data passed here is not
> > portable.
> > - * It is required that the application takes care of identifying and
> > - * passing any required platform specific data.
> > - */
> > -typedef struct odp_platform_init_t {
> > -} odp_platform_init_t;
> > -
> > -
> > -/**
> >   * Global ODP initialization
> >   *
> >   * This function must be called once before calling any other ODP API
> > --
> > 1.9.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
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH 2/2] api: removing the platform_init defination

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)

API modifying patches must be targeted to "api-next" branch, and labeled with 
"API-NEXT PATCH" prefix:

[API-NEXT PATCH 2/2] api: init: moved platform_init struct definition


Also, you need to leave the doxygen documentation of the type to the public API 
header file. The typedef code can be moved, but the documentation must stay 
here...

/**
 * @typedef odp_queue_t
 * ODP platform initialization data
 *
 * @note ODP API does nothing with this data. It is the underlying
 * implementation that requires it and any data passed here is not portable.
 * It is required that the application takes care of identifying and
 * passing any required platform specific data.
 */

-Petri



> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Hemant Agrawal
> Sent: Monday, December 14, 2015 12:06 PM
> To: lng-odp@lists.linaro.org
> Cc: Hemant Agrawal
> Subject: [lng-odp] [PATCH 2/2] api: removing the platform_init defination
> 
> odp_plaform_init defination in standard API will conflict with platform
> specific defination. better to keep it in the linux-generic or other
> platform init header file.
> 
> Signed-off-by: Hemant Agrawal 
> ---
>  include/odp/api/init.h | 12 
>  1 file changed, 12 deletions(-)
> 
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 737ff6d..cf92f38 100644
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -125,18 +125,6 @@ typedef struct odp_init_t {
>  } odp_init_t;
> 
>  /**
> - * ODP platform initialization data
> - *
> - * @note ODP API does nothing with this data. It is the underlying
> - * implementation that requires it and any data passed here is not
> portable.
> - * It is required that the application takes care of identifying and
> - * passing any required platform specific data.
> - */
> -typedef struct odp_platform_init_t {
> -} odp_platform_init_t;
> -
> -
> -/**
>   * Global ODP initialization
>   *
>   * This function must be called once before calling any other ODP API
> --
> 1.9.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


[lng-odp] [PATCH 1/2] linux-generic:adding the platform_init structure

2015-12-14 Thread Hemant Agrawal
odp_platform_init structure is platform specific data, it is up
to the platform specific implementation to define it.

Signed-off-by: Hemant Agrawal 
---
 platform/linux-generic/include/odp/init.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/platform/linux-generic/include/odp/init.h 
b/platform/linux-generic/include/odp/init.h
index 950a4f8..afa543c 100644
--- a/platform/linux-generic/include/odp/init.h
+++ b/platform/linux-generic/include/odp/init.h
@@ -22,6 +22,17 @@ extern "C" {
  */
 
 /**
+ * ODP platform initialization data
+ *
+ * @note ODP API does nothing with this data. It is the underlying
+ * implementation that requires it and any data passed here is not portable.
+ * It is required that the application takes care of identifying and
+ * passing any required platform specific data.
+ */
+typedef struct odp_platform_init_t {
+} odp_platform_init_t;
+
+/**
  * @}
  */
 
-- 
1.9.1

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


[lng-odp] [PATCH 2/2] api: removing the platform_init defination

2015-12-14 Thread Hemant Agrawal
odp_plaform_init defination in standard API will conflict with platform 
specific defination. better to keep it in the linux-generic or other platform 
init header file.

Signed-off-by: Hemant Agrawal 
---
 include/odp/api/init.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 737ff6d..cf92f38 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -125,18 +125,6 @@ typedef struct odp_init_t {
 } odp_init_t;
 
 /**
- * ODP platform initialization data
- *
- * @note ODP API does nothing with this data. It is the underlying
- * implementation that requires it and any data passed here is not portable.
- * It is required that the application takes care of identifying and
- * passing any required platform specific data.
- */
-typedef struct odp_platform_init_t {
-} odp_platform_init_t;
-
-
-/**
  * Global ODP initialization
  *
  * This function must be called once before calling any other ODP API
-- 
1.9.1

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


Re: [lng-odp] Does ODP support DPDK flow director feature APIs?

2015-12-14 Thread Krishna Garapati
including odp team.

/Krishna

On 13 December 2015 at 20:40, Dapeng Liu  wrote:

> Hi Wenxian,
>
> I checked the API document but failed to find a exact matching function.
> Just share my understanding with you.
>
> ODP has an event distribution model working as below:
> 1) packet classified to COS(class of service),
> 2) COS associated to queue
> 3) queue associated to worker thread.
> Although the worker thread could be created with pinned CPU with
> odph_linux_pthread_create. The problem is that packet classification at the
> first step is based on some certain fields in the frame, which is either IP
> or port or something else but hard to be the combination unless with some
> carefully defined offset and mask. Moreover user has to specify the desired
> matched value. So seemingly it is hard to achieve the flow(5-tuples) based
> distribution where we never specify the matched value.
>
> If it indeed turns out to be a missing function, I think it could be a
> good candidate feature in the future for ODP.
> However given the shallow understanding of ODP, I am probably wrong :)
>
> Let's wait for experts' comments.
>
> Best Regards,
> Dapeng
>
> ​
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT/PATCHv1 1/4] api: classification: add class of serivce create api

2015-12-14 Thread Bala Manoharan
Ping.

On 8 December 2015 at 15:51, Balasubramanian Manoharan
 wrote:
> class of service create function now takes pool, queue, drop policy and
> name as input parameters.
> Adds class of service parameter structure odp_cls_cos_param_t and
> initialization function odp_cls_cos_param_init()
>
> Signed-off-by: Balasubramanian Manoharan 
> ---
>  include/odp/api/classification.h | 31 ++-
>  1 file changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/include/odp/api/classification.h 
> b/include/odp/api/classification.h
> index 725e1ab..18572ad 100644
> --- a/include/odp/api/classification.h
> +++ b/include/odp/api/classification.h
> @@ -37,7 +37,7 @@ extern "C" {
>
>  /**
>   * @def ODP_COS_INVALID
> - * This value is returned from odp_cos_create() on failure,
> + * This value is returned from odp_cls_cos_create() on failure,
>   * May also be used as a sink class of service that
>   * results in packets being discarded.
>   */
> @@ -60,9 +60,9 @@ extern "C" {
>   */
>
>  /**
> - * Class-of-service packet drop policies
> + * class of service packet drop policies
>   */
> -typedef enum odp_cos_drop {
> +typedef enum odp_cls_drop {
> ODP_COS_DROP_POOL,/**< Follow buffer pool drop policy */
> ODP_COS_DROP_NEVER,/**< Never drop, ignoring buffer pool policy */
>  } odp_drop_e;
> @@ -89,14 +89,35 @@ typedef enum odp_cos_hdr_flow_fields {
>  } odp_cos_hdr_flow_fields_e;
>
>  /**
> + * Class of service parameters
> + * Used to communicate class of service creation options
> + */
> +typedef struct odp_cls_cos_param {
> +   odp_queue_t queue;  /**< Queue associated with CoS */
> +   odp_pool_t pool;/**< Pool associated with CoS */
> +   odp_drop_e drop_policy; /**< Drop policy associated with CoS */
> +} odp_cls_cos_param_t;
> +
> +/**
> + * Initialize class of service parameters
> + *
> + * Initialize an odp_cls_cos_param_t to its default value for all fields
> + *
> + * @param param   Address of the odp_cls_cos_param_t to be initialized
> + */
> +void odp_cls_cos_param_init(odp_cls_cos_param_t *param);
> +
> +/**
>   * Create a class-of-service
>   *
>   * @param[in]  nameString intended for debugging purposes.
>   *
> - * @return Class of service instance identifier
> + * @param[in]  param   class of service parameters
> + *
> + * @retval class of service handle
>   * @retval ODP_COS_INVALID on failure.
>   */
> -odp_cos_t odp_cos_create(const char *name);
> +odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param);
>
>  /**
>   * Discard a class-of-service along with all its associated resources
> --
> 1.9.1
>



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


Re: [lng-odp] [PATCHv4] doc: userguide: add application programming section

2015-12-14 Thread Maxim Uvarov

Merged,
Maxim.

On 12/11/2015 21:51, Mike Holmes wrote:


On 11 December 2015 at 12:23, Bill Fischofer 
mailto:bill.fischo...@linaro.org>> wrote:


Complete the reformatting to standard asciidoc style, expand the
ODP Application Programming section, and include a reorganized and
expanded discussion of ODP queues.

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


Reviewed-by: Mike Holmes >


Mike

---
 doc/users-guide/users-guide.adoc | 450
+++
 1 file changed, 358 insertions(+), 92 deletions(-)

diff --git a/doc/users-guide/users-guide.adoc
b/doc/users-guide/users-guide.adoc
index cf77fa0..2e30f3a 100644
--- a/doc/users-guide/users-guide.adoc
+++ b/doc/users-guide/users-guide.adoc
@@ -8,16 +8,19 @@ OpenDataPlane (ODP)  Users-Guide
 Abstract
 
 This document is intended to guide a new ODP application developer.
-Further details about ODP may be found at the
http://opendataplane.org[ODP] home page.
+Further details about ODP may be found at the
http://opendataplane.org[ODP]
+home page.

 .Overview of a system running ODP applications
 image::../images/overview.png[align="center"]

-ODP is an API specification that allows many implementations to
provide platform independence, automatic hardware acceleration and
CPU scaling to high performance networking  applications.
-This document describes how to write an application that can
successfully take advantage of the API.
+ODP is an API specification that allows many implementations to
provide
+platform independence, automatic hardware acceleration and CPU
scaling to
+high performance networking  applications. This document
describes how to
+write an application that can successfully take advantage of the API.

 :numbered:
-== Introduction ==
+== Introduction
 .OpenDataPlane Components
 image::../images/odp_components.png[align="center"]

@@ -42,7 +45,7 @@ ODP API specification--that is the
responsibility of each ODP implementation.
 * Application-centric.  Covers functional needs of data plane
applications.
 * Ensures portability by specifying the functional behavior of ODP.
 * Defined jointly and openly by application writers and platform
implementers.
-* Archiected to be implementable on a wide range of platforms
efficiently
+* Architected to be implementable on a wide range of platforms
efficiently
 * Sponsored, governed, and maintained by the Linaro Networking
Group (LNG)

 .ODP Implementations
@@ -68,7 +71,7 @@ where the application will run on a target
platform chosen by someone else.
 * One size does not fit all--supporting multiple implementations
allows ODP
 to adapt to widely differing internals among platforms.
 * Anyone can create an ODP implementation tailored to their platform
-* Distribution and mainteinance of each implementation is as
owner wishes
+* Distribution and maintenance of each implementation is as owner
wishes
   - Open source or closed source as business needs determine
   - Have independent release cycles and service streams
 * Allows HW and SW innovation in how ODP APIs are implemented on
each platform.
@@ -100,7 +103,7 @@ drivers supported by DPDK.
 they are derived from a reference implementation.

 .ODP Validation Test Suite
-Third, to enure consistency between different ODP
implementations, ODP
+Third, to ensure consistency between different ODP
implementations, ODP
 consists of a validation suite that verifies that any given
implementation of
 ODP faithfully provides the specified functional behavior of each
ODP API.
 As a separate open source component, the validation suite may be
used by
@@ -115,16 +118,16 @@ ODP API specification.
 * Key to ensuring application portability across all ODP
implementations
 * Tests that ODP implementations conform to the specified
functional behavior
 of ODP APIs.
-* Can be run at any time by users and vendors to validat
implementations
-od ODP.
+* Can be run at any time by users and vendors to validate
implementations
+of ODP.

-=== ODP API Specification Versioning ===
+=== ODP API Specification Versioning
 As an evolving standard, the ODP API specification is released
under an
 incrementing version number, and corresponding implementations of
ODP, as well
 as the validation suite that verifies API conformance, are linked
to this
-version number. ODP versions are specified using a stanard
three-level
+version number. ODP versions are specified using a standard
three-level
 number (major.minor.fixlevel) that are incremented according to
the degree of
-change the level repres

Re: [lng-odp] [PATCH] api: pktio link status

2015-12-14 Thread Savolainen, Petri (Nokia - FI/Espoo)
A specific "is_up()" would not help if the call can fail (return <0). User 
would still need to check against 1 vs. 0 vs. <0. I think the current 
specification is logical in the way that "1" means (up and) OK, "0" (down and) 
try again later, "<0" (failure) no point to try again before something else is 
changed in system config. Additional down states can be added later with the 
same logic:


/**
 * Determine pktio link status.
 *
 * @param pktio Packet IO handle.
 *
 * @retval  1 link is up
 * @retval  0 link is down
 * @retval  -1 A HW component is not present
 * @retval  -2 Lower layer down
 * @retval <-2 on other failures
 */
 int odp_pktio_link_status(odp_pktio_t pktio); 


-Petri



> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Maxim Uvarov
> Sent: Monday, December 14, 2015 10:43 AM
> To: Alexandru Badicioiu
> Cc: LNG ODP Mailman List
> Subject: Re: [lng-odp] [PATCH] api: pktio link status
> 
> 
> 
> _link_up() might be confused with setting command. Not with getting
> status command.
> 
> How about:
> odp_pktio_status_link_up()?
> 
> There might be some other statuses for pktio which we can extend later
> and use the same prefix odp_pktio_status_
> 
> Maxim.
> 
> 
> On 12/11/2015 15:53, Alexandru Badicioiu wrote:
> > Wouldn't be the application code more clear if the function is renamed
> > to _link_up()?
> > Return values clearly suggest this. The application has to remember
> > that 1 means link up and 0 means link down.
> >
> > Alex
> >
> >
> > On 11 December 2015 at 14:44, Maxim Uvarov  > > wrote:
> >
> > Signed-off-by: Maxim Uvarov  > >
> > ---
> >  v1 was link_state(), now it's link_status().
> >
> >  include/odp/api/packet_io.h | 11 +++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/include/odp/api/packet_io.h
> b/include/odp/api/packet_io.h
> > index 443841e..8999b2c 100644
> > --- a/include/odp/api/packet_io.h
> > +++ b/include/odp/api/packet_io.h
> > @@ -673,6 +673,17 @@ void
> > odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t
> > *param);
> >  void odp_pktio_print(odp_pktio_t pktio);
> >
> >  /**
> > + * Determine pktio link is up or down for a packet IO interface.
> > + *
> > + * @param pktio Packet IO handle.
> > + *
> > + * @retval  1 link is up
> > + * @retval  0 link is down
> > + * @retval <0 on failure
> > +*/
> > +int odp_pktio_link_status(odp_pktio_t pktio);
> > +
> > +/**
> >   * @}
> >   */
> >
> > --
> > 1.9.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
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv2] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-14 Thread Maxim Uvarov

On 12/11/2015 16:22, Bill Fischofer wrote:

The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
mechanism so that these dependencies do not "bleed through" the ODP API.
This means that ODP applications can be independent of _POSIX_C_SOURCE
level.

Signed-off-by: Bill Fischofer 
---
  .../linux-generic/include/odp/plat/time_types.h|  9 ---
  platform/linux-generic/odp_time.c  | 30 +++---
  2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/platform/linux-generic/include/odp/plat/time_types.h 
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..e999beb 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,11 +21,12 @@ extern "C" {
   *  @{
   **/
  
-typedef struct timespec odp_time_t;

+typedef struct {
+   int64_t tv_sec;
+   int64_t tv_nsec;
+} odp_time_t;


Looks like that struct should be moved to ./include/odp/api/time.h
Overwise apps will relay on different time structures which platforms 
can redifine.


Also doxygen notes are missing:
/opt/Linaro/check-odp.git/build/odp-apply/include/odp/api/time.h:32: 
warning: documented symbol `odp_time_t' was not declared or defined.
/opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:25: 
warning: Member tv_sec (variable) of class odp_time_t is not documented.
/opt/Linaro/check-odp.git/build/odp-apply/platform/linux-generic/include/odp/plat/time_types.h:26: 
warning: Member tv_nsec (variable) of class odp_time_t is not documented.


Maxim.

  
-odp_time_t odp_time_null(void);

-
-#define ODP_TIME_NULL  odp_time_null()
+#define ODP_TIME_NULL ((odp_time_t){0, 0})
  
  /**

   * @}
diff --git a/platform/linux-generic/odp_time.c 
b/platform/linux-generic/odp_time.c
index 1c7c214..9b64b37 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -11,7 +11,12 @@
  #include 
  #include 
  
-static struct timespec start_time;

+typedef union {
+   odp_time_t  ex;
+   struct timespec in;
+} _odp_time_t;
+
+static odp_time_t start_time;
  
  static inline

  uint64_t time_to_ns(odp_time_t time)
@@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
  static inline
  odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
  {
-   struct timespec time;
+   odp_time_t time;
  
  	time.tv_sec = t2.tv_sec - t1.tv_sec;

time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
@@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
  odp_time_t odp_time_local(void)
  {
int ret;
-   struct timespec time;
+   _odp_time_t time;
  
-	ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);

+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
if (odp_unlikely(ret != 0))
ODP_ABORT("clock_gettime failed\n");
  
-	return time_diff(time, start_time);

+   return time_diff(time.ex, start_time);
  }
  
  odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)

@@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
  
  odp_time_t odp_time_local_from_ns(uint64_t ns)

  {
-   struct timespec time;
+   odp_time_t time;
  
  	time.tv_sec = ns / ODP_TIME_SEC_IN_NS;

time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
@@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
  
  odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)

  {
-   struct timespec time;
+   odp_time_t time;
  
  	time.tv_sec = t2.tv_sec + t1.tv_sec;

time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
@@ -113,18 +118,13 @@ uint64_t odp_time_to_u64(odp_time_t time)
return time_to_ns(time) / resolution;
  }
  
-odp_time_t odp_time_null(void)

-{
-   return (struct timespec) {0, 0};
-}
-
  int odp_time_global_init(void)
  {
int ret;
-   struct timespec time;
+   _odp_time_t time;
  
-	ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time);

-   start_time = ret ? odp_time_null() : time;
+   ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time.in);
+   start_time = ret ? ODP_TIME_NULL : time.ex;
  
  	return ret;

  }


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


Re: [lng-odp] [PATCH] api: pktio link status

2015-12-14 Thread Alexandru Badicioiu
_link_up() looks consistent with ODP naming convention - setting the link
up would be named _link_up_set().

Alex

On 14 December 2015 at 10:42, Maxim Uvarov  wrote:

>
>
> _link_up() might be confused with setting command. Not with getting status
> command.
>
> How about:
> odp_pktio_status_link_up()?
>
> There might be some other statuses for pktio which we can extend later and
> use the same prefix odp_pktio_status_
>
> Maxim.
>
>
> On 12/11/2015 15:53, Alexandru Badicioiu wrote:
>
>> Wouldn't be the application code more clear if the function is renamed to
>> _link_up()?
>> Return values clearly suggest this. The application has to remember that
>> 1 means link up and 0 means link down.
>>
>> Alex
>>
>>
>> On 11 December 2015 at 14:44, Maxim Uvarov > > wrote:
>>
>> Signed-off-by: Maxim Uvarov > >
>>
>> ---
>>  v1 was link_state(), now it's link_status().
>>
>>  include/odp/api/packet_io.h | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
>> index 443841e..8999b2c 100644
>> --- a/include/odp/api/packet_io.h
>> +++ b/include/odp/api/packet_io.h
>> @@ -673,6 +673,17 @@ void
>> odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t
>> *param);
>>  void odp_pktio_print(odp_pktio_t pktio);
>>
>>  /**
>> + * Determine pktio link is up or down for a packet IO interface.
>> + *
>> + * @param pktio Packet IO handle.
>> + *
>> + * @retval  1 link is up
>> + * @retval  0 link is down
>> + * @retval <0 on failure
>> +*/
>> +int odp_pktio_link_status(odp_pktio_t pktio);
>> +
>> +/**
>>   * @}
>>   */
>>
>> --
>> 1.9.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] [PATCHv5 0/4] TAP pktio

2015-12-14 Thread Maxim Uvarov

Merged,
Maxim.

On 12/14/2015 10:08, Ilya Maximets wrote:

On 11.12.2015 19:51, Stuart Haslam wrote:

On Thu, Dec 10, 2015 at 06:32:00PM +0300, Ilya Maximets wrote:

Creates a new pktio type that allows for creating and
sending/receiving packets through TAP interface.
Detailed description in commit-message of patch
"[PATCHv5 3/4] linux-generic: pktio: add tap pktio type".

Changelog:

Version 5:
* nothing changed. New patch added to add ability
  to wait some time right after pktio_open() to
  be sure that tap interface switched to enabled state
  inside the bridge. Fixes occasional first test failures.
  ODP_WAIT_FOR_NETWORK used to run tests.
* rebased on current master

Version 4:
* changed error handling part in tap_pktio_send. (Stuart Haslam)

Version 3:
* return 77 (TEST_SKIPPED) if user is not root. (Stuart Haslam)

Version 2:
* Validation tests added
* Pktio tests fixed to work with real-world
  interfaces.
* MAC of pktio now is not a kernel interface's MAC
* Interfaces are UP after pktio_open()
* Fixed getting mtu, getting/setting promisc mode
* Misclenious fixes

Ilya Maximets (4):
   validation: pktio: initialize mac addresses for all packets
   validation: pktio: ability to wait for external network
   linux-generic: pktio: add tap pktio type
   linux-generic: pktio: add test for tap pktio

For the series:

Reviewed-and-Tested-by: Stuart Haslam 

Thanks.


  platform/linux-generic/Makefile.am |   2 +
  .../linux-generic/include/odp_packet_io_internal.h |   3 +
  platform/linux-generic/include/odp_packet_tap.h|  21 ++
  platform/linux-generic/pktio/io_ops.c  |   1 +
  platform/linux-generic/pktio/tap.c | 327 +
  platform/linux-generic/test/Makefile.am|   1 +
  platform/linux-generic/test/pktio/Makefile.am  |   3 +-
  platform/linux-generic/test/pktio/pktio_run_tap| 115 
  test/validation/pktio/pktio.c  |  72 -
  9 files changed, 536 insertions(+), 9 deletions(-)
  create mode 100644 platform/linux-generic/include/odp_packet_tap.h
  create mode 100644 platform/linux-generic/pktio/tap.c
  create mode 100755 platform/linux-generic/test/pktio/pktio_run_tap

--
2.1.4





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


Re: [lng-odp] [PATCH] api: pktio link status

2015-12-14 Thread Maxim Uvarov



_link_up() might be confused with setting command. Not with getting 
status command.


How about:
odp_pktio_status_link_up()?

There might be some other statuses for pktio which we can extend later 
and use the same prefix odp_pktio_status_


Maxim.


On 12/11/2015 15:53, Alexandru Badicioiu wrote:
Wouldn't be the application code more clear if the function is renamed 
to _link_up()?
Return values clearly suggest this. The application has to remember 
that 1 means link up and 0 means link down.


Alex


On 11 December 2015 at 14:44, Maxim Uvarov > wrote:


Signed-off-by: Maxim Uvarov mailto:maxim.uva...@linaro.org>>
---
 v1 was link_state(), now it's link_status().

 include/odp/api/packet_io.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 443841e..8999b2c 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -673,6 +673,17 @@ void
odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t
*param);
 void odp_pktio_print(odp_pktio_t pktio);

 /**
+ * Determine pktio link is up or down for a packet IO interface.
+ *
+ * @param pktio Packet IO handle.
+ *
+ * @retval  1 link is up
+ * @retval  0 link is down
+ * @retval <0 on failure
+*/
+int odp_pktio_link_status(odp_pktio_t pktio);
+
+/**
  * @}
  */

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


[lng-odp] [PATCH 2/6] example: update the prototype for thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 example/classifier/odp_classifier.c | 2 +-
 example/generator/odp_generator.c   | 9 ++---
 example/ipsec/odp_ipsec.c   | 2 +-
 example/packet/odp_pktio.c  | 3 ++-
 example/timer/odp_timer_test.c  | 2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 81e6bf0..6cf4596 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -533,7 +533,7 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  pktio_receive_thread,
- args);
+ args, ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 01807a0..f156497 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -784,7 +784,8 @@ int main(int argc, char *argv[])
abort();
args->thread[1].mode = args->appl.mode;
odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
- gen_recv_thread, &args->thread[1]);
+ gen_recv_thread, &args->thread[1],
+ ODP_THREAD_WORKER);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
@@ -804,7 +805,8 @@ int main(int argc, char *argv[])
odp_cpumask_zero(&cpu_mask);
odp_cpumask_set(&cpu_mask, cpu_next);
odph_linux_pthread_create(&thread_tbl[0], &cpu_mask,
- gen_send_thread, &args->thread[0]);
+ gen_send_thread, &args->thread[0],
+ ODP_THREAD_WORKER);
 
} else {
int cpu = odp_cpumask_first(&cpumask);
@@ -849,7 +851,8 @@ int main(int argc, char *argv[])
odph_linux_pthread_create(&thread_tbl[i],
  &thd_mask,
  thr_run_func,
- &args->thread[i]);
+ &args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
 
}
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index f0ff2c9..fab1035 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1333,7 +1333,7 @@ main(int argc, char *argv[])
 * Create and init worker threads
 */
odph_linux_pthread_create(thread_tbl, &cpumask,
- pktio_thread, NULL);
+ pktio_thread, NULL, ODP_THREAD_WORKER);
 
/*
 * If there are streams attempt to verify them else
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 239c1b0..c42331b 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -442,7 +442,8 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  thr_run_func,
- &args->thread[i]);
+ &args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 8796b66..b7a4fd2 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -479,7 +479,7 @@ int main(int argc, char *argv[])
 
/* Create and launch worker threads */
odph_linux_pthread_create(thread_tbl, &cpumask,
- run_thread, gbls);
+ run_thread, gbls, ODP_THREAD_WORKER);
 
/* Wait for worker threads to exit */
odph_linux_pthread_join(thread_tbl, num_workers);
-- 
1.9.1

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


[lng-odp] [PATCH 5/6] test:performance:update the thread create proto

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/performance/odp_atomic.c | 2 +-
 test/performance/odp_l2fwd.c  | 3 ++-
 test/performance/odp_pktio_perf.c | 4 ++--
 test/performance/odp_scheduling.c | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
index 1402a0c..054f653 100644
--- a/test/performance/odp_atomic.c
+++ b/test/performance/odp_atomic.c
@@ -286,7 +286,7 @@ int odp_test_thread_create(void *func_ptr(void *), 
pthrd_arg *arg)
/* Create and init additional threads */
odp_cpumask_default_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
- (void *)arg);
+ (void *)arg, ODP_THREAD_WORKER);
 
return 0;
 }
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 3941c50..481fb01 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -598,7 +598,8 @@ int main(int argc, char *argv[])
odp_cpumask_set(&thd_mask, cpu);
odph_linux_pthread_create(&thread_tbl[i], &thd_mask,
  thr_run_func,
- &gbl_args->thread[i]);
+ &gbl_args->thread[i],
+ ODP_THREAD_WORKER);
cpu = odp_cpumask_next(&cpumask, cpu);
}
 
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index ffe9844..82dcf19 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -629,7 +629,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
/* start receiver threads first */
args_rx.batch_len = gbl_args->args.rx_batch_len;
odph_linux_pthread_create(&thd_tbl[0], thd_mask_rx,
- run_thread_rx, &args_rx);
+ run_thread_rx, &args_rx, ODP_THREAD_WORKER);
odp_barrier_wait(&gbl_args->rx_barrier);
num_rx_workers = odp_cpumask_count(thd_mask_rx);
 
@@ -639,7 +639,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
args_tx.duration  = gbl_args->args.duration;
args_tx.batch_len = gbl_args->args.tx_batch_len;
odph_linux_pthread_create(&thd_tbl[num_rx_workers], thd_mask_tx,
- run_thread_tx, &args_tx);
+ run_thread_tx, &args_tx, ODP_THREAD_WORKER);
odp_barrier_wait(&gbl_args->tx_barrier);
 
/* wait for transmitter threads to terminate */
diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index cb865b3..971d19b 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -995,7 +995,7 @@ int main(int argc, char *argv[])
} else {
/* Create and launch worker threads */
odph_linux_pthread_create(thread_tbl, &cpumask,
- run_thread, NULL);
+ run_thread, NULL, ODP_THREAD_WORKER);
 
/* Wait for worker threads to terminate */
odph_linux_pthread_join(thread_tbl, num_workers);
-- 
1.9.1

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


[lng-odp] [PATCH 6/6] test:validation:common: update the thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/validation/common/odp_cunit_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/validation/common/odp_cunit_common.c 
b/test/validation/common/odp_cunit_common.c
index bc786ec..a886f10 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -33,7 +33,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg 
*arg)
odp_cpumask_default_worker(&cpumask, arg->numthrds);
 
return odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
-(void *)arg);
+(void *)arg, ODP_THREAD_WORKER);
 }
 
 /** exit from test thread */
-- 
1.9.1

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


[lng-odp] [PATCH 1/6] linux:add thread type in odph_linux_pthread_create

2015-12-14 Thread Hemant Agrawal
The exisiting helper routine only create the worker threads.
However there is a need to use the same for creating the control thread as 
well. e.g. CLI thread.

Signed-off-by: Hemant Agrawal 
---
 helper/include/odp/helper/linux.h |  4 +++-
 helper/linux.c| 31 +++
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/helper/include/odp/helper/linux.h 
b/helper/include/odp/helper/linux.h
index ce61fdf..72f8f10 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/include/odp/helper/linux.h
@@ -59,12 +59,14 @@ typedef struct {
  * @param mask  CPU mask
  * @param start_routine Thread start function
  * @param arg   Thread argument
+ * @param thr_type  Thread type
  *
  * @return Number of threads created
  */
 int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
   const odp_cpumask_t *mask,
-  void *(*start_routine) (void *), void *arg);
+  void *(*start_routine) (void *), void *arg,
+  odp_thread_type_t thr_type);
 
 /**
  * Waits pthreads to exit
diff --git a/helper/linux.c b/helper/linux.c
index 4a8e8b3..497bd8c 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -44,9 +44,31 @@ static void *odp_run_start_routine(void *arg)
return ret_ptr;
 }
 
+static void *odp_run_start_contorl_routine(void *arg)
+{
+   odp_start_args_t *start_args = arg;
+
+   /* ODP thread local init for control thread */
+   if (odp_init_local(ODP_THREAD_CONTROL)) {
+   ODPH_ERR("Local init failed for control\n");
+   return NULL;
+   }
+
+   void *ret_ptr = start_args->start_routine(start_args->arg);
+   int ret = odp_term_local();
+
+   if (ret < 0)
+   ODPH_ERR("Local term failed for control\n");
+   else if (ret == 0 && odp_term_global())
+   ODPH_ERR("Global term failed for control\n");
+
+   return ret_ptr;
+}
+
 int odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
  const odp_cpumask_t *mask_in,
- void *(*start_routine)(void *), void *arg)
+ void *(*start_routine)(void *), void *arg,
+ odp_thread_type_t thr_type)
 {
int i;
int num;
@@ -90,9 +112,10 @@ int odph_linux_pthread_create(odph_linux_pthread_t 
*thread_tbl,
thread_tbl[i].start_args->arg   = arg;
 
ret = pthread_create(&thread_tbl[i].thread,
-&thread_tbl[i].attr,
-odp_run_start_routine,
-thread_tbl[i].start_args);
+   &thread_tbl[i].attr,
+   thr_type == ODP_THREAD_WORKER ?
+   odp_run_start_routine : odp_run_start_contorl_routine,
+   thread_tbl[i].start_args);
if (ret != 0) {
ODPH_ERR("Failed to start thread on cpu #%d\n", cpu);
free(thread_tbl[i].start_args);
-- 
1.9.1

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


[lng-odp] [PATCH 4/6] test:api_test:update the thread create prototype

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 test/api_test/odp_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 681d915..cebaa12 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -76,7 +76,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg 
*arg)
/* Create and init additional threads */
odp_cpumask_default_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
- (void *)arg);
+ (void *)arg, ODP_THREAD_WORKER);
 
return 0;
 }
-- 
1.9.1

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


[lng-odp] [PATCH 3/6] helper:test:update the prototype for thread create

2015-12-14 Thread Hemant Agrawal
Updating the prototype for odph_linux_pthread_create

Signed-off-by: Hemant Agrawal 
---
 helper/test/odp_thread.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c
index 592f856..65b5778 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/odp_thread.c
@@ -61,7 +61,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
printf("new cpu mask:   %s\n", cpumaskstr);
printf("new num worker threads: %i\n\n", num_workers);
 
-   odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL);
+   odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, worker_fn, NULL,
+   ODP_THREAD_WORKER);
 
odph_linux_pthread_join(thread_tbl, num_workers);
 
-- 
1.9.1

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