[lng-odp] [PATCH] validation: packet: test now handles pool that do not support segmentation

2015-08-19 Thread Nicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin 
---
 test/validation/packet/packet.c | 40 ++--
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index 99a6745..d6dd3eb 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -21,8 +21,8 @@ static odp_pool_t packet_pool;
 static const uint32_t packet_len = PACKET_BUF_LEN -
PACKET_TAILROOM_RESERVE;
 
-static const uint32_t segmented_packet_len = PACKET_BUF_LEN * 5 -
-   PACKET_TAILROOM_RESERVE;
+static uint32_t   segmented_packet_len = ODP_CONFIG_PACKET_BUF_LEN_MAX;
+static odp_bool_t segmentation_supported = true;
 
 odp_packet_t test_packet, segmented_test_packet;
 
@@ -55,11 +55,7 @@ int packet_suite_init(void)
return -1;
 
test_packet = odp_packet_alloc(packet_pool, packet_len);
-   segmented_test_packet = odp_packet_alloc(packet_pool,
-segmented_packet_len);
-
-   if (odp_packet_is_valid(test_packet) == 0 ||
-   odp_packet_is_valid(segmented_test_packet) == 0)
+   if (odp_packet_is_valid(test_packet) == 0)
return -1;
 
udat = odp_packet_user_area(test_packet);
@@ -69,6 +65,20 @@ int packet_suite_init(void)
odp_pool_print(packet_pool);
memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
+   /* Try to allocate the largest possible packet to see
+* if segmentation is supported  */
+   do {
+   segmented_test_packet = odp_packet_alloc(packet_pool,
+segmented_packet_len);
+   if (segmented_test_packet == ODP_PACKET_INVALID)
+   segmented_packet_len -= ODP_CONFIG_BUFFER_ALIGN_MIN;
+   } while (segmented_test_packet == ODP_PACKET_INVALID);
+
+   if (odp_packet_is_valid(segmented_test_packet) == 0)
+   return -1;
+   if (!odp_packet_is_segmented(segmented_test_packet))
+   segmentation_supported = false;
+
udat = odp_packet_user_area(segmented_test_packet);
udat_size = odp_packet_user_area_size(segmented_test_packet);
if (udat == NULL || udat_size != sizeof(struct udata_struct))
@@ -136,6 +146,8 @@ void packet_test_alloc_segmented(void)
pkt = odp_packet_alloc(packet_pool, len);
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
CU_ASSERT(odp_packet_len(pkt) == len);
+   if (segmentation_supported)
+   CU_ASSERT(odp_packet_is_segmented(pkt) == 1);
odp_packet_free(pkt);
 }
 
@@ -406,7 +418,8 @@ void packet_test_segments(void)
}
 
CU_ASSERT(odp_packet_is_segmented(pkt) == 0);
-   CU_ASSERT(odp_packet_is_segmented(seg_pkt) == 1);
+   if (segmentation_supported)
+   CU_ASSERT(odp_packet_is_segmented(seg_pkt) == 1);
 
seg = odp_packet_first_seg(pkt);
buf_len = 0;
@@ -568,9 +581,16 @@ void packet_test_add_rem_data(void)
  sizeof(struct udata_struct));
memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
-   /* Insert one more packet length in the middle of a packet */
offset = pkt_len / 2;
-   add_len = pkt_len;
+
+   if (segmentation_supported) {
+   /* Insert one more packet length in the middle of a packet */
+   add_len = pkt_len;
+   } else {
+   /* Add diff between largest and smaller packets
+* which is at least tailroom */
+   add_len = segmented_packet_len - packet_len;
+   }
 
new_pkt = odp_packet_add_data(pkt, offset, add_len);
CU_ASSERT(new_pkt != ODP_PACKET_INVALID);
-- 
2.5.0.rc2.3.g9ad628c

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


Re: [lng-odp] [API-NEXT PATCHv2] validation: classification: added additional suite to test individual PMRs

2015-08-19 Thread Ivan Khoronzhuk

Hi Bala,

just several comments I forgot to mention.

On 19.08.15 08:45, Bala Manoharan wrote:

Ivan,

On 18 August 2015 at 22:39, Ivan Khoronzhuk mailto:ivan.khoronz...@linaro.org>> wrote:

post test review.

I've tested. It works for me. (except UDP/TCP src, as it's not supported).
Why you didn't add here others PMR? Are you planing it after?
Also there is no some "inter-PMR" tests, like:
1 - create PMR_dudp-CoS1 (port X)
2 - create PMR_dtcp-CoS2 (same port X)
3 - send UDP packet with port X
4 - check if it was received with CoS1
5 - send TCP packet with same port X
6 - check if it was received with CoS2

Maybe it's not place for it, but it definitly should be added.
It can help to figure out issues when L4 layer cannot differ type of packet.
And implementor has to add some inter PMR to dispatch packet by type on L3 
level.

Yes. I am planning to add more complex Test Cases in a separate suite. So that 
the user can first test whether the basic functionality is working fine.
This current patch contains the basic test suite suite which tests the basic 
functionality of all the APIs.

Some additional comments below.

On 12.08.15 11:53, Balasubramanian Manoharan wrote:

Additional test suite is added to classification validation suite to 
test
individual PMRs. This suite will test the defined PMRs by configuring
pktio separately for every test case.

Fixes:
https://bugs.linaro.org/show_bug.cgi?id=1542
https://bugs.linaro.org/show_bug.cgi?id=1544
https://bugs.linaro.org/show_bug.cgi?id=1545
https://bugs.linaro.org/show_bug.cgi?id=1546

Signed-off-by: Balasubramanian Manoharan mailto:bala.manoha...@linaro.org>>
---
v2: Incorporates review comments from Ivan and Christophe

   helper/include/odp/helper/tcp.h|   4 +
   test/validation/classification/Makefile.am |   2 +
   test/validation/classification/classification.c|   5 +
   .../classification/odp_classification_common.c | 225 
   .../classification/odp_classification_test_pmr.c   | 640 
+
   .../classification/odp_classification_tests.c  | 152 +
   .../classification/odp_classification_testsuites.h |  10 +-
   7 files changed, 906 insertions(+), 132 deletions(-)
   create mode 100644 
test/validation/classification/odp_classification_common.c
   create mode 100644 
test/validation/classification/odp_classification_test_pmr.c

