Re: [lng-odp] [PATCH 2/3 v5] linux-generic: odp_timer: warn if tick is late

2015-11-18 Thread Ola Liljedahl
On 10 November 2015 at 15:35, Ivan Khoronzhuk
 wrote:
> If tick is late then application should be warned about this.
> It means that actual timer resolution is worse than expected.
> The default timer resolution is set 10ms, that is equal to jiffy
> on most systems. The default resolution is set bearing in mind
> that on a CPU runs maximum two threads that ideally fits in 10ms.
> But user can change it to be smaller, in case if CPU0 is isolated
> and it handles only the timer ticks. This patch helps user to set
> correct timer resolution.
>
> Signed-off-by: Ivan Khoronzhuk 
> ---
>  platform/linux-generic/odp_timer.c | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/platform/linux-generic/odp_timer.c 
> b/platform/linux-generic/odp_timer.c
> index e8f0267..407ccc1 100644
> --- a/platform/linux-generic/odp_timer.c
> +++ b/platform/linux-generic/odp_timer.c
> @@ -632,7 +632,14 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t 
> tpid, uint64_t tick)
>
>  static void timer_notify(sigval_t sigval)
>  {
> +   int overrun;
> odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
> +
> +   overrun = timer_getoverrun(tp->timerid);
The Linux man page isn't completely clear to me but I assume that this
overrun counter doesn't accumulate over time (then we would get the
message every tick as soon as it occurred once) but that it only count
and returns the numbers of overruns (expiration notifications lost)
since this specific timer expired and the notification was enqueued.

> +   if (overrun)
> +   ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer 
> resolution too high\n",
The timer overruns but ticks are lost. I think you are conflating the
concepts here by writing "ticks overrun". What was wrong with my
"ticks lost on timer pool %s"? Or "POSIX timer overrun(s) on timer
pool %s"?

> +   overrun, tp->name);
> +
>  #ifdef __ARM_ARCH
> odp_timer *array = >timers[0];
> uint32_t i;
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] doc: users-guide: convert to ODP standard layout

2015-11-18 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 doc/users-guide/users-guide.adoc | 101 +--
 1 file changed, 66 insertions(+), 35 deletions(-)

diff --git a/doc/users-guide/users-guide.adoc b/doc/users-guide/users-guide.adoc
index be40d2f..e087696 100644
--- a/doc/users-guide/users-guide.adoc
+++ b/doc/users-guide/users-guide.adoc
@@ -8,13 +8,16 @@ OpenDataPlane (ODP)  Users-Guide
 Abstract
 
 This document is intended to guide a new ODP application developer.
-Further details about ODP may be found at the http://opendataplane.org[ODP] 
home page.
+Further details about ODP may be found at the http://opendataplane.org[ODP] 
home
+page.
 
 .Overview of a system running ODP applications
 image::../images/overview.png[align="center"]
 
-ODP is an API specification that allows many implementations to provide 
platform independence, automatic hardware acceleration and CPU scaling to high 
performance networking  applications.
-This document describes how to write an application that can successfully take 
advantage of the API.
+ODP is an API specification that allows many implementations to provide 
platform
+independence, automatic hardware acceleration and CPU scaling to high
+performance networking  applications. This document describes how to write an
+application that can successfully take advantage of the API.
 
 :numbered:
 == Introduction ==
@@ -422,23 +425,35 @@ goals. Again, the advantage here is that on many 
platforms traffic management
 functions are implemented in hardware, permitting transparent offload of
 this work.
 
-Glossary
-
+== Glossary ==
+
 [glossary]
 odp_worker::
-An opd_worker is a type of odp_thread. It will usually be isolated from 
the scheduling of any host operating system and is intended for fast-path 
processing with a low and predictable latency. Odp_workers will not generally 
receive interrupts and will run to completion.
+An opd_worker is a type of odp_thread. It will usually be isolated from the
+scheduling of any host operating system and is intended for fast-path
+processing with a low and predictable latency. Odp_workers will not
+generally receive interrupts and will run to completion.
 odp_control::
-An odp_control is a type of odp_thread. It will be isolated from the host 
operating system house keeping tasks but will be scheduled by it and may 
receive interrupts.
+An odp_control is a type of odp_thread. It will be isolated from the host
+operating system house keeping tasks but will be scheduled by it and may
+receive interrupts.
 odp_thread::
-An odp_thread is a flow of execution that in a Linux environment could be 
a Linux process or thread.
+An odp_thread is a flow of execution that in a Linux environment could be a
+Linux process or thread.
 event::
 An event is a notification that can be placed in a queue.
 
-The include structure
--
-Applications only include the 'include/odp.h file which includes the 
'platform//include/plat' files to provide a complete 
definition of the API on that platform.
-The doxygen documentation defining the behavior of the ODP API is all 
contained in the public API files, and the actual definitions for an 
implementation will be found in the per platform directories.
-Per-platform data that might normally be a #define can be recovered via the 
appropriate access function if the #define is not directly visible to the 
application.
+== The include structure ==
+
+Applications only include the 'include/odp.h' file which includes the
+'platform//include/plat' files to provide a complete
+definition of the API on that platform.
+The doxygen documentation defining the behavior of the ODP API is all contained
+in the public API files, and the actual definitions for an implementation will
+be found in the per platform directories.
+Per-platform data that might normally be a #define can be recovered via the
+appropriate access function if the #define is not directly visible to the
+application.
 
 .Users include structure
 
@@ -451,21 +466,29 @@ Per-platform data that might normally be a #define can be 
recovered via the appr
 │   └── odp.h   This file should be the only file included by the application.
 
 
-Initialization
---
-IMPORTANT: ODP depends on the application to perform a graceful shutdown, 
calling the terminate functions should only be done when the application is 
sure it has closed the ingress and subsequently drained all queues etc.
+== Initialization ==
+
+IMPORTANT: ODP depends on the application to perform a graceful shutdown,
+calling the terminate functions should only be done when the application is 
sure
+it has closed the ingress and subsequently drained all queues etc.
+
+=== Startup ===
 
-Startup
-
 The first API that must be called is 'odp_init_global()'.
-This takes two pointers, odp_init_t contains ODP initialization data that is 
platform independent 

[lng-odp] [PATCH] validation: pktio: test batch receive

2015-11-18 Thread Stuart Haslam
Modify the tests that currently transmit packets in batches to also
receive packets in batches. This adds coverage of odp_queue_deq_multi()
and odp_schedule_multi() specifically against a packet input queue,
as this doesn't get tested anywhere else in the validation suite.

Signed-off-by: Stuart Haslam 
---
 test/validation/pktio/pktio.c | 137 +-
 1 file changed, 68 insertions(+), 69 deletions(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 41106b0..9cccaf2 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -137,7 +137,7 @@ static uint32_t pktio_pkt_seq(odp_packet_t pkt)
pkt_tail_t tail;
 
if (pkt == ODP_PACKET_INVALID)
-   return -1;
+   return TEST_SEQ_INVALID;
 
off = odp_packet_l4_offset(pkt);
if (off ==  ODP_PACKET_OFFSET_INVALID)
@@ -330,68 +330,76 @@ static int destroy_inq(odp_pktio_t pktio)
return odp_queue_destroy(inq);
 }
 
-static odp_event_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns)
+static int get_packets(pktio_info_t *pktio_rx, odp_packet_t pkt_tbl[], int num)
 {
-   uint64_t start, now, diff;
-   odp_event_t ev;
+   odp_event_t evt_tbl[num];
+   int num_evts = 0;
+   int num_pkts = 0;
+   int i;
 
-   start = odp_time_cycles();
+   if (pktio_rx->in_mode == ODP_PKTIN_MODE_RECV)
+   return odp_pktio_recv(pktio_rx->id, pkt_tbl, num);
 
-   do {
-   ev = odp_queue_deq(queue);
-   if (ev != ODP_EVENT_INVALID)
-   return ev;
-   now = odp_time_cycles();
-   diff = odp_time_diff_cycles(start, now);
-   } while (odp_time_cycles_to_ns(diff) < ns);
+   if (num > 1) {
+   if (pktio_rx->in_mode == ODP_PKTIN_MODE_POLL)
+   num_evts = odp_queue_deq_multi(pktio_rx->inq, evt_tbl,
+  num);
+   else
+   num_evts = odp_schedule_multi(NULL, ODP_SCHED_NO_WAIT,
+ evt_tbl, num);
+   } else {
+   odp_event_t evt_tmp;
+
+   if (pktio_rx->in_mode == ODP_PKTIN_MODE_POLL)
+   evt_tmp = odp_queue_deq(pktio_rx->inq);
+   else
+   evt_tmp = odp_schedule(NULL, ODP_SCHED_NO_WAIT);
+
+   if (evt_tmp != ODP_EVENT_INVALID)
+   evt_tbl[num_evts++] = evt_tmp;
+   }
+
+   /* convert events to packets, discarding any non-packet events */
+   for (i = 0; i < num_evts; ++i) {
+   if (odp_event_type(evt_tbl[i]) == ODP_EVENT_PACKET)
+   pkt_tbl[num_pkts++] = odp_packet_from_event(evt_tbl[i]);
+   else
+   odp_event_free(evt_tbl[i]);
+   }
 
-   return ODP_EVENT_INVALID;
+   return num_pkts;
 }
 
-static odp_packet_t wait_for_packet(pktio_info_t *pktio_rx,
-   uint32_t seq, uint64_t ns)
+static int wait_for_packets(pktio_info_t *pktio_rx, odp_packet_t pkt_tbl[],
+   uint32_t seq_tbl[], int num, uint64_t ns)
 {
uint64_t start, now, diff;
-   odp_event_t ev;
-   odp_packet_t pkt;
-   uint64_t wait;
+   int num_rx = 0;
+   int i;
+   odp_packet_t pkt_tmp[num];
 
start = odp_time_cycles();
-   wait = odp_schedule_wait_time(ns);
 
do {
-   pkt = ODP_PACKET_INVALID;
-
-   if (pktio_rx->in_mode == ODP_PKTIN_MODE_RECV) {
-   odp_pktio_recv(pktio_rx->id, , 1);
-   } else {
-   if (pktio_rx->in_mode == ODP_PKTIN_MODE_POLL)
-   ev = queue_deq_wait_time(pktio_rx->inq, ns);
-   else
-   ev = odp_schedule(NULL, wait);
-
-   if (ev != ODP_EVENT_INVALID) {
-   if (odp_event_type(ev) == ODP_EVENT_PACKET)
-   pkt = odp_packet_from_event(ev);
-   else
-   odp_event_free(ev);
-   }
-   }
+   int n = get_packets(pktio_rx, pkt_tmp, num);
 
-   if (pkt != ODP_PACKET_INVALID) {
-   if (pktio_pkt_seq(pkt) == seq)
-   return pkt;
+   if (n < 0)
+   break;
 
-   odp_packet_free(pkt);
+   for (i = 0; i < n; ++i) {
+   if (pktio_pkt_seq(pkt_tmp[i]) == seq_tbl[num_rx]) {
+   pkt_tbl[num_rx++] = pkt_tmp[i];
+   num--;
+   } else {
+   odp_packet_free(pkt_tmp[i]);
+   }

Re: [lng-odp] [PATCH 1/3 v3] example: timer: warn if timeout less than resolution

2015-11-18 Thread Ola Liljedahl
On 10 November 2015 at 15:35, Ivan Khoronzhuk
 wrote:
> The period shouldn't be less than timer resolution. If it's less
> there is no guarantee about timeout accuracy, it can be executed
> right after setting it or after up to timer resolution timeout or
> even be set late, in which case application will be stopped with
> error. So it's better to warn user that timeout is less then
> resolution instead of silence.
>
> Signed-off-by: Ivan Khoronzhuk 
Reviewed-by: Ola Liljedahl 

> ---
>  example/timer/odp_timer_test.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
> index 94619e4..aee01c8 100644
> --- a/example/timer/odp_timer_test.c
> +++ b/example/timer/odp_timer_test.c
> @@ -311,6 +311,9 @@ static void parse_args(int argc, char *argv[], 
> test_args_t *args)
> break;
> }
> }
> +
> +   if (args->period_us < args->resolution_us)
> +   printf("\n\tWarn: timeout is set less then resolution\n");
You could also warn if the timeout is not an (integer) multiple of the
resolution but that is less of a problem.

>  }
>
>
> --
> 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] [PATCHv2 2/2] doc: userguide: add baseline overview to document

2015-11-18 Thread Bill Fischofer
On that subject, I was just discussing with Mike this morning how Asciidoc
support include structures, so it's probably reasonable to put things like
a glossary into its own file that can be maintained separately and included
in the main
doc.

On Wed, Nov 18, 2015 at 9:53 AM, Bill Fischofer 
wrote:

> Thanks.  The glossary is part of the base document and not covered by this
> patch.  The intent is to start improving the document on an incremental
> basis to keep the size of individual patches manageable.  Much more will
> follow as we restructure and fill in this document.
>
> On Wed, Nov 18, 2015 at 9:38 AM, Stuart Haslam 
> wrote:
>
>> On Wed, Nov 18, 2015 at 03:30:31PM +, Stuart Haslam wrote:
>> > On Tue, Nov 17, 2015 at 11:15:14AM -0600, Bill Fischofer wrote:
>> > > Add a basic ODP overview to the User's Guide, providing
>> > > an overview of ODP concepts, components, etc. Included
>> > > are a number of diagrams covering component structure
>> > > as well as packet RX, event scheduling, and packet TX
>> > > processing.
>> > >
>> > > Signed-off-by: Bill Fischofer 
>> >
>> > Looks good to me. Mostly just typo comments below.
>> >
>>
>> Sorry just realised I reviewed v2 and you've sent v4 with the typos
>> fixed. The comment about the glossary is still valid though.
>>
>> --
>> Stuart.
>>
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] CONTRIBUTING: add user doc guidelines

2015-11-18 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 CONTRIBUTING | 33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/CONTRIBUTING b/CONTRIBUTING
index 75fb711..4ad964e 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -7,7 +7,8 @@ Table of content:
 2. ODP patch expectations as an  open source project
 3. Common Errors in Patch and Commit Messages
 4. Documenting the code
-5. References
+5. Documenting the user docs
+6. References
 
 1. New Development
 --
@@ -103,7 +104,35 @@ Code without a proper signoff cannot be merged into the 
mainline.
 - Functions return values should all be specified using @return or @retval
 - There should be no doxygen warnings or errors generated.
 
-5. References
+5. Documenting the user docs
+
+- Users guides are stored in asciidoc format in the odp/docs directory and in
+  sub directories of it as appropriate.
+- ODP code references such as types and enums are highlighted using the
+  + syntax. For example text referring to the type odp_pktio_t would decorate 
the
+  type thus:-
++odp_pktio_t+
+- Section heading use the = syntax. For example:-
+== Level 1
+Text.
+
+=== Level 2
+Text.
+- Code and scripting excerpts are decorated with the block syntax:-
+.Optional Title
+[source,perl]
+
+
+
+- Images are decorated with :-
+.Optional Title
+image::../images/.png[align="center"]
+- The images are stored in the doc/images directory as svg files and rendered 
as
+  png and eps during the build process.
+- Body text shall wrap at the 80 char point.
+- No warnings may be generated by the asciidoc tool.
+
+6. References
 -
 [1] 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/CodingStyle
 [2] http://ldn.linuxfoundation.org/book/how-participate-linux-community
-- 
2.5.0

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


[lng-odp] [API-NEXT PATCH] api: init: allow implementation to use private ways for its own configuration

2015-11-18 Thread Zoltan Kiss
This could help the existing configuration methods to be used if the
application prefers that. The platform_params should always supersede that
though.

Signed-off-by: Zoltan Kiss 

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 737ff6d..24f4f3a 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -141,6 +141,9 @@ typedef struct odp_platform_init_t {
  *
  * This function must be called once before calling any other ODP API
  * functions.
+ * The underlying implementation may have another way to get configuration
+ * related to platform_params (e.g. environmental variable, configuration
+ * file), but if the application passes it, it should always supersede.
  *
  * @param params  Those parameters that are interpreted by the ODP API.
  *Use NULL to set all parameters to their defaults.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] validation: scheduler: add missing ticketlock unlock

2015-11-18 Thread Bill Fischofer
On Wed, Nov 18, 2015 at 9:47 AM, Stuart Haslam 
wrote:

> The scheduler validation test occasionally deadlocks due to a missing
> ticketlock unlock.
>
> Signed-off-by: Stuart Haslam 
>

Reviewed-by: Bill Fischofer 


> ---
>  test/validation/scheduler/scheduler.c | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/test/validation/scheduler/scheduler.c
> b/test/validation/scheduler/scheduler.c
> index f8effb3..2bd180c 100644
> --- a/test/validation/scheduler/scheduler.c
> +++ b/test/validation/scheduler/scheduler.c
> @@ -593,6 +593,7 @@ static void *schedule_common_(void *arg)
> queue_context *qctx;
> buf_contents *bctx, *bctx_cpy;
> odp_pool_t pool;
> +   int locked;
>
> globals = args->globals;
> sync = args->sync;
> @@ -608,7 +609,6 @@ static void *schedule_common_(void *arg)
> odp_buffer_t buf, buf_cpy;
> odp_queue_t from = ODP_QUEUE_INVALID;
> int num = 0;
> -   int locked;
>
> odp_ticketlock_lock(>lock);
> if (globals->buf_count == 0) {
> @@ -747,9 +747,12 @@ static void *schedule_common_(void *arg)
> if (args->num_workers > 1)
> odp_barrier_wait(>barrier);
>
> -   if (sync == ODP_SCHED_SYNC_ORDERED &&
> -   odp_ticketlock_trylock(>lock) &&
> -   globals->buf_count_cpy > 0) {
> +   if (sync == ODP_SCHED_SYNC_ORDERED)
> +   locked = odp_ticketlock_trylock(>lock);
> +   else
> +   locked = 0;
> +
> +   if (locked && globals->buf_count_cpy > 0) {
> odp_event_t ev;
> odp_queue_t pq;
> uint64_t seq;
> @@ -787,9 +790,11 @@ static void *schedule_common_(void *arg)
> }
> CU_ASSERT(bcount == buf_count);
> globals->buf_count_cpy = 0;
> -   odp_ticketlock_unlock(>lock);
> }
>
> +   if (locked)
> +   odp_ticketlock_unlock(>lock);
> +
> return NULL;
>  }
>
> --
> 2.1.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCHv2 2/2] doc: userguide: add baseline overview to document

