Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Maxim Uvarov

That patches introduce segfault. Pktio is socket_mmap:

8cf523f api: classification: add odp_cls_cos_pool_set() api
8da0ee0 example: classifier: add odp_cls_cos_pool_set() api
4ade6a3 validation: classification: add odp_cls_cos_pool_set() api
e695969 linux-generic: classification: implements odp_cls_cos_pool_set() api

Maxim.

On 12/10/2015 23:04, Maxim Uvarov wrote:

Bala,

I have opposite result. After you patch master never fails. api-next 
fails and my merge master to api-next also fails.

So it looks like we have something in api-next that breaks the work.


queue1   |queue2   |queue3   |DefaultCos   |Total Packets
queue  pool  |queue  pool  |queue  pool  |queue  pool  |
437867 437867|131602 131602|653612 653612|59811  59811 |1282892
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x74a91700 (LWP 3363)]
0x0042652a in _odp_packet_cls_enq (pktio_entry=0x2b600040, 
base=0x75307042 "33", buf_len=107, pkt_ret=0x74a90c40) at 
pktio/pktio_common.c:29

29pool = cos->s.pool->s.pool_hdl;
(gdb) bt
#0  0x0042652a in _odp_packet_cls_enq 
(pktio_entry=0x2b600040, base=0x75307042 "33", buf_len=107, 
pkt_ret=0x74a90c40) at pktio/pktio_common.c:29
#1  0x00410a88 in pkt_mmap_v2_rx (pktio_entry=0x2b600040, 
pkt_sock=0x2b600080, pkt_table=0x74a90c40, len=8, 
if_mac=0x2b6001a4 "") at pktio/socket_mmap.c:152
#2  0x004118b3 in sock_mmap_recv (pktio_entry=0x2b600040, 
pkt_table=0x74a90c40, len=8) at pktio/socket_mmap.c:519
#3  0x0040cee1 in odp_pktio_recv (id=0x1, 
pkt_table=0x74a90c40, len=8) at odp_packet_io.c:397
#4  0x0040d843 in pktin_poll (entry=0x2b600040) at 
odp_packet_io.c:667
#5  0x00417a0f in schedule (out_queue=0x74a90e10, 
out_ev=0x74a90dd8, max_num=1, max_deq=4) at odp_schedule.c:496
#6  0x00417d90 in schedule_loop (out_queue=0x74a90e10, 
wait=18446744073709551615, out_ev=0x74a90dd8, max_num=1, 
max_deq=4) at odp_schedule.c:594
#7  0x00417e67 in odp_schedule (out_queue=0x74a90e10, 
wait=18446744073709551615) at odp_schedule.c:626
#8  0x0040321f in pktio_receive_thread (arg=0x77ff4000) at 
odp_classifier.c:304
#9  0x0042900b in odp_run_start_routine (arg=0x6954e0) at 
linux.c:36
#10 0x773a3182 in start_thread (arg=0x74a91700) at 
pthread_create.c:312
#11 0x770d047d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) p cos
$1 = (cos_t *) 0x0
(gdb)


On 12/10/2015 18:12, Bala Manoharan wrote:

odp_classifier runs on api-next branch but if we run on master it
currently crashes during queue_enq function.
I remember the crash was similar to the one we had during queue
reorder implementation.

Regards,
Bala

On 10 December 2015 at 20:38, Stuart Haslam 
 wrote:

On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:

How to reproduce that it is broken?


I was looking at:

sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run

This shows a few packets going through initially then 0. Turns out this
is related to the netmap pktio, this works:

sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic 
./test/performance/odp_l2fwd_run


Not sure if this is the same failure Bala was seeing.

--
Stuart.







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


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

2015-12-10 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 
---

v2: improve wording about superseding

 include/odp/api/init.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 737ff6d..4ac5216 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -141,6 +141,10 @@ 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 platform_params, it should always
+ * supersede any other configuration data the platform has.
  *
  * @param params  Those parameters that are interpreted by the ODP API.
  *Use NULL to set all parameters to their defaults.
-- 
1.9.1

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


Re: [lng-odp] [PATCH] linux-generic: schedule: set sched_local.pool correctly

2015-12-10 Thread Bill Fischofer
Ping

On Tue, Dec 1, 2015 at 7:14 AM, Bill Fischofer 
wrote:

> This corrects bug https://bugs.linaro.org/show_bug.cgi?id=1921
>
> Signed-off-by: Bill Fischofer 
> ---
>  platform/linux-generic/odp_schedule.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/platform/linux-generic/odp_schedule.c
> b/platform/linux-generic/odp_schedule.c
> index 884ae60..9b7cd57 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -553,6 +553,8 @@ static int schedule(odp_queue_t *out_queue,
> odp_event_t out_ev[],
> sched_local.origin_qe = qe;
> sched_local.order =
> sched_local.buf_hdr[0]->order;
> +   sched_local.pool =
> +   sched_local.buf_hdr[0]->pool_hdl;
> for (k = 0;
>  k < qe->s.param.sched.lock_count;
>  k++) {
> --
> 2.1.4
>
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Maxim Uvarov

Bala,

I have opposite result. After you patch master never fails. api-next 
fails and my merge master to api-next also fails.

So it looks like we have something in api-next that breaks the work.


queue1   |queue2   |queue3   |DefaultCos   |Total Packets
queue  pool  |queue  pool  |queue  pool  |queue  pool  |
437867 437867|131602 131602|653612 653612|59811  59811 |1282892
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x74a91700 (LWP 3363)]
0x0042652a in _odp_packet_cls_enq (pktio_entry=0x2b600040, 
base=0x75307042 "33", buf_len=107, pkt_ret=0x74a90c40) at 
pktio/pktio_common.c:29

29pool = cos->s.pool->s.pool_hdl;
(gdb) bt
#0  0x0042652a in _odp_packet_cls_enq 
(pktio_entry=0x2b600040, base=0x75307042 "33", buf_len=107, 
pkt_ret=0x74a90c40) at pktio/pktio_common.c:29
#1  0x00410a88 in pkt_mmap_v2_rx (pktio_entry=0x2b600040, 
pkt_sock=0x2b600080, pkt_table=0x74a90c40, len=8, 
if_mac=0x2b6001a4 "") at pktio/socket_mmap.c:152
#2  0x004118b3 in sock_mmap_recv (pktio_entry=0x2b600040, 
pkt_table=0x74a90c40, len=8) at pktio/socket_mmap.c:519
#3  0x0040cee1 in odp_pktio_recv (id=0x1, 
pkt_table=0x74a90c40, len=8) at odp_packet_io.c:397
#4  0x0040d843 in pktin_poll (entry=0x2b600040) at 
odp_packet_io.c:667
#5  0x00417a0f in schedule (out_queue=0x74a90e10, 
out_ev=0x74a90dd8, max_num=1, max_deq=4) at odp_schedule.c:496
#6  0x00417d90 in schedule_loop (out_queue=0x74a90e10, 
wait=18446744073709551615, out_ev=0x74a90dd8, max_num=1, max_deq=4) 
at odp_schedule.c:594
#7  0x00417e67 in odp_schedule (out_queue=0x74a90e10, 
wait=18446744073709551615) at odp_schedule.c:626
#8  0x0040321f in pktio_receive_thread (arg=0x77ff4000) at 
odp_classifier.c:304

#9  0x0042900b in odp_run_start_routine (arg=0x6954e0) at linux.c:36
#10 0x773a3182 in start_thread (arg=0x74a91700) at 
pthread_create.c:312
#11 0x770d047d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) p cos
$1 = (cos_t *) 0x0
(gdb)


On 12/10/2015 18:12, Bala Manoharan wrote:

odp_classifier runs on api-next branch but if we run on master it
currently crashes during queue_enq function.
I remember the crash was similar to the one we had during queue
reorder implementation.

Regards,
Bala

On 10 December 2015 at 20:38, Stuart Haslam  wrote:

On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:

How to reproduce that it is broken?


I was looking at:

sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run

This shows a few packets going through initially then 0. Turns out this
is related to the netmap pktio, this works:

sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic 
./test/performance/odp_l2fwd_run

Not sure if this is the same failure Bala was seeing.

--
Stuart.





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


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

2015-12-10 Thread Ivan Khoronzhuk



On 10.12.15 08:42, Maxim Uvarov wrote:

Going to apply this patch to unblock builds in new distros. Any objections?

Maxim.


I worry about change of timespec struct can break linux-generic time API.
I believe it will not happen, but that's why I like Maxim`s approach a little 
more.
[lng-odp] [API-NEXT PATCH 2/2] linux-generic: time: use same type as returned



On 12/09/2015 19:25, Ola Liljedahl wrote:

On 9 December 2015 at 16:53, Bill Fischofer > wrote:

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

Yes this is the way it should be done. This is also another step in the ODP API 
becoming binary portable and run-time independent of the actual implementation.


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

