Re: [lng-odp] [API-NEXT PATCH] linux-generic: buffer: remove unused _odp_buffer_type_set() function

2015-07-13 Thread Maxim Uvarov

Merged to api-next.

Thanks,
Maxim.

On 07/10/15 21:18, Mike Holmes wrote:



On 10 July 2015 at 10:21, Bill Fischofer bill.fischo...@linaro.org 
mailto:bill.fischo...@linaro.org wrote:


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


Reviewed-by: Mike Holmes mike.hol...@linaro.org 
mailto:mike.hol...@linaro.org


---
 platform/linux-generic/include/odp_buffer_internal.h | 9 -
 platform/linux-generic/odp_buffer.c  | 8 
 2 files changed, 17 deletions(-)

diff --git a/platform/linux-generic/include/odp_buffer_internal.h
b/platform/linux-generic/include/odp_buffer_internal.h
index d9ffc06..ae799dd 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -168,15 +168,6 @@ odp_buffer_t buffer_alloc(odp_pool_t pool,
size_t size);
  */
 int _odp_buffer_type(odp_buffer_t buf);

-/*
- * Buffer type set
- *
- * @param buf  Buffer handle
- * @param type New type value
- *
- */
-   void _odp_buffer_type_set(odp_buffer_t buf, int type);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_buffer.c
b/platform/linux-generic/odp_buffer.c
index 0803805..d5d42a6 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -47,14 +47,6 @@ int _odp_buffer_type(odp_buffer_t buf)
return hdr-type;
 }

-void _odp_buffer_type_set(odp_buffer_t buf, int type)
-{
-   odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
-
-   hdr-type = type;
-}
-
-
 int odp_buffer_is_valid(odp_buffer_t buf)
 {
return validate_buf(buf) != NULL;
--
2.1.4

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




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org http://www.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 mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] Proposal for packet headroom as an input parameter for initialize pool memory

2015-07-13 Thread Maxim Uvarov

Hello Genis,

this config.h is platform settings and limitation. Every platform 
developer sets his own limits according to his hardware possibility. So 
it's not intended to

be edited by application developer.

What is your use case? Maybe it's possible to do what you need with 
other odp api?


Thank you,
Maxim.

On 07/13/15 14:00, Genis Riera wrote:

Hi all,

I just wanted to propose an idea for extending the packet 
headromm/tailroom feature of ODP linux-generic platform.


As far as I'm aware, the default values for initialize a packet 
headroom/tailroom can be found at config.h, and if someone wish to 
modify it, then ODP must be recompiled. Since I'm currently taking 
advantage of it to manage some metadata, I think would be interesting 
to provide some mechanism to set the packet headroom/tailrrom size 
when pool memory is initialized inside an application which uses ODP 
framework. For example, having a new parameter on odp_pool_params_t to 
set it up (when the pool is type of packet pool, of course). Does it 
make sense for you?


So far, I haven't looked in detail the source code of linux-generic 
implementation, but if you think that this proposal is not too 
difficult to implement, I could try to do it. Furthermore, it would be 
a good way to get more involve in the ODP developement.


Please, don't hesitate to make suggestions for this proposal. Does it 
make sense for you?


Thank you so much for your support. Best regards,

Genís Riera Pérez.

Genís Riera Pérez
Software Engineer at StarFlow Networks
Edifici K2M, S103 c/ Jordi Girona 31
08034 Barcelona

E-mail: gri...@starflownetworks.com mailto:gri...@starflownetworks.com


___
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] Proposal for packet headroom as an input parameter for initialize pool memory

2015-07-13 Thread Bill Fischofer
Actually, the original proposal for this had these as part of the
odp_pool_param_t structure, however some platforms have difficulty
implementing varying headroom/tailroom on a per-pool basis.

But good to revisit this since we'd like to minimize use of odp_config.h in
preference to more dynamic APIs, so I'll add this to the agenda for this
week's call.

On Mon, Jul 13, 2015 at 6:00 AM, Genis Riera gri...@starflownetworks.com
wrote:

 Hi all,

 I just wanted to propose an idea for extending the packet
 headromm/tailroom feature of ODP linux-generic platform.

 As far as I'm aware, the default values for initialize a packet
 headroom/tailroom can be found at config.h, and if someone wish to modify
 it, then ODP must be recompiled. Since I'm currently taking advantage of it
 to manage some metadata, I think would be interesting to provide some
 mechanism to set the packet headroom/tailrrom size when pool memory is
 initialized inside an application which uses ODP framework. For example,
 having a new parameter on odp_pool_params_t to set it up (when the pool is
 type of packet pool, of course). Does it make sense for you?

 So far, I haven't looked in detail the source code of linux-generic
 implementation, but if you think that this proposal is not too difficult to
 implement, I could try to do it. Furthermore, it would be a good way to get
 more involve in the ODP developement.

 Please, don't hesitate to make suggestions for this proposal. Does it make
 sense for you?

 Thank you so much for your support. Best regards,

 Genís Riera Pérez.

 Genís Riera Pérez
 Software Engineer at StarFlow Networks
 Edifici K2M, S103 c/ Jordi Girona 31
 08034 Barcelona

 E-mail: gri...@starflownetworks.com

 ___
 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 1/1] validation: queue: add missing tests for new APIs

2015-07-13 Thread Maxim Uvarov

On 07/10/15 22:46, Bill Fischofer wrote:

Add validation test coverage for the following APIs:
odp_queue_sched_group()
odp_queue_sched_prio()
odp_queue_sched_type()

Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
---
  test/validation/queue/queue.c | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index b700e88..5830d9b 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -51,9 +51,15 @@ static void queue_test_sunnydays(void)
int nr_deq_entries = 0;
int max_iteration = CONFIG_MAX_ITERATION;
void *prtn = NULL;
+   odp_queue_param_t qparams;
+
+   odp_queue_param_init(qparams);
+   qparams.sched.prio = ODP_SCHED_PRIO_LOWEST;
+   qparams.sched.sync = ODP_SCHED_SYNC_NONE;
+   qparams.sched.group = ODP_SCHED_GROUP_WORKER;
  
  	queue_creat_id = odp_queue_create(test_queue,

- ODP_QUEUE_TYPE_POLL, NULL);
+ ODP_QUEUE_TYPE_POLL, qparams);


That is the same code as was before. But now we need 4 more lines of 
initialization. It looks like it's good to set default

values inside odp_queue_param_init().

Maxim.

CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id);
  
  	CU_ASSERT_EQUAL(ODP_QUEUE_TYPE_POLL,

@@ -62,6 +68,11 @@ static void queue_test_sunnydays(void)
queue_id = odp_queue_lookup(test_queue);
CU_ASSERT_EQUAL(queue_creat_id, queue_id);
  
+	CU_ASSERT_EQUAL(ODP_SCHED_GROUP_WORKER,

+   odp_queue_sched_group(queue_id));
+   CU_ASSERT_EQUAL(ODP_SCHED_PRIO_LOWEST, odp_queue_sched_prio(queue_id));
+   CU_ASSERT_EQUAL(ODP_SCHED_SYNC_NONE, odp_queue_sched_type(queue_id));
+
CU_ASSERT(0 == odp_queue_set_context(queue_id, queue_contest));
  
  	prtn = odp_queue_get_context(queue_id);


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


Re: [lng-odp] [API-NEXT PATCH 1/1] validation: queue: add missing tests for new APIs

2015-07-13 Thread Bill Fischofer
The purpose of this test is to validate that these can be set to
non-default values, hence the explicit initialization statements.

On Mon, Jul 13, 2015 at 6:29 AM, Maxim Uvarov maxim.uva...@linaro.org
wrote:

 On 07/10/15 22:46, Bill Fischofer wrote:

 Add validation test coverage for the following APIs:
 odp_queue_sched_group()
 odp_queue_sched_prio()
 odp_queue_sched_type()

 Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
 ---
   test/validation/queue/queue.c | 13 -
   1 file changed, 12 insertions(+), 1 deletion(-)

 diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
 index b700e88..5830d9b 100644
 --- a/test/validation/queue/queue.c
 +++ b/test/validation/queue/queue.c
 @@ -51,9 +51,15 @@ static void queue_test_sunnydays(void)
 int nr_deq_entries = 0;
 int max_iteration = CONFIG_MAX_ITERATION;
 void *prtn = NULL;
 +   odp_queue_param_t qparams;
 +
 +   odp_queue_param_init(qparams);
 +   qparams.sched.prio = ODP_SCHED_PRIO_LOWEST;
 +   qparams.sched.sync = ODP_SCHED_SYNC_NONE;
 +   qparams.sched.group = ODP_SCHED_GROUP_WORKER;
 queue_creat_id = odp_queue_create(test_queue,
 - ODP_QUEUE_TYPE_POLL, NULL);
 + ODP_QUEUE_TYPE_POLL, qparams);


 That is the same code as was before. But now we need 4 more lines of
 initialization. It looks like it's good to set default
 values inside odp_queue_param_init().

 Maxim.

 CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id);
 CU_ASSERT_EQUAL(ODP_QUEUE_TYPE_POLL,
 @@ -62,6 +68,11 @@ static void queue_test_sunnydays(void)
 queue_id = odp_queue_lookup(test_queue);
 CU_ASSERT_EQUAL(queue_creat_id, queue_id);
   + CU_ASSERT_EQUAL(ODP_SCHED_GROUP_WORKER,
 +   odp_queue_sched_group(queue_id));
 +   CU_ASSERT_EQUAL(ODP_SCHED_PRIO_LOWEST,
 odp_queue_sched_prio(queue_id));
 +   CU_ASSERT_EQUAL(ODP_SCHED_SYNC_NONE,
 odp_queue_sched_type(queue_id));
 +
 CU_ASSERT(0 == odp_queue_set_context(queue_id, queue_contest));
 prtn = odp_queue_get_context(queue_id);


 ___
 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 v7] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Maxim Uvarov

Looks good for me. Only description needed to be fixed:



On 07/10/15 21:10, Zoltan Kiss wrote:

Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event(free).

odp_event_free(evt), right? I can fix that on merge.

Maxim.

Wider error handling is attempted, but this patch can't fix all the flaws
in the many calling functions of odp_queue_enq()

Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org
---

v5: fix array use in last hunk

v6: handle negative 'ret' in last hunk

v7: refactor all hunks to similar than last one

  test/performance/odp_pktio_perf.c | 10 +-
  test/performance/odp_scheduling.c |  8 ++--
  test/validation/pktio/pktio.c |  3 +++
  test/validation/queue/queue.c |  4 
  4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index f4d9d2d..c2e95fb 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -270,12 +270,20 @@ static int alloc_packets(odp_event_t *event_tbl, int 
num_pkts)
  static int send_packets(odp_queue_t outq,
odp_event_t *event_tbl, unsigned num_pkts)
  {
+   int ret;
+   unsigned i;
+
if (num_pkts == 0)
return 0;
else if (num_pkts == 1)
return odp_queue_enq(outq, event_tbl[0]) == 0 ? 1 : 0;
  
-	return odp_queue_enq_multi(outq, event_tbl, num_pkts);

+   ret = odp_queue_enq_multi(outq, event_tbl, num_pkts);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_event_free(event_tbl[i]);
+   return ret;
+
  }
  
  /*

diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 99f0f9b..a9ebfaa 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -530,9 +530,13 @@ static int test_schedule_multi(const char *str, int thr,
}
  
  		/* Assume we can enqueue all events */