2015-11-18 Thread Stuart Haslam
On Wed, Nov 18, 2015 at 03:30:31PM +, Stuart Haslam wrote:
> On Tue, Nov 17, 2015 at 11:15:14AM -0600, Bill Fischofer wrote:
> > Add a basic ODP overview to the User's Guide, providing
> > an overview of ODP concepts, components, etc. Included
> > are a number of diagrams covering component structure
> > as well as packet RX, event scheduling, and packet TX
> > processing.
> > 
> > Signed-off-by: Bill Fischofer 
> 
> Looks good to me. Mostly just typo comments below.
> 

Sorry just realised I reviewed v2 and you've sent v4 with the typos
fixed. The comment about the glossary is still valid though.

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


[lng-odp] [PATCH] doc: implementers-guide: convert to ODP standard layout

2015-11-18 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 doc/implementers-guide/implementers-guide.adoc | 265 +
 1 file changed, 185 insertions(+), 80 deletions(-)

diff --git a/doc/implementers-guide/implementers-guide.adoc 
b/doc/implementers-guide/implementers-guide.adoc
index 0033ba3..8b9c729 100644
--- a/doc/implementers-guide/implementers-guide.adoc
+++ b/doc/implementers-guide/implementers-guide.adoc
@@ -11,9 +11,11 @@ Further details about ODP may be found at 
http://opendataplane.org[ODP homepage]
 
 
 :numbered:
-The include structure
--
-The implementers view of the include source tree allows the common API 
definitions and documentation to be reused by all the platforms defined in the 
tree, but leave the actual definitions to be defined by the specific platform.
+== The include structure ==
+
+The implementers view of the include source tree allows the common API
+definitions and documentation to be reused by all the platforms defined in the
+tree, but leave the actual definitions to be defined by the specific platform.
 
 .Implementers include structure
 
@@ -29,94 +31,145 @@ The implementers view of the include source tree allows 
the common API definitio
 │   ├── /
 │   │   ├── include/
 │   │   │   ├── odp/
-│   │   │   │   ├── In-line function definitions of the public API for this 
platform
-│   │   │   │   │   seen by the applicationx.
+│   │   │   │   ├── In-line function definitions of the public API for this
+│   │   │   │   │   platform seen by the application.
 │   │   │   │   │
 │   │   │   │   └── plat/
-│   │   │   │       └── Platform specific types, enums etc as seen by the 
application
-│   │   │   │   but require overriding by the implementation.
+│   │   │   │       └── Platform specific types, enums etc as seen by the
+│   │   │   │   application but require overriding by the
+│   │   │   │   implementation.
 │   │   │   │  
 │   │   │   └── Internal header files seen only by the implementation.
 
 
-The doxygen description of the API definition is held in the public api file 
'include/odp/api'.
-This file is included by a counterpart in 'platform//include/odp'.
-The include of the public API is AFTER the platform specific definitions to 
allow the platform to provide definitions that match the underlying hardware.
-The implementation code includes 'platform//include/plat' 
and this then provides the source files with a complete definition the ODP API 
to be implemented.
-Applications in turn include the include/odp.h file which includes the 
'platform//include/plat' files to provide a complete 
definition of the API.
+The doxygen description of the API definition is held in the public api file
+'include/odp/api'.
+This file is included by a counterpart in
+'platform//include/odp'.
+The include of the public API is AFTER the platform specific definitions to
+allow the platform to provide definitions that match the underlying hardware.
+The implementation code includes 'platform//include/plat'
+and this then provides the source files with a complete definition the ODP API
+to be implemented.
+Applications in turn include the include/odp.h file which includes the
+'platform//include/plat' files to provide a complete
+definition of the API.
 
-The validation Suite
-
-ODP provides a comprehensive set of API validation tests that are intended to 
be used by implementers during development and by application developers to 
verify that a particular implementation meets their requirements.
+== The validation Suite ==
+
+ODP provides a comprehensive set of API validation tests that are intended to 
be
+used by implementers during development and by application developers to verify
+that a particular implementation meets their requirements.
 
 The list of these tests is expected to grow as ODP grows.
 
-The list of test executables is run by the automake test harness, when running 
"make check".
-Therefore, as required by this harness, each executable should return 0 on 
success (tests passed), 77 on inconclusive, or any other values on failure.
-The automake functionality shows a status line (PASSED/FAIL...) for each of 
the ran test executables.
+The list of test executables is run by the automake test harness, when running
+"make check".
+Therefore, as required by this harness, each executable should return 0 on
+success (tests passed), 77 on inconclusive, or any other values on failure.
+The automake functionality shows a status line (PASSED/FAIL...) for each of the
+ran test executables.
 
-It is expected that ODP developers will need to run tests as early as possible 
in the development cycle, before all APIs have been implemented.
-Besides, although there are no APIs that are formally listed as optional, it 
is also expected that there may be cases where a subset of APIs remain 
unimplemented on a particular platform.
-Moreover, some platforms may require specific 

Re: [lng-odp] [PATCH] platform: move list of API files to Makefile.inc so it is common to all platforms

2015-11-18 Thread Mike Holmes
On 12 November 2015 at 09:22, Nicolas Morey-Chaisemartin 
wrote:

> Signed-off-by: Nicolas Morey-Chaisemartin 
>

Reviewed-by: Mike Holmes 