diff --git a/platform/linux-generic/include/odp/plat/time_types.h
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..05e2b59 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,7 +21,10 @@ extern "C" {
  *  @{
  **/

-typedef struct timespec odp_time_t;
+typedef struct {
+   uint64_t tv_sec;
+   int64_t  tv_nsec;
+} odp_time_t;

 odp_time_t odp_time_null(void);

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

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

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

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

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

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

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

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

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

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

time.tv_sec = t2.tv_sec + t1.tv_sec;
time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
@@ -115,16 +120,16 @@ uint64_t odp_time_to_u64(odp_time_t time)

 odp_time_t odp_time_null(void)
 {
-   return (struct timespec) {0, 0};
+   return (odp_time_t) {0, 0};
 }

 int odp_time_global_init(void)
 {
int ret;
-   struct timespec time;
+   _odp_time_t time;

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

return ret;
 }
--
2.1.4

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




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


___
lng-odp mailing list
lng-odp@lists.linaro.org

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

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

> Signed-off-by: Bill Fischofer 
> ---
>  .../linux-generic/include/odp/plat/time_types.h|  5 +++-
>  platform/linux-generic/odp_time.c  | 27 +
> -
>  2 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
> b/platform/linux-generic/include/odp/plat/time_types.h
> index e5765ec..05e2b59 100644
> --- a/platform/linux-generic/include/odp/plat/time_types.h
> +++ b/platform/linux-generic/include/odp/plat/time_types.h
> @@ -21,7 +21,10 @@ extern "C" {
>   *  @{
>   **/
> 
> -typedef struct timespec odp_time_t;
> +typedef struct {
> + uint64_t tv_sec;
> + int64_t  tv_nsec;
> +} odp_time_t;


This struct should match timespec exactly. If that’s not possible, union should 
not be used but copy data between timespec and odp_time_t.

POSIX: "The  header shall declare the structure timespec, which has at 
least the following members:"

time_t  tv_secSeconds. 
longtv_nsec   Nanoseconds. 

int64_t is not long. I think we hit that previously this week. Long may be 32 
bits on a 32 bit system.

time_t is defined in C headers.

Also POSIX spec states that there can be more members than these. That hints 
that field order/offset and struct size may vary. At least the hack should be 
well documented and build/run time checked.

-Petri


> 
>  odp_time_t odp_time_null(void);
> 
> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
> generic/odp_time.c
> index 1c7c214..b5737f6 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -11,7 +11,12 @@
>  #include 
>  #include 
> 
> -static struct timespec start_time;
> +typedef union {
> + odp_time_t  ex;
> + struct timespec in;
> +} _odp_time_t;
> +
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

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


From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT Ola 
Liljedahl
Sent: Wednesday, December 09, 2015 6:26 PM
To: Bill Fischofer
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] linux-generic: time: remove posix bleed 
through on odp_time_t

On 9 December 2015 at 16:53, Bill Fischofer 
> wrote:
The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
mechanism so that these dependencies do not "bleed through" the ODP API.
This means that ODP applications can be independent of _POSIX_C_SOURCE
level.
Yes this is the way it should be done. This is also another step in the ODP API 
becoming binary portable and run-time independent of the actual implementation.

This definition is still platform (linux-generic) specific. It just redefines 
timespec struct, so that original timespec and thus posix level is not visible 
to application.

-Petri

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


Re: [lng-odp] [PATCH 00/10] Pktio checks

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


> -Original Message-
> From: EXT Maxim Uvarov [mailto:maxim.uva...@linaro.org]
> Sent: Thursday, December 10, 2015 11:15 AM
> To: Savolainen, Petri (Nokia - FI/Espoo); EXT Mike Holmes
> Cc: lng-odp@lists.linaro.org
> Subject: Re: [lng-odp] [PATCH 00/10] Pktio checks
> 
> On 12/10/2015 12:08, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> > I’d really need the bug fix applied on api-next ASAP. It’s more urgent
> > than a guide update. Buggy code slows down actual work. Buggy document
> > is just annoying but does not prevent working efficiently.
> >
> > Anyway, this used to be our policy: bug fixes (to master) are merged
> > to api-next soon after master. What is the rationale **not** to merge
> > bug fixes ASAP?
> >
> > -Petri
> >
> 
> working on sync master and api-next right now.
> 
> Maxim.


Thanks!

-Petri


> >
> > *From:*EXT Mike Holmes [mailto:mike.hol...@linaro.org]
> > *Sent:* Wednesday, December 09, 2015 8:34 PM
> > *To:* Maxim Uvarov
> > *Cc:* Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
> > *Subject:* Re: [lng-odp] [PATCH 00/10] Pktio checks
> >
> > Can we merge [1] that was ready and reviewed last week with no
> objections
> >
> > Maxim Petri - can you review that patch and if there are changes
> > needed I can update.
> >
> > [1] [PATCH] doc: process-guide: add release process
> >
> > On 9 December 2015 at 04:35, Maxim Uvarov  > > wrote:
> >
> > On 12/09/2015 11:54, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> >
> >
> > So, critical bug fixes from master side are not visible to
> > api-next until a month or so?
> >
> >
> > Exactly. api-next was broken with TM. Until issue if fixed and
> > branch operates as usual, there is no pull of critical bug and etc.
> > https://ci.linaro.org/view/odp-ci/job/odp-api-check
> >
> > Now some people still see build fails with gcc4.9, but I can not
> > reproduce it and CI also passes. So only now I can pull changes
> > from master.
> >
> > Maxim.
> >
> > Most bug fixes should apply directly to api-next as well,
> > since those are implementation/test code/build system fixes
> > (not api changing fixes). Some fixes may touch the same lines
> > that api-next have changed due to an api change (and would
> > need more thinking), but generally that should not be the case.
> >
> > For example, without these fixes it’s impossible to write
> > implementation (on api-next side) that is compatible to the
> > API spec AND passes validation tests, since validation tests
> > do not follow the spec. So, I could not send patches for
> > api-next that follow the spec for one month (since ‘make
> > check’ fails),  OR I would need to include these same (or
> > similar bug fix) patches in the front of my patch set.
> >
> > -Petri
> >
> > *From:*EXT Mike Holmes [mailto:mike.hol...@linaro.org
> > ]
> > *Sent:* Tuesday, December 08, 2015 5:34 PM
> > *To:* Maxim Uvarov
> > *Cc:* Savolainen, Petri (Nokia - FI/Espoo);
> > lng-odp@lists.linaro.org 
> > *Subject:* Re: [lng-odp] [PATCH 00/10] Pktio checks
> >
> > The process states that API-NEXT takes master on master
> > release points only.
> >
> >
> https://docs.google.com/drawings/d/1kWkr2qBV4xbqOCXMDVsoINhdxaNeHC-
> 8sCm6SBVFI8o/edit
> >
> > On 8 December 2015 at 09:48, Maxim Uvarov
> > 
> >  > >> wrote:
> >
> > On 12/08/2015 17:20, Savolainen, Petri (Nokia - FI/Espoo)
> > wrote:
> >
> > Could you merge this into api-next ASAP. Just lost
> > couple of
> > hours in debugging these same malfunctioning tests.
> >
> > -Petri
> >
> >
> > If you can merge that master and api-next I can. But for
> > now after
> > time things 2 branches out of sync in many files.
> >
> > Maxim.
> >
> >
> >
> > -Original Message-
> > From: lng-odp
> > [mailto:lng-odp-boun...@lists.linaro.org
> > 
> >  > >] On Behalf Of EXT
> > Maxim Uvarov
> > Sent: Tuesday, December 08, 2015 4:14 PM
> >
> > To: lng-odp@lists.linaro.org
> > 
> >  > >
> > Subject: Re: [lng-odp] [PATCH 00/10] Pktio checks
> >
> >   

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

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

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

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

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

diff --git a/helper/include/odp/helper/udp.h b/helper/include/odp/helper/udp.h
index 06c439b..d0599b1 100644
--- a/helper/include/odp/helper/udp.h
+++ b/helper/include/odp/helper/udp.h
@@ -4,7 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-
 /**
  * @file
  *
@@ -22,7 +21,6 @@ extern "C" {
 #include 
 #include 
 
-
 /** @addtogroup odph_header ODPH HEADER
  *  @{
  */
@@ -39,51 +37,70 @@ typedef struct ODP_PACKED {
 } odph_udphdr_t;
 
 /**
+ * Perform byte swap required by UDP checksum computation algorithm
+ */
+static inline uint16_t csum_bswap(uint16_t val)
+{
+#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
+   val = __odp_builtin_bswap16((__odp_force uint16_t)val);
+#endif
+   return val;
+}
+
+/**
+ * Pad a byte value to the left or to the right as required by UDP checksum
+ * computation algorithm and convert the result to CPU native uint16_t.
+ * Left padding is performed for the IP protocol field in the UDP
+ * pseudo-header (RFC 768). Right padding is performed in the case of the odd
+ * byte in a UDP packet having the length not a 2 multiple.
+ */
+static inline uint16_t u8_pad_to_u16(uint8_t val, odp_bool_t left)
+{
+   uint16_tret;
+
+   ret = (left) ? val : val << 8;
+   return csum_bswap(ret);
+}
+
+/**
  * UDP checksum
  *
  * This function uses odp packet to calc checksum
  *
  * @param pkt  calculate chksum for pkt
- * @return  checksum value
+ * @return  checksum value in CPU endianness
  */
 static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt)
 {
-   uint32_t sum = 0;
-   odph_udphdr_t *udph;
-   odph_ipv4hdr_t *iph;
-   uint16_t udplen;
-   uint8_t *buf;
-
-   if (!odp_packet_l3_offset(pkt))
-   return 0;
+   odph_ipv4hdr_t  *iph;
+   odph_udphdr_t   *udph;
+   uint32_tsum;
+   uint16_tudplen, *buf;
 
-   if (!odp_packet_l4_offset(pkt))
+   if (odp_packet_l4_offset(pkt) == ODP_PACKET_OFFSET_INVALID)
return 0;
-
iph = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
udph = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
-   udplen = odp_be_to_cpu_16(udph->length);
-
-   /* 32-bit sum of all 16-bit words covered by UDP chksum */
+   /* 32-bit sum of UDP pseudo-header */
sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
- (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
- (uint16_t)iph->proto + udplen;
-   for (buf = (uint8_t *)udph; udplen > 1; udplen -= 2) {
-   sum += ((*buf << 8) + *(buf + 1));
-   buf += 2;
-   }
-
-   /* Fold sum to 16 bits: add carrier to result */
-   while (sum >> 16)
-   sum = (sum & 0x) + (sum >> 16);
-
+   (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
+   u8_pad_to_u16(iph->proto, 1) + udph->length;
+   udplen = odp_be_to_cpu_16(udph->length);
+   buf = (uint16_t *)((void *)udph);
+   /* 32-bit sum of UDP header (checksum field cleared) and UDP data */
+   for ( ; udplen > 1; udplen -= 2)
+   sum += *buf++;
+   /* Length is not a multiple of 2 bytes */
+   if (udplen)
+   sum += u8_pad_to_u16(*buf, 0);
+   /* Fold sum to 16 bits */
+   sum = (sum & 0x) + (sum >> 16);
+   /* Add carrier (0/1) to result */
+   sum += (sum >> 16);
/* 1's complement */
sum = ~sum;
-
-   /* set computation result */
-   sum = (sum == 0x0) ? 0x : sum;
-
-   return sum;
+   /* Set computation result in CPU endianness */
+   return (sum == 0x0) ? 0x : csum_bswap(sum);
 }
 
 /** @internal Compile 

[lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Kury Nicolas
Hi


I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure if I'm 
doing something wrong or if it's a bug.

uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 
2015 x86_64 x86_64 x86_64 GNU/Linux


Received packets with this Src IP will be stored in "queue1", right ?

sudo ./odp_classifier -i eth0 -m 0 -p 
"ODP_PMR_SIP_ADDR:160.98.101.61::queue1"


I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and there 
isn't any match. All packets go to default queue.


I have also tried:

sudo ./odp_classifier -i eth0 -m 0 -p 
"ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
-> queue1


sudo ./odp_classifier -i eth0 -m 0 -p 
"ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
-> default queue


sudo ./odp_classifier -i eth0 -m 0 -p 
"ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
-> default queue


I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.


Thank you

Nicolas


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


[lng-odp] [BUG] linux-generic: timer: race for odp_timer_pool

2015-12-10 Thread Ilya Maximets
Timer pool may be freed while another thread executes timer_notify().
This leads to segmentation fault.

Example scenario:

 Time   main_thread timer_notify_thread

  1call odp_timer_pool_del(tp) call timer_notify(sigval)
  2odp_lock(>lock);tp = sigval.sival_ptr;
  3... ...
  4odp_lock(>itimer_running);  ...
  5itimer_fini(tp);timer_getoverrun(tp->timerid);
  6odp_shm_free(tp->shm);  ...
  7... odp_atomic_fetch_inc_u64(>cur_tick);

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffedffb700 (LWP 1744)]
in odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
158 return __atomic_fetch_add(>v, 1, __ATOMIC_RELAXED);

(gdb) bt
#0  odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
#1  timer_notify (sigval=..., sigval@entry=...) at odp_timer.c:650
#2  timer_sigev_thread (arg=...) at ../unix/sysv/linux/timer_routines.c:62
#3  start_thread (arg=0x7fffedffb700) at pthread_create.c:333
#4  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Segmentation fault appears approximately 1 time from 200 runs of
./test/validation/timer/timer_main on my system.

Hint: There is no way to protect memory from feeing by lock located
  inside that memory.

I have no time to fix that. Tag below may be added to patch that fixes that.

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


[lng-odp] [Bug 1940] New: linux-generic: timer: race for odp_timer_pool

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

Bug ID: 1940
   Summary: linux-generic: timer: race for odp_timer_pool
   Product: OpenDataPlane - linux- generic reference
   Version: unspecified
  Hardware: Other
OS: Linux
Status: UNCONFIRMED
  Severity: enhancement
  Priority: ---
 Component: Timers
  Assignee: ola.liljed...@linaro.org
  Reporter: maxim.uva...@linaro.org
CC: lng-odp@lists.linaro.org

On 12/10/2015 11:08, Ilya Maximets wrote:
> Timer pool may be freed while another thread executes timer_notify().
> This leads to segmentation fault.
>
> Example scenario:
>
>  Time   main_thread timer_notify_thread
> 
>   1call odp_timer_pool_del(tp) call timer_notify(sigval)
>   2odp_lock(>lock);tp = sigval.sival_ptr;
>   3... ...
>   4odp_lock(>itimer_running);  ...
>   5itimer_fini(tp);timer_getoverrun(tp->timerid);
>   6odp_shm_free(tp->shm);  ...
>   7... 
> odp_atomic_fetch_inc_u64(>cur_tick);
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffedffb700 (LWP 1744)]
> in odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
> 158 return __atomic_fetch_add(>v, 1, __ATOMIC_RELAXED);
>
> (gdb) bt
> #0  odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
> #1  timer_notify (sigval=..., sigval@entry=...) at odp_timer.c:650
> #2  timer_sigev_thread (arg=...) at ../unix/sysv/linux/timer_routines.c:62
> #3  start_thread (arg=0x7fffedffb700) at pthread_create.c:333
> #4  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
>
> Segmentation fault appears approximately 1 time from 200 runs of
> ./test/validation/timer/timer_main on my system.
>
> Hint: There is no way to protect memory from feeing by lock located
>   inside that memory.
>
> I have no time to fix that. Tag below may be added to patch that fixes that.
>
> Reported-by: Ilya Maximets 

-- 
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] [BUG] linux-generic: timer: race for odp_timer_pool

2015-12-10 Thread Maxim Uvarov

Thanks for analysis,

Created bug to track it:
https://bugs.linaro.org/show_bug.cgi?id=1940

Maxim.

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

Timer pool may be freed while another thread executes timer_notify().
This leads to segmentation fault.

Example scenario:

  Time   main_thread timer_notify_thread

   1call odp_timer_pool_del(tp) call timer_notify(sigval)
   2odp_lock(>lock);tp = sigval.sival_ptr;
   3... ...
   4odp_lock(>itimer_running);  ...
   5itimer_fini(tp);timer_getoverrun(tp->timerid);
   6odp_shm_free(tp->shm);  ...
   7... odp_atomic_fetch_inc_u64(>cur_tick);

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffedffb700 (LWP 1744)]
in odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
158 return __atomic_fetch_add(>v, 1, __ATOMIC_RELAXED);

(gdb) bt
#0  odp_atomic_fetch_inc_u64 (atom=...) at ./include/odp/atomic.h:158
#1  timer_notify (sigval=..., sigval@entry=...) at odp_timer.c:650
#2  timer_sigev_thread (arg=...) at ../unix/sysv/linux/timer_routines.c:62
#3  start_thread (arg=0x7fffedffb700) at pthread_create.c:333
#4  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Segmentation fault appears approximately 1 time from 200 runs of
./test/validation/timer/timer_main on my system.

Hint: There is no way to protect memory from feeing by lock located
   inside that memory.

I have no time to fix that. Tag below may be added to patch that fixes that.

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


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


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

2015-12-10 Thread Maxim Uvarov

On 12/10/2015 11:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:

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

diff --git a/platform/linux-generic/include/odp/plat/time_types.h
b/platform/linux-generic/include/odp/plat/time_types.h
index e5765ec..05e2b59 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,7 +21,10 @@ extern "C" {
   *  @{
   **/

-typedef struct timespec odp_time_t;
+typedef struct {
+   uint64_t tv_sec;
+   int64_t  tv_nsec;
+} odp_time_t;


This struct should match timespec exactly. If that’s not possible, union should 
not be used but copy data between timespec and odp_time_t.

POSIX: "The  header shall declare the structure timespec, which has at least 
the following members:"

time_t  tv_secSeconds.
longtv_nsec   Nanoseconds.

int64_t is not long. I think we hit that previously this week. Long may be 32 
bits on a 32 bit system.

time_t is defined in C headers.

Also POSIX spec states that there can be more members than these. That hints 
that field order/offset and struct size may vary. At least the hack should be 
well documented and build/run time checked.

-Petri


Yes, Petri is right. Yesterday I went thought headers but did not see 
mismatch.

Both values are signed in linux:

struct timespec
  {
__time_t tv_sec;/* Seconds.  */
__syscall_slong_t tv_nsec;/* Nanoseconds.  */
  };

/* Signed long type used in system calls.  */
__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;

#if defined __x86_64__ && defined __ILP32__
# define __SYSCALL_SLONG_TYPE__SQUAD_TYPE
# define __SYSCALL_ULONG_TYPE__UQUAD_TYPE
#else
# define __SYSCALL_SLONG_TYPE__SLONGWORD_TYPE
# define __SYSCALL_ULONG_TYPE__ULONGWORD_TYPE
#endif

# define __SQUAD_TYPElong int
#define __SLONGWORD_TYPElong int

btw, time_t is also signed value:
__STD_TYPE __TIME_T_TYPE __time_t;/* Seconds since the Epoch. */
#define __TIME_T_TYPE__SYSCALL_SLONG_TYPE

But it's reachable from 

Question - why that values are signed in linux?

Maxim.





  odp_time_t odp_time_null(void);

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

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

___
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 00/10] Pktio checks

2015-12-10 Thread Savolainen, Petri (Nokia - FI/Espoo)
I’d really need the bug fix applied on api-next ASAP. It’s more urgent than a 
guide update. Buggy code slows down actual work. Buggy document is just 
annoying but does not prevent working efficiently.

Anyway, this used to be our policy: bug fixes (to master) are merged to 
api-next soon after master. What is the rationale *not* to merge bug fixes ASAP?

-Petri


From: EXT Mike Holmes [mailto:mike.hol...@linaro.org]
Sent: Wednesday, December 09, 2015 8:34 PM
To: Maxim Uvarov
Cc: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH 00/10] Pktio checks

Can we merge [1] that was ready and reviewed last week with no objections

Maxim Petri - can you review that patch and if there are changes needed I can 
update.

[1] [PATCH] doc: process-guide: add release process

On 9 December 2015 at 04:35, Maxim Uvarov 
> wrote:
On 12/09/2015 11:54, Savolainen, Petri (Nokia - FI/Espoo) wrote:

So, critical bug fixes from master side are not visible to api-next until a 
month or so?

Exactly. api-next was broken with TM. Until issue if fixed and branch operates 
as usual, there is no pull of critical bug and etc.
https://ci.linaro.org/view/odp-ci/job/odp-api-check

Now some people still see build fails with gcc4.9, but I can not reproduce it 
and CI also passes. So only now I can pull changes from master.

Maxim.

Most bug fixes should apply directly to api-next as well, since those are 
implementation/test code/build system fixes (not api changing fixes). Some 
fixes may touch the same lines that api-next have changed due to an api change 
(and would need more thinking), but generally that should not be the case.

For example, without these fixes it’s impossible to write implementation (on 
api-next side) that is compatible to the API spec AND passes validation tests, 
since validation tests do not follow the spec. So, I could not send patches for 
api-next that follow the spec for one month (since ‘make check’ fails),  OR I 
would need to include these same (or similar bug fix) patches in the front of 
my patch set.

-Petri

*From:*EXT Mike Holmes 
[mailto:mike.hol...@linaro.org]
*Sent:* Tuesday, December 08, 2015 5:34 PM
*To:* Maxim Uvarov
*Cc:* Savolainen, Petri (Nokia - FI/Espoo); 
lng-odp@lists.linaro.org
*Subject:* Re: [lng-odp] [PATCH 00/10] Pktio checks

The process states that API-NEXT takes master on master release points only.

https://docs.google.com/drawings/d/1kWkr2qBV4xbqOCXMDVsoINhdxaNeHC-8sCm6SBVFI8o/edit

On 8 December 2015 at 09:48, Maxim Uvarov 
 
>> wrote:

On 12/08/2015 17:20, Savolainen, Petri (Nokia - FI/Espoo) wrote:

Could you merge this into api-next ASAP. Just lost couple of
hours in debugging these same malfunctioning tests.

-Petri


If you can merge that master and api-next I can. But for now after
time things 2 branches out of sync in many files.

Maxim.



-Original Message-
From: lng-odp 
[mailto:lng-odp-boun...@lists.linaro.org

>]
 On Behalf Of EXT
Maxim Uvarov
Sent: Tuesday, December 08, 2015 4:14 PM
To: lng-odp@lists.linaro.org 
>
Subject: Re: [lng-odp] [PATCH 00/10] Pktio checks

Merged,
Maxim.

On 11/10/2015 18:49, Nicolas Morey-Chaisemartin wrote:

This series add several tests for pktios and fixes the
issue they

raised.

The main features checked are:
* RONLY pktio cannot be sent to
* WONLY pktio cannot be read from
* stopped pktio cannot be stopped
* started pktio cannot be started
* started pktio cannot be configured

Nicolas Morey-Chaisemartin (10):
linux-generic: pktio: check interface mode is
compatible before
  receiving or sending
validation: pktio: add customizable out mode for
pktios
validation: pktio: add tests for rrecv() on WONLY,
and send on RONLY
  pktios
validation: pktio: stop interfaces before removing
the default inq
validation: pktio: remove unneeded stop as
interface is stopped after
  open()
validation: classification: start pktio after
setting inq and stop it
  

Re: [lng-odp] [PATCH 00/10] Pktio checks

2015-12-10 Thread Maxim Uvarov

On 12/10/2015 12:08, Savolainen, Petri (Nokia - FI/Espoo) wrote:


I’d really need the bug fix applied on api-next ASAP. It’s more urgent 
than a guide update. Buggy code slows down actual work. Buggy document 
is just annoying but does not prevent working efficiently.


Anyway, this used to be our policy: bug fixes (to master) are merged 
to api-next soon after master. What is the rationale **not** to merge 
bug fixes ASAP?


-Petri



working on sync master and api-next right now.

Maxim.


*From:*EXT Mike Holmes [mailto:mike.hol...@linaro.org]
*Sent:* Wednesday, December 09, 2015 8:34 PM
*To:* Maxim Uvarov
*Cc:* Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org
*Subject:* Re: [lng-odp] [PATCH 00/10] Pktio checks

Can we merge [1] that was ready and reviewed last week with no objections

Maxim Petri - can you review that patch and if there are changes 
needed I can update.


[1] [PATCH] doc: process-guide: add release process

On 9 December 2015 at 04:35, Maxim Uvarov > wrote:


On 12/09/2015 11:54, Savolainen, Petri (Nokia - FI/Espoo) wrote:


So, critical bug fixes from master side are not visible to
api-next until a month or so?


Exactly. api-next was broken with TM. Until issue if fixed and
branch operates as usual, there is no pull of critical bug and etc.
https://ci.linaro.org/view/odp-ci/job/odp-api-check

Now some people still see build fails with gcc4.9, but I can not
reproduce it and CI also passes. So only now I can pull changes
from master.

Maxim.

Most bug fixes should apply directly to api-next as well,
since those are implementation/test code/build system fixes
(not api changing fixes). Some fixes may touch the same lines
that api-next have changed due to an api change (and would
need more thinking), but generally that should not be the case.

For example, without these fixes it’s impossible to write
implementation (on api-next side) that is compatible to the
API spec AND passes validation tests, since validation tests
do not follow the spec. So, I could not send patches for
api-next that follow the spec for one month (since ‘make
check’ fails),  OR I would need to include these same (or
similar bug fix) patches in the front of my patch set.

-Petri

*From:*EXT Mike Holmes [mailto:mike.hol...@linaro.org
]
*Sent:* Tuesday, December 08, 2015 5:34 PM
*To:* Maxim Uvarov
*Cc:* Savolainen, Petri (Nokia - FI/Espoo);
lng-odp@lists.linaro.org 
*Subject:* Re: [lng-odp] [PATCH 00/10] Pktio checks

The process states that API-NEXT takes master on master
release points only.


https://docs.google.com/drawings/d/1kWkr2qBV4xbqOCXMDVsoINhdxaNeHC-8sCm6SBVFI8o/edit

On 8 December 2015 at 09:48, Maxim Uvarov

>> wrote:

On 12/08/2015 17:20, Savolainen, Petri (Nokia - FI/Espoo)
wrote:

Could you merge this into api-next ASAP. Just lost
couple of
hours in debugging these same malfunctioning tests.

-Petri


If you can merge that master and api-next I can. But for
now after
time things 2 branches out of sync in many files.

Maxim.



-Original Message-
From: lng-odp
[mailto:lng-odp-boun...@lists.linaro.org

>] On Behalf Of EXT
Maxim Uvarov
Sent: Tuesday, December 08, 2015 4:14 PM

To: lng-odp@lists.linaro.org

>
Subject: Re: [lng-odp] [PATCH 00/10] Pktio checks

Merged,
Maxim.

On 11/10/2015 18:49, Nicolas Morey-Chaisemartin wrote:

This series add several tests for pktios and
fixes the
issue they

raised.

The main features checked are:
* RONLY pktio cannot be sent to
* WONLY pktio cannot be read from
* stopped pktio cannot be stopped
* started pktio cannot be started
* started pktio cannot be configured

Nicolas Morey-Chaisemartin (10):

[lng-odp] [PATCH] configure.ac: add user_guides config status

2015-12-10 Thread Mike Holmes
Signed-off-by: Mike Holmes 
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 00a1415..e45d90a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -413,4 +413,5 @@ AC_MSG_RESULT([
test_perf:  ${test_perf}
test_cpp:   ${test_cpp}
test_helper:${test_helper}
+   user_guides:${user_guides}
 ])
-- 
2.5.0

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


Re: [lng-odp] [PATCHv17 08/10] linix-generic: return error for unsupported pktio calls

2015-12-10 Thread Ola Liljedahl
linix-generic => linux-generic in subject
Perhaps this can be corrected when merging?


On 10 December 2015 at 15:24, Maxim Uvarov  wrote:

> For some pktios like loop and ipc functions like mtu, promisc,
> and mac addr are not applicable. Instead of crash on deference
> null pointer just return error if functions are not defined.
> Signed-off-by: Maxim Uvarov 
> ---
>  platform/linux-generic/odp_packet_io.c | 24 
>  1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/platform/linux-generic/odp_packet_io.c
> b/platform/linux-generic/odp_packet_io.c
> index 1e9d08c..c8b6502 100644
> --- a/platform/linux-generic/odp_packet_io.c
> +++ b/platform/linux-generic/odp_packet_io.c
> @@ -725,7 +725,7 @@ int pktin_poll(pktio_entry_t *entry)
>  int odp_pktio_mtu(odp_pktio_t id)
>  {
> pktio_entry_t *entry;
> -   int ret;
> +   int ret = -1;
>
> entry = get_pktio_entry(id);
> if (entry == NULL) {
> @@ -740,7 +740,9 @@ int odp_pktio_mtu(odp_pktio_t id)
> ODP_DBG("already freed pktio\n");
> return -1;
> }
> -   ret = entry->s.ops->mtu_get(entry);
> +
> +   if (entry->s.ops->mtu_get)
> +   ret = entry->s.ops->mtu_get(entry);
>
> unlock_entry(entry);
> return ret;
> @@ -749,7 +751,7 @@ int odp_pktio_mtu(odp_pktio_t id)
>  int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t enable)
>  {
> pktio_entry_t *entry;
> -   int ret;
> +   int ret = -1;
>
> entry = get_pktio_entry(id);
> if (entry == NULL) {
> @@ -769,7 +771,8 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id,
> odp_bool_t enable)
> return -1;
> }
>
> -   ret = entry->s.ops->promisc_mode_set(entry, enable);
> +   if (entry->s.ops->promisc_mode_set)
> +   ret = entry->s.ops->promisc_mode_set(entry, enable);
>
> unlock_entry(entry);
> return ret;
> @@ -778,7 +781,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id,
> odp_bool_t enable)
>  int odp_pktio_promisc_mode(odp_pktio_t id)
>  {
> pktio_entry_t *entry;
> -   int ret;
> +   int ret = -1;
>
> entry = get_pktio_entry(id);
> if (entry == NULL) {
> @@ -794,13 +797,13 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
> return -1;
> }
>
> -   ret = entry->s.ops->promisc_mode_get(entry);
> +   if (entry->s.ops->promisc_mode_get)
> +   ret = entry->s.ops->promisc_mode_get(entry);
> unlock_entry(entry);
>
> return ret;
>  }
>
> -
>  int odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, int addr_size)
>  {
> pktio_entry_t *entry;
> @@ -825,7 +828,12 @@ int odp_pktio_mac_addr(odp_pktio_t id, void
> *mac_addr, int addr_size)
> return -1;
> }
>
> -   ret = entry->s.ops->mac_get(entry, mac_addr);
> +   if (entry->s.ops->mac_get) {
> +   ret = entry->s.ops->mac_get(entry, mac_addr);
> +   } else {
> +   ODP_DBG("pktio does not support mac addr get\n");
> +   ret = -1;
> +   }
> unlock_entry(entry);
>
> return ret;
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [PATCH] configure.ac: add user_guides config status

2015-12-10 Thread Bill Fischofer
On Thu, Dec 10, 2015 at 3:08 PM, Mike Holmes  wrote:

> Signed-off-by: Mike Holmes 
>

Reviewed-by: Bill Fischofer 


> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configure.ac b/configure.ac
> index 00a1415..e45d90a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -413,4 +413,5 @@ AC_MSG_RESULT([
> test_perf:  ${test_perf}
> test_cpp:   ${test_cpp}
> test_helper:${test_helper}
> +   user_guides:${user_guides}
>  ])
> --
> 2.5.0
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-12-10 Thread Bill Fischofer
On Thu, Dec 10, 2015 at 12:58 PM, Zoltan Kiss 
wrote:

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

Reviewed-by: Bill Fischofer 


> ---
>
> v2: improve wording about superseding
>
>  include/odp/api/init.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 737ff6d..4ac5216 100644
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -141,6 +141,10 @@ 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 platform_params, it should always
> + * supersede any other configuration data the platform has.
>   *
>   * @param params  Those parameters that are interpreted by the
> ODP API.
>   *Use NULL to set all parameters to their
> defaults.
> --
> 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] [Bug 1940] linux-generic: timer: race for odp_timer_pool

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

Ilya Maximets  changed:

   What|Removed |Added

 CC||i.maxim...@samsung.com

--- Comment #2 from Ilya Maximets  ---
(In reply to Stuart Haslam from comment #1)
> This is a duplicate of bug 1615

Yes. It is the same segmentation fault. But, I think, analysis isn't correct in
1615. It is just a race for pool, that must be fixed, because segfault appears
while processing of legitimate notification created before calling of
odp_timer_pool_del().

-- 
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] [API-NEXT PATCH] linux-generic: time: remove posix bleed through on odp_time_t

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


From: EXT Ola Liljedahl [mailto:ola.liljed...@linaro.org]
Sent: Thursday, December 10, 2015 12:40 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: Bill Fischofer; LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] linux-generic: time: remove posix bleed 
through on odp_time_t



On 10 December 2015 at 09:30, Savolainen, Petri (Nokia - FI/Espoo) 
> wrote:


From: lng-odp 
[mailto:lng-odp-boun...@lists.linaro.org]
 On Behalf Of EXT Ola Liljedahl