diff --git a/helper/include/odp/helper/tcp.h 
b/helper/include/odp/helper/tcp.h
index defe422..b52784d 100644
--- a/helper/include/odp/helper/tcp.h
+++ b/helper/include/odp/helper/tcp.h
@@ -26,6 +26,10 @@ extern "C" {
*  @{
*/

+/** TCP header length (Minimum Header length without options)*/
+/** If options field is added to TCP header then the correct header 
value
+should be updated by the application */
+#define ODPH_TCPHDR_LEN 20

   /** TCP header */
   typedef struct ODP_PACKED {
diff --git a/test/validation/classification/Makefile.am 
b/test/validation/classification/Makefile.am
index ba468fa..050d5e6 100644
--- a/test/validation/classification/Makefile.am
+++ b/test/validation/classification/Makefile.am
@@ -3,6 +3,8 @@ include ../Makefile.inc
   noinst_LTLIBRARIES = libclassification.la 

   libclassification_la_SOURCES = odp_classification_basic.c \
odp_classification_tests.c \
+  odp_classification_test_pmr.c \
+  odp_classification_common.c \
classification.c

   bin_PROGRAMS = classification_main$(EXEEXT)
diff --git a/test/validation/classification/classification.c 
b/test/validation/classification/classification.c
index 2582aaa..a88a301 100644
--- a/test/validation/classification/classification.c
+++ b/test/validation/classification/classification.c
@@ -18,6 +18,11 @@ static CU_SuiteInfo classification_suites[] = {
 .pInitFunc = classification_suite_init,
 .pCleanupFunc = classification_suite_term,
 },
+   { .pName = "classification pmr tests",
+   .pTests = classification_suite_pmr,
+   .pInitFunc = classification_suite_pmr_init,
+   .pCleanupFunc = classification_suite_pmr_term,
+   },
 CU_SUITE_INFO_NULL,
   };

diff --git a/test/validation/classification/odp_classification_common.c 
b/test/validation/classification/od

Re: [lng-odp] [PATCHv7] example:generator:option to supply core mask

2015-08-19 Thread Stuart Haslam
On Wed, Aug 12, 2015 at 10:55:12AM +0200, Balakrishna.Garapati wrote:
> Signed-off-by: Balakrishna.Garapati 
> ---
>  validate cpumask from parse_args and exit with a message
> 
>  example/generator/odp_generator.c | 72 
> ---
>  1 file changed, 52 insertions(+), 20 deletions(-)
> 
> diff --git a/example/generator/odp_generator.c 
> b/example/generator/odp_generator.c
> index bdee222..2ad4e27 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -43,6 +43,7 @@
>   */
>  typedef struct {
>   int cpu_count;  /**< system CPU count */
> + const char *mask;   /**< s/core mask/CPU mask */

In my previous comment I was asking to replace the text "core mask" with
"CPU mask".

>   int if_count;   /**< Number of interfaces to be used */
>   char **if_names;/**< Array of pointers to interface names */
>   char *if_str;   /**< Storage for interface names */
> @@ -645,18 +646,26 @@ int main(int argc, char *argv[])
>   if (args->appl.cpu_count)
>   num_workers = args->appl.cpu_count;
>  
> - /* ping mode need two worker */
> - if (args->appl.mode == APPL_MODE_PING)
> - num_workers = 2;
> -
> - /* Get default worker cpumask */
>   num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
> + if (args->appl.mask) {
> + odp_cpumask_from_str(&cpumask, args->appl.mask);
> + num_workers = odp_cpumask_count(&cpumask);
> + }
> +
>   (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
>  
>   printf("num worker threads: %i\n", num_workers);
>   printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
>   printf("cpu mask:   %s\n", cpumaskstr);
>  
> + /* ping mode need two workers */
> + if (args->appl.mode == APPL_MODE_PING) {
> + if (num_workers < 2) {
> + EXAMPLE_ERR("Need at least two worker threads\n");
> + exit(EXIT_FAILURE);
> + }
> + }
> +
>   /* Create packet pool */
>   memset(¶ms, 0, sizeof(params));
>   params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
> @@ -704,12 +713,13 @@ int main(int argc, char *argv[])
>   memset(thread_tbl, 0, sizeof(thread_tbl));
>  
>   if (args->appl.mode == APPL_MODE_PING) {
> - odp_cpumask_t cpu0_mask;
> + odp_cpumask_t cpu_mask;
>   odp_queue_t tq;
> + int cpu_first, cpu_next;
>  
> - /* Previous code forced both threads to CPU 0 */
> - odp_cpumask_zero(&cpu0_mask);
> - odp_cpumask_set(&cpu0_mask, 0);
> + odp_cpumask_zero(&cpu_mask);
> + cpu_first = odp_cpumask_first(&cpumask);
> + odp_cpumask_set(&cpu_mask, cpu_first);
>  
>   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
>   if (tq == ODP_QUEUE_INVALID)
> @@ -725,7 +735,7 @@ int main(int argc, char *argv[])
>   if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
>   abort();
>   args->thread[1].mode = args->appl.mode;
> - odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
> + odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
> gen_recv_thread, &args->thread[1]);
>  
>   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
> @@ -742,7 +752,10 @@ int main(int argc, char *argv[])
>   if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
>   abort();
>   args->thread[0].mode = args->appl.mode;
> - odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
> + cpu_next = odp_cpumask_next(&cpumask, cpu_first);
> + 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]);
>  
>   /* only wait send thread to join */
> @@ -824,11 +837,12 @@ static void parse_args(int argc, char *argv[], 
> appl_args_t *appl_args)
>   static struct option longopts[] = {
>   {"interface", required_argument, NULL, 'I'},
>   {"workers", required_argument, NULL, 'w'},
> + {"cpumask", required_argument, NULL, 'c'},
>   {"srcmac", required_argument, NULL, 'a'},
>   {"dstmac", required_argument, NULL, 'b'},
> - {"srcip", required_argument, NULL, 'c'},
> + {"srcip", required_argument, NULL, 's'},
>   {"dstip", required_argument, NULL, 'd'},
> - {"packetsize", required_argument, NULL, 's'},
> + {"packetsize", required_argument, NULL, 'p'},
>   {"mode", required_argument, NULL, 'm'},
>   {"count", required_argument, NULL, 'n'},
>   {"timeout", req

Re: [lng-odp] [PATCHv5] example:generator:option to supply core mask

2015-08-19 Thread Stuart Haslam
On Tue, Aug 18, 2015 at 05:39:59PM +0200, Krishna Garapati wrote:
> Stuart, you have reviewed the old patch. please look at the PATCHv7 "
> http://patches.opendataplane.org/patch/2723/";
> 

Oops missed that, a couple of minor comments still apply so I'll reply to
that patch.

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


Re: [lng-odp] [API-NEXT PATCH v2 2/4] test/example: avoid "cycle" word usage

2015-08-19 Thread Stuart Haslam
On Sat, Aug 08, 2015 at 01:28:08AM +0300, Ivan Khoronzhuk wrote:
> The word "cycle" is left from old API time names. The "cycle" is
> ambiguous word, especially when it can be used for other purposes.
> So better to use "tick" word or just "t" symbol.
> 
> Signed-off-by: Ivan Khoronzhuk 
> ---
>  example/ipsec/odp_ipsec.c | 14 +++---
>  example/timer/odp_timer_test.c| 22 +-
>  test/performance/odp_pktio_perf.c | 32 +++---
>  test/performance/odp_scheduling.c | 80 
> +--
>  test/validation/scheduler/scheduler.c |  4 +-
>  test/validation/time/time.c   | 38 -
>  6 files changed, 95 insertions(+), 95 deletions(-)
> 
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index 3d34210..019a0b6 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -265,11 +265,11 @@ odp_queue_t polled_odp_queue_create(const char *name,
>  static
>  odp_event_t polled_odp_schedule(odp_queue_t *from, uint64_t wait)
>  {
> - uint64_t start_cycle;
> - uint64_t cycle;
> + uint64_t start_tick;
> + uint64_t tick;
>   uint64_t diff;
>  
> - start_cycle = 0;
> + start_tick = 0;
>  
>   while (1) {
>   int idx;
> @@ -292,13 +292,13 @@ odp_event_t polled_odp_schedule(odp_queue_t *from, 
> uint64_t wait)
>   if (ODP_SCHED_NO_WAIT == wait)
>   break;
>  
> - if (0 == start_cycle) {
> - start_cycle = odp_time_tick();
> + if (0 == start_tick) {
> + start_tick = odp_time_tick();
>   continue;
>   }
>  
> - cycle = odp_time_tick();
> - diff  = odp_time_ticks_diff(start_cycle, cycle);
> + tick = odp_time_tick();
> + diff  = odp_time_ticks_diff(start_tick, tick);
>  
>   if (wait < diff)
>   break;
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index c6c809d..bbaaf7d 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -313,7 +313,7 @@ int main(int argc, char *argv[])
>   odph_linux_pthread_t thread_tbl[MAX_WORKERS];
>   int num_workers;
>   odp_queue_t queue;
> - uint64_t cycles, ns;
> + uint64_t ticks, ns;
>   odp_queue_param_t param;
>   odp_pool_param_t params;
>   odp_timer_pool_param_t tparams;
> @@ -438,21 +438,21 @@ int main(int argc, char *argv[])
>   }
>  
>   printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
> - printf("Cycles vs nanoseconds:\n");
> + printf("Ticks vs nanoseconds:\n");
>   ns = 0;
> - cycles = odp_time_ns_to_tick(ns);
> + ticks = odp_time_ns_to_tick(ns);
>  
> - printf("  %12"PRIu64" ns  ->  %12"PRIu64" cycles\n", ns, cycles);
> - printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
> -odp_time_tick_to_ns(cycles));
> + printf("  %12"PRIu64" ns  ->  %12"PRIu64" ticks\n", ns, ticks);

This was already present, but checkpatch complains about;

CHECK: Concatenated strings should use spaces between elements

> + printf("  %12"PRIu64" ticks  ->  %12"PRIu64" ns\n", ticks,

nit: this puts the alignment out, need another space after ticks.

> +odp_time_tick_to_ns(ticks));
>  
>   for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) {
> - cycles = odp_time_ns_to_tick(ns);
> + ticks = odp_time_ns_to_tick(ns);
>  
> - printf("  %12"PRIu64" ns  ->  %12"PRIu64" cycles\n", ns,
> -cycles);
> - printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
> -odp_time_tick_to_ns(cycles));
> + printf("  %12"PRIu64" ns  ->  %12"PRIu64" ticks\n", ns,
> +ticks);
> + printf("  %12"PRIu64" ticks  ->  %12"PRIu64" ns\n", ticks,

And here.

> +odp_time_tick_to_ns(ticks));
>   }
>  
>   printf("\n");
> diff --git a/test/performance/odp_pktio_perf.c 
> b/test/performance/odp_pktio_perf.c
> index b3f8d2b..a80d19a 100644
> --- a/test/performance/odp_pktio_perf.c
> +++ b/test/performance/odp_pktio_perf.c
> @@ -106,7 +106,7 @@ struct tx_stats_s {
>   uint64_t tx_cnt;/* Packets transmitted */
>   uint64_t alloc_failures;/* Packet allocation failures */
>   uint64_t enq_failures;  /* Enqueue failures */
> - uint64_t idle_cycles;   /* Idle cycle count in TX loop */
> + uint64_t idle_ticks;/* Idle ticks count in TX loop */
>  };
>  
>  typedef union tx_stats_u {
> @@ -302,8 +302,8 @@ static void *run_thread_tx(void *arg)
>   int thr_id;
>   odp_queue_t outq;
>   pkt_tx_stats_t *stats;
> - uint64_t next_tx_cycles, end_cycles, cur_cycles;
> - uint64_t burst_gap_cycles;
> + uint64_t next_tx_tick, end_tick, cur_tick;
> + uint64_t burst_gap;
>   uint32_t batch_le

Re: [lng-odp] [API-NEXT PATCH v2 3/4] linux-generic: use appropriate time API with tick instead of cycles

2015-08-19 Thread Stuart Haslam
On Sat, Aug 08, 2015 at 01:28:09AM +0300, Ivan Khoronzhuk wrote:
> The time API were changed from *_cycles* to *_tick*, so use
> appropriate names.
> 
> Signed-off-by: Ivan Khoronzhuk 
> ---
>  platform/linux-generic/arch/linux/odp_time.c  | 2 +-
>  platform/linux-generic/arch/mips64/odp_time.c | 2 +-
>  platform/linux-generic/arch/x86/odp_time.c| 2 +-
>  platform/linux-generic/odp_schedule.c | 8 
>  platform/linux-generic/odp_time.c | 6 +++---
>  5 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/platform/linux-generic/arch/linux/odp_time.c 
> b/platform/linux-generic/arch/linux/odp_time.c
> index 4dc0764..bd16a32 100644
> --- a/platform/linux-generic/arch/linux/odp_time.c
> +++ b/platform/linux-generic/arch/linux/odp_time.c
> @@ -16,7 +16,7 @@
>  
>  #define GIGA 10
>  
> -uint64_t odp_time_cycles(void)
> +uint64_t odp_time_tick(void)
>  {
>   struct timespec time;
>   uint64_t sec, ns, hz, cycles;

cycles -> tick

> diff --git a/platform/linux-generic/arch/mips64/odp_time.c 
> b/platform/linux-generic/arch/mips64/odp_time.c
> index 4fb790b..2a68aa5 100644
> --- a/platform/linux-generic/arch/mips64/odp_time.c
> +++ b/platform/linux-generic/arch/mips64/odp_time.c
> @@ -8,7 +8,7 @@
>  #include 
>  #include 
>  
> -uint64_t odp_time_cycles(void)
> +uint64_t odp_time_tick(void)
>  {
>   #define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
>   #define CVMX_TMP_STR2(x) #x
> diff --git a/platform/linux-generic/arch/x86/odp_time.c 
> b/platform/linux-generic/arch/x86/odp_time.c
> index a111561..a4f60e1 100644
> --- a/platform/linux-generic/arch/x86/odp_time.c
> +++ b/platform/linux-generic/arch/x86/odp_time.c
> @@ -5,7 +5,7 @@
>   */
>  #include 
>  
> -uint64_t odp_time_cycles(void)
> +uint64_t odp_time_tick(void)
>  {
>   union {
>   uint64_t tsc_64;
> diff --git a/platform/linux-generic/odp_schedule.c 
> b/platform/linux-generic/odp_schedule.c
> index 5d32c81..d0cd41e 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -528,12 +528,12 @@ static int schedule_loop(odp_queue_t *out_queue, 
> uint64_t wait,
>   break;
>  
>   if (start_cycle == 0) {
> - start_cycle = odp_time_cycles();
> + start_cycle = odp_time_tick();
>   continue;
>   }
>  
> - cycle = odp_time_cycles();
> - diff  = odp_time_diff_cycles(start_cycle, cycle);
> + cycle = odp_time_tick();
> + diff  = odp_time_ticks_diff(start_cycle, cycle);
>  
>   if (wait < diff)
>   break;
> @@ -579,7 +579,7 @@ uint64_t odp_schedule_wait_time(uint64_t ns)
>   if (ns <= ODP_SCHED_NO_WAIT)
>   ns = ODP_SCHED_NO_WAIT + 1;
>  
> - return odp_time_ns_to_cycles(ns);
> + return odp_time_ns_to_tick(ns);
>  }
>  
>  
> diff --git a/platform/linux-generic/odp_time.c 
> b/platform/linux-generic/odp_time.c
> index a08833d..aed3702 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -12,7 +12,7 @@
>  
>  #define GIGA 10
>  
> -uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
> +uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2)
>  {
>   if (odp_likely(t2 > t1))
>   return t2 - t1;
> @@ -20,7 +20,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
>   return t2 + (UINT64_MAX - t1);
>  }
>  
> -uint64_t odp_time_cycles_to_ns(uint64_t cycles)
> +uint64_t odp_time_tick_to_ns(uint64_t cycles)

parameter name; cycles -> tick

>  {
>   uint64_t hz = odp_sys_cpu_hz();
>  
> @@ -31,7 +31,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
>  }
>  
>  
> -uint64_t odp_time_ns_to_cycles(uint64_t ns)
> +uint64_t odp_time_ns_to_tick(uint64_t ns)
>  {
>   uint64_t hz = odp_sys_cpu_hz();
>  
> -- 
> 1.9.1
> 

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


[lng-odp] [API-NEXT PATCH] api: pktio description of doxygen group

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 include/odp/api/packet_io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index e00d011..8169372 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -19,7 +19,7 @@ extern "C" {
 #endif
 
 /** @defgroup odp_packet_io ODP PACKET IO
- *  Operations on a packet.
+ *  Operations on a packet input/output interface.
  *  @{
  */
 
-- 
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 v2 2/4] test/example: avoid "cycle" word usage

2015-08-19 Thread Ivan Khoronzhuk



On 19.08.15 12:49, Stuart Haslam wrote:

On Sat, Aug 08, 2015 at 01:28:08AM +0300, Ivan Khoronzhuk wrote:

The word "cycle" is left from old API time names. The "cycle" is
ambiguous word, especially when it can be used for other purposes.
So better to use "tick" word or just "t" symbol.

Signed-off-by: Ivan Khoronzhuk 
---
  example/ipsec/odp_ipsec.c | 14 +++---
  example/timer/odp_timer_test.c| 22 +-
  test/performance/odp_pktio_perf.c | 32 +++---
  test/performance/odp_scheduling.c | 80 +--
  test/validation/scheduler/scheduler.c |  4 +-
  test/validation/time/time.c   | 38 -
  6 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 3d34210..019a0b6 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -265,11 +265,11 @@ odp_queue_t polled_odp_queue_create(const char *name,
  static
  odp_event_t polled_odp_schedule(odp_queue_t *from, uint64_t wait)
  {
-   uint64_t start_cycle;
-   uint64_t cycle;
+   uint64_t start_tick;
+   uint64_t tick;
uint64_t diff;

-   start_cycle = 0;
+   start_tick = 0;

while (1) {
int idx;
@@ -292,13 +292,13 @@ odp_event_t polled_odp_schedule(odp_queue_t *from, 
uint64_t wait)
if (ODP_SCHED_NO_WAIT == wait)
break;

-   if (0 == start_cycle) {
-   start_cycle = odp_time_tick();
+   if (0 == start_tick) {
+   start_tick = odp_time_tick();
continue;
}

-   cycle = odp_time_tick();
-   diff  = odp_time_ticks_diff(start_cycle, cycle);
+   tick = odp_time_tick();
+   diff  = odp_time_ticks_diff(start_tick, tick);

if (wait < diff)
break;
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index c6c809d..bbaaf7d 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -313,7 +313,7 @@ int main(int argc, char *argv[])
odph_linux_pthread_t thread_tbl[MAX_WORKERS];
int num_workers;
odp_queue_t queue;
-   uint64_t cycles, ns;
+   uint64_t ticks, ns;
odp_queue_param_t param;
odp_pool_param_t params;
odp_timer_pool_param_t tparams;
@@ -438,21 +438,21 @@ int main(int argc, char *argv[])
}

printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
-   printf("Cycles vs nanoseconds:\n");
+   printf("Ticks vs nanoseconds:\n");
ns = 0;
-   cycles = odp_time_ns_to_tick(ns);
+   ticks = odp_time_ns_to_tick(ns);

-   printf("  %12"PRIu64" ns  ->  %12"PRIu64" cycles\n", ns, cycles);
-   printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
-  odp_time_tick_to_ns(cycles));
+   printf("  %12"PRIu64" ns  ->  %12"PRIu64" ticks\n", ns, ticks);


This was already present, but checkpatch complains about;

CHECK: Concatenated strings should use spaces between elements



Ok. I'll correct it.


+   printf("  %12"PRIu64" ticks  ->  %12"PRIu64" ns\n", ticks,


nit: this puts the alignment out, need another space after ticks.



Ok. I'll add 1 space after ticks.


+  odp_time_tick_to_ns(ticks));

for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) {
-   cycles = odp_time_ns_to_tick(ns);
+   ticks = odp_time_ns_to_tick(ns);

-   printf("  %12"PRIu64" ns  ->  %12"PRIu64" cycles\n", ns,
-  cycles);
-   printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
-  odp_time_tick_to_ns(cycles));
+   printf("  %12"PRIu64" ns  ->  %12"PRIu64" ticks\n", ns,
+  ticks);
+   printf("  %12"PRIu64" ticks  ->  %12"PRIu64" ns\n", ticks,


And here.


Ok.


+  odp_time_tick_to_ns(ticks));
}

printf("\n");
diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index b3f8d2b..a80d19a 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -106,7 +106,7 @@ struct tx_stats_s {
uint64_t tx_cnt;/* Packets transmitted */
uint64_t alloc_failures;/* Packet allocation failures */
uint64_t enq_failures;  /* Enqueue failures */
-   uint64_t idle_cycles;   /* Idle cycle count in TX loop */
+   uint64_t idle_ticks;/* Idle ticks count in TX loop */
  };

  typedef union tx_stats_u {
@@ -302,8 +302,8 @@ static void *run_thread_tx(void *arg)
int thr_id;
odp_queue_t outq;
pkt_tx_stats_t *stats;
-   uint64_t next_tx_cycles, end_cycles, cur_cycles;
-   uint64_t burst_gap_cycles;
+   uint64_t next_tx_tick, end_tick, cur_tick;
+   uint64_t burst_gap;
u

Re: [lng-odp] [API-NEXT PATCHv2 6/7] validation: test odp_pktio_start and odp_pktio_stop

2015-08-19 Thread Stuart Haslam
On Fri, Aug 14, 2015 at 02:03:03PM +0300, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov 
> ---
>  test/validation/pktio/pktio.c | 114 
> ++
>  1 file changed, 114 insertions(+)
> 
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index ebe34fa..4222463 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -626,6 +626,119 @@ void pktio_test_inq(void)
>   CU_ASSERT(odp_pktio_close(pktio) == 0);
>  }
>  
> +static uint32_t pktio_pkt_validate(odp_packet_t pkt)
> +{
> + size_t off;
> + pkt_head_t head;
> + pkt_tail_t tail;
> +
> + if (pkt == ODP_PACKET_INVALID)
> + return -1;
> +
> + off = odp_packet_l4_offset(pkt);
> + if (off ==  ODP_PACKET_OFFSET_INVALID)
> + return -1;
> +
> + off += ODPH_UDPHDR_LEN;
> + if (odp_packet_copydata_out(pkt, off, sizeof(head), &head) != 0)
> + return -1;
> +
> + if (head.magic != TEST_SEQ_MAGIC)
> + return -1;
> +
> + if (odp_packet_len(pkt) == packet_len) {
> + off = packet_len - sizeof(tail);
> + if (odp_packet_copydata_out(pkt, off, sizeof(tail), &tail) != 0)
> + return -1;
> + }
> +
> + return 0;
> +}

This is pretty similar to pktio_pkt_seq() except that this isn't checking
packets arrive in sequence or that their tail magic is valid, what's the
reason for that?

If the two functions are needed they could do with being refactored a bit.

> +
> +static void pktio_test_start_stop(void)
> +{
> + odp_pktio_t pktio[MAX_NUM_IFACES];
> + odp_packet_t pkt;
> + odp_event_t tx_ev[1000];
> + odp_event_t ev;
> + int i, pkts, ret, alloc = 0;
> + odp_queue_t outq;
> +
> + for (i = 0; i < num_ifaces; i++) {
> + pktio[i] = create_pktio(iface_name[i], ODP_QUEUE_TYPE_SCHED, 0);
> + CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID);
> + create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
> + }
> +
> + for (alloc = 0; alloc < 1000; alloc++) {
> + pkt = odp_packet_alloc(default_pkt_pool, packet_len);
> + if (pkt == ODP_PACKET_INVALID)
> + break;
> + pktio_init_packet(pkt);
> + tx_ev[alloc] = odp_packet_to_event(pkt);
> + }
> +
> + outq = odp_pktio_outq_getdef(pktio[0]);
> +
> + /* stop and check that we can not transmit*/
> + odp_pktio_stop(pktio[0]);

Check return value

> + odp_errno_zero();
> + ret = odp_queue_enq_multi(outq, tx_ev, 10);
> + CU_ASSERT(ret == -1);
> + CU_ASSERT(odp_errno() == EPERM);

Shouldn't be trying to enq to a stopped pktio.

Putting this specific return value and errno in the validation test
would mean that it needs to be defined in the API so that all pktios
behave the same. I don't think we should do that though as attempting
to enq to a pktio that's in the wrong state is a programming error and
we shouldn't force all implementations to guard against it.

> +
> + /* start first and queue packets */
> + odp_pktio_start(pktio[0]);

Check return value

> + for (pkts = 0; pkts != alloc; ) {
> + ret = odp_queue_enq_multi(outq, &tx_ev[pkts], alloc - pkts);
> + if (ret < 0) {
> + CU_FAIL("unable to enqueue packet\n");
> + break;
> + }
> + pkts += ret;
> + }
> + /* stop second and check that packets did not arrive */
> + if (num_ifaces == 1)
> + odp_pktio_stop(pktio[0]);
> + else
> + odp_pktio_stop(pktio[1]);

I imagine some platforms will have a problem with this as it assumes the
enqueued packets haven't already been received and pre-scheduled before
the pktio was stopped.

It works in linux-generic only because the scheduler runs within the
context of this (single) test thread so everything is serialised.

> + for (i = 0, pkts = 0; i < 1000; i++) {
> + ev = odp_schedule(NULL, ODP_TIME_MSEC);
> + if (ev != ODP_EVENT_INVALID) {
> + if (odp_event_type(ev) == ODP_EVENT_PACKET) {
> + if (!pktio_pkt_validate(pkt))
> + pkts++;
> + }
> + odp_event_free(ev);
> + }
> + }
> + if (pkts)
> + CU_FAIL("pktio stopped, received unexpected events");
> +
> + /* start second and get packets */
> + if (num_ifaces == 1)
> + odp_pktio_start(pktio[0]);
> + else
> + odp_pktio_start(pktio[1]);

This assumes that packets enqueued before the pktio was previously
stopped are retained somewhere until it's started again, which doesn't
make sense as expected behaviour given that in the meantime while the
pktio was stopped all received packets were dropped. IMO we should only
expect to receive packets that have arrived at the pktio since
odp_pktio_star

[lng-odp] [PATCHv8] example:generator:option to supply core mask

2015-08-19 Thread Balakrishna.Garapati
Signed-off-by: Balakrishna.Garapati 
---
 v8: moved optional args from MANDATORY to OPTIONAL options
 fixed the comment section "core mask" to "CPU maski".
 example/generator/odp_generator.c | 72 ---
 1 file changed, 52 insertions(+), 20 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index bdee222..2ad4e27 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -43,6 +43,7 @@
  */
 typedef struct {
int cpu_count;  /**< system CPU count */
+   const char *mask;   /**< s/core mask/CPU mask */
int if_count;   /**< Number of interfaces to be used */
char **if_names;/**< Array of pointers to interface names */
char *if_str;   /**< Storage for interface names */
@@ -645,18 +646,26 @@ int main(int argc, char *argv[])
if (args->appl.cpu_count)
num_workers = args->appl.cpu_count;
 
-   /* ping mode need two worker */
-   if (args->appl.mode == APPL_MODE_PING)
-   num_workers = 2;
-
-   /* Get default worker cpumask */
num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
+   if (args->appl.mask) {
+   odp_cpumask_from_str(&cpumask, args->appl.mask);
+   num_workers = odp_cpumask_count(&cpumask);
+   }
+
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf("num worker threads: %i\n", num_workers);
printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
printf("cpu mask:   %s\n", cpumaskstr);
 
+   /* ping mode need two workers */
+   if (args->appl.mode == APPL_MODE_PING) {
+   if (num_workers < 2) {
+   EXAMPLE_ERR("Need at least two worker threads\n");
+   exit(EXIT_FAILURE);
+   }
+   }
+
/* Create packet pool */
memset(¶ms, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
@@ -704,12 +713,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
 
if (args->appl.mode == APPL_MODE_PING) {
-   odp_cpumask_t cpu0_mask;
+   odp_cpumask_t cpu_mask;
odp_queue_t tq;
+   int cpu_first, cpu_next;
 
-   /* Previous code forced both threads to CPU 0 */
-   odp_cpumask_zero(&cpu0_mask);
-   odp_cpumask_set(&cpu0_mask, 0);
+   odp_cpumask_zero(&cpu_mask);
+   cpu_first = odp_cpumask_first(&cpumask);
+   odp_cpumask_set(&cpu_mask, cpu_first);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
@@ -725,7 +735,7 @@ int main(int argc, char *argv[])
if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[1].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
+   odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
  gen_recv_thread, &args->thread[1]);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
@@ -742,7 +752,10 @@ int main(int argc, char *argv[])
if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[0].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
+   cpu_next = odp_cpumask_next(&cpumask, cpu_first);
+   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]);
 
/* only wait send thread to join */
@@ -824,11 +837,12 @@ static void parse_args(int argc, char *argv[], 
appl_args_t *appl_args)
static struct option longopts[] = {
{"interface", required_argument, NULL, 'I'},
{"workers", required_argument, NULL, 'w'},
+   {"cpumask", required_argument, NULL, 'c'},
{"srcmac", required_argument, NULL, 'a'},
{"dstmac", required_argument, NULL, 'b'},
-   {"srcip", required_argument, NULL, 'c'},
+   {"srcip", required_argument, NULL, 's'},
{"dstip", required_argument, NULL, 'd'},
-   {"packetsize", required_argument, NULL, 's'},
+   {"packetsize", required_argument, NULL, 'p'},
{"mode", required_argument, NULL, 'm'},
{"count", required_argument, NULL, 'n'},
{"timeout", required_argument, NULL, 't'},
@@ -843,8 +857,8 @@ static void parse_args(int argc, char *argv[], appl_args_t 
*appl_args)
appl_args->timeout = -1;
 
w

Re: [lng-odp] [PATCHv7] example:generator:option to supply core mask

2015-08-19 Thread Krishna Garapati
Fixed all the comments in PATCHv8.

On 19 August 2015 at 11:49, Stuart Haslam  wrote:

> On Wed, Aug 12, 2015 at 10:55:12AM +0200, Balakrishna.Garapati wrote:
> > Signed-off-by: Balakrishna.Garapati 
> > ---
> >  validate cpumask from parse_args and exit with a message
> >
> >  example/generator/odp_generator.c | 72
> ---
> >  1 file changed, 52 insertions(+), 20 deletions(-)
> >
> > diff --git a/example/generator/odp_generator.c
> b/example/generator/odp_generator.c
> > index bdee222..2ad4e27 100644
> > --- a/example/generator/odp_generator.c
> > +++ b/example/generator/odp_generator.c
> > @@ -43,6 +43,7 @@
> >   */
> >  typedef struct {
> >   int cpu_count;  /**< system CPU count */
> > + const char *mask;   /**< s/core mask/CPU mask */
>
> In my previous comment I was asking to replace the text "core mask" with
> "CPU mask".
>

Fixed the comment in PATCHv8

>
> >   int if_count;   /**< Number of interfaces to be used */
> >   char **if_names;/**< Array of pointers to interface names
> */
> >   char *if_str;   /**< Storage for interface names */
> > @@ -645,18 +646,26 @@ int main(int argc, char *argv[])
> >   if (args->appl.cpu_count)
> >   num_workers = args->appl.cpu_count;
> >
> > - /* ping mode need two worker */
> > - if (args->appl.mode == APPL_MODE_PING)
> > - num_workers = 2;
> > -
> > - /* Get default worker cpumask */
> >   num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
> > + if (args->appl.mask) {
> > + odp_cpumask_from_str(&cpumask, args->appl.mask);
> > + num_workers = odp_cpumask_count(&cpumask);
> > + }
> > +
> >   (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
> >
> >   printf("num worker threads: %i\n", num_workers);
> >   printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
> >   printf("cpu mask:   %s\n", cpumaskstr);
> >
> > + /* ping mode need two workers */
> > + if (args->appl.mode == APPL_MODE_PING) {
> > + if (num_workers < 2) {
> > + EXAMPLE_ERR("Need at least two worker threads\n");
> > + exit(EXIT_FAILURE);
> > + }
> > + }
> > +
> >   /* Create packet pool */
> >   memset(¶ms, 0, sizeof(params));
> >   params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
> > @@ -704,12 +713,13 @@ int main(int argc, char *argv[])
> >   memset(thread_tbl, 0, sizeof(thread_tbl));
> >
> >   if (args->appl.mode == APPL_MODE_PING) {
> > - odp_cpumask_t cpu0_mask;
> > + odp_cpumask_t cpu_mask;
> >   odp_queue_t tq;
> > + int cpu_first, cpu_next;
> >
> > - /* Previous code forced both threads to CPU 0 */
> > - odp_cpumask_zero(&cpu0_mask);
> > - odp_cpumask_set(&cpu0_mask, 0);
> > + odp_cpumask_zero(&cpu_mask);
> > + cpu_first = odp_cpumask_first(&cpumask);
> > + odp_cpumask_set(&cpu_mask, cpu_first);
> >
> >   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
> >   if (tq == ODP_QUEUE_INVALID)
> > @@ -725,7 +735,7 @@ int main(int argc, char *argv[])
> >   if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
> >   abort();
> >   args->thread[1].mode = args->appl.mode;
> > - odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
> > + odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
> > gen_recv_thread,
> &args->thread[1]);
> >
> >   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
> > @@ -742,7 +752,10 @@ int main(int argc, char *argv[])
> >   if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
> >   abort();
> >   args->thread[0].mode = args->appl.mode;
> > - odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
> > + cpu_next = odp_cpumask_next(&cpumask, cpu_first);
> > + 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]);
> >
> >   /* only wait send thread to join */
> > @@ -824,11 +837,12 @@ static void parse_args(int argc, char *argv[],
> appl_args_t *appl_args)
> >   static struct option longopts[] = {
> >   {"interface", required_argument, NULL, 'I'},
> >   {"workers", required_argument, NULL, 'w'},
> > + {"cpumask", required_argument, NULL, 'c'},
> >   {"srcmac", required_argument, NULL, 'a'},
> >   {"dstmac", required_argument, NULL, 'b'},
> > - {"srcip", required_argument, NULL, 'c'},
> > + {"srcip", required_argument, NULL, 's'},
> >   

Re: [lng-odp] [API-NEXT PATCH v2 3/4] linux-generic: use appropriate time API with tick instead of cycles

2015-08-19 Thread Ivan Khoronzhuk

Hi, Stuart

On 19.08.15 12:50, Stuart Haslam wrote:

On Sat, Aug 08, 2015 at 01:28:09AM +0300, Ivan Khoronzhuk wrote:

The time API were changed from *_cycles* to *_tick*, so use
appropriate names.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/arch/linux/odp_time.c  | 2 +-
  platform/linux-generic/arch/mips64/odp_time.c | 2 +-
  platform/linux-generic/arch/x86/odp_time.c| 2 +-
  platform/linux-generic/odp_schedule.c | 8 
  platform/linux-generic/odp_time.c | 6 +++---
  5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/platform/linux-generic/arch/linux/odp_time.c 
b/platform/linux-generic/arch/linux/odp_time.c
index 4dc0764..bd16a32 100644
--- a/platform/linux-generic/arch/linux/odp_time.c
+++ b/platform/linux-generic/arch/linux/odp_time.c
@@ -16,7 +16,7 @@

  #define GIGA 10

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
struct timespec time;
uint64_t sec, ns, hz, cycles;


cycles -> tick



I have leaved cycles here intentionally, as in this
implementation exactly CPU cycles inside of function.
If you don't agree with this, let me know and I will change it.


diff --git a/platform/linux-generic/arch/mips64/odp_time.c 
b/platform/linux-generic/arch/mips64/odp_time.c
index 4fb790b..2a68aa5 100644
--- a/platform/linux-generic/arch/mips64/odp_time.c
+++ b/platform/linux-generic/arch/mips64/odp_time.c
@@ -8,7 +8,7 @@
  #include 
  #include 

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
#define CVMX_TMP_STR2(x) #x
diff --git a/platform/linux-generic/arch/x86/odp_time.c 
b/platform/linux-generic/arch/x86/odp_time.c
index a111561..a4f60e1 100644
--- a/platform/linux-generic/arch/x86/odp_time.c
+++ b/platform/linux-generic/arch/x86/odp_time.c
@@ -5,7 +5,7 @@
   */
  #include 

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
union {
uint64_t tsc_64;
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 5d32c81..d0cd41e 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -528,12 +528,12 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
break;

if (start_cycle == 0) {
-   start_cycle = odp_time_cycles();
+   start_cycle = odp_time_tick();
continue;
}

-   cycle = odp_time_cycles();
-   diff  = odp_time_diff_cycles(start_cycle, cycle);
+   cycle = odp_time_tick();
+   diff  = odp_time_ticks_diff(start_cycle, cycle);

if (wait < diff)
break;
@@ -579,7 +579,7 @@ uint64_t odp_schedule_wait_time(uint64_t ns)
if (ns <= ODP_SCHED_NO_WAIT)
ns = ODP_SCHED_NO_WAIT + 1;

-   return odp_time_ns_to_cycles(ns);
+   return odp_time_ns_to_tick(ns);
  }


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

  #define GIGA 10

-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
+uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2)
  {
if (odp_likely(t2 > t1))
return t2 - t1;
@@ -20,7 +20,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
return t2 + (UINT64_MAX - t1);
  }

-uint64_t odp_time_cycles_to_ns(uint64_t cycles)
+uint64_t odp_time_tick_to_ns(uint64_t cycles)


parameter name; cycles -> tick



same here. It was not changed intentionally


  {
uint64_t hz = odp_sys_cpu_hz();

@@ -31,7 +31,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
  }


-uint64_t odp_time_ns_to_cycles(uint64_t ns)
+uint64_t odp_time_ns_to_tick(uint64_t ns)
  {
uint64_t hz = odp_sys_cpu_hz();

--
1.9.1





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


[lng-odp] [PATCHv9] example:generator:option to supply core mask

2015-08-19 Thread Balakrishna.Garapati
Signed-off-by: Balakrishna.Garapati 
---
 v8: Ignore this patch as the chnages were not included by mistake.
 v9: moved optional args from MANDATORY to OPTIONAL options
 fixed the comment section "core mask" to "CPU maski".
 example/generator/odp_generator.c | 80 +++
 1 file changed, 55 insertions(+), 25 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index bdee222..f398aaf 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -43,6 +43,7 @@
  */
 typedef struct {
int cpu_count;  /**< system CPU count */
+   const char *mask;   /**< CPU mask */
int if_count;   /**< Number of interfaces to be used */
char **if_names;/**< Array of pointers to interface names */
char *if_str;   /**< Storage for interface names */
@@ -645,18 +646,26 @@ int main(int argc, char *argv[])
if (args->appl.cpu_count)
num_workers = args->appl.cpu_count;
 
-   /* ping mode need two worker */
-   if (args->appl.mode == APPL_MODE_PING)
-   num_workers = 2;
-
-   /* Get default worker cpumask */
num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
+   if (args->appl.mask) {
+   odp_cpumask_from_str(&cpumask, args->appl.mask);
+   num_workers = odp_cpumask_count(&cpumask);
+   }
+
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
 
printf("num worker threads: %i\n", num_workers);
printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
printf("cpu mask:   %s\n", cpumaskstr);
 
+   /* ping mode need two workers */
+   if (args->appl.mode == APPL_MODE_PING) {
+   if (num_workers < 2) {
+   EXAMPLE_ERR("Need at least two worker threads\n");
+   exit(EXIT_FAILURE);
+   }
+   }
+
/* Create packet pool */
memset(¶ms, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
@@ -704,12 +713,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
 
if (args->appl.mode == APPL_MODE_PING) {
-   odp_cpumask_t cpu0_mask;
+   odp_cpumask_t cpu_mask;
odp_queue_t tq;
+   int cpu_first, cpu_next;
 
-   /* Previous code forced both threads to CPU 0 */
-   odp_cpumask_zero(&cpu0_mask);
-   odp_cpumask_set(&cpu0_mask, 0);
+   odp_cpumask_zero(&cpu_mask);
+   cpu_first = odp_cpumask_first(&cpumask);
+   odp_cpumask_set(&cpu_mask, cpu_first);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
if (tq == ODP_QUEUE_INVALID)
@@ -725,7 +735,7 @@ int main(int argc, char *argv[])
if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[1].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
+   odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
  gen_recv_thread, &args->thread[1]);
 
tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
@@ -742,7 +752,10 @@ int main(int argc, char *argv[])
if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[0].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
+   cpu_next = odp_cpumask_next(&cpumask, cpu_first);
+   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]);
 
/* only wait send thread to join */
@@ -820,15 +833,17 @@ static void parse_args(int argc, char *argv[], 
appl_args_t *appl_args)
int long_index;
char *token;
size_t len;
-   int i;
+   odp_cpumask_t cpumask, cpumask_args, cpumask_and;
+   int i, num_workers;
static struct option longopts[] = {
{"interface", required_argument, NULL, 'I'},
{"workers", required_argument, NULL, 'w'},
+   {"cpumask", required_argument, NULL, 'c'},
{"srcmac", required_argument, NULL, 'a'},
{"dstmac", required_argument, NULL, 'b'},
-   {"srcip", required_argument, NULL, 'c'},
+   {"srcip", required_argument, NULL, 's'},
{"dstip", required_argument, NULL, 'd'},
-   {"packetsize", required_argument, NULL, 's'},
+   {"packetsize", required_argument, NULL, 'p'},
{"mode", required_argument, NULL, 'm'},
{"count", requ

Re: [lng-odp] [API-NEXT PATCH] api: reclock: added recursive lock

2015-08-19 Thread Savolainen, Petri (Nokia - FI/Espoo)
Hi,

As stated in the patch log entry, the main use case for recursive lock is 
porting legacy code on top of ODP. It’s not feasible to modify large legacy 
projects to not use recursive locking when it’s widely used and expected by the 
programming model.

For example, FreeBSD uses recursive mutexes and read-write locks. The link 
under high lights recursive lock creations in user space FreeBSD TCP/IP stack 
project.

https://github.com/pkelsey/libuinet/search?utf8=%E2%9C%93&q=recurse
Also, DPDK provides recursive spinlock (but not rwlock).

With another look into this, it would be better to define recursive versions of 
these two lock types:

odp_spinlock_rec_xxx()
odp_rwlock_rec_xxx()

These could be implemented also as helpers, but proper API would allow HW 
specific optimization of these fast path APIs.

-Petri



From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of ext Bill 
Fischofer
Sent: Sunday, July 05, 2015 11:56 PM
To: Maxim Uvarov
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] api: reclock: added recursive lock

An application that needed this functionality for legacy use could construct 
these semantics on top of the ODP locking primitives.  The only reason to have 
it be an ODP API would be if the primitive itself were in common use across 
multiple platforms that could implement it differently.

Needs further discussion, but seems a low-priority item for now.

On Fri, Jul 3, 2015 at 10:23 AM, Maxim Uvarov 
mailto:maxim.uva...@linaro.org>> wrote:


On 3 July 2015 at 18:19, Ivan Khoronzhuk 
mailto:ivan.khoronz...@linaro.org>> wrote:
Maxim,

On 03.07.15 18:13, Maxim Uvarov wrote:


On 3 July 2015 at 17:59, Ivan Khoronzhuk 
mailto:ivan.khoronz...@linaro.org>
>> wrote:

Maxim,
I've never used such kind of lock.
They are not used in LK for a lot of reasons.
It's not the same as rwlocks, it's intended for other purposes -
to avoid deadlocks ) by hiding bad design.

If app calls twice spinlock_lock() (in subroutine once again
for instance) it will deadlock... forever...
But in case with reclock, it will continue to work.
I suppose some apps use this feature  :)..

The main drawback that it hides unintentional recursive locks.
The reclock can be absolutely avoided by better design, on my opinion.


Yes, I also as many of others here,  worked with kernel before. I even
looked to fresh sources
if there is something changed. But that kind of locks are not there and even
there were number of reasons to not accept it. My question was to Petri
to clarify use case
for that. Maybe we can propose better approach than that.

btw, I also never used recursive mutex, only locked one. :)

Maxim.

I suppose there is no any reason except support of legacy apps.
That's why I proposed to disable it`s usage for new apps somehow.

that is api-next. I.e. that api is under discussion to accept it or not. Ivan, 
I agree
with you that we need to avoid it's usage.

Maxim.



On 03.07.15 17:44, Maxim Uvarov wrote:

On 07/03/15 17:00, Ivan Khoronzhuk wrote:

Maxim,

mutex and spinlock is not the same ...


yes, I know.

What is the use case of that locks? Defend some data between control
thread and worker thread?  I.e. odp worker holds write lock and
updates
something. While control thread needs do periodical read and
needs to
hold read lock? Is that something like linux rwlocks?

Hide spinlocks like that will be vary hard to debug in future.

Maxim.


On 03.07.15 16:54, Maxim Uvarov wrote:

Petri, looks like you invented mutex (mtx_recursive) :


https://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.basetrf1/mtx_destroy.htm



Thanks,
Maxim.


On 07/03/15 16:25, Petri Savolainen wrote:

Applications can use recursive locks to avoid
deadlock from single
thread acquiring the same lock multiple times.
Recursive locks
are commonly used by legacy applications.

Signed-off-by: Petri Savolainen

mailto:petri.savolai...@nokia.com>

>>

---
   include/odp.h
   |  1 +
   include/odp/api/reclock.h
   | 82
++
   platform/linux-generic/Makefile.am
  |  4 ++

.../linux-generic/include/odp/plat/reclock_types.h |
46 
   platform/linux-generic/include/odp/reclock.h
  | 28 
 

Re: [lng-odp] [API-NEXT PATCH v2 3/4] linux-generic: use appropriate time API with tick instead of cycles

2015-08-19 Thread Stuart Haslam
On Wed, Aug 19, 2015 at 02:06:34PM +0300, Ivan Khoronzhuk wrote:
> Hi, Stuart
> 
> On 19.08.15 12:50, Stuart Haslam wrote:
> >On Sat, Aug 08, 2015 at 01:28:09AM +0300, Ivan Khoronzhuk wrote:
> >>The time API were changed from *_cycles* to *_tick*, so use
> >>appropriate names.
> >>
> >>Signed-off-by: Ivan Khoronzhuk 
> >>---
> >>  platform/linux-generic/arch/linux/odp_time.c  | 2 +-
> >>  platform/linux-generic/arch/mips64/odp_time.c | 2 +-
> >>  platform/linux-generic/arch/x86/odp_time.c| 2 +-
> >>  platform/linux-generic/odp_schedule.c | 8 
> >>  platform/linux-generic/odp_time.c | 6 +++---
> >>  5 files changed, 10 insertions(+), 10 deletions(-)
> >>
> >>diff --git a/platform/linux-generic/arch/linux/odp_time.c 
> >>b/platform/linux-generic/arch/linux/odp_time.c
> >>index 4dc0764..bd16a32 100644
> >>--- a/platform/linux-generic/arch/linux/odp_time.c
> >>+++ b/platform/linux-generic/arch/linux/odp_time.c
> >>@@ -16,7 +16,7 @@
> >>
> >>  #define GIGA 10
> >>
> >>-uint64_t odp_time_cycles(void)
> >>+uint64_t odp_time_tick(void)
> >>  {
> >>struct timespec time;
> >>uint64_t sec, ns, hz, cycles;
> >
> >cycles -> tick
> >
> 
> I have leaved cycles here intentionally, as in this
> implementation exactly CPU cycles inside of function.
> If you don't agree with this, let me know and I will change it.
> 

OK I see, it's still doing some conversion to mimic a clock that runs at
the rate of odp_sys_cpu_hz(). I wonder if that should be removed and
just return "(time.tv_sec * 10) + time.tv_nsec"?

> >>diff --git a/platform/linux-generic/arch/mips64/odp_time.c 
> >>b/platform/linux-generic/arch/mips64/odp_time.c
> >>index 4fb790b..2a68aa5 100644
> >>--- a/platform/linux-generic/arch/mips64/odp_time.c
> >>+++ b/platform/linux-generic/arch/mips64/odp_time.c
> >>@@ -8,7 +8,7 @@
> >>  #include 
> >>  #include 
> >>
> >>-uint64_t odp_time_cycles(void)
> >>+uint64_t odp_time_tick(void)
> >>  {
> >>#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
> >>#define CVMX_TMP_STR2(x) #x
> >>diff --git a/platform/linux-generic/arch/x86/odp_time.c 
> >>b/platform/linux-generic/arch/x86/odp_time.c
> >>index a111561..a4f60e1 100644
> >>--- a/platform/linux-generic/arch/x86/odp_time.c
> >>+++ b/platform/linux-generic/arch/x86/odp_time.c
> >>@@ -5,7 +5,7 @@
> >>   */
> >>  #include 
> >>
> >>-uint64_t odp_time_cycles(void)
> >>+uint64_t odp_time_tick(void)
> >>  {
> >>union {
> >>uint64_t tsc_64;
> >>diff --git a/platform/linux-generic/odp_schedule.c 
> >>b/platform/linux-generic/odp_schedule.c
> >>index 5d32c81..d0cd41e 100644
> >>--- a/platform/linux-generic/odp_schedule.c
> >>+++ b/platform/linux-generic/odp_schedule.c
> >>@@ -528,12 +528,12 @@ static int schedule_loop(odp_queue_t *out_queue, 
> >>uint64_t wait,
> >>break;
> >>
> >>if (start_cycle == 0) {
> >>-   start_cycle = odp_time_cycles();
> >>+   start_cycle = odp_time_tick();
> >>continue;
> >>}
> >>
> >>-   cycle = odp_time_cycles();
> >>-   diff  = odp_time_diff_cycles(start_cycle, cycle);
> >>+   cycle = odp_time_tick();
> >>+   diff  = odp_time_ticks_diff(start_cycle, cycle);
> >>
> >>if (wait < diff)
> >>break;
> >>@@ -579,7 +579,7 @@ uint64_t odp_schedule_wait_time(uint64_t ns)
> >>if (ns <= ODP_SCHED_NO_WAIT)
> >>ns = ODP_SCHED_NO_WAIT + 1;
> >>
> >>-   return odp_time_ns_to_cycles(ns);
> >>+   return odp_time_ns_to_tick(ns);
> >>  }
> >>
> >>
> >>diff --git a/platform/linux-generic/odp_time.c 
> >>b/platform/linux-generic/odp_time.c
> >>index a08833d..aed3702 100644
> >>--- a/platform/linux-generic/odp_time.c
> >>+++ b/platform/linux-generic/odp_time.c
> >>@@ -12,7 +12,7 @@
> >>
> >>  #define GIGA 10
> >>
> >>-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
> >>+uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2)
> >>  {
> >>if (odp_likely(t2 > t1))
> >>return t2 - t1;
> >>@@ -20,7 +20,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
> >>return t2 + (UINT64_MAX - t1);
> >>  }
> >>
> >>-uint64_t odp_time_cycles_to_ns(uint64_t cycles)
> >>+uint64_t odp_time_tick_to_ns(uint64_t cycles)
> >
> >parameter name; cycles -> tick
> >
> 
> same here. It was not changed intentionally
> 
> >>  {
> >>uint64_t hz = odp_sys_cpu_hz();
> >>
> >>@@ -31,7 +31,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
> >>  }
> >>
> >>
> >>-uint64_t odp_time_ns_to_cycles(uint64_t ns)
> >>+uint64_t odp_time_ns_to_tick(uint64_t ns)
> >>  {
> >>uint64_t hz = odp_sys_cpu_hz();
> >>
> >>--
> >>1.9.1
> >>
> >
> 
> -- 
> Regards,
> Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH] api: pktio description of doxygen group

2015-08-19 Thread Mike Holmes
On 19 August 2015 at 06:24, Maxim Uvarov  wrote:
> Signed-off-by: Maxim Uvarov 
> ---
>  include/odp/api/packet_io.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
> index e00d011..8169372 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -19,7 +19,7 @@ extern "C" {
>  #endif
>
>  /** @defgroup odp_packet_io ODP PACKET IO
> - *  Operations on a packet.
> + *  Operations on a packet input/output interface.
>   *  @{
>   */
>
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp

If you are adding detail could we add a paragraph of detailed
description below this brief description ?

Currently all we have is if the following for the detailed description.
"
Detailed Description

Operations on a packet. "

I think it is important that we describe its two modes, it may be used
in polled mode or with the classifier and scheduler in event driven
mode, and then allude broadly to what you can do with this module to
configure an interface.

This is a very rough example of what I think we need.
"
Packet IO is the Ingress and Egress interface to ODP processing. It
allows manipulation of the interface for setting such attributes as
the mtu, mac etc.
Pktio is usually followed by the classifier and a default class COS
can be set so that the scheduler may distribute flows. The interface
may be used directly in polled mode with odp_pktio_recv() &
odp_pktio_send().
Diagnostic massages can be enhanced by using odp_pktio_to_u64 which
will generate a printable reference for a pktio handle for use with
the logging @ref odp_ver_abt_log_dbg
"


-- 
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] api: define pktio statistics api

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 include/odp/api/packet_io_stats.h  | 77 ++
 platform/linux-generic/include/odp/packet_io.h |  1 +
 2 files changed, 78 insertions(+)
 create mode 100644 include/odp/api/packet_io_stats.h

diff --git a/include/odp/api/packet_io_stats.h 
b/include/odp/api/packet_io_stats.h
new file mode 100644
index 000..731a96f
--- /dev/null
+++ b/include/odp/api/packet_io_stats.h
@@ -0,0 +1,77 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Packet IO
+ */
+
+#ifndef ODP_API_PACKET_IO_STATS_H_
+#define ODP_API_PACKET_IO_STATS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup odp_packet_io ODP PACKET IO
+ *  @{
+ */
+
+/**
+ * Packet IO statistics
+ *
+ */
+typedef struct odp_pktio_stats_t {
+   uint64_t collisions;  /**< number of collisions */
+   uint64_t multicast;   /**< multicast packets received */
+
+   uint64_t rx_bytes;/**< total bytes received */
+   uint64_t rx_crc_errors;   /**< received packets with crc error */
+   uint64_t rx_dropped;  /**< no space in buffers */
+   uint64_t rx_errors;   /**< bad packets received */
+   uint64_t rx_fifo_errors;  /**< recv'r fifo overrun */
+   uint64_t rx_frame_errors; /**< recv'd frame alignment error */
+   uint64_t rx_length_errors;/**< bad packets length */
+   uint64_t rx_missed_errors;/**< receiver missed packet */
+   uint64_t rx_over_errors;  /**< receiver ring buff overflow */
+   uint64_t rx_packets;  /**< total packets received   */
+
+   uint64_t tx_aborted_errors;   /**< packets aborted during
+ transmission by a network device (e.g:
+ because of a medium collision) */
+   uint64_t tx_bytes;/**< total bytes transmitted */
+   uint64_t tx_carrier_errors;   /**< not transmitted packets because of
+   carrier errors (e.g: physical link down) */
+   uint64_t tx_dropped;  /**< no resources to transmit packet*/
+   uint64_t tx_errors;   /**< packets transmit problems */
+   uint64_t tx_fifo_errors;  /**< packets transmit FIFO errors */
+   uint64_t tx_heartbeat_errors; /**< packets transmitted that have been
+ reported as heartbeat errors */
+   uint64_t tx_packets;  /**< total packets transmitted */
+   uint64_t tx_window_errors;/**< number of packets not successfully
+ transmitted due to a window collision.*/
+} odp_pktio_stats_t;
+
+/**
+ * Get statistics for pktio handle
+ *
+ * @param  pktioPacket IO handle
+ * @param[out] *stats   Output buffer
+ * @retval  0 on success
+ * @retval <0 on failure
+ */
+int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/packet_io.h 
b/platform/linux-generic/include/odp/packet_io.h
index 1d690f5..18f8e78 100644
--- a/platform/linux-generic/include/odp/packet_io.h
+++ b/platform/linux-generic/include/odp/packet_io.h
@@ -33,6 +33,7 @@ extern "C" {
  */
 
 #include 
+#include 
 
 #ifdef __cplusplus
 }
-- 
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 v2 3/4] linux-generic: use appropriate time API with tick instead of cycles

2015-08-19 Thread Ivan Khoronzhuk



On 19.08.15 14:26, Stuart Haslam wrote:

On Wed, Aug 19, 2015 at 02:06:34PM +0300, Ivan Khoronzhuk wrote:

Hi, Stuart

On 19.08.15 12:50, Stuart Haslam wrote:

On Sat, Aug 08, 2015 at 01:28:09AM +0300, Ivan Khoronzhuk wrote:

The time API were changed from *_cycles* to *_tick*, so use
appropriate names.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/arch/linux/odp_time.c  | 2 +-
  platform/linux-generic/arch/mips64/odp_time.c | 2 +-
  platform/linux-generic/arch/x86/odp_time.c| 2 +-
  platform/linux-generic/odp_schedule.c | 8 
  platform/linux-generic/odp_time.c | 6 +++---
  5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/platform/linux-generic/arch/linux/odp_time.c 
b/platform/linux-generic/arch/linux/odp_time.c
index 4dc0764..bd16a32 100644
--- a/platform/linux-generic/arch/linux/odp_time.c
+++ b/platform/linux-generic/arch/linux/odp_time.c
@@ -16,7 +16,7 @@

  #define GIGA 10

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
struct timespec time;
uint64_t sec, ns, hz, cycles;


cycles -> tick



I have leaved cycles here intentionally, as in this
implementation exactly CPU cycles inside of function.
If you don't agree with this, let me know and I will change it.



OK I see, it's still doing some conversion to mimic a clock that runs at
the rate of odp_sys_cpu_hz(). I wonder if that should be removed and
just return "(time.tv_sec * 10) + time.tv_nsec"?


Nor sure.
Current variant is more clear in what's going on.
If it should be changed it can be done outside of this series.




diff --git a/platform/linux-generic/arch/mips64/odp_time.c 
b/platform/linux-generic/arch/mips64/odp_time.c
index 4fb790b..2a68aa5 100644
--- a/platform/linux-generic/arch/mips64/odp_time.c
+++ b/platform/linux-generic/arch/mips64/odp_time.c
@@ -8,7 +8,7 @@
  #include 
  #include 

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
#define CVMX_TMP_STR(x) CVMX_TMP_STR2(x)
#define CVMX_TMP_STR2(x) #x
diff --git a/platform/linux-generic/arch/x86/odp_time.c 
b/platform/linux-generic/arch/x86/odp_time.c
index a111561..a4f60e1 100644
--- a/platform/linux-generic/arch/x86/odp_time.c
+++ b/platform/linux-generic/arch/x86/odp_time.c
@@ -5,7 +5,7 @@
   */
  #include 

-uint64_t odp_time_cycles(void)
+uint64_t odp_time_tick(void)
  {
union {
uint64_t tsc_64;
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 5d32c81..d0cd41e 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -528,12 +528,12 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t 
wait,
break;

if (start_cycle == 0) {
-   start_cycle = odp_time_cycles();
+   start_cycle = odp_time_tick();
continue;
}

-   cycle = odp_time_cycles();
-   diff  = odp_time_diff_cycles(start_cycle, cycle);
+   cycle = odp_time_tick();
+   diff  = odp_time_ticks_diff(start_cycle, cycle);

if (wait < diff)
break;
@@ -579,7 +579,7 @@ uint64_t odp_schedule_wait_time(uint64_t ns)
if (ns <= ODP_SCHED_NO_WAIT)
ns = ODP_SCHED_NO_WAIT + 1;

-   return odp_time_ns_to_cycles(ns);
+   return odp_time_ns_to_tick(ns);
  }


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

  #define GIGA 10

-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
+uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2)
  {
if (odp_likely(t2 > t1))
return t2 - t1;
@@ -20,7 +20,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
return t2 + (UINT64_MAX - t1);
  }

-uint64_t odp_time_cycles_to_ns(uint64_t cycles)
+uint64_t odp_time_tick_to_ns(uint64_t cycles)


parameter name; cycles -> tick



same here. It was not changed intentionally


  {
uint64_t hz = odp_sys_cpu_hz();

@@ -31,7 +31,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles)
  }


-uint64_t odp_time_ns_to_cycles(uint64_t ns)
+uint64_t odp_time_ns_to_tick(uint64_t ns)
  {
uint64_t hz = odp_sys_cpu_hz();

--
1.9.1





--
Regards,
Ivan Khoronzhuk


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


Re: [lng-odp] [PATCHv9] example:generator:option to supply core mask

2015-08-19 Thread Stuart Haslam
On Wed, Aug 19, 2015 at 01:12:44PM +0200, Balakrishna.Garapati wrote:
> Signed-off-by: Balakrishna.Garapati 

Reviewed-by: Stuart Haslam 

(needed a 3way merge to apply)

> ---
>  v8: Ignore this patch as the chnages were not included by mistake.
>  v9: moved optional args from MANDATORY to OPTIONAL options
>  fixed the comment section "core mask" to "CPU maski".
>  example/generator/odp_generator.c | 80 
> +++
>  1 file changed, 55 insertions(+), 25 deletions(-)
> 
> diff --git a/example/generator/odp_generator.c 
> b/example/generator/odp_generator.c
> index bdee222..f398aaf 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -43,6 +43,7 @@
>   */
>  typedef struct {
>   int cpu_count;  /**< system CPU count */
> + const char *mask;   /**< CPU mask */
>   int if_count;   /**< Number of interfaces to be used */
>   char **if_names;/**< Array of pointers to interface names */
>   char *if_str;   /**< Storage for interface names */
> @@ -645,18 +646,26 @@ int main(int argc, char *argv[])
>   if (args->appl.cpu_count)
>   num_workers = args->appl.cpu_count;
>  
> - /* ping mode need two worker */
> - if (args->appl.mode == APPL_MODE_PING)
> - num_workers = 2;
> -
> - /* Get default worker cpumask */
>   num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
> + if (args->appl.mask) {
> + odp_cpumask_from_str(&cpumask, args->appl.mask);
> + num_workers = odp_cpumask_count(&cpumask);
> + }
> +
>   (void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
>  
>   printf("num worker threads: %i\n", num_workers);
>   printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
>   printf("cpu mask:   %s\n", cpumaskstr);
>  
> + /* ping mode need two workers */
> + if (args->appl.mode == APPL_MODE_PING) {
> + if (num_workers < 2) {
> + EXAMPLE_ERR("Need at least two worker threads\n");
> + exit(EXIT_FAILURE);
> + }
> + }
> +
>   /* Create packet pool */
>   memset(¶ms, 0, sizeof(params));
>   params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
> @@ -704,12 +713,13 @@ int main(int argc, char *argv[])
>   memset(thread_tbl, 0, sizeof(thread_tbl));
>  
>   if (args->appl.mode == APPL_MODE_PING) {
> - odp_cpumask_t cpu0_mask;
> + odp_cpumask_t cpu_mask;
>   odp_queue_t tq;
> + int cpu_first, cpu_next;
>  
> - /* Previous code forced both threads to CPU 0 */
> - odp_cpumask_zero(&cpu0_mask);
> - odp_cpumask_set(&cpu0_mask, 0);
> + odp_cpumask_zero(&cpu_mask);
> + cpu_first = odp_cpumask_first(&cpumask);
> + odp_cpumask_set(&cpu_mask, cpu_first);
>  
>   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
>   if (tq == ODP_QUEUE_INVALID)
> @@ -725,7 +735,7 @@ int main(int argc, char *argv[])
>   if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
>   abort();
>   args->thread[1].mode = args->appl.mode;
> - odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
> + odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
> gen_recv_thread, &args->thread[1]);
>  
>   tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);
> @@ -742,7 +752,10 @@ int main(int argc, char *argv[])
>   if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
>   abort();
>   args->thread[0].mode = args->appl.mode;
> - odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
> + cpu_next = odp_cpumask_next(&cpumask, cpu_first);
> + 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]);
>  
>   /* only wait send thread to join */
> @@ -820,15 +833,17 @@ static void parse_args(int argc, char *argv[], 
> appl_args_t *appl_args)
>   int long_index;
>   char *token;
>   size_t len;
> - int i;
> + odp_cpumask_t cpumask, cpumask_args, cpumask_and;
> + int i, num_workers;
>   static struct option longopts[] = {
>   {"interface", required_argument, NULL, 'I'},
>   {"workers", required_argument, NULL, 'w'},
> + {"cpumask", required_argument, NULL, 'c'},
>   {"srcmac", required_argument, NULL, 'a'},
>   {"dstmac", required_argument, NULL, 'b'},
> - {"srcip", required_argument, NULL, 'c'},
> + {"srcip", required_argument, NULL, 's'},
>   {"dstip", required_argument, NULL, 'd'},
> -  

[lng-odp] [PATCHv3 0/7] implementation of odp_pktio_start and _stop

2015-08-19 Thread Maxim Uvarov
 v3: update test case according to Stuarts review comments.
 v2: return -1 and set odp_errno on send/receive on stopped pktio. Adjust test
 accordingly.

--
odp_pktio_start() and odp_pktio_stop() API function uses to control pktio
inside worker or to start/stop pktio from control thread.

Patch set includes:
- linux-generic implementation
- validation test suite
- fixes to all apps uses odp_pktio_open(). For now I left current logic
if it will be needed in future we can move odp_pktio_start() to worker
thread.

Best regards,
Maxim.

Maxim Uvarov (7):
  linux-generic: add pktio_start and pktio_stop
  linux-generic: schedule pktin_poll: account pktio stop state
  linux-generic: loop: implement pktio_start and pktio_stop
  linux-generic: socket mmap: implement pktio_start and pktio_stop
  linux-generic: socket: implement pktio_start and pktio_stop
  validation: test odp_pktio_start and odp_pktio_stop
  linux-generic: default state for pktio is STOP

 example/classifier/odp_classifier.c|   1 +
 example/generator/odp_generator.c  |   2 +-
 example/ipsec/odp_ipsec.c  |   1 +
 example/packet/odp_pktio.c |   1 +
 .../linux-generic/include/odp_packet_io_internal.h |   6 ++
 platform/linux-generic/odp_packet_io.c |  37 +++
 platform/linux-generic/pktio/loop.c|  27 +
 platform/linux-generic/pktio/socket.c  |  37 +++
 platform/linux-generic/pktio/socket_mmap.c |  27 +
 test/performance/odp_l2fwd.c   |   1 +
 test/performance/odp_pktio_perf.c  |   2 +-
 .../classification/odp_classification_tests.c  |   1 +
 test/validation/pktio/pktio.c  | 120 +
 13 files changed, 261 insertions(+), 2 deletions(-)

-- 
1.9.1

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


[lng-odp] [PATCHv3 2/7] linux-generic: schedule pktin_poll: account pktio stop state

2015-08-19 Thread Maxim Uvarov
If pktio in state stop return 0, which means no packets was
received but that pktio is good to be sheduled next time.

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/odp_packet_io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 532c264..84485a9 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -610,6 +610,9 @@ int pktin_poll(pktio_entry_t *entry)
if (odp_unlikely(entry->s.inq_default == ODP_QUEUE_INVALID))
return -1;
 
+   if (entry->s.state == STATE_STOP)
+   return 0;
+
num = odp_pktio_recv(entry->s.handle, pkt_tbl, QUEUE_MULTI_MAX);
 
if (num < 0) {
-- 
1.9.1

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


[lng-odp] [PATCHv3 3/7] linux-generic: loop: implement pktio_start and pktio_stop

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/loop.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index 188a9ee..f61ccd5 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -18,6 +18,8 @@
 #include 
 #include 
 
+#include 
+
 /* MTU to be reported for the "loop" interface */
 #define PKTIO_LOOP_MTU 1500
 /* MAC address for the "loop" interface */
@@ -39,6 +41,7 @@ static int loopback_open(odp_pktio_t id, pktio_entry_t 
*pktio_entry,
if (pktio_entry->s.pkt_loop.loopq == ODP_QUEUE_INVALID)
return -1;
 
+   pktio_entry->s.state = STATE_START;
return 0;
 }
 
@@ -54,6 +57,11 @@ static int loopback_recv(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX];
queue_entry_t *qentry;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq);
nbr = queue_deq_multi(qentry, hdr_tbl, len);
 
@@ -72,6 +80,11 @@ static int loopback_send(pktio_entry_t *pktio_entry, 
odp_packet_t pkt_tbl[],
queue_entry_t *qentry;
unsigned i;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
for (i = 0; i < len; ++i)
hdr_tbl[i] = odp_buf_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));
 
@@ -103,11 +116,25 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
return pktio_entry->s.pkt_loop.promisc ? 1 : 0;
 }
 
+static int loopback_start(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_START;
+   return 0;
+}
+
+static int loopback_stop(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_STOP;
+   return 0;
+}
+
 const pktio_if_ops_t loopback_pktio_ops = {
.init = NULL,
.term = NULL,
.open = loopback_open,
.close = loopback_close,
+   .start = loopback_start,
+   .stop = loopback_stop,
.recv = loopback_recv,
.send = loopback_send,
.mtu_get = loopback_mtu_get,
-- 
1.9.1

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


[lng-odp] [PATCHv3 4/7] linux-generic: socket mmap: implement pktio_start and pktio_stop

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/socket_mmap.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 7d42678..2e55672 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -486,6 +486,7 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
goto error;
}
 
+   pktio_entry->s.state = STATE_START;
return 0;
 
 error:
@@ -497,6 +498,12 @@ static int sock_mmap_recv(pktio_entry_t *pktio_entry,
  odp_packet_t pkt_table[], unsigned len)
 {
pkt_sock_mmap_t *const pkt_sock = &pktio_entry->s.pkt_sock_mmap;
+
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
return pkt_mmap_v2_rx(pkt_sock->rx_ring.sock, &pkt_sock->rx_ring,
  pkt_table, len, pkt_sock->pool,
  pkt_sock->if_mac);
@@ -506,6 +513,12 @@ static int sock_mmap_send(pktio_entry_t *pktio_entry,
  odp_packet_t pkt_table[], unsigned len)
 {
pkt_sock_mmap_t *const pkt_sock = &pktio_entry->s.pkt_sock_mmap;
+
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
return pkt_mmap_v2_tx(pkt_sock->tx_ring.sock, &pkt_sock->tx_ring,
  pkt_table, len);
 }
@@ -535,11 +548,25 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
   pktio_entry->s.name);
 }
 
+static int sock_mmap_start(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_START;
+   return 0;
+}
+
+static int sock_mmap_stop(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_STOP;
+   return 0;
+}
+
 const pktio_if_ops_t sock_mmap_pktio_ops = {
.init = NULL,
.term = NULL,
.open = sock_mmap_open,
.close = sock_mmap_close,
+   .start = sock_mmap_start,
+   .stop = sock_mmap_stop,
.recv = sock_mmap_recv,
.send = sock_mmap_send,
.mtu_get = sock_mmap_mtu_get,
-- 
1.9.1

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


[lng-odp] [PATCHv3 6/7] validation: test odp_pktio_start and odp_pktio_stop

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 test/validation/pktio/pktio.c | 119 ++
 1 file changed, 119 insertions(+)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index ebe34fa..d43c25e 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -109,6 +109,9 @@ static uint32_t pktio_pkt_seq(odp_packet_t pkt)
pkt_head_t head;
pkt_tail_t tail;
 
+   if (pkt == ODP_PACKET_INVALID)
+   return -1;
+
off = odp_packet_l4_offset(pkt);
if (off ==  ODP_PACKET_OFFSET_INVALID)
return TEST_SEQ_INVALID;
@@ -626,6 +629,121 @@ void pktio_test_inq(void)
CU_ASSERT(odp_pktio_close(pktio) == 0);
 }
 
+static void pktio_test_start_stop(void)
+{
+   odp_pktio_t pktio[MAX_NUM_IFACES];
+   odp_packet_t pkt;
+   odp_event_t tx_ev[1000];
+   odp_event_t ev;
+   int i, pkts, ret, alloc = 0;
+   odp_queue_t outq;
+
+   for (i = 0; i < num_ifaces; i++) {
+   pktio[i] = create_pktio(iface_name[i], ODP_QUEUE_TYPE_SCHED, 0);
+   CU_ASSERT(pktio[i] != ODP_PKTIO_INVALID);
+   create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
+   }
+
+   for (alloc = 0; alloc < 1000; alloc++) {
+   pkt = odp_packet_alloc(default_pkt_pool, packet_len);
+   if (pkt == ODP_PACKET_INVALID)
+   break;
+   pktio_init_packet(pkt);
+   tx_ev[alloc] = odp_packet_to_event(pkt);
+   }
+
+   outq = odp_pktio_outq_getdef(pktio[0]);
+
+   /* stop and check that we can not transmit*/
+   ret = odp_pktio_stop(pktio[0]);
+   CU_ASSERT(ret == 0);
+   odp_errno_zero();
+   ret = odp_queue_enq_multi(outq, tx_ev, 10);
+   CU_ASSERT(ret == -1);
+
+   /* start first and queue packets */
+   ret = odp_pktio_start(pktio[0]);
+   CU_ASSERT(ret == 0);
+   /* stop second and send packets*/
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stop(pktio[1]);
+   CU_ASSERT(ret == 0);
+   }
+   for (pkts = 0; pkts != alloc; ) {
+   ret = odp_queue_enq_multi(outq, &tx_ev[pkts], alloc - pkts);
+   if (ret < 0) {
+   CU_FAIL("unable to enqueue packet\n");
+   break;
+   }
+   pkts += ret;
+   }
+   /* check that packets did not arrive */
+   for (i = 0, pkts = 0; i < 1000; i++) {
+   ev = odp_schedule(NULL, ODP_TIME_MSEC);
+   if (ev != ODP_EVENT_INVALID) {
+   if (odp_event_type(ev) == ODP_EVENT_PACKET) {
+   if (pktio_pkt_seq(pkt) != TEST_SEQ_INVALID)
+   pkts++;
+   }
+   odp_event_free(ev);
+   }
+   }
+   if (pkts)
+   CU_FAIL("pktio stopped, received unexpected events");
+
+   /* start both, send and get packets */
+   /* 0 already started */
+   if (num_ifaces > 1) {
+   ret = odp_pktio_start(pktio[1]);
+   CU_ASSERT(ret == 0);
+   }
+
+   /* flush packets with magic number in pipes */
+   for (i = 0; i < 1000; i++) {
+   ev = odp_schedule(NULL, ODP_TIME_MSEC);
+   if (ev != ODP_EVENT_INVALID)
+   odp_event_free(ev);
+   }
+
+   /* alloc */
+   for (alloc = 0; alloc < 1000; alloc++) {
+   pkt = odp_packet_alloc(default_pkt_pool, packet_len);
+   if (pkt == ODP_PACKET_INVALID)
+   break;
+   pktio_init_packet(pkt);
+   tx_ev[alloc] = odp_packet_to_event(pkt);
+   }
+
+   /* send */
+   for (pkts = 0; pkts != alloc; ) {
+   ret = odp_queue_enq_multi(outq, &tx_ev[pkts], alloc - pkts);
+   if (ret < 0) {
+   CU_FAIL("unable to enqueue packet\n");
+   break;
+   }
+   pkts += ret;
+   }
+
+   /* get */
+   for (i = 0, pkts = 0; i < 1000; i++) {
+   ev = odp_schedule(NULL, ODP_TIME_MSEC);
+   if (ev != ODP_EVENT_INVALID) {
+   if (odp_event_type(ev) == ODP_EVENT_PACKET) {
+   pkt = odp_packet_from_event(ev);
+   if (pktio_pkt_seq(pkt) != TEST_SEQ_INVALID)
+   pkts++;
+   }
+   odp_event_free(ev);
+   }
+   }
+   CU_ASSERT(pkts == alloc);
+
+   for (i = 0; i < num_ifaces; i++) {
+   destroy_inq(pktio[i]);
+   CU_ASSERT(odp_pktio_close(pktio[i]) == 0);
+   }
+}
+
 static int create_pool(const char *iface, int num)
 {
char pool_name[ODP_POOL_NAME_LEN];
@@ -722,6 +840,7 @@ CU_TestInfo pktio_suite[] = {
{"pktio promisc mode",  pktio_test_pro

[lng-odp] [PATCHv3 5/7] linux-generic: socket: implement pktio_start and pktio_stop

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/socket.c | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 55c3594..7db9747 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -248,6 +248,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const 
char *netdev,
goto error;
}
 
+   pktio_entry->s.state = STATE_START;
return 0;
 
 error:
@@ -296,6 +297,11 @@ static int sock_basic_recv(pktio_entry_t *pktio_entry,
uint8_t *pkt_buf;
int nb_rx = 0;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
/*  recvfrom:
 *  If the address argument is not a null pointer
 *  and the protocol does not provide the source address of
@@ -355,6 +361,11 @@ static int sock_basic_send(pktio_entry_t *pktio_entry,
unsigned nb_tx;
int ret;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
sockfd = pkt_sock->sockfd;
flags = MSG_DONTWAIT;
i = 0;
@@ -400,6 +411,11 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry,
int recv_msgs;
int i;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
if (odp_unlikely(len > ODP_PACKET_SOCKET_MAX_BURST_RX))
return -1;
 
@@ -465,6 +481,11 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry,
unsigned sent_msgs = 0;
unsigned flags;
 
+   if (pktio_entry->s.state == STATE_STOP) {
+   __odp_errno = EPERM;
+   return -1;
+   }
+
if (odp_unlikely(len > ODP_PACKET_SOCKET_MAX_BURST_TX))
return -1;
 
@@ -534,11 +555,25 @@ static int sock_promisc_mode_get(pktio_entry_t 
*pktio_entry)
   pktio_entry->s.name);
 }
 
+static int sock_start(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_START;
+   return 0;
+}
+
+static int sock_stop(pktio_entry_t *pktio_entry)
+{
+   pktio_entry->s.state = STATE_STOP;
+   return 0;
+}
+
 const pktio_if_ops_t sock_basic_pktio_ops = {
.init = NULL,
.term = NULL,
.open = sock_basic_open,
.close = sock_close,
+   .start = sock_start,
+   .stop = sock_stop,
.recv = sock_basic_recv,
.send = sock_basic_send,
.mtu_get = sock_mtu_get,
@@ -552,6 +587,8 @@ const pktio_if_ops_t sock_mmsg_pktio_ops = {
.term = NULL,
.open = sock_mmsg_open,
.close = sock_close,
+   .start = sock_start,
+   .stop = sock_stop,
.recv = sock_mmsg_recv,
.send = sock_mmsg_send,
.mtu_get = sock_mtu_get,
-- 
1.9.1

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


[lng-odp] [PATCHv3 7/7] linux-generic: default state for pktio is STOP

2015-08-19 Thread Maxim Uvarov
After open pktio remains stopped. Inside worker thread (after all
configuration done it should be started.) In that patch I just start
it everywhere to keep original logic and be easy for review. Putting
it inside worker threads will require thread arguments change and
understanding logic of current app. It's better to do further changes
in separate patches per app.

Signed-off-by: Maxim Uvarov 
---
 example/classifier/odp_classifier.c   | 1 +
 example/generator/odp_generator.c | 2 +-
 example/ipsec/odp_ipsec.c | 1 +
 example/packet/odp_pktio.c| 1 +
 platform/linux-generic/pktio/loop.c   | 2 +-
 platform/linux-generic/pktio/socket.c | 2 +-
 platform/linux-generic/pktio/socket_mmap.c| 2 +-
 test/performance/odp_l2fwd.c  | 1 +
 test/performance/odp_pktio_perf.c | 2 +-
 test/validation/classification/odp_classification_tests.c | 1 +
 test/validation/pktio/pktio.c | 1 +
 11 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index ac204af..ffa39f8 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -210,6 +210,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t 
pool)
EXAMPLE_ERR("pktio create failed for %s\n", dev);
exit(EXIT_FAILURE);
}
+   odp_pktio_start(pktio); /* @todo: move to worker thread */
 
odp_queue_param_init(&qparam);
qparam.sched.prio  = ODP_SCHED_PRIO_DEFAULT;
diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index 35a6fa8..3cf99fa 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -333,10 +333,10 @@ static odp_pktio_t create_pktio(const char *dev, 
odp_pool_t pool)
 
/* Open a packet IO instance */
pktio = odp_pktio_open(dev, pool, &pktio_param);
-
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT("Error: pktio create failed for %s\n", dev);
 
+   odp_pktio_start(pktio); /* @todo: move to worker thread */
/*
 * Create and set the default INPUT queue associated with the 'pktio'
 * resource
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index d392925..c1401d7 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -529,6 +529,7 @@ void initialize_intf(char *intf)
EXAMPLE_ERR("Error: pktio create failed for %s\n", intf);
exit(EXIT_FAILURE);
}
+   odp_pktio_start(pktio); /* @todo: move to worker thread */
outq_def = odp_pktio_outq_getdef(pktio);
 
/*
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index f4574a2..66dce07 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -138,6 +138,7 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t 
pool, int mode)
pktio = odp_pktio_open(dev, pool, &pktio_param);
if (pktio == ODP_PKTIO_INVALID)
EXAMPLE_ABORT("Error: pktio create failed for %s\n", dev);
+   odp_pktio_start(pktio); /* @todo: move to worker thread */
 
snprintf(inq_name, sizeof(inq_name), "%" PRIu64 "-pktio_inq_def",
 odp_pktio_to_u64(pktio));
diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index f61ccd5..ef77e34 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -41,7 +41,7 @@ static int loopback_open(odp_pktio_t id, pktio_entry_t 
*pktio_entry,
if (pktio_entry->s.pkt_loop.loopq == ODP_QUEUE_INVALID)
return -1;
 
-   pktio_entry->s.state = STATE_START;
+   pktio_entry->s.state = STATE_STOP;
return 0;
 }
 
diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 7db9747..f1dd39c 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -248,7 +248,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const 
char *netdev,
goto error;
}
 
-   pktio_entry->s.state = STATE_START;
+   pktio_entry->s.state = STATE_STOP;
return 0;
 
 error:
diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 2e55672..3fd2b0f 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -486,7 +486,7 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
goto error;
}
 
-   pktio_entry->s.state = STATE_START;
+   pktio_entry->s.state = STATE_STOP;
return 0;
 
 error:
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 366

[lng-odp] [PATCHv3 1/7] linux-generic: add pktio_start and pktio_stop

2015-08-19 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 .../linux-generic/include/odp_packet_io_internal.h |  6 
 platform/linux-generic/odp_packet_io.c | 34 ++
 2 files changed, 40 insertions(+)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 5ae3718..f56d100 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -50,6 +50,10 @@ struct pktio_entry {
pkt_sock_mmap_t pkt_sock_mmap;  /**< using socket mmap
 *   API for IO */
};
+   enum {
+   STATE_START = 0,
+   STATE_STOP
+   } state;
classifier_t cls;   /**< classifier linked with this pktio*/
char name[IF_NAMESIZE]; /**< name of pktio provided to
   pktio_open() */
@@ -72,6 +76,8 @@ typedef struct pktio_if_ops {
int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry,
const char *devname, odp_pool_t pool);
int (*close)(pktio_entry_t *pktio_entry);
+   int (*start)(pktio_entry_t *pktio_entry);
+   int (*stop)(pktio_entry_t *pktio_entry);
int (*recv)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[],
unsigned len);
int (*send)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[],
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 135e84f..532c264 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -289,6 +289,40 @@ int odp_pktio_close(odp_pktio_t id)
return 0;
 }
 
+int odp_pktio_start(odp_pktio_t id)
+{
+   pktio_entry_t *entry;
+   int res = 0;
+
+   entry = get_pktio_entry(id);
+   if (!entry)
+   return -1;
+
+   lock_entry(entry);
+   if (entry->s.ops->start)
+   res = entry->s.ops->start(entry);
+   unlock_entry(entry);
+
+   return res;
+}
+
+int odp_pktio_stop(odp_pktio_t id)
+{
+   pktio_entry_t *entry;
+   int res = 0;
+
+   entry = get_pktio_entry(id);
+   if (!entry)
+   return -1;
+
+   lock_entry(entry);
+   if (entry->s.ops->stop)
+   res = entry->s.ops->stop(entry);
+   unlock_entry(entry);
+
+   return res;
+}
+
 odp_pktio_t odp_pktio_lookup(const char *dev)
 {
odp_pktio_t id = ODP_PKTIO_INVALID;
-- 
1.9.1

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


Re: [lng-odp] [PATCH 00/13] validation: use macro _CU_TEST_INFO() in all tests

2015-08-19 Thread Stuart Haslam
On Wed, Jul 29, 2015 at 01:09:30PM +0100, Stuart Haslam wrote:
> On Mon, Jul 27, 2015 at 02:43:42PM +0200, Christophe Milard wrote:
> > This is another step in getting the test environment more homogeneous.
> > The usage of this macro guaranties that the test name (string in C_unit)
> > will always match the function name.
> > This is needed as the C_unit strings will be used towards the C_unit API
> > (to skip a test, for instance).
> > 
> > Christophe Milard (13):
> >   validation: factorise _CU_TEST_INFO definition
> >   validation: cpumask: using _CU_TEST_INFO()
> >   validation: crypto: using _CU_TEST_INFO()
> >   validation: errno: using _CU_TEST_INFO()
> >   validation: init: using _CU_TEST_INFO()
> >   validation: pktio: using _CU_TEST_INFO()
> >   validation: queue: using _CU_TEST_INFO()
> >   validation: scheduler: using _CU_TEST_INFO()
> >   validation: shmem: using _CU_TEST_INFO()
> >   validation: synchronizers: using _CU_TEST_INFO()
> >   validation: system: using _CU_TEST_INFO()
> >   validation: time: using _CU_TEST_INFO()
> >   validation: timer: using _CU_TEST_INFO()
> 
> For the series;
> 
> Reviewed-by: Stuart Haslam 
> 

ping - I've just noticed this series never got merged.

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


Re: [lng-odp] [API-NEXT PATCHv2] validation: classification: added additional suite to test individual PMRs

2015-08-19 Thread Bala Manoharan
Hi Ivan,

On 19 August 2015 at 15:02, Ivan Khoronzhuk 
wrote:

> Hi Bala,
>
> just several comments I forgot to mention.
>
> On 19.08.15 08:45, Bala Manoharan wrote:
>
>> Ivan,
>>
>> On 18 August 2015 at 22:39, Ivan Khoronzhuk > > wrote:
>>
>> post test review.
>>
>> I've tested. It works for me. (except UDP/TCP src, as it's not
>> supported).
>> Why you didn't add here others PMR? Are you planing it after?
>> Also there is no some "inter-PMR" tests, like:
>> 1 - create PMR_dudp-CoS1 (port X)
>> 2 - create PMR_dtcp-CoS2 (same port X)
>> 3 - send UDP packet with port X
>> 4 - check if it was received with CoS1
>> 5 - send TCP packet with same port X
>> 6 - check if it was received with CoS2
>>
>> Maybe it's not place for it, but it definitly should be added.
>> It can help to figure out issues when L4 layer cannot differ type of
>> packet.
>> And implementor has to add some inter PMR to dispatch packet by type
>> on L3 level.
>>
>> Yes. I am planning to add more complex Test Cases in a separate suite. So
>> that the user can first test whether the basic functionality is working
>> fine.
>> This current patch contains the basic test suite suite which tests the
>> basic functionality of all the APIs.
>>
>> Some additional comments below.
>>
>> On 12.08.15 11:53, Balasubramanian Manoharan wrote:
>>
>> Additional test suite is added to classification validation suite
>> to test
>> individual PMRs. This suite will test the defined PMRs by
>> configuring
>> pktio separately for every test case.
>>
>> Fixes:
>> https://bugs.linaro.org/show_bug.cgi?id=1542
>> https://bugs.linaro.org/show_bug.cgi?id=1544
>> https://bugs.linaro.org/show_bug.cgi?id=1545
>> https://bugs.linaro.org/show_bug.cgi?id=1546
>>
>> Signed-off-by: Balasubramanian Manoharan <
>> bala.manoha...@linaro.org >
>> ---
>> v2: Incorporates review comments from Ivan and Christophe
>>
>>helper/include/odp/helper/tcp.h|   4 +
>>test/validation/classification/Makefile.am |   2 +
>>test/validation/classification/classification.c|   5 +
>>.../classification/odp_classification_common.c | 225
>> 
>>.../classification/odp_classification_test_pmr.c   | 640
>> +
>>.../classification/odp_classification_tests.c  | 152 +
>>.../classification/odp_classification_testsuites.h |  10 +-
>>7 files changed, 906 insertions(+), 132 deletions(-)
>>create mode 100644
>> test/validation/classification/odp_classification_common.c
>>create mode 100644
>> test/validation/classification/odp_classification_test_pmr.c
>>
>> diff --git a/helper/include/odp/helper/tcp.h
>> b/helper/include/odp/helper/tcp.h
>> index defe422..b52784d 100644
>> --- a/helper/include/odp/helper/tcp.h
>> +++ b/helper/include/odp/helper/tcp.h
>> @@ -26,6 +26,10 @@ extern "C" {
>> *  @{
>> */
>>
>> +/** TCP header length (Minimum Header length without options)*/
>> +/** If options field is added to TCP header then the correct
>> header value
>> +should be updated by the application */
>> +#define ODPH_TCPHDR_LEN 20
>>
>>/** TCP header */
>>typedef struct ODP_PACKED {
>> diff --git a/test/validation/classification/Makefile.am
>> b/test/validation/classification/Makefile.am
>> index ba468fa..050d5e6 100644
>> --- a/test/validation/classification/Makefile.am
>> +++ b/test/validation/classification/Makefile.am
>> @@ -3,6 +3,8 @@ include ../Makefile.inc
>>noinst_LTLIBRARIES = libclassification.la <
>> http://libclassification.la>
>>libclassification_la_SOURCES = odp_classification_basic.c \
>> odp_classification_tests.c \
>> +  odp_classification_test_pmr.c \
>> +  odp_classification_common.c \
>> classification.c
>>
>>bin_PROGRAMS = classification_main$(EXEEXT)
>> diff --git a/test/validation/classification/classification.c
>> b/test/validation/classification/classification.c
>> index 2582aaa..a88a301 100644
>> --- a/test/validation/classification/classification.c
>> +++ b/test/validation/classification/classification.c
>> @@ -18,6 +18,11 @@ static CU_SuiteInfo classification_suites[] = {
>>  .pInitFunc = classification_suite_init,
>>  .pCleanupFunc =
>> classification_suite_term,
>>  },
>> +   { .pName = "classification pmr tests",
>>   

Re: [lng-odp] [PATCHv9] example:generator:option to supply core mask

2015-08-19 Thread Maxim Uvarov

Merged,

Thanks,
Maxim.

On 08/19/15 15:57, Stuart Haslam wrote:

On Wed, Aug 19, 2015 at 01:12:44PM +0200, Balakrishna.Garapati wrote:

Signed-off-by: Balakrishna.Garapati 

Reviewed-by: Stuart Haslam 

(needed a 3way merge to apply)


---
  v8: Ignore this patch as the chnages were not included by mistake.
  v9: moved optional args from MANDATORY to OPTIONAL options
  fixed the comment section "core mask" to "CPU maski".
  example/generator/odp_generator.c | 80 +++
  1 file changed, 55 insertions(+), 25 deletions(-)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index bdee222..f398aaf 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -43,6 +43,7 @@
   */
  typedef struct {
int cpu_count;  /**< system CPU count */
+   const char *mask;   /**< CPU mask */
int if_count;   /**< Number of interfaces to be used */
char **if_names;/**< Array of pointers to interface names */
char *if_str;   /**< Storage for interface names */
@@ -645,18 +646,26 @@ int main(int argc, char *argv[])
if (args->appl.cpu_count)
num_workers = args->appl.cpu_count;
  
-	/* ping mode need two worker */

-   if (args->appl.mode == APPL_MODE_PING)
-   num_workers = 2;
-
-   /* Get default worker cpumask */
num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
+   if (args->appl.mask) {
+   odp_cpumask_from_str(&cpumask, args->appl.mask);
+   num_workers = odp_cpumask_count(&cpumask);
+   }
+
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
  
  	printf("num worker threads: %i\n", num_workers);

printf("first CPU:  %i\n", odp_cpumask_first(&cpumask));
printf("cpu mask:   %s\n", cpumaskstr);
  
+	/* ping mode need two workers */

+   if (args->appl.mode == APPL_MODE_PING) {
+   if (num_workers < 2) {
+   EXAMPLE_ERR("Need at least two worker threads\n");
+   exit(EXIT_FAILURE);
+   }
+   }
+
/* Create packet pool */
memset(¶ms, 0, sizeof(params));
params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
@@ -704,12 +713,13 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
  
  	if (args->appl.mode == APPL_MODE_PING) {

-   odp_cpumask_t cpu0_mask;
+   odp_cpumask_t cpu_mask;
odp_queue_t tq;
+   int cpu_first, cpu_next;
  
-		/* Previous code forced both threads to CPU 0 */

-   odp_cpumask_zero(&cpu0_mask);
-   odp_cpumask_set(&cpu0_mask, 0);
+   odp_cpumask_zero(&cpu_mask);
+   cpu_first = odp_cpumask_first(&cpumask);
+   odp_cpumask_set(&cpu_mask, cpu_first);
  
  		tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);

if (tq == ODP_QUEUE_INVALID)
@@ -725,7 +735,7 @@ int main(int argc, char *argv[])
if (args->thread[1].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[1].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[1], &cpu0_mask,
+   odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
  gen_recv_thread, &args->thread[1]);
  
  		tq = odp_queue_create("", ODP_QUEUE_TYPE_POLL, NULL);

@@ -742,7 +752,10 @@ int main(int argc, char *argv[])
if (args->thread[0].tmo_ev == ODP_TIMEOUT_INVALID)
abort();
args->thread[0].mode = args->appl.mode;
-   odph_linux_pthread_create(&thread_tbl[0], &cpu0_mask,
+   cpu_next = odp_cpumask_next(&cpumask, cpu_first);
+   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]);
  
  		/* only wait send thread to join */

@@ -820,15 +833,17 @@ static void parse_args(int argc, char *argv[], 
appl_args_t *appl_args)
int long_index;
char *token;
size_t len;
-   int i;
+   odp_cpumask_t cpumask, cpumask_args, cpumask_and;
+   int i, num_workers;
static struct option longopts[] = {
{"interface", required_argument, NULL, 'I'},
{"workers", required_argument, NULL, 'w'},
+   {"cpumask", required_argument, NULL, 'c'},
{"srcmac", required_argument, NULL, 'a'},
{"dstmac", required_argument, NULL, 'b'},
-   {"srcip", required_argument, NULL, 'c'},
+   {"srcip", required_argument, NULL, 's'},
{"dstip", required_argument, NULL, 'd'},
-   {"packetsize", required_argument, NULL, '

Re: [lng-odp] [API-NEXT PATCH v2 1/4] api: time: unbind CPU cycles from time API

2015-08-19 Thread Savolainen, Petri (Nokia - FI/Espoo)
Hi,

As I mentioned in the call, I'd like to avoid confusion between time and timer 
(timer tick). In minimum, the API documentation should not refer to "timer". 
Also could term 'tick' be removed altogether and just use 'time'?

Something like this:

uint64_t odp_time(void);
uint64_t odp_time_diff(uint64_t t1, uint64_t t2);
uint64_t odp_time_to_ns(uint64_t time);
uint64_t odp_time_from_ns(uint64_t ns);

-Petri


> diff --git a/include/odp/api/time.h b/include/odp/api/time.h
> index b0072fc..b48dcae 100644
> --- a/include/odp/api/time.h
> +++ b/include/odp/api/time.h
> @@ -30,11 +30,11 @@ extern "C" {
> 
> 
>  /**
> - * Current time in CPU cycles
> + * Current time in ticks of best hi-resolution timer available
>   *
> - * @return Current time in CPU cycles
> + * @return Current time in timer ticks
>   */
> -uint64_t odp_time_cycles(void);
> +uint64_t odp_time_tick(void);
> 
> 
>  /**
> @@ -43,29 +43,29 @@ uint64_t odp_time_cycles(void);
>   * @param t1First time stamp
>   * @param t2Second time stamp
>   *
> - * @return Difference of time stamps in CPU cycles
> + * @return Difference of time stamps in timer ticks
>   */
> -uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2);
> +uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2);
> 
> 
>  /**
> - * Convert CPU cycles to nanoseconds
> + * Convert timer ticks to nanoseconds
>   *
> - * @param cycles  Time in CPU cycles
> + * @param ticks  Time in timer ticks
>   *
>   * @return Time in nanoseconds
>   */
> -uint64_t odp_time_cycles_to_ns(uint64_t cycles);
> +uint64_t odp_time_tick_to_ns(uint64_t ticks);
> 
> 
>  /**
> - * Convert nanoseconds to CPU cycles
> + * Convert nanoseconds to ticks of best hi-resolution timer available
>   *
>   * @param ns  Time in nanoseconds
>   *
> - * @return Time in CPU cycles
> + * @return Time in timer ticks
>   */
> -uint64_t odp_time_ns_to_cycles(uint64_t ns);
> +uint64_t odp_time_ns_to_tick(uint64_t ns);
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH v2 1/4] api: time: unbind CPU cycles from time API

2015-08-19 Thread Ivan Khoronzhuk



On 19.08.15 17:12, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Hi,

As I mentioned in the call, I'd like to avoid confusion between time and timer (timer 
tick). In minimum, the API documentation should not refer to "timer". Also 
could term 'tick' be removed altogether and just use 'time'?

Something like this:

uint64_t odp_time(void);
uint64_t odp_time_diff(uint64_t t1, uint64_t t2);
uint64_t odp_time_to_ns(uint64_t time);
uint64_t odp_time_from_ns(uint64_t ns);

-Petri


Sorry I've unintentionally missed this call.

It's confusing only at first glance. I'm used to this already.
Even don't know, it seems to be reasonable, but any way we
have similar function odp_time_to_ns. And avoiding word tick
makes the functions a little strange, like you take time, by default
it is in ticks, but time is so general word... name odp_time_to_ns
sounds like you convert time to ns, how it can be?

But if it can make life easier I have no objection, I don't know conclusion
about this on the call but if Maxim, Stuart and others are OK with it I
can change it.





diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index b0072fc..b48dcae 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -30,11 +30,11 @@ extern "C" {


  /**
- * Current time in CPU cycles
+ * Current time in ticks of best hi-resolution timer available
   *
- * @return Current time in CPU cycles
+ * @return Current time in timer ticks
   */
-uint64_t odp_time_cycles(void);
+uint64_t odp_time_tick(void);


  /**
@@ -43,29 +43,29 @@ uint64_t odp_time_cycles(void);
   * @param t1First time stamp
   * @param t2Second time stamp
   *
- * @return Difference of time stamps in CPU cycles
+ * @return Difference of time stamps in timer ticks
   */
-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2);
+uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2);


  /**
- * Convert CPU cycles to nanoseconds
+ * Convert timer ticks to nanoseconds
   *
- * @param cycles  Time in CPU cycles
+ * @param ticks  Time in timer ticks
   *
   * @return Time in nanoseconds
   */
-uint64_t odp_time_cycles_to_ns(uint64_t cycles);
+uint64_t odp_time_tick_to_ns(uint64_t ticks);


  /**
- * Convert nanoseconds to CPU cycles
+ * Convert nanoseconds to ticks of best hi-resolution timer available
   *
   * @param ns  Time in nanoseconds
   *
- * @return Time in CPU cycles
+ * @return Time in timer ticks
   */
-uint64_t odp_time_ns_to_cycles(uint64_t ns);
+uint64_t odp_time_ns_to_tick(uint64_t ns);


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


Re: [lng-odp] [API-NEXT PATCH v2 1/4] api: time: unbind CPU cycles from time API

2015-08-19 Thread Ivan Khoronzhuk

+

On 19.08.15 17:49, Ivan Khoronzhuk wrote:



On 19.08.15 17:12, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Hi,

As I mentioned in the call, I'd like to avoid confusion between time and timer (timer 
tick). In minimum, the API documentation should not refer to "timer". Also 
could term 'tick' be removed altogether and just use 'time'?

Something like this:

uint64_t odp_time(void);
uint64_t odp_time_diff(uint64_t t1, uint64_t t2);
uint64_t odp_time_to_ns(uint64_t time);
uint64_t odp_time_from_ns(uint64_t ns);

-Petri


Sorry I've unintentionally missed this call.

It's confusing only at first glance. I'm used to this already.
Even don't know, it seems to be reasonable, but any way we
have similar function odp_time_to_ns. And avoiding word tick
makes the functions a little strange, like you take time, by default
it is in ticks, but time is so general word... name odp_time_to_ns
sounds like you convert time to ns, how it can be?

But if it can make life easier I have no objection, I don't know conclusion
about this on the call but if Maxim, Stuart and others are OK with it I
can change it.



Maybe
odp_tick()
odp_tick_diff()
odp_tick_to_ns()
odp_tick_from_ns()







diff --git a/include/odp/api/time.h b/include/odp/api/time.h
index b0072fc..b48dcae 100644
--- a/include/odp/api/time.h
+++ b/include/odp/api/time.h
@@ -30,11 +30,11 @@ extern "C" {


  /**
- * Current time in CPU cycles
+ * Current time in ticks of best hi-resolution timer available
   *
- * @return Current time in CPU cycles
+ * @return Current time in timer ticks
   */
-uint64_t odp_time_cycles(void);
+uint64_t odp_time_tick(void);


  /**
@@ -43,29 +43,29 @@ uint64_t odp_time_cycles(void);
   * @param t1First time stamp
   * @param t2Second time stamp
   *
- * @return Difference of time stamps in CPU cycles
+ * @return Difference of time stamps in timer ticks
   */
-uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2);
+uint64_t odp_time_ticks_diff(uint64_t t1, uint64_t t2);


  /**
- * Convert CPU cycles to nanoseconds
+ * Convert timer ticks to nanoseconds
   *
- * @param cycles  Time in CPU cycles
+ * @param ticks  Time in timer ticks
   *
   * @return Time in nanoseconds
   */
-uint64_t odp_time_cycles_to_ns(uint64_t cycles);
+uint64_t odp_time_tick_to_ns(uint64_t ticks);


  /**
- * Convert nanoseconds to CPU cycles
+ * Convert nanoseconds to ticks of best hi-resolution timer available
   *
   * @param ns  Time in nanoseconds
   *
- * @return Time in CPU cycles
+ * @return Time in timer ticks
   */
-uint64_t odp_time_ns_to_cycles(uint64_t ns);
+uint64_t odp_time_ns_to_tick(uint64_t ns);




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


Re: [lng-odp] [PATCH 00/13] validation: use macro _CU_TEST_INFO() in all tests

2015-08-19 Thread Maxim Uvarov

Uh..., that needs rebase.

Maxim.


On 08/19/15 16:43, Stuart Haslam wrote:

On Wed, Jul 29, 2015 at 01:09:30PM +0100, Stuart Haslam wrote:

On Mon, Jul 27, 2015 at 02:43:42PM +0200, Christophe Milard wrote:

This is another step in getting the test environment more homogeneous.
The usage of this macro guaranties that the test name (string in C_unit)
will always match the function name.
This is needed as the C_unit strings will be used towards the C_unit API
(to skip a test, for instance).

Christophe Milard (13):
   validation: factorise _CU_TEST_INFO definition
   validation: cpumask: using _CU_TEST_INFO()
   validation: crypto: using _CU_TEST_INFO()
   validation: errno: using _CU_TEST_INFO()
   validation: init: using _CU_TEST_INFO()
   validation: pktio: using _CU_TEST_INFO()
   validation: queue: using _CU_TEST_INFO()
   validation: scheduler: using _CU_TEST_INFO()
   validation: shmem: using _CU_TEST_INFO()
   validation: synchronizers: using _CU_TEST_INFO()
   validation: system: using _CU_TEST_INFO()
   validation: time: using _CU_TEST_INFO()
   validation: timer: using _CU_TEST_INFO()

For the series;

Reviewed-by: Stuart Haslam 


ping - I've just noticed this series never got merged.



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


[lng-odp] [PATCH 1/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Mike Holmes
The odp_format tool is not infallible, in this case it is better to omit
the macro from formatting

Signed-off-by: Mike Holmes 
---
 platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index a7638da..db9defa 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -30,7 +30,7 @@ extern "C" {
 #include 
 #include 
 
-
+/* clang-format off */
 #define ODP_BITSIZE(x) \
((x) <= 2 ?  1 : \
((x) <= 4 ?  2 : \
@@ -49,6 +49,7 @@ extern "C" {
((x) <= 32768 ? 15 : \
((x) <= 65536 ? 16 : \
 (0/0)
+/* clang-format on */
 
 _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
   "ODP Segment size must be a minimum of 256 bytes");
-- 
2.1.4

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


[lng-odp] [PATCH 2/3] add ./clang-format

2015-08-19 Thread Mike Holmes
The odp_format tool uses clang-format and this definition generates
output that matches the odp checkpatch rules

Signed-off-by: Mike Holmes 
---
 .clang-format | 11 +++
 1 file changed, 11 insertions(+)
 create mode 100644 .clang-format

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000..c9fad75
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,11 @@
+BasedOnStyle: LLVM
+IndentWidth: 8
+UseTab: Always
+BreakBeforeBraces: Linux
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: false
+ColumnLimit: 80
+UseTab: Always
+PointerAlignment: Right
+Cpp11BracedListStyle: true
+Standard: Cpp11
-- 
2.1.4

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


[lng-odp] [PATCH 3/3] scripts: add odp_format to match chekpatch style

2015-08-19 Thread Mike Holmes
This odp_format script applies source file formatting to match the ODP
checkpatch style

Signed-off-by: Mike Holmes 
---
 scripts/odp_format | 31 +++
 1 file changed, 31 insertions(+)
 create mode 100755 scripts/odp_format

diff --git a/scripts/odp_format b/scripts/odp_format
new file mode 100755
index 000..192e63d
--- /dev/null
+++ b/scripts/odp_format
@@ -0,0 +1,31 @@
+#!/bin/bash
+# This script is a clean up tool for the ODP project source files.
+# It will replace the src files with versions that are formatted to match the
+# checkpatch rules for ODP.
+
+set -e
+
+CLANG_FORMAT=clang-format-3.6
+
+if ! type $CLANG_FORMAT >/dev/null ; then
+   echo "Require $CLANG_FORMAT"
+   echo "try apt-get install $CLANG_FORMAT"
+   exit
+fi
+
+if [[ $# -eq 0 ]]
+then
+   echo "No source file paths supplied"
+   exit
+fi
+
+#work on specified files
+while (( "$#" )); do
+   echo $1
+   clang-format-3.6 -i -style=file $1
+   #as of version 3.6 a few corner cases slip though so use sed
+   #to fix them bacasue it uses space where checkpatch wants a tab
+   sed -i 's/^/\t/' $1
+   sed -i 's/\\/\\\t/' $1
+  shift
+done
-- 
2.1.4

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


Re: [lng-odp] [PATCH 1/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Bill Fischofer
Is clang-format intended to be used as a convenience or as something that
is a standard part of ODP?  I have no problem with offering it as a
convenience to help submitters in creating clean patches, but what's the
point of having a style guide if code is going to be run through a
formatter?  That would suggest that folks really don't need to pay
attention to style since they can assume that some tools is going to
reformat things anyway.

We want code to be written to the ODP style, not converted into that for
publication from the "real" style used by each author.

On Wed, Aug 19, 2015 at 11:20 AM, Mike Holmes 
wrote:

> The odp_format tool is not infallible, in this case it is better to omit
> the macro from formatting
>
> Signed-off-by: Mike Holmes 
> ---
>  platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> b/platform/linux-generic/include/odp_buffer_internal.h
> index a7638da..db9defa 100644
> --- a/platform/linux-generic/include/odp_buffer_internal.h
> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> @@ -30,7 +30,7 @@ extern "C" {
>  #include 
>  #include 
>
> -
> +/* clang-format off */
>  #define ODP_BITSIZE(x) \
> ((x) <= 2 ?  1 : \
> ((x) <= 4 ?  2 : \
> @@ -49,6 +49,7 @@ extern "C" {
> ((x) <= 32768 ? 15 : \
> ((x) <= 65536 ? 16 : \
>  (0/0)
> +/* clang-format on */
>
>  _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
>"ODP Segment size must be a minimum of 256 bytes");
> --
> 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] validation: packet: test now handles pool that do not support segmentation

2015-08-19 Thread Bill Fischofer
I like this, however some suggested improvements inline:

On Wed, Aug 19, 2015 at 4:10 AM, Nicolas Morey-Chaisemartin <
nmo...@kalray.eu> wrote:

> Signed-off-by: Nicolas Morey-Chaisemartin 
> ---
>  test/validation/packet/packet.c | 40
> ++--
>  1 file changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/test/validation/packet/packet.c
> b/test/validation/packet/packet.c
> index 99a6745..d6dd3eb 100644
> --- a/test/validation/packet/packet.c
> +++ b/test/validation/packet/packet.c
> @@ -21,8 +21,8 @@ static odp_pool_t packet_pool;
>  static const uint32_t packet_len = PACKET_BUF_LEN -
> PACKET_TAILROOM_RESERVE;
>
> -static const uint32_t segmented_packet_len = PACKET_BUF_LEN * 5 -
> -   PACKET_TAILROOM_RESERVE;
> +static uint32_t   segmented_packet_len = ODP_CONFIG_PACKET_BUF_LEN_MAX;
> +static odp_bool_t segmentation_supported = true;
>
>  odp_packet_t test_packet, segmented_test_packet;
>
> @@ -55,11 +55,7 @@ int packet_suite_init(void)
> return -1;
>
> test_packet = odp_packet_alloc(packet_pool, packet_len);
> -   segmented_test_packet = odp_packet_alloc(packet_pool,
> -segmented_packet_len);
> -
> -   if (odp_packet_is_valid(test_packet) == 0 ||
> -   odp_packet_is_valid(segmented_test_packet) == 0)
> +   if (odp_packet_is_valid(test_packet) == 0)
>
Seems we can leave both test_packet and segmented_test_packet given other
suggested changes.

> return -1;
>
> udat = odp_packet_user_area(test_packet);
> @@ -69,6 +65,20 @@ int packet_suite_init(void)
> odp_pool_print(packet_pool);
> memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
>
> +   /* Try to allocate the largest possible packet to see
> +* if segmentation is supported  */
> +   do {
> +   segmented_test_packet = odp_packet_alloc(packet_pool,
> +
> segmented_packet_len);
> +   if (segmented_test_packet == ODP_PACKET_INVALID)
> +   segmented_packet_len -=
> ODP_CONFIG_BUFFER_ALIGN_MIN;
> +   } while (segmented_test_packet == ODP_PACKET_INVALID);
> +
> +   if (odp_packet_is_valid(segmented_test_packet) == 0)
> +   return -1;
> +   if (!odp_packet_is_segmented(segmented_test_packet))
> +   segmentation_supported = false;

+
>

How about just:
segmentation_supported = odp_packet_is_segmented(segmented_test_packet);


> udat = odp_packet_user_area(segmented_test_packet);
> udat_size = odp_packet_user_area_size(segmented_test_packet);
> if (udat == NULL || udat_size != sizeof(struct udata_struct))
> @@ -136,6 +146,8 @@ void packet_test_alloc_segmented(void)
> pkt = odp_packet_alloc(packet_pool, len);
> CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
> CU_ASSERT(odp_packet_len(pkt) == len);
> +   if (segmentation_supported)
> +   CU_ASSERT(odp_packet_is_segmented(pkt) == 1);
>
CU_ASSERT(odp_packet_is_segmented(pkt) ==
segmentation_supported);

> odp_packet_free(pkt);
>  }
>
> @@ -406,7 +418,8 @@ void packet_test_segments(void)
> }
>
> CU_ASSERT(odp_packet_is_segmented(pkt) == 0);
> -   CU_ASSERT(odp_packet_is_segmented(seg_pkt) == 1);
> +   if (segmentation_supported)
> +   CU_ASSERT(odp_packet_is_segmented(seg_pkt) == 1);
>
 CU_ASSERT(odp_packet_is_segmented(seg_pkt) ==
segmentation_supported);

>
> seg = odp_packet_first_seg(pkt);
> buf_len = 0;
> @@ -568,9 +581,16 @@ void packet_test_add_rem_data(void)
>   sizeof(struct udata_struct));
> memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
>
> -   /* Insert one more packet length in the middle of a packet */
> offset = pkt_len / 2;
> -   add_len = pkt_len;
> +
> +   if (segmentation_supported) {
> +   /* Insert one more packet length in the middle of a packet
> */
> +   add_len = pkt_len;
> +   } else {
> +   /* Add diff between largest and smaller packets
> +* which is at least tailroom */
> +   add_len = segmented_packet_len - packet_len;
> +   }
>
> new_pkt = odp_packet_add_data(pkt, offset, add_len);
> CU_ASSERT(new_pkt != ODP_PACKET_INVALID);
> --
> 2.5.0.rc2.3.g9ad628c
>
> ___
> 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/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Mike Holmes
On 19 August 2015 at 13:26, Bill Fischofer  wrote:
> Is clang-format intended to be used as a convenience or as something that is
> a standard part of ODP?

I don’t see it as mandatory, just to help those who find their
favourite editor does not play well with checkpatch rules.
It also fixes 99% of the current mess generated when we moved to the
newer checkpatch automatically, I expect to run it and fix all those
warnings in 1.3 as Nicloas had proposed.

 I have no problem with offering it as a convenience
> to help submitters in creating clean patches, but what's the point of having
> a style guide if code is going to be run through a formatter?
 That would
> suggest that folks really don't need to pay attention to style since they
> can assume that some tools is going to reformat things anyway.
>
> We want code to be written to the ODP style, not converted into that for
> publication from the "real" style used by each author.

By providing this as an option those with editors that are correctly
set to a style that is generating different but still checkpatch
compliant code will be fine.
We don’t need to enforce this single tools view of the code,
checkpatch already enforces the ODP rule.

>
> On Wed, Aug 19, 2015 at 11:20 AM, Mike Holmes 
> wrote:
>>
>> The odp_format tool is not infallible, in this case it is better to omit
>> the macro from formatting
>>
>> Signed-off-by: Mike Holmes 
>> ---
>>  platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
>> b/platform/linux-generic/include/odp_buffer_internal.h
>> index a7638da..db9defa 100644
>> --- a/platform/linux-generic/include/odp_buffer_internal.h
>> +++ b/platform/linux-generic/include/odp_buffer_internal.h
>> @@ -30,7 +30,7 @@ extern "C" {
>>  #include 
>>  #include 
>>
>> -
>> +/* clang-format off */
>>  #define ODP_BITSIZE(x) \
>> ((x) <= 2 ?  1 : \
>> ((x) <= 4 ?  2 : \
>> @@ -49,6 +49,7 @@ extern "C" {
>> ((x) <= 32768 ? 15 : \
>> ((x) <= 65536 ? 16 : \
>>  (0/0)
>> +/* clang-format on */
>>
>>  _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
>>"ODP Segment size must be a minimum of 256 bytes");
>> --
>> 2.1.4
>>
>> ___
>> 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 1/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Bill Fischofer
Ok,  then I don't see any need to "protect" existing code that's already
checkpatch clean.

On Wednesday, August 19, 2015, Mike Holmes  wrote:

> On 19 August 2015 at 13:26, Bill Fischofer  > wrote:
> > Is clang-format intended to be used as a convenience or as something
> that is
> > a standard part of ODP?
>
> I don’t see it as mandatory, just to help those who find their
> favourite editor does not play well with checkpatch rules.
> It also fixes 99% of the current mess generated when we moved to the
> newer checkpatch automatically, I expect to run it and fix all those
> warnings in 1.3 as Nicloas had proposed.
>
>  I have no problem with offering it as a convenience
> > to help submitters in creating clean patches, but what's the point of
> having
> > a style guide if code is going to be run through a formatter?
>  That would
> > suggest that folks really don't need to pay attention to style since they
> > can assume that some tools is going to reformat things anyway.
> >
> > We want code to be written to the ODP style, not converted into that for
> > publication from the "real" style used by each author.
>
> By providing this as an option those with editors that are correctly
> set to a style that is generating different but still checkpatch
> compliant code will be fine.
> We don’t need to enforce this single tools view of the code,
> checkpatch already enforces the ODP rule.
>
> >
> > On Wed, Aug 19, 2015 at 11:20 AM, Mike Holmes  >
> > wrote:
> >>
> >> The odp_format tool is not infallible, in this case it is better to omit
> >> the macro from formatting
> >>
> >> Signed-off-by: Mike Holmes >
> >> ---
> >>  platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> >> b/platform/linux-generic/include/odp_buffer_internal.h
> >> index a7638da..db9defa 100644
> >> --- a/platform/linux-generic/include/odp_buffer_internal.h
> >> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> >> @@ -30,7 +30,7 @@ extern "C" {
> >>  #include 
> >>  #include 
> >>
> >> -
> >> +/* clang-format off */
> >>  #define ODP_BITSIZE(x) \
> >> ((x) <= 2 ?  1 : \
> >> ((x) <= 4 ?  2 : \
> >> @@ -49,6 +49,7 @@ extern "C" {
> >> ((x) <= 32768 ? 15 : \
> >> ((x) <= 65536 ? 16 : \
> >>  (0/0)
> >> +/* clang-format on */
> >>
> >>  _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
> >>"ODP Segment size must be a minimum of 256 bytes");
> >> --
> >> 2.1.4
> >>
> >> ___
> >> 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 1/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Mike Holmes
On 19 August 2015 at 15:09, Bill Fischofer  wrote:
> Ok,  then I don't see any need to "protect" existing code that's already
> checkpatch clean.

It is needed when we run this to clean up the existing problems - seen
here https://ci.linaro.org/job/odp-api-style-check/label=build/534/console
It is the only case in the entire code base where there is a conflict
and the result looks worse although it is complaint and does compile,
by marking it future changes to this file can be run though and will
not cause a problem.

>
>
> On Wednesday, August 19, 2015, Mike Holmes  wrote:
>>
>> On 19 August 2015 at 13:26, Bill Fischofer 
>> wrote:
>> > Is clang-format intended to be used as a convenience or as something
>> > that is
>> > a standard part of ODP?
>>
>> I don’t see it as mandatory, just to help those who find their
>> favourite editor does not play well with checkpatch rules.
>> It also fixes 99% of the current mess generated when we moved to the
>> newer checkpatch automatically, I expect to run it and fix all those
>> warnings in 1.3 as Nicloas had proposed.
>>
>>  I have no problem with offering it as a convenience
>> > to help submitters in creating clean patches, but what's the point of
>> > having
>> > a style guide if code is going to be run through a formatter?
>>  That would
>> > suggest that folks really don't need to pay attention to style since
>> > they
>> > can assume that some tools is going to reformat things anyway.
>> >
>> > We want code to be written to the ODP style, not converted into that for
>> > publication from the "real" style used by each author.
>>
>> By providing this as an option those with editors that are correctly
>> set to a style that is generating different but still checkpatch
>> compliant code will be fine.
>> We don’t need to enforce this single tools view of the code,
>> checkpatch already enforces the ODP rule.
>>
>> >
>> > On Wed, Aug 19, 2015 at 11:20 AM, Mike Holmes 
>> > wrote:
>> >>
>> >> The odp_format tool is not infallible, in this case it is better to
>> >> omit
>> >> the macro from formatting
>> >>
>> >> Signed-off-by: Mike Holmes 
>> >> ---
>> >>  platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
>> >>  1 file changed, 2 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
>> >> b/platform/linux-generic/include/odp_buffer_internal.h
>> >> index a7638da..db9defa 100644
>> >> --- a/platform/linux-generic/include/odp_buffer_internal.h
>> >> +++ b/platform/linux-generic/include/odp_buffer_internal.h
>> >> @@ -30,7 +30,7 @@ extern "C" {
>> >>  #include 
>> >>  #include 
>> >>
>> >> -
>> >> +/* clang-format off */
>> >>  #define ODP_BITSIZE(x) \
>> >> ((x) <= 2 ?  1 : \
>> >> ((x) <= 4 ?  2 : \
>> >> @@ -49,6 +49,7 @@ extern "C" {
>> >> ((x) <= 32768 ? 15 : \
>> >> ((x) <= 65536 ? 16 : \
>> >>  (0/0)
>> >> +/* clang-format on */
>> >>
>> >>  _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
>> >>"ODP Segment size must be a minimum of 256 bytes");
>> >> --
>> >> 2.1.4
>> >>
>> >> ___
>> >> 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



-- 
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 1/3] linux-generic: buffer_internal add clang-format barriers

2015-08-19 Thread Bill Fischofer
It's the responsibility of each patch submitter to ensure that the
submission is checkpatch clean.  If we're doing a one-off scrub of the
existing code then any anomalies can be dealt with via one-off manual edits
so that the cleanup patches are clean. From then on normal patch processes
should maintain conformance.

On Wednesday, August 19, 2015, Mike Holmes  wrote:

> On 19 August 2015 at 15:09, Bill Fischofer  > wrote:
> > Ok,  then I don't see any need to "protect" existing code that's already
> > checkpatch clean.
>
> It is needed when we run this to clean up the existing problems - seen
> here https://ci.linaro.org/job/odp-api-style-check/label=build/534/console
> It is the only case in the entire code base where there is a conflict
> and the result looks worse although it is complaint and does compile,
> by marking it future changes to this file can be run though and will
> not cause a problem.
>
> >
> >
> > On Wednesday, August 19, 2015, Mike Holmes  > wrote:
> >>
> >> On 19 August 2015 at 13:26, Bill Fischofer  >
> >> wrote:
> >> > Is clang-format intended to be used as a convenience or as something
> >> > that is
> >> > a standard part of ODP?
> >>
> >> I don’t see it as mandatory, just to help those who find their
> >> favourite editor does not play well with checkpatch rules.
> >> It also fixes 99% of the current mess generated when we moved to the
> >> newer checkpatch automatically, I expect to run it and fix all those
> >> warnings in 1.3 as Nicloas had proposed.
> >>
> >>  I have no problem with offering it as a convenience
> >> > to help submitters in creating clean patches, but what's the point of
> >> > having
> >> > a style guide if code is going to be run through a formatter?
> >>  That would
> >> > suggest that folks really don't need to pay attention to style since
> >> > they
> >> > can assume that some tools is going to reformat things anyway.
> >> >
> >> > We want code to be written to the ODP style, not converted into that
> for
> >> > publication from the "real" style used by each author.
> >>
> >> By providing this as an option those with editors that are correctly
> >> set to a style that is generating different but still checkpatch
> >> compliant code will be fine.
> >> We don’t need to enforce this single tools view of the code,
> >> checkpatch already enforces the ODP rule.
> >>
> >> >
> >> > On Wed, Aug 19, 2015 at 11:20 AM, Mike Holmes  >
> >> > wrote:
> >> >>
> >> >> The odp_format tool is not infallible, in this case it is better to
> >> >> omit
> >> >> the macro from formatting
> >> >>
> >> >> Signed-off-by: Mike Holmes >
> >> >> ---
> >> >>  platform/linux-generic/include/odp_buffer_internal.h | 3 ++-
> >> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >> >>
> >> >> diff --git a/platform/linux-generic/include/odp_buffer_internal.h
> >> >> b/platform/linux-generic/include/odp_buffer_internal.h
> >> >> index a7638da..db9defa 100644
> >> >> --- a/platform/linux-generic/include/odp_buffer_internal.h
> >> >> +++ b/platform/linux-generic/include/odp_buffer_internal.h
> >> >> @@ -30,7 +30,7 @@ extern "C" {
> >> >>  #include 
> >> >>  #include 
> >> >>
> >> >> -
> >> >> +/* clang-format off */
> >> >>  #define ODP_BITSIZE(x) \
> >> >> ((x) <= 2 ?  1 : \
> >> >> ((x) <= 4 ?  2 : \
> >> >> @@ -49,6 +49,7 @@ extern "C" {
> >> >> ((x) <= 32768 ? 15 : \
> >> >> ((x) <= 65536 ? 16 : \
> >> >>  (0/0)
> >> >> +/* clang-format on */
> >> >>
> >> >>  _ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256,
> >> >>"ODP Segment size must be a minimum of 256
> bytes");
> >> >> --
> >> >> 2.1.4
> >> >>
> >> >> ___
> >> >> 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
>
>
>
> --
> 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] [API-NEXT PATCH v3 3/3] validation: packet: test if the max value can be set for RSS hash

2015-08-19 Thread Bill Fischofer
On Fri, Aug 14, 2015 at 1:42 PM, Zoltan Kiss  wrote:

> Signed-off-by: Zoltan Kiss 
>

Reviewed-by: Bill Fischofer 


> ---
>  test/validation/packet/packet.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/test/validation/packet/packet.c
> b/test/validation/packet/packet.c
> index 99a6745..a4eb24c 100644
> --- a/test/validation/packet/packet.c
> +++ b/test/validation/packet/packet.c
> @@ -164,6 +164,9 @@ void packet_test_basic_metadata(void)
> CU_ASSERT(odp_packet_pool(pkt) != ODP_POOL_INVALID);
> /* Packet was allocated by application so shouldn't have valid
> pktio. */
> CU_ASSERT(odp_packet_input(pkt) == ODP_PKTIO_INVALID);
> +
> +   odp_packet_rss_hash_set(pkt, UINT32_MAX);
> +   CU_ASSERT(odp_packet_rss_hash(pkt) == UINT32_MAX);
>  }
>
>  void packet_test_length(void)
> --
> 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 PATCH v3 2/3] linux-generic: packet: implement RSS hash support

2015-08-19 Thread Bill Fischofer
The RSS Hash is the output of the Toepliz Hash function.  It is used by
masking some number of low-order bits of this function to get the RSS Index
used.  As such 32-bits is more than sufficient since it is essentially maps
to the number of processing cores.  A 32-bit hash supports 4 billion cores,
well beyond today's largest systems.

I'd leave it as uint32_t for now.

On Mon, Aug 17, 2015 at 3:45 AM, Santosh Shukla 
wrote:

> On 17 August 2015 at 14:09, Zoltan Kiss  wrote:
> >
> >
> > On 17/08/15 07:24, Maxim Uvarov wrote:
> >>
> >> On 08/14/15 21:42, Zoltan Kiss wrote:
> >>>
> >>> This platform doesn't compute it, packet_init set it to 0, which
> happens
> >>> to be ODP_PACKET_RSS_INVALID.
> >>>
> >>> Signed-off-by: Zoltan Kiss 
> >>> ---
> >>>   platform/linux-generic/include/odp/plat/packet_types.h |  2 ++
> >>>   platform/linux-generic/include/odp_packet_internal.h   |  1 +
> >>>   platform/linux-generic/odp_packet.c| 14
> >>> ++
> >>>   3 files changed, 17 insertions(+)
> >>>
> >>> diff --git a/platform/linux-generic/include/odp/plat/packet_types.h
> >>> b/platform/linux-generic/include/odp/plat/packet_types.h
> >>> index 45cb801..afc72f4 100644
> >>> --- a/platform/linux-generic/include/odp/plat/packet_types.h
> >>> +++ b/platform/linux-generic/include/odp/plat/packet_types.h
> >>> @@ -36,6 +36,8 @@ typedef ODP_HANDLE_T(odp_packet_seg_t);
> >>>   #define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t,
> >>> 0x)
> >>> +#define ODP_PACKET_RSS_INVALID _odp_cast_scalar(odp_packet_t, 0)
> >
> >
> > This define is incorrect, I think.
> >
> >>> +
> >>>   /** Get printable format of odp_packet_t */
> >>>   static inline uint64_t odp_packet_to_u64(odp_packet_t hdl)
> >>>   {
> >>> diff --git a/platform/linux-generic/include/odp_packet_internal.h
> >>> b/platform/linux-generic/include/odp_packet_internal.h
> >>> index 8c41491..6e52713 100644
> >>> --- a/platform/linux-generic/include/odp_packet_internal.h
> >>> +++ b/platform/linux-generic/include/odp_packet_internal.h
> >>> @@ -136,6 +136,7 @@ typedef struct {
> >>>   uint32_t tailroom;
> >>>   odp_pktio_t input;
> >>> +uint32_t rss_hash;  /**< RSS hash value*/
> >>
> >>
> >> is rss_hash always and everywhere 32 bit?
> >
> >
> > I don't think it's guaranteed anywhere. Maybe we should rather use an
> opaque
> > type? But then we would need to provide operator functions for all the
> > possible uses, that would be an overkill.
> >
>
> So far per my knowledge; Plenty of NIC's example e100/ixgbe/brcm etc
> provide 32bit word size. You could add opaque support, but make sure
> handle/method are inlined (less expensive); Because its per-pkt
> Otherwise overkill. I would prefer keeping it 32bit word size unless
> someone speaks / describe their experience on using rss_hash 64bit
> word size.
>
> >>
> >> Maxim.
> >>
> >>
> >>>   odp_crypto_generic_op_result_t op_result;  /**< Result for
> >>> crypto */
> >>>   } odp_packet_hdr_t;
> >>> diff --git a/platform/linux-generic/odp_packet.c
> >>> b/platform/linux-generic/odp_packet.c
> >>> index 5581cc4..649071f 100644
> >>> --- a/platform/linux-generic/odp_packet.c
> >>> +++ b/platform/linux-generic/odp_packet.c
> >>> @@ -326,6 +326,20 @@ int odp_packet_l4_offset_set(odp_packet_t pkt,
> >>> uint32_t offset)
> >>>   return 0;
> >>>   }
> >>> +uint32_t odp_packet_rss_hash(odp_packet_t pkt)
> >>> +{
> >>> +odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> >>> +
> >>> +return pkt_hdr->rss_hash;
> >>> +}
> >>> +
> >>> +void odp_packet_rss_hash_set(odp_packet_t pkt, uint32_t rss_hash)
> >>> +{
> >>> +odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
> >>> +
> >>> +pkt_hdr->rss_hash = rss_hash;
> >>> +}
> >>> +
> >>>   int odp_packet_is_segmented(odp_packet_t pkt)
> >>>   {
> >>>   return odp_packet_hdr(pkt)->buf_hdr.segcount > 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
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCH v4 1/3] api: pool: add packet user area initializer for pool creation parameters

2015-08-19 Thread Bala Manoharan
Reviewed-by: Balasubramanian Manoharan 

On 15 August 2015 at 00:25, Zoltan Kiss  wrote:

> Applications can preset certain parts of the packet user area, so when that
> memory will be allocated it starts from a known state. If the platform
> allocates the memory during pool creation, it's enough to run the
> constructor after that. If it's allocating memory on demand, it should
> call the constructor each time.
> Porting applications to ODP can benefit from this. If the application can't
> afford to change its whole packet handling to ODP, it's likely it needs to
> maintain its own metadata in the user area. And probably it needs to set
> constant fields in that metadata e.g. to mark that this is an ODP packet,
> and/or store the handle of the packet itself.
>
> Signed-off-by: Zoltan Kiss 
> ---
> v2:
> - restrict this feature to packet user area
> - expand comments
>
> v3:
> - include packet.h in pool.h
>
> v4:
> - fix grammar based on Bill's comments
>
>  include/odp/api/packet.h |  3 +++
>  include/odp/api/pool.h   | 26 ++
>  2 files changed, 29 insertions(+)
>
> diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> index 3a454b5..f5d2142 100644
> --- a/include/odp/api/packet.h
> +++ b/include/odp/api/packet.h
> @@ -73,6 +73,9 @@ extern "C" {
>   * @note The default headroom and tailroom used for packets is specified
> by
>   * the ODP_CONFIG_PACKET_HEADROOM and ODP_CONFIG_PACKET_TAILROOM defines
> in
>   * odp_config.h.
> + * @note Data changed in user area might be preserved by the platform from
> + * previous usage of the buffer, so values preset in uarea_init() are not
> + * guaranteed.
>   */
>  odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t len);
>
> diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
> index 2e79a55..01f770f 100644
> --- a/include/odp/api/pool.h
> +++ b/include/odp/api/pool.h
> @@ -21,6 +21,7 @@ extern "C" {
>
>
>  #include 
> +#include 
>
>  /** @defgroup odp_pool ODP POOL
>   *  Operations on a pool.
> @@ -41,6 +42,23 @@ extern "C" {
>  #define ODP_POOL_NAME_LEN  32
>
>  /**
> + * Packet user area initializer callback function for pools.
> + *
> + * @param pkt   Handle of the packet
> + * @param uarea_init_argOpaque pointer defined in odp_pool_param_t
> + *
> + * @note If the application specifies this pointer, it expects that every
> buffer
> + * is initialized exactly once with it when the underlying memory is
> allocated.
> + * It is not called from odp_packet_alloc(), unless the platform chooses
> to
> + * allocate the memory at that point. Applications can only assume that
> this
> + * callback is called once before the packet is first used. Any subsequent
> + * change to the user area might be preserved after odp_packet_free() is
> called,
> + * so applications should take care of (re)initialization if they change
> data
> + * preset by this function.
> + */
> +typedef void (odp_packet_uarea_init_t)(odp_packet_t pkt, void
> *uarea_init_arg);
> +
> +/**
>   * Pool parameters
>   * Used to communicate pool creation options.
>   */
> @@ -82,6 +100,14 @@ typedef struct odp_pool_param_t {
> /** User area size in bytes. Specify as 0 if no
> user
> area is needed. */
> uint32_t uarea_size;
> +
> +   /** Initialize every packet's user area at
> allocation
> +   time. Use NULL if no initialization needed. */
> +   odp_packet_uarea_init_t *uarea_init;
> +
> +   /** Opaque pointer passed to packet user area
> +   constructor. */
> +   void *uarea_init_arg;
> } pkt;
> struct {
> /** Number of timeouts in the pool */
> --
> 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