> ---
>  platform/Makefile.inc  | 39
> ++
>  platform/linux-generic/Makefile.am | 39
> --
>  2 files changed, 39 insertions(+), 39 deletions(-)
>
> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
> index 8e8e97b..14e134c 100644
> --- a/platform/Makefile.inc
> +++ b/platform/Makefile.inc
> @@ -15,3 +15,42 @@ AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>  GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh $(top_srcdir)`
>  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
>  AM_CFLAGS += -DPLATFORM=${with_platform}
> +
> +odpapiincludedir= $(includedir)/odp/api
> +odpapiinclude_HEADERS = \
> + $(top_srcdir)/include/odp/api/align.h \
> + $(top_srcdir)/include/odp/api/atomic.h \
> + $(top_srcdir)/include/odp/api/barrier.h \
> + $(top_srcdir)/include/odp/api/buffer.h \
> + $(top_srcdir)/include/odp/api/byteorder.h \
> + $(top_srcdir)/include/odp/api/classification.h \
> + $(top_srcdir)/include/odp/api/compiler.h \
> + $(top_srcdir)/include/odp/api/config.h \
> + $(top_srcdir)/include/odp/api/cpu.h \
> + $(top_srcdir)/include/odp/api/cpumask.h \
> + $(top_srcdir)/include/odp/api/crypto.h \
> + $(top_srcdir)/include/odp/api/debug.h \
> + $(top_srcdir)/include/odp/api/errno.h \
> + $(top_srcdir)/include/odp/api/event.h \
> + $(top_srcdir)/include/odp/api/hints.h \
> + $(top_srcdir)/include/odp/api/init.h \
> + $(top_srcdir)/include/odp/api/packet.h \
> + $(top_srcdir)/include/odp/api/packet_flags.h \
> + $(top_srcdir)/include/odp/api/packet_io.h \
> + $(top_srcdir)/include/odp/api/pool.h \
> + $(top_srcdir)/include/odp/api/queue.h \
> + $(top_srcdir)/include/odp/api/random.h \
> + $(top_srcdir)/include/odp/api/rwlock.h \
> + $(top_srcdir)/include/odp/api/schedule.h \
> + $(top_srcdir)/include/odp/api/schedule_types.h \
> + $(top_srcdir)/include/odp/api/shared_memory.h \
> + $(top_srcdir)/include/odp/api/spinlock.h \
> + $(top_srcdir)/include/odp/api/std_types.h \
> + $(top_srcdir)/include/odp/api/sync.h \
> + $(top_srcdir)/include/odp/api/system_info.h \
> + $(top_srcdir)/include/odp/api/thread.h \
> + $(top_srcdir)/include/odp/api/thrmask.h \
> + $(top_srcdir)/include/odp/api/ticketlock.h \
> + $(top_srcdir)/include/odp/api/time.h \
> + $(top_srcdir)/include/odp/api/timer.h \
> + $(top_srcdir)/include/odp/api/version.h
> \ No newline at end of file
> diff --git a/platform/linux-generic/Makefile.am
> b/platform/linux-generic/Makefile.am
> index 0135947..610e04d 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -73,45 +73,6 @@ odpplatinclude_HEADERS = \
>   $(srcdir)/include/odp/plat/timer_types.h \
>   $(srcdir)/include/odp/plat/version_types.h
>
> -odpapiincludedir= $(includedir)/odp/api
> -odpapiinclude_HEADERS = \
> - $(top_srcdir)/include/odp/api/align.h \
> - $(top_srcdir)/include/odp/api/atomic.h \
> - $(top_srcdir)/include/odp/api/barrier.h \
> - $(top_srcdir)/include/odp/api/buffer.h \
> - $(top_srcdir)/include/odp/api/byteorder.h \
> - $(top_srcdir)/include/odp/api/classification.h \
> - $(top_srcdir)/include/odp/api/compiler.h \
> - $(top_srcdir)/include/odp/api/config.h \
> - $(top_srcdir)/include/odp/api/cpu.h \
> - $(top_srcdir)/include/odp/api/cpumask.h \
> - $(top_srcdir)/include/odp/api/crypto.h \
> - $(top_srcdir)/include/odp/api/debug.h \
> - $(top_srcdir)/include/odp/api/errno.h \
> - $(top_srcdir)/include/odp/api/event.h \
> - $(top_srcdir)/include/odp/api/hints.h \
> - $(top_srcdir)/include/odp/api/init.h \
> - $(top_srcdir)/include/odp/api/packet.h \
> - $(top_srcdir)/include/odp/api/packet_flags.h \
> - $(top_srcdir)/include/odp/api/packet_io.h \
> - $(top_srcdir)/include/odp/api/pool.h \
> - $(top_srcdir)/include/odp/api/queue.h \
> - $(top_srcdir)/include/odp/api/random.h \
> - 

Re: [lng-odp] [PATCH 2/3 v5] linux-generic: odp_timer: warn if tick is late

2015-11-18 Thread Ivan Khoronzhuk



On 18.11.15 19:37, Ola Liljedahl wrote:

On 10 November 2015 at 15:35, Ivan Khoronzhuk
 wrote:

If tick is late then application should be warned about this.
It means that actual timer resolution is worse than expected.
The default timer resolution is set 10ms, that is equal to jiffy
on most systems. The default resolution is set bearing in mind
that on a CPU runs maximum two threads that ideally fits in 10ms.
But user can change it to be smaller, in case if CPU0 is isolated
and it handles only the timer ticks. This patch helps user to set
correct timer resolution.

Signed-off-by: Ivan Khoronzhuk 
---
  platform/linux-generic/odp_timer.c | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/platform/linux-generic/odp_timer.c 
b/platform/linux-generic/odp_timer.c
index e8f0267..407ccc1 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -632,7 +632,14 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t 
tpid, uint64_t tick)

  static void timer_notify(sigval_t sigval)
  {
+   int overrun;
 odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr;
+
+   overrun = timer_getoverrun(tp->timerid);

The Linux man page isn't completely clear to me but I assume that this
overrun counter doesn't accumulate over time (then we would get the

I assume that it can accumulate but handle them one by one. Thus when
3 tick where not delivered in time, it will handle it 3 times one by one 
equaling it to 0.
It can lead to burst of ticks. Even in this case they cannot be accumulated as 
the main reason
why they were late is process yielding and after process is awaken it handles 
all late
ticks in a queue. Even in case the ticks are not in the queue we have requested 
timer
resolution more than system can allow and it shows in how much it should be 
tuned and after read it = 0.
I've tested it.


message every tick as soon as it occurred once) but that it only count
and returns the numbers of overruns (expiration notifications lost)
since this specific timer expired and the notification was enqueued.


+   if (overrun)
+   ODP_ERR("\n\t%d ticks overrun on timer pool \"%s\", timer resolution 
too high\n",

The timer overruns but ticks are lost. I think you are conflating the

yes


concepts here by writing "ticks overrun". What was wrong with my
"ticks lost on timer pool %s"? Or "POSIX timer overrun(s) on timer
pool %s"?


There is no description they are lost or not. Thus in some case they can be in 
queue.
Or some amount can be in the queue and other can be lost (due to limitations).
So I cannot say that they are all lost or all late, and here no need in it.
Here it's used only as indicator that resolution is incorrect and print 
evaluation number
in how much it's should be tuned.




+   overrun, tp->name);
+
  #ifdef __ARM_ARCH
 odp_timer *array = >timers[0];
 uint32_t i;
--
1.9.1

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


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


Re: [lng-odp] [PATCH 3/3 v3] linux-generic: cpumask: warn that CPU0 is used by control and worker thread

2015-11-18 Thread Ola Liljedahl
On 18 November 2015 at 18:09, Ivan Khoronzhuk
 wrote:
> 3patch
>
> On 10.11.15 17:36, Ivan Khoronzhuk wrote:
>>
>> By default all control threads on CPU0, and odp_cpumask_default_control
By default, all control threads execute on CPU 0 and
odp_cpumask_default_control()
return this CPU. For reasons of performance, control and worker CPU's shouldn't
overlap but for some scenarios it can be desirable to utilize all
CPU's for worker threads.
Thus we leave the decision of CPU allocation to the user but report
when a CPU is
used for both control and worker threads.

>> returns it. It shouldn't overlap with worker cpumask, but for some
>> cases it's correct to use potential processing capability, so better
>> leave this choice to application and only draw attention to it when
>> cpumask for worker thread is read.
>>
>> Signed-off-by: Ivan Khoronzhuk 
Apart from the language, the patch is OK. But I would prefer an update
with rephrased description and ODP_DBG message.

>> ---
>>   platform/linux-generic/odp_cpumask_task.c | 4 
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/platform/linux-generic/odp_cpumask_task.c
>> b/platform/linux-generic/odp_cpumask_task.c
>> index 535891c..b4b4f23 100644
>> --- a/platform/linux-generic/odp_cpumask_task.c
>> +++ b/platform/linux-generic/odp_cpumask_task.c
>> @@ -40,6 +40,10 @@ int odp_cpumask_default_worker(odp_cpumask_t *mask, int
>> num)
>> }
>> }
>>
>> +   if (odp_cpumask_isset(mask, 0))
>> +   ODP_DBG("\n\tCPU0 will be used for control and worker
>> thread.\n"
>> +   "\tIt can have impact on worker thread\n");
I would phrase it like this:
"CPU 0 will be used for both control and worker threads, this will
likely have a performance impact on the worker thread\n"

>> +
>> return cpu;
>>   }
>>
>>
>
> --
> Regards,
> Ivan Khoronzhuk
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] doc: users-guide: convert to ODP standard layout

2015-11-18 Thread Bill Fischofer
Another reason to merge these since I have further updates I'd like to
submit but don't want to get into a tower of babel set of patches.

BTW, my base patch still needs a reviewed-by

On Wed, Nov 18, 2015 at 1:56 PM, Mike Holmes  wrote:

> Thanks, unless Maxim needs it I wont resend.
>
> On 18 November 2015 at 14:53, Bill Fischofer 
> wrote:
>
>> Looks like this patch needs to be applied on top of my patch to the user
>> guide.  Other than that:
>>
>> On Wed, Nov 18, 2015 at 11:03 AM, Mike Holmes 
>> wrote:
>>
>>> Signed-off-by: Mike Holmes 
>>>
>>
>> Reviewed-and-tested-by: Bill Fischofer 
>>
>>
>>> ---
>>>  doc/users-guide/users-guide.adoc | 101
>>> +--
>>>  1 file changed, 66 insertions(+), 35 deletions(-)
>>>
>>> diff --git a/doc/users-guide/users-guide.adoc
>>> b/doc/users-guide/users-guide.adoc
>>> index be40d2f..e087696 100644
>>> --- a/doc/users-guide/users-guide.adoc
>>> +++ b/doc/users-guide/users-guide.adoc
>>> @@ -8,13 +8,16 @@ OpenDataPlane (ODP)  Users-Guide
>>>  Abstract
>>>  
>>>  This document is intended to guide a new ODP application developer.
>>> -Further details about ODP may be found at the http://opendataplane.org[ODP]
>>> home page.
>>> +Further details about ODP may be found at the http://opendataplane.org[ODP]
>>> home
>>> +page.
>>>
>>>  .Overview of a system running ODP applications
>>>  image::../images/overview.png[align="center"]
>>>
>>> -ODP is an API specification that allows many implementations to provide
>>> platform independence, automatic hardware acceleration and CPU scaling to
>>> high performance networking  applications.
>>> -This document describes how to write an application that can
>>> successfully take advantage of the API.
>>> +ODP is an API specification that allows many implementations to provide
>>> platform
>>> +independence, automatic hardware acceleration and CPU scaling to high
>>> +performance networking  applications. This document describes how to
>>> write an
>>> +application that can successfully take advantage of the API.
>>>
>>>  :numbered:
>>>  == Introduction ==
>>> @@ -422,23 +425,35 @@ goals. Again, the advantage here is that on many
>>> platforms traffic management
>>>  functions are implemented in hardware, permitting transparent offload of
>>>  this work.
>>>
>>> -Glossary
>>> -
>>> +== Glossary ==
>>> +
>>>  [glossary]
>>>  odp_worker::
>>> -An opd_worker is a type of odp_thread. It will usually be isolated
>>> from the scheduling of any host operating system and is intended for
>>> fast-path processing with a low and predictable latency. Odp_workers will
>>> not generally receive interrupts and will run to completion.
>>> +An opd_worker is a type of odp_thread. It will usually be isolated
>>> from the
>>> +scheduling of any host operating system and is intended for
>>> fast-path
>>> +processing with a low and predictable latency. Odp_workers will not
>>> +generally receive interrupts and will run to completion.
>>>  odp_control::
>>> -An odp_control is a type of odp_thread. It will be isolated from
>>> the host operating system house keeping tasks but will be scheduled by it
>>> and may receive interrupts.
>>> +An odp_control is a type of odp_thread. It will be isolated from
>>> the host
>>> +operating system house keeping tasks but will be scheduled by it
>>> and may
>>> +receive interrupts.
>>>  odp_thread::
>>> -An odp_thread is a flow of execution that in a Linux environment
>>> could be a Linux process or thread.
>>> +An odp_thread is a flow of execution that in a Linux environment
>>> could be a
>>> +Linux process or thread.
>>>  event::
>>>  An event is a notification that can be placed in a queue.
>>>
>>> -The include structure
>>> --
>>> -Applications only include the 'include/odp.h file which includes the
>>> 'platform//include/plat' files to provide a complete
>>> definition of the API on that platform.
>>> -The doxygen documentation defining the behavior of the ODP API is all
>>> contained in the public API files, and the actual definitions for an
>>> implementation will be found in the per platform directories.
>>> -Per-platform data that might normally be a #define can be recovered via
>>> the appropriate access function if the #define is not directly visible to
>>> the application.
>>> +== The include structure ==
>>> +
>>> +Applications only include the 'include/odp.h' file which includes the
>>> +'platform//include/plat' files to provide a
>>> complete
>>> +definition of the API on that platform.
>>> +The doxygen documentation defining the behavior of the ODP API is all
>>> contained
>>> +in the public API files, and the actual definitions for an
>>> implementation will
>>> +be found in the per platform directories.
>>> +Per-platform data that might normally be a #define 

Re: [lng-odp] [PATCH] doc: implementers-guide: convert to ODP standard layout

2015-11-18 Thread Bill Fischofer
This patch won't apply for me on any branch (master, next, or api-next).
Needs a rebase?

Bill

On Wed, Nov 18, 2015 at 12:09 PM, Mike Holmes 
wrote:

> Signed-off-by: Mike Holmes 
> ---
>  doc/implementers-guide/implementers-guide.adoc | 265
> +
>  1 file changed, 185 insertions(+), 80 deletions(-)
>
> diff --git a/doc/implementers-guide/implementers-guide.adoc
> b/doc/implementers-guide/implementers-guide.adoc
> index 0033ba3..8b9c729 100644
> --- a/doc/implementers-guide/implementers-guide.adoc
> +++ b/doc/implementers-guide/implementers-guide.adoc
> @@ -11,9 +11,11 @@ Further details about ODP may be found at
> http://opendataplane.org[ODP homepage]
>
>
>  :numbered:
> -The include structure
> --
> -The implementers view of the include source tree allows the common API
> definitions and documentation to be reused by all the platforms defined in
> the tree, but leave the actual definitions to be defined by the specific
> platform.
> +== The include structure ==
> +
> +The implementers view of the include source tree allows the common API
> +definitions and documentation to be reused by all the platforms defined
> in the
> +tree, but leave the actual definitions to be defined by the specific
> platform.
>
>  .Implementers include structure
>  
> @@ -29,94 +31,145 @@ The implementers view of the include source tree
> allows the common API definitio
>  │   ├── /
>  │   │   ├── include/
>  │   │   │   ├── odp/
> -│   │   │   │   ├── In-line function definitions of the public API for
> this platform
> -│   │   │   │   │   seen by the applicationx.
> +│   │   │   │   ├── In-line function definitions of the public API for
> this
> +│   │   │   │   │   platform seen by the application.
>  │   │   │   │   │
>  │   │   │   │   └── plat/
> -│   │   │   │   └── Platform specific types, enums etc as seen by the
> application
> -│   │   │   │   but require overriding by the implementation.
> +│   │   │   │   └── Platform specific types, enums etc as seen by the
> +│   │   │   │   application but require overriding by the
> +│   │   │   │   implementation.
>  │   │   │   │
>  │   │   │   └── Internal header files seen only by the implementation.
>  
>
> -The doxygen description of the API definition is held in the public api
> file 'include/odp/api'.
> -This file is included by a counterpart in 'platform/ name>/include/odp'.
> -The include of the public API is AFTER the platform specific definitions
> to allow the platform to provide definitions that match the underlying
> hardware.
> -The implementation code includes 'platform/ name>/include/plat' and this then provides the source files with a complete
> definition the ODP API to be implemented.
> -Applications in turn include the include/odp.h file which includes the
> 'platform//include/plat' files to provide a complete
> definition of the API.
> +The doxygen description of the API definition is held in the public api
> file
> +'include/odp/api'.
> +This file is included by a counterpart in
> +'platform//include/odp'.
> +The include of the public API is AFTER the platform specific definitions
> to
> +allow the platform to provide definitions that match the underlying
> hardware.
> +The implementation code includes 'platform/ name>/include/plat'
> +and this then provides the source files with a complete definition the
> ODP API
> +to be implemented.
> +Applications in turn include the include/odp.h file which includes the
> +'platform//include/plat' files to provide a complete
> +definition of the API.
>
> -The validation Suite
> -
> -ODP provides a comprehensive set of API validation tests that are
> intended to be used by implementers during development and by application
> developers to verify that a particular implementation meets their
> requirements.
> +== The validation Suite ==
> +
> +ODP provides a comprehensive set of API validation tests that are
> intended to be
> +used by implementers during development and by application developers to
> verify
> +that a particular implementation meets their requirements.
>
>  The list of these tests is expected to grow as ODP grows.
>
> -The list of test executables is run by the automake test harness, when
> running "make check".
> -Therefore, as required by this harness, each executable should return 0
> on success (tests passed), 77 on inconclusive, or any other values on
> failure.
> -The automake functionality shows a status line (PASSED/FAIL...) for each
> of the ran test executables.
> +The list of test executables is run by the automake test harness, when
> running
> +"make check".
> +Therefore, as required by this harness, each executable should return 0 on
> +success (tests passed), 77 on inconclusive, or any other values on
> failure.
> +The automake functionality shows a status line (PASSED/FAIL...) for each
> of the
> +ran test executables.
>
> -It is 

Re: [lng-odp] [PATCH] doc: users-guide: convert to ODP standard layout

2015-11-18 Thread Bill Fischofer
Looks like this patch needs to be applied on top of my patch to the user
guide.  Other than that:

On Wed, Nov 18, 2015 at 11:03 AM, Mike Holmes 
wrote:

> Signed-off-by: Mike Holmes 
>

Reviewed-and-tested-by: Bill Fischofer 


> ---
>  doc/users-guide/users-guide.adoc | 101
> +--
>  1 file changed, 66 insertions(+), 35 deletions(-)
>
> diff --git a/doc/users-guide/users-guide.adoc
> b/doc/users-guide/users-guide.adoc
> index be40d2f..e087696 100644
> --- a/doc/users-guide/users-guide.adoc
> +++ b/doc/users-guide/users-guide.adoc
> @@ -8,13 +8,16 @@ OpenDataPlane (ODP)  Users-Guide
>  Abstract
>  
>  This document is intended to guide a new ODP application developer.
> -Further details about ODP may be found at the http://opendataplane.org[ODP]
> home page.
> +Further details about ODP may be found at the http://opendataplane.org[ODP]
> home
> +page.
>
>  .Overview of a system running ODP applications
>  image::../images/overview.png[align="center"]
>
> -ODP is an API specification that allows many implementations to provide
> platform independence, automatic hardware acceleration and CPU scaling to
> high performance networking  applications.
> -This document describes how to write an application that can successfully
> take advantage of the API.
> +ODP is an API specification that allows many implementations to provide
> platform
> +independence, automatic hardware acceleration and CPU scaling to high
> +performance networking  applications. This document describes how to
> write an
> +application that can successfully take advantage of the API.
>
>  :numbered:
>  == Introduction ==
> @@ -422,23 +425,35 @@ goals. Again, the advantage here is that on many
> platforms traffic management
>  functions are implemented in hardware, permitting transparent offload of
>  this work.
>
> -Glossary
> -
> +== Glossary ==
> +
>  [glossary]
>  odp_worker::
> -An opd_worker is a type of odp_thread. It will usually be isolated
> from the scheduling of any host operating system and is intended for
> fast-path processing with a low and predictable latency. Odp_workers will
> not generally receive interrupts and will run to completion.
> +An opd_worker is a type of odp_thread. It will usually be isolated
> from the
> +scheduling of any host operating system and is intended for fast-path
> +processing with a low and predictable latency. Odp_workers will not
> +generally receive interrupts and will run to completion.
>  odp_control::
> -An odp_control is a type of odp_thread. It will be isolated from the
> host operating system house keeping tasks but will be scheduled by it and
> may receive interrupts.
> +An odp_control is a type of odp_thread. It will be isolated from the
> host
> +operating system house keeping tasks but will be scheduled by it and
> may
> +receive interrupts.
>  odp_thread::
> -An odp_thread is a flow of execution that in a Linux environment
> could be a Linux process or thread.
> +An odp_thread is a flow of execution that in a Linux environment
> could be a
> +Linux process or thread.
>  event::
>  An event is a notification that can be placed in a queue.
>
> -The include structure
> --
> -Applications only include the 'include/odp.h file which includes the
> 'platform//include/plat' files to provide a complete
> definition of the API on that platform.
> -The doxygen documentation defining the behavior of the ODP API is all
> contained in the public API files, and the actual definitions for an
> implementation will be found in the per platform directories.
> -Per-platform data that might normally be a #define can be recovered via
> the appropriate access function if the #define is not directly visible to
> the application.
> +== The include structure ==
> +
> +Applications only include the 'include/odp.h' file which includes the
> +'platform//include/plat' files to provide a complete
> +definition of the API on that platform.
> +The doxygen documentation defining the behavior of the ODP API is all
> contained
> +in the public API files, and the actual definitions for an implementation
> will
> +be found in the per platform directories.
> +Per-platform data that might normally be a #define can be recovered via
> the
> +appropriate access function if the #define is not directly visible to the
> +application.
>
>  .Users include structure
>  
> @@ -451,21 +466,29 @@ Per-platform data that might normally be a #define
> can be recovered via the appr
>  │   └── odp.h   This file should be the only file included by the
> application.
>  
>
> -Initialization
> ---
> -IMPORTANT: ODP depends on the application to perform a graceful shutdown,
> calling the terminate functions should only be done when the application is
> sure it has closed the ingress and subsequently drained all queues etc.
> +== 

Re: [lng-odp] [PATCH] doc: users-guide: convert to ODP standard layout

2015-11-18 Thread Mike Holmes
Thanks, unless Maxim needs it I wont resend.

On 18 November 2015 at 14:53, Bill Fischofer 
wrote:

> Looks like this patch needs to be applied on top of my patch to the user
> guide.  Other than that:
>
> On Wed, Nov 18, 2015 at 11:03 AM, Mike Holmes 
> wrote:
>
>> Signed-off-by: Mike Holmes 
>>
>
> Reviewed-and-tested-by: Bill Fischofer 
>
>
>> ---
>>  doc/users-guide/users-guide.adoc | 101
>> +--
>>  1 file changed, 66 insertions(+), 35 deletions(-)
>>
>> diff --git a/doc/users-guide/users-guide.adoc
>> b/doc/users-guide/users-guide.adoc
>> index be40d2f..e087696 100644
>> --- a/doc/users-guide/users-guide.adoc
>> +++ b/doc/users-guide/users-guide.adoc
>> @@ -8,13 +8,16 @@ OpenDataPlane (ODP)  Users-Guide
>>  Abstract
>>  
>>  This document is intended to guide a new ODP application developer.
>> -Further details about ODP may be found at the http://opendataplane.org[ODP]
>> home page.
>> +Further details about ODP may be found at the http://opendataplane.org[ODP]
>> home
>> +page.
>>
>>  .Overview of a system running ODP applications
>>  image::../images/overview.png[align="center"]
>>
>> -ODP is an API specification that allows many implementations to provide
>> platform independence, automatic hardware acceleration and CPU scaling to
>> high performance networking  applications.
>> -This document describes how to write an application that can
>> successfully take advantage of the API.
>> +ODP is an API specification that allows many implementations to provide
>> platform
>> +independence, automatic hardware acceleration and CPU scaling to high
>> +performance networking  applications. This document describes how to
>> write an
>> +application that can successfully take advantage of the API.
>>
>>  :numbered:
>>  == Introduction ==
>> @@ -422,23 +425,35 @@ goals. Again, the advantage here is that on many
>> platforms traffic management
>>  functions are implemented in hardware, permitting transparent offload of
>>  this work.
>>
>> -Glossary
>> -
>> +== Glossary ==
>> +
>>  [glossary]
>>  odp_worker::
>> -An opd_worker is a type of odp_thread. It will usually be isolated
>> from the scheduling of any host operating system and is intended for
>> fast-path processing with a low and predictable latency. Odp_workers will
>> not generally receive interrupts and will run to completion.
>> +An opd_worker is a type of odp_thread. It will usually be isolated
>> from the
>> +scheduling of any host operating system and is intended for fast-path
>> +processing with a low and predictable latency. Odp_workers will not
>> +generally receive interrupts and will run to completion.
>>  odp_control::
>> -An odp_control is a type of odp_thread. It will be isolated from the
>> host operating system house keeping tasks but will be scheduled by it and
>> may receive interrupts.
>> +An odp_control is a type of odp_thread. It will be isolated from the
>> host
>> +operating system house keeping tasks but will be scheduled by it and
>> may
>> +receive interrupts.
>>  odp_thread::
>> -An odp_thread is a flow of execution that in a Linux environment
>> could be a Linux process or thread.
>> +An odp_thread is a flow of execution that in a Linux environment
>> could be a
>> +Linux process or thread.
>>  event::
>>  An event is a notification that can be placed in a queue.
>>
>> -The include structure
>> --
>> -Applications only include the 'include/odp.h file which includes the
>> 'platform//include/plat' files to provide a complete
>> definition of the API on that platform.
>> -The doxygen documentation defining the behavior of the ODP API is all
>> contained in the public API files, and the actual definitions for an
>> implementation will be found in the per platform directories.
>> -Per-platform data that might normally be a #define can be recovered via
>> the appropriate access function if the #define is not directly visible to
>> the application.
>> +== The include structure ==
>> +
>> +Applications only include the 'include/odp.h' file which includes the
>> +'platform//include/plat' files to provide a complete
>> +definition of the API on that platform.
>> +The doxygen documentation defining the behavior of the ODP API is all
>> contained
>> +in the public API files, and the actual definitions for an
>> implementation will
>> +be found in the per platform directories.
>> +Per-platform data that might normally be a #define can be recovered via
>> the
>> +appropriate access function if the #define is not directly visible to the
>> +application.
>>
>>  .Users include structure
>>  
>> @@ -451,21 +466,29 @@ Per-platform data that might normally be a #define
>> can be recovered via the appr
>>  │   └── odp.h   This file should be the only file included by the
>> application.
>>  
>>
>> 

Re: [lng-odp] [PATCH] platform: move list of API files to Makefile.inc so it is common to all platforms

2015-11-18 Thread Bill Fischofer
Based on our discussions earlier today, this patch should be applied as it
helps whether or not we split the odp.git repo.

+1

On Wed, Nov 18, 2015 at 12:14 PM, Mike Holmes 
wrote:

> On 12 November 2015 at 09:22, Nicolas Morey-Chaisemartin  > wrote:
>
>> Signed-off-by: Nicolas Morey-Chaisemartin 
>>
>
> Reviewed-by: Mike Holmes 
>
>
>> ---
>>  platform/Makefile.inc  | 39
>> ++
>>  platform/linux-generic/Makefile.am | 39
>> --
>>  2 files changed, 39 insertions(+), 39 deletions(-)
>>
>> diff --git a/platform/Makefile.inc b/platform/Makefile.inc
>> index 8e8e97b..14e134c 100644
>> --- a/platform/Makefile.inc
>> +++ b/platform/Makefile.inc
>> @@ -15,3 +15,42 @@ AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
>>  GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh $(top_srcdir)`
>>  AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
>>  AM_CFLAGS += -DPLATFORM=${with_platform}
>> +
>> +odpapiincludedir= $(includedir)/odp/api
>> +odpapiinclude_HEADERS = \
>> + $(top_srcdir)/include/odp/api/align.h \
>> + $(top_srcdir)/include/odp/api/atomic.h \
>> + $(top_srcdir)/include/odp/api/barrier.h \
>> + $(top_srcdir)/include/odp/api/buffer.h \
>> + $(top_srcdir)/include/odp/api/byteorder.h \
>> + $(top_srcdir)/include/odp/api/classification.h \
>> + $(top_srcdir)/include/odp/api/compiler.h \
>> + $(top_srcdir)/include/odp/api/config.h \
>> + $(top_srcdir)/include/odp/api/cpu.h \
>> + $(top_srcdir)/include/odp/api/cpumask.h \
>> + $(top_srcdir)/include/odp/api/crypto.h \
>> + $(top_srcdir)/include/odp/api/debug.h \
>> + $(top_srcdir)/include/odp/api/errno.h \
>> + $(top_srcdir)/include/odp/api/event.h \
>> + $(top_srcdir)/include/odp/api/hints.h \
>> + $(top_srcdir)/include/odp/api/init.h \
>> + $(top_srcdir)/include/odp/api/packet.h \
>> + $(top_srcdir)/include/odp/api/packet_flags.h \
>> + $(top_srcdir)/include/odp/api/packet_io.h \
>> + $(top_srcdir)/include/odp/api/pool.h \
>> + $(top_srcdir)/include/odp/api/queue.h \
>> + $(top_srcdir)/include/odp/api/random.h \
>> + $(top_srcdir)/include/odp/api/rwlock.h \
>> + $(top_srcdir)/include/odp/api/schedule.h \
>> + $(top_srcdir)/include/odp/api/schedule_types.h \
>> + $(top_srcdir)/include/odp/api/shared_memory.h \
>> + $(top_srcdir)/include/odp/api/spinlock.h \
>> + $(top_srcdir)/include/odp/api/std_types.h \
>> + $(top_srcdir)/include/odp/api/sync.h \
>> + $(top_srcdir)/include/odp/api/system_info.h \
>> + $(top_srcdir)/include/odp/api/thread.h \
>> + $(top_srcdir)/include/odp/api/thrmask.h \
>> + $(top_srcdir)/include/odp/api/ticketlock.h \
>> + $(top_srcdir)/include/odp/api/time.h \
>> + $(top_srcdir)/include/odp/api/timer.h \
>> + $(top_srcdir)/include/odp/api/version.h
>> \ No newline at end of file
>> diff --git a/platform/linux-generic/Makefile.am
>> b/platform/linux-generic/Makefile.am
>> index 0135947..610e04d 100644
>> --- a/platform/linux-generic/Makefile.am
>> +++ b/platform/linux-generic/Makefile.am
>> @@ -73,45 +73,6 @@ odpplatinclude_HEADERS = \
>>   $(srcdir)/include/odp/plat/timer_types.h \
>>   $(srcdir)/include/odp/plat/version_types.h
>>
>> -odpapiincludedir= $(includedir)/odp/api
>> -odpapiinclude_HEADERS = \
>> - $(top_srcdir)/include/odp/api/align.h \
>> - $(top_srcdir)/include/odp/api/atomic.h \
>> - $(top_srcdir)/include/odp/api/barrier.h \
>> - $(top_srcdir)/include/odp/api/buffer.h \
>> - $(top_srcdir)/include/odp/api/byteorder.h \
>> - $(top_srcdir)/include/odp/api/classification.h \
>> - $(top_srcdir)/include/odp/api/compiler.h \
>> - $(top_srcdir)/include/odp/api/config.h \
>> - $(top_srcdir)/include/odp/api/cpu.h \
>> - $(top_srcdir)/include/odp/api/cpumask.h \
>> - $(top_srcdir)/include/odp/api/crypto.h \
>> - $(top_srcdir)/include/odp/api/debug.h \
>> - $(top_srcdir)/include/odp/api/errno.h \
>> - $(top_srcdir)/include/odp/api/event.h \
>> - $(top_srcdir)/include/odp/api/hints.h \
>> - $(top_srcdir)/include/odp/api/init.h \
>> - $(top_srcdir)/include/odp/api/packet.h \
>> - 