Sent: Wednesday, December 09, 2015 6:26 PM
To: Bill Fischofer
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH] linux-generic: time: remove posix bleed 
through on odp_time_t

On 9 December 2015 at 16:53, Bill Fischofer 
> wrote:
The linux-generic implementation of odp_time_t makes use of POSIX
APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
mechanism so that these dependencies do not "bleed through" the ODP API.
This means that ODP applications can be independent of _POSIX_C_SOURCE
level.
Yes this is the way it should be done. This is also another step in the ODP API 
becoming binary portable and run-time independent of the actual implementation.

This definition is still platform (linux-generic) specific. It just redefines 
timespec struct, so that original timespec and thus posix level is not visible 
to application.
For now it is platform specific but now when we have a definition which is 
decoupled from the underlying implementation, we can promote this to become the 
binary interface for all ODP implementations. I didn't say we are there yet.

It’s another exercise to define every handle and other platform specific types 
for a binary compatibility mode (e.g. for ARMv8). We could define odp_time_t 
(in binary compatibility mode) as plain “uint64_t nsec”. It’s large enough for 
>500 years.

-Petri


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


[lng-odp] [API-NEXT PATCH] api: pktio link state

2015-12-10 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 include/odp/api/packet_io.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
index 443841e..f970ad7 100644
--- a/include/odp/api/packet_io.h
+++ b/include/odp/api/packet_io.h
@@ -673,6 +673,17 @@ void 
odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t *param);
 void odp_pktio_print(odp_pktio_t pktio);
 
 /**
+ * Determine pktio link is up or down for a packet IO interface.
+ *
+ * @param[in] pktio Packet IO handle.
+ *
+ * @retval  1 link is up
+ * @retval  0 link is down
+ * @retval <0 on failure
+*/
+int odp_pktio_link_state(odp_pktio_t pktio);
+
+/**
  * @}
  */
 
-- 
1.9.1

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


Re: [lng-odp] [PATCHv5] helper : Fix UDP checksum computation

2015-12-10 Thread Ion Grigore
Hi,

I sent a new patch(V6) making the code more understandable.

Thanks,
Grig


-Original Message-
From: Ilya Maximets [mailto:i.maxim...@samsung.com] 
Sent: Wednesday, December 09, 2015 2:52 PM
To: Grigore Ion-B17953 ; lng-odp@lists.linaro.org
Subject: Re: [PATCHv5] helper : Fix UDP checksum computation



On 09.12.2015 15:26, Ion Grigore wrote:
> See inline comments.
> 
> -Original Message-
> From: Ilya Maximets [mailto:i.maxim...@samsung.com]
> Sent: Wednesday, December 09, 2015 12:04 PM
> To: Grigore Ion-B17953 ; 
> lng-odp@lists.linaro.org
> Subject: Re: [PATCHv5] helper : Fix UDP checksum computation
> 
> Some comments below.
> 
> On 09.12.2015 11:59, ion.grig...@freescale.com wrote:
>> From: Grigore Ion 
>>
>> This patch fixes the following problems:
>> - checksum computation for LE platforms
>> - checksum is computed in the CPU endianness. The returned result 
>> must be converted to the BE ordering when it is used to update the 
>> UDP checksum in a packet.
>> - checksum computation for packets having the UDP length not a 
>> multiple of 2
>> - fixes the UDP checksum associated validation test
>>
>> Signed-off-by: Grigore Ion 
>> ---
>> v5:
>> - Checksum in CPU endianness fix added (Ilya Maximets)
>> v4:
>> - Verify checksum in CPU endianness in the associated test (Ilya
>> Maximets)
>> v3:
>> - fix the UDP checksum computation in the associated test (Maxim
>> Uvarov)
>> v2:
>> - patch updated to the last master (Maxim Uvarov)
>> v1:
>> - Move variables declaration on top of block. (Maxim Uvarov)
>> - Check patch with checkpatch script.  (Maxim Uvarov)
>> - L3 header presence is tested twice. (Alexandru Badicioiu)
>> - Remove unnecessary check for L3 header presence. (Bill Fischofer)
>> - Modify check of odp_packet_l4_offset() return. (Bill Fischofer)
>>
>>  helper/include/odp/helper/udp.h | 55 
>> +
>>  helper/test/odp_chksum.c|  4 +--
>>  2 files changed, 25 insertions(+), 34 deletions(-)
>>
>> diff --git a/helper/include/odp/helper/udp.h 
>> b/helper/include/odp/helper/udp.h index 06c439b..9e7256d 100644
>> --- a/helper/include/odp/helper/udp.h
>> +++ b/helper/include/odp/helper/udp.h
>> @@ -4,7 +4,6 @@
>>   * SPDX-License-Identifier: BSD-3-Clause
>>   */
>>  
>> -
>>  /**
>>   * @file
>>   *
>> @@ -22,7 +21,6 @@ extern "C" {
>>  #include 
>>  #include 
>>  
>> -
>>  /** @addtogroup odph_header ODPH HEADER
>>   *  @{
>>   */
>> @@ -44,46 +42,39 @@ typedef struct ODP_PACKED {
>>   * This function uses odp packet to calc checksum
>>   *
>>   * @param pkt  calculate chksum for pkt
>> - * @return  checksum value
>> + * @return  checksum value in CPU endianness
>>   */
>>  static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt)  {
>> -uint32_t sum = 0;
>> -odph_udphdr_t *udph;
>> -odph_ipv4hdr_t *iph;
>> -uint16_t udplen;
>> -uint8_t *buf;
>> -
>> -if (!odp_packet_l3_offset(pkt))
>> -return 0;
>> +odph_ipv4hdr_t  *iph;
>> +odph_udphdr_t   *udph;
>> +uint32_tsum;
>> +uint16_tudplen, *buf;
>>  
>> -if (!odp_packet_l4_offset(pkt))
>> +if (odp_packet_l4_offset(pkt) == ODP_PACKET_OFFSET_INVALID)
>>  return 0;
>> -
>>  iph = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>>  udph = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
>> -udplen = odp_be_to_cpu_16(udph->length);
>> -
>> -/* 32-bit sum of all 16-bit words covered by UDP chksum */
>> +/* 32-bit sum of UDP pseudo-header */
>>  sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
>> -  (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
>> -  (uint16_t)iph->proto + udplen;
>> -for (buf = (uint8_t *)udph; udplen > 1; udplen -= 2) {
>> -sum += ((*buf << 8) + *(buf + 1));
>> -buf += 2;
>> -}
>> -
>> -/* Fold sum to 16 bits: add carrier to result */
>> -while (sum >> 16)
>> -sum = (sum & 0x) + (sum >> 16);
>> -
>> +(iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
>> +odp_be_to_cpu_16(iph->proto) + udph->length;
> 
> This line is also strange. You're using odp_be_to_cpu_16 for 8-bit digit.
> At this point, iph->proto firstly will be extended to u16 in CPU endianness 
> and after that odp_be_to_cpu_16() will return it to BE. You will have right 
> position of all bytes (8 zero bits + 8 bits of iph->proto), but the way how 
> this done is wrong.
> 
> [IGR] Here the proto field is added as the LSB in a 16-bit BE value. Do you 
> think the following code clearer ?
> 
>   uint16 val;
>   ...
>   val = iph->proto;
>   sum += odp_be_to_cpu_16(val);

No, because 'val' is in CPU endianness and you're using odp_be_to_cpu_16() for 
variable that is already in CPU endianness.

> 
>> +udplen = odp_be_to_cpu_16(udph->length);
>> +buf = 

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

2015-12-10 Thread Ola Liljedahl
On 10 December 2015 at 09:40, Maxim Uvarov  wrote:

> On 12/10/2015 11:21, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>
>> Signed-off-by: Bill Fischofer 
>>> ---
>>>   .../linux-generic/include/odp/plat/time_types.h|  5 +++-
>>>   platform/linux-generic/odp_time.c  | 27
>>> +
>>> -
>>>   2 files changed, 20 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
>>> b/platform/linux-generic/include/odp/plat/time_types.h
>>> index e5765ec..05e2b59 100644
>>> --- a/platform/linux-generic/include/odp/plat/time_types.h
>>> +++ b/platform/linux-generic/include/odp/plat/time_types.h
>>> @@ -21,7 +21,10 @@ extern "C" {
>>>*  @{
>>>**/
>>>
>>> -typedef struct timespec odp_time_t;
>>> +typedef struct {
>>> +   uint64_t tv_sec;
>>> +   int64_t  tv_nsec;
>>> +} odp_time_t;
>>>
>>
>> This struct should match timespec exactly. If that’s not possible, union
>> should not be used but copy data between timespec and odp_time_t.
>>
>> POSIX: "The  header shall declare the structure timespec, which
>> has at least the following members:"
>>
>> time_t  tv_secSeconds.
>> longtv_nsec   Nanoseconds.
>>
>> int64_t is not long. I think we hit that previously this week. Long may
>> be 32 bits on a 32 bit system.
>>
>> time_t is defined in C headers.
>>
>> Also POSIX spec states that there can be more members than these. That
>> hints that field order/offset and struct size may vary. At least the hack
>> should be well documented and build/run time checked.
>>
>> -Petri
>>
>
> Yes, Petri is right. Yesterday I went thought headers but did not see
> mismatch.
> Both values are signed in linux:
>
> struct timespec
>   {
> __time_t tv_sec;/* Seconds.  */
> __syscall_slong_t tv_nsec;/* Nanoseconds.  */
>   };
>
> /* Signed long type used in system calls.  */
> __STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;
>
> #if defined __x86_64__ && defined __ILP32__
> # define __SYSCALL_SLONG_TYPE__SQUAD_TYPE
> # define __SYSCALL_ULONG_TYPE__UQUAD_TYPE
> #else
> # define __SYSCALL_SLONG_TYPE__SLONGWORD_TYPE
> # define __SYSCALL_ULONG_TYPE__ULONGWORD_TYPE
> #endif
>
> # define __SQUAD_TYPElong int
> #define __SLONGWORD_TYPElong int
>
> btw, time_t is also signed value:
> __STD_TYPE __TIME_T_TYPE __time_t;/* Seconds since the Epoch. */
> #define __TIME_T_TYPE__SYSCALL_SLONG_TYPE
>
> But it's reachable from 
>
> Question - why that values are signed in linux?

time_t has always been signed in Unix. Probably the original Unix
implementors were more interested in that past (before 1970) than in the
future (beyond year 2038).


>
>
> Maxim.
>
>
>
>>
>>   odp_time_t odp_time_null(void);
>>>
>>> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-
>>> generic/odp_time.c
>>> index 1c7c214..b5737f6 100644
>>> --- a/platform/linux-generic/odp_time.c
>>> +++ b/platform/linux-generic/odp_time.c
>>> @@ -11,7 +11,12 @@
>>>   #include 
>>>   #include 
>>>
>>> -static struct timespec start_time;
>>> +typedef union {
>>> +   odp_time_t  ex;
>>> +   struct timespec in;
>>> +} _odp_time_t;
>>> +
>>>
>> ___
>> 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] merge master -> api-next

2015-12-10 Thread Maxim Uvarov

Hello,

I did merge of current master branch to api-next. There are bunch of 
reject, most of them due to new time api.
It might be not easy to review. Bit it will be good to do some review to 
check that I did not lost significant patches.



Merged branch here:
https://git.linaro.org/people/maxim.uvarov/odp.git  api-next

Web link to reject message
https://git.linaro.org/people/maxim.uvarov/odp.git/commit/1aabbe8080c6edd52ef1a79db99b89ac6bb14283

commit 1aabbe8080c6edd52ef1a79db99b89ac6bb14283
Merge: 8608024 433f1cd
Author: Maxim Uvarov 
Date:   Thu Dec 10 13:03:29 2015 +0300

Merge branch 'master' into api-next

Signed-off-by: Maxim Uvarov 

Conflicts:
example/generator/odp_generator.c
include/odp/api/crypto.h
include/odp/api/time.h
platform/linux-generic/include/odp/plat/time_types.h
platform/linux-generic/include/odp_cpu_internal.h
platform/linux-generic/include/odp_crypto_internal.h
platform/linux-generic/odp_cpu.c
platform/linux-generic/odp_crypto.c
platform/linux-generic/odp_schedule.c
platform/linux-generic/odp_time.c
test/performance/odp_pktio_perf.c
test/performance/odp_scheduling.c
test/validation/classification/odp_classification_test_pmr.c
test/validation/crypto/crypto.h
test/validation/crypto/odp_crypto_test_inp.c
test/validation/crypto/test_vectors.h
test/validation/crypto/test_vectors_len.h
test/validation/pktio/pktio.c
test/validation/queue/queue.c
test/validation/time/time.c
test/validation/time/time.h

diff --cc include/odp/api/version.h
index e00777f,58bb7ec..5498c9f
--- a/include/odp/api/version.h
+++ b/include/odp/api/version.h
@@@ -53,17 -46,10 +53,17 @@@ extern "C"
   * to the API. For an API with common generation and major version, 
but with

   * different minor numbers the two versions are backward compatible.
   */
- #define ODP_VERSION_API_MINOR 1
+ #define ODP_VERSION_API_MINOR 0

  /**
 - * Returns ODP API version string
 + * ODP API version string
 + *
 + * The API version string defines ODP API version in this format:
 + * @verbatim .. @endverbatim
 + *
 + * The string is null terminated.
 + *
 + * @return Pointer to API version string
   */
  const char *odp_version_api_str(void);

diff --cc test/validation/classification/odp_classification_test_pmr.c
index 2fa524d,1502b9a..120ddd2
--- a/test/validation/classification/odp_classification_test_pmr.c
+++ b/test/validation/classification/odp_classification_test_pmr.c
@@@ -89,57 -83,17 +83,62 @@@ int create_default_inq(odp_pktio_t pkti
  ODP_QUEUE_TYPE_PKTIN,
  qtype == ODP_QUEUE_TYPE_POLL ? NULL : );

- CU_ASSERT(inq_def != ODP_QUEUE_INVALID);
+ CU_ASSERT_FATAL(inq_def != ODP_QUEUE_INVALID);

  if (0 > odp_pktio_inq_setdef(pktio, inq_def))
 -return ODP_QUEUE_INVALID;
 +return -1;

+ if (odp_pktio_start(pktio)) {
+ fprintf(stderr, "unable to start loop\n");
 -return ODP_QUEUE_INVALID;
++return -1;
+ }
+
 -return inq_def;
 +return 0;
 +}
 +
 +void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos,
 +   odp_queue_t *queue, odp_pool_t *pool)
 +{
 +odp_pool_param_t pool_param;
 +odp_pool_t default_pool;
 +odp_cos_t default_cos;
 +odp_queue_t default_queue;
 +int retval;
 +char cosname[ODP_COS_NAME_LEN];
 +char poolname[ODP_POOL_NAME_LEN];
 +char queuename[ODP_QUEUE_NAME_LEN];
 +
 +odp_pool_param_init(_param);
 +pool_param.pkt.seg_len = SHM_PKT_BUF_SIZE;
 +pool_param.pkt.len = SHM_PKT_BUF_SIZE;
 +pool_param.pkt.num = SHM_PKT_NUM_BUFS;
 +pool_param.type= ODP_POOL_PACKET;
 +sprintf(poolname, "%s", "DefaultPool");
 +
 +default_pool  = odp_pool_create(poolname, _param);
 +CU_ASSERT(default_pool != ODP_POOL_INVALID);
 +
 +sprintf(queuename, "DefaultQueue");
 +default_queue = queue_create(queuename, true);
 +CU_ASSERT(default_queue != ODP_QUEUE_INVALID);
 +
 +sprintf(cosname, "DefaultCos");
 +default_cos = odp_cos_create(cosname);
 +CU_ASSERT(default_cos != ODP_COS_INVALID);
 +
 +retval = odp_cos_queue_set(default_cos, default_queue);
 +CU_ASSERT(retval == 0);
 +
 +retval = odp_cls_cos_pool_set(default_cos, default_pool);
 +CU_ASSERT(retval == 0);
 +
 +retval = odp_pktio_default_cos_set(pktio, default_cos);
 +CU_ASSERT(retval == 0);
 +
 +*cos = default_cos;
 +*queue = default_queue;
 +*pool = default_pool;
 +return;
  }

  int classification_suite_pmr_term(void)

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


Re: [lng-odp] [API-NEXT PATCH] validation: Makefiles: change install location

2015-12-10 Thread Stuart Haslam
On Thu, Dec 10, 2015 at 02:29:30PM +0300, Maxim Uvarov wrote:
> All tests should be installed under testdir variable and not in the bin
> directory.
> 
> Signed-off-by: Maxim Uvarov 

Reviewed-by: Stuart Haslam 

> ---
>  test/validation/hash/Makefile.am | 2 +-
>  test/validation/std_clib/Makefile.am | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/validation/hash/Makefile.am 
> b/test/validation/hash/Makefile.am
> index 9ddc57c..b899b8b 100644
> --- a/test/validation/hash/Makefile.am
> +++ b/test/validation/hash/Makefile.am
> @@ -3,7 +3,7 @@ include ../Makefile.inc
>  noinst_LTLIBRARIES = libtesthash.la
>  libtesthash_la_SOURCES = hash.c
>  
> -bin_PROGRAMS = hash_main$(EXEEXT)
> +test_PROGRAMS = hash_main$(EXEEXT)
>  dist_hash_main_SOURCES = hash_main.c
>  hash_main_LDADD = libtesthash.la $(LIBCUNIT_COMMON) $(LIBODP)
>  
> diff --git a/test/validation/std_clib/Makefile.am 
> b/test/validation/std_clib/Makefile.am
> index aa02be6..e2fc0cc 100644
> --- a/test/validation/std_clib/Makefile.am
> +++ b/test/validation/std_clib/Makefile.am
> @@ -3,7 +3,7 @@ include ../Makefile.inc
>  noinst_LTLIBRARIES = libteststd_clib.la
>  libteststd_clib_la_SOURCES = std_clib.c
>  
> -bin_PROGRAMS = std_clib_main$(EXEEXT)
> +test_PROGRAMS = std_clib_main$(EXEEXT)
>  dist_std_clib_main_SOURCES = std_clib_main.c
>  std_clib_main_LDADD = libteststd_clib.la $(LIBCUNIT_COMMON) $(LIBODP)
>  
> -- 
> 1.9.1
> 
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp

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


Re: [lng-odp] [API-NEXT PATCH] api: pktio link state

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


> -Original Message-
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> Maxim Uvarov
> Sent: Thursday, December 10, 2015 1:45 PM
> To: lng-odp@lists.linaro.org
> Subject: [lng-odp] [API-NEXT PATCH] api: pktio link state
> 
> Signed-off-by: Maxim Uvarov 
> ---
>  include/odp/api/packet_io.h | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h
> index 443841e..f970ad7 100644
> --- a/include/odp/api/packet_io.h
> +++ b/include/odp/api/packet_io.h
> @@ -673,6 +673,17 @@ void
> odp_pktio_output_queue_param_init(odp_pktio_output_queue_param_t *param);
>  void odp_pktio_print(odp_pktio_t pktio);
> 
>  /**
> + * Determine pktio link is up or down for a packet IO interface.
> + *
> + * @param[in] pktio Packet IO handle.

[in] is not needed. All params are input by default. We highlight output params 
with [out].

> + *
> + * @retval  1 link is up
> + * @retval  0 link is down
> + * @retval <0 on failure
> +*/
> +int odp_pktio_link_state(odp_pktio_t pktio);

int odp_pktio_link_status(odp_pktio_t pktio);

Status would be better name for the call. RFCs use variable name IfOperStatus. 
RFC2863 defines additional states: notPresent, lowerLayerDown, which refine 
down state.

DPDK names this link_status (1 up, 0 down) in struct rte_eth_link.



-Petri


> +
> +/**
>   * @}
>   */
> 
> --
> 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] [HELP] odp_classification no match ?

2015-12-10 Thread Stuart Haslam
On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:
> Hi
> 
> 
> I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure if I'm 
> doing something wrong or if it's a bug.
> 
> uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 
> 2015 x86_64 x86_64 x86_64 GNU/Linux
> 
> 
> Received packets with this Src IP will be stored in "queue1", right ?
> 
> sudo ./odp_classifier -i eth0 -m 0 -p 
> "ODP_PMR_SIP_ADDR:160.98.101.61::queue1"
> 
> 
> I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and there 
> isn't any match. All packets go to default queue.
> 
> 
> I have also tried:
> 
> sudo ./odp_classifier -i eth0 -m 0 -p 
> "ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
> -> queue1
> 
> 
> sudo ./odp_classifier -i eth0 -m 0 -p 
> "ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
> -> default queue
> 
> 
> sudo ./odp_classifier -i eth0 -m 0 -p 
> "ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
> -> default queue
> 
> 
> I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.
> 
> 
> Thank you
> 
> Nicolas

It looks like something is broken :(

I have a similar test that used to work and is now failing, sending
everything to the default queue as you see.

f64b306 is the last commit that works for me, 0d56b7b is the first one
that fails in this way. The commits in between all either fail to build
or seg fault (probably because the fix fe376471 is missing).

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


[lng-odp] [Bug 1940] linux-generic: timer: race for odp_timer_pool

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

Stuart Haslam  changed:

   What|Removed |Added

 CC||stuart.has...@linaro.org

--- Comment #1 from Stuart Haslam  ---
This is a duplicate of bug 1615

-- 
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] [API-NEXT PATCH] linux-generic: time: remove posix bleed through on odp_time_t

2015-12-10 Thread Ola Liljedahl
On 10 December 2015 at 09:30, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
>
>
> *From:* lng-odp [mailto:lng-odp-boun...@lists.linaro.org] *On Behalf Of *EXT
> Ola Liljedahl
> *Sent:* Wednesday, December 09, 2015 6:26 PM
> *To:* Bill Fischofer
> *Cc:* LNG ODP Mailman List
> *Subject:* Re: [lng-odp] [API-NEXT PATCH] linux-generic: time: remove
> posix bleed through on odp_time_t
>
>
>
> On 9 December 2015 at 16:53, Bill Fischofer 
> wrote:
>
> The linux-generic implementation of odp_time_t makes use of POSIX
> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an indirection
> mechanism so that these dependencies do not "bleed through" the ODP API.
> This means that ODP applications can be independent of _POSIX_C_SOURCE
> level.
>
> Yes this is the way it should be done. This is also another step in the
> ODP API becoming binary portable and run-time independent of the actual
> implementation.
>
>
>
> This definition is still platform (linux-generic) specific. It just
> redefines timespec struct, so that original timespec and thus posix level
> is not visible to application.
>
For now it is platform specific but now when we have a definition which is
decoupled from the underlying implementation, we can promote this to become
the binary interface for all ODP implementations. I didn't say we are there
yet.



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


[lng-odp] [API-NEXT PATCH] validation: Makefiles: change install location

2015-12-10 Thread Maxim Uvarov
All tests should be installed under testdir variable and not in the bin
directory.

Signed-off-by: Maxim Uvarov 
---
 test/validation/hash/Makefile.am | 2 +-
 test/validation/std_clib/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/validation/hash/Makefile.am b/test/validation/hash/Makefile.am
index 9ddc57c..b899b8b 100644
--- a/test/validation/hash/Makefile.am
+++ b/test/validation/hash/Makefile.am
@@ -3,7 +3,7 @@ include ../Makefile.inc
 noinst_LTLIBRARIES = libtesthash.la
 libtesthash_la_SOURCES = hash.c
 
-bin_PROGRAMS = hash_main$(EXEEXT)
+test_PROGRAMS = hash_main$(EXEEXT)
 dist_hash_main_SOURCES = hash_main.c
 hash_main_LDADD = libtesthash.la $(LIBCUNIT_COMMON) $(LIBODP)
 
diff --git a/test/validation/std_clib/Makefile.am 
b/test/validation/std_clib/Makefile.am
index aa02be6..e2fc0cc 100644
--- a/test/validation/std_clib/Makefile.am
+++ b/test/validation/std_clib/Makefile.am
@@ -3,7 +3,7 @@ include ../Makefile.inc
 noinst_LTLIBRARIES = libteststd_clib.la
 libteststd_clib_la_SOURCES = std_clib.c
 
-bin_PROGRAMS = std_clib_main$(EXEEXT)
+test_PROGRAMS = std_clib_main$(EXEEXT)
 dist_std_clib_main_SOURCES = std_clib_main.c
 std_clib_main_LDADD = libteststd_clib.la $(LIBCUNIT_COMMON) $(LIBODP)
 
-- 
1.9.1

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


Re: [lng-odp] [API-NEXT PATCH v3] api: atomic: added atomic_lock_free_u64

2015-12-10 Thread Ola Liljedahl
On 26 November 2015 at 09:56, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

> ping.
>
> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT
> > Petri Savolainen
> > Sent: Thursday, November 12, 2015 10:30 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH v3] api: atomic: added
> > atomic_lock_free_u64
> >
> > Platforms may support some uint64 operations lock-free and
> > others not. For example, inc_64 can be natively supported but
> > cas_64 (or max_64/min_64) not. User may be able to switch to
> > 32 bit variables when a 64 bit operation uses locks. The same
> > atomic operation struture could be used for platform init to guide
> > lock vs. lock-free implementation (e.g. if cas_64 is never
> > called, inc_64 can be lock-free).
> >
> > Signed-off-by: Petri Savolainen 
>
Reviewed-by: Ola Liljedahl 