-   if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX) !=
-   MULTI_BUFS_MAX) {
+   num = odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX);
+   if (num != MULTI_BUFS_MAX) {
LOG_ERR(  [%i] Queue enqueue failed.\n, thr);
+   j = num  0 ? 0 : num;
+   for ( ; j  MULTI_BUFS_MAX; j++)
+   odp_event_free(ev[j]);
+
return -1;
}
}
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 82ced5c..283dd92 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -388,6 +388,9 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, 
pktio_info_t *pktio_b,
ret = odp_queue_enq_multi(pktio_a-outq, tx_ev, num_pkts);
if (ret != num_pkts) {
CU_FAIL(failed to enqueue test packets);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_packet_free(tx_ev[i]);
return;
}
}
diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index f686b71..96dc932 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -88,6 +88,10 @@ static void queue_test_sunnydays(void)
 */
ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE);
CU_ASSERT(MAX_BUFFER_QUEUE == ret);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  MAX_BUFFER_QUEUE; i++)
+   odp_event_free(enev[i]);
+
pev_tmp = deev;
do {
deq_ret  = odp_queue_deq_multi(queue_id, pev_tmp,


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


Re: [lng-odp] [API-NEXT PATCH v2] validation: cpumask: test def_control and setall APIs

2015-07-13 Thread Maxim Uvarov

Merged.

Thanks,
Maxim.

On 07/11/15 00:31, Mike Holmes wrote:

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

fixed cpumask_test_odp_cpumask_def test

  test/validation/cpumask/cpumask.c | 57 +++
  1 file changed, 57 insertions(+)

diff --git a/test/validation/cpumask/cpumask.c 
b/test/validation/cpumask/cpumask.c
index 943a8e0..d4daa61 100644
--- a/test/validation/cpumask/cpumask.c
+++ b/test/validation/cpumask/cpumask.c
@@ -30,6 +30,9 @@
  /* padding pattern used to check buffer overflow: */
  #define FILLING_PATTERN 0x55
  
+/* default worker paramiter to get all that may be available */

+#define ALL_AVAILABLE 0
+
  /*
   * returns the length of a string, excluding terminating NULL.
   * As its C lib strlen equivalent. Just rewritten here to avoid C lib
@@ -456,6 +459,56 @@ static void cpumask_test_odp_cpumask_next(void)
CU_ASSERT(odp_cpumask_next(mask1, i) == expected[i]);
  }
  
+static void cpumask_test_odp_cpumask_setall(void)

+{
+   int num_cpus;
+   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   odp_cpumask_t mask;
+
+   odp_cpumask_setall(mask);
+   num_cpus = odp_cpumask_count(mask);
+
+   CU_ASSERT(num_cpus  0);
+   CU_ASSERT(num_cpus = max_cpus);
+}
+
+static void cpumask_test_odp_cpumask_def_control(void)
+{
+   int num;
+   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   odp_cpumask_t mask;
+
+   num = odp_cpumask_def_control(mask, ALL_AVAILABLE);
+
+   CU_ASSERT(num = 0);
+   CU_ASSERT(num = max_cpus);
+}
+
+static void cpumask_test_odp_cpumask_def_worker(void)
+{
+   int num;
+   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   odp_cpumask_t mask;
+
+   num = odp_cpumask_def_worker(mask, ALL_AVAILABLE);
+
+   CU_ASSERT(num = 0);
+   CU_ASSERT(num = max_cpus);
+}
+
+static void cpumask_test_odp_cpumask_def(void)
+{
+   int num_worker;
+   int num_control;
+   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   odp_cpumask_t mask;
+
+   num_worker = odp_cpumask_def_worker(mask, max_cpus - 1);
+   num_control = odp_cpumask_def_control(mask, 1);
+
+   CU_ASSERT((num_control + num_worker) == max_cpus);
+}
+
  static CU_TestInfo cpumask_suite[] = {
{odp_cpumask_to/from_str(), cpumask_test_odp_cpumask_to_from_str},
{odp_cpumask_equal(), cpumask_test_odp_cpumask_equal},
@@ -471,6 +524,10 @@ static CU_TestInfo cpumask_suite[] = {
{odp_cpumask_first(), cpumask_test_odp_cpumask_first},
{odp_cpumask_last(),  cpumask_test_odp_cpumask_last},
{odp_cpumask_next(),  cpumask_test_odp_cpumask_next},
+   {odp_cpumask_setall(),  cpumask_test_odp_cpumask_setall},
+   {odp_cpumask_def_control(), cpumask_test_odp_cpumask_def_control},
+   {odp_cpumask_def_worker(),  cpumask_test_odp_cpumask_def_worker},
+   {odp_cpumask_def(),   cpumask_test_odp_cpumask_def},
CU_TEST_INFO_NULL,
  };
  


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


Re: [lng-odp] [API-NEXT PATCH v7] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Zoltan Kiss



On 13/07/15 11:29, Maxim Uvarov wrote:

Looks good for me. Only description needed to be fixed:



On 07/10/15 21:10, Zoltan Kiss wrote:

Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event(free).

odp_event_free(evt), right? I can fix that on merge.

Maxim.


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


[lng-odp] Proposal for packet headroom as an input parameter for initialize pool memory

2015-07-13 Thread Genis Riera
Hi all,

I just wanted to propose an idea for extending the packet headromm/tailroom
feature of ODP linux-generic platform.

As far as I'm aware, the default values for initialize a packet
headroom/tailroom can be found at config.h, and if someone wish to modify
it, then ODP must be recompiled. Since I'm currently taking advantage of it
to manage some metadata, I think would be interesting to provide some
mechanism to set the packet headroom/tailrrom size when pool memory is
initialized inside an application which uses ODP framework. For example,
having a new parameter on odp_pool_params_t to set it up (when the pool is
type of packet pool, of course). Does it make sense for you?

So far, I haven't looked in detail the source code of linux-generic
implementation, but if you think that this proposal is not too difficult to
implement, I could try to do it. Furthermore, it would be a good way to get
more involve in the ODP developement.

Please, don't hesitate to make suggestions for this proposal. Does it make
sense for you?

Thank you so much for your support. Best regards,

Genís Riera Pérez.

Genís Riera Pérez
Software Engineer at StarFlow Networks
Edifici K2M, S103 c/ Jordi Girona 31
08034 Barcelona

E-mail: gri...@starflownetworks.com
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] doc: api_guide_lines: add structure initialization

2015-07-13 Thread Maxim Uvarov

On 07/10/15 20:49, Mike Holmes wrote:

Signed-off-by: Mike Holmes mike.hol...@linaro.org
---
  doc/api_guide_lines.dox | 11 +++
  1 file changed, 11 insertions(+)

diff --git a/doc/api_guide_lines.dox b/doc/api_guide_lines.dox
index f3f7799..70d6cb8 100644
--- a/doc/api_guide_lines.dox
+++ b/doc/api_guide_lines.dox
@@ -78,6 +78,17 @@ Other mechanisms available to the implementer are:
   - ODP_DEPRECATED() is used to signify that a call is planned for 
obsolescence.
   - ODP_LOG() is used to direct implementation messages to the application.
  
+@subsection structure Structure Initialization

+For each structure defined in the ODP API an initialization function is 
required.
+It must take the form odpstructure_name_init for example:-

1. odp_structure_name_init. (_ after odp is missing).
2. please check after example :-. Should it be : ?

Maxim.

+
+@code
+typedef struct odp_foo_t {
+...
+} odp_foo_t
+
+void odp_foo_init(odp_foo_t *foo);
+@endcode
  
  @subsection function_name Function Names

  Functions must attempt to be so clear in their intent that referencing the 
documentation is not necessary, the guidelines below should be followed unless 
a strong case is made for an exception.


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


Re: [lng-odp] [API-NEXT PATCH 1/3] api: queue: allow for anonymous queues

2015-07-13 Thread Jerin Jacob
On Mon, Jul 13, 2015 at 04:11:28PM -0500, Bill Fischofer wrote:
 Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
 ---
  include/odp/api/queue.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/include/odp/api/queue.h b/include/odp/api/queue.h
 index 297067d..7f46892 100644
 --- a/include/odp/api/queue.h
 +++ b/include/odp/api/queue.h
 @@ -86,7 +86,7 @@ typedef struct odp_queue_param_t {
   * Queue create
   *
   * @param nameQueue name
 - * @param typeQueue type
 + * @param typeQueue type, or NULL for an anonymous queue.

new anonymous queue description added to param 'type', Not to param 'name'

   * @param param   Queue parameters. Uses defaults if NULL.
   *
   * @return Queue handle
 -- 
 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] [PATCHv2 0/3] Remove basic pktio sock and support segmented packet

2015-07-13 Thread Maxim Uvarov

Stuart, that version is good for you, right?

Maxim.

On 07/08/15 16:23, Nicolas Morey-Chaisemartin wrote:

Pretty much the same patch as before except for the test part.
There are now 3 test suite in the pktio test:
* Standard one
* Segmented for regular packets (No Jumbo)
* Segmented Jumbo packet (unsegmented regular)

The pool have different name at each run so people who don't support 
pool_destroy should not be bothered with it.
Platform that do not support segmented packet or segmented jumbo can just 
disable the specific test suites.

As no one raised any issue with sock_basic being drop during the last call (as 
long as sock_mmap and sock_mmsg stayed), I kept the drop patch.

Nicolas Morey-Chaisemartin (3):
   linux-generic: pktio: remove basic socket implementation
   linux-generic: pktio: handle segmented packet in socket mode
   test: pktio: add tests for segmented packets

  example/generator/odp_generator.c  |   1 -
  example/packet/odp_pktio.c |   1 -
  .../linux-generic/include/odp_packet_io_internal.h |   3 +-
  platform/linux-generic/odp_packet_io.c |  18 ---
  platform/linux-generic/odp_packet_socket.c | 157 +++--
  platform/linux-generic/test/pktio/pktio_run|   2 +-
  test/performance/odp_l2fwd.c   |   1 -
  test/validation/pktio/pktio.c  |  99 +++--
  8 files changed, 139 insertions(+), 143 deletions(-)

___
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 v7] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Maxim Uvarov

pktio.c: In function ‘pktio_txrx_multi’:
pktio.c:393:5: error: passing argument 1 of ‘odp_packet_free’ from 
incompatible pointer type [-Werror]

 odp_packet_free(tx_ev[i]);
 ^
In file included from 
../../../platform/linux-generic/include/odp/packet.h:35:0,

 from ../../../include/odp.h:47,
 from pktio.c:6:
../../../include/odp/api/packet.h:100:6: note: expected ‘odp_packet_t’ 
but argument is of type ‘odp_event_t’

 void odp_packet_free(odp_packet_t pkt);

On 07/13/15 15:14, Zoltan Kiss wrote:



On 13/07/15 11:29, Maxim Uvarov wrote:

Looks good for me. Only description needed to be fixed:



On 07/10/15 21:10, Zoltan Kiss wrote:

Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event(free).

odp_event_free(evt), right? I can fix that on merge.

Maxim.


Yes, please do


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


Re: [lng-odp] [API-NEXT PATCH v7] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Zoltan Kiss

Oops!... I Did It Again (Max Martin / Rami Yacoub)

It was correct originally, but I missed it with the recent rework, I'll 
send it again.


On 13/07/15 14:04, Maxim Uvarov wrote:

pktio.c: In function ‘pktio_txrx_multi’:
pktio.c:393:5: error: passing argument 1 of ‘odp_packet_free’ from
incompatible pointer type [-Werror]
  odp_packet_free(tx_ev[i]);
  ^
In file included from
../../../platform/linux-generic/include/odp/packet.h:35:0,
  from ../../../include/odp.h:47,
  from pktio.c:6:
../../../include/odp/api/packet.h:100:6: note: expected ‘odp_packet_t’
but argument is of type ‘odp_event_t’
  void odp_packet_free(odp_packet_t pkt);

On 07/13/15 15:14, Zoltan Kiss wrote:



On 13/07/15 11:29, Maxim Uvarov wrote:

Looks good for me. Only description needed to be fixed:



On 07/10/15 21:10, Zoltan Kiss wrote:

Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event(free).

odp_event_free(evt), right? I can fix that on merge.

Maxim.


Yes, please do



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


[lng-odp] [Bug 1688] New: CID 98427: /example/packet/odp_pktio.c

2015-07-13 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1688

Bug ID: 1688
   Summary: CID 98427: /example/packet/odp_pktio.c
   Product: OpenDataPlane
   Version: 1.1
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: Packet IO
  Assignee: maxim.uva...@linaro.org
  Reporter: mike.hol...@linaro.org
CC: lng-odp@lists.linaro.org

287 /* Swap Eth MACs and IP-addrs */
288 swap_pkt_addrs(pkt_tbl, pkts_ok);
289 sent = odp_pktio_send(pktio, pkt_tbl,
pkts_ok);
290 if (odp_unlikely(sent  pkts_ok)) {
291 err_cnt += pkts_ok - sent;
292 do
 CID 98427:(NEGATIVE_RETURNS)
 Using variable sent as an index to array pkt_tbl.
293
odp_packet_free(pkt_tbl[sent]);
294 while (++sent  pkts_ok);
295 }
296 }
297
298 if (odp_unlikely(pkts_ok != pkts))

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


[lng-odp] [Bug 1688] CID 98427: /example/packet/odp_pktio.c

2015-07-13 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1688

--- Comment #1 from Mike Holmes mike.hol...@linaro.org ---
Also in 

/test/performance/odp_l2fwd.c: 233 in pktio_ifburst_thread()
227 if (pkts_ok  0) {
228 int sent = odp_pktio_send(pktio_dst, pkt_tbl,
pkts_ok);
229
230 if (odp_unlikely(sent  pkts_ok)) {
231 stats-drops += pkts_ok - sent;
232 do
 CID 98427:(NEGATIVE_RETURNS)
 Using variable sent as an index to array pkt_tbl.
233 odp_packet_free(pkt_tbl[sent]);
234 while (++sent  pkts_ok);
235 }
236 }
237
238 if (odp_unlikely(pkts_ok != pkts))

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


Re: [lng-odp] Proposal for packet headroom as an input parameter for initialize pool memory

2015-07-13 Thread Zoltan Kiss

Hi,

There is an API now to have user metadata:

https://git.linaro.org/lng/odp.git/blob/HEAD:/include/odp/api/packet.h#l447

Zoli

On 13/07/15 12:00, Genis Riera wrote:

Since I'm currently taking advantage of it to manage some metadata, I
think would be interesting to provide some mechanism to set the packet
headroom/tailrrom size when pool memory is initialized inside an
application which uses ODP framework

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


[lng-odp] [API-NEXT PATCH v8] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Zoltan Kiss
Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event_free().
Wider error handling is attempted, but this patch can't fix all the flaws
in the many calling functions of odp_queue_enq()

Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org
---

v5: fix array use in last hunk

v6: handle negative 'ret' in last hunk

v7: refactor all hunks to similar than last one

v8: fix pktio_txrx_multi and the commit message

 test/performance/odp_pktio_perf.c | 10 +-
 test/performance/odp_scheduling.c |  8 ++--
 test/validation/pktio/pktio.c |  3 +++
 test/validation/queue/queue.c |  4 
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index f4d9d2d..c2e95fb 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -270,12 +270,20 @@ static int alloc_packets(odp_event_t *event_tbl, int 
num_pkts)
 static int send_packets(odp_queue_t outq,
odp_event_t *event_tbl, unsigned num_pkts)
 {
+   int ret;
+   unsigned i;
+
if (num_pkts == 0)
return 0;
else if (num_pkts == 1)
return odp_queue_enq(outq, event_tbl[0]) == 0 ? 1 : 0;
 
-   return odp_queue_enq_multi(outq, event_tbl, num_pkts);
+   ret = odp_queue_enq_multi(outq, event_tbl, num_pkts);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_event_free(event_tbl[i]);
+   return ret;
+
 }
 
 /*
diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 99f0f9b..a9ebfaa 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -530,9 +530,13 @@ static int test_schedule_multi(const char *str, int thr,
}
 
/* Assume we can enqueue all events */
-   if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX) !=
-   MULTI_BUFS_MAX) {
+   num = odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX);
+   if (num != MULTI_BUFS_MAX) {
LOG_ERR(  [%i] Queue enqueue failed.\n, thr);
+   j = num  0 ? 0 : num;
+   for ( ; j  MULTI_BUFS_MAX; j++)
+   odp_event_free(ev[j]);
+
return -1;
}
}
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 82ced5c..d603b27 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -388,6 +388,9 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, 
pktio_info_t *pktio_b,
ret = odp_queue_enq_multi(pktio_a-outq, tx_ev, num_pkts);
if (ret != num_pkts) {
CU_FAIL(failed to enqueue test packets);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_packet_free(tx_pkt[i]);
return;
}
}
diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index f686b71..96dc932 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -88,6 +88,10 @@ static void queue_test_sunnydays(void)
 */
ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE);
CU_ASSERT(MAX_BUFFER_QUEUE == ret);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  MAX_BUFFER_QUEUE; i++)
+   odp_event_free(enev[i]);
+
pev_tmp = deev;
do {
deq_ret  = odp_queue_deq_multi(queue_id, pev_tmp,
-- 
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 v8] queue: handle return value of odp_queue_enq_multi()

2015-07-13 Thread Maxim Uvarov

Merged with changing subject from queue: to test:.

Maxim.

On 07/13/15 16:43, Zoltan Kiss wrote:

Unsent packet has to be released. If the event type is obvious from the
context, use directly the relevant release functions, otherwise
odp_event_free().
Wider error handling is attempted, but this patch can't fix all the flaws
in the many calling functions of odp_queue_enq()

Signed-off-by: Zoltan Kiss zoltan.k...@linaro.org
---

v5: fix array use in last hunk

v6: handle negative 'ret' in last hunk

v7: refactor all hunks to similar than last one

v8: fix pktio_txrx_multi and the commit message

  test/performance/odp_pktio_perf.c | 10 +-
  test/performance/odp_scheduling.c |  8 ++--
  test/validation/pktio/pktio.c |  3 +++
  test/validation/queue/queue.c |  4 
  4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_pktio_perf.c 
b/test/performance/odp_pktio_perf.c
index f4d9d2d..c2e95fb 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -270,12 +270,20 @@ static int alloc_packets(odp_event_t *event_tbl, int 
num_pkts)
  static int send_packets(odp_queue_t outq,
odp_event_t *event_tbl, unsigned num_pkts)
  {
+   int ret;
+   unsigned i;
+
if (num_pkts == 0)
return 0;
else if (num_pkts == 1)
return odp_queue_enq(outq, event_tbl[0]) == 0 ? 1 : 0;
  
-	return odp_queue_enq_multi(outq, event_tbl, num_pkts);

+   ret = odp_queue_enq_multi(outq, event_tbl, num_pkts);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_event_free(event_tbl[i]);
+   return ret;
+
  }
  
  /*

diff --git a/test/performance/odp_scheduling.c 
b/test/performance/odp_scheduling.c
index 99f0f9b..a9ebfaa 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -530,9 +530,13 @@ static int test_schedule_multi(const char *str, int thr,
}
  
  		/* Assume we can enqueue all events */

-   if (odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX) !=
-   MULTI_BUFS_MAX) {
+   num = odp_queue_enq_multi(queue, ev, MULTI_BUFS_MAX);
+   if (num != MULTI_BUFS_MAX) {
LOG_ERR(  [%i] Queue enqueue failed.\n, thr);
+   j = num  0 ? 0 : num;
+   for ( ; j  MULTI_BUFS_MAX; j++)
+   odp_event_free(ev[j]);
+
return -1;
}
}
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 82ced5c..d603b27 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -388,6 +388,9 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, 
pktio_info_t *pktio_b,
ret = odp_queue_enq_multi(pktio_a-outq, tx_ev, num_pkts);
if (ret != num_pkts) {
CU_FAIL(failed to enqueue test packets);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  num_pkts; i++)
+   odp_packet_free(tx_pkt[i]);
return;
}
}
diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index f686b71..96dc932 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -88,6 +88,10 @@ static void queue_test_sunnydays(void)
 */