Re: [lng-odp] [PATCH] doc: users-guide: convert to ODP standard layout

2015-11-18 Thread Mike Holmes
I will take a look soon so that we get the basics in.

On 18 November 2015 at 14:59, Bill Fischofer 
wrote:

> Another reason to merge these since I have further updates I'd like to
> submit but don't want to get into a tower of babel set of patches.
>
> BTW, my base patch still needs a reviewed-by
>
> On Wed, Nov 18, 2015 at 1:56 PM, Mike Holmes 
> wrote:
>
>> Thanks, unless Maxim needs it I wont resend.
>>
>> On 18 November 2015 at 14:53, Bill Fischofer 
>> wrote:
>>
>>> Looks like this patch needs to be applied on top of my patch to the user
>>> guide.  Other than that:
>>>
>>> On Wed, Nov 18, 2015 at 11:03 AM, Mike Holmes 
>>> wrote:
>>>
 Signed-off-by: Mike Holmes 

>>>
>>> Reviewed-and-tested-by: Bill Fischofer 
>>>
>>>
 ---
  doc/users-guide/users-guide.adoc | 101
 +--
  1 file changed, 66 insertions(+), 35 deletions(-)

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

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

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

  :numbered:
  == Introduction ==
 @@ -422,23 +425,35 @@ goals. Again, the advantage here is that on many
 platforms traffic management
  functions are implemented in hardware, permitting transparent offload
 of
  this work.

 -Glossary
 -
 +== Glossary ==
 +
  [glossary]
  odp_worker::
 -An opd_worker is a type of odp_thread. It will usually be isolated
 from the scheduling of any host operating system and is intended for
 fast-path processing with a low and predictable latency. Odp_workers will
 not generally receive interrupts and will run to completion.
 +An opd_worker is a type of odp_thread. It will usually be isolated
 from the
 +scheduling of any host operating system and is intended for
 fast-path
 +processing with a low and predictable latency. Odp_workers will not
 +generally receive interrupts and will run to completion.
  odp_control::
 -An odp_control is a type of odp_thread. It will be isolated from
 the host operating system house keeping tasks but will be scheduled by it
 and may receive interrupts.
 +An odp_control is a type of odp_thread. It will be isolated from
 the host
 +operating system house keeping tasks but will be scheduled by it
 and may
 +receive interrupts.
  odp_thread::
 -An odp_thread is a flow of execution that in a Linux environment
 could be a Linux process or thread.
 +An odp_thread is a flow of execution that in a Linux environment
 could be a
 +Linux process or thread.
  event::
  An event is a notification that can be placed in a queue.

 -The include structure
 --
 -Applications only include the 'include/odp.h file which includes the
 'platform//include/plat' files to provide a complete
 definition of the API on that platform.
 -The doxygen documentation defining the behavior of the ODP API is all
 contained in the public API files, and the actual definitions for an
 implementation will be found in the per platform directories.
 -Per-platform data that might normally be a #define can be recovered
 via the appropriate access function if the #define is not directly visible
 to the application.
 +== The include structure ==
 +
 +Applications only include the 'include/odp.h' file which includes the
 +'platform//include/plat' files to provide a
 complete
 +definition of the API on that platform.
 

Re: [lng-odp] [API-NEXT PATCH 5/5] validation: implement pktio statistics counters

2015-11-18 Thread Maxim Uvarov

On 11/10/2015 21:30, Stuart Haslam wrote:

On Mon, Nov 09, 2015 at 02:21:53PM +0300, Maxim Uvarov wrote:

Signed-off-by: Maxim Uvarov 
---
  test/validation/pktio/pktio.c | 130 ++
  1 file changed, 130 insertions(+)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 6320b77..c591c94 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -690,6 +690,135 @@ void pktio_test_inq(void)
CU_ASSERT(odp_pktio_close(pktio) == 0);
  }
  
+static void _print_pktio_stats(odp_pktio_stats_t *s, const char *name)

+{
+   printf("\n%s:\n"
+   "  in_octets %"PRIu64"\n"
+   "  in_ucast_pkts %"PRIu64"\n"
+   "  in_discards %"PRIu64"\n"
+   "  in_errors %"PRIu64"\n"
+   "  in_unknown_protos %"PRIu64"\n"
+   "  out_octets %"PRIu64"\n"
+   "  out_ucast_pkts %"PRIu64"\n"
+   "  out_discards %"PRIu64"\n"
+   "  out_errors %"PRIu64"\n",
+   name,
+   s->in_octets,
+   s->in_ucast_pkts,
+   s->in_discards,
+   s->in_errors,
+   s->in_unknown_protos,
+   s->out_octets,
+   s->out_ucast_pkts,
+   s->out_discards,
+   s->out_errors);
+}
+
+static void pktio_test_statistics_counters(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;
+   uint64_t wait = odp_schedule_wait_time(ODP_TIME_MSEC);
+   odp_pktio_stats_t stats[2];
+
+   for (i = 0; i < num_ifaces; i++) {
+   pktio[i] = create_pktio(i, ODP_PKTIN_MODE_SCHED);
+   CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID);
+   create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
+   }
+
+   outq = odp_pktio_outq_getdef(pktio[0]);
+
+   ret = odp_pktio_start(pktio[0]);
+   CU_ASSERT(ret == 0);
+   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, wait);
+   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);
+   }
+
+   ret = odp_pktio_stats_reset(pktio[0]);
+   CU_ASSERT(ret == 0);
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats_reset(pktio[1]);
+   CU_ASSERT(ret == 0);
+   }
+
+   /* send */
+   for (pkts = 0; pkts != alloc; ) {
+   ret = odp_queue_enq_multi(outq, _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, wait);
+   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);
+   }
+   }
+
+   ret = odp_pktio_stats(pktio[0], [0]);
+   CU_ASSERT(ret == 0);
+   _print_pktio_stats([0], iface_name[0]);

I don't like tests printing to stdout, it clutters the output and makes
it harder to see what's passed/failed. If all of the asserts pass then
it doesn't matter what the actual values are, that's a detail of the
test, if something fails though it's reasonable to dump to stderr.


+
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats(pktio[1], [1]);
+   CU_ASSERT(ret == 0);
+   _print_pktio_stats([1], iface_name[1]);
+
+   CU_ASSERT(stats[1].in_ucast_pkts >= (uint64_t)pkts);
+   CU_ASSERT(stats[0].out_ucast_pkts == stats[1].in_ucast_pkts);
+   CU_ASSERT(stats[0].out_octets == stats[1].in_octets);
+   CU_ASSERT(stats[0].out_octets >=
+ (stats[0].out_ucast_pkts * (uint64_t)pkts));

What's this check for?.. seems to assert that average pkt size >= 2
octets.


+   } else {

Why not check out_octets and out_ucast_pkts in this case?

The logic would be simpler with something like:

if (num_ifaces == 1)

[lng-odp] [API-NEXT PATCHv2 5/5] validation: implement pktio statistics counters

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

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 6320b77..9f05392 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -23,6 +23,8 @@
 #define TEST_SEQ_MAGIC 0x92749451
 #define TX_BATCH_LEN   4
 
+#undef DEBUG_STATS
+
 /** interface names used for testing */
 static const char *iface_name[MAX_NUM_IFACES];
 
@@ -690,6 +692,137 @@ void pktio_test_inq(void)
CU_ASSERT(odp_pktio_close(pktio) == 0);
 }
 
+#ifdef DEBUG_STATS
+static void _print_pktio_stats(odp_pktio_stats_t *s, const char *name)
+{
+   fprintf(stderr, "\n%s:\n"
+   "  in_octets %"PRIu64"\n"
+   "  in_ucast_pkts %"PRIu64"\n"
+   "  in_discards %"PRIu64"\n"
+   "  in_errors %"PRIu64"\n"
+   "  in_unknown_protos %"PRIu64"\n"
+   "  out_octets %"PRIu64"\n"
+   "  out_ucast_pkts %"PRIu64"\n"
+   "  out_discards %"PRIu64"\n"
+   "  out_errors %"PRIu64"\n",
+   name,
+   s->in_octets,
+   s->in_ucast_pkts,
+   s->in_discards,
+   s->in_errors,
+   s->in_unknown_protos,
+   s->out_octets,
+   s->out_ucast_pkts,
+   s->out_discards,
+   s->out_errors);
+}
+#endif
+
+static void pktio_test_statistics_counters(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;
+   uint64_t wait = odp_schedule_wait_time(ODP_TIME_MSEC);
+   odp_pktio_stats_t stats[2];
+
+   for (i = 0; i < num_ifaces; i++) {
+   pktio[i] = create_pktio(i, ODP_PKTIN_MODE_SCHED);
+   CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID);
+   create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
+   }
+
+   outq = odp_pktio_outq_getdef(pktio[0]);
+
+   ret = odp_pktio_start(pktio[0]);
+   CU_ASSERT(ret == 0);
+   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, wait);
+   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);
+   }
+
+   ret = odp_pktio_stats_reset(pktio[0]);
+   CU_ASSERT(ret == 0);
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats_reset(pktio[1]);
+   CU_ASSERT(ret == 0);
+   }
+
+   /* send */
+   for (pkts = 0; pkts != alloc; ) {
+   ret = odp_queue_enq_multi(outq, _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, wait);
+   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);
+   }
+   }
+
+   ret = odp_pktio_stats(pktio[0], [0]);
+   CU_ASSERT(ret == 0);
+
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats(pktio[1], [1]);
+   CU_ASSERT(ret == 0);
+   CU_ASSERT(stats[1].in_ucast_pkts >= (uint64_t)pkts);
+   CU_ASSERT(stats[0].out_ucast_pkts == stats[1].in_ucast_pkts);
+   CU_ASSERT(stats[0].out_octets == stats[1].in_octets);
+   CU_ASSERT(stats[0].out_octets >=
+ (PKT_LEN_NORMAL * (uint64_t)pkts));
+   } else {
+   CU_ASSERT(stats[0].in_ucast_pkts == (uint64_t)pkts);
+   CU_ASSERT(stats[0].in_octets ==
+ (PKT_LEN_NORMAL * (uint64_t)pkts));
+   }
+
+   CU_ASSERT(pkts == alloc);
+   CU_ASSERT(0 == stats[0].in_discards);
+   CU_ASSERT(0 == stats[0].in_errors);
+   CU_ASSERT(0 == stats[0].in_unknown_protos);
+   CU_ASSERT(0 == stats[0].out_discards);
+   CU_ASSERT(0 == stats[0].out_errors);
+
+   for (i = 0; 

[lng-odp] [API-NEXT PATCHv2 4/5] linux-generic: pktio netmap: implement statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/netmap.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..f9359ba 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -168,6 +168,12 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if (err)
goto error;
 
+   /* netmap uses only ethtool to get statistics counters */
+   pktio_entry->s.use_ethtool;
+   err = sock_stats_reset(pktio_entry);
+   if (err != 0)
+   goto error;
+
/* Wait for the link to come up */
for (i = 0; i < NM_OPEN_RETRIES; i++) {
err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_GLINK);
@@ -313,6 +319,8 @@ const pktio_if_ops_t netmap_pktio_ops = {
.close = netmap_close,
.start = NULL,
.stop = NULL,
+   .stats = sock_stats,
+   .stats_reset = sock_stats_reset,
.recv = netmap_recv,
.send = netmap_send,
.mtu_get = netmap_mtu_get,
-- 
1.9.1

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


Re: [lng-odp] [PATCH 3/5] pkg/rpm: fix dnf builddep

2015-11-18 Thread Maxim Uvarov

On 11/16/2015 16:16, Anders Roxell wrote:

Need to be a value and not a string in order to install the build
requires with: dnf builddep pkg/rpm/odp.spec

Reported-by: Riku Voipio 
Signed-off-by: Anders Roxell 
Reviewed-by: Riku Voipio 
---
  pkg/rpm/odp.spec | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/rpm/odp.spec b/pkg/rpm/odp.spec
index eb756ce..9dc2258 100644
--- a/pkg/rpm/odp.spec
+++ b/pkg/rpm/odp.spec
@@ -4,7 +4,7 @@
  # SPDX-License-Identifier: BSD-3-Clause
  
  Name: opendataplane

-Version: Dummy that will be replaced!
+Version: 1.4

what is the plan with updating that version?

Maxim.

  Release: 1
  Packager: anders.rox...@linaro.org
  URL: http://opendataplane.org


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


Re: [lng-odp] odp_platform_init_t vs ODP_PLATFORM_PARAMS

2015-11-18 Thread Bill Fischofer
On Wed, Nov 18, 2015 at 4:58 AM, Zoltan Kiss  wrote:

>
> On 17/11/15 20:46, Bill Fischofer wrote:
>
>> I vote for B.  The idea is that if the application wishes to override it
>> can do so otherwise let the implementation take its defaults from the
>> environment or however else it wishes to support platform-specific
>>
>
> I think your analogy fails a bit here because not passing
> odp_platform_init_t doesn't mean you are using "defaults". It just means
> you are using an another way to provide the configuration.
>

That "other way" by definition is a platform-specific default mechanism,
which might be an environment variable or something else entirely.  The
point is either the application has an application-centric preference or it
does not.  Option B handles those options simply and cleanly.


>
> configuration options.  This is in keeping with how we handle other
>> overridable defaults for things like log and abort functions.  Specify
>> NULL == accept whatever default behavior is in effect, otherwise specify
>> what you want.  Simpler for everyone.
>>
>> On Tue, Nov 17, 2015 at 1:05 PM, Mike Holmes > > wrote:
>>
>>
>>
>> On 17 November 2015 at 13:54, Zoltan Kiss > > wrote:
>>
>> Hi all,
>>
>> Our odp_init_global() has a second parameter with type
>> odp_platform_init_t. It's supposed to convey platform specific
>> init parameters, however neither linux-generic nor linux-dpdk
>> uses that. In the latter we use instead the ODP_PLATFORM_PARAMS
>> environment variable. It has the little advantage that you don't
>> have to modify your application's code, but it limits you to
>> strings. In case of ODP-OVS we store this in OVSDB and retrieve
>> it from the startup script (or specify it manually if you don't
>> use the startup script.)
>> I'm tempted to change ODP-OVS and ODP-DPDK to use
>> odp_platform_init_t, would be cleaner for OVS and for any bigger
>> application which have a nice, full-fledged config database
>> solution. But that would immediately bring us a bigger problem:
>> none of our unit tests or example applications supports passing
>> this parameter at all. They are small applications, implementing
>> a proper config management would be an overkill. I have two
>> options to solve this:
>>
>> Apart from keeping the odp_platform_init_t type to be passed
>> odp_init_global()
>>
>> A) change our code in linux-generic for examples and tests (>20
>> places in the repo) to get the platform parameters from
>> ODP_PLATFORM_PARAMS env variable, and pass it down to
>> odp_init_global() as a string.
>>
>> B) Or just allow a platform to use both ways, document this, and
>> require that if both are present, the odp_platform_init_t passed
>> as parameter should take precedence. So smaller applications
>> using simply configurable platforms (like ODP-DPDK) don't have
>> to figure out a way to deal with this problem.
>>
>> I have a slight preference towards B), but I could be convinced
>> that it's a bad idea to have 2 ways to do the same thing.
>>
>>
>> I like A, two ways always feels bad to me.
>> I like that it is explicitly passed in and you know what you have.
>> Env vars can change without the difference being seen in the code as
>> easily and not all OS'es have env vars. Env vars are a great way to
>> do system dependent things but I think the application should
>> translate them into the odp_platform_init_t so that the fudging is
>> the apps problem and the app knows more about the portability
>> compromises it is making when using platform specifics.
>>
>>
>> Thoughts?
>>
>> Zoltan
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org 
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>> --
>> Mike Holmes
>> Technical Manager - Linaro Networking Group
>> Linaro.org ***│ *Open source software for
>> ARM SoCs
>>
>> __
>>
>>
>>
>> ___
>> lng-odp mailing list
>> lng-odp@lists.linaro.org 
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH v3] linux-generic: pktio: print out the name of pktio used

2015-11-18 Thread Stuart Haslam
On Mon, Nov 16, 2015 at 05:37:07PM +, Zoltan Kiss wrote:
> For debug purposes, otherwise it's not trivial to figure out which pktio was
> successful.
> 
> Signed-off-by: Zoltan Kiss 

Reviewed-by: Stuart Haslam 