> > ---
> >  include/odp/api/atomic.h| 48
> > +
> >  platform/linux-generic/Makefile.am  |  1 +
> >  platform/linux-generic/odp_atomic.c | 24 +++
> >  3 files changed, 73 insertions(+)
> >  create mode 100644 platform/linux-generic/odp_atomic.c
> >
> > diff --git a/include/odp/api/atomic.h b/include/odp/api/atomic.h
> > index 316f13a..5e897c1 100644
> > --- a/include/odp/api/atomic.h
> > +++ b/include/odp/api/atomic.h
> > @@ -388,6 +388,54 @@ void odp_atomic_add_rls_u32(odp_atomic_u32_t *atom,
> > uint32_t val);
> >  void odp_atomic_sub_rls_u32(odp_atomic_u32_t *atom, uint32_t val);
> >
> >  /**
> > + * Atomic operations
> > + *
> > + * Atomic operations listed in a bit field structure.
> > + */
> > +typedef union odp_atomic_op_t {
> > + /** Operation flags */
> > + struct {
> > + uint32_t init  : 1;  /**< Init atomic variable */
> > + uint32_t load  : 1;  /**< Atomic load */
> > + uint32_t store : 1;  /**< Atomic store */
> > + uint32_t fetch_add : 1;  /**< Atomic fetch and add */
> > + uint32_t add   : 1;  /**< Atomic add */
> > + uint32_t fetch_sub : 1;  /**< Atomic fetch and substract */
> > + uint32_t sub   : 1;  /**< Atomic substract */
> > + uint32_t fetch_inc : 1;  /**< Atomic fetch and increment */
> > + uint32_t inc   : 1;  /**< Atomic increment */
> > + uint32_t fetch_dec : 1;  /**< Atomic fetch and decrement */
> > + uint32_t dec   : 1;  /**< Atomic decrement */
> > + uint32_t min   : 1;  /**< Atomic minimum */
> > + uint32_t max   : 1;  /**< Atomic maximum */
> > + uint32_t cas   : 1;  /**< Atomic compare and swap */
> > + } op;
> > +
> > + /** All bits of the bit field structure.
> > +   * Operation flag mapping is architecture specific. This field can
> > be
> > +   * used to set/clear all flags, or bitwise operations over the
> > entire
> > +   * structure. */
> > + uint32_t all_bits;
> > +} odp_atomic_op_t;
> > +
> > +/**
> > + * Query which atomic uint64 operations are lock-free
> > + *
> > + * Lock-free implementations have higher performance and scale better
> > than
> > + * implementations using locks. User can decide to use e.g. uint32
> atomic
> > + * variables instead of uint64 to optimize performance on platforms that
> > + * implement a performance critical operation using locks.
> > + *
> > + * @param atomic_op  Pointer to atomic operation structure for storing
> > + *   operation flags. All bits are initialized to zero
> > during
> > + *   the operation. The parameter is ignored when NULL.
> > + * @retval 0 None of the operations are lock-free
> > + * @retval 1 Some of the operations are lock-free
> > + * @retval 2 All operations are lock-free
> > + */
> > +int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op);
> > +
> > +/**
> >   * @}
> >   */
> >
> > diff --git a/platform/linux-generic/Makefile.am b/platform/linux-
> > generic/Makefile.am
> > index a6b6029..0b7234e 100644
> > --- a/platform/linux-generic/Makefile.am
> > +++ b/platform/linux-generic/Makefile.am
> > @@ -151,6 +151,7 @@ noinst_HEADERS = \
> > ${srcdir}/Makefile.inc
> >
> >  __LIB__libodp_la_SOURCES = \
> > +odp_atomic.c \
> >  odp_barrier.c \
> >  odp_buffer.c \
> >  odp_classification.c \
> > diff --git a/platform/linux-generic/odp_atomic.c b/platform/linux-
> > generic/odp_atomic.c
> > new file mode 100644
> > index 000..996d09a
> > --- /dev/null
> > +++ b/platform/linux-generic/odp_atomic.c
> > @@ -0,0 +1,24 @@
> > +/* Copyright (c) 2015, Linaro Limited
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: BSD-3-Clause
> > + */
> > +
> > +#include 
> > +
> > +int 

Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Maxim Uvarov

Bala, can you tested it on merged master to api-next?

https://git.linaro.org/people/maxim.uvarov/odp.git api-next

We need to check if that changes did not went to merge. And I did not 
pull error back to api-next.


Maxim.

On 12/10/2015 18:12, Bala Manoharan wrote:

odp_classifier runs on api-next branch but if we run on master it
currently crashes during queue_enq function.
I remember the crash was similar to the one we had during queue
reorder implementation.

Regards,
Bala

On 10 December 2015 at 20:38, Stuart Haslam  wrote:

On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:

How to reproduce that it is broken?


I was looking at:

sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run

This shows a few packets going through initially then 0. Turns out this
is related to the netmap pktio, this works:

sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic 
./test/performance/odp_l2fwd_run

Not sure if this is the same failure Bala was seeing.

--
Stuart.





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