ret = odp_queue_enq_multi(queue_id, enev, MAX_BUFFER_QUEUE);
CU_ASSERT(MAX_BUFFER_QUEUE == ret);
+   i = ret  0 ? 0 : ret;
+   for ( ; i  MAX_BUFFER_QUEUE; i++)
+   odp_event_free(enev[i]);
+
pev_tmp = deev;
do {
deq_ret  = odp_queue_deq_multi(queue_id, pev_tmp,


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


[lng-odp] [API-NEXT PATCH 1/6] validation: add missing include to odp_cunit_common.h

2015-07-13 Thread Stuart Haslam
stdint.h is required for uint32_t

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 test/validation/common/odp_cunit_common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/validation/common/odp_cunit_common.h 
b/test/validation/common/odp_cunit_common.h
index 98bccfb..7c2a9dd 100644
--- a/test/validation/common/odp_cunit_common.h
+++ b/test/validation/common/odp_cunit_common.h
@@ -13,6 +13,7 @@
 #ifndef ODP_CUNICT_COMMON_H
 #define ODP_CUNICT_COMMON_H
 
+#include stdint.h
 #include CUnit/Basic.h
 
 #define MAX_WORKERS 32 /** Maximum number of work threads */
-- 
2.1.1

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


[lng-odp] [API-NEXT PATCH 6/6] validation: thrmask: test worker and control APIs

2015-07-13 Thread Stuart Haslam
Add tests for odp_thrmask_worker() and odp_thrmask_control()

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 test/validation/thrmask/thrmask.c | 72 ---
 1 file changed, 67 insertions(+), 5 deletions(-)

diff --git a/test/validation/thrmask/thrmask.c 
b/test/validation/thrmask/thrmask.c
index 15d39c3..d07744e 100644
--- a/test/validation/thrmask/thrmask.c
+++ b/test/validation/thrmask/thrmask.c
@@ -7,9 +7,74 @@
 #include odp.h
 
 #include odp_cunit_common.h
+#include test_debug.h
 #include thrmask.h
 #include mask_common.h
 
+odp_barrier_t bar_entry;
+odp_barrier_t bar_exit;
+
+static void *thread_func(void *arg TEST_UNUSED)
+{
+   /* indicate that thread has started */
+   odp_barrier_wait(bar_entry);
+
+   /* wait for indication that we can exit */
+   odp_barrier_wait(bar_exit);
+
+   return NULL;
+}
+
+static void thrmask_test_odp_thrmask_worker(void)
+{
+   odp_thrmask_t mask;
+   int ret;
+   pthrd_arg args = { .testcase = 0, .numthrds = 1 };
+
+   CU_ASSERT_FATAL(odp_thread_type() == ODP_THREAD_CONTROL);
+
+   odp_barrier_init(bar_entry, args.numthrds + 1);
+   odp_barrier_init(bar_exit,  args.numthrds + 1);
+
+   /* should start out with 0 worker threads */
+   ret = odp_thrmask_worker(mask);
+   CU_ASSERT(ret == odp_thrmask_count(mask));
+   CU_ASSERT(ret == 0);
+
+   /* start the test thread(s) */
+   ret = odp_cunit_thread_create(thread_func, args);
+   CU_ASSERT(ret == args.numthrds);
+
+   if (ret != args.numthrds)
+   return;
+
+   /* wait for thread(s) to start */
+   odp_barrier_wait(bar_entry);
+
+   ret = odp_thrmask_worker(mask);
+   CU_ASSERT(ret == odp_thrmask_count(mask));
+   CU_ASSERT(ret == args.numthrds);
+   CU_ASSERT(ret = ODP_CONFIG_MAX_THREADS);
+
+   /* allow thread(s) to exit */
+   odp_barrier_wait(bar_exit);
+
+   odp_cunit_thread_exit(args);
+}
+
+static void thrmask_test_odp_thrmask_control(void)
+{
+   odp_thrmask_t mask;
+   int ret;
+
+   CU_ASSERT(odp_thread_type() == ODP_THREAD_CONTROL);
+
+   /* should start out with 1 worker thread */
+   ret = odp_thrmask_control(mask);
+   CU_ASSERT(ret == odp_thrmask_count(mask));
+   CU_ASSERT(ret == 1);
+}
+
 static CU_TestInfo thrmask_suite[] = {
{odp_thrmask_to/from_str(), thrmask_test_odp_thrmask_to_from_str},
{odp_thrmask_equal(),   thrmask_test_odp_thrmask_equal},
@@ -25,6 +90,8 @@ static CU_TestInfo thrmask_suite[] = {
{odp_thrmask_first(),   thrmask_test_odp_thrmask_first},
{odp_thrmask_last(),thrmask_test_odp_thrmask_last},
{odp_thrmask_next(),thrmask_test_odp_thrmask_next},
+   {odp_thrmask_worker(),  thrmask_test_odp_thrmask_worker},
+   {odp_thrmask_control(), thrmask_test_odp_thrmask_control},
CU_TEST_INFO_NULL,
 };
 
@@ -33,11 +100,6 @@ static CU_SuiteInfo thrmask_suites[] = {
CU_SUITE_INFO_NULL,
 };
 
-unsigned max_supported_num_in_mask(void)
-{
-   return ODP_CONFIG_MAX_THREADS;
-}
-
 int thrmask_main(void)
 {
return odp_cunit_run(thrmask_suites);
-- 
2.1.1

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


[lng-odp] [API-NEXT PATCH 2/6] validation: split out cpumask tests into separate file

2015-07-13 Thread Stuart Haslam
Split the test cases out into a separate file in preparation for
sharing them to perform thrmask tests.

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 test/validation/cpumask/Makefile.am   |   2 +-
 test/validation/cpumask/cpumask.c | 463 +
 test/validation/cpumask/mask_common.c | 470 ++
 test/validation/cpumask/mask_common.h |  28 ++
 4 files changed, 501 insertions(+), 462 deletions(-)
 create mode 100644 test/validation/cpumask/mask_common.c
 create mode 100644 test/validation/cpumask/mask_common.h

diff --git a/test/validation/cpumask/Makefile.am 
b/test/validation/cpumask/Makefile.am
index 61b65ec..da46c5e 100644
--- a/test/validation/cpumask/Makefile.am
+++ b/test/validation/cpumask/Makefile.am
@@ -1,7 +1,7 @@
 include ../Makefile.inc
 
 noinst_LIBRARIES = libcpumask.a
-libcpumask_a_SOURCES = cpumask.c
+libcpumask_a_SOURCES = cpumask.c mask_common.c
 
 bin_PROGRAMS = cpumask_main$(EXEEXT)
 dist_cpumask_main_SOURCES = cpumask_main.c
diff --git a/test/validation/cpumask/cpumask.c 
b/test/validation/cpumask/cpumask.c
index d4daa61..c86a6ee 100644
--- a/test/validation/cpumask/cpumask.c
+++ b/test/validation/cpumask/cpumask.c
@@ -5,473 +5,14 @@
  */
 
 #include odp.h
+
 #include odp_cunit_common.h
 #include cpumask.h
-
-/*
- * The following string are used to build cpu masks with
- * odp_cpumask_from_str(). Both 0x prefixed and non prefixed
- * hex values are supported by odp_cpumask_from_str()
- */
-#define TEST_MASK_NO_CPU  0x0
-#define TEST_MASK_CPU_0   0x1
-#define TEST_MASK_CPU_1   0x2
-#define TEST_MASK_CPU_2   0x4
-#define TEST_MASK_CPU_0_2 0x5
-#define TEST_MASK_CPU_0_3 0x9
-#define TEST_MASK_CPU_1_2 0x6
-#define TEST_MASK_CPU_1_3 0xA
-#define TEST_MASK_CPU_0_1_2   0x7
-#define TEST_MASK_CPU_0_2_4_6 0x55
-#define TEST_MASK_CPU_1_2_4_6 0x56
-
-#define TEST_MASK_CPU_0_NO_PREFIX   1
-
-/* padding pattern used to check buffer overflow: */
-#define FILLING_PATTERN 0x55
+#include mask_common.h
 
 /* default worker paramiter to get all that may be available */
 #define ALL_AVAILABLE 0
 
-/*
- * returns the length of a string, excluding terminating NULL.
- * As its C lib strlen equivalent. Just rewritten here to avoid C lib
- * dependency in ODP tests (for platform independent / bare metal testing)
- */
-static unsigned int stringlen(const char *str)
-{
-   unsigned int i = 0;
-
-   while (str[i] != 0)
-   i++;
-   return i;
-}
-
-/*
- * builds a string containing a 0x prefixed hex number
- * where a single bit (corresponding to cpu) is set.
- * The string is null terminated.
- * cpu_to_str(0) returns 0x1.
- * cpu_to_str(10) returns 0x400.
- * The buffer should be at least ceil(cpu/4)+3 bytes long,
- * to accommodate with 4 cpus per nibble + 0x prefix + null.
- */
-#define CPUS_PER_NIBBLE 4
-static void cpu_to_str(char *buff, int cpu)
-{
-   const char *hex_nibble = 1248;
-   int i = 0;
-
-   buff[i++] = '0';
-   buff[i++] = 'x';
-   buff[i++] = hex_nibble[cpu % CPUS_PER_NIBBLE];
-   while (cpu  3) {
-   buff[i++] = '0';
-   cpu -= CPUS_PER_NIBBLE;
-   }
-   buff[i++] = 0; /* null */
-}
-
-/*
- * returns the mask size to be tested...
- * There is a bit of confusion right now about how to get this,
- * so this is centralized here... in case of change...
- */
-static unsigned int get_max_number_of_cpus_in_a_mask(void)
-{
-   return odp_cpu_count();
-}
-
-static void cpumask_test_odp_cpumask_to_from_str(void)
-{
-   odp_cpumask_t mask;
-   int32_t str_sz;
-   unsigned int buf_sz; /* buf size for the 2 following bufs */
-   char *buf_in;
-   char *buf_out;
-   unsigned int cpu;
-   unsigned int i;
-
-   /* makes sure the mask has room for at least 1 CPU...: */
-   CU_ASSERT_FATAL(get_max_number_of_cpus_in_a_mask()  0);
-
-   /* allocate memory for the buffers containing the mask strings:
-  1 char per nibble, i.e. 1 char per 4 cpus +extra for 0x and null:*/
-   buf_sz = (get_max_number_of_cpus_in_a_mask()  2) + 20;
-   buf_in  = malloc(buf_sz);
-   buf_out = malloc(buf_sz);
-   CU_ASSERT_FATAL(buf_in  buf_out);
-
-   /* test 1 CPU at a time for all possible cpu positions in the mask */
-   for (cpu = 0; cpu  get_max_number_of_cpus_in_a_mask(); cpu++) {
-   /* init buffer for overwrite check: */
-   for (i = 0; i  buf_sz; i++)
-   buf_out[i] = FILLING_PATTERN;
-
-   /* generate a hex string with that cpu set: */
-   cpu_to_str(buf_in, cpu);
-
-   /* generate mask: */
-   odp_cpumask_from_str(mask, buf_in);
-
-   /* reverse cpu mask computation to get string back: */
-   str_sz = odp_cpumask_to_str(mask, buf_out,
-   stringlen(buf_in) + 1);
-
-   /* check that returned size 

Re: [lng-odp] Proposal for packet headroom as an input parameter for initialize pool memory

2015-07-13 Thread Genis Riera
Hi Zoltan, all

Thank you for provide me this information. I'll take a look during this
week.

Regards,

Genís Riera Pérez.

Genís Riera Pérez
Software Engineer at StarFlow Networks
Edifici K2M, S103 c/ Jordi Girona 31
08034 Barcelona

E-mail: gri...@starflownetworks.com

On Mon, Jul 13, 2015 at 3:05 PM, Zoltan Kiss zoltan.k...@linaro.org wrote:

 Hi,

 There is an API now to have user metadata:

 https://git.linaro.org/lng/odp.git/blob/HEAD:/include/odp/api/packet.h#l447

 Zoli


 On 13/07/15 12:00, Genis Riera wrote:

 Since I'm currently taking advantage of it to manage some metadata, I
 think would be interesting to provide some mechanism to set the packet
 headroom/tailrrom size when pool memory is initialized inside an
 application which uses ODP framework


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


[lng-odp] [API-NEXT PATCH 4/6] validation: thrmask: introduce thrmask tests

2015-07-13 Thread Stuart Haslam
Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 configure.ac|  1 +
 platform/linux-generic/test/Makefile.am |  1 +
 test/validation/Makefile.am |  1 +
 test/validation/cpumask/mask_common.h   | 14 ++-
 test/validation/thrmask/.gitignore  |  2 ++
 test/validation/thrmask/Makefile.am | 10 
 test/validation/thrmask/thrmask.c   | 44 +
 test/validation/thrmask/thrmask.h   | 13 ++
 test/validation/thrmask/thrmask_main.c  | 11 +
 9 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/thrmask/.gitignore
 create mode 100644 test/validation/thrmask/Makefile.am
 create mode 100644 test/validation/thrmask/thrmask.c
 create mode 100644 test/validation/thrmask/thrmask.h
 create mode 100644 test/validation/thrmask/thrmask_main.c

diff --git a/configure.ac b/configure.ac
index 2ea1368..636ee4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,6 +319,7 @@ AC_CONFIG_FILES([Makefile
 test/validation/scheduler/Makefile
 test/validation/synchronizers/Makefile
 test/validation/thread/Makefile
+test/validation/thrmask/Makefile
 test/validation/time/Makefile
 test/validation/timer/Makefile
 test/validation/shmem/Makefile
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index 7d1ce1b..bc330b2 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -20,6 +20,7 @@ TESTS = pktio/pktio_run \
${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \

${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \
${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \
+   ${top_builddir}/test/validation/thrmask/thrmask_main$(EXEEXT) \
${top_builddir}/test/validation/time/time_main$(EXEEXT) \
${top_builddir}/test/validation/timer/timer_main$(EXEEXT) \
${top_builddir}/test/validation/shmem/shmem_main$(EXEEXT) \
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 56ddd64..8d564f5 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -12,6 +12,7 @@ ODP_MODULES = buffer \
  scheduler \
  synchronizers \
  thread \
+ thrmask \
  time \
  timer \
  shmem \
diff --git a/test/validation/cpumask/mask_common.h 
b/test/validation/cpumask/mask_common.h
index a8c6ba7..7bb6b1f 100644
--- a/test/validation/cpumask/mask_common.h
+++ b/test/validation/cpumask/mask_common.h
@@ -7,11 +7,23 @@
 #ifndef ODP_MASK_COMMON_H_
 #define ODP_MASK_COMMON_H_
 
+/*
+ * The same set of tests are used for testing both the odp_thrmask_ and
+ * odp_cpumask_ APIs.
+ *
+ * To build the thrmask tests TEST_THRMASK must be defined.
+ */
+#ifdef TEST_THRMASK
+#include thrmask.h
+typedef odp_thrmask_t _odp_mask_t;
+#define MASK_API_PREFIX(n) odp_thrmask_##n
+#define MASK_TESTFUNC(n) void thrmask_test_odp_thrmask_ ## n(void)
+#else
 #include cpumask.h
-
 typedef odp_cpumask_t _odp_mask_t;
 #define MASK_API_PREFIX(n) odp_cpumask_##n
 #define MASK_TESTFUNC(n) void cpumask_test_odp_cpumask_ ## n(void)
+#endif
 
 #define _odp_mask_from_str MASK_API_PREFIX(from_str)
 #define _odp_mask_to_str   MASK_API_PREFIX(to_str)
diff --git a/test/validation/thrmask/.gitignore 
b/test/validation/thrmask/.gitignore
new file mode 100644
index 000..cf7b774
--- /dev/null
+++ b/test/validation/thrmask/.gitignore
@@ -0,0 +1,2 @@
+thrmask_main
+libthrmask.a
diff --git a/test/validation/thrmask/Makefile.am 
b/test/validation/thrmask/Makefile.am
new file mode 100644
index 000..30b82a6
--- /dev/null
+++ b/test/validation/thrmask/Makefile.am
@@ -0,0 +1,10 @@
+include ../Makefile.inc
+
+noinst_LIBRARIES = libthrmask.a
+libthrmask_a_SOURCES = thrmask.c ../cpumask/mask_common.c
+libthrmask_a_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask/
+
+bin_PROGRAMS = thrmask_main$(EXEEXT)
+dist_thrmask_main_SOURCES = thrmask_main.c
+thrmask_main_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask
+thrmask_main_LDADD = libthrmask.a $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/test/validation/thrmask/thrmask.c 
b/test/validation/thrmask/thrmask.c
new file mode 100644
index 000..15d39c3
--- /dev/null
+++ b/test/validation/thrmask/thrmask.c
@@ -0,0 +1,44 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include odp.h
+
+#include odp_cunit_common.h
+#include thrmask.h
+#include mask_common.h
+
+static CU_TestInfo thrmask_suite[] = {
+   {odp_thrmask_to/from_str(), thrmask_test_odp_thrmask_to_from_str},
+   {odp_thrmask_equal(),   thrmask_test_odp_thrmask_equal},
+   {odp_thrmask_zero(),thrmask_test_odp_thrmask_zero},
+   {odp_thrmask_set(),   

[lng-odp] [API-NEXT PATCH 5/6] validation: common: return number of threads created

2015-07-13 Thread Stuart Haslam
odph_linux_pthread_create() now returns the number of threads created,
so modify odp_cunit_thread_create() to do the same.

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 test/validation/common/odp_cunit_common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/validation/common/odp_cunit_common.c 
b/test/validation/common/odp_cunit_common.c
index 807325b..d995ad3 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -29,10 +29,9 @@ int odp_cunit_thread_create(void *func_ptr(void *), 
pthrd_arg *arg)
 
/* Create and init additional threads */
odp_cpumask_def_worker(cpumask, arg-numthrds);
-   odph_linux_pthread_create(thread_tbl, cpumask, func_ptr,
- (void *)arg);
 
-   return 0;
+   return odph_linux_pthread_create(thread_tbl, cpumask, func_ptr,
+(void *)arg);
 }
 
 /** exit from test thread */
-- 
2.1.1

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


[lng-odp] [API-NEXT PATCH 3/6] validation: refactor cpumask tests

2015-07-13 Thread Stuart Haslam
Refactor the cpumask tests a bit so that they may be resused to perform
the thrmask testing.

Signed-off-by: Stuart Haslam stuart.has...@linaro.org
---
 test/validation/cpumask/cpumask.c |   8 +-
 test/validation/cpumask/cpumask.h |   6 +
 test/validation/cpumask/mask_common.c | 521 +-
 test/validation/cpumask/mask_common.h |  55 ++--
 4 files changed, 309 insertions(+), 281 deletions(-)

diff --git a/test/validation/cpumask/cpumask.c 
b/test/validation/cpumask/cpumask.c
index c86a6ee..0f5cd78 100644
--- a/test/validation/cpumask/cpumask.c
+++ b/test/validation/cpumask/cpumask.c
@@ -16,7 +16,7 @@
 static void cpumask_test_odp_cpumask_def_control(void)
 {
int num;
-   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   int max_cpus = mask_capacity();
odp_cpumask_t mask;
 
num = odp_cpumask_def_control(mask, ALL_AVAILABLE);
@@ -28,7 +28,7 @@ static void cpumask_test_odp_cpumask_def_control(void)
 static void cpumask_test_odp_cpumask_def_worker(void)
 {
int num;
-   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   int max_cpus = mask_capacity();
odp_cpumask_t mask;
 
num = odp_cpumask_def_worker(mask, ALL_AVAILABLE);
@@ -41,13 +41,13 @@ static void cpumask_test_odp_cpumask_def(void)
 {
int num_worker;
int num_control;
-   int max_cpus = get_max_number_of_cpus_in_a_mask();
+   int max_cpus = mask_capacity();
odp_cpumask_t mask;
 
num_worker = odp_cpumask_def_worker(mask, max_cpus - 1);
num_control = odp_cpumask_def_control(mask, 1);
 
-   CU_ASSERT((num_control + num_worker) == max_cpus);
+   CU_ASSERT((num_control + num_worker) = max_cpus);
 }
 
 static CU_TestInfo cpumask_suite[] = {
diff --git a/test/validation/cpumask/cpumask.h 
b/test/validation/cpumask/cpumask.h
index c0d19a9..d24ea06 100644
--- a/test/validation/cpumask/cpumask.h
+++ b/test/validation/cpumask/cpumask.h
@@ -4,4 +4,10 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#ifndef _ODP_CPUMASK_TEST_H_
+#define _ODP_CPUMASK_TEST_H_
+
+unsigned max_supported_num_in_mask(void);
 int cpumask_main(void);
+
+#endif
diff --git a/test/validation/cpumask/mask_common.c 
b/test/validation/cpumask/mask_common.c
index 0ed38ff..a2b0386 100644
--- a/test/validation/cpumask/mask_common.c
+++ b/test/validation/cpumask/mask_common.c
@@ -5,27 +5,27 @@
  */
 
 #include odp.h
+
 #include odp_cunit_common.h
 #include mask_common.h
 
 /*
- * The following string are used to build cpu masks with
- * odp_cpumask_from_str(). Both 0x prefixed and non prefixed
- * hex values are supported by odp_cpumask_from_str()
+ * The following strings are used to build masks with odp_*mask_from_str().
+ * Both 0x prefixed and non prefixed hex values are supported.
  */
-#define TEST_MASK_NO_CPU  0x0
-#define TEST_MASK_CPU_0   0x1
-#define TEST_MASK_CPU_1   0x2
-#define TEST_MASK_CPU_2   0x4
-#define TEST_MASK_CPU_0_2 0x5
-#define TEST_MASK_CPU_0_3 0x9
-#define TEST_MASK_CPU_1_2 0x6
-#define TEST_MASK_CPU_1_3 0xA
-#define TEST_MASK_CPU_0_1_2   0x7
-#define TEST_MASK_CPU_0_2_4_6 0x55
-#define TEST_MASK_CPU_1_2_4_6 0x56
-
-#define TEST_MASK_CPU_0_NO_PREFIX   1
+#define TEST_MASK_NONE0x0
+#define TEST_MASK_0   0x1
+#define TEST_MASK_1   0x2
+#define TEST_MASK_2   0x4
+#define TEST_MASK_0_2 0x5
+#define TEST_MASK_0_3 0x9
+#define TEST_MASK_1_2 0x6
+#define TEST_MASK_1_3 0xA
+#define TEST_MASK_0_1_2   0x7
+#define TEST_MASK_0_2_4_6 0x55
+#define TEST_MASK_1_2_4_6 0x56
+
+#define TEST_MASK_0_NO_PREFIX   1
 
 /* padding pattern used to check buffer overflow: */
 #define FILLING_PATTERN 0x55
@@ -45,43 +45,42 @@ static unsigned int stringlen(const char *str)
 }
 
 /*
- * builds a string containing a 0x prefixed hex number
- * where a single bit (corresponding to cpu) is set.
+ * builds a string containing a 0x prefixed hex number where a single bit
+ * (corresponding to a cpu or thread) is set.
  * The string is null terminated.
- * cpu_to_str(0) returns 0x1.
- * cpu_to_str(10) returns 0x400.
- * The buffer should be at least ceil(cpu/4)+3 bytes long,
- * to accommodate with 4 cpus per nibble + 0x prefix + null.
+ * bit_set_str(0) returns 0x1.
+ * bit_set_str(10) returns 0x400.
+ * The buffer should be at least ceil(offs/4)+3 bytes long,
+ * to accommodate with 4 bits per nibble + 0x prefix + null.
  */
-#define CPUS_PER_NIBBLE 4
-static void cpu_to_str(char *buff, int cpu)
+#define BITS_PER_NIBBLE 4
+static void bit_set_str(char *buff, int offs)
 {
const char *hex_nibble = 1248;
int i = 0;
 
buff[i++] = '0';
buff[i++] = 'x';
-   buff[i++] = hex_nibble[cpu % CPUS_PER_NIBBLE];
-   while (cpu  3) {
+   buff[i++] = hex_nibble[offs % BITS_PER_NIBBLE];
+   while (offs  3) {
buff[i++] = '0';
-   cpu -= CPUS_PER_NIBBLE;
+   offs -= BITS_PER_NIBBLE;
}

[lng-odp] [API-NEXT PATCH 2/3] linux-generic: queue: allow for anonymous queues

2015-07-13 Thread Bill Fischofer
Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
---
 platform/linux-generic/odp_queue.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_queue.c 
b/platform/linux-generic/odp_queue.c
index 2546e2b..31d76ef 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -52,7 +52,10 @@ queue_entry_t *get_qentry(uint32_t queue_id)
 static void queue_init(queue_entry_t *queue, const char *name,
   odp_queue_type_t type, odp_queue_param_t *param)
 {
-   strncpy(queue-s.name, name, ODP_QUEUE_NAME_LEN - 1);
+   if (name)
+   strncpy(queue-s.name, name, ODP_QUEUE_NAME_LEN - 1);
+   else
+   memset(queue-s.name, 0, sizeof(queue-s.name));
queue-s.type = type;
 
if (param) {
-- 
2.1.4

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


[lng-odp] [API-NEXT PATCH 3/3] validation: queue: allow for anonymous queues

2015-07-13 Thread Bill Fischofer
Signed-off-by: Bill Fischofer bill.fischo...@linaro.org
---
 test/validation/queue/queue.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index ef7c8f2..480b3aa 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -40,7 +40,7 @@ static int queue_suite_term(void)
 
 static void queue_test_sunnydays(void)
 {
-   odp_queue_t queue_creat_id, queue_id;
+   odp_queue_t queue_creat_id, queue_anon_id, queue_id;
odp_event_t enev[MAX_BUFFER_QUEUE];
odp_event_t deev[MAX_BUFFER_QUEUE];
odp_buffer_t buf;
@@ -52,6 +52,10 @@ static void queue_test_sunnydays(void)
int max_iteration = CONFIG_MAX_ITERATION;
void *prtn = NULL;
 
+   queue_anon_id = odp_queue_create(NULL, ODP_QUEUE_TYPE_POLL, NULL);
+   CU_ASSERT(ODP_QUEUE_INVALID != queue_anon_id);
+   CU_ASSERT(odp_queue_destroy(queue_anon_id) == 0);
+
queue_creat_id = odp_queue_create(test_queue,
  ODP_QUEUE_TYPE_POLL, NULL);
CU_ASSERT(ODP_QUEUE_INVALID != queue_creat_id);
-- 
2.1.4

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