> --
> 
> v2:
> - change the string for loopback and socket interfaces
> - also add it to odp_pktio_print()
> 
> v3: change back ODP_ERR to ODP_DBG
> 
> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
> b/platform/linux-generic/include/odp_packet_io_internal.h
> index 1a1118c..a46c6fe 100644
> --- a/platform/linux-generic/include/odp_packet_io_internal.h
> +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> @@ -100,6 +100,7 @@ typedef struct {
>  } pktio_table_t;
>  
>  typedef struct pktio_if_ops {
> + const char *name;
>   int (*init)(void);
>   int (*term)(void);
>   int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry,
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index 3ef400f..402e64d 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
> odp_pool_t pool,
>  
>   if (!ret) {
>   pktio_entry->s.ops = pktio_if_ops[pktio_if];
> + ODP_DBG("%s uses %s\n",
> + dev, pktio_if_ops[pktio_if]->name);
>   break;
>   }
>   }
> @@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id)
>   len += snprintf([len], n - len,
>   "  name %s\n", entry->s.name);
>   len += snprintf([len], n - len,
> + "  type %s\n", entry->s.ops->name);
> + len += snprintf([len], n - len,
>   "  state%s\n",
>   entry->s.state ==  STATE_START ? "start" :
>  (entry->s.state ==  STATE_STOP ? "stop" : "unknown"));
> diff --git a/platform/linux-generic/pktio/loop.c 
> b/platform/linux-generic/pktio/loop.c
> index ce19add..44da917 100644
> --- a/platform/linux-generic/pktio/loop.c
> +++ b/platform/linux-generic/pktio/loop.c
> @@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t 
> *pktio_entry)
>  }
>  
>  const pktio_if_ops_t loopback_pktio_ops = {
> + .name = "loop",
>   .init = NULL,
>   .term = NULL,
>   .open = loopback_open,
> diff --git a/platform/linux-generic/pktio/netmap.c 
> b/platform/linux-generic/pktio/netmap.c
> index 794c82e..bc4ab1c 100644
> --- a/platform/linux-generic/pktio/netmap.c
> +++ b/platform/linux-generic/pktio/netmap.c
> @@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t 
> *pktio_entry)
>  }
>  
>  const pktio_if_ops_t netmap_pktio_ops = {
> + .name = "netmap",
>   .init = NULL,
>   .term = NULL,
>   .open = netmap_open,
> diff --git a/platform/linux-generic/pktio/pcap.c 
> b/platform/linux-generic/pktio/pcap.c
> index 0817bf5..94b506d 100644
> --- a/platform/linux-generic/pktio/pcap.c
> +++ b/platform/linux-generic/pktio/pcap.c
> @@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
> *pktio_entry)
>  }
>  
>  const pktio_if_ops_t pcap_pktio_ops = {
> + .name = "pcap",
>   .open = pcapif_init,
>   .close = pcapif_close,
>   .recv = pcapif_recv_pkt,
> diff --git a/platform/linux-generic/pktio/socket.c 
> b/platform/linux-generic/pktio/socket.c
> index 5f5e0ae..56b0a8b 100644
> --- a/platform/linux-generic/pktio/socket.c
> +++ b/platform/linux-generic/pktio/socket.c
> @@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t 
> *pktio_entry)
>  }
>  
>  const pktio_if_ops_t sock_mmsg_pktio_ops = {
> + .name = "socket",
>   .init = NULL,
>   .term = NULL,
>   .open = sock_mmsg_open,
> diff --git a/platform/linux-generic/pktio/socket_mmap.c 
> b/platform/linux-generic/pktio/socket_mmap.c
> index 79ff82d..3a51179 100644
> --- a/platform/linux-generic/pktio/socket_mmap.c
> +++ b/platform/linux-generic/pktio/socket_mmap.c
> @@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t 
> *pktio_entry)
>  }
>  
>  const pktio_if_ops_t sock_mmap_pktio_ops = {
> + .name = "socket_mmap",
>   .init = NULL,
>   .term = NULL,
>   .open = sock_mmap_open,
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [Bug 1879] Ordered queues occasionally not restoring order properly

2015-11-18 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=1879

--- Comment #24 from Bill Fischofer  ---
Final piece of the puzzle now merged with commit id
32189ae9ad7e12f4df84ae068ea95fd2787b5286

All patches relating to this bug are now part of ODP v1.4.1

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


Re: [lng-odp] odp_platform_init_t vs ODP_PLATFORM_PARAMS

2015-11-18 Thread Zoltan Kiss



On 18/11/15 12:05, Bill Fischofer wrote:



On Wed, Nov 18, 2015 at 4:58 AM, Zoltan Kiss > wrote:


On 17/11/15 20:46, Bill Fischofer wrote:

I vote for B.  The idea is that if the application wishes to
override it
can do so otherwise let the implementation take its defaults
from the
environment or however else it wishes to support platform-specific


I think your analogy fails a bit here because not passing
odp_platform_init_t doesn't mean you are using "defaults". It just
means you are using an another way to provide the configuration.


That "other way" by definition is a platform-specific default mechanism,
which might be an environment variable or something else entirely.  The
point is either the application has an application-centric preference or
it does not.  Option B handles those options simply and cleanly.


I see. If you phrase it like this, it explains why we want to have two 
ways to do the same things, I like that. My original thought was to 
explicitly define ODP_PLATFORM_PARAMS, but it's better to leave it out.

I would phrase option B then like this:

--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -152,6 +152,10 @@ typedef struct odp_platform_init_t {
  *
  * @see odp_term_global()
  * @see odp_init_local() which is required per thread before use.
+ * @note The underlying implementation may have an another way to get
+ * configuration related to platform_params (e.g. environmental variable,
+ * configuration file), but if the application passes it, it should always
+ * take precedence.
  */
 int odp_init_global(const odp_init_t *params,
const odp_platform_init_t *platform_params);






configuration options.  This is in keeping with how we handle other
overridable defaults for things like log and abort functions.
Specify
NULL == accept whatever default behavior is in effect, otherwise
specify
what you want.  Simpler for everyone.

On Tue, Nov 17, 2015 at 1:05 PM, Mike Holmes

>>
wrote:



 On 17 November 2015 at 13:54, Zoltan Kiss

 >> wrote:

 Hi all,

 Our odp_init_global() has a second parameter with type
 odp_platform_init_t. It's supposed to convey platform
specific
 init parameters, however neither linux-generic nor
linux-dpdk
 uses that. In the latter we use instead the
ODP_PLATFORM_PARAMS
 environment variable. It has the little advantage that
you don't
 have to modify your application's code, but it limits
you to
 strings. In case of ODP-OVS we store this in OVSDB and
retrieve
 it from the startup script (or specify it manually if
you don't
 use the startup script.)
 I'm tempted to change ODP-OVS and ODP-DPDK to use
 odp_platform_init_t, would be cleaner for OVS and for
any bigger
 application which have a nice, full-fledged config database
 solution. But that would immediately bring us a bigger
problem:
 none of our unit tests or example applications supports
passing
 this parameter at all. They are small applications,
implementing
 a proper config management would be an overkill. I have two
 options to solve this:

 Apart from keeping the odp_platform_init_t type to be
passed
 odp_init_global()

 A) change our code in linux-generic for examples and
tests (>20
 places in the repo) to get the platform parameters from
 ODP_PLATFORM_PARAMS env variable, and pass it down to
 odp_init_global() as a string.

 B) Or just allow a platform to use both ways, document
this, and
 require that if both are present, the
odp_platform_init_t passed
 as parameter should take precedence. So smaller
applications
 using simply configurable platforms (like ODP-DPDK)
don't have
 to figure out a way to deal with this problem.

 I have a slight preference towards B), but I could be
convinced
 that it's a bad idea to have 2 ways to do the same thing.


 I like A, two ways always feels bad to me.
 I like that it is explicitly passed in and you know what
   

Re: [lng-odp] [PATCH v3] linux-generic: pktio: print out the name of pktio used

2015-11-18 Thread Maxim Uvarov

Merged to api-next,


Maxim.
On 11/18/2015 14:04, Stuart Haslam wrote:

On Mon, Nov 16, 2015 at 05:37:07PM +, Zoltan Kiss wrote:

For debug purposes, otherwise it's not trivial to figure out which pktio was
successful.

Signed-off-by: Zoltan Kiss 

Reviewed-by: Stuart Haslam 


--

v2:
- change the string for loopback and socket interfaces
- also add it to odp_pktio_print()

v3: change back ODP_ERR to ODP_DBG

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..a46c6fe 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -100,6 +100,7 @@ typedef struct {
  } pktio_table_t;
  
  typedef struct pktio_if_ops {

+   const char *name;
int (*init)(void);
int (*term)(void);
int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry,
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 3ef400f..402e64d 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
odp_pool_t pool,
  
  		if (!ret) {

pktio_entry->s.ops = pktio_if_ops[pktio_if];
+   ODP_DBG("%s uses %s\n",
+   dev, pktio_if_ops[pktio_if]->name);
break;
}
}
@@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id)
len += snprintf([len], n - len,
"  name %s\n", entry->s.name);
len += snprintf([len], n - len,
+   "  type %s\n", entry->s.ops->name);
+   len += snprintf([len], n - len,
"  state%s\n",
entry->s.state ==  STATE_START ? "start" :
   (entry->s.state ==  STATE_STOP ? "stop" : "unknown"));
diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index ce19add..44da917 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t loopback_pktio_ops = {

+   .name = "loop",
.init = NULL,
.term = NULL,
.open = loopback_open,
diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..bc4ab1c 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t netmap_pktio_ops = {

+   .name = "netmap",
.init = NULL,
.term = NULL,
.open = netmap_open,
diff --git a/platform/linux-generic/pktio/pcap.c 
b/platform/linux-generic/pktio/pcap.c
index 0817bf5..94b506d 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t pcap_pktio_ops = {

+   .name = "pcap",
.open = pcapif_init,
.close = pcapif_close,
.recv = pcapif_recv_pkt,
diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 5f5e0ae..56b0a8b 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry)
  }
  
  const pktio_if_ops_t sock_mmsg_pktio_ops = {

+   .name = "socket",
.init = NULL,
.term = NULL,
.open = sock_mmsg_open,
diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 79ff82d..3a51179 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t sock_mmap_pktio_ops = {

+   .name = "socket_mmap",
.init = NULL,
.term = NULL,
.open = sock_mmap_open,


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


Re: [lng-odp] [PATCH v3] linux-generic: pktio: print out the name of pktio used

2015-11-18 Thread Maxim Uvarov

Stuart,

reviewed-by ok?

Maxim.

On 11/16/2015 20:37, Zoltan Kiss wrote:

For debug purposes, otherwise it's not trivial to figure out which pktio was
successful.

Signed-off-by: Zoltan Kiss 
--

v2:
- change the string for loopback and socket interfaces
- also add it to odp_pktio_print()

v3: change back ODP_ERR to ODP_DBG

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..a46c6fe 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -100,6 +100,7 @@ typedef struct {
  } pktio_table_t;
  
  typedef struct pktio_if_ops {

+   const char *name;
int (*init)(void);
int (*term)(void);
int (*open)(odp_pktio_t pktio, pktio_entry_t *pktio_entry,
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 3ef400f..402e64d 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -229,6 +229,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev, 
odp_pool_t pool,
  
  		if (!ret) {

pktio_entry->s.ops = pktio_if_ops[pktio_if];
+   ODP_DBG("%s uses %s\n",
+   dev, pktio_if_ops[pktio_if]->name);
break;
}
}
@@ -845,6 +847,8 @@ void odp_pktio_print(odp_pktio_t id)
len += snprintf([len], n - len,
"  name %s\n", entry->s.name);
len += snprintf([len], n - len,
+   "  type %s\n", entry->s.ops->name);
+   len += snprintf([len], n - len,
"  state%s\n",
entry->s.state ==  STATE_START ? "start" :
   (entry->s.state ==  STATE_STOP ? "stop" : "unknown"));
diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index ce19add..44da917 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -108,6 +108,7 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t loopback_pktio_ops = {

+   .name = "loop",
.init = NULL,
.term = NULL,
.open = loopback_open,
diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..bc4ab1c 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -307,6 +307,7 @@ static int netmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t netmap_pktio_ops = {

+   .name = "netmap",
.init = NULL,
.term = NULL,
.open = netmap_open,
diff --git a/platform/linux-generic/pktio/pcap.c 
b/platform/linux-generic/pktio/pcap.c
index 0817bf5..94b506d 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -370,6 +370,7 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t pcap_pktio_ops = {

+   .name = "pcap",
.open = pcapif_init,
.close = pcapif_close,
.recv = pcapif_recv_pkt,
diff --git a/platform/linux-generic/pktio/socket.c 
b/platform/linux-generic/pktio/socket.c
index 5f5e0ae..56b0a8b 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -468,6 +468,7 @@ static int sock_promisc_mode_get(pktio_entry_t *pktio_entry)
  }
  
  const pktio_if_ops_t sock_mmsg_pktio_ops = {

+   .name = "socket",
.init = NULL,
.term = NULL,
.open = sock_mmsg_open,
diff --git a/platform/linux-generic/pktio/socket_mmap.c 
b/platform/linux-generic/pktio/socket_mmap.c
index 79ff82d..3a51179 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -519,6 +519,7 @@ static int sock_mmap_promisc_mode_get(pktio_entry_t 
*pktio_entry)
  }
  
  const pktio_if_ops_t sock_mmap_pktio_ops = {

+   .name = "socket_mmap",
.init = NULL,
.term = NULL,
.open = sock_mmap_open,


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


Re: [lng-odp] odp_platform_init_t vs ODP_PLATFORM_PARAMS

2015-11-18 Thread Bill Fischofer
On Wed, Nov 18, 2015 at 6:51 AM, Zoltan Kiss  wrote:

>
>
> On 18/11/15 12:05, Bill Fischofer wrote:
>
>>
>>
>> On Wed, Nov 18, 2015 at 4:58 AM, Zoltan Kiss > > wrote:
>>
>>
>> On 17/11/15 20:46, Bill Fischofer wrote:
>>
>> I vote for B.  The idea is that if the application wishes to
>> override it
>> can do so otherwise let the implementation take its defaults
>> from the
>> environment or however else it wishes to support platform-specific
>>
>>
>> I think your analogy fails a bit here because not passing
>> odp_platform_init_t doesn't mean you are using "defaults". It just
>> means you are using an another way to provide the configuration.
>>
>>
>> That "other way" by definition is a platform-specific default mechanism,
>> which might be an environment variable or something else entirely.  The
>> point is either the application has an application-centric preference or
>> it does not.  Option B handles those options simply and cleanly.
>>
>
> I see. If you phrase it like this, it explains why we want to have two
> ways to do the same things, I like that. My original thought was to
> explicitly define ODP_PLATFORM_PARAMS, but it's better to leave it out.
> I would phrase option B then like this:
>
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -152,6 +152,10 @@ typedef struct odp_platform_init_t {
>   *
>   * @see odp_term_global()
>   * @see odp_init_local() which is required per thread before use.
> + * @note The underlying implementation may have an another way to get
>

typo: an another.  Otherwise I like the note.


> + * configuration related to platform_params (e.g. environmental variable,
> + * configuration file), but if the application passes it, it should always
> + * take precedence.
>   */
>  int odp_init_global(const odp_init_t *params,
> const odp_platform_init_t *platform_params);
>
>
>
>
>>
>> configuration options.  This is in keeping with how we handle
>> other
>> overridable defaults for things like log and abort functions.
>> Specify
>> NULL == accept whatever default behavior is in effect, otherwise
>> specify
>> what you want.  Simpler for everyone.
>>
>> On Tue, Nov 17, 2015 at 1:05 PM, Mike Holmes
>> 
>> >>
>> wrote:
>>
>>
>>
>>  On 17 November 2015 at 13:54, Zoltan Kiss
>> 
>>  >
>> >> wrote:
>>
>>  Hi all,
>>
>>  Our odp_init_global() has a second parameter with type
>>  odp_platform_init_t. It's supposed to convey platform
>> specific
>>  init parameters, however neither linux-generic nor
>> linux-dpdk
>>  uses that. In the latter we use instead the
>> ODP_PLATFORM_PARAMS
>>  environment variable. It has the little advantage that
>> you don't
>>  have to modify your application's code, but it limits
>> you to
>>  strings. In case of ODP-OVS we store this in OVSDB and
>> retrieve
>>  it from the startup script (or specify it manually if
>> you don't
>>  use the startup script.)
>>  I'm tempted to change ODP-OVS and ODP-DPDK to use
>>  odp_platform_init_t, would be cleaner for OVS and for
>> any bigger
>>  application which have a nice, full-fledged config
>> database
>>  solution. But that would immediately bring us a bigger
>> problem:
>>  none of our unit tests or example applications supports
>> passing
>>  this parameter at all. They are small applications,
>> implementing
>>  a proper config management would be an overkill. I have
>> two
>>  options to solve this:
>>
>>  Apart from keeping the odp_platform_init_t type to be
>> passed
>>  odp_init_global()
>>
>>  A) change our code in linux-generic for examples and
>> tests (>20
>>  places in the repo) to get the platform parameters from
>>  ODP_PLATFORM_PARAMS env variable, and pass it down to
>>  odp_init_global() as a string.
>>
>>  B) Or just allow a platform to use both ways, document
>> this, and
>>  require that if both are present, the
>> odp_platform_init_t passed
>>  as parameter should take precedence. So smaller
>> applications
>> 

Re: [lng-odp] odp_platform_init_t vs ODP_PLATFORM_PARAMS

2015-11-18 Thread Savolainen, Petri (Nokia - FI/Espoo)
> 
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -152,6 +152,10 @@ typedef struct odp_platform_init_t {
>*
>* @see odp_term_global()
>* @see odp_init_local() which is required per thread before use.
> + * @note The underlying implementation may have an another way to get
> + * configuration related to platform_params (e.g. environmental variable,
> + * configuration file), but if the application passes it, it should
> always
> + * take precedence.
>*/
>   int odp_init_global(const odp_init_t *params,
>  const odp_platform_init_t *platform_params);
> 

Otherwise OK, but add it into the body of the documentation text (instead of 
@note).

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


Re: [lng-odp] [PATCH 0/5] rpm and deb pkg fixes

2015-11-18 Thread Maxim Uvarov

Merged,
Maxim.

On 11/16/2015 16:16, Anders Roxell wrote:

Hi,

This patchset fixes some rpm and deb pkg issues.

Cheers,
Anders

Anders Roxell (5):
   DEPENDENCIES: don't exist in fedora anymore
   pkg/rpm: fix ssl BuildRequires
   pkg/rpm: fix dnf builddep
   pkg/rpm: add missing BuildRequires
   pkg/debian: add more build-deps

  DEPENDENCIES   | 2 +-
  pkg/debian/control | 2 +-
  pkg/rpm/odp.spec   | 7 ---
  3 files changed, 6 insertions(+), 5 deletions(-)



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


Re: [lng-odp] [API-NEXT PATCHv2 3/4] api: crypto: Add AES128-GCM support

2015-11-18 Thread Maxim Uvarov

On 11/16/2015 16:09, Nicolas Morey-Chaisemartin wrote:

Signed-off-by: Nicolas Morey-Chaisemartin 
---
  include/odp/api/crypto.h   |   4 +
  .../linux-generic/include/odp_crypto_internal.h|   3 +
  platform/linux-generic/odp_crypto.c| 183 +
  3 files changed, 190 insertions(+)

diff --git a/include/odp/api/crypto.h b/include/odp/api/crypto.h
index c62021e..41beedb 100644
--- a/include/odp/api/crypto.h
+++ b/include/odp/api/crypto.h
@@ -70,6 +70,8 @@ typedef enum {
ODP_CIPHER_ALG_3DES_CBC,
/** AES128 with cipher block chaining */
ODP_CIPHER_ALG_AES128_CBC,
+   /** AES128 in Galois/Counter Mode */
+   ODP_CIPHER_ALG_AES128_GCM,
  } odp_cipher_alg_t;
  
  /**

@@ -82,6 +84,8 @@ typedef enum {
ODP_AUTH_ALG_MD5_96,
/** SHA256 with 128 bit key */
ODP_AUTH_ALG_SHA256_128,
+   /** AES128 in Galois/Counter Mode */
+   ODP_AUTH_ALG_AES128_GCM,
  } odp_auth_alg_t;
  
  /**

diff --git a/platform/linux-generic/include/odp_crypto_internal.h 
b/platform/linux-generic/include/odp_crypto_internal.h
index b9128a4..7b104af 100644
--- a/platform/linux-generic/include/odp_crypto_internal.h
+++ b/platform/linux-generic/include/odp_crypto_internal.h
@@ -50,6 +50,9 @@ struct odp_crypto_generic_session {
struct {
AES_KEY key;
} aes;
+   struct {
+   EVP_CIPHER_CTX *ctx;
+   } aes_gcm;
} data;
crypto_func_t func;
} cipher;
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 17fced9..65e8503 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -292,6 +292,170 @@ int process_aes_params(odp_crypto_generic_session_t 
*session,
  }
  
  static

+odp_crypto_alg_err_t aes_gcm_encrypt(odp_crypto_op_params_t *params,
+odp_crypto_generic_session_t *session)
+{
+   uint8_t *data  = odp_packet_data(params->out_pkt);
+   uint32_t plain_len   = params->cipher_range.length;
+   uint8_t *aad_head = data + params->auth_range.offset;
+   uint8_t *aad_tail = data + params->cipher_range.offset +
+   params->cipher_range.length;
+   uint32_t auth_len = params->auth_range.length;
+   unsigned char iv_enc[AES_BLOCK_SIZE];
+   void *iv_ptr;
+   uint8_t *tag = data + params->hash_result_offset;
+
+   if (params->override_iv_ptr)
+   iv_ptr = params->override_iv_ptr;
+   else if (session->cipher.iv.data)
+   iv_ptr = session->cipher.iv.data;
+   else
+   return ODP_CRYPTO_ALG_ERR_IV_INVALID;
+
+   /* All cipher data must be part of the authentication */
+   if (params->auth_range.offset > params->cipher_range.offset ||
+   params->auth_range.offset + auth_len <
+   params->cipher_range.offset + plain_len)
+   return ODP_CRYPTO_ALG_ERR_DATA_SIZE;
+
+   /*
+* Create a copy of the IV.  The DES library modifies IV
+* and if we are processing packets on parallel threads
+* we could get corruption.
+*/
+   memcpy(iv_enc, iv_ptr, AES_BLOCK_SIZE);
+
+   /* Adjust pointer for beginning of area to cipher/auth */
+   uint8_t *plaindata = data + params->cipher_range.offset;
+
+   /* Encrypt it */
+   EVP_CIPHER_CTX *ctx = session->cipher.data.aes_gcm.ctx;
+   int cipher_len = 0;
+
+   EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_enc);
+
+   /* Authenticate header data (if any) without encrypting them */
+   if (aad_head < plaindata) {
+   EVP_EncryptUpdate(ctx, NULL, _len,
+ aad_head, plaindata - aad_head);
+   }
+
+   EVP_EncryptUpdate(ctx, plaindata, _len,
+ plaindata, plain_len);
+   cipher_len = plain_len;
+
+   /* Authenticate footer data (if any) without encrypting them */
+   if (aad_head + auth_len > plaindata + plain_len) {
+   EVP_EncryptUpdate(ctx, NULL, NULL, aad_tail,
+ auth_len - (aad_tail - aad_head));
+   }
+
+   EVP_EncryptFinal_ex(ctx, plaindata + cipher_len, _len);
+   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag);
+
+   return ODP_CRYPTO_ALG_ERR_NONE;
+}
+
+static
+odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_params_t *params,
+odp_crypto_generic_session_t *session)
+{
+   uint8_t *data  = odp_packet_data(params->out_pkt);
+   uint32_t cipher_len   = params->cipher_range.length;
+   uint8_t *aad_head = data + params->auth_range.offset;
+   uint8_t *aad_tail = data + params->cipher_range.offset +
+   params->cipher_range.length;
+   uint32_t auth_len = params->auth_range.length;

[lng-odp] [API-NEXT PATCHv3 1/5] linux-generic: sockets: implement pktio statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |  11 ++
 platform/linux-generic/include/odp_packet_socket.h |   6 +
 platform/linux-generic/odp_packet_io.c |  53 +++
 platform/linux-generic/pktio/ethtool.c | 160 +
 platform/linux-generic/pktio/socket.c  |  84 +++
 platform/linux-generic/pktio/socket_mmap.c |  19 +++
 platform/linux-generic/pktio/sysfs.c   |  71 +
 8 files changed, 406 insertions(+)
 create mode 100644 platform/linux-generic/pktio/ethtool.c
 create mode 100644 platform/linux-generic/pktio/sysfs.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 610c79c..71b030e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -165,11 +165,13 @@ __LIB__libodp_la_SOURCES = \
   odp_packet.c \
   odp_packet_flags.c \
   odp_packet_io.c \
+  pktio/ethtool.c \
   pktio/io_ops.c \
   pktio/loop.c \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/sysfs.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..6566978 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -84,6 +84,9 @@ struct pktio_entry {
STATE_STOP
} state;
classifier_t cls;   /**< classifier linked with this pktio*/
+   odp_pktio_stats_t stats;/**< statistic counters for pktio */
+   int use_ethtool;/**< 1 - use ethtool,
+0 - sysfs for statistics */
char name[PKTIO_NAME_LEN];  /**< name of pktio provided to
   pktio_open() */
odp_pktio_param_t param;
@@ -107,6 +110,8 @@ typedef struct pktio_if_ops {
int (*close)(pktio_entry_t *pktio_entry);
int (*start)(pktio_entry_t *pktio_entry);
int (*stop)(pktio_entry_t *pktio_entry);
+   int (*stats)(pktio_entry_t *pktio_entry, odp_pktio_stats_t *stats);
+   int (*stats_reset)(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[],
@@ -159,6 +164,12 @@ extern const pktio_if_ops_t pcap_pktio_ops;
 #endif
 extern const pktio_if_ops_t * const pktio_if_ops[];
 
+int sysfs_stats(pktio_entry_t *pktio_entry,
+   odp_pktio_stats_t *stats);
+int sock_stats_reset(pktio_entry_t *pktio_entry);
+int sock_stats(pktio_entry_t *pktio_entry,
+  odp_pktio_stats_t *stats);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/include/odp_packet_socket.h 
b/platform/linux-generic/include/odp_packet_socket.h
index a5e0eb3..0836e3c 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -114,4 +115,9 @@ int promisc_mode_set_fd(int fd, const char *name, int 
enable);
  */
 int promisc_mode_get_fd(int fd, const char *name);
 
+/**
+ * Get ethtool statistics of a packet socket
+ */
+int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats);
+
 #endif
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 3ef400f..ba97629 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -862,3 +862,56 @@ void odp_pktio_print(odp_pktio_t id)
 
ODP_PRINT("\n%s\n", str);
 }
+
+int odp_pktio_stats(odp_pktio_t pktio,
+   odp_pktio_stats_t *stats)
+{
+   pktio_entry_t *entry;
+   int ret = -1;
+
+   entry = get_pktio_entry(pktio);
+   if (entry == NULL) {
+   ODP_DBG("pktio entry %d does not exist\n", pktio);
+   return -1;
+   }
+
+   lock_entry(entry);
+
+   if (odp_unlikely(is_free(entry))) {
+   unlock_entry(entry);
+   ODP_DBG("already freed pktio\n");
+   return -1;
+   }
+
+   if (entry->s.ops->stats)
+   ret = entry->s.ops->stats(entry, stats);
+   unlock_entry(entry);
+
+   return ret;
+}
+
+int odp_pktio_stats_reset(odp_pktio_t pktio)
+{
+   pktio_entry_t *entry;
+   int ret = -1;
+
+   entry = 

[lng-odp] [API-NEXT PATCHv3 5/5] validation: implement pktio statistics counters

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

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 6320b77..9f05392 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -23,6 +23,8 @@
 #define TEST_SEQ_MAGIC 0x92749451
 #define TX_BATCH_LEN   4
 
+#undef DEBUG_STATS
+
 /** interface names used for testing */
 static const char *iface_name[MAX_NUM_IFACES];
 
@@ -690,6 +692,137 @@ void pktio_test_inq(void)
CU_ASSERT(odp_pktio_close(pktio) == 0);
 }
 
+#ifdef DEBUG_STATS
+static void _print_pktio_stats(odp_pktio_stats_t *s, const char *name)
+{
+   fprintf(stderr, "\n%s:\n"
+   "  in_octets %"PRIu64"\n"
+   "  in_ucast_pkts %"PRIu64"\n"
+   "  in_discards %"PRIu64"\n"
+   "  in_errors %"PRIu64"\n"
+   "  in_unknown_protos %"PRIu64"\n"
+   "  out_octets %"PRIu64"\n"
+   "  out_ucast_pkts %"PRIu64"\n"
+   "  out_discards %"PRIu64"\n"
+   "  out_errors %"PRIu64"\n",
+   name,
+   s->in_octets,
+   s->in_ucast_pkts,
+   s->in_discards,
+   s->in_errors,
+   s->in_unknown_protos,
+   s->out_octets,
+   s->out_ucast_pkts,
+   s->out_discards,
+   s->out_errors);
+}
+#endif
+
+static void pktio_test_statistics_counters(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;
+   uint64_t wait = odp_schedule_wait_time(ODP_TIME_MSEC);
+   odp_pktio_stats_t stats[2];
+
+   for (i = 0; i < num_ifaces; i++) {
+   pktio[i] = create_pktio(i, ODP_PKTIN_MODE_SCHED);
+   CU_ASSERT_FATAL(pktio[i] != ODP_PKTIO_INVALID);
+   create_inq(pktio[i],  ODP_QUEUE_TYPE_SCHED);
+   }
+
+   outq = odp_pktio_outq_getdef(pktio[0]);
+
+   ret = odp_pktio_start(pktio[0]);
+   CU_ASSERT(ret == 0);
+   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, wait);
+   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);
+   }
+
+   ret = odp_pktio_stats_reset(pktio[0]);
+   CU_ASSERT(ret == 0);
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats_reset(pktio[1]);
+   CU_ASSERT(ret == 0);
+   }
+
+   /* send */
+   for (pkts = 0; pkts != alloc; ) {
+   ret = odp_queue_enq_multi(outq, _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, wait);
+   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);
+   }
+   }
+
+   ret = odp_pktio_stats(pktio[0], [0]);
+   CU_ASSERT(ret == 0);
+
+   if (num_ifaces > 1) {
+   ret = odp_pktio_stats(pktio[1], [1]);
+   CU_ASSERT(ret == 0);
+   CU_ASSERT(stats[1].in_ucast_pkts >= (uint64_t)pkts);
+   CU_ASSERT(stats[0].out_ucast_pkts == stats[1].in_ucast_pkts);
+   CU_ASSERT(stats[0].out_octets == stats[1].in_octets);
+   CU_ASSERT(stats[0].out_octets >=
+ (PKT_LEN_NORMAL * (uint64_t)pkts));
+   } else {
+   CU_ASSERT(stats[0].in_ucast_pkts == (uint64_t)pkts);
+   CU_ASSERT(stats[0].in_octets ==
+ (PKT_LEN_NORMAL * (uint64_t)pkts));
+   }
+
+   CU_ASSERT(pkts == alloc);
+   CU_ASSERT(0 == stats[0].in_discards);
+   CU_ASSERT(0 == stats[0].in_errors);
+   CU_ASSERT(0 == stats[0].in_unknown_protos);
+   CU_ASSERT(0 == stats[0].out_discards);
+   CU_ASSERT(0 == stats[0].out_errors);
+
+   for (i = 0; 

Re: [lng-odp] [API-NEXT PATCHv2 4/5] linux-generic: pktio netmap: implement statistics counters

2015-11-18 Thread Maxim Uvarov

On 11/18/2015 12:34, Maxim Uvarov wrote:

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

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..f9359ba 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -168,6 +168,12 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if (err)
goto error;
  
+	/* netmap uses only ethtool to get statistics counters */

+   pktio_entry->s.use_ethtool;

ops, it has to be = 1.

Will resend.

+   err = sock_stats_reset(pktio_entry);
+   if (err != 0)
+   goto error;
+
/* Wait for the link to come up */
for (i = 0; i < NM_OPEN_RETRIES; i++) {
err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_GLINK);
@@ -313,6 +319,8 @@ const pktio_if_ops_t netmap_pktio_ops = {
.close = netmap_close,
.start = NULL,
.stop = NULL,
+   .stats = sock_stats,
+   .stats_reset = sock_stats_reset,
.recv = netmap_recv,
.send = netmap_send,
.mtu_get = netmap_mtu_get,


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


Re: [lng-odp] [PATCH] validation: crypto: limit packet size to maximum supported by platform

2015-11-18 Thread Maxim Uvarov

Merged.

On 11/17/2015 06:56, Bill Fischofer wrote:


On Thu, Nov 12, 2015 at 10:07 AM, Nicolas Morey-Chaisemartin 
> wrote:


Signed-off-by: Nicolas Morey-Chaisemartin >


Reviewed-by: Bill Fischofer >


---
 test/validation/crypto/crypto.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/validation/crypto/crypto.c
b/test/validation/crypto/crypto.c
index 9229cab..1234f78 100644
--- a/test/validation/crypto/crypto.c
+++ b/test/validation/crypto/crypto.c
@@ -42,6 +42,9 @@ int crypto_init(void)
params.pkt.num = SHM_PKT_POOL_SIZE /
SHM_PKT_POOL_BUF_SIZE;
params.type= ODP_POOL_PACKET;

+   if (SHM_PKT_POOL_BUF_SIZE > odp_config_packet_buf_len_max())
+   params.pkt.len = odp_config_packet_buf_len_max();
+
pool = odp_pool_create("packet_pool", );

if (ODP_POOL_INVALID == pool) {
--
2.6.2.406.gaaaec35

___
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] [API-NEXT PATCHv2 1/5] linux-generic: sockets: implement pktio statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |  11 ++
 platform/linux-generic/include/odp_packet_socket.h |   6 +
 platform/linux-generic/odp_packet_io.c |  53 +++
 platform/linux-generic/pktio/ethtool.c | 160 +
 platform/linux-generic/pktio/socket.c  |  84 +++
 platform/linux-generic/pktio/socket_mmap.c |  19 +++
 platform/linux-generic/pktio/sysfs.c   |  71 +
 8 files changed, 406 insertions(+)
 create mode 100644 platform/linux-generic/pktio/ethtool.c
 create mode 100644 platform/linux-generic/pktio/sysfs.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 610c79c..71b030e 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -165,11 +165,13 @@ __LIB__libodp_la_SOURCES = \
   odp_packet.c \
   odp_packet_flags.c \
   odp_packet_io.c \
+  pktio/ethtool.c \
   pktio/io_ops.c \
   pktio/loop.c \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/sysfs.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..6566978 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -84,6 +84,9 @@ struct pktio_entry {
STATE_STOP
} state;
classifier_t cls;   /**< classifier linked with this pktio*/
+   odp_pktio_stats_t stats;/**< statistic counters for pktio */
+   int use_ethtool;/**< 1 - use ethtool,
+0 - sysfs for statistics */
char name[PKTIO_NAME_LEN];  /**< name of pktio provided to
   pktio_open() */
odp_pktio_param_t param;
@@ -107,6 +110,8 @@ typedef struct pktio_if_ops {
int (*close)(pktio_entry_t *pktio_entry);
int (*start)(pktio_entry_t *pktio_entry);
int (*stop)(pktio_entry_t *pktio_entry);
+   int (*stats)(pktio_entry_t *pktio_entry, odp_pktio_stats_t *stats);
+   int (*stats_reset)(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[],
@@ -159,6 +164,12 @@ extern const pktio_if_ops_t pcap_pktio_ops;
 #endif
 extern const pktio_if_ops_t * const pktio_if_ops[];
 
+int sysfs_stats(pktio_entry_t *pktio_entry,
+   odp_pktio_stats_t *stats);
+int sock_stats_reset(pktio_entry_t *pktio_entry);
+int sock_stats(pktio_entry_t *pktio_entry,
+  odp_pktio_stats_t *stats);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/include/odp_packet_socket.h 
b/platform/linux-generic/include/odp_packet_socket.h
index a5e0eb3..0836e3c 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -114,4 +115,9 @@ int promisc_mode_set_fd(int fd, const char *name, int 
enable);
  */
 int promisc_mode_get_fd(int fd, const char *name);
 
+/**
+ * Get ethtool statistics of a packet socket
+ */
+int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats);
+
 #endif
diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 3ef400f..ba97629 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -862,3 +862,56 @@ void odp_pktio_print(odp_pktio_t id)
 
ODP_PRINT("\n%s\n", str);
 }
+
+int odp_pktio_stats(odp_pktio_t pktio,
+   odp_pktio_stats_t *stats)
+{
+   pktio_entry_t *entry;
+   int ret = -1;
+
+   entry = get_pktio_entry(pktio);
+   if (entry == NULL) {
+   ODP_DBG("pktio entry %d does not exist\n", pktio);
+   return -1;
+   }
+
+   lock_entry(entry);
+
+   if (odp_unlikely(is_free(entry))) {
+   unlock_entry(entry);
+   ODP_DBG("already freed pktio\n");
+   return -1;
+   }
+
+   if (entry->s.ops->stats)
+   ret = entry->s.ops->stats(entry, stats);
+   unlock_entry(entry);
+
+   return ret;
+}
+
+int odp_pktio_stats_reset(odp_pktio_t pktio)
+{
+   pktio_entry_t *entry;
+   int ret = -1;
+
+   entry = 

[lng-odp] [API-NEXT PATCHv2 0/5] pktio statistics counters

2015-11-18 Thread Maxim Uvarov
v2: -  try to use ethtool for statistics counters if not fall back to sysfs.
( virtual veth devices do not support sysfs, netmap does not support 
sysfs.)
 - fix Stuarts comments for validation test suite.

** Netmap needed testing on working environment.

BR,
Maxim.

Maxim Uvarov (5):
  linux-generic: sockets: implement pktio statistics counters
  linux-generic: pktio loop: implement statistics counters
  linux-generic: pcap: implement pktio statistics counters
  linux-generic: pktio netmap: implement statistics counters
  validation: implement pktio statistics counters

 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |  11 ++
 platform/linux-generic/include/odp_packet_socket.h |   6 +
 platform/linux-generic/odp_packet_io.c |  53 +++
 platform/linux-generic/pktio/ethtool.c | 160 +
 platform/linux-generic/pktio/loop.c|  36 -
 platform/linux-generic/pktio/netmap.c  |   8 ++
 platform/linux-generic/pktio/pcap.c|  28 +++-
 platform/linux-generic/pktio/socket.c  |  84 +++
 platform/linux-generic/pktio/socket_mmap.c |  19 +++
 platform/linux-generic/pktio/sysfs.c   |  71 +
 test/validation/pktio/pktio.c  | 134 +
 12 files changed, 609 insertions(+), 3 deletions(-)
 create mode 100644 platform/linux-generic/pktio/ethtool.c
 create mode 100644 platform/linux-generic/pktio/sysfs.c

-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv3 0/5] pktio statistics counters

2015-11-18 Thread Maxim Uvarov
v3: - fix netmap (ethtool = 1);
v2: -  try to use ethtool for statistics counters if not fall back to sysfs.
( virtual veth devices do not support sysfs, netmap does not support 
sysfs.)
 - fix Stuarts comments for validation test suite.

** Netmap needed testing on working environment.

BR,
Maxim.

Maxim Uvarov (5):
  linux-generic: sockets: implement pktio statistics counters
  linux-generic: pktio loop: implement statistics counters
  linux-generic: pcap: implement pktio statistics counters
  linux-generic: pktio netmap: implement statistics counters
  validation: implement pktio statistics counters

 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |  11 ++
 platform/linux-generic/include/odp_packet_socket.h |   6 +
 platform/linux-generic/odp_packet_io.c |  53 +++
 platform/linux-generic/pktio/ethtool.c | 160 +
 platform/linux-generic/pktio/loop.c|  36 -
 platform/linux-generic/pktio/netmap.c  |   8 ++
 platform/linux-generic/pktio/pcap.c|  28 +++-
 platform/linux-generic/pktio/socket.c  |  84 +++
 platform/linux-generic/pktio/socket_mmap.c |  19 +++
 platform/linux-generic/pktio/sysfs.c   |  71 +
 test/validation/pktio/pktio.c  | 134 +
 12 files changed, 609 insertions(+), 3 deletions(-)
 create mode 100644 platform/linux-generic/pktio/ethtool.c
 create mode 100644 platform/linux-generic/pktio/sysfs.c

-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv3 2/5] linux-generic: pktio loop: implement statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/loop.c | 36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index ce19add..ec65fd4 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -23,6 +23,8 @@
 /* MAC address for the "loop" interface */
 static const char pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01};
 