Re: [lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Bill Fischofer
Please open a bug for this.  Thanks.

On Thu, Dec 10, 2015 at 6:27 AM, Stuart Haslam 
wrote:

> On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:
> > Hi
> >
> >
> > I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure
> if I'm doing something wrong or if it's a bug.
> >
> > uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
> UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
> >
> >
> > Received packets with this Src IP will be stored in "queue1", right ?
> >
> > sudo ./odp_classifier -i eth0 -m 0 -p "ODP_PMR_SIP_ADDR:160.98.101.61:
> :queue1"
> >
> >
> > I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and
> there isn't any match. All packets go to default queue.
> >
> >
> > I have also tried:
> >
> > sudo ./odp_classifier -i eth0 -m 0 -p
> "ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
> > -> queue1
> >
> >
> > sudo ./odp_classifier -i eth0 -m 0 -p
> "ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
> > -> default queue
> >
> >
> > sudo ./odp_classifier -i eth0 -m 0 -p "ODP_PMR_SIP_ADDR:160.98.101.61:
> F000:queue1"
> > -> default queue
> >
> >
> > I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.
> >
> >
> > Thank you
> >
> > Nicolas
>
> It looks like something is broken :(
>
> I have a similar test that used to work and is now failing, sending
> everything to the default queue as you see.
>
> f64b306 is the last commit that works for me, 0d56b7b is the first one
> that fails in this way. The commits in between all either fail to build
> or seg fault (probably because the fix fe376471 is missing).
>
> --
> Stuart.
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


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

2015-12-10 Thread Bill Fischofer
On Thu, Dec 10, 2015 at 2:05 AM, Ivan Khoronzhuk  wrote:

>
>
> On 10.12.15 08:42, Maxim Uvarov wrote:
>
>> Going to apply this patch to unblock builds in new distros. Any
>> objections?
>>
>> Maxim.
>>
>
> I worry about change of timespec struct can break linux-generic time API.
> I believe it will not happen, but that's why I like Maxim`s approach a
> little more.
> [lng-odp] [API-NEXT PATCH 2/2] linux-generic: time: use same type as
> returned



In the (unlikely) event that the struct changes and that change would be
made in a non-backward compatible manner, then inn that case ODP would
simply update the implementation to  match the new internal API while
maintaining the
external definition.  This might involve changing the union to do
intermediate copies, however for now the union is more efficient, which is
why that's the technique used here.


>
>
>> On 12/09/2015 19:25, Ola Liljedahl wrote:
>>
>>> On 9 December 2015 at 16:53, Bill Fischofer >> > wrote:
>>>
>>> The linux-generic implementation of odp_time_t makes use of POSIX
>>> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an
>>> indirection
>>> mechanism so that these dependencies do not "bleed through" the
>>> ODP API.
>>> This means that ODP applications can be independent of
>>> _POSIX_C_SOURCE
>>> level.
>>>
>>> Yes this is the way it should be done. This is also another step in the
>>> ODP API becoming binary portable and run-time independent of the actual
>>> implementation.
>>>
>>>
>>> Signed-off-by: Bill Fischofer >> >
>>> ---
>>>  .../linux-generic/include/odp/plat/time_types.h|  5 +++-
>>>  platform/linux-generic/odp_time.c  | 27
>>> +-
>>>  2 files changed, 20 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
>>> b/platform/linux-generic/include/odp/plat/time_types.h
>>> index e5765ec..05e2b59 100644
>>> --- a/platform/linux-generic/include/odp/plat/time_types.h
>>> +++ b/platform/linux-generic/include/odp/plat/time_types.h
>>> @@ -21,7 +21,10 @@ extern "C" {
>>>   *  @{
>>>   **/
>>>
>>> -typedef struct timespec odp_time_t;
>>> +typedef struct {
>>> +   uint64_t tv_sec;
>>> +   int64_t  tv_nsec;
>>> +} odp_time_t;
>>>
>>>  odp_time_t odp_time_null(void);
>>>
>>> diff --git a/platform/linux-generic/odp_time.c
>>> b/platform/linux-generic/odp_time.c
>>> index 1c7c214..b5737f6 100644
>>> --- a/platform/linux-generic/odp_time.c
>>> +++ b/platform/linux-generic/odp_time.c
>>> @@ -11,7 +11,12 @@
>>>  #include 
>>>  #include 
>>>
>>> -static struct timespec start_time;
>>> +typedef union {
>>> +   odp_time_t  ex;
>>> +   struct timespec in;
>>> +} _odp_time_t;
>>> +
>>> +static odp_time_t start_time;
>>>
>>>  static inline
>>>  uint64_t time_to_ns(odp_time_t time)
>>> @@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
>>>  static inline
>>>  odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>>>  {
>>> -   struct timespec time;
>>> +   odp_time_t time;
>>>
>>> time.tv_sec = t2.tv_sec - t1.tv_sec;
>>> time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
>>> @@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t
>>> t1)
>>>  odp_time_t odp_time_local(void)
>>>  {
>>> int ret;
>>> -   struct timespec time;
>>> +   _odp_time_t time;
>>>
>>> -   ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
>>> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, 
>>> );
>>> if (odp_unlikely(ret != 0))
>>> ODP_ABORT("clock_gettime failed\n");
>>>
>>> -   return time_diff(time, start_time);
>>> +   return time_diff(time.ex, start_time);
>>>  }
>>>
>>>  odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
>>> @@ -64,7 +69,7 @@ uint64_t odp_time_to_ns(odp_time_t time)
>>>
>>>  odp_time_t odp_time_local_from_ns(uint64_t ns)
>>>  {
>>> -   struct timespec time;
>>> +   odp_time_t time;
>>>
>>> time.tv_sec = ns / ODP_TIME_SEC_IN_NS;
>>> time.tv_nsec = ns - time.tv_sec * ODP_TIME_SEC_IN_NS;
>>> @@ -85,7 +90,7 @@ int odp_time_cmp(odp_time_t t2, odp_time_t t1)
>>>
>>>  odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
>>>  {
>>> -   struct timespec time;
>>> +   odp_time_t time;
>>>
>>> time.tv_sec = t2.tv_sec + t1.tv_sec;
>>> time.tv_nsec = t2.tv_nsec + t1.tv_nsec;
>>> @@ -115,16 +120,16 @@ uint64_t odp_time_to_u64(odp_time_t time)
>>>
>>>  odp_time_t odp_time_null(void)
>>>  {
>>> -   return (struct timespec) {0, 

Re: [lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Maxim Uvarov

On 12/10/2015 16:18, Bala Manoharan wrote:

Looks like a previous commit has changed the Ip address format
As a work around pls provide IP address format in hexadecimal.
For eg "10.10.10.1" ==> "A.A.A.1".

Pls assign the bug to me.

Regards,
Bala


Can we also add that to  make check test? It will be good to capture 
such things as soon as possible.


Maxim.



On 10 December 2015 at 18:28, Bill Fischofer  wrote:

Please open a bug for this.  Thanks.

On Thu, Dec 10, 2015 at 6:27 AM, Stuart Haslam 
wrote:

On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:

Hi


I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure
if I'm doing something wrong or if it's a bug.

uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


Received packets with this Src IP will be stored in "queue1", right ?

sudo ./odp_classifier -i eth0 -m 0 -p
"ODP_PMR_SIP_ADDR:160.98.101.61::queue1"


I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and
there isn't any match. All packets go to default queue.


I have also tried:

sudo ./odp_classifier -i eth0 -m 0 -p
"ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
-> queue1


sudo ./odp_classifier -i eth0 -m 0 -p
"ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
-> default queue


sudo ./odp_classifier -i eth0 -m 0 -p
"ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
-> default queue


I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.


Thank you

Nicolas

It looks like something is broken :(

I have a similar test that used to work and is now failing, sending
everything to the default queue as you see.

f64b306 is the last commit that works for me, 0d56b7b is the first one
that fails in this way. The commits in between all either fail to build
or seg fault (probably because the fix fe376471 is missing).

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



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






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


Re: [lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Kury Nicolas

>Looks like a previous commit has changed the Ip address format
>As a work around pls provide IP address format in hexadecimal.
>For eg "10.10.10.1" ==> "A.A.A.1".

Thank you it works! But I still  have no match with ODP_PMR_UDP_DPORT=1234 even 
if I use the hexadecimal notation 4D2 or 04D2.



De : Bala Manoharan 
Envoyé : jeudi 10 décembre 2015 14:18
À : Bill Fischofer
Cc : Stuart Haslam; Kury Nicolas; lng-odp@lists.linaro.org
Objet : Re: [lng-odp] [HELP] odp_classification no match ?

Looks like a previous commit has changed the Ip address format
As a work around pls provide IP address format in hexadecimal.
For eg "10.10.10.1" ==> "A.A.A.1".

Pls assign the bug to me.

Regards,
Bala

On 10 December 2015 at 18:28, Bill Fischofer  wrote:
> Please open a bug for this.  Thanks.
>
> On Thu, Dec 10, 2015 at 6:27 AM, Stuart Haslam 
> wrote:
>>
>> On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:
>> > Hi
>> >
>> >
>> > I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure
>> > if I'm doing something wrong or if it's a bug.
>> >
>> > uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
>> > UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
>> >
>> >
>> > Received packets with this Src IP will be stored in "queue1", right ?
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61::queue1"
>> >
>> >
>> > I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and
>> > there isn't any match. All packets go to default queue.
>> >
>> >
>> > I have also tried:
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
>> > -> queue1
>> >
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
>> > -> default queue
>> >
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
>> > -> default queue
>> >
>> >
>> > I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.
>> >
>> >
>> > Thank you
>> >
>> > Nicolas
>>
>> It looks like something is broken :(
>>
>> I have a similar test that used to work and is now failing, sending
>> everything to the default queue as you see.
>>
>> f64b306 is the last commit that works for me, 0d56b7b is the first one
>> that fails in this way. The commits in between all either fail to build
>> or seg fault (probably because the fix fe376471 is missing).
>>
>> --
>> Stuart.
>> ___
>> 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
>



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


Re: [lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Bala Manoharan
I think with  ODP_PMR_UDP_DPORT match there was an issue and I had
fixed it in my latest patch in api-next.
Can you pls try if the api-next branch works for ODP_PMR_UDP_DPORT match.

Hexadecimal is required only for ip address and not for UDP port number.
Anyhow pls report the same in the bug.

I am working on a patch to revert IP address into the previous format
and will post it soon.

Regards,
Bala

On 10 December 2015 at 19:14, Kury Nicolas
 wrote:
>
>>Looks like a previous commit has changed the Ip address format
>>As a work around pls provide IP address format in hexadecimal.
>>For eg "10.10.10.1" ==> "A.A.A.1".
>
> Thank you it works! But I still  have no match with ODP_PMR_UDP_DPORT=1234 
> even if I use the hexadecimal notation 4D2 or 04D2.
>
>
> 
> De : Bala Manoharan 
> Envoyé : jeudi 10 décembre 2015 14:18
> À : Bill Fischofer
> Cc : Stuart Haslam; Kury Nicolas; lng-odp@lists.linaro.org
> Objet : Re: [lng-odp] [HELP] odp_classification no match ?
>
> Looks like a previous commit has changed the Ip address format
> As a work around pls provide IP address format in hexadecimal.
> For eg "10.10.10.1" ==> "A.A.A.1".
>
> Pls assign the bug to me.
>
> Regards,
> Bala
>
> On 10 December 2015 at 18:28, Bill Fischofer  
> wrote:
>> Please open a bug for this.  Thanks.
>>
>> On Thu, Dec 10, 2015 at 6:27 AM, Stuart Haslam 
>> wrote:
>>>
>>> On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:
>>> > Hi
>>> >
>>> >
>>> > I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure
>>> > if I'm doing something wrong or if it's a bug.
>>> >
>>> > uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
>>> > UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
>>> >
>>> >
>>> > Received packets with this Src IP will be stored in "queue1", right ?
>>> >
>>> > sudo ./odp_classifier -i eth0 -m 0 -p
>>> > "ODP_PMR_SIP_ADDR:160.98.101.61::queue1"
>>> >
>>> >
>>> > I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and
>>> > there isn't any match. All packets go to default queue.
>>> >
>>> >
>>> > I have also tried:
>>> >
>>> > sudo ./odp_classifier -i eth0 -m 0 -p
>>> > "ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
>>> > -> queue1
>>> >
>>> >
>>> > sudo ./odp_classifier -i eth0 -m 0 -p
>>> > "ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
>>> > -> default queue
>>> >
>>> >
>>> > sudo ./odp_classifier -i eth0 -m 0 -p
>>> > "ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
>>> > -> default queue
>>> >
>>> >
>>> > I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.
>>> >
>>> >
>>> > Thank you
>>> >
>>> > Nicolas
>>>
>>> It looks like something is broken :(
>>>
>>> I have a similar test that used to work and is now failing, sending
>>> everything to the default queue as you see.
>>>
>>> f64b306 is the last commit that works for me, 0d56b7b is the first one
>>> that fails in this way. The commits in between all either fail to build
>>> or seg fault (probably because the fix fe376471 is missing).
>>>
>>> --
>>> Stuart.
>>> ___
>>> 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
>>
>
>
>
> --
> Regards,
> Bala



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


Re: [lng-odp] [HELP] odp_classification no match ?

2015-12-10 Thread Bala Manoharan
Looks like a previous commit has changed the Ip address format
As a work around pls provide IP address format in hexadecimal.
For eg "10.10.10.1" ==> "A.A.A.1".

Pls assign the bug to me.

Regards,
Bala

On 10 December 2015 at 18:28, Bill Fischofer  wrote:
> Please open a bug for this.  Thanks.
>
> On Thu, Dec 10, 2015 at 6:27 AM, Stuart Haslam 
> wrote:
>>
>> On Thu, Dec 10, 2015 at 08:48:53AM +, Kury Nicolas wrote:
>> > Hi
>> >
>> >
>> > I'm trying odp_classification (ODP linux-generic 1.5) and I'm not sure
>> > if I'm doing something wrong or if it's a bug.
>> >
>> > uname -a : 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14
>> > UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
>> >
>> >
>> > Received packets with this Src IP will be stored in "queue1", right ?
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61::queue1"
>> >
>> >
>> > I'm sending UDP packets with Src IP = 160.98.101.61 on port 1234 and
>> > there isn't any match. All packets go to default queue.
>> >
>> >
>> > I have also tried:
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:1000:queue1"
>> > -> queue1
>> >
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:3000:queue1"
>> > -> default queue
>> >
>> >
>> > sudo ./odp_classifier -i eth0 -m 0 -p
>> > "ODP_PMR_SIP_ADDR:160.98.101.61:F000:queue1"
>> > -> default queue
>> >
>> >
>> > I have also tested with ODP_PMR_UDP_DPORT=1234 and it doesn't match too.
>> >
>> >
>> > Thank you
>> >
>> > Nicolas
>>
>> It looks like something is broken :(
>>
>> I have a similar test that used to work and is now failing, sending
>> everything to the default queue as you see.
>>
>> f64b306 is the last commit that works for me, 0d56b7b is the first one
>> that fails in this way. The commits in between all either fail to build
>> or seg fault (probably because the fix fe376471 is missing).
>>
>> --
>> Stuart.
>> ___
>> 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
>



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


Re: [lng-odp] [PATCH] test: performance: set a packet rate pass threshold for l2fwd

2015-12-10 Thread Stuart Haslam
ping

odp_generator appears to be broken on master, this would've caught it.

Stuart.

On 11 November 2015 at 15:01, Stuart Haslam  wrote:
> Report a failure if the maximum achieved packet rate is less than a
> predefined threshold (currently set at 5000pps).
>
> Signed-off-by: Stuart Haslam 
> ---
>  test/performance/odp_l2fwd_run | 25 ++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run
> index e0c61e7..001d8c2 100755
> --- a/test/performance/odp_l2fwd_run
> +++ b/test/performance/odp_l2fwd_run
> @@ -61,16 +61,35 @@ run_l2fwd()
> 2>&1 > /dev/null &
> GEN_PID=$!
>
> -   echo "Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2"
> -   odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2
> +   # this just turns off output buffering so that you still get periodic
> +   # output while piping to tee, as long as stdbuf is available.
> +   if [ "$(which stdbuf)" != "" ]; then
> +   STDBUF="stdbuf -o 0"
> +   else
> +   STDBUF=
> +   fi
> +   LOG=odp_l2fwd_tmp.log
> +   $STDBUF odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 | tee $LOG
> ret=$?
>
> kill ${GEN_PID}
>
> +   if [ ! -f $LOG ]; then
> +   echo "FAIL: $LOG not found"
> +   ret=1
> +   elif [ $ret -eq 0 ]; then
> +   PASS_PPS=5000
> +   MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
> +   if [ "$MAX_PPS" -lt "$PASS_PPS" ]; then
> +   echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
> +   ret=1
> +   fi
> +   fi
> +
> +   rm -f $LOG
> cleanup_pktio_env
> if [ $? -ne 0 ]; then
> echo "cleanup_pktio_env error $?"
> -   exit $TEST_SKIPPED
> fi
>
> exit $ret
> --
> 2.1.1
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


[lng-odp] [PATCH] example: classifier: fix ipv4 address input format

2015-12-10 Thread Balasubramanian Manoharan
Fixes ipv4 address input format issue.

Signed-off-by: Balasubramanian Manoharan 
---
 example/classifier/odp_classifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/example/classifier/odp_classifier.c 
b/example/classifier/odp_classifier.c
index 2ecf733..0da07e7 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -167,9 +167,8 @@ int parse_ipv4_addr(const char *ipaddress, uint64_t *addr)
uint32_t b[4];
int converted;
 
-   converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
-  ".%" SCNx32 ".%" SCNx32,
-   [3], [2], [1], [0]);
+   converted = sscanf(ipaddress, "%d.%d.%d.%d",
+  [3], [2], [1], [0]);
if (4 != converted)
return -1;
 
-- 
1.9.1

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


Re: [lng-odp] [PATCH] test: performance: set a packet rate pass threshold for l2fwd

2015-12-10 Thread Maxim Uvarov

Merged.
Maxim.

On 12/10/2015 17:07, Stuart Haslam wrote:

ping

odp_generator appears to be broken on master, this would've caught it.

Stuart.

On 11 November 2015 at 15:01, Stuart Haslam  wrote:

Report a failure if the maximum achieved packet rate is less than a
predefined threshold (currently set at 5000pps).

Signed-off-by: Stuart Haslam 
---
  test/performance/odp_l2fwd_run | 25 ++---
  1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run
index e0c61e7..001d8c2 100755
--- a/test/performance/odp_l2fwd_run
+++ b/test/performance/odp_l2fwd_run
@@ -61,16 +61,35 @@ run_l2fwd()
 2>&1 > /dev/null &
 GEN_PID=$!

-   echo "Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2"
-   odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2
+   # this just turns off output buffering so that you still get periodic
+   # output while piping to tee, as long as stdbuf is available.
+   if [ "$(which stdbuf)" != "" ]; then
+   STDBUF="stdbuf -o 0"
+   else
+   STDBUF=
+   fi
+   LOG=odp_l2fwd_tmp.log
+   $STDBUF odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 | tee $LOG
 ret=$?

 kill ${GEN_PID}

+   if [ ! -f $LOG ]; then
+   echo "FAIL: $LOG not found"
+   ret=1
+   elif [ $ret -eq 0 ]; then
+   PASS_PPS=5000
+   MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
+   if [ "$MAX_PPS" -lt "$PASS_PPS" ]; then
+   echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
+   ret=1
+   fi
+   fi
+
+   rm -f $LOG
 cleanup_pktio_env
 if [ $? -ne 0 ]; then
 echo "cleanup_pktio_env error $?"
-   exit $TEST_SKIPPED
 fi

 exit $ret
--
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] [PATCH] example: classifier: fix ipv4 address input format

2015-12-10 Thread Maxim Uvarov

Merged,
Maxim.

On 12/10/2015 18:49, Bill Fischofer wrote:



On Thu, Dec 10, 2015 at 8:13 AM, Balasubramanian Manoharan 
> wrote:


Fixes ipv4 address input format issue.

Signed-off-by: Balasubramanian Manoharan
>


Reviewed-by: Bill Fischofer >


---
 example/classifier/odp_classifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/example/classifier/odp_classifier.c
b/example/classifier/odp_classifier.c
index 2ecf733..0da07e7 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -167,9 +167,8 @@ int parse_ipv4_addr(const char *ipaddress,
uint64_t *addr)
uint32_t b[4];
int converted;

-   converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
-  ".%" SCNx32 ".%" SCNx32,
-   [3], [2], [1], [0]);
+   converted = sscanf(ipaddress, "%d.%d.%d.%d",
+  [3], [2], [1], [0]);
if (4 != converted)
return -1;

--
1.9.1

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




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


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


Re: [lng-odp] [PATCH] linux-generic: schedule: set sched_local.pool correctly

2015-12-10 Thread Maxim Uvarov

Merged,
Maxim.

On 12/10/2015 22:58, Bill Fischofer wrote:

Ping

On Tue, Dec 1, 2015 at 7:14 AM, Bill Fischofer 
> wrote:


This corrects bug https://bugs.linaro.org/show_bug.cgi?id=1921

Signed-off-by: Bill Fischofer >
---
 platform/linux-generic/odp_schedule.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/platform/linux-generic/odp_schedule.c
b/platform/linux-generic/odp_schedule.c
index 884ae60..9b7cd57 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -553,6 +553,8 @@ static int schedule(odp_queue_t *out_queue,
odp_event_t out_ev[],
sched_local.origin_qe = qe;
sched_local.order =
sched_local.buf_hdr[0]->order;
+   sched_local.pool =
+  sched_local.buf_hdr[0]->pool_hdl;
for (k = 0;
 k < qe->s.param.sched.lock_count;
 k++) {
--
2.1.4




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


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


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

2015-12-10 Thread Savolainen, Petri (Nokia - FI/Espoo)
Reviewed-by: Petri Savolainen 


> -Original Message-
> From: EXT Zoltan Kiss [mailto:zoltan.k...@linaro.org]
> Sent: Thursday, December 10, 2015 8:59 PM
> To: lng-odp@lists.linaro.org
> Cc: Savolainen, Petri (Nokia - FI/Espoo)
> Subject: [API-NEXT PATCH v2] api: init: allow implementation to use
> private ways for its own configuration
> 
> 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 
> ---
> 
> v2: improve wording about superseding
> 
>  include/odp/api/init.h | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/odp/api/init.h b/include/odp/api/init.h
> index 737ff6d..4ac5216 100644
> --- a/include/odp/api/init.h
> +++ b/include/odp/api/init.h
> @@ -141,6 +141,10 @@ 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 platform_params, it should always
> + * supersede any other configuration data the platform has.
>   *
>   * @param params  Those parameters that are interpreted by the
> ODP API.
>   *Use NULL to set all parameters to their
> defaults.
> --
> 1.9.1

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


Re: [lng-odp] [PATCHv6] helper : Fix UDP checksum computation

2015-12-10 Thread Ilya Maximets
Comments inlined.

On 10.12.2015 12:59, ion.grig...@freescale.com wrote:
> From: Grigore Ion 
> 
> This patch fixes the following problems:
> - checksum computation for LE platforms
> - checksum is computed in the CPU endianness. The returned result
> must be converted to the BE ordering when it is used to update
> the UDP checksum in a packet.
> - checksum computation for packets having the UDP length not a
> multiple of 2
> - fixes the UDP checksum associated validation test
> 
> Signed-off-by: Grigore Ion 
> ---
>  v6:
>  - Make code more understandable (Ilya Maximets)
>  v5:
>  - Checksum in CPU endianness fix added (Ilya Maximets)
>  v4:
>  - Verify checksum in CPU endianness in the associated test
>  (Ilya Maximets)
>  v3:
>  - fix the UDP checksum computation in the associated test
>  (Maxim Uvarov)
>  v2:
>  - patch updated to the last master (Maxim Uvarov)
>  v1:
>  - Move variables declaration on top of block. (Maxim Uvarov)
>  - Check patch with checkpatch script.  (Maxim Uvarov)
>  - L3 header presence is tested twice. (Alexandru Badicioiu)
>  - Remove unnecessary check for L3 header presence. (Bill Fischofer)
>  - Modify check of odp_packet_l4_offset() return. (Bill Fischofer)
> 
>  helper/include/odp/helper/udp.h | 81 
> +
>  helper/test/odp_chksum.c|  4 +-
>  2 files changed, 51 insertions(+), 34 deletions(-)
> 
> diff --git a/helper/include/odp/helper/udp.h b/helper/include/odp/helper/udp.h
> index 06c439b..d0599b1 100644
> --- a/helper/include/odp/helper/udp.h
> +++ b/helper/include/odp/helper/udp.h
> @@ -4,7 +4,6 @@
>   * SPDX-License-Identifier: BSD-3-Clause
>   */
>  
> -
>  /**
>   * @file
>   *
> @@ -22,7 +21,6 @@ extern "C" {
>  #include 
>  #include 
>  
> -
>  /** @addtogroup odph_header ODPH HEADER
>   *  @{
>   */
> @@ -39,51 +37,70 @@ typedef struct ODP_PACKED {
>  } odph_udphdr_t;
>  
>  /**
> + * Perform byte swap required by UDP checksum computation algorithm
> + */
> +static inline uint16_t csum_bswap(uint16_t val)
> +{
> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN
> + val = __odp_builtin_bswap16((__odp_force uint16_t)val);
> +#endif
> + return val;
> +}

Please, don't duplicate the code.

> +
> +/**
> + * Pad a byte value to the left or to the right as required by UDP checksum
> + * computation algorithm and convert the result to CPU native uint16_t.
> + * Left padding is performed for the IP protocol field in the UDP
> + * pseudo-header (RFC 768). Right padding is performed in the case of the odd
> + * byte in a UDP packet having the length not a 2 multiple.
> + */
> +static inline uint16_t u8_pad_to_u16(uint8_t val, odp_bool_t left)
> +{
> + uint16_tret;
> +
> + ret = (left) ? val : val << 8;
> + return csum_bswap(ret);
> +}
> +
> +/**
>   * UDP checksum
>   *
>   * This function uses odp packet to calc checksum
>   *
>   * @param pkt  calculate chksum for pkt
> - * @return  checksum value
> + * @return  checksum value in CPU endianness
>   */
>  static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt)
>  {
> - uint32_t sum = 0;
> - odph_udphdr_t *udph;
> - odph_ipv4hdr_t *iph;
> - uint16_t udplen;
> - uint8_t *buf;
> -
> - if (!odp_packet_l3_offset(pkt))
> - return 0;
> + odph_ipv4hdr_t  *iph;
> + odph_udphdr_t   *udph;
> + uint32_tsum;
> + uint16_tudplen, *buf;
>  
> - if (!odp_packet_l4_offset(pkt))
> + if (odp_packet_l4_offset(pkt) == ODP_PACKET_OFFSET_INVALID)
>   return 0;
> -
>   iph = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
>   udph = (odph_udphdr_t *)odp_packet_l4_ptr(pkt, NULL);
> - udplen = odp_be_to_cpu_16(udph->length);
> -
> - /* 32-bit sum of all 16-bit words covered by UDP chksum */
> + /* 32-bit sum of UDP pseudo-header */
>   sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
> -   (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
> -   (uint16_t)iph->proto + udplen;
> - for (buf = (uint8_t *)udph; udplen > 1; udplen -= 2) {
> - sum += ((*buf << 8) + *(buf + 1));
> - buf += 2;
> - }
> -
> - /* Fold sum to 16 bits: add carrier to result */
> - while (sum >> 16)
> - sum = (sum & 0x) + (sum >> 16);
> -
> + (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
> + u8_pad_to_u16(iph->proto, 1) + udph->length;

I meant something like:

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

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

sum = (iph->src_addr & 0x) + (iph->src_addr >> 16) +
  (iph->dst_addr & 0x) + (iph->dst_addr >> 16) +
  val.v16 + udph->length;

> + udplen = odp_be_to_cpu_16(udph->length);
> + buf = (uint16_t *)((void *)udph);
> + /* 32-bit sum of UDP header (checksum field cleared) and UDP data */
> + for ( ; udplen > 1; udplen -= 2)
> +  

Re: [lng-odp] [PATCH] example: classifier: fix ipv4 address input format

2015-12-10 Thread Bill Fischofer
On Thu, Dec 10, 2015 at 8:13 AM, Balasubramanian Manoharan <
bala.manoha...@linaro.org> wrote:

> Fixes ipv4 address input format issue.
>
> Signed-off-by: Balasubramanian Manoharan 
>

Reviewed-by: Bill Fischofer 


> ---
>  example/classifier/odp_classifier.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/example/classifier/odp_classifier.c
> b/example/classifier/odp_classifier.c
> index 2ecf733..0da07e7 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -167,9 +167,8 @@ int parse_ipv4_addr(const char *ipaddress, uint64_t
> *addr)
> uint32_t b[4];
> int converted;
>
> -   converted = sscanf(ipaddress, "%" SCNx32 ".%" SCNx32
> -  ".%" SCNx32 ".%" SCNx32,
> -   [3], [2], [1], [0]);
> +   converted = sscanf(ipaddress, "%d.%d.%d.%d",
> +  [3], [2], [1], [0]);
> if (4 != converted)
> return -1;
>
> --
> 1.9.1
>
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Bala Manoharan
Hi Maxim,

I just tested it again and I am seeing the same behaviour I explained
in the mail above.
In Master branch odp_classifier and odp_generator fails and both are
working on api-next branch.
This behaviour was seen by Stuart as well.

Regards,
Bala

On 11 December 2015 at 01:41, Maxim Uvarov  wrote:
> That patches introduce segfault. Pktio is socket_mmap:
>
> 8cf523f api: classification: add odp_cls_cos_pool_set() api
> 8da0ee0 example: classifier: add odp_cls_cos_pool_set() api
> 4ade6a3 validation: classification: add odp_cls_cos_pool_set() api
> e695969 linux-generic: classification: implements odp_cls_cos_pool_set() api
>
> Maxim.
>
>
> On 12/10/2015 23:04, Maxim Uvarov wrote:
>>
>> Bala,
>>
>> I have opposite result. After you patch master never fails. api-next fails
>> and my merge master to api-next also fails.
>> So it looks like we have something in api-next that breaks the work.
>>
>>
>> queue1   |queue2   |queue3   |DefaultCos   |Total Packets
>> queue  pool  |queue  pool  |queue  pool  |queue  pool  |
>> 437867 437867|131602 131602|653612 653612|59811  59811 |1282892
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0x74a91700 (LWP 3363)]
>> 0x0042652a in _odp_packet_cls_enq (pktio_entry=0x2b600040,
>> base=0x75307042 "33", buf_len=107, pkt_ret=0x74a90c40) at
>> pktio/pktio_common.c:29
>> 29pool = cos->s.pool->s.pool_hdl;
>> (gdb) bt
>> #0  0x0042652a in _odp_packet_cls_enq (pktio_entry=0x2b600040,
>> base=0x75307042 "33", buf_len=107, pkt_ret=0x74a90c40) at
>> pktio/pktio_common.c:29
>> #1  0x00410a88 in pkt_mmap_v2_rx (pktio_entry=0x2b600040,
>> pkt_sock=0x2b600080, pkt_table=0x74a90c40, len=8,
>> if_mac=0x2b6001a4 "") at pktio/socket_mmap.c:152
>> #2  0x004118b3 in sock_mmap_recv (pktio_entry=0x2b600040,
>> pkt_table=0x74a90c40, len=8) at pktio/socket_mmap.c:519
>> #3  0x0040cee1 in odp_pktio_recv (id=0x1,
>> pkt_table=0x74a90c40, len=8) at odp_packet_io.c:397
>> #4  0x0040d843 in pktin_poll (entry=0x2b600040) at
>> odp_packet_io.c:667
>> #5  0x00417a0f in schedule (out_queue=0x74a90e10,
>> out_ev=0x74a90dd8, max_num=1, max_deq=4) at odp_schedule.c:496
>> #6  0x00417d90 in schedule_loop (out_queue=0x74a90e10,
>> wait=18446744073709551615, out_ev=0x74a90dd8, max_num=1, max_deq=4) at
>> odp_schedule.c:594
>> #7  0x00417e67 in odp_schedule (out_queue=0x74a90e10,
>> wait=18446744073709551615) at odp_schedule.c:626
>> #8  0x0040321f in pktio_receive_thread (arg=0x77ff4000) at
>> odp_classifier.c:304
>> #9  0x0042900b in odp_run_start_routine (arg=0x6954e0) at
>> linux.c:36
>> #10 0x773a3182 in start_thread (arg=0x74a91700) at
>> pthread_create.c:312
>> #11 0x770d047d in clone () at
>> ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
>> (gdb) p cos
>> $1 = (cos_t *) 0x0
>> (gdb)
>>
>>
>> On 12/10/2015 18:12, Bala Manoharan wrote:
>>>
>>> odp_classifier runs on api-next branch but if we run on master it
>>> currently crashes during queue_enq function.
>>> I remember the crash was similar to the one we had during queue
>>> reorder implementation.
>>>
>>> Regards,
>>> Bala
>>>
>>> On 10 December 2015 at 20:38, Stuart Haslam 
>>> wrote:

 On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:
>
> How to reproduce that it is broken?
>
 I was looking at:

 sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run

 This shows a few packets going through initially then 0. Turns out this
 is related to the netmap pktio, this works:

 sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic
 ./test/performance/odp_l2fwd_run

 Not sure if this is the same failure Bala was seeing.

 --
 Stuart.
>>>
>>>
>>>
>>
>



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


[lng-odp] [PATCHv17 06/10] linux-generic/helper: move ring from helper to linux-generic

2015-12-10 Thread Maxim Uvarov
Move ring and it's test from helper to linux-generic/pktio and kill
not needed api_test directory. Unfortunately odp_ring_test.c had some old
dirty code so I had to clean up it to to use cunit and
latest helper apis.

Signed-off-by: Maxim Uvarov 
---
 configure.ac   |   1 -
 helper/Makefile.am |   2 -
 helper/test/Makefile.am|   5 +-
 platform/linux-generic/Makefile.am |   2 +
 .../include/odp_packet_io_ring_internal.h  | 112 +
 platform/linux-generic/m4/configure.m4 |   3 +-
 {helper => platform/linux-generic/pktio}/ring.c| 263 ++---
 platform/linux-generic/test/Makefile.am|   3 +-
 platform/linux-generic/test/ring/.gitignore|   1 +
 platform/linux-generic/test/ring/Makefile.am   |  16 ++
 .../linux-generic/test/ring/ringtest.c | 178 +++---
 test/Makefile.am   |   2 +-
 test/api_test/.gitignore   |   2 -
 test/api_test/Makefile.am  |  13 -
 test/api_test/odp_common.c |  91 ---
 test/api_test/odp_common.h |  42 
 16 files changed, 307 insertions(+), 429 deletions(-)
 rename helper/include/odp/helper/ring.h => 
platform/linux-generic/include/odp_packet_io_ring_internal.h (87%)
 rename {helper => platform/linux-generic/pktio}/ring.c (71%)
 create mode 100644 platform/linux-generic/test/ring/.gitignore
 create mode 100644 platform/linux-generic/test/ring/Makefile.am
 rename test/api_test/odp_ring_test.c => 
platform/linux-generic/test/ring/ringtest.c (72%)
 delete mode 100644 test/api_test/.gitignore
 delete mode 100644 test/api_test/Makefile.am
 delete mode 100644 test/api_test/odp_common.c
 delete mode 100644 test/api_test/odp_common.h

diff --git a/configure.ac b/configure.ac
index 00a1415..bfaa3be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -345,7 +345,6 @@ AC_CONFIG_FILES([Makefile
 pkgconfig/libodphelper.pc
 scripts/Makefile
 test/Makefile
-test/api_test/Makefile
 test/performance/Makefile
 test/validation/Makefile
 test/validation/buffer/Makefile
diff --git a/helper/Makefile.am b/helper/Makefile.am
index 9caaba0..0f4c09b 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -8,7 +8,6 @@ AM_CFLAGS += -I$(top_srcdir)/include
 
 helperincludedir = $(includedir)/odp/helper/
 helperinclude_HEADERS = \
- $(srcdir)/include/odp/helper/ring.h \
  $(srcdir)/include/odp/helper/linux.h \
  $(srcdir)/include/odp/helper/chksum.h\
  $(srcdir)/include/odp/helper/eth.h\
@@ -29,7 +28,6 @@ noinst_HEADERS = \
 
 __LIB__libodphelper_la_SOURCES = \
linux.c \
-   ring.c \
hashtable.c \
lineartable.c
 
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index 760dac1..a9c3016 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -1,6 +1,7 @@
 include $(top_srcdir)/test/Makefile.inc
 
 AM_CFLAGS += -I$(srcdir)/common
+AM_CFLAGS += -I$(top_srcdir)/test/validation/common
 AM_LDFLAGS += -static
 
 TESTS_ENVIRONMENT += TEST_DIR=${builddir}
@@ -28,5 +29,5 @@ dist_thread_SOURCES = thread.c
 thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
 dist_process_SOURCES = process.c
 process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-odph_pause_SOURCES = pause.c
-dist_odp_table_SOURCES = table.c
+dist_pause_SOURCES = pause.c
+dist_table_SOURCES = table.c
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index f71c0f2..1ed2ed7 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -91,6 +91,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_internal.h \
  ${srcdir}/include/odp_packet_io_internal.h \
  ${srcdir}/include/odp_packet_io_queue.h \
+ ${srcdir}/include/odp_packet_io_ring_internal.h \
  ${srcdir}/include/odp_packet_netmap.h \
  ${srcdir}/include/odp_packet_socket.h \
  ${srcdir}/include/odp_pool_internal.h \
@@ -121,6 +122,7 @@ __LIB__libodp_la_SOURCES = \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/ring.c \
   odp_pool.c \
   odp_queue.c \
   odp_rwlock.c \
diff --git a/helper/include/odp/helper/ring.h 
b/platform/linux-generic/include/odp_packet_io_ring_internal.h
similarity index 87%
rename from 

Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Mike Holmes
If the examples are broken, this is a strong reason that we need to add the
examples to the  "make check" with maybe --enable-test-examples.
We  touched on this in the JIra scrub for doc and examples this morning
https://projects.linaro.org/browse/ODP-203

On 10 December 2015 at 09:19, Bala Manoharan 
wrote:

> Hi,
>
> odp_classifier and odp_generator is failing in the master branch but
> both are working in api-next branch.
> Looks like the issue in classifier is a bug is in the queue module
> which was fixed in api-next branch and this fix needs to be merged
> into master branch.
>
> Regards,
> Bala
> ___
> 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] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Bala Manoharan
Not sure which was the commit.
Maybe Bill can confirm the commit.

Regards,
Bala

On 10 December 2015 at 19:55, Maxim Uvarov  wrote:
> On 12/10/2015 17:19, Bala Manoharan wrote:
>>
>> Hi,
>>
>> odp_classifier and odp_generator is failing in the master branch but
>> both are working in api-next branch.
>> Looks like the issue in classifier is a bug is in the queue module
>> which was fixed in api-next branch and this fix needs to be merged
>> into master branch.
>>
>> Regards,
>> Bala
>
> Do you know specific commit id?
>
> Maxim.
>
>
>> ___
>> 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



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


[lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Bala Manoharan
Hi,

odp_classifier and odp_generator is failing in the master branch but
both are working in api-next branch.
Looks like the issue in classifier is a bug is in the queue module
which was fixed in api-next branch and this fix needs to be merged
into master branch.

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


[lng-odp] [PATCHv17 03/10] helper: flag to not link ring to linked list

2015-12-10 Thread Maxim Uvarov
Add flag ODPH_RING_NO_LIST to ring to not link it to linked list.

Signed-off-by: Maxim Uvarov 
---
 helper/include/odp/helper/ring.h | 21 +
 helper/ring.c|  3 ++-
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h
index 5e640a7..541a466 100644
--- a/helper/include/odp/helper/ring.h
+++ b/helper/include/odp/helper/ring.h
@@ -155,14 +155,19 @@ typedef struct odph_ring {
void *ring[0] ODP_ALIGNED_CACHE;
 } odph_ring_t;
 
-
-#define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is 
"single-producer".*/
-#define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is 
"single-consumer".*/
-#define ODPH_RING_SHM_PROC 0x0004 /* If set - ring is visible from different
-   processes. Default is thread visible. */
-#define ODPH_RING_QUOT_EXCEED (1 << 31)  /* Quota exceed for burst ops */
-#define ODPH_RING_SZ_MASK  (unsigned)(0x0fff) /* Ring size mask */
-
+/* The default enqueue is "single-producer".*/
+#define ODPH_RING_F_SP_ENQ (1 << 0)
+/* The default dequeue is "single-consumer".*/
+#define ODPH_RING_F_SC_DEQ (1 << 1)
+/* If set - ring is visible from different processes.
+ * Default is thread visible.*/
+#define ODPH_RING_SHM_PROC (1 << 2)
+ /* Do not link ring to linked list. */
+#define ODPH_RING_NO_LIST  (1 << 3)
+/* Quota exceed for burst ops */
+#define ODPH_RING_QUOT_EXCEED (1 << 31)
+/* Ring size mask */
+#define ODPH_RING_SZ_MASK  (unsigned)(0x0fff)
 
 /**
  * Create a new ring named *name* in memory.
diff --git a/helper/ring.c b/helper/ring.c
index 844abf7..e113606 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -199,7 +199,8 @@ odph_ring_create(const char *name, unsigned count, unsigned 
flags)
r->prod.tail = 0;
r->cons.tail = 0;
 
-   TAILQ_INSERT_TAIL(_ring_list, r, next);
+   if (!(flags & ODPH_RING_NO_LIST))
+   TAILQ_INSERT_TAIL(_ring_list, r, next);
} else {
ODPH_ERR("Cannot reserve memory\n");
}
-- 
1.9.1

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


[lng-odp] [PATCHv17 04/10] helpers: remove odp_ prefix for tests source files

2015-12-10 Thread Maxim Uvarov
Prefixed were removed for validation test suite and to
be consistent we need to do the same for helpers.

Signed-off-by: Maxim Uvarov 
---
 helper/test/.gitignore   | 10 +-
 helper/test/Makefile.am  | 25 -
 helper/test/{odp_chksum.c => chksum.c}   |  3 +--
 helper/test/{odph_pause.c => pause.c}|  0
 helper/test/{odp_process.c => process.c} |  3 ++-
 helper/test/{odp_table.c => table.c} |  1 -
 helper/test/{odp_thread.c => thread.c}   |  3 ++-
 7 files changed, 22 insertions(+), 23 deletions(-)
 rename helper/test/{odp_chksum.c => chksum.c} (98%)
 rename helper/test/{odph_pause.c => pause.c} (100%)
 rename helper/test/{odp_process.c => process.c} (96%)
 rename helper/test/{odp_table.c => table.c} (99%)
 rename helper/test/{odp_thread.c => thread.c} (96%)

diff --git a/helper/test/.gitignore b/helper/test/.gitignore
index 50a0da4..1984139 100644
--- a/helper/test/.gitignore
+++ b/helper/test/.gitignore
@@ -1,7 +1,7 @@
 *.trs
 *.log
-odp_chksum
-odp_process
-odp_table
-odp_thread
-odph_pause
+chksum
+process
+table
+thread
+pause
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index d6820e1..760dac1 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -5,11 +5,11 @@ AM_LDFLAGS += -static
 
 TESTS_ENVIRONMENT += TEST_DIR=${builddir}
 
-EXECUTABLES = odp_chksum$(EXEEXT) \
-  odp_thread$(EXEEXT) \
-  odp_process$(EXEEXT)\
-  odph_pause$(EXEEXT)\
-  odp_table$(EXEEXT)
+EXECUTABLES = chksum$(EXEEXT) \
+  thread$(EXEEXT) \
+  process$(EXEEXT)\
+  pause$(EXEEXT)\
+  table$(EXEEXT)
 
 COMPILE_ONLY =
 
@@ -23,11 +23,10 @@ dist_bin_SCRIPTS =
 
 bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
 
-
-dist_odp_chksum_SOURCES = odp_chksum.c
-dist_odp_thread_SOURCES = odp_thread.c
-odp_thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-dist_odp_process_SOURCES = odp_process.c
-odp_process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
-odph_pause_SOURCES = odph_pause.c
-dist_odp_table_SOURCES = odp_table.c
+dist_chksum_SOURCES = chksum.c
+dist_thread_SOURCES = thread.c
+thread_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
+dist_process_SOURCES = process.c
+process_LDADD = $(LIB)/libodphelper.la $(LIB)/libodp.la
+odph_pause_SOURCES = pause.c
+dist_odp_table_SOURCES = table.c
diff --git a/helper/test/odp_chksum.c b/helper/test/chksum.c
similarity index 98%
rename from helper/test/odp_chksum.c
rename to helper/test/chksum.c
index 1d417a8..c987905 100644
--- a/helper/test/odp_chksum.c
+++ b/helper/test/chksum.c
@@ -64,10 +64,9 @@ static int scan_ip(const char *buf, unsigned int *paddr)
if (paddr)
*paddr = part1 << 24 | part2 << 16 | part3 << 8 | part4;
return 1;
-   } else {
-   printf("not good ip %d:%d:%d:%d/n", part1, part2, part3, part4);
}
 
+   printf("not good ip %d:%d:%d:%d/n", part1, part2, part3, part4);
return 0;
 }
 
diff --git a/helper/test/odph_pause.c b/helper/test/pause.c
similarity index 100%
rename from helper/test/odph_pause.c
rename to helper/test/pause.c
diff --git a/helper/test/odp_process.c b/helper/test/process.c
similarity index 96%
rename from helper/test/odp_process.c
rename to helper/test/process.c
index cb9b328..6648627 100644
--- a/helper/test/odp_process.c
+++ b/helper/test/process.c
@@ -53,7 +53,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
cpu = odp_cpumask_first(_mask);
printf("the first CPU:  %i\n", cpu);
 
-   /* reserve cpu 0 for the control plane so remove it from the default 
mask */
+   /* reserve cpu 0 for the control plane so remove it from
+* the default mask */
odp_cpumask_clr(_mask, 0);
num_workers = odp_cpumask_count(_mask);
(void)odp_cpumask_to_str(_mask, cpumaskstr, sizeof(cpumaskstr));
diff --git a/helper/test/odp_table.c b/helper/test/table.c
similarity index 99%
rename from helper/test/odp_table.c
rename to helper/test/table.c
index 16de165..b7f53d6 100644
--- a/helper/test/odp_table.c
+++ b/helper/test/table.c
@@ -131,4 +131,3 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
 
return 0;
 }
-
diff --git a/helper/test/odp_thread.c b/helper/test/thread.c
similarity index 96%
rename from helper/test/odp_thread.c
rename to helper/test/thread.c
index 592f856..4e7f053 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/thread.c
@@ -54,7 +54,8 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
cpu = odp_cpumask_first(_mask);
printf("the first CPU:  %i\n", cpu);
 
-   /* reserve cpu 0 for the control plane so remove it from the default 
mask */
+   /* reserve cpu 0 for the control plane so remove it from
+* the default mask */
odp_cpumask_clr(_mask, 0);
num_workers = odp_cpumask_count(_mask);
 

[lng-odp] [PATCHv17 05/10] helper: move odp pause to installed helper

2015-12-10 Thread Maxim Uvarov
ipc pktio depends on ring which depends on pause. Move
pause to installed helpers to support out of tree builds.

Signed-off-by: Maxim Uvarov 
---
 helper/Makefile.am  | 4 ++--
 helper/{odph_pause.h => include/odp/helper/pause.h} | 0
 helper/ring.c   | 2 +-
 helper/test/pause.c | 2 +-
 platform/linux-generic/Makefile.am  | 1 +
 5 files changed, 5 insertions(+), 4 deletions(-)
 rename helper/{odph_pause.h => include/odp/helper/pause.h} (100%)

diff --git a/helper/Makefile.am b/helper/Makefile.am
index 1906ae2..9caaba0 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -18,11 +18,11 @@ helperinclude_HEADERS = \
  $(srcdir)/include/odp/helper/strong_types.h\
  $(srcdir)/include/odp/helper/tcp.h\
  $(srcdir)/include/odp/helper/table.h\
- $(srcdir)/include/odp/helper/udp.h
+ $(srcdir)/include/odp/helper/udp.h \
+ $(srcdir)/include/odp/helper/pause.h
 
 noinst_HEADERS = \
 $(srcdir)/odph_debug.h \
-$(srcdir)/odph_pause.h \
 $(srcdir)/odph_hashtable.h \
 $(srcdir)/odph_lineartable.h \
 $(srcdir)/odph_list_internal.h
diff --git a/helper/odph_pause.h b/helper/include/odp/helper/pause.h
similarity index 100%
rename from helper/odph_pause.h
rename to helper/include/odp/helper/pause.h
diff --git a/helper/ring.c b/helper/ring.c
index e113606..6b233cc 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -71,7 +71,7 @@
 
 #include 
 #include 
-#include "odph_pause.h"
+#include 
 #include 
 #include 
 #include 
diff --git a/helper/test/pause.c b/helper/test/pause.c
index f5f5da3..c5a5f1a 100644
--- a/helper/test/pause.c
+++ b/helper/test/pause.c
@@ -5,7 +5,7 @@
  */
 
 #include 
-#include "../odph_pause.h"
+#include 
 
 int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
 {
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 70bd8fe..f71c0f2 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -6,6 +6,7 @@ include $(top_srcdir)/platform/Makefile.inc
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/helper/include
+AM_CFLAGS +=  -I$(top_srcdir)/helper
 
 include_HEADERS = \
  $(top_srcdir)/include/odp.h
-- 
1.9.1

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


Re: [lng-odp] [PATCH] test: performance: set a packet rate pass threshold for l2fwd

2015-12-10 Thread Maxim Uvarov

On 12/10/2015 17:07, Stuart Haslam wrote:

ping

odp_generator appears to be broken on master, this would've caught it.

Stuart.

Thank we need to fix it and then apply that patch.

Maxim.



On 11 November 2015 at 15:01, Stuart Haslam  wrote:

Report a failure if the maximum achieved packet rate is less than a
predefined threshold (currently set at 5000pps).

Signed-off-by: Stuart Haslam 
---
  test/performance/odp_l2fwd_run | 25 ++---
  1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/test/performance/odp_l2fwd_run b/test/performance/odp_l2fwd_run
index e0c61e7..001d8c2 100755
--- a/test/performance/odp_l2fwd_run
+++ b/test/performance/odp_l2fwd_run
@@ -61,16 +61,35 @@ run_l2fwd()
 2>&1 > /dev/null &
 GEN_PID=$!

-   echo "Run odp_l2fwd -i $IF1,$IF2 -m 0 -t 30 -c 2"
-   odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2
+   # this just turns off output buffering so that you still get periodic
+   # output while piping to tee, as long as stdbuf is available.
+   if [ "$(which stdbuf)" != "" ]; then
+   STDBUF="stdbuf -o 0"
+   else
+   STDBUF=
+   fi
+   LOG=odp_l2fwd_tmp.log
+   $STDBUF odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 | tee $LOG
 ret=$?

 kill ${GEN_PID}

+   if [ ! -f $LOG ]; then
+   echo "FAIL: $LOG not found"
+   ret=1
+   elif [ $ret -eq 0 ]; then
+   PASS_PPS=5000
+   MAX_PPS=$(awk '/TEST RESULT/ {print $3}' $LOG)
+   if [ "$MAX_PPS" -lt "$PASS_PPS" ]; then
+   echo "FAIL: pps below threshold $MAX_PPS < $PASS_PPS"
+   ret=1
+   fi
+   fi
+
+   rm -f $LOG
 cleanup_pktio_env
 if [ $? -ne 0 ]; then
 echo "cleanup_pktio_env error $?"
-   exit $TEST_SKIPPED
 fi

 exit $ret
--
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] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Maxim Uvarov

How to reproduce that it is broken?

Maxim.

On 12/10/2015 17:48, Bala Manoharan wrote:

Not sure which was the commit.
Maybe Bill can confirm the commit.

Regards,
Bala

On 10 December 2015 at 19:55, Maxim Uvarov  wrote:

On 12/10/2015 17:19, Bala Manoharan wrote:

Hi,

odp_classifier and odp_generator is failing in the master branch but
both are working in api-next branch.
Looks like the issue in classifier is a bug is in the queue module
which was fixed in api-next branch and this fix needs to be merged
into master branch.

Regards,
Bala

Do you know specific commit id?

Maxim.



___
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] [PATCHv17 01/10] helper: ring: update ring with shm proc argument

2015-12-10 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 helper/include/odp/helper/ring.h | 2 ++
 helper/ring.c| 9 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/helper/include/odp/helper/ring.h b/helper/include/odp/helper/ring.h
index 65c32ad..5e640a7 100644
--- a/helper/include/odp/helper/ring.h
+++ b/helper/include/odp/helper/ring.h
@@ -158,6 +158,8 @@ typedef struct odph_ring {
 
 #define ODPH_RING_F_SP_ENQ 0x0001 /* The default enqueue is 
"single-producer".*/
 #define ODPH_RING_F_SC_DEQ 0x0002 /* The default dequeue is 
"single-consumer".*/
+#define ODPH_RING_SHM_PROC 0x0004 /* If set - ring is visible from different
+   processes. Default is thread visible. */
 #define ODPH_RING_QUOT_EXCEED (1 << 31)  /* Quota exceed for burst ops */
 #define ODPH_RING_SZ_MASK  (unsigned)(0x0fff) /* Ring size mask */
 
diff --git a/helper/ring.c b/helper/ring.c
index 3122173..844abf7 100644
--- a/helper/ring.c
+++ b/helper/ring.c
@@ -158,8 +158,14 @@ odph_ring_create(const char *name, unsigned count, 
unsigned flags)
char ring_name[ODPH_RING_NAMESIZE];
odph_ring_t *r;
size_t ring_size;
+   uint32_t shm_flag;
odp_shm_t shm;
 
+   if (flags & ODPH_RING_SHM_PROC)
+   shm_flag = ODP_SHM_PROC;
+   else
+   shm_flag = 0;
+
/* count must be a power of 2 */
if (!RING_VAL_IS_POWER_2(count) || (count > ODPH_RING_SZ_MASK)) {
ODPH_ERR("Requested size is invalid, must be power of 2, and do 
not exceed the size limit %u\n",
@@ -172,7 +178,8 @@ odph_ring_create(const char *name, unsigned count, unsigned 
flags)
 
odp_rwlock_write_lock();
/* reserve a memory zone for this ring.*/
-   shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE, 0);
+   shm = odp_shm_reserve(ring_name, ring_size, ODP_CACHE_LINE_SIZE,
+ shm_flag);
 
r = odp_shm_addr(shm);
 
-- 
1.9.1

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


[lng-odp] [PATCHv17 00/10] IPC (pktio)

2015-12-10 Thread Maxim Uvarov
v17: - move ring from helper to linux-generic
 - do small makefile fixes to make make distcheck pass

v16: - do not use ODPH_DBG if ring is used for implementation,
also set up right errno as described in doxygen description.

v15: - rebase on the latest master
 - fix checkpatch errors on move odp ring (Mikes comment)

v14: - rebase on the latest master
 - move odp pause to installed helper to make out of tree builds happen.

v13: - added ipc.README with description and limitations notes.

v12: - size size for ring names arrays;
 - add patch "linix-generic: return error for unsupported pktio calls"
to not crash on unsupported calls;
 - fix sleep(0.1);
 - fix git ignore;

v11: - removed odph_pause patch due to Petri will send patch to make it
odp api. (Anders).
 - implement pktio stop, pktio close, do helpers, fix Stuarts comments.

v10: clean up patches according to Stuart comments
(remove timeouts, add O_EXCL, do not map rings each packets and etc..)

v9: reworked patches according to Connect agreements:
- linux-generic only pktio;
- 2 separate symmetric apps with same init process;
- does not matter which app was run first;
- init process for 2 apps is the same;

https://git.linaro.org/people/maxim.uvarov/odp.git pktio_ipc_v17

Maxim Uvarov (10):
  helper: ring: update ring with shm proc argument
  linux-generic: create internal pool create function with shm flags
  helper: flag to not link ring to linked list
  helpers: remove odp_ prefix for tests source files
  helper: move odp pause to installed helper
  linux-generic/helper: move ring from helper to linux-generic
  linux-generic: ring set up __odp_errno as doxygen says
  linix-generic: return error for unsupported pktio calls
  linux-generic: add ipc pktio support
  linux-generic: internal ipc_pktio test

 configure.ac   |   1 -
 helper/Makefile.am |   6 +-
 .../{odph_pause.h => include/odp/helper/pause.h}   |   0
 helper/test/.gitignore |  10 +-
 helper/test/Makefile.am|  26 +-
 helper/test/{odp_chksum.c => chksum.c} |   3 +-
 helper/test/{odph_pause.c => pause.c}  |   2 +-
 helper/test/{odp_process.c => process.c}   |   3 +-
 helper/test/{odp_table.c => table.c}   |   1 -
 helper/test/{odp_thread.c => thread.c} |   3 +-
 platform/linux-generic/Makefile.am |   6 +
 .../linux-generic/include/odp_buffer_internal.h|   3 +
 .../linux-generic/include/odp_packet_io_internal.h |  38 ++
 .../include/odp_packet_io_ipc_internal.h   |  47 ++
 .../include/odp_packet_io_ring_internal.h  | 119 ++--
 platform/linux-generic/include/odp_pool_internal.h |   4 +
 platform/linux-generic/include/odp_shm_internal.h  |  21 +
 platform/linux-generic/m4/configure.m4 |   4 +-
 platform/linux-generic/odp_packet_io.c |  25 +-
 platform/linux-generic/odp_pool.c  |  25 +-
 platform/linux-generic/odp_schedule.c  |   3 +-
 platform/linux-generic/odp_shared_memory.c |  14 +-
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/ipc.c | 729 +
 {helper => platform/linux-generic/pktio}/ring.c| 276 
 platform/linux-generic/test/Makefile.am|   4 +-
 platform/linux-generic/test/pktio_ipc/.gitignore   |   2 +
 platform/linux-generic/test/pktio_ipc/Makefile.am  |  20 +
 platform/linux-generic/test/pktio_ipc/ipc_common.c | 138 
 platform/linux-generic/test/pktio_ipc/ipc_common.h |  87 +++
 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 310 +
 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 187 ++
 .../linux-generic/test/pktio_ipc/pktio_ipc_run |  64 ++
 platform/linux-generic/test/ring/.gitignore|   1 +
 platform/linux-generic/test/ring/Makefile.am   |  16 +
 .../linux-generic/test/ring/ringtest.c | 178 ++---
 test/Makefile.am   |   2 +-
 test/api_test/.gitignore   |   2 -
 test/api_test/Makefile.am  |  13 -
 test/api_test/odp_common.c |  91 ---
 test/api_test/odp_common.h |  42 --
 41 files changed, 2056 insertions(+), 471 deletions(-)
 rename helper/{odph_pause.h => include/odp/helper/pause.h} (100%)
 rename helper/test/{odp_chksum.c => chksum.c} (98%)
 rename helper/test/{odph_pause.c => pause.c} (88%)
 rename helper/test/{odp_process.c => process.c} (96%)
 rename helper/test/{odp_table.c => table.c} (99%)
 rename helper/test/{odp_thread.c => thread.c} (96%)
 create mode 100644 platform/linux-generic/include/odp_packet_io_ipc_internal.h
 rename helper/include/odp/helper/ring.h => 
platform/linux-generic/include/odp_packet_io_ring_internal.h (86%)
 create mode 100644 

[lng-odp] [PATCHv17 02/10] linux-generic: create internal pool create function with shm flags

2015-12-10 Thread Maxim Uvarov
On init odp creates odp_sched_pool. We can not modify API to add new
parameter to odp_pool_param_t and this pool should not be shared
between different processes. To do that implemented internal linux-generic
function with parameters to created shm.
Note: create shm before and then provide it to the pool does not work
because shm argument likely will be dropped from odp_pool_create() (patch
already posted.).

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/include/odp_pool_internal.h |  4 
 platform/linux-generic/odp_pool.c  | 11 +--
 platform/linux-generic/odp_schedule.c  |  3 +--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index 94bf1fa..b268cde 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -354,6 +354,10 @@ static inline uint32_t odp_buffer_pool_tailroom(odp_pool_t 
pool)
return odp_pool_to_entry(pool)->s.tailroom;
 }
 
+odp_pool_t _pool_create(const char *name,
+   odp_pool_param_t *params,
+   uint32_t shmflags);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index 9859ff6..e0992db 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -150,7 +150,9 @@ int odp_pool_term_local(void)
  * Pool creation
  */
 
-odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
+odp_pool_t _pool_create(const char *name,
+   odp_pool_param_t *params,
+   uint32_t shmflags)
 {
odp_pool_t pool_hdl = ODP_POOL_INVALID;
pool_entry_t *pool;
@@ -296,7 +298,7 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
 
shm = odp_shm_reserve(pool->s.name,
  pool->s.pool_size,
- ODP_PAGE_SIZE, 0);
+ ODP_PAGE_SIZE, shmflags);
if (shm == ODP_SHM_INVALID) {
POOL_UNLOCK(>s.lock);
return ODP_POOL_INVALID;
@@ -409,6 +411,11 @@ odp_pool_t odp_pool_create(const char *name, 
odp_pool_param_t *params)
return pool_hdl;
 }
 
+odp_pool_t odp_pool_create(const char *name,
+  odp_pool_param_t *params)
+{
+   return _pool_create(name, params, ODP_SHM_PROC);
+}
 
 odp_pool_t odp_pool_lookup(const char *name)
 {
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 884ae60..edfe4e5 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -141,8 +141,7 @@ int odp_schedule_init_global(void)
params.buf.num   = NUM_SCHED_CMD;
params.type  = ODP_POOL_BUFFER;
 
-   pool = odp_pool_create("odp_sched_pool", );
-
+   pool = _pool_create("odp_sched_pool", , 0);
if (pool == ODP_POOL_INVALID) {
ODP_ERR("Schedule init: Pool create failed.\n");
return -1;
-- 
1.9.1

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


[lng-odp] [PATCHv17 07/10] linux-generic: ring set up __odp_errno as doxygen says

2015-12-10 Thread Maxim Uvarov
Accodring to doxygen comment if ring creation fails __odp_errno
should be set.

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

diff --git a/platform/linux-generic/pktio/ring.c 
b/platform/linux-generic/pktio/ring.c
index 9af11b7..015f1c0 100644
--- a/platform/linux-generic/pktio/ring.c
+++ b/platform/linux-generic/pktio/ring.c
@@ -79,6 +79,7 @@
 #include "odph_debug.h"
 #include 
 #include 
+#include 
 
 static TAILQ_HEAD(, _ring) odp_ring_list;
 
@@ -171,6 +172,7 @@ _ring_create(const char *name, unsigned count, unsigned 
flags)
ODPH_ERR("Requested size is invalid, must be power of 2,"
 "and do not exceed the size limit %u\n",
 _RING_SZ_MASK);
+   __odp_errno = EINVAL;
return NULL;
}
 
@@ -203,6 +205,7 @@ _ring_create(const char *name, unsigned count, unsigned 
flags)
if (!(flags & _RING_NO_LIST))
TAILQ_INSERT_TAIL(_ring_list, r, next);
} else {
+   __odp_errno = ENOMEM;
ODPH_ERR("Cannot reserve memory\n");
}
 
-- 
1.9.1

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


[lng-odp] [PATCHv17 08/10] linix-generic: return error for unsupported pktio calls

2015-12-10 Thread Maxim Uvarov
For some pktios like loop and ipc functions like mtu, promisc,
and mac addr are not applicable. Instead of crash on deference
null pointer just return error if functions are not defined.
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/odp_packet_io.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 1e9d08c..c8b6502 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -725,7 +725,7 @@ int pktin_poll(pktio_entry_t *entry)
 int odp_pktio_mtu(odp_pktio_t id)
 {
pktio_entry_t *entry;
-   int ret;
+   int ret = -1;
 
entry = get_pktio_entry(id);
if (entry == NULL) {
@@ -740,7 +740,9 @@ int odp_pktio_mtu(odp_pktio_t id)
ODP_DBG("already freed pktio\n");
return -1;
}
-   ret = entry->s.ops->mtu_get(entry);
+
+   if (entry->s.ops->mtu_get)
+   ret = entry->s.ops->mtu_get(entry);
 
unlock_entry(entry);
return ret;
@@ -749,7 +751,7 @@ int odp_pktio_mtu(odp_pktio_t id)
 int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t enable)
 {
pktio_entry_t *entry;
-   int ret;
+   int ret = -1;
 
entry = get_pktio_entry(id);
if (entry == NULL) {
@@ -769,7 +771,8 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t 
enable)
return -1;
}
 
-   ret = entry->s.ops->promisc_mode_set(entry, enable);
+   if (entry->s.ops->promisc_mode_set)
+   ret = entry->s.ops->promisc_mode_set(entry, enable);
 
unlock_entry(entry);
return ret;
@@ -778,7 +781,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t id, odp_bool_t 
enable)
 int odp_pktio_promisc_mode(odp_pktio_t id)
 {
pktio_entry_t *entry;
-   int ret;
+   int ret = -1;
 
entry = get_pktio_entry(id);
if (entry == NULL) {
@@ -794,13 +797,13 @@ int odp_pktio_promisc_mode(odp_pktio_t id)
return -1;
}
 
-   ret = entry->s.ops->promisc_mode_get(entry);
+   if (entry->s.ops->promisc_mode_get)
+   ret = entry->s.ops->promisc_mode_get(entry);
unlock_entry(entry);
 
return ret;
 }
 
-
 int odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, int addr_size)
 {
pktio_entry_t *entry;
@@ -825,7 +828,12 @@ int odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr, int 
addr_size)
return -1;
}
 
-   ret = entry->s.ops->mac_get(entry, mac_addr);
+   if (entry->s.ops->mac_get) {
+   ret = entry->s.ops->mac_get(entry, mac_addr);
+   } else {
+   ODP_DBG("pktio does not support mac addr get\n");
+   ret = -1;
+   }
unlock_entry(entry);
 
return ret;
-- 
1.9.1

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


[lng-odp] [PATCHv17 09/10] linux-generic: add ipc pktio support

2015-12-10 Thread Maxim Uvarov
Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/Makefile.am |   3 +
 .../linux-generic/include/odp_buffer_internal.h|   3 +
 .../linux-generic/include/odp_packet_io_internal.h |  38 ++
 .../include/odp_packet_io_ipc_internal.h   |  47 ++
 platform/linux-generic/include/odp_shm_internal.h  |  21 +
 platform/linux-generic/odp_packet_io.c |   1 +
 platform/linux-generic/odp_pool.c  |  14 +-
 platform/linux-generic/odp_shared_memory.c |  14 +-
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/ipc.c | 729 +
 10 files changed, 866 insertions(+), 5 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_packet_io_ipc_internal.h
 create mode 100644 platform/linux-generic/include/odp_shm_internal.h
 create mode 100644 platform/linux-generic/pktio/ipc.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 1ed2ed7..c631a2b 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -90,6 +90,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_internal.h \
  ${srcdir}/include/odp_packet_internal.h \
  ${srcdir}/include/odp_packet_io_internal.h \
+ ${srcdir}/include/odp_packet_io_ipc_internal.h \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_io_ring_internal.h \
  ${srcdir}/include/odp_packet_netmap.h \
@@ -97,6 +98,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_schedule_internal.h \
+ ${srcdir}/include/odp_shm_internal.h \
  ${srcdir}/include/odp_spin_internal.h \
  ${srcdir}/include/odp_timer_internal.h \
  ${srcdir}/include/odp_cpu_internal.h \
@@ -118,6 +120,7 @@ __LIB__libodp_la_SOURCES = \
   odp_packet_flags.c \
   odp_packet_io.c \
   pktio/io_ops.c \
+  pktio/ipc.c \
   pktio/loop.c \
   pktio/netmap.c \
   pktio/socket.c \
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 74a0b5c..2ea594d 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -133,6 +133,9 @@ struct odp_buffer_hdr_t {
uint32_t uarea_size; /* size of user area */
uint32_t segcount;   /* segment count */
uint32_t segsize;/* segment size */
+   /* ipc mapped process can not walk over pointers,
+* offset has to be used */
+   uint64_t ipc_addr_offset[ODP_BUFFER_MAX_SEG];
void*addr[ODP_BUFFER_MAX_SEG]; /* block addrs */
uint64_t order;  /* sequence for ordered queues */
queue_entry_t   *origin_qe;  /* ordered queue origin */
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index 1a1118c..5d20c4a 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -25,6 +25,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -61,6 +62,41 @@ typedef struct {
 } pkt_pcap_t;
 #endif
 
+typedefstruct {
+   /* TX */
+   struct  {
+   _ring_t *send; /**< ODP ring for IPC msg packets
+   indexes transmitted to shared
+   memory */
+   _ring_t *free; /**< ODP ring for IPC msg packets
+   indexes already processed by remote
+   process */
+   } tx;
+   /* RX */
+   struct {
+   _ring_t *recv; /**< ODP ring for IPC msg packets
+   indexes received from shared
+memory (from remote process) */
+   _ring_t *free; /**< ODP ring for IPC msg packets
+   indexes already processed by
+   current process */
+   } rx; /* slave */
+   void*pool_base; /**< Remote pool base addr */
+   void*pool_mdata_base;   /**< Remote pool mdata base 
addr */
+   uint64_tpkt_size;   /**< Packet size in remote pool 
*/
+   odp_pool_t  pool;   

[lng-odp] [PATCHv17 10/10] linux-generic: internal ipc_pktio test

2015-12-10 Thread Maxim Uvarov
2 example ipc pktio applications create ipc pktio to each other and do
packet transfer, validation magic numbers and packets sequence counters
inside it.

Signed-off-by: Maxim Uvarov 
---
 platform/linux-generic/m4/configure.m4 |   1 +
 platform/linux-generic/test/Makefile.am|   3 +-
 platform/linux-generic/test/pktio_ipc/.gitignore   |   2 +
 platform/linux-generic/test/pktio_ipc/Makefile.am  |  20 ++
 platform/linux-generic/test/pktio_ipc/ipc_common.c | 138 +
 platform/linux-generic/test/pktio_ipc/ipc_common.h |  87 ++
 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 310 +
 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 187 +
 .../linux-generic/test/pktio_ipc/pktio_ipc_run |  64 +
 9 files changed, 811 insertions(+), 1 deletion(-)
 create mode 100644 platform/linux-generic/test/pktio_ipc/.gitignore
 create mode 100644 platform/linux-generic/test/pktio_ipc/Makefile.am
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/ipc_common.h
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc1.c
 create mode 100644 platform/linux-generic/test/pktio_ipc/pktio_ipc2.c
 create mode 100755 platform/linux-generic/test/pktio_ipc/pktio_ipc_run

diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index 6bb159f..46aaf40 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -24,4 +24,5 @@ m4_include([platform/linux-generic/m4/odp_pcap.m4])
 AC_CONFIG_FILES([platform/linux-generic/Makefile
 platform/linux-generic/test/Makefile
 platform/linux-generic/test/pktio/Makefile
+platform/linux-generic/test/pktio_ipc/Makefile
 platform/linux-generic/test/ring/Makefile])
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index a4d4dcd..802a5db 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -1,10 +1,11 @@
 include $(top_srcdir)/test/Makefile.inc
 TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
 
-ODP_MODULES = pktio ring
+ODP_MODULES = pktio pktio_ipc ring
 
 if test_vald
 TESTS = pktio/pktio_run \
+   pktio_ipc/pktio_ipc_run \
ring/ringtest$(EXEEXT) \
${top_builddir}/test/validation/buffer/buffer_main$(EXEEXT) \

${top_builddir}/test/validation/classification/classification_main$(EXEEXT) \
diff --git a/platform/linux-generic/test/pktio_ipc/.gitignore 
b/platform/linux-generic/test/pktio_ipc/.gitignore
new file mode 100644
index 000..49ee4fd
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/.gitignore
@@ -0,0 +1,2 @@
+pktio_ipc1
+pktio_ipc2
diff --git a/platform/linux-generic/test/pktio_ipc/Makefile.am 
b/platform/linux-generic/test/pktio_ipc/Makefile.am
new file mode 100644
index 000..bc224ae
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/Makefile.am
@@ -0,0 +1,20 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+
+test_PROGRAMS = pktio_ipc1\
+   pktio_ipc2
+
+pktio_ipc1_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+pktio_ipc1_LDFLAGS = $(AM_LDFLAGS) -static
+pktio_ipc2_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+pktio_ipc2_LDFLAGS = $(AM_LDFLAGS) -static
+
+noinst_HEADERS = $(top_srcdir)/test/test_debug.h
+
+dist_pktio_ipc1_SOURCES = pktio_ipc1.c ipc_common.c
+dist_pktio_ipc2_SOURCES = pktio_ipc2.c ipc_common.c
+
+EXTRA_DIST = ipc_common.h
+
+dist_check_SCRIPTS = pktio_ipc_run
+test_SCRIPTS = $(dist_check_SCRIPTS)
diff --git a/platform/linux-generic/test/pktio_ipc/ipc_common.c 
b/platform/linux-generic/test/pktio_ipc/ipc_common.c
new file mode 100644
index 000..33775b0
--- /dev/null
+++ b/platform/linux-generic/test/pktio_ipc/ipc_common.c
@@ -0,0 +1,138 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "ipc_common.h"
+
+/** Run time in seconds */
+int run_time_sec;
+
+int ipc_odp_packet_sendall(odp_pktio_t pktio,
+  odp_packet_t pkt_tbl[], int num)
+{
+   int ret;
+   int sent = 0;
+   uint64_t start_cycle;
+   uint64_t diff;
+   uint64_t wait;
+
+   wait = odp_time_local_from_ns(1 * ODP_TIME_SEC_IN_NS);
+   start_cycle = odp_time_local();
+
+   while (sent != num) {
+   ret = odp_pktio_send(pktio, _tbl[sent], num - sent);
+   if (ret < 0)
+   return -1;
+
+   sent += ret;
+
+   diff = odp_time_diff(odp_time_local(), start_cycle);
+   if (odp_time_cmp(wait, diff) < 0)
+   return -1;
+   }
+
+   return 0;
+}
+
+odp_pktio_t create_pktio(odp_pool_t pool)
+{
+   odp_pktio_param_t pktio_param;
+  

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

2015-12-10 Thread Mike Holmes
Is anyone following the OFP project, they are also discussing this struct
from a user of ODPs perspctive on a couple of threads like
http://www.openfastpath.org/pipermail/openfastpath/2015-December/48.html

On 10 December 2015 at 08:07, Bill Fischofer 
wrote:

>
>
> On Thu, Dec 10, 2015 at 2:05 AM, Ivan Khoronzhuk <
> ivan.khoronz...@linaro.org> wrote:
>
>>
>>
>> On 10.12.15 08:42, Maxim Uvarov wrote:
>>
>>> Going to apply this patch to unblock builds in new distros. Any
>>> objections?
>>>
>>> Maxim.
>>>
>>
>> I worry about change of timespec struct can break linux-generic time API.
>> I believe it will not happen, but that's why I like Maxim`s approach a
>> little more.
>> [lng-odp] [API-NEXT PATCH 2/2] linux-generic: time: use same type as
>> returned
>
>
>
> In the (unlikely) event that the struct changes and that change would be
> made in a non-backward compatible manner, then inn that case ODP would
> simply update the implementation to  match the new internal API while
> maintaining the
> external definition.  This might involve changing the union to do
> intermediate copies, however for now the union is more efficient, which is
> why that's the technique used here.
>
>
>>
>>
>>> On 12/09/2015 19:25, Ola Liljedahl wrote:
>>>
 On 9 December 2015 at 16:53, Bill Fischofer > wrote:

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

 Yes this is the way it should be done. This is also another step in the
 ODP API becoming binary portable and run-time independent of the actual
 implementation.


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

 diff --git a/platform/linux-generic/include/odp/plat/time_types.h
 b/platform/linux-generic/include/odp/plat/time_types.h
 index e5765ec..05e2b59 100644
 --- a/platform/linux-generic/include/odp/plat/time_types.h
 +++ b/platform/linux-generic/include/odp/plat/time_types.h
 @@ -21,7 +21,10 @@ extern "C" {
   *  @{
   **/

 -typedef struct timespec odp_time_t;
 +typedef struct {
 +   uint64_t tv_sec;
 +   int64_t  tv_nsec;
 +} odp_time_t;

  odp_time_t odp_time_null(void);

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

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

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

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

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

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

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

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

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

Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Bala Manoharan
odp_classifier runs on api-next branch but if we run on master it
currently crashes during queue_enq function.
I remember the crash was similar to the one we had during queue
reorder implementation.

Regards,
Bala

On 10 December 2015 at 20:38, Stuart Haslam  wrote:
> On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:
>> How to reproduce that it is broken?
>>
>
> I was looking at:
>
> sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run
>
> This shows a few packets going through initially then 0. Turns out this
> is related to the netmap pktio, this works:
>
> sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic 
> ./test/performance/odp_l2fwd_run
>
> Not sure if this is the same failure Bala was seeing.
>
> --
> Stuart.



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


[lng-odp] [PATCHv5 1/4] validation: pktio: initialize mac addresses for all packets

2015-12-10 Thread Ilya Maximets
For the purpose of testing of real-world interfaces the packet's
content should be valid or kernel will throw them away.

Signed-off-by: Ilya Maximets 
---
 test/validation/pktio/pktio.c | 46 ---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 52e5414..53633dd 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -86,16 +86,16 @@ static void set_pool_len(odp_pool_param_t *params)
 }
 
 static void pktio_pkt_set_macs(odp_packet_t pkt,
-  pktio_info_t *src, pktio_info_t *dst)
+  odp_pktio_t src, odp_pktio_t dst)
 {
uint32_t len;
odph_ethhdr_t *eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, );
int ret;
 
-   ret = odp_pktio_mac_addr(src->id, >src, sizeof(eth->src));
+   ret = odp_pktio_mac_addr(src, >src, sizeof(eth->src));
CU_ASSERT(ret == ODPH_ETHADDR_LEN);
 
-   ret = odp_pktio_mac_addr(dst->id, >dst, sizeof(eth->dst));
+   ret = odp_pktio_mac_addr(dst, >dst, sizeof(eth->dst));
CU_ASSERT(ret == ODPH_ETHADDR_LEN);
 }
 
@@ -412,12 +412,16 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, 
pktio_info_t *pktio_b,
break;
 
tx_seq[i] = pktio_init_packet(tx_pkt[i]);
-   if (tx_seq[i] == TEST_SEQ_INVALID)
+   if (tx_seq[i] == TEST_SEQ_INVALID) {
+   odp_packet_free(tx_pkt[i]);
break;
+   }
 
-   pktio_pkt_set_macs(tx_pkt[i], pktio_a, pktio_b);
-   if (pktio_fixup_checksums(tx_pkt[i]) != 0)
+   pktio_pkt_set_macs(tx_pkt[i], pktio_a->id, pktio_b->id);
+   if (pktio_fixup_checksums(tx_pkt[i]) != 0) {
+   odp_packet_free(tx_pkt[i]);
break;
+   }
 
tx_ev[i] = odp_packet_to_event(tx_pkt[i]);
}
@@ -740,6 +744,13 @@ static void pktio_test_start_stop(void)
if (pkt == ODP_PACKET_INVALID)
break;
pktio_init_packet(pkt);
+
+   pktio_pkt_set_macs(pkt, pktio[0], pktio[1]);
+   if (pktio_fixup_checksums(pkt) != 0) {
+   odp_packet_free(pkt);
+   break;
+   }
+
tx_ev[alloc] = odp_packet_to_event(pkt);
}
 
@@ -787,6 +798,13 @@ static void pktio_test_start_stop(void)
if (pkt == ODP_PACKET_INVALID)
break;
pktio_init_packet(pkt);
+   if (num_ifaces > 1) {
+   pktio_pkt_set_macs(pkt, pktio[0], pktio[1]);
+   if (pktio_fixup_checksums(pkt) != 0) {
+   odp_packet_free(pkt);
+   break;
+   }
+   }
tx_ev[alloc] = odp_packet_to_event(pkt);
}
 
@@ -911,8 +929,17 @@ static void pktio_test_send_failure(void)
break;
 
pkt_seq[i] = pktio_init_packet(pkt_tbl[i]);
-   if (pkt_seq[i] == TEST_SEQ_INVALID)
+
+   pktio_pkt_set_macs(pkt_tbl[i], pktio_tx, pktio_rx);
+   if (pktio_fixup_checksums(pkt_tbl[i]) != 0) {
+   odp_packet_free(pkt_tbl[i]);
+   break;
+   }
+
+   if (pkt_seq[i] == TEST_SEQ_INVALID) {
+   odp_packet_free(pkt_tbl[i]);
break;
+   }
}
alloc_pkts = i;
 
@@ -956,6 +983,11 @@ static void pktio_test_send_failure(void)
 odp_packet_len(pkt_tbl[i]) -
 PKT_LEN_NORMAL);
pkt_seq[i] = pktio_init_packet(pkt_tbl[i]);
+
+   pktio_pkt_set_macs(pkt_tbl[i], pktio_tx, pktio_rx);
+   ret = pktio_fixup_checksums(pkt_tbl[i]);
+   CU_ASSERT_FATAL(ret == 0);
+
CU_ASSERT_FATAL(pkt_seq[i] != TEST_SEQ_INVALID);
ret = odp_pktio_send(pktio_tx, _tbl[i], TX_BATCH_LEN - i);
CU_ASSERT_FATAL(ret == (TX_BATCH_LEN - i));
-- 
2.1.4

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


[lng-odp] [PATCHv5 3/4] linux-generic: pktio: add tap pktio type

2015-12-10 Thread Ilya Maximets
Creates a new pktio type that allows for creating and
sending/receiving packets through TAP interface.
It is intended for use as a simple conventional communication
method between applications that use kernel network stack
(ping, ssh, iperf, etc.) and ODP applications for the purpose
of functional testing and can be used as it is with some
of the existing example applications.

To use this interface the name passed to odp_pktio_open() must
begin with "tap:" and be in the format:

 tap:iface

   iface   the name of TAP device to be created.

TUN/TAP kernel module should be loaded to use this pktio.
There should be no device named 'iface' in the system.
The total length of the 'iface' is limited by IF_NAMESIZE.

Signed-off-by: Ilya Maximets 
---
 platform/linux-generic/Makefile.am |   2 +
 .../linux-generic/include/odp_packet_io_internal.h |   3 +
 platform/linux-generic/include/odp_packet_tap.h|  21 ++
 platform/linux-generic/pktio/io_ops.c  |   1 +
 platform/linux-generic/pktio/tap.c | 327 +
 5 files changed, 354 insertions(+)
 create mode 100644 platform/linux-generic/include/odp_packet_tap.h
 create mode 100644 platform/linux-generic/pktio/tap.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 70bd8fe..4639ebc 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -92,6 +92,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_packet_io_queue.h \
  ${srcdir}/include/odp_packet_netmap.h \
  ${srcdir}/include/odp_packet_socket.h \
+ ${srcdir}/include/odp_packet_tap.h \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_queue_internal.h \
  ${srcdir}/include/odp_schedule_internal.h \
@@ -120,6 +121,7 @@ __LIB__libodp_la_SOURCES = \
   pktio/netmap.c \
   pktio/socket.c \
   pktio/socket_mmap.c \
+  pktio/tap.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..de29557 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -22,6 +22,7 @@ extern "C" {
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,6 +79,7 @@ struct pktio_entry {
 #ifdef HAVE_PCAP
pkt_pcap_t pkt_pcap;/**< Using pcap for IO */
 #endif
+   pkt_tap_t pkt_tap;  /**< using TAP for IO */
};
enum {
STATE_START = 0,
@@ -157,6 +159,7 @@ extern const pktio_if_ops_t loopback_pktio_ops;
 #ifdef HAVE_PCAP
 extern const pktio_if_ops_t pcap_pktio_ops;
 #endif
+extern const pktio_if_ops_t tap_pktio_ops;
 extern const pktio_if_ops_t * const pktio_if_ops[];
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp_packet_tap.h 
b/platform/linux-generic/include/odp_packet_tap.h
new file mode 100644
index 000..7877586
--- /dev/null
+++ b/platform/linux-generic/include/odp_packet_tap.h
@@ -0,0 +1,21 @@
+/* Copyright (c) 2015, Ilya Maximets 
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PACKET_TAP_H_
+#define ODP_PACKET_TAP_H_
+
+#include 
+
+typedef struct {
+   int fd; /**< file descriptor for tap interface*/
+   int skfd;   /**< socket descriptor */
+   uint32_t mtu;   /**< cached mtu */
+   unsigned char if_mac[ETH_ALEN]; /**< MAC address of pktio side (not a
+MAC address of kernel interface)*/
+   odp_pool_t pool;/**< pool to alloc packets from */
+} pkt_tap_t;
+
+#endif
diff --git a/platform/linux-generic/pktio/io_ops.c 
b/platform/linux-generic/pktio/io_ops.c
index 3b344e6..1933abc 100644
--- a/platform/linux-generic/pktio/io_ops.c
+++ b/platform/linux-generic/pktio/io_ops.c
@@ -18,6 +18,7 @@ const pktio_if_ops_t * const pktio_if_ops[]  = {
 #ifdef HAVE_PCAP
_pktio_ops,
 #endif
+   _pktio_ops,
_mmap_pktio_ops,
_mmsg_pktio_ops,
NULL
diff --git a/platform/linux-generic/pktio/tap.c 
b/platform/linux-generic/pktio/tap.c
new file mode 100644
index 000..7ecb300
--- /dev/null
+++ b/platform/linux-generic/pktio/tap.c
@@ -0,0 +1,327 @@
+/* Copyright (c) 2015, Ilya Maximets 
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * TAP pktio type
+ *
+ * This file provides a pktio interface that allows for creating and
+ * send/receive 

[lng-odp] [PATCHv5 0/4] TAP pktio

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

Changelog:

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

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

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

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

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

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

-- 
2.1.4

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


Re: [lng-odp] ODP_CLASSIFIER and ODP_GENERATOR failing in master branch

2015-12-10 Thread Stuart Haslam
On Thu, Dec 10, 2015 at 06:01:05PM +0300, Maxim Uvarov wrote:
> How to reproduce that it is broken?
> 

I was looking at:

sudo ODP_PLATFORM=linux-generic ./test/performance/odp_l2fwd_run

This shows a few packets going through initially then 0. Turns out this
is related to the netmap pktio, this works:

sudo ODP_PKTIO_DISABLE_NETMAP=y ODP_PLATFORM=linux-generic 
./test/performance/odp_l2fwd_run

Not sure if this is the same failure Bala was seeing.

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


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

2015-12-10 Thread Bill Fischofer
Thanks.  I'll pop over to that thread to take a look.  However odp_time_t
should be opaque from a user perspective--that's the purpose of having
abstract types in the first place.

On Thu, Dec 10, 2015 at 9:00 AM, Mike Holmes  wrote:

> Is anyone following the OFP project, they are also discussing this struct
> from a user of ODPs perspctive on a couple of threads like
> http://www.openfastpath.org/pipermail/openfastpath/2015-December/48.html
>
> On 10 December 2015 at 08:07, Bill Fischofer 
> wrote:
>
>>
>>
>> On Thu, Dec 10, 2015 at 2:05 AM, Ivan Khoronzhuk <
>> ivan.khoronz...@linaro.org> wrote:
>>
>>>
>>>
>>> On 10.12.15 08:42, Maxim Uvarov wrote:
>>>
 Going to apply this patch to unblock builds in new distros. Any
 objections?

 Maxim.

>>>
>>> I worry about change of timespec struct can break linux-generic time API.
>>> I believe it will not happen, but that's why I like Maxim`s approach a
>>> little more.
>>> [lng-odp] [API-NEXT PATCH 2/2] linux-generic: time: use same type as
>>> returned
>>
>>
>>
>> In the (unlikely) event that the struct changes and that change would be
>> made in a non-backward compatible manner, then inn that case ODP would
>> simply update the implementation to  match the new internal API while
>> maintaining the
>> external definition.  This might involve changing the union to do
>> intermediate copies, however for now the union is more efficient, which is
>> why that's the technique used here.
>>
>>
>>>
>>>
 On 12/09/2015 19:25, Ola Liljedahl wrote:

> On 9 December 2015 at 16:53, Bill Fischofer  > wrote:
>
> The linux-generic implementation of odp_time_t makes use of POSIX
> APIs that are sensitive to the _POSIX_C_SOURCE level. Use an
> indirection
> mechanism so that these dependencies do not "bleed through" the
> ODP API.
> This means that ODP applications can be independent of
> _POSIX_C_SOURCE
> level.
>
> Yes this is the way it should be done. This is also another step in
> the ODP API becoming binary portable and run-time independent of the 
> actual
> implementation.
>
>
> Signed-off-by: Bill Fischofer  >
> ---
>  .../linux-generic/include/odp/plat/time_types.h|  5 +++-
>  platform/linux-generic/odp_time.c  | 27
> +-
>  2 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp/plat/time_types.h
> b/platform/linux-generic/include/odp/plat/time_types.h
> index e5765ec..05e2b59 100644
> --- a/platform/linux-generic/include/odp/plat/time_types.h
> +++ b/platform/linux-generic/include/odp/plat/time_types.h
> @@ -21,7 +21,10 @@ extern "C" {
>   *  @{
>   **/
>
> -typedef struct timespec odp_time_t;
> +typedef struct {
> +   uint64_t tv_sec;
> +   int64_t  tv_nsec;
> +} odp_time_t;
>
>  odp_time_t odp_time_null(void);
>
> diff --git a/platform/linux-generic/odp_time.c
> b/platform/linux-generic/odp_time.c
> index 1c7c214..b5737f6 100644
> --- a/platform/linux-generic/odp_time.c
> +++ b/platform/linux-generic/odp_time.c
> @@ -11,7 +11,12 @@
>  #include 
>  #include 
>
> -static struct timespec start_time;
> +typedef union {
> +   odp_time_t  ex;
> +   struct timespec in;
> +} _odp_time_t;
> +
> +static odp_time_t start_time;
>
>  static inline
>  uint64_t time_to_ns(odp_time_t time)
> @@ -27,7 +32,7 @@ uint64_t time_to_ns(odp_time_t time)
>  static inline
>  odp_time_t time_diff(odp_time_t t2, odp_time_t t1)
>  {
> -   struct timespec time;
> +   odp_time_t time;
>
> time.tv_sec = t2.tv_sec - t1.tv_sec;
> time.tv_nsec = t2.tv_nsec - t1.tv_nsec;
> @@ -43,13 +48,13 @@ odp_time_t time_diff(odp_time_t t2, odp_time_t
> t1)
>  odp_time_t odp_time_local(void)
>  {
> int ret;
> -   struct timespec time;
> +   _odp_time_t time;
>
> -   ret = clock_gettime(CLOCK_MONOTONIC_RAW, );
> +   ret = clock_gettime(CLOCK_MONOTONIC_RAW, 
> );
> if (odp_unlikely(ret != 0))
> ODP_ABORT("clock_gettime failed\n");
>
> -   return time_diff(time, start_time);
> +   return time_diff(time.ex, start_time);
>  }
>
>  odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1)
> @@ 

[lng-odp] [PATCHv5 2/4] validation: pktio: ability to wait for external network

2015-12-10 Thread Ilya Maximets
'ODP_WAIT_FOR_NETWORK' environment variable may be used
to wait some time right after pktio_open().

Signed-off-by: Ilya Maximets 
---

'ODP_WAIT_FOR_NETWORK' also may be used to remove sleep(1)
from netmap pktio in the future, beacause IMO waiting
for external network is a work for application and not
for pktio itself.

 test/validation/pktio/pktio.c | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 53633dd..28bfd30 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -29,6 +29,11 @@ static const char *iface_name[MAX_NUM_IFACES];
 /** number of interfaces being used (1=loopback, 2=pair) */
 static int num_ifaces;
 
+/** while testing real-world interfaces additional time may be
+needed for external network to enable link to pktio
+interface that just become up.*/
+static bool wait_for_network;
+
 /** local container for pktio attributes */
 typedef struct {
const char *name;
@@ -252,6 +257,17 @@ static int default_pool_create(void)
return 0;
 }
 
+static void spin_wait(uint64_t ns)
+{
+   odp_time_t start, now, diff;
+
+   start = odp_time_local();
+   do {
+   now = odp_time_local();
+   diff = odp_time_diff(now, start);
+   } while (odp_time_to_ns(diff) < ns);
+}
+
 static odp_pktio_t create_pktio(int iface_idx, odp_pktio_input_mode_t imode,
odp_pktio_output_mode_t omode)
 {
@@ -271,6 +287,9 @@ static odp_pktio_t create_pktio(int iface_idx, 
odp_pktio_input_mode_t imode,
CU_ASSERT(odp_pktio_to_u64(pktio) !=
  odp_pktio_to_u64(ODP_PKTIO_INVALID));
 
+   if (wait_for_network)
+   spin_wait(ODP_TIME_SEC_IN_NS / 4);
+
return pktio;
 }
 
@@ -1105,11 +1124,16 @@ static int create_pool(const char *iface, int num)
 
 static int pktio_suite_init(void)
 {
+   int i;
+
odp_atomic_init_u32(_seq, 0);
+
+   if (getenv("ODP_WAIT_FOR_NETWORK"))
+   wait_for_network = true;
+
iface_name[0] = getenv("ODP_PKTIO_IF0");
iface_name[1] = getenv("ODP_PKTIO_IF1");
num_ifaces = 1;
-   int i;
 
if (!iface_name[0]) {
printf("No interfaces specified, using default \"loop\".\n");
-- 
2.1.4

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


[lng-odp] [Bug 1940] linux-generic: timer: race for odp_timer_pool

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

Mike Holmes  changed:

   What|Removed |Added

   Assignee|ola.liljed...@linaro.org|ivan.khoronz...@linaro.org
 CC||mike.hol...@linaro.org

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


[lng-odp] [Bug 1941] [odp_classifier] ODP_PMR_SIP_ADDR never matches

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

Mike Holmes  changed:

   What|Removed |Added

 CC||mike.hol...@linaro.org
   Assignee|lng-odp@lists.linaro.org|bala.manoha...@linaro.org

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


[lng-odp] [Bug 1873] odp process-mode is broken

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

Mike Holmes  changed:

   What|Removed |Added

   Assignee|lng-odp@lists.linaro.org|maxim.uva...@linaro.org

--- Comment #8 from Mike Holmes  ---
IPC patch is at v17 Maxim indicated it will contribute to the fix

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