+static int loopback_stats_reset(pktio_entry_t *pktio_entry);
+
 static int loopback_open(odp_pktio_t id, pktio_entry_t *pktio_entry,
 const char *devname, odp_pool_t pool ODP_UNUSED)
 {
@@ -39,6 +41,8 @@ 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;
 
+   loopback_stats_reset(pktio_entry);
+
return 0;
 }
 
@@ -63,8 +67,11 @@ static int loopback_recv(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
pkt_hdr = odp_packet_hdr(pkts[i]);
packet_parse_reset(pkts[i]);
packet_parse_l2(pkt_hdr);
+   pktio_entry->s.stats.in_octets += odp_packet_len(pkts[i]);
}
 
+   pktio_entry->s.stats.in_ucast_pkts += nbr;
+
return nbr;
 }
 
@@ -74,12 +81,22 @@ static int loopback_send(pktio_entry_t *pktio_entry, 
odp_packet_t pkt_tbl[],
odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX];
queue_entry_t *qentry;
unsigned i;
+   int ret;
+   uint32_t bytes = 0;
 
-   for (i = 0; i < len; ++i)
+   for (i = 0; i < len; ++i) {
hdr_tbl[i] = odp_buf_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));
+   bytes += odp_packet_len(pkt_tbl[i]);
+   }
 
qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq);
-   return queue_enq_multi(qentry, hdr_tbl, len, 0);
+   ret = queue_enq_multi(qentry, hdr_tbl, len, 0);
+   if (ret > 0) {
+   pktio_entry->s.stats.out_ucast_pkts += ret;
+   pktio_entry->s.stats.out_octets += bytes;
+   }
+
+   return ret;
 }
 
 static int loopback_mtu_get(pktio_entry_t *pktio_entry ODP_UNUSED)
@@ -107,6 +124,19 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
return pktio_entry->s.pkt_loop.promisc ? 1 : 0;
 }
 
+static int loopback_stats(pktio_entry_t *pktio_entry,
+ odp_pktio_stats_t *stats)
+{
+   memcpy(stats, _entry->s.stats, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
+static int loopback_stats_reset(pktio_entry_t *pktio_entry ODP_UNUSED)
+{
+   memset(_entry->s.stats, 0, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
 const pktio_if_ops_t loopback_pktio_ops = {
.init = NULL,
.term = NULL,
@@ -114,6 +144,8 @@ const pktio_if_ops_t loopback_pktio_ops = {
.close = loopback_close,
.start = NULL,
.stop = NULL,
+   .stats = loopback_stats,
+   .stats_reset = loopback_stats_reset,
.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] [API-NEXT PATCHv2 3/5] linux-generic: pcap: implement pktio statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/pcap.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/pcap.c 
b/platform/linux-generic/pktio/pcap.c
index 0817bf5..34cd73c 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -51,6 +51,8 @@
 #define PKTIO_PCAP_MTU (64 * 1024)
 static const char pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04};
 
+static int pcapif_stats_reset(pktio_entry_t *pktio_entry);
+
 static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname)
 {
char *tok;
@@ -156,6 +158,8 @@ static int pcapif_init(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if (ret == 0 && (!pcap->rx && !pcap->tx_dump))
ret = -1;
 
+   (void)pcapif_stats_reset(pktio_entry);
+
return ret;
 }
 
@@ -251,6 +255,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
}
 
packet_parse_l2(pkt_hdr);
+   pktio_entry->s.stats.in_octets += pkt_hdr->frame_len;
 
pkts[i] = pkt;
pkt = ODP_PACKET_INVALID;
@@ -261,6 +266,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
if (pkt != ODP_PACKET_INVALID)
odp_packet_free(pkt);
 
+   pktio_entry->s.stats.in_ucast_pkts += i;
return i;
 }
 
@@ -293,7 +299,9 @@ static int pcapif_send_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
ODP_ASSERT(pktio_entry->s.state == STATE_START);
 
for (i = 0; i < len; ++i) {
-   if (odp_packet_len(pkts[i]) > PKTIO_PCAP_MTU) {
+   int pkt_len = odp_packet_len(pkts[i]);
+
+   if (pkt_len > PKTIO_PCAP_MTU) {
if (i == 0)
return -1;
break;
@@ -302,9 +310,12 @@ static int pcapif_send_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
if (_pcapif_dump_pkt(pcap, pkts[i]) != 0)
break;
 
+   pktio_entry->s.stats.out_octets += pkt_len;
odp_packet_free(pkts[i]);
}
 
+   pktio_entry->s.stats.out_ucast_pkts += i;
+
return i;
 }
 
@@ -369,9 +380,24 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
*pktio_entry)
return pktio_entry->s.pkt_pcap.promisc;
 }
 
+static int pcapif_stats_reset(pktio_entry_t *pktio_entry)
+{
+   memset(_entry->s.stats, 0, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
+static int pcapif_stats(pktio_entry_t *pktio_entry,
+   odp_pktio_stats_t *stats)
+{
+   memcpy(stats, _entry->s.stats, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
 const pktio_if_ops_t pcap_pktio_ops = {
.open = pcapif_init,
.close = pcapif_close,
+   .stats = pcapif_stats,
+   .stats_reset = pcapif_stats_reset,
.recv = pcapif_recv_pkt,
.send = pcapif_send_pkt,
.mtu_get = pcapif_mtu_get,
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv2 2/5] linux-generic: pktio loop: implement statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/loop.c | 36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/pktio/loop.c 
b/platform/linux-generic/pktio/loop.c
index ce19add..ec65fd4 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -23,6 +23,8 @@
 /* MAC address for the "loop" interface */
 static const char pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01};
 
+static int loopback_stats_reset(pktio_entry_t *pktio_entry);
+
 static int loopback_open(odp_pktio_t id, pktio_entry_t *pktio_entry,
 const char *devname, odp_pool_t pool ODP_UNUSED)
 {
@@ -39,6 +41,8 @@ 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;
 
+   loopback_stats_reset(pktio_entry);
+
return 0;
 }
 
@@ -63,8 +67,11 @@ static int loopback_recv(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
pkt_hdr = odp_packet_hdr(pkts[i]);
packet_parse_reset(pkts[i]);
packet_parse_l2(pkt_hdr);
+   pktio_entry->s.stats.in_octets += odp_packet_len(pkts[i]);
}
 
+   pktio_entry->s.stats.in_ucast_pkts += nbr;
+
return nbr;
 }
 
@@ -74,12 +81,22 @@ static int loopback_send(pktio_entry_t *pktio_entry, 
odp_packet_t pkt_tbl[],
odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX];
queue_entry_t *qentry;
unsigned i;
+   int ret;
+   uint32_t bytes = 0;
 
-   for (i = 0; i < len; ++i)
+   for (i = 0; i < len; ++i) {
hdr_tbl[i] = odp_buf_to_hdr(_odp_packet_to_buffer(pkt_tbl[i]));
+   bytes += odp_packet_len(pkt_tbl[i]);
+   }
 
qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq);
-   return queue_enq_multi(qentry, hdr_tbl, len, 0);
+   ret = queue_enq_multi(qentry, hdr_tbl, len, 0);
+   if (ret > 0) {
+   pktio_entry->s.stats.out_ucast_pkts += ret;
+   pktio_entry->s.stats.out_octets += bytes;
+   }
+
+   return ret;
 }
 
 static int loopback_mtu_get(pktio_entry_t *pktio_entry ODP_UNUSED)
@@ -107,6 +124,19 @@ static int loopback_promisc_mode_get(pktio_entry_t 
*pktio_entry)
return pktio_entry->s.pkt_loop.promisc ? 1 : 0;
 }
 
+static int loopback_stats(pktio_entry_t *pktio_entry,
+ odp_pktio_stats_t *stats)
+{
+   memcpy(stats, _entry->s.stats, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
+static int loopback_stats_reset(pktio_entry_t *pktio_entry ODP_UNUSED)
+{
+   memset(_entry->s.stats, 0, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
 const pktio_if_ops_t loopback_pktio_ops = {
.init = NULL,
.term = NULL,
@@ -114,6 +144,8 @@ const pktio_if_ops_t loopback_pktio_ops = {
.close = loopback_close,
.start = NULL,
.stop = NULL,
+   .stats = loopback_stats,
+   .stats_reset = loopback_stats_reset,
.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] [API-NEXT PATCHv3 3/5] linux-generic: pcap: implement pktio statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/pcap.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/pcap.c 
b/platform/linux-generic/pktio/pcap.c
index 0817bf5..34cd73c 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -51,6 +51,8 @@
 #define PKTIO_PCAP_MTU (64 * 1024)
 static const char pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04};
 
+static int pcapif_stats_reset(pktio_entry_t *pktio_entry);
+
 static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname)
 {
char *tok;
@@ -156,6 +158,8 @@ static int pcapif_init(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if (ret == 0 && (!pcap->rx && !pcap->tx_dump))
ret = -1;
 
+   (void)pcapif_stats_reset(pktio_entry);
+
return ret;
 }
 
@@ -251,6 +255,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
}
 
packet_parse_l2(pkt_hdr);
+   pktio_entry->s.stats.in_octets += pkt_hdr->frame_len;
 
pkts[i] = pkt;
pkt = ODP_PACKET_INVALID;
@@ -261,6 +266,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
if (pkt != ODP_PACKET_INVALID)
odp_packet_free(pkt);
 
+   pktio_entry->s.stats.in_ucast_pkts += i;
return i;
 }
 
@@ -293,7 +299,9 @@ static int pcapif_send_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
ODP_ASSERT(pktio_entry->s.state == STATE_START);
 
for (i = 0; i < len; ++i) {
-   if (odp_packet_len(pkts[i]) > PKTIO_PCAP_MTU) {
+   int pkt_len = odp_packet_len(pkts[i]);
+
+   if (pkt_len > PKTIO_PCAP_MTU) {
if (i == 0)
return -1;
break;
@@ -302,9 +310,12 @@ static int pcapif_send_pkt(pktio_entry_t *pktio_entry, 
odp_packet_t pkts[],
if (_pcapif_dump_pkt(pcap, pkts[i]) != 0)
break;
 
+   pktio_entry->s.stats.out_octets += pkt_len;
odp_packet_free(pkts[i]);
}
 
+   pktio_entry->s.stats.out_ucast_pkts += i;
+
return i;
 }
 
@@ -369,9 +380,24 @@ static int pcapif_promisc_mode_get(pktio_entry_t 
*pktio_entry)
return pktio_entry->s.pkt_pcap.promisc;
 }
 
+static int pcapif_stats_reset(pktio_entry_t *pktio_entry)
+{
+   memset(_entry->s.stats, 0, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
+static int pcapif_stats(pktio_entry_t *pktio_entry,
+   odp_pktio_stats_t *stats)
+{
+   memcpy(stats, _entry->s.stats, sizeof(odp_pktio_stats_t));
+   return 0;
+}
+
 const pktio_if_ops_t pcap_pktio_ops = {
.open = pcapif_init,
.close = pcapif_close,
+   .stats = pcapif_stats,
+   .stats_reset = pcapif_stats_reset,
.recv = pcapif_recv_pkt,
.send = pcapif_send_pkt,
.mtu_get = pcapif_mtu_get,
-- 
1.9.1

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


[lng-odp] [API-NEXT PATCHv3 4/5] linux-generic: pktio netmap: implement statistics counters

2015-11-18 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/pktio/netmap.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 794c82e..920c365 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -168,6 +168,12 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, 
pktio_entry_t *pktio_entry,
if (err)
goto error;
 
+   /* netmap uses only ethtool to get statistics counters */
+   pktio_entry->s.use_ethtool = 1;
+   err = sock_stats_reset(pktio_entry);
+   if (err != 0)
+   goto error;
+
/* Wait for the link to come up */
for (i = 0; i < NM_OPEN_RETRIES; i++) {
err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_GLINK);
@@ -313,6 +319,8 @@ const pktio_if_ops_t netmap_pktio_ops = {
.close = netmap_close,
.start = NULL,
.stop = NULL,
+   .stats = sock_stats,
+   .stats_reset = sock_stats_reset,
.recv = netmap_recv,
.send = netmap_send,
.mtu_get = netmap_mtu_get,
-- 
1.9.1

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


Re: [lng-odp] [PATCH 1/2] helper/hashtable.c: remove unused variable

2015-11-18 Thread Maxim Uvarov

Merged,
Maxim.

On 11/17/2015 00:56, Mike Holmes wrote:



On 16 November 2015 at 13:03, Anders Roxell > wrote:


hashtable.c: In function 'odph_hash_table_create':
hashtable.c:68:6: warning: unused variable 'idx' [-Wunused-variable]
  int idx, i;
  ^
hashtable.c: In function 'odph_hash_table_lookup':
hashtable.c:151:6: warning: unused variable 'idx' [-Wunused-variable]
  int idx;
  ^

Signed-off-by: Anders Roxell >


For series

Reviewed-by: Mike Holmes >


---
 helper/hashtable.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/helper/hashtable.c b/helper/hashtable.c
index 0b29814..1121beb 100644
--- a/helper/hashtable.c
+++ b/helper/hashtable.c
@@ -65,7 +65,7 @@ odph_table_t odph_hash_table_create(const char
*name, uint32_t capacity,
uint32_t key_size,
uint32_t value_size)
 {
-   int idx, i;
+   int i;
uint32_t node_num;
odph_hash_table_imp *tbl;
odp_shm_t shmem;
@@ -148,7 +148,6 @@ int odph_hash_table_destroy(odph_table_t table)

 odph_table_t odph_hash_table_lookup(const char *name)
 {
-   int idx;
odph_hash_table_imp *hash_tbl;

if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN)
--
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


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


Re: [lng-odp] odp_platform_init_t vs ODP_PLATFORM_PARAMS

2015-11-18 Thread Mike Holmes
On 18 November 2015 at 08:08, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> >
> > --- a/include/odp/api/init.h
> > +++ b/include/odp/api/init.h
> > @@ -152,6 +152,10 @@ typedef struct odp_platform_init_t {
> >*
> >* @see odp_term_global()
> >* @see odp_init_local() which is required per thread before use.
> > + * @note The underlying implementation may have an another way to get
> > + * configuration related to platform_params (e.g. environmental
> variable,
> > + * configuration file), but if the application passes it, it should
> > always
> > + * take precedence.
> >*/
> >   int odp_init_global(const odp_init_t *params,
> >  const odp_platform_init_t *platform_params);
> >
>
> Otherwise OK, but add it into the body of the documentation text (instead
> of @note).
>

I like this but I'd like a clarification.

If a platform may have another way, implicitly we saying platform must
always accept  platform_params for all the items that may have been passed
another way.


>
> -Petri
> ___
> 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] [API-NEXT PATCHv2 1/5] linux-generic: sockets: implement pktio statistics counters

2015-11-18 Thread Stuart Haslam
On Wed, Nov 18, 2015 at 12:34:24PM +0300, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/Makefile.am |   2 +
>  .../linux-generic/include/odp_packet_io_internal.h |  11 ++
>  platform/linux-generic/include/odp_packet_socket.h |   6 +
>  platform/linux-generic/odp_packet_io.c |  53 +++
>  platform/linux-generic/pktio/ethtool.c | 160 
> +
>  platform/linux-generic/pktio/socket.c  |  84 +++
>  platform/linux-generic/pktio/socket_mmap.c |  19 +++
>  platform/linux-generic/pktio/sysfs.c   |  71 +
>  8 files changed, 406 insertions(+)
>  create mode 100644 platform/linux-generic/pktio/ethtool.c
>  create mode 100644 platform/linux-generic/pktio/sysfs.c
> 
> diff --git a/platform/linux-generic/Makefile.am 
> b/platform/linux-generic/Makefile.am
> index 610c79c..71b030e 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -165,11 +165,13 @@ __LIB__libodp_la_SOURCES = \
>  odp_packet.c \
>  odp_packet_flags.c \
>  odp_packet_io.c \
> +pktio/ethtool.c \
>  pktio/io_ops.c \
>  pktio/loop.c \
>  pktio/netmap.c \
>  pktio/socket.c \
>  pktio/socket_mmap.c \
> +pktio/sysfs.c \
>  odp_pool.c \
>  odp_queue.c \
>  odp_rwlock.c \
> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
> b/platform/linux-generic/include/odp_packet_io_internal.h
> index 1a1118c..6566978 100644
> --- a/platform/linux-generic/include/odp_packet_io_internal.h
> +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> @@ -84,6 +84,9 @@ struct pktio_entry {
>   STATE_STOP
>   } state;
>   classifier_t cls;   /**< classifier linked with this pktio*/
> + odp_pktio_stats_t stats;/**< statistic counters for pktio */
> + int use_ethtool;/**< 1 - use ethtool,
> +  0 - sysfs for statistics */
>   char name[PKTIO_NAME_LEN];  /**< name of pktio provided to
>  pktio_open() */
>   odp_pktio_param_t param;
> @@ -107,6 +110,8 @@ typedef struct pktio_if_ops {
>   int (*close)(pktio_entry_t *pktio_entry);
>   int (*start)(pktio_entry_t *pktio_entry);
>   int (*stop)(pktio_entry_t *pktio_entry);
> + int (*stats)(pktio_entry_t *pktio_entry, odp_pktio_stats_t *stats);
> + int (*stats_reset)(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[],
> @@ -159,6 +164,12 @@ extern const pktio_if_ops_t pcap_pktio_ops;
>  #endif
>  extern const pktio_if_ops_t * const pktio_if_ops[];
>  
> +int sysfs_stats(pktio_entry_t *pktio_entry,
> + odp_pktio_stats_t *stats);
> +int sock_stats_reset(pktio_entry_t *pktio_entry);
> +int sock_stats(pktio_entry_t *pktio_entry,
> +odp_pktio_stats_t *stats);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/platform/linux-generic/include/odp_packet_socket.h 
> b/platform/linux-generic/include/odp_packet_socket.h
> index a5e0eb3..0836e3c 100644
> --- a/platform/linux-generic/include/odp_packet_socket.h
> +++ b/platform/linux-generic/include/odp_packet_socket.h
> @@ -18,6 +18,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  
> @@ -114,4 +115,9 @@ int promisc_mode_set_fd(int fd, const char *name, int 
> enable);
>   */
>  int promisc_mode_get_fd(int fd, const char *name);
>  
> +/**
> + * Get ethtool statistics of a packet socket
> + */
> +int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats);
> +
>  #endif
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index 3ef400f..ba97629 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -862,3 +862,56 @@ void odp_pktio_print(odp_pktio_t id)
>  
>   ODP_PRINT("\n%s\n", str);
>  }
> +
> +int odp_pktio_stats(odp_pktio_t pktio,
> + odp_pktio_stats_t *stats)
> +{
> + pktio_entry_t *entry;
> + int ret = -1;
> +
> + entry = get_pktio_entry(pktio);
> + if (entry == NULL) {
> + ODP_DBG("pktio entry %d does not exist\n", pktio);
> + return -1;
> + }
> +
> + lock_entry(entry);
> +
> + if (odp_unlikely(is_free(entry))) {
> + unlock_entry(entry);
> + ODP_DBG("already freed pktio\n");
> + return -1;
> + }
> +
> + if (entry->s.ops->stats)
> +  

[lng-odp] [PATCH] example/webserver: pick up the www_dir from the environment

2015-11-18 Thread Anders Roxell
Signed-off-by: Anders Roxell 
---
 example/webserver/httpd.c  | 7 ---
 scripts/start_webserver.sh | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/example/webserver/httpd.c b/example/webserver/httpd.c
index d4e37fa..98753a4 100644
--- a/example/webserver/httpd.c
+++ b/example/webserver/httpd.c
@@ -14,9 +14,6 @@ void httpd_main(uint32_t addr);
 int sigreceived = 0;
 static uint32_t myaddr;
 
-/* Set www_dir to point to your web directory. */
-static const char *www_dir = "/home/hjokinen/Dropbox/kolumbus-web";
-
 /* Table of concurrent connections */
 #define NUM_CONNECTIONS 16
 static struct {
@@ -62,6 +59,8 @@ static int sendf(int fd, const char *fmt, ...)
 /* Send one file. */
 static void get_file(int s, char *url)
 {
+   /* Set www_dir to point to your web directory. */
+   char *www_dir = NULL;
char bufo[512];
int n, w;
 
@@ -88,6 +87,8 @@ static void get_file(int s, char *url)
else if (!strcmp(p2, "js")) mime = "text/javascript";
}
 
+   www_dir = getenv("www_dir");
+
snprintf(bufo, sizeof(bufo), "%s/%s", www_dir, p);
FILE *f = fopen(bufo, "rb");
 
diff --git a/scripts/start_webserver.sh b/scripts/start_webserver.sh
index ac9b66d..ced4ac1 100755
--- a/scripts/start_webserver.sh
+++ b/scripts/start_webserver.sh
@@ -7,6 +7,8 @@ fi
 intf=$1
 echo Starting Web Server on interface $intf
 
+www_dir="${www_dir:-"/var/www/"}"
+export www_dir
 ./example/webserver/webserver -i $intf -c 2 &
 
 sleep 1
-- 
2.1.4

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


Re: [lng-odp] [API-NEXT PATCHv2 1/5] linux-generic: sockets: implement pktio statistics counters

2015-11-18 Thread Stuart Haslam
On Wed, Nov 18, 2015 at 12:34:24PM +0300, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/Makefile.am |   2 +
>  .../linux-generic/include/odp_packet_io_internal.h |  11 ++
>  platform/linux-generic/include/odp_packet_socket.h |   6 +
>  platform/linux-generic/odp_packet_io.c |  53 +++
>  platform/linux-generic/pktio/ethtool.c | 160 
> +
>  platform/linux-generic/pktio/socket.c  |  84 +++
>  platform/linux-generic/pktio/socket_mmap.c |  19 +++
>  platform/linux-generic/pktio/sysfs.c   |  71 +
>  8 files changed, 406 insertions(+)
>  create mode 100644 platform/linux-generic/pktio/ethtool.c
>  create mode 100644 platform/linux-generic/pktio/sysfs.c
> 
> diff --git a/platform/linux-generic/Makefile.am 
> b/platform/linux-generic/Makefile.am
> index 610c79c..71b030e 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -165,11 +165,13 @@ __LIB__libodp_la_SOURCES = \
>  odp_packet.c \
>  odp_packet_flags.c \
>  odp_packet_io.c \
> +pktio/ethtool.c \
>  pktio/io_ops.c \
>  pktio/loop.c \
>  pktio/netmap.c \
>  pktio/socket.c \
>  pktio/socket_mmap.c \
> +pktio/sysfs.c \
>  odp_pool.c \
>  odp_queue.c \
>  odp_rwlock.c \
> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
> b/platform/linux-generic/include/odp_packet_io_internal.h
> index 1a1118c..6566978 100644
> --- a/platform/linux-generic/include/odp_packet_io_internal.h
> +++ b/platform/linux-generic/include/odp_packet_io_internal.h
> @@ -84,6 +84,9 @@ struct pktio_entry {
>   STATE_STOP
>   } state;
>   classifier_t cls;   /**< classifier linked with this pktio*/
> + odp_pktio_stats_t stats;/**< statistic counters for pktio */
> + int use_ethtool;/**< 1 - use ethtool,
> +  0 - sysfs for statistics */
>   char name[PKTIO_NAME_LEN];  /**< name of pktio provided to
>  pktio_open() */
>   odp_pktio_param_t param;
> @@ -107,6 +110,8 @@ typedef struct pktio_if_ops {
>   int (*close)(pktio_entry_t *pktio_entry);
>   int (*start)(pktio_entry_t *pktio_entry);
>   int (*stop)(pktio_entry_t *pktio_entry);
> + int (*stats)(pktio_entry_t *pktio_entry, odp_pktio_stats_t *stats);
> + int (*stats_reset)(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[],
> @@ -159,6 +164,12 @@ extern const pktio_if_ops_t pcap_pktio_ops;
>  #endif
>  extern const pktio_if_ops_t * const pktio_if_ops[];
>  
> +int sysfs_stats(pktio_entry_t *pktio_entry,
> + odp_pktio_stats_t *stats);
> +int sock_stats_reset(pktio_entry_t *pktio_entry);
> +int sock_stats(pktio_entry_t *pktio_entry,
> +odp_pktio_stats_t *stats);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/platform/linux-generic/include/odp_packet_socket.h 
> b/platform/linux-generic/include/odp_packet_socket.h
> index a5e0eb3..0836e3c 100644
> --- a/platform/linux-generic/include/odp_packet_socket.h
> +++ b/platform/linux-generic/include/odp_packet_socket.h
> @@ -18,6 +18,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  
> @@ -114,4 +115,9 @@ int promisc_mode_set_fd(int fd, const char *name, int 
> enable);
>   */
>  int promisc_mode_get_fd(int fd, const char *name);
>  
> +/**
> + * Get ethtool statistics of a packet socket
> + */
> +int ethtool_stats_get_fd(int fd, const char *name, odp_pktio_stats_t *stats);
> +
>  #endif
> diff --git a/platform/linux-generic/odp_packet_io.c 
> b/platform/linux-generic/odp_packet_io.c
> index 3ef400f..ba97629 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -862,3 +862,56 @@ void odp_pktio_print(odp_pktio_t id)
>  
>   ODP_PRINT("\n%s\n", str);
>  }
> +
> +int odp_pktio_stats(odp_pktio_t pktio,
> + odp_pktio_stats_t *stats)
> +{
> + pktio_entry_t *entry;
> + int ret = -1;
> +
> + entry = get_pktio_entry(pktio);
> + if (entry == NULL) {
> + ODP_DBG("pktio entry %d does not exist\n", pktio);
> + return -1;
> + }
> +
> + lock_entry(entry);
> +
> + if (odp_unlikely(is_free(entry))) {
> + unlock_entry(entry);
> + ODP_DBG("already freed pktio\n");
> + return -1;
> + }
> +
> + if (entry->s.ops->stats)
> +  

Re: [lng-odp] [PATCH] doc: implementers-guide: convert to ODP standard layout

2015-11-18 Thread Bill Fischofer
Hmmm...I must have gotten the wrong patch as this now applies to master for
me.  Spelling issues noted.

On Wed, Nov 18, 2015 at 12:09 PM, Mike Holmes 
wrote:

> Signed-off-by: Mike Holmes 
> ---
>  doc/implementers-guide/implementers-guide.adoc | 265
> +
>  1 file changed, 185 insertions(+), 80 deletions(-)
>
> diff --git a/doc/implementers-guide/implementers-guide.adoc
> b/doc/implementers-guide/implementers-guide.adoc
> index 0033ba3..8b9c729 100644
> --- a/doc/implementers-guide/implementers-guide.adoc
> +++ b/doc/implementers-guide/implementers-guide.adoc
> @@ -11,9 +11,11 @@ Further details about ODP may be found at
> http://opendataplane.org[ODP homepage]
>
>
>  :numbered:
> -The include structure
> --
> -The implementers view of the include source tree allows the common API
> definitions and documentation to be reused by all the platforms defined in
> the tree, but leave the actual definitions to be defined by the specific
> platform.
> +== The include structure ==
> +
> +The implementers view of the include source tree allows the common API
> +definitions and documentation to be reused by all the platforms defined
> in the
> +tree, but leave the actual definitions to be defined by the specific
> platform.
>
>  .Implementers include structure
>  
> @@ -29,94 +31,145 @@ The implementers view of the include source tree
> allows the common API definitio
>  │   ├── /
>  │   │   ├── include/
>  │   │   │   ├── odp/
> -│   │   │   │   ├── In-line function definitions of the public API for
> this platform
> -│   │   │   │   │   seen by the applicationx.
> +│   │   │   │   ├── In-line function definitions of the public API for
> this
> +│   │   │   │   │   platform seen by the application.
>  │   │   │   │   │
>  │   │   │   │   └── plat/
> -│   │   │   │   └── Platform specific types, enums etc as seen by the
> application
> -│   │   │   │   but require overriding by the implementation.
> +│   │   │   │   └── Platform specific types, enums etc as seen by the
> +│   │   │   │   application but require overriding by the
> +│   │   │   │   implementation.
>  │   │   │   │
>  │   │   │   └── Internal header files seen only by the implementation.
>  
>
> -The doxygen description of the API definition is held in the public api
> file 'include/odp/api'.
> -This file is included by a counterpart in 'platform/ name>/include/odp'.
> -The include of the public API is AFTER the platform specific definitions
> to allow the platform to provide definitions that match the underlying
> hardware.
> -The implementation code includes 'platform/ name>/include/plat' and this then provides the source files with a complete
> definition the ODP API to be implemented.
> -Applications in turn include the include/odp.h file which includes the
> 'platform//include/plat' files to provide a complete
> definition of the API.
> +The doxygen description of the API definition is held in the public api
> file
> +'include/odp/api'.
> +This file is included by a counterpart in
> +'platform//include/odp'.
> +The include of the public API is AFTER the platform specific definitions
> to
> +allow the platform to provide definitions that match the underlying
> hardware.
> +The implementation code includes 'platform/ name>/include/plat'
> +and this then provides the source files with a complete definition the
> ODP API
> +to be implemented.
> +Applications in turn include the include/odp.h file which includes the
> +'platform//include/plat' files to provide a complete
> +definition of the API.
>
> -The validation Suite
> -
> -ODP provides a comprehensive set of API validation tests that are
> intended to be used by implementers during development and by application
> developers to verify that a particular implementation meets their
> requirements.
> +== The validation Suite ==
> +
> +ODP provides a comprehensive set of API validation tests that are
> intended to be
> +used by implementers during development and by application developers to
> verify
> +that a particular implementation meets their requirements.
>
>  The list of these tests is expected to grow as ODP grows.
>
> -The list of test executables is run by the automake test harness, when
> running "make check".
> -Therefore, as required by this harness, each executable should return 0
> on success (tests passed), 77 on inconclusive, or any other values on
> failure.
> -The automake functionality shows a status line (PASSED/FAIL...) for each
> of the ran test executables.
> +The list of test executables is run by the automake test harness, when
> running
> +"make check".
> +Therefore, as required by this harness, each executable should return 0 on
> +success (tests passed), 77 on inconclusive, or any other values on
> failure.
> +The automake functionality shows a status line (PASSED/FAIL...) for each
> of the
> +ran test executables.
>
> 

[lng-odp] [PATCH] scripts/builddeb: add support for source only generation

2015-11-18 Thread Riku Voipio
For CI loop, we have separate job to build binaries (build-package).
To make it possible to build source package without first installing
all build-deps, add a new optional parameter "source" to build
only source package.

Signed-off-by: Riku Voipio 
---
 scripts/builddeb | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/builddeb b/scripts/builddeb
index 829fd1d..28927ea 100755
--- a/scripts/builddeb
+++ b/scripts/builddeb
@@ -23,6 +23,11 @@ if [ $(egrep "\.([a-z0-9]{8}\>|dirty)" .scmversion |wc -l) 
-gt 0 ]; then
dch --newversion ${version}-1 --urgency low "not a official release!"
 fi
 
-debuild -us -uc
+if [ "$1" = source ]
+then
+   dpkg-buildpackage -S -d
+else
+   debuild -us -uc
+fi
 popd
 popd
-- 
2.6.2

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


[lng-odp] [PATCH 1/2] configure.ac: do not set linux-generic as default platform

2015-11-18 Thread Nicolas Morey-Chaisemartin
This prepares for the second patch and add support for repo
 which do not have a linux-generic platform

Signed-off-by: Nicolas Morey-Chaisemartin 
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index be21eaf..0d7860b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,7 @@ AC_ARG_WITH([platform],
 [AS_HELP_STRING([--with-platform=platform],
 [select platform to be used, default linux-generic])],
 [],
-[with_platform=linux-generic
+[AC_MSG_ERROR([No platform specified. Use --with-platform])
 ])
 
 AC_SUBST([with_platform])
-- 
2.6.3.372.gcb93895


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


[lng-odp] [PATCH 2/2] bootstrap: auto generate platform list

2015-11-18 Thread Nicolas Morey-Chaisemartin
This list all the available platforms looking for
 platform/*/m4/configure.m4 and generate the appropriate m4
 file for the configure.ac to include

Signed-off-by: Nicolas Morey-Chaisemartin 
---
 bootstrap| 23 +++
 configure.ac |  9 +
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/bootstrap b/bootstrap
index 7c3d220..daa8c58 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,5 +1,28 @@
 #! /bin/sh
 set -x
+
+# Auto generate the platform list
+PLATFORM_M4S=$(ls platform/*/m4/configure.m4)
+PLATFORMS=$(basename -a ${PLATFORM_M4S//\/m4\/configure\.m4/})
+GEN_M4="m4/platforms.m4"
+
+prefix=""
+echo "# Auto-Generated platform list" > $GEN_M4
+for platform in $PLATFORMS; do
+   cat << EOF >> $GEN_M4
+${prefix}if test "\${with_platform}" == "${platform}";
+then
+   m4_include([./platform/${platform}/m4/configure.m4])
+EOF
+   prefix="el"
+done
+cat << EOF >> $GEN_M4
+else
+echo "UNSUPPORTED PLATFORM: \${with_platform}"
+exit 1
+fi
+EOF
+
 aclocal -I config -I m4
 libtoolize --copy
 autoheader
diff --git a/configure.ac b/configure.ac
index 0d7860b..157e5f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,14 +87,7 @@ netmap_support=no
 
 ##
 # Run platform specific checks and settings
-##
-if test "${with_platform}" == "linux-generic";
-then
-m4_include([./platform/linux-generic/m4/configure.m4])
-else
-echo "UNSUPPORTED PLATFORM: ${with_platform}"
-exit 1
-fi
+m4_include([m4/platforms.m4])
 
 ##
 # Set conditionals as computed within platform specific files
-- 
2.6.3.372.gcb93895

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