Re: [lng-odp] [PATCH] travis: linux-gen: add dpdk pktio

2016-11-18 Thread Maxim Uvarov

On 11/18/16 22:29, Anders Roxell wrote:

On 18 November 2016 at 14:05, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

On 11/18/16 12:06, Anders Roxell wrote:

On 7 November 2016 at 16:49, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

Turn on linux-generic dpdk and pcap pktios with their validation
tests.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
   .travis.yml | 22 ++
   1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 0d1add3..1092cd0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,7 @@ sudo: required
   before_install:
   - sudo apt-get -qq update
   - sudo apt-get install automake autoconf libtool libssl-dev
graphviz mscgen doxygen
+- sudo apt-get install libpcap-dev linux-headers-`uname -r`
   - gem install asciidoctor

   #   Install cunit for the validation tests because distro version
is too old and fails C99 compile
@@ -24,12 +25,25 @@ before_install:
   - sudo make install
   - cd ..
   - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
-
-install:
-- ./bootstrap
+#  DPDK pktio
+- TARGET=${TARGET:-"x86_64-native-linuxapp-gcc"}
+- git clone http://dpdk.org/git/dpdk dpdk
+- pushd dpdk
+- git checkout -b bv16.07 v16.07
+- make config T=${TARGET} O=${TARGET}
+- pushd ${TARGET}
+- sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
+- popd
+- make install T=${TARGET} EXTRA_CFLAGS="-fPIC"
+- popd

why do we build DPDK from source and not just consume the deb package
with apt-get install?

Cheers,
Anders


my ubuntu does not have dpdk deb package in apt repository. Especially
v16.07 with PMD_PCAP and -fPIC.


Why did you push this patch while we still discuss the patch?

deb.opendataplane.org/... should have what you need.


Sorry, I interpret your question as question, not as objection. Then I 
discussed that with Mike

and we agreed that it's better to take what is in README.

Testing deb packages will require some time. As well as README update, 
and update documentation

how to build such debs from source.


Current script follows steps from README.

OK, so maybe we should update the README.


I'm not really know what is better. For me dpdk source code is better so 
I can jump into it with ctags.
Let's discuss on Arch call if we should like .travis tests to debs or to 
source code.



But I don't object if you want
speed up tests with pre built dpdk package.

I guess someone want to do that.

Cheers,
Anders


Maxim.



   script:
-- ./configure --enable-test-cpp --enable-test-vald
--enable-test-helper --enable-test-perf --enable-user-guides
--enable-test-perf-proc --enable-test-example
+
+- ./bootstrap
+- ./configure --enable-test-cpp --enable-test-vald
--enable-test-helper --enable-test-perf --enable-user-guides
--enable-test-perf-proc --enable-test-example
--with-dpdk-path=`pwd`/dpdk/${TARGET}
   - make check
+- git clean -f -d -x && rm -rf dpdk
+- ./bootstrap
+- ./configure
   - make doxygen-doc
   - make distcheck
--
2.7.1.250.gff4ea60





[lng-odp] [PATCH] test: tm: do lookup first then open

2016-11-18 Thread Maxim Uvarov
First tests will open pktio and all others will look up
handle by name. Change order of open/lookup to not call
fail opens.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 .../validation/api/traffic_mngr/traffic_mngr.c| 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c 
b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
index c7bde40..2829662 100644
--- a/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
+++ b/test/common_plat/validation/api/traffic_mngr/traffic_mngr.c
@@ -497,14 +497,15 @@ static int open_pktios(void)
}
 
pools[iface] = pkt_pool;
-   pktio = odp_pktio_open(iface_name[iface], pkt_pool,
-  _param);
+
+   pktio = odp_pktio_lookup(iface_name[iface]);
if (pktio == ODP_PKTIO_INVALID)
-   pktio = odp_pktio_lookup(iface_name[iface]);
-   if (pktio == ODP_PKTIO_INVALID) {
-   LOG_ERR("odp_pktio_open() failed\n");
-   return -1;
-   }
+   pktio = odp_pktio_open(iface_name[iface], pkt_pool,
+  _param);
+   if (pktio == ODP_PKTIO_INVALID) {
+   LOG_ERR("odp_pktio_open() failed\n");
+   return -1;
+   }
 
/* Set defaults for PktIn and PktOut queues */
(void)odp_pktin_queue_config(pktio, NULL);
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH v2] travis.yml: add coverity support

2016-11-18 Thread Maxim Uvarov

On 11/18/16 21:34, Mike Holmes wrote:

Enables static analysis when pushing to a branch coverity_scan on github
See https://scan.coverity.com/travis_ci

Signed-off-by: Mike Holmes 
---
v2:
   Include all the executables in the scan (Maxim)

  .travis.yml | 20 +++-
  1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 0d1add3..afcc353 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,17 @@
  # Copyright (c) 2016, Linaro Limited
  # All rights reserved.
  # SPDX-License-Identifier: BSD-3-Clause
+#
+# Please update  for your coverity token and notification email if required
+# pushing to github/master will run make check
+# pushing to github/coverity_scan will also launch a static analysis
+# See https://scan.coverity.com/travis_ci
  
-

+env:
+  global:
+# COVERITY_SCAN_TOKEN
+# ** specific to your project **
+- secure: ""
  
  language: c

  compiler: clang
@@ -33,3 +42,12 @@ script:
  - make check
  - make doxygen-doc
  - make distcheck
+
+addons:
+coverity_scan:
+project:
+name: "$TRAVIS_REPO_SLUG"
+notification_email: 
+build_command_prepend: "./bootstrap && ./configure --enable-test-cpp 
--enable-test-vald --enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example"


user-guides might be not needed here

Maxim.


+build_command:   "make"
+branch_pattern: coverity_scan




Re: [lng-odp] [PATCH] travis: linux-gen: add dpdk pktio

2016-11-18 Thread Maxim Uvarov

Merged.

On 11/17/16 22:56, Mike Holmes wrote:

On 7 November 2016 at 10:49, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

Turn on linux-generic dpdk and pcap pktios with their validation
tests.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>

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

We need to make this complete and add netmap pktio to cover all the
possibilities
We could also do with a matrix to cover the different schedulers possibly.


yes, or separate test for that.

Maxim.




---
  .travis.yml | 22 ++
  1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 0d1add3..1092cd0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,7 @@ sudo: required
  before_install:
  - sudo apt-get -qq update
  - sudo apt-get install automake autoconf libtool libssl-dev graphviz 
mscgen doxygen
+- sudo apt-get install libpcap-dev linux-headers-`uname -r`
  - gem install asciidoctor

  #   Install cunit for the validation tests because distro version is too 
old and fails C99 compile
@@ -24,12 +25,25 @@ before_install:
  - sudo make install
  - cd ..
  - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
-
-install:
-- ./bootstrap
+#  DPDK pktio
+- TARGET=${TARGET:-"x86_64-native-linuxapp-gcc"}
+- git clone http://dpdk.org/git/dpdk dpdk
+- pushd dpdk
+- git checkout -b bv16.07 v16.07
+- make config T=${TARGET} O=${TARGET}
+- pushd ${TARGET}
+- sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
+- popd
+- make install T=${TARGET} EXTRA_CFLAGS="-fPIC"
+- popd

  script:
-- ./configure --enable-test-cpp --enable-test-vald 
--enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example
+
+- ./bootstrap
+- ./configure --enable-test-cpp --enable-test-vald 
--enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example 
--with-dpdk-path=`pwd`/dpdk/${TARGET}
  - make check
+- git clean -f -d -x && rm -rf dpdk
+- ./bootstrap
+- ./configure
  - make doxygen-doc
  - make distcheck
--
2.7.1.250.gff4ea60








Re: [lng-odp] [PATCH] test: linux-gen: mmap_vlan_ins change bin to test programs

2016-11-18 Thread Maxim Uvarov

Merged,
Maxim.

On 11/18/16 19:49, Mike Holmes wrote:

On 17 November 2016 at 10:44, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

Generated binaries should be marked as test programs to be
installed by autotools in test directory.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>

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


---
  test/linux-generic/mmap_vlan_ins/Makefile.am | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am 
b/test/linux-generic/mmap_vlan_ins/Makefile.am
index 2641556..5cac159 100644
--- a/test/linux-generic/mmap_vlan_ins/Makefile.am
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -7,7 +7,7 @@ dist_check_SCRIPTS = vlan.pcap \

  test_SCRIPTS = $(dist_check_SCRIPTS)

-bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
+test_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
  plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
  plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example

--
2.7.1.250.gff4ea60








Re: [lng-odp] [PATCH] changelog: summary of changes for odp v1.10.2.0

2016-11-18 Thread Maxim Uvarov


I think Monarch branch with his changelog changes has to be merged in 
master.

Then this changes will update version to v1.11.0.0

And after that current changelog updates version to v1.11.1.0

Please see structure here:
https://git.linaro.org/people/maxim.uvarov/odp.git/log/
(gitk or git log --oneline --graph can show merge history better).

If no objections I will do that merge. And I think I can change 
numbering in you patch in place, without resending it.


Maxim.


On 11/17/16 17:50, Bill Fischofer wrote:

Signed-off-by: Bill Fischofer 
---
  CHANGELOG | 211 ++
  1 file changed, 211 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index d8230cd..3ab7354 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,214 @@
+== OpenDataPlane (1.10.2.0)
+
+=== New Features
+
+ APIs
+ODP v1.10.2.0 is a minor API revision level and introduces a small change to
+the Traffic Manager API as well as some documentation clarification surrounding
+other APIs.
+
+ Traffic Manager Egress Function
+The `odp_tm_egress_t` struct has been changed to add an explicit Boolean
+(`egress_fcn_supported`) that indicates whether the TM system supports
+a user-provided egress function. When specified this function is called to
+"output" a packet rather than having TM transmit it directly to a PktIO
+interface.
+
+ Traffic Manager Coupling Change
+The `odp_tm_egress_t` struct has been changed to associate a TM system with an
+output `odp_pktio_t` rather than the previous `odp_pktout_queue_t`. This makes
+an explicit 1-to-1 map between a TM system and a PktIO interface.
+
+ Default huge page size clarification
+The documentation for the `odp_sys_huge_page_size()` API has been reworded to
+clarify that this API refers to default huge page size.
+
+ Strict Priority (SP) Scheduler
+Building on the modular scheduler framework added in v1.10.1.0, an alternate
+Strict Priority (SP) Scheduler is now available for latency-sensitive
+workloads. Applications wishing to use the SP scheduler should specify
+the `./configure` option `--enable-schedule-sp`. This scheduler emphasizes low
+latency processing of high priority events at the expense of throughput. This
+alternate scheduler is considered experimental and should not be used for
+production at this time.
+
+ Application Binary Interface (ABI) Support
+Support is added to enable ODP applications to be binary compatible across
+different implementations of ODP sharing the same Instruction Set Architecture
+(ISA). This support introduces a new `configure` option:
+
+`--enable-abi-compat=yes`::
+This is the default and specifies that the ODP library is to be built to
+support ABI compatibility mode. In this mode ODP APIs are never inlined. ABI
+compatibility ensures maximum application portability in cloud environments.
+
+`--enable-abi-compat=no`::
+Specify this option to enable the inlining of ODP APIs. This may result in
+improved performance at the cost of ABI compatibility and is suitable for
+applications running in embedded environments.
+
+Note that ODP applications retain source code portability between ODP
+implementations regardless of the ABI mode chosen. To move to a different ODP
+application running on a different ISA, code need simply be recompiled against
+that target ODP implementation.
+
+ SCTP Parsing Support
+The ODP classifier adds support for recognizing Stream Control Transmission
+Protocol (SCTP) packets. The APIs for this were previously not implemented.
+
+=== Packaging and Implementation Refinements
+
+ Remove dependency on Linux headers
+ODP no longer has a dependency on Linux headers. This will help make the
+odp-linux reference implementation more easily portable to non-Linux
+environments.
+
+ Remove dependency on helpers
+The odp-linux implementation has been made independent of the helper library
+to avoid circular dependency issues with packaging. Helper functions may use
+ODP APIs, however ODP implementations should not use helper functions.
+
+ Reorganization of `test` directory
+The `test` directory has been reorganized to better support a unified approach
+to ODP component testing. API tests now live in
+`test/common_plat/validation/api` instead of the former
+`test/validation`. With this change performance and validation tests, as well
+as common and platform-specific tests can all be part of a unified test
+hierarchy.
+
+The resulting test tree now looks like:
+
+.New `test` directory hierarchy
+-
+test
+├── common_plat
+│   ├── common
+│   ├── m4
+│   ├── miscellaneous
+│   ├── performance
+│   └── validation
+│   └── api
+│   ├── atomic
+│   ├── barrier
+│   ├── buffer
+│   ├── classification
+│   ├── cpumask
+│   ├── crypto
+│   ├── errno
+│   ├── hash
+│   ├── init
+│   ├── lock
+│   ├── packet
+│   ├── pktio
+│   

Re: [lng-odp] [PATCH] test: linux-gen: mmap_vlan_ins change bin to test programs

2016-11-18 Thread Maxim Uvarov

ping, please review.

Maxim.

On 11/17/16 18:44, Maxim Uvarov wrote:

Generated binaries should be marked as test programs to be
installed by autotools in test directory.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
  test/linux-generic/mmap_vlan_ins/Makefile.am | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am 
b/test/linux-generic/mmap_vlan_ins/Makefile.am
index 2641556..5cac159 100644
--- a/test/linux-generic/mmap_vlan_ins/Makefile.am
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -7,7 +7,7 @@ dist_check_SCRIPTS = vlan.pcap \
  
  test_SCRIPTS = $(dist_check_SCRIPTS)
  
-bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)

+test_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
  plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
  plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
  




[lng-odp] [PATCH] test: linux-gen: mmap_vlan_ins change bin to test programs

2016-11-17 Thread Maxim Uvarov
Generated binaries should be marked as test programs to be
installed by autotools in test directory.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 test/linux-generic/mmap_vlan_ins/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am 
b/test/linux-generic/mmap_vlan_ins/Makefile.am
index 2641556..5cac159 100644
--- a/test/linux-generic/mmap_vlan_ins/Makefile.am
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -7,7 +7,7 @@ dist_check_SCRIPTS = vlan.pcap \
 
 test_SCRIPTS = $(dist_check_SCRIPTS)
 
-bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
+test_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
 plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
 plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
 
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [API-NEXT PATCH v3 00/19] pool optimization

2016-11-17 Thread Maxim Uvarov
ok, looks like you changed something in the pool and long packets can 
not be allocated:



passed
  Test: pktio_test_pktio_config ...passed
  Test: pktio_test_info ...pktio 0
  name   pktiop0p1
  driver socket
pktio 1
  name   pktiop1p0
  driver socket
passed
  Test: pktio_test_pktin_queue_config_direct ...passed
  Test: pktio_test_pktin_queue_config_sched ...passed
  Test: pktio_test_pktin_queue_config_queue ...passed
  Test: pktio_test_pktout_queue_config ...passed
  Test: pktio_test_plain_queue ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts
2. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_plain_multi ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts
2. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_sched_queue ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts
2. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_sched_multi ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts
2. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_recv ...error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_recv_multi ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:635 - 
num_rx == num_pkts

  Test: pktio_test_recv_queue ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
FAILED
1. 
../../../../../../test/common_plat/validation/api/pktio/pktio.c:864 - 
num_rx == TX_BATCH_LEN

  Test: pktio_test_recv_tmo ...error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: packet length invalid: 9216 (64)
error: header magic invalid 0
error: header magic invalid 393473
error: offset invalid
error: offset invalid
error: header magic invalid 0
error: header magic invalid 0
error: header magic invalid 8650752
error: offset invalid
error: header magic invalid 0
error: header magic invalid 0
error: header magic invalid 8650752
error: offset invalid
error: header magic invalid 0
error: header magic invalid 8650752


On 11/17/16 11:36, Savolainen, Petri (Nokia - FI/Espoo) wrote:

I have reported a bug https://bugs.linaro.org/show_bug.cgi?id=2595 about the 
new VLAN test hang. Could this be the same issue? It hangs for me sometimes, 
most times not. It happens both at the tip of the master and api-next.

-Petri




-Original Message-
From: Maxim Uvarov [mailto:maxim.uva...@linaro.org]
Sent: Wednesday, November 16, 2016 10:03 PM
To: Bill Fischofer <bill.fischo...@linaro.org>; Savolainen, Petri (Nokia -
FI/Espoo) <petri.savolai...@nokia-bell-labs.com>; Mike Holmes
<mike.hol...@linaro.org>
Cc: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [API-NEXT PATCH v3 00/19] pool optimization

I can not test patch by patch this series because it fails (one time it
was TM, one time kernel died, other time OOM killer killed tests then
hang kernel).

And for all patches test/common_plat/validation/api/pktio/pktio_main
hangs forever:


Program received signal SIGINT, Interrupt.
0x2afbe69ffb80 in __nanosleep_nocancel () at
../sysdeps/unix/syscall-template.S:81
81in ../sysdeps/unix/syscall-template.S
(gdb) bt
#0  0x2afbe69ffb80 in __nanosleep_nocancel () at
../sysdeps/unix/syscall-template.S:81
#1  0x00415ced in odp_pktin_recv_tmo (queue=...,
packets=pack

Re: [lng-odp] [API-NEXT PATCH v3 00/19] pool optimization

2016-11-17 Thread Maxim Uvarov

On 11/17/16 11:36, Savolainen, Petri (Nokia - FI/Espoo) wrote:

I have reported a bug https://bugs.linaro.org/show_bug.cgi?id=2595 about the 
new VLAN test hang. Could this be the same issue? It hangs for me sometimes, 
most times not. It happens both at the tip of the master and api-next.

-Petri


Vlan testing hang runs:
test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh

where it can hang only if your #!/bin/sh does not support this syntax 
for KILL command.


# Listen on veth pipe and write to pcap Send pcap
plat_mmap_vlan_ins${EXEEXT} pktiop0p1 pcap:out=${PCAP_OUT} \
00:02:03:04:05:06 00:08:09:0a:0b:0c &
P1=$!
# Send pcap file to veth interface
plat_mmap_vlan_ins${EXEEXT} pcap:in=${PCAP_IN} pktiop0p1 \
01:02:03:04:05:06 01:08:09:0a:0b:0c &
P2=$!

sleep 1
kill -s INT ${P1}
kill -s INT ${P2}


But for me it works well with both /bin/sh and /bin/bash


In your case 'pktio_main' binary rolls in infinite loop. So I would say 
it's different issues.


Maxim.




-Original Message-
From: Maxim Uvarov [mailto:maxim.uva...@linaro.org]
Sent: Wednesday, November 16, 2016 10:03 PM
To: Bill Fischofer <bill.fischo...@linaro.org>; Savolainen, Petri (Nokia -
FI/Espoo) <petri.savolai...@nokia-bell-labs.com>; Mike Holmes
<mike.hol...@linaro.org>
Cc: lng-odp-forward <lng-odp@lists.linaro.org>
Subject: Re: [lng-odp] [API-NEXT PATCH v3 00/19] pool optimization

I can not test patch by patch this series because it fails (one time it
was TM, one time kernel died, other time OOM killer killed tests then
hang kernel).

And for all patches test/common_plat/validation/api/pktio/pktio_main
hangs forever:


Program received signal SIGINT, Interrupt.
0x2afbe69ffb80 in __nanosleep_nocancel () at
../sysdeps/unix/syscall-template.S:81
81in ../sysdeps/unix/syscall-template.S
(gdb) bt
#0  0x2afbe69ffb80 in __nanosleep_nocancel () at
../sysdeps/unix/syscall-template.S:81
#1  0x00415ced in odp_pktin_recv_tmo (queue=...,
packets=packets@entry=0x7ffed64d8bd0, num=num@entry=1,
  wait=wait@entry=18446744073709551615) at
../../../platform/linux-generic/odp_packet_io.c:1584
#2  0x004047fa in recv_packets_tmo (pktio=pktio@entry=0x2,
pkt_tbl=pkt_tbl@entry=0x7ffed64d9500,
  seq_tbl=seq_tbl@entry=0x7ffed64d94b0, num=num@entry=1,
mode=mode@entry=RECV_TMO, tmo=tmo@entry=18446744073709551615,
ns=ns@entry=0)
  at
../../../../../../test/common_plat/validation/api/pktio/pktio.c:515
#3  0x004075f8 in test_recv_tmo (mode=RECV_TMO) at
../../../../../../test/common_plat/validation/api/pktio/pktio.c:940
#4  0x2afbe61cc482 in run_single_test () from
/usr/local/lib/libcunit.so.1
#5  0x2afbe61cc0b2 in run_single_suite () from
/usr/local/lib/libcunit.so.1
#6  0x2afbe61c9d55 in CU_run_all_tests () from
/usr/local/lib/libcunit.so.1
#7  0x2afbe61ce245 in basic_run_all_tests () from
/usr/local/lib/libcunit.so.1
#8  0x2afbe61cdfe7 in CU_basic_run_tests () from
/usr/local/lib/libcunit.so.1
#9  0x00409361 in odp_cunit_run () at
../../../../test/common_plat/common/odp_cunit_common.c:298
#10 0x2afbe6c2ff45 in __libc_start_main (main=0x403850 ,
argc=1, argv=0x7ffed64d9878, init=,
  fini=, rtld_fini=,
stack_end=0x7ffed64d9868) at libc-start.c:287
#11 0x0040387e in _start ()
(gdb) up
#1  0x00415ced in odp_pktin_recv_tmo (queue=...,
packets=packets@entry=0x7ffed64d8bd0, num=num@entry=1,
  wait=wait@entry=18446744073709551615) at
../../../platform/linux-generic/odp_packet_io.c:1584
1584nanosleep(, NULL);
(gdb) p ts
$1 = {tv_sec = 0, tv_nsec = 1000}
(gdb) l
1579}
1580
1581wait--;
1582}
1583
1584nanosleep(, NULL);
1585}
1586}
1587
1588int odp_pktin_recv_mq_tmo(const odp_pktin_queue_t queues[],
unsigned num_q,
(gdb) up
#2  0x004047fa in recv_packets_tmo (pktio=pktio@entry=0x2,
pkt_tbl=pkt_tbl@entry=0x7ffed64d9500,
  seq_tbl=seq_tbl@entry=0x7ffed64d94b0, num=num@entry=1,
mode=mode@entry=RECV_TMO, tmo=tmo@entry=18446744073709551615,
ns=ns@entry=0)
  at
../../../../../../test/common_plat/validation/api/pktio/pktio.c:515
515n = odp_pktin_recv_tmo(pktin[0], pkt_tmp, num - num_rx,
(gdb) p num - num_rx
$2 = 1
(gdb) l
510/** Multiple odp_pktin_recv_tmo()/odp_pktin_recv_mq_tmo()
calls may be
511 *  required to discard possible non-test packets. */
512do {
513ts1 = odp_time_global();
514if (mode == RECV_TMO)
515n = odp_pktin_recv_tmo(pktin[0], pkt_tmp, num - num_rx,
516   tmo);
517else
518n = odp_pktin_recv_mq_tmo(pktin, (unsigned)num_q,
519  from, pkt_tmp,
(gdb) p tmo
$3 = 18446744073709551615


I applied patches and following script under root:
CLEANUP=0 GIT_URL=/opt/Linaro/odp3.git GIT_BRANCH=api-next ./build.sh

Need more investigation into this issue... Not applied yet.

Re: [lng-odp] [API-NEXT PATCH 0/5] name argument definitions in *_create() functions

2016-11-17 Thread Maxim Uvarov

Merged,
Maxim.

On 11/16/16 13:43, Elo, Matias (Nokia - FI/Espoo) wrote:


Ping. This patch set has been reviewed and tested.

Reviewed-and-tested-by: Bill Fischofer >
Reviewed-by: Petri Savolainen >



On 24 Oct 2016, at 13:44, Elo, Matias (Nokia - FI/Espoo) 
> wrote:



Ping. This patch set has been reviewed and tested.

-Matias

On 20 Oct 2016, at 1.08, Bill Fischofer > 
wrote:


For this series:

Reviewed-and-tested-by: Bill Fischofer >


On Fri, Oct 14, 2016 at 3:49 AM, Matias Elo > wrote:
This patch set improves name argument definitions in *_create() 
functions to
clearly state when NULL is a valid value and when the name string 
doesn't have

to be unique.

The related function implementions are fixed to handle NULL name values
correctly. NULL values are also tested in the validation suite.

Note: NULL name values are not yet working (and tested) for 
odp_pool_create()
and odp_timer_pool_create(). Fixing these functions would require 
editing odp
shared memory code which is currently being updated in a separate 
patch set.


Matias Elo (5):
 api: improve name argument definitions in *_create() functions
 linux-gen: schedule: fix creating event group with no name
 linux-gen: queue: fix creating queue with no name
 linux-gen: classification: fix creating cos with no name
 linux-gen: timer: fix creating timer pool with no name

include/odp/api/spec/classification.h  | 10 +
include/odp/api/spec/pool.h| 17 +-
include/odp/api/spec/queue.h   |  9 +---
include/odp/api/spec/schedule.h| 12 +-
include/odp/api/spec/timer.h   |  5 -
platform/linux-generic/odp_classification.c| 11 ++---
platform/linux-generic/odp_queue.c |  8 +--
platform/linux-generic/odp_schedule.c  | 26 
+++---

platform/linux-generic/odp_schedule_sp.c   | 11 +++--
platform/linux-generic/odp_timer.c | 14 
.../api/classification/odp_classification_basic.c  |  4 +---
test/common_plat/validation/api/queue/queue.c  | 10 -
.../validation/api/scheduler/scheduler.c   |  9 +++-
13 files changed, 97 insertions(+), 49 deletions(-)

--
2.7.4









[lng-odp] mail list issues

2016-11-16 Thread Maxim Uvarov

Hello,

we have some mailing list issues. If your did not get response on some 
email please check that

email appeared in archive:

https://lists.linaro.org/pipermail/lng-odp/

If not, please send it again.

I hope it will be fixed very soon.

Maxim.


Re: [lng-odp] [API-NEXT PATCH v3 17/19] api: packet: added limits for packet len on alloc

2016-11-11 Thread Maxim Uvarov

On 11/11/16 13:50, Savolainen, Petri (Nokia - FI/Espoo) wrote:

+   /** Maximum packet length that will be allocated from
+   the pool. The maximum value is defined by pool
+   capability pkt.max_len. Use 0 for default (the
+   pool maximum). */
+   uint32_t max_len;
+

This max_len is not not used in 2 patches bellow.

Do not see difference between this new max_len and old len:


Max_len is additional information that implementation may use to optimize 
memory usage. Currently, linux-gen implementation choose not to use that 
(max_len here must be always up to max_len of capability).

Len and max_len are different things. 'Len' is used with 'num' to specify how many packet 
there are in the pool (up to 'len' size). Max_len tells what is the maximum packet len 
allocated (even if it's a single packet). E.g. application may specify that pool must 
have 8k packets that are at least 1.5k in length, but specify max_len to 9k for jumbo 
packets (alloc calls are never requested more than 9k). Today application does not tell 
the max, but assumes that every pool provide the max_len of capability, which may be e.g. 
64k or "infinite" (== limited only by system memory).

-Petri


len - is maximum packet,
seg_len - is maximum segment size

in your case seg_len=1.5, len=9k
allocation of more then len will fail.

max_len is not needed.

Maxim.



  /** Minimum packet length that the pool must provide
  'num' packets. The number of packets may be less
  than 'num' when packets are larger than 'len'.
  The maximum value is defined by pool capability
  pkt.max_len. Use 0 for default. */
  uint32_t len;


Is that really needed?

Maxim.


/** Minimum number of packet data bytes that are stored
in the first segment of a packet. The maximum value
is defined by pool capability pkt.max_seg_len.




Re: [lng-odp] [PATCH 1/2] api: crypto: Adding crypto authentication algorithm

2016-11-11 Thread Maxim Uvarov
patch has to be prefixed with API-NEXT PATCH

On 11 November 2016 at 11:27, Balakrishna Garapati <
balakrishna.garap...@linaro.org> wrote:

> Signed-off-by: Balakrishna Garapati 
> ---
>  include/odp/api/spec/crypto.h | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
> index dea1fe9..bfa71cf 100644
> --- a/include/odp/api/spec/crypto.h
> +++ b/include/odp/api/spec/crypto.h
> @@ -83,6 +83,8 @@ typedef enum {
> ODP_AUTH_ALG_NULL,
> /** HMAC-MD5 with 96 bit key */
> ODP_AUTH_ALG_MD5_96,
> +   /** HMAC-MD5 with 512 bit key */
> +   ODP_AUTH_ALG_MD5_512,
> /** SHA256 with 128 bit key */
> ODP_AUTH_ALG_SHA256_128,
> /** AES128 in Galois/Counter Mode */
> @@ -130,6 +132,9 @@ typedef union odp_crypto_auth_algos_t {
> /** ODP_AUTH_ALG_MD5_96 */
> uint32_t md5_96 : 1;
>
> +   /** ODP_AUTH_ALG_MD5_512 */
> +   uint32_t md5_512 : 1;
> +
> /** ODP_AUTH_ALG_SHA256_128 */
> uint32_t sha256_128 : 1;
>
> --
> 1.9.1
>
>


Re: [lng-odp] [API-NEXT PATCH 1/3] drv: shm: function to query for physical addresses

2016-11-10 Thread Maxim Uvarov

On 11/10/16 20:21, Christophe Milard wrote:

The capability "can_getphy" is introduced and tells whether physical
address queries are available.
The function odpdrv_getphy() is added to query for physical address
(from virtual address)

Signed-off-by: Christophe Milard 
---
  include/odp/drv/spec/shm.h | 35 +++
  1 file changed, 35 insertions(+)

diff --git a/include/odp/drv/spec/shm.h b/include/odp/drv/spec/shm.h
index ef64f5d..ca3aae2 100644
--- a/include/odp/drv/spec/shm.h
+++ b/include/odp/drv/spec/shm.h
@@ -43,6 +43,12 @@ extern "C" {
  #define ODPDRV_SHM_LOCK   0x02 /**< Memory shall be locked (no 
swap) */
  
  /**

+ * @typedef odpdrv_phys_addr_t
+ * A physical memory address
+ *
+ */
+
+/**
   * Shared memory block info
   */
  typedef struct odpdrv_shm_info_t {
@@ -75,6 +81,13 @@ typedef struct odpdrv_shm_capability_t {
 * available memory size. */
uint64_t max_align;
  
+	/** Can retrieve physical addresses

+*
+* A true (non-zero) value means that odpdrv_getphy() can be
+* used to retrieve physical memory addresses, (as well as
+* the debug function odp_drv_dumpphy() */
+   int can_getphy;

intnphys_addr:1;

+
  } odpdrv_shm_capability_t;
  
  /**

@@ -220,6 +233,28 @@ int odpdrv_shm_print_all(const char *title);
  uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl);
  
  /**

+ * Get physical address from virtual address
+ *
+ * @addr   virtual address.
+ * @return Physicall address or NULL
+ *
+ * @note This routine will work only if capability "can_getphy" is true.
+ */
+odpdrv_phys_addr_t odpdrv_getphy(const void *addr);


naming is bad. By 'phy' I used to see physics layer chip, not physical 
memory.

Something similar to linux kernel might be:

odpdrv_virt_to_phys()
odpdrv_phys_to_virt()


and (I don't know how writes done from user space), but probably you 
need odp version of ioremap()




+
+/**
+ * Print physical address mapping
+ *

print where?

+ * @addr   virtual address.

what is len?


+ * @return Physicall address or NULL
+ *


it's void, no return.


+ * @note This routine will work only if capability "can_getphy" is true.
+ * @note This routine is intended to be used for diagnostic purposes,
+ * and uses ODP_DBG printouts
+ */
+void odpdrv_dumpphy(void *addr, uint64_t len);


Maybe odpdrv_memmap_print()? to print current mappings by driver?

should driver handle be passed as argument?


+
+/**
   * @}
   */
  




Re: [lng-odp] [API-NEXT PATCH v3 17/19] api: packet: added limits for packet len on alloc

2016-11-10 Thread Maxim Uvarov

On 11/10/16 14:07, Petri Savolainen wrote:

There's no use case for application to allocate zero length
packets. Application should always have some knowledge about
the new packet data length before allocation. Also
implementations are more efficient when a check for zero length
is avoided.

Also added a pool parameter to specify the maximum packet length
to be allocated from the pool. Implementations may use this
information to optimize e.g. memory usage, etc. Application must
not exceed the max_len parameter value on alloc calls. Pool
capabilities define already max_len.

Signed-off-by: Petri Savolainen 
---
  include/odp/api/spec/packet.h | 9 +
  include/odp/api/spec/pool.h   | 6 ++
  2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 4a14f2d..faf62e2 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -82,13 +82,14 @@ extern "C" {
   * Allocate a packet from a packet pool
   *
   * Allocates a packet of the requested length from the specified packet pool.
- * Pool must have been created with ODP_POOL_PACKET type. The
+ * The pool must have been created with ODP_POOL_PACKET type. The
   * packet is initialized with data pointers and lengths set according to the
   * specified len, and the default headroom and tailroom length settings. All
- * other packet metadata are set to their default values.
+ * other packet metadata are set to their default values. Packet length must
+ * be greater than zero and not exceed packet pool parameter 'max_len' value.
   *
   * @param pool  Pool handle
- * @param len   Packet data length
+ * @param len   Packet data length (1 ... pool max_len)
   *
   * @return Handle of allocated packet
   * @retval ODP_PACKET_INVALID  Packet could not be allocated
@@ -105,7 +106,7 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool, uint32_t 
len);
   * packets from a pool.
   *
   * @param pool  Pool handle
- * @param len   Packet data length
+ * @param len   Packet data length (1 ... pool max_len)
   * @param[out] pkt  Array of packet handles for output
   * @param num   Maximum number of packets to allocate
   *
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index c80c98a..6c99e05 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -192,6 +192,12 @@ typedef struct odp_pool_param_t {
pkt.max_len. Use 0 for default. */
uint32_t len;
  
+			/** Maximum packet length that will be allocated from

+   the pool. The maximum value is defined by pool
+   capability pkt.max_len. Use 0 for default (the
+   pool maximum). */
+   uint32_t max_len;
+


This max_len is not not used in 2 patches bellow.

Do not see difference between this new max_len and old len:

/** Minimum packet length that the pool must provide
'num' packets. The number of packets may be less
than 'num' when packets are larger than 'len'.
The maximum value is defined by pool capability
pkt.max_len. Use 0 for default. */
uint32_t len;


Is that really needed?

Maxim.


/** Minimum number of packet data bytes that are stored
in the first segment of a packet. The maximum value
is defined by pool capability pkt.max_seg_len.




Re: [lng-odp] [PATCHv4] linux-generic: add vlan insertion test

2016-11-09 Thread Maxim Uvarov

Merged,
Maxim.

On 11/08/16 21:45, Mike Holmes wrote:



On 8 November 2016 at 09:55, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


linux-generic packet mmap has separate function to put back
vlan tags which stripped out by linux kernel. This test is
to add code coverage for this function with receiving vlan
traffic from veth device.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org
<mailto:maxim.uva...@linaro.org>>


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


---

 v4: add check for root

 test/linux-generic/Makefile.am|   4 +
 test/linux-generic/m4/configure.m4|  1 +
 test/linux-generic/mmap_vlan_ins/.gitignore   |  2 +
 test/linux-generic/mmap_vlan_ins/Makefile.am  | 15 ++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c  | 232
++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh | 82 
 test/linux-generic/mmap_vlan_ins/pktio_env| 120 +++
 test/linux-generic/mmap_vlan_ins/vlan.pcap| Bin 0 -> 9728
bytes
 8 files changed, 456 insertions(+)
 create mode 100644 test/linux-generic/mmap_vlan_ins/.gitignore
 create mode 100644 test/linux-generic/mmap_vlan_ins/Makefile.am
 create mode 100644 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
 create mode 100755 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh
 create mode 100644 test/linux-generic/mmap_vlan_ins/pktio_env
 create mode 100644 test/linux-generic/mmap_vlan_ins/vlan.pcap

diff --git a/test/linux-generic/Makefile.am
b/test/linux-generic/Makefile.am
index 4660cf0..998ee56 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -37,11 +37,15 @@ TESTS = validation/api/pktio/pktio_run.sh \

 SUBDIRS += validation/api/pktio\
   validation/api/shmem\
+  mmap_vlan_ins\
   pktio_ipc\
   ring

 if HAVE_PCAP
 TESTS += validation/api/pktio/pktio_run_pcap.sh
+
+TESTS +=   mmap_vlan_ins/mmap_vlan_ins.sh
+SUBDIRS += mmap_vlan_ins
 endif
 if netmap_support
 TESTS += validation/api/pktio/pktio_run_netmap.sh
diff --git a/test/linux-generic/m4/configure.m4
b/test/linux-generic/m4/configure.m4
index 6b92201..8746dab 100644
--- a/test/linux-generic/m4/configure.m4
+++ b/test/linux-generic/m4/configure.m4
@@ -3,6 +3,7 @@ m4_include([test/linux-generic/m4/performance.m4])
 AC_CONFIG_FILES([test/linux-generic/Makefile
 test/linux-generic/validation/api/shmem/Makefile
 test/linux-generic/validation/api/pktio/Makefile
+test/linux-generic/mmap_vlan_ins/Makefile
 test/linux-generic/pktio_ipc/Makefile
 test/linux-generic/ring/Makefile
 test/linux-generic/performance/Makefile])
diff --git a/test/linux-generic/mmap_vlan_ins/.gitignore
b/test/linux-generic/mmap_vlan_ins/.gitignore
new file mode 100644
index 000..755fa2e
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/.gitignore
@@ -0,0 +1,2 @@
+*.pcap
+plat_mmap_vlan_ins
diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am
b/test/linux-generic/mmap_vlan_ins/Makefile.am
new file mode 100644
index 000..2641556
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+
+dist_check_SCRIPTS = vlan.pcap \
+mmap_vlan_ins.sh \
+pktio_env
+
+test_SCRIPTS = $(dist_check_SCRIPTS)
+
+bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
+plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
+plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+# Clonned from example odp_l2fwd simple
+dist_plat_mmap_vlan_ins_SOURCES = mmap_vlan_ins.c
diff --git a/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
new file mode 100644
index 000..0682d2d
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
@@ -0,0 +1,232 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define POOL_NUM_PKT 8192
+#define POOL_SEG_LEN 1856
+#define MAX_PKT_BURST 32
+#define MAX_WORKERS 1
+
+static int exit_thr;
+static int g_ret;
+
+struct {
+   odp_pktio_t if0, if1;
+   odp_pktin_queue_t if0in, if1in;
+ 

[lng-odp] [PATCHv4] linux-generic: add vlan insertion test

2016-11-08 Thread Maxim Uvarov
linux-generic packet mmap has separate function to put back
vlan tags which stripped out by linux kernel. This test is
to add code coverage for this function with receiving vlan
traffic from veth device.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---

 v4: add check for root

 test/linux-generic/Makefile.am|   4 +
 test/linux-generic/m4/configure.m4|   1 +
 test/linux-generic/mmap_vlan_ins/.gitignore   |   2 +
 test/linux-generic/mmap_vlan_ins/Makefile.am  |  15 ++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c  | 232 ++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh |  82 
 test/linux-generic/mmap_vlan_ins/pktio_env| 120 +++
 test/linux-generic/mmap_vlan_ins/vlan.pcap| Bin 0 -> 9728 bytes
 8 files changed, 456 insertions(+)
 create mode 100644 test/linux-generic/mmap_vlan_ins/.gitignore
 create mode 100644 test/linux-generic/mmap_vlan_ins/Makefile.am
 create mode 100644 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
 create mode 100755 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh
 create mode 100644 test/linux-generic/mmap_vlan_ins/pktio_env
 create mode 100644 test/linux-generic/mmap_vlan_ins/vlan.pcap

diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am
index 4660cf0..998ee56 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -37,11 +37,15 @@ TESTS = validation/api/pktio/pktio_run.sh \
 
 SUBDIRS += validation/api/pktio\
   validation/api/shmem\
+  mmap_vlan_ins\
   pktio_ipc\
   ring
 
 if HAVE_PCAP
 TESTS += validation/api/pktio/pktio_run_pcap.sh
+
+TESTS +=   mmap_vlan_ins/mmap_vlan_ins.sh
+SUBDIRS += mmap_vlan_ins
 endif
 if netmap_support
 TESTS += validation/api/pktio/pktio_run_netmap.sh
diff --git a/test/linux-generic/m4/configure.m4 
b/test/linux-generic/m4/configure.m4
index 6b92201..8746dab 100644
--- a/test/linux-generic/m4/configure.m4
+++ b/test/linux-generic/m4/configure.m4
@@ -3,6 +3,7 @@ m4_include([test/linux-generic/m4/performance.m4])
 AC_CONFIG_FILES([test/linux-generic/Makefile
 test/linux-generic/validation/api/shmem/Makefile
 test/linux-generic/validation/api/pktio/Makefile
+test/linux-generic/mmap_vlan_ins/Makefile
 test/linux-generic/pktio_ipc/Makefile
 test/linux-generic/ring/Makefile
 test/linux-generic/performance/Makefile])
diff --git a/test/linux-generic/mmap_vlan_ins/.gitignore 
b/test/linux-generic/mmap_vlan_ins/.gitignore
new file mode 100644
index 000..755fa2e
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/.gitignore
@@ -0,0 +1,2 @@
+*.pcap
+plat_mmap_vlan_ins
diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am 
b/test/linux-generic/mmap_vlan_ins/Makefile.am
new file mode 100644
index 000..2641556
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+
+dist_check_SCRIPTS = vlan.pcap \
+mmap_vlan_ins.sh \
+pktio_env
+
+test_SCRIPTS = $(dist_check_SCRIPTS)
+
+bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
+plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
+plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+# Clonned from example odp_l2fwd simple
+dist_plat_mmap_vlan_ins_SOURCES = mmap_vlan_ins.c
diff --git a/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c 
b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
new file mode 100644
index 000..0682d2d
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
@@ -0,0 +1,232 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define POOL_NUM_PKT 8192
+#define POOL_SEG_LEN 1856
+#define MAX_PKT_BURST 32
+#define MAX_WORKERS 1
+
+static int exit_thr;
+static int g_ret;
+
+struct {
+   odp_pktio_t if0, if1;
+   odp_pktin_queue_t if0in, if1in;
+   odp_pktout_queue_t if0out, if1out;
+   odph_ethaddr_t src, dst;
+} global;
+
+static void sig_handler(int signo ODP_UNUSED)
+{
+   printf("sig_handler!\n");
+   exit_thr = 1;
+}
+
+static odp_pktio_t create_pktio(const char *name, odp_pool_t pool,
+   odp_pktin_queue_t *pktin,
+   odp_pktout_queue_t *pktout)
+{
+   odp_pktio_param_t pktio_param;
+   odp_pktin_queue_param_t in_queue_param;
+   odp_pktout_queue_param_t out_queue_param;
+   odp_pktio_t pktio;
+
+   odp_pktio_param_init(_param);
+
+   pktio = odp_pktio_open(name, pool, _param);
+   if (pktio == ODP_PKTIO_INVALID) {
+   printf("Failed to open %s\n", name);
+   exit(1);
+   }
+
+

Re: [lng-odp] [API-NEXT PATCHv2 4/5] linux-gen: implementation of odp_load_driver function

2016-11-08 Thread Maxim Uvarov

On 11/08/16 17:15, Christophe Milard wrote:

On 8 November 2016 at 15:06, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

are there any system for linux-generic platform where dlopen is not
supported?
I think that we don't need ifdefs.

Are you saying we should limit us to plain linux? including the test??
I am not sure I agree with this really,...
Any other voices?


Tests should not care about dlopen. They should call api 
odp_driver_load() and if call is not supported then skip test.


Maxim.


Maxim.



On 11/07/16 14:15, Christophe Milard wrote:

Implementation of the driver loading function, of north API

Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---
   configure.ac   |  4 ++--
   platform/linux-generic/include/.gitignore  |  1 +
   .../linux-generic/include/odp_platform_config.h.in | 11 +++
   platform/linux-generic/m4/configure.m4 |  1 +
   platform/linux-generic/m4/odp_drivers.m4   | 16 
   platform/linux-generic/odp_init.c  | 22
++
   6 files changed, 53 insertions(+), 2 deletions(-)
   create mode 100644 platform/linux-generic/include/.gitignore
   create mode 100644
platform/linux-generic/include/odp_platform_config.h.in
   create mode 100644 platform/linux-generic/m4/odp_drivers.m4

diff --git a/configure.ac b/configure.ac
index 8942894..a92469c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ AC_PROG_MAKE_SET
 AM_PROG_AR
   #Use libtool
-LT_INIT([])
+LT_INIT([dlopen])
   AC_SUBST([LIBTOOL_DEPS])
   AM_PROG_LIBTOOL
   @@ -58,7 +58,7 @@ AC_CHECK_FUNCS([bzero clock_gettime gethostbyname
getpagesize gettimeofday memse
 # Checks for header files.
   AC_HEADER_RESOLV
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h
netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h
sys/time.h unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h
netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h
sys/time.h unistd.h dlfcn.h])
 # Checks for typedefs, structures, and compiler characteristics.
   AC_HEADER_STDBOOL
diff --git a/platform/linux-generic/include/.gitignore
b/platform/linux-generic/include/.gitignore
new file mode 100644
index 000..a32f733
--- /dev/null
+++ b/platform/linux-generic/include/.gitignore
@@ -0,0 +1 @@
+odp_platform_config.h
diff --git a/platform/linux-generic/include/odp_platform_config.h.in
b/platform/linux-generic/include/odp_platform_config.h.in
new file mode 100644
index 000..3b0ed2c
--- /dev/null
+++ b/platform/linux-generic/include/odp_platform_config.h.in
@@ -0,0 +1,11 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* the .h.in file is parsed by automake which performs substitutions
+ * according to the AC_SUBST macro given in m4 files.
+ */
+
+#define HAVE_DLFCN_H @HAVE_DLFCN_H@
diff --git a/platform/linux-generic/m4/configure.m4
b/platform/linux-generic/m4/configure.m4
index d3e5528..487f21e 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -35,6 +35,7 @@ m4_include([platform/linux-generic/m4/odp_netmap.m4])
   m4_include([platform/linux-generic/m4/odp_dpdk.m4])
   m4_include([platform/linux-generic/m4/odp_ipc.m4])
   m4_include([platform/linux-generic/m4/odp_schedule.m4])
+m4_include([platform/linux-generic/m4/odp_drivers.m4])
 AC_CONFIG_FILES([platform/linux-generic/Makefile

platform/linux-generic/include/odp/api/plat/static_inline.h])
diff --git a/platform/linux-generic/m4/odp_drivers.m4
b/platform/linux-generic/m4/odp_drivers.m4
new file mode 100644
index 000..f0ceccc
--- /dev/null
+++ b/platform/linux-generic/m4/odp_drivers.m4
@@ -0,0 +1,16 @@

+##
+# Check for dlopen and lt equivalent availability

+##
+
+AC_SEARCH_LIBS([dlopen], [dl dld],
+[
+   HAVE_DLFCN_H=1
+   AM_LDFLAGS="$AM_LDFLAGS -ldl"
+],
+[
+   echo "Warning! dlopen not available: won't be able to load
drivers!"
+   HAVE_DLFCN_H=0
+])
+
+AC_SUBST(HAVE_DLFCN_H)
+AC_CONFIG_FILES([platform/linux-generic/include/odp_platform_config.h])
diff --git a/platform/linux-generic/odp_init.c
b/platform/linux-generic/odp_init.c
index d4a8e09..3dfbbc6 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include 
   #include 
   #include 
   #include 
@@ -11,6 +12,10 @@
   #include 
   #include 
   +#if HAVE_DLFCN_H
+# include 
+#endif
+
   struct odp_global_data_s odp_global_data;
 int odp_init_global(odp_instance_t *instance,
@@ -374,3 +379,20 @@ int _odp_term_local(enum init_stage stage)
 return rc;
   }
+

Re: [lng-odp] [API-NEXT PATCHv2 3/5] api: init: driver load function added

2016-11-08 Thread Maxim Uvarov

On 11/08/16 17:09, Christophe Milard wrote:

On 8 November 2016 at 14:56, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

On 11/07/16 14:15, Christophe Milard wrote:

Function added on the north API to load drivers.

Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---
   include/odp/api/spec/init.h | 16 
   1 file changed, 16 insertions(+)

diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index 154cdf8..bfe43df 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -270,6 +270,22 @@ int odp_init_local(odp_instance_t instance,
odp_thread_type_t thr_type);
   int odp_term_local(void);
 /**
+ * Driver loading
+ *
+ * This function is used by the application to load NIC drivers into ODP.


s/NIC divers/ODP drivers/

Sorry: don't understand this comment. what do you mean?


change text from 'NIC drivers'  to 'ODP dirvers' due to driver might be 
not only for NIC.



+ * Calls to this function are optional, but should be performed (if any)
+ * after odp_init_global
+ *
+ *
+ * @param filenameDriver shared lib (dynamic library)


it it full file name or just name of the library?

Whatever dl_open supports (full path or filename searched in LD_BIBRARY...)
Will include that in the comment =>V3


yes comment needs to be updated. Argument might be also "*name" or 
"*libname"





+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ *
+ */
+int odp_load_driver(const char *filename);


odp_driver_load() or even odp_drv_load().

I think it's better to keep common prefix for drivers.

then it should be odp_driver_load, because the prefix in odp only as
this function is part of the application API
=> V3


ok.


Christophe


Maxim.



+
+/**
* @}
*/







Re: [lng-odp] [API-NEXT PATCHv2 5/5] test: adding test for driver load function

2016-11-08 Thread Maxim Uvarov

On 11/07/16 14:15, Christophe Milard wrote:

Trying to fix a proper structure for driver tests in the hard world
of autotools:
Staticaly linked drivers fails with autotools as the linker would need the
"--whole-archive" option which autotools cannot handle.
Trying to used ltdl lib does not seem to help the nedd for rpath otpion
(which is surprising).
So this patch just point at the .so path usiong rpath.

Signed-off-by: Christophe Milard 
---
  test/.gitignore|  1 +
  test/Makefile.inc  |  3 +-
  test/common_plat/m4/configure.m4   |  1 +
  test/common_plat/validation/Makefile.inc   |  1 -
  test/common_plat/validation/drv/Makefile.am|  1 +
  test/common_plat/validation/drv/drvinit/.gitignore |  1 +
  .../common_plat/validation/drv/drvinit/Makefile.am | 25 ++
  test/common_plat/validation/drv/drvinit/drvinit.c  | 58 ++
  test/common_plat/validation/drv/drvinit/drvinit.h  | 24 +
  .../validation/drv/drvinit/drvinit_main.c  | 12 +
  .../validation/drv/drvinit/empty_driver.c  | 12 +
  test/linux-generic/Makefile.am |  1 +
  test/m4/configure.m4   |  3 ++
  test/test_config.h.in  | 13 +
  14 files changed, 154 insertions(+), 2 deletions(-)
  create mode 100644 test/.gitignore
  create mode 100644 test/common_plat/validation/drv/drvinit/.gitignore
  create mode 100644 test/common_plat/validation/drv/drvinit/Makefile.am
  create mode 100644 test/common_plat/validation/drv/drvinit/drvinit.c
  create mode 100644 test/common_plat/validation/drv/drvinit/drvinit.h
  create mode 100644 test/common_plat/validation/drv/drvinit/drvinit_main.c
  create mode 100644 test/common_plat/validation/drv/drvinit/empty_driver.c
  create mode 100644 test/test_config.h.in

diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 000..4be1df5
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1 @@
+test_config.h
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 1ebc047..923ca21 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -12,7 +12,8 @@ INCFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/platform/@with_platform@/include \
-I$(top_srcdir)/test \
-   -I$(top_builddir)/include
+   -I$(top_builddir)/include \
+   -I$(top_builddir)/test
  
  AM_CFLAGS += $(INCFLAGS)

  AM_CXXFLAGS = $(INCFLAGS)
diff --git a/test/common_plat/m4/configure.m4 b/test/common_plat/m4/configure.m4
index 1fc350d..32ac8c4 100644
--- a/test/common_plat/m4/configure.m4
+++ b/test/common_plat/m4/configure.m4
@@ -33,4 +33,5 @@ AC_CONFIG_FILES([test/common_plat/Makefile
 test/common_plat/validation/api/traffic_mngr/Makefile
 test/common_plat/validation/drv/Makefile
 test/common_plat/validation/drv/drvatomic/Makefile
+test/common_plat/validation/drv/drvinit/Makefile
 test/common_plat/validation/drv/drvshmem/Makefile])
diff --git a/test/common_plat/validation/Makefile.inc 
b/test/common_plat/validation/Makefile.inc
index ffba620..36c9899 100644
--- a/test/common_plat/validation/Makefile.inc
+++ b/test/common_plat/validation/Makefile.inc
@@ -8,7 +8,6 @@ COMMON_DIR = $(top_builddir)/test/common_plat/common
  AUTOMAKE_OPTIONS = nostdinc
  
  AM_CFLAGS += -I$(top_srcdir)/test/common_plat/common

-AM_LDFLAGS += -static
  
  LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la

  LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
diff --git a/test/common_plat/validation/drv/Makefile.am 
b/test/common_plat/validation/drv/Makefile.am
index bcdb92e..1574f3d 100644
--- a/test/common_plat/validation/drv/Makefile.am
+++ b/test/common_plat/validation/drv/Makefile.am
@@ -1,4 +1,5 @@
  ODPDRV_MODULES = drvatomic \
+drvinit \
 drvshmem
  
  SUBDIRS = $(ODPDRV_MODULES)

diff --git a/test/common_plat/validation/drv/drvinit/.gitignore 
b/test/common_plat/validation/drv/drvinit/.gitignore
new file mode 100644
index 000..d630ef5
--- /dev/null
+++ b/test/common_plat/validation/drv/drvinit/.gitignore
@@ -0,0 +1 @@
+drvinit_main
diff --git a/test/common_plat/validation/drv/drvinit/Makefile.am 
b/test/common_plat/validation/drv/drvinit/Makefile.am
new file mode 100644
index 000..8ccf2aa
--- /dev/null
+++ b/test/common_plat/validation/drv/drvinit/Makefile.am
@@ -0,0 +1,25 @@
+include ../Makefile.inc
+include $(top_srcdir)/platform/@with_platform@/Makefile.inc
+
+ABS_TEST_BUILDDIR = $(abs_top_builddir)/test/common_plat/validation/drv/drvinit
+
+noinst_LTLIBRARIES = libtestdrvinit.la
+libtestdrvinit_la_SOURCES = drvinit.c
+
+# the minimalist driver:
+lib_LTLIBRARIES = empty_driver.la
+empty_driver_la_SOURCES = empty_driver.c
+empty_driver_la_LDFLAGS = $(AM_LDFLAGS) -module -shared -export-dynamic \
+ -avoid-version
+

Re: [lng-odp] [API-NEXT PATCHv2 4/5] linux-gen: implementation of odp_load_driver function

2016-11-08 Thread Maxim Uvarov
are there any system for linux-generic platform where dlopen is not 
supported?

I think that we don't need ifdefs.

Maxim.


On 11/07/16 14:15, Christophe Milard wrote:

Implementation of the driver loading function, of north API

Signed-off-by: Christophe Milard 
---
  configure.ac   |  4 ++--
  platform/linux-generic/include/.gitignore  |  1 +
  .../linux-generic/include/odp_platform_config.h.in | 11 +++
  platform/linux-generic/m4/configure.m4 |  1 +
  platform/linux-generic/m4/odp_drivers.m4   | 16 
  platform/linux-generic/odp_init.c  | 22 ++
  6 files changed, 53 insertions(+), 2 deletions(-)
  create mode 100644 platform/linux-generic/include/.gitignore
  create mode 100644 platform/linux-generic/include/odp_platform_config.h.in
  create mode 100644 platform/linux-generic/m4/odp_drivers.m4

diff --git a/configure.ac b/configure.ac
index 8942894..a92469c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ AC_PROG_MAKE_SET
  
  AM_PROG_AR

  #Use libtool
-LT_INIT([])
+LT_INIT([dlopen])
  AC_SUBST([LIBTOOL_DEPS])
  AM_PROG_LIBTOOL
  
@@ -58,7 +58,7 @@ AC_CHECK_FUNCS([bzero clock_gettime gethostbyname getpagesize gettimeofday memse
  
  # Checks for header files.

  AC_HEADER_RESOLV
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h 
stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h 
unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netdb.h netinet/in.h 
stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h 
unistd.h dlfcn.h])
  
  # Checks for typedefs, structures, and compiler characteristics.

  AC_HEADER_STDBOOL
diff --git a/platform/linux-generic/include/.gitignore 
b/platform/linux-generic/include/.gitignore
new file mode 100644
index 000..a32f733
--- /dev/null
+++ b/platform/linux-generic/include/.gitignore
@@ -0,0 +1 @@
+odp_platform_config.h
diff --git a/platform/linux-generic/include/odp_platform_config.h.in 
b/platform/linux-generic/include/odp_platform_config.h.in
new file mode 100644
index 000..3b0ed2c
--- /dev/null
+++ b/platform/linux-generic/include/odp_platform_config.h.in
@@ -0,0 +1,11 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* the .h.in file is parsed by automake which performs substitutions
+ * according to the AC_SUBST macro given in m4 files.
+ */
+
+#define HAVE_DLFCN_H @HAVE_DLFCN_H@
diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index d3e5528..487f21e 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -35,6 +35,7 @@ m4_include([platform/linux-generic/m4/odp_netmap.m4])
  m4_include([platform/linux-generic/m4/odp_dpdk.m4])
  m4_include([platform/linux-generic/m4/odp_ipc.m4])
  m4_include([platform/linux-generic/m4/odp_schedule.m4])
+m4_include([platform/linux-generic/m4/odp_drivers.m4])
  
  AC_CONFIG_FILES([platform/linux-generic/Makefile

   platform/linux-generic/include/odp/api/plat/static_inline.h])
diff --git a/platform/linux-generic/m4/odp_drivers.m4 
b/platform/linux-generic/m4/odp_drivers.m4
new file mode 100644
index 000..f0ceccc
--- /dev/null
+++ b/platform/linux-generic/m4/odp_drivers.m4
@@ -0,0 +1,16 @@
+##
+# Check for dlopen and lt equivalent availability
+##
+
+AC_SEARCH_LIBS([dlopen], [dl dld],
+[
+   HAVE_DLFCN_H=1
+   AM_LDFLAGS="$AM_LDFLAGS -ldl"
+],
+[
+   echo "Warning! dlopen not available: won't be able to load drivers!"
+   HAVE_DLFCN_H=0
+])
+
+AC_SUBST(HAVE_DLFCN_H)
+AC_CONFIG_FILES([platform/linux-generic/include/odp_platform_config.h])
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index d4a8e09..3dfbbc6 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -3,6 +3,7 @@
   *
   * SPDX-License-Identifier: BSD-3-Clause
   */
+#include 
  #include 
  #include 
  #include 
@@ -11,6 +12,10 @@
  #include 
  #include 
  
+#if HAVE_DLFCN_H

+# include 
+#endif
+
  struct odp_global_data_s odp_global_data;
  
  int odp_init_global(odp_instance_t *instance,

@@ -374,3 +379,20 @@ int _odp_term_local(enum init_stage stage)
  
  	return rc;

  }
+
+int odp_load_driver(const char *filename)
+{
+/*
+ * If dlopen is not available, then dynamic loading is not available:
+ * return error.
+ */
+#if HAVE_DLFCN_H
+   if (dlopen(filename, RTLD_NOW) == NULL) {
+   ODP_ERR("dlopen failed:%s\n", dlerror());
+   return -1;
+   }
+   return 0;
+
+#endif
+   return -1;
+}




Re: [lng-odp] [API-NEXT PATCHv2 3/5] api: init: driver load function added

2016-11-08 Thread Maxim Uvarov

On 11/07/16 14:15, Christophe Milard wrote:

Function added on the north API to load drivers.

Signed-off-by: Christophe Milard 
---
  include/odp/api/spec/init.h | 16 
  1 file changed, 16 insertions(+)

diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index 154cdf8..bfe43df 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -270,6 +270,22 @@ int odp_init_local(odp_instance_t instance, 
odp_thread_type_t thr_type);
  int odp_term_local(void);
  
  /**

+ * Driver loading
+ *
+ * This function is used by the application to load NIC drivers into ODP.


s/NIC divers/ODP drivers/


+ * Calls to this function are optional, but should be performed (if any)
+ * after odp_init_global
+ *
+ *
+ * @param filenameDriver shared lib (dynamic library)


it it full file name or just name of the library?



+ *
+ * @retval 0 on success
+ * @retval <0 on failure
+ *
+ */
+int odp_load_driver(const char *filename);


odp_driver_load() or even odp_drv_load().

I think it's better to keep common prefix for drivers.

Maxim.


+
+/**
   * @}
   */
  




[lng-odp] shared odp lib and threads creation

2016-11-07 Thread Maxim Uvarov

Hello,

I added basic ODP input support for Suricata here:

https://github.com/muvarov/suricata

and now I think how it's better to resolve things with threads. Problem 
is that when we did dpdk port dpdk run it's workers
at early init stage. Then called function passed as call back and dpdk 
worker, which runs it instead of busy loop. Validation tests and
examples do not see difference in thread creation due to use of odp 
helper library. Which is different for linux-gen and odp-dpdk

platforms.

Because of we wanted to make odp helper optional library. We need to 
make common execution of multi threaded app. So that

replacement of .so library can work.

it might be:
1) try to move thread start thread for odp-dpdk to odp_init_local() 
which is at the beginning of each thread.


2) use in all multi thread applications odp helper library.

3) move common things to odp API.

So the questions are:
1) does somebody else change odp helper code?

   2) what is better way to support multi threaded apps in binary 
compatibility mode?


Thank you,
Maxim.



[lng-odp] [PATCH] travis: linux-gen: add dpdk pktio

2016-11-07 Thread Maxim Uvarov
Turn on linux-generic dpdk and pcap pktios with their validation
tests.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 .travis.yml | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 0d1add3..1092cd0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,6 +11,7 @@ sudo: required
 before_install:
 - sudo apt-get -qq update
 - sudo apt-get install automake autoconf libtool libssl-dev graphviz 
mscgen doxygen
+- sudo apt-get install libpcap-dev linux-headers-`uname -r`
 - gem install asciidoctor
 
 #   Install cunit for the validation tests because distro version is too 
old and fails C99 compile
@@ -24,12 +25,25 @@ before_install:
 - sudo make install
 - cd ..
 - export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
-
-install:
-- ./bootstrap
+#  DPDK pktio
+- TARGET=${TARGET:-"x86_64-native-linuxapp-gcc"}
+- git clone http://dpdk.org/git/dpdk dpdk
+- pushd dpdk
+- git checkout -b bv16.07 v16.07
+- make config T=${TARGET} O=${TARGET}
+- pushd ${TARGET}
+- sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
+- popd
+- make install T=${TARGET} EXTRA_CFLAGS="-fPIC"
+- popd
 
 script:
-- ./configure --enable-test-cpp --enable-test-vald 
--enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example
+
+- ./bootstrap
+- ./configure --enable-test-cpp --enable-test-vald 
--enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example 
--with-dpdk-path=`pwd`/dpdk/${TARGET}
 - make check
+- git clean -f -d -x && rm -rf dpdk
+- ./bootstrap
+- ./configure
 - make doxygen-doc
 - make distcheck
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH v2 2/2] add travis.yml for gitub automation

2016-11-07 Thread Maxim Uvarov

Merged,

Maxim.

On 10/28/16 19:24, Mike Holmes wrote:



On 28 October 2016 at 10:16, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Mike,

all crypto tests failed for me. On laptop I have "Version:
1.0.1f-1ubuntu2.19" which is about the same as Travis uses.
Do you see the same errors?


Yes, the travis is working perfectly and has found an issue already :)

My run just now 
https://travis-ci.org/mike-holmes-linaro/odp/builds/171432977


I expect it to fail often becasue without the  capability structs 
being implemented and used properly our tests expect too much of the 
HW when run in the cloud, but this is something else it appears


Our Jenkins nightly from yesterday sees no issue

https://ci.linaro.org/view/odp-ci/job/odp-api-check/ARCH=x86-64,label=docker-jessie-amd64,pktio=none/882/console

*19:50:10* PASS: ../../test/common_plat/validation/api/cpumask/cpumask_main



Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.38 [1,581 kB]

Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl1.0.0 amd64 1.0.1-4ubuntu5.38 [1,055 kB]



  Test: crypto_test_dec_alg_aes128_gcm ...FAILED

1.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

  Test: crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED

1.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

Test: crypto_test_dec_alg_aes128_gcm ...FAILED Test:
crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED


Maxim.




On 10/21/16 21:40, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically
trigger CI builds

Signed-off-by: Mike Holmes <mike.hol...@linaro.org
<mailto:mike.hol...@linaro.org>>
---
  .travis.yml | 35 +++
  1 file changed, 35 insertions(+)
  create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0d1add3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+language: c
+compiler: clang
+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool
libssl-dev graphviz mscgen doxygen
+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro
version is too old and fails C99 compile
+- export CUNIT_VERSION=2.1-3
+- curl -sSOL

http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2

<http://sourceforge.net/projects/cunit/files/CUnit/$%7BCUNIT_VERSION%7D/CUnit-$%7BCUNIT_VERSION%7D.tar.bz2>
+- tar -jxf *.bz2
+- cd CUnit*
+- ./bootstrap
+- ./configure --enable-debug --enable-automated
--enable-basic --enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
+- ./configure --enable-test-cpp --enable-test-vald
--enable-test-helper --enable-test-perf --enable-user-guides
--enable-test-perf-proc --enable-test-example
   

Re: [lng-odp] [PATCHv2 1/1] validation: classification: fix TCP/UDP checksum update

2016-11-03 Thread Maxim Uvarov

ping, please review.

Maxim.

On 10/27/16 16:00, Balasubramanian Manoharan wrote:

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

Signed-off-by: Balasubramanian Manoharan 
---
v2: Incorporates review comments
  .../api/classification/odp_classification_common.c | 14 +-
  .../api/classification/odp_classification_test_pmr.c   |  3 +++
  2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/test/common_plat/validation/api/classification/odp_classification_common.c 
b/test/common_plat/validation/api/classification/odp_classification_common.c
index 7a42ac7..2923a71 100644
--- a/test/common_plat/validation/api/classification/odp_classification_common.c
+++ b/test/common_plat/validation/api/classification/odp_classification_common.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include "test_debug.h"
  
  typedef struct cls_test_packet {

odp_u32be_t magic;
@@ -291,6 +292,8 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan,
parse_ipv4_string(CLS_DEFAULT_SADDR, , );
ip->src_addr = odp_cpu_to_be_32(addr);
ip->ver_ihl = ODPH_IPV4 << 4 | ODPH_IPV4HDR_IHL_MIN;
+   odp_packet_has_ipv4_set(pkt, 1);
+
if (flag_udp)
ip->tot_len = odp_cpu_to_be_16(ODPH_UDPHDR_LEN + payload_len +
   ODPH_IPV4HDR_LEN);
@@ -318,14 +321,23 @@ odp_packet_t create_packet_len(odp_pool_t pool, bool vlan,
udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
udp->length = odp_cpu_to_be_16(payload_len + ODPH_UDPHDR_LEN);
udp->chksum = 0;
+   odp_packet_has_udp_set(pkt, 1);
+   if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
+   LOG_ERR("odph_udp_tcp_chksum failed\n");
+   return ODP_PACKET_INVALID;
+   }
} else {
odp_packet_l4_offset_set(pkt, offset);
tcp = (odph_tcphdr_t *)odp_packet_l4_ptr(pkt, NULL);
tcp->src_port = odp_cpu_to_be_16(CLS_DEFAULT_SPORT);
tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT);
tcp->hl = ODPH_TCPHDR_LEN / 4;
-   /* TODO: checksum field has to be updated */
tcp->cksm = 0;
+   odp_packet_has_tcp_set(pkt, 1);
+   if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) {
+   LOG_ERR("odph_udp_tcp_chksum failed\n");
+   return ODP_PACKET_INVALID;
+   }
}
  
  	/* set pkt sequence number */

diff --git 
a/test/common_plat/validation/api/classification/odp_classification_test_pmr.c 
b/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
index c8bbf50..88fbf8f 100644
--- 
a/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
+++ 
b/test/common_plat/validation/api/classification/odp_classification_test_pmr.c
@@ -717,6 +717,7 @@ void classification_test_pmr_term_dmac(void)
  
  	/* Other packets delivered to default queue */

pkt = create_packet(pkt_pool, false, , false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
memset(eth->dst.addr, 0, ODPH_ETHADDR_LEN);
CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
@@ -1102,6 +1103,7 @@ static void classification_test_pmr_term_daddr(void)
/* packet with dst ip address matching PMR rule to be
received in the CoS queue*/
pkt = create_packet(pkt_pool, false, , false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
odp_pktio_mac_addr(pktio, eth->src.addr, ODPH_ETHADDR_LEN);
odp_pktio_mac_addr(pktio, eth->dst.addr, ODPH_ETHADDR_LEN);
@@ -1122,6 +1124,7 @@ static void classification_test_pmr_term_daddr(void)
  
  	/* Other packets delivered to default queue */

pkt = create_packet(pkt_pool, false, , false);
+   CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID);
seqno = cls_pkt_get_seq(pkt);
CU_ASSERT(seqno != TEST_SEQ_INVALID);
eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);




Re: [lng-odp] [API-NEXT PATCHv6 2/5] linux-generic: packet: implement splice/reference apis

2016-11-02 Thread Maxim Uvarov

On 10/11/16 06:45, Bill Fischofer wrote:

+
+odp_packet_t odp_packet_ref(odp_packet_t pkt, uint32_t offset)
+{
+   odp_packet_t refpkt;
+
+   if (pkt == ODP_PACKET_INVALID || offset >= odp_packet_len(pkt))
+   return ODP_PACKET_INVALID;
+
+   refpkt = odp_packet_alloc(odp_packet_pool(pkt), 0);
+


that might be reasonable to update pool_create() description saying that
number of pool entries also includes number of packet references. I.e. 
packet

references are also allocate from the same pool and will eat pool entries.

Maxim.


+   if (refpkt == ODP_PACKET_INVALID)
+   return ODP_PACKET_INVALID;
+
+   return packet_splice(refpkt, pkt, offset);
+}




[lng-odp] [PATCHv3] linux-generic: add vlan insertion test

2016-11-02 Thread Maxim Uvarov
linux-generic packet mmap has separate function to put back
vlan tags which stripped out by linux kernel. This test is
to add code coverage for this function with receiving vlan
traffic from veth device.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 v3: - do not point from tests to examples. (Christophe)
 - use better naming.
 - steal code from l2fwd_simple istead of packet.

 I tested this code with printf added to vlan insersion function.

 Thanks,
 Maxim.

 test/linux-generic/Makefile.am|   4 +
 test/linux-generic/m4/configure.m4|   1 +
 test/linux-generic/mmap_vlan_ins/.gitignore   |   2 +
 test/linux-generic/mmap_vlan_ins/Makefile.am  |  15 ++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c  | 232 ++
 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh |  79 
 test/linux-generic/mmap_vlan_ins/pktio_env| 120 +++
 test/linux-generic/mmap_vlan_ins/vlan.pcap| Bin 0 -> 9728 bytes
 8 files changed, 453 insertions(+)
 create mode 100644 test/linux-generic/mmap_vlan_ins/.gitignore
 create mode 100644 test/linux-generic/mmap_vlan_ins/Makefile.am
 create mode 100644 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
 create mode 100755 test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh
 create mode 100644 test/linux-generic/mmap_vlan_ins/pktio_env
 create mode 100644 test/linux-generic/mmap_vlan_ins/vlan.pcap

diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am
index 4660cf0..998ee56 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -37,11 +37,15 @@ TESTS = validation/api/pktio/pktio_run.sh \
 
 SUBDIRS += validation/api/pktio\
   validation/api/shmem\
+  mmap_vlan_ins\
   pktio_ipc\
   ring
 
 if HAVE_PCAP
 TESTS += validation/api/pktio/pktio_run_pcap.sh
+
+TESTS +=   mmap_vlan_ins/mmap_vlan_ins.sh
+SUBDIRS += mmap_vlan_ins
 endif
 if netmap_support
 TESTS += validation/api/pktio/pktio_run_netmap.sh
diff --git a/test/linux-generic/m4/configure.m4 
b/test/linux-generic/m4/configure.m4
index 6b92201..8746dab 100644
--- a/test/linux-generic/m4/configure.m4
+++ b/test/linux-generic/m4/configure.m4
@@ -3,6 +3,7 @@ m4_include([test/linux-generic/m4/performance.m4])
 AC_CONFIG_FILES([test/linux-generic/Makefile
 test/linux-generic/validation/api/shmem/Makefile
 test/linux-generic/validation/api/pktio/Makefile
+test/linux-generic/mmap_vlan_ins/Makefile
 test/linux-generic/pktio_ipc/Makefile
 test/linux-generic/ring/Makefile
 test/linux-generic/performance/Makefile])
diff --git a/test/linux-generic/mmap_vlan_ins/.gitignore 
b/test/linux-generic/mmap_vlan_ins/.gitignore
new file mode 100644
index 000..755fa2e
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/.gitignore
@@ -0,0 +1,2 @@
+*.pcap
+plat_mmap_vlan_ins
diff --git a/test/linux-generic/mmap_vlan_ins/Makefile.am 
b/test/linux-generic/mmap_vlan_ins/Makefile.am
new file mode 100644
index 000..2641556
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/test/Makefile.inc
+TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+
+dist_check_SCRIPTS = vlan.pcap \
+mmap_vlan_ins.sh \
+pktio_env
+
+test_SCRIPTS = $(dist_check_SCRIPTS)
+
+bin_PROGRAMS = plat_mmap_vlan_ins$(EXEEXT)
+plat_mmap_vlan_ins_LDFLAGS = $(AM_LDFLAGS) -static
+plat_mmap_vlan_ins_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example
+
+# Clonned from example odp_l2fwd simple
+dist_plat_mmap_vlan_ins_SOURCES = mmap_vlan_ins.c
diff --git a/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c 
b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
new file mode 100644
index 000..0682d2d
--- /dev/null
+++ b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c
@@ -0,0 +1,232 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define POOL_NUM_PKT 8192
+#define POOL_SEG_LEN 1856
+#define MAX_PKT_BURST 32
+#define MAX_WORKERS 1
+
+static int exit_thr;
+static int g_ret;
+
+struct {
+   odp_pktio_t if0, if1;
+   odp_pktin_queue_t if0in, if1in;
+   odp_pktout_queue_t if0out, if1out;
+   odph_ethaddr_t src, dst;
+} global;
+
+static void sig_handler(int signo ODP_UNUSED)
+{
+   printf("sig_handler!\n");
+   exit_thr = 1;
+}
+
+static odp_pktio_t create_pktio(const char *name, odp_pool_t pool,
+   odp_pktin_queue_t *pktin,
+   odp_pktout_queue_t *pktout)
+{
+   odp_pktio_param_t pktio_param;
+   odp_pktin_queue_param_t in_queue_param;
+   odp_pktout_queue_param_t out_queue_param;
+   odp_pktio_t pktio;
+
+   odp_pktio_param_init(_para

Re: [lng-odp] Deterministic Random Data in ODP

2016-11-02 Thread Maxim Uvarov
why random_r() can not be used for implementation?

On 2 November 2016 at 17:27, Bill Fischofer 
wrote:

> Background:
>
> The odp_random_data() API is currently being refined [1] to deprecate the
> confusing use_entropy parameter in favor of an enum (odp_random_kind_t)
> that specifies the kind of random data required. In conjunction with this
> it has been suggested that an additional API should be provided
> to allow applications to request repeatable deterministic random sequences
> for testing purposes.
> The new API might look something like:
>
> /**
>  * Generate repeatable random byte data
>  *
>  * For testing purposes it is often useful to generate "random" sequences
>  * that are repeatable. This is accomplished by supplying a seed value that
>  * is used for pseudo-random data generation. The caller provides
>  *
>  * @param[out]buf  Output buffer
>  * @param size Size of output buffer
>  * @param kind Specifies the type of random data required. Request
>  * will fail if the implementation is unable to provide
>  * repeatable random of the requested type. This is
>  * always true for true random and may be true for
>  * cryptographic random.
>  * @param[in,out] seed Seed value to use
> *
> * @return Number of bytes written
> * @retval <0 on failure
>  */
> int32_t odp_random_seeded_data(uint8_t *buf, int32_t size,
>   odp_random_kind_t kind, uint64_t *seed);
>
> Implementation:
>
> As with cryptography, it is a poor idea to attempt to "roll your own" when
> it comes to random number generation as this is a surprisingly difficult
> problem to get right [2]. The odp-linux implementation currently uses the
> OpenSSL library's RAND_bytes() API to generate cryptographic-quality
> pseudo-random data as part of the implementation of odp_random_data(),
> however OpenSSL has no APIs to generate repeatable random, so another
> algorithm is needed.
>
> Question:
>
> What open-source generator should odp-linux use? PCG [3] seems
> well-regarded and is Apache 2.0 licensed, which should be compatible with
> ODP's BSD 3-clause license. Another possibility
> is a direct import of FreeBSD's rand.c function [4], though this doesn't do
> exactly what we want and would need to be reworked.
>
> I'd like to solicit opinions and suggestions in this area.  Thanks.
>
> Bill
>
> -
> [1] http://patches.opendataplane.org/patch/7192/
> [2]
> https://nakedsecurity.sophos.com/2015/02/19/freebsd-and-
> the-yarnbug-more-trouble-at-the-random-number-mill/
> [3] http://www.pcg-random.org/
> [4] https://github.com/lattera/freebsd/blob/master/lib/libc/stdlib/rand.c
>


Re: [lng-odp] [RFC 1/4] timer: add odp_timer_pool_res()

2016-11-01 Thread Maxim Uvarov
_capabilities()  to match other functions.

On 25 October 2016 at 10:38, Brian Brooks  wrote:

> On 10/31 17:20:27, Bill Fischofer wrote:
> > I've added this to tomorrow's ODP call to discuss, however some general
> > comments:
> >
> > 1. These should be marked [RFC API-NEXT PATCH] so that Patchworks will
> pick
> > them up as patches. Without the PATCH keyword they just appear to be
> > comments on the list.
> >
> > 2. The short log should follow the CONTRIBUTING guidelines. In particular
> > these should be api: timer:  to flag that these are proposed
> > API changes.
>
> OK. I wasn't sure if 'api: ' prefix was needed since it includes
> implementation
> and test..
>
> > 3. APIs should be in a separate patch for their implementation to
> > facilitate review. Generally it's best to have a patch for API
> definition,
> > another for implementation, another for validation, and another for
> > documentation so that these functional areas can be considered
> individually.
>
> Since these 2 patches are extremely succinct (< 100 lines) I thought it
> was easiest for reviewers to see it in 2 patches instead of 8. I didn't
> check
> the docs for guidelines on this. Are these 2 patches candidates for
> breaking up
> into multiple patches?
>
> > On Mon, Oct 24, 2016 at 7:27 PM, Brian Brooks 
> > wrote:
> >
> > > Signed-off-by: Brian Brooks 
> > > ---
> > >  include/odp/api/spec/timer.h  | 9 +
> > >  platform/linux-generic/odp_timer.c| 5 +
> > >  test/common_plat/validation/api/timer/timer.c | 2 ++
> > >  3 files changed, 16 insertions(+)
> > >
> > > diff --git a/include/odp/api/spec/timer.h
> b/include/odp/api/spec/timer.h
> > > index 3f8fdd4..540da44 100644
> > > --- a/include/odp/api/spec/timer.h
> > > +++ b/include/odp/api/spec/timer.h
> > > @@ -191,6 +191,15 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,
> > > odp_timer_pool_info_t *info);
> > >
> > >  /**
> > > + * Get resolution from timer pool
> > > + *
> > > + * @param tpid Timer pool identifier
> > > + *
> > > + * @return Timeout resolution in nanoseconds
> > > + */
> > > +uint64_t odp_timer_pool_res(odp_timer_pool_t tpid);
> > >
> >
> > res is confusingly short here. Does it mean reserve?  restore? I'd prefer
> > odp_timer_pool_resolution()
>
> Agree. Went with 'res' to be consistent with 'res_ns' in timer pool params.
> I think updating rest of code would be a net win but also as a follow-up
> patch to this (or someone could submit a patch which would force me to
> rebase
> this one with updated naming!).
>
> > > +
> > > +/**
> > >   * Allocate a timer
> > >   *
> > >   * Create a timer (allocating all necessary resources e.g. timeout
> event)
> > > from
> > > diff --git a/platform/linux-generic/odp_timer.c
> > > b/platform/linux-generic/odp_timer.c
> > > index ee4c4c0..d4b30b2 100644
> > > --- a/platform/linux-generic/odp_timer.c
> > > +++ b/platform/linux-generic/odp_timer.c
> > > @@ -837,6 +837,11 @@ int odp_timer_pool_info(odp_timer_pool_t tpid,
> > > return 0;
> > >  }
> > >
> > > +uint64_t odp_timer_pool_res(odp_timer_pool_t tpid)
> > > +{
> > > +   return tpid->param.res_ns;
> > > +}
> > > +
> > >  uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid)
> > >  {
> > > return _odp_pri(tpid);
> > > diff --git a/test/common_plat/validation/api/timer/timer.c
> > > b/test/common_plat/validation/api/timer/timer.c
> > > index 0007639..a8321f3 100644
> > > --- a/test/common_plat/validation/api/timer/timer.c
> > > +++ b/test/common_plat/validation/api/timer/timer.c
> > > @@ -529,6 +529,8 @@ void timer_test_odp_timer_all(void)
> > > CU_ASSERT(tpinfo.param.max_tmo == MAX);
> > > CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
> > >
> > > +   CU_ASSERT(odp_timer_pool_res(tp) == RES);
> > > +
> > > LOG_DBG("Timer pool handle: %" PRIu64 "\n",
> > > odp_timer_pool_to_u64(tp));
> > > LOG_DBG("#timers..: %u\n", NTIMERS);
> > > LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS,
> > > --
> > > 2.10.1
> > >
> > >
>


Re: [lng-odp] [PATCHv2] linux-generic: add vlan insertion test

2016-11-01 Thread Maxim Uvarov
On 1 November 2016 at 12:43, Christophe Milard <christophe.mil...@linaro.org
> wrote:

> On 31 October 2016 at 20:53, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> > Use vlan tagged traffic for example validation test
> > to add code coverage for pkt_mmap_vlan_insert() internal
> > function.
> >
> > Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
> > ---
> >  v2: update to current master.
> >
> >  test/common_plat/validation/api/.gitignore |   1 +
> >  test/linux-generic/Makefile.am |   5 
> >  test/linux-generic/m4/configure.m4 |   1 +
> >  test/linux-generic/pktio/Makefile.am   |   4 +++
> >  test/linux-generic/pktio/pktio_run_vlan.sh |  46
> +
> >  test/linux-generic/pktio/vlan.pcap | Bin 0 -> 9728 bytes
> >  6 files changed, 57 insertions(+)
> >  create mode 100644 test/linux-generic/pktio/Makefile.am
> >  create mode 100755 test/linux-generic/pktio/pktio_run_vlan.sh
> >  create mode 100644 test/linux-generic/pktio/vlan.pcap
> >
> > diff --git a/test/common_plat/validation/api/.gitignore
> b/test/common_plat/validation/api/.gitignore
> > index 7e563b8..5f75e14 100644
> > --- a/test/common_plat/validation/api/.gitignore
> > +++ b/test/common_plat/validation/api/.gitignore
> > @@ -1,2 +1,3 @@
> >  *.log
> >  *.trs
> > +*.pcap
> > diff --git a/test/linux-generic/Makefile.am
> b/test/linux-generic/Makefile.am
>
> Why is this test platform specific? are we doing the same as for IPC,
> here, i.e. adding linux-only functions?.
> Which is raising -again- the problem if platform vs OS difference...
> is platform specific the same as linux specific?
> I am not sure it is a good idea to continue having specific APIs for,
> linux-gen: Why can't we agree to have pcap support on all platforms?
> We already had a specific case for IPC, and it did not turn create
> concensus.
>
> > index 4660cf0..c926c1f 100644
> > --- a/test/linux-generic/Makefile.am
> > +++ b/test/linux-generic/Makefile.am
> > @@ -37,11 +37,16 @@ TESTS = validation/api/pktio/pktio_run.sh \
> >
> >  SUBDIRS += validation/api/pktio\
> >validation/api/shmem\
> > +  pktio\
>
> The logic would be to have all platform specific (if this is regarded
> a such) pktio tests under pktio. But if you have pktio_ipc, why would
> this one be oktio only?
>
> >pktio_ipc\
> >ring
> >
> >  if HAVE_PCAP
> >  TESTS += validation/api/pktio/pktio_run_pcap.sh
> > +if test_example
>
> Why "if test_example"? this is not the example directory!
>
> > +TESTS += pktio/pktio_run_vlan.sh
> > +SUBDIRS += pktio
> > +endif
> >  endif
> >  if netmap_support
> >  TESTS += validation/api/pktio/pktio_run_netmap.sh
> > diff --git a/test/linux-generic/m4/configure.m4 b/test/linux-generic/m4/
> configure.m4
> > index 6b92201..7793b84 100644
> > --- a/test/linux-generic/m4/configure.m4
> > +++ b/test/linux-generic/m4/configure.m4
> > @@ -3,6 +3,7 @@ m4_include([test/linux-generic/m4/performance.m4])
> >  AC_CONFIG_FILES([test/linux-generic/Makefile
> >  test/linux-generic/validation/api/shmem/Makefile
> >  test/linux-generic/validation/api/pktio/Makefile
> > +test/linux-generic/pktio/Makefile
> >  test/linux-generic/pktio_ipc/Makefile
> >  test/linux-generic/ring/Makefile
> >  test/linux-generic/performance/Makefile])
> > diff --git a/test/linux-generic/pktio/Makefile.am
> b/test/linux-generic/pktio/Makefile.am
> > new file mode 100644
> > index 000..978ca27
> > --- /dev/null
> > +++ b/test/linux-generic/pktio/Makefile.am
> > @@ -0,0 +1,4 @@
> > +dist_check_SCRIPTS = vlan.pcap\
> > +pktio_run_vlan.sh
> > +
> > +test_SCRIPTS = $(dist_check_SCRIPTS)
> > diff --git a/test/linux-generic/pktio/pktio_run_vlan.sh
> b/test/linux-generic/pktio/pktio_run_vlan.sh
> > new file mode 100755
> > index 000..b12e488
> > --- /dev/null
> > +++ b/test/linux-generic/pktio/pktio_run_vlan.sh
> > @@ -0,0 +1,46 @@
> > +#!/bin/sh
> > +#
> > +# Copyright (c) 2016, Linaro Limited
> > +# All rights reserved.
> > +#
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +#
> > +
> > +#
> > +# This test is intend to test pkt_mmap_vlan_insert() feature for
> > +# linux-generic packet mmap pktio.
> > +#
> > +#
> > +
> > +# any parameter passed as 

[lng-odp] [PATCHv2] linux-generic: add vlan insertion test

2016-10-31 Thread Maxim Uvarov
Use vlan tagged traffic for example validation test
to add code coverage for pkt_mmap_vlan_insert() internal
function.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 v2: update to current master.

 test/common_plat/validation/api/.gitignore |   1 +
 test/linux-generic/Makefile.am |   5 
 test/linux-generic/m4/configure.m4 |   1 +
 test/linux-generic/pktio/Makefile.am   |   4 +++
 test/linux-generic/pktio/pktio_run_vlan.sh |  46 +
 test/linux-generic/pktio/vlan.pcap | Bin 0 -> 9728 bytes
 6 files changed, 57 insertions(+)
 create mode 100644 test/linux-generic/pktio/Makefile.am
 create mode 100755 test/linux-generic/pktio/pktio_run_vlan.sh
 create mode 100644 test/linux-generic/pktio/vlan.pcap

diff --git a/test/common_plat/validation/api/.gitignore 
b/test/common_plat/validation/api/.gitignore
index 7e563b8..5f75e14 100644
--- a/test/common_plat/validation/api/.gitignore
+++ b/test/common_plat/validation/api/.gitignore
@@ -1,2 +1,3 @@
 *.log
 *.trs
+*.pcap
diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am
index 4660cf0..c926c1f 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -37,11 +37,16 @@ TESTS = validation/api/pktio/pktio_run.sh \
 
 SUBDIRS += validation/api/pktio\
   validation/api/shmem\
+  pktio\
   pktio_ipc\
   ring
 
 if HAVE_PCAP
 TESTS += validation/api/pktio/pktio_run_pcap.sh
+if test_example
+TESTS += pktio/pktio_run_vlan.sh
+SUBDIRS += pktio
+endif
 endif
 if netmap_support
 TESTS += validation/api/pktio/pktio_run_netmap.sh
diff --git a/test/linux-generic/m4/configure.m4 
b/test/linux-generic/m4/configure.m4
index 6b92201..7793b84 100644
--- a/test/linux-generic/m4/configure.m4
+++ b/test/linux-generic/m4/configure.m4
@@ -3,6 +3,7 @@ m4_include([test/linux-generic/m4/performance.m4])
 AC_CONFIG_FILES([test/linux-generic/Makefile
 test/linux-generic/validation/api/shmem/Makefile
 test/linux-generic/validation/api/pktio/Makefile
+test/linux-generic/pktio/Makefile
 test/linux-generic/pktio_ipc/Makefile
 test/linux-generic/ring/Makefile
 test/linux-generic/performance/Makefile])
diff --git a/test/linux-generic/pktio/Makefile.am 
b/test/linux-generic/pktio/Makefile.am
new file mode 100644
index 000..978ca27
--- /dev/null
+++ b/test/linux-generic/pktio/Makefile.am
@@ -0,0 +1,4 @@
+dist_check_SCRIPTS = vlan.pcap\
+pktio_run_vlan.sh
+
+test_SCRIPTS = $(dist_check_SCRIPTS)
diff --git a/test/linux-generic/pktio/pktio_run_vlan.sh 
b/test/linux-generic/pktio/pktio_run_vlan.sh
new file mode 100755
index 000..b12e488
--- /dev/null
+++ b/test/linux-generic/pktio/pktio_run_vlan.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+#
+# This test is intend to test pkt_mmap_vlan_insert() feature for
+# linux-generic packet mmap pktio.
+#
+#
+
+# any parameter passed as arguments to this script is passed unchanged to
+# the test itself (pktio_main)
+
+# directories where pktio_main binary can be found:
+# -in the validation dir when running make check (intree or out of tree)
+# -in the script directory, when running after 'make install', or
+# -in the validation when running standalone intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/pktio:$PATH
+PATH=$(dirname $0):$PATH
+PATH=../../example/packet:$PATH
+PATH=../../../_inst/bin:$PATH
+PATH=.:$PATH
+
+odp_pktio_path=$(which odp_pktio${EXEEXT})
+if [ -x "$odp_pktio_path" ] ; then
+   echo "running with $odp_pktio_path"
+else
+   pwd
+   echo $PATH
+   echo "cannot find odp_pktio${EXEEXT}: please set you PATH for it."
+   exit 1
+fi
+
+PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit`
+echo "using PCAP_IN = ${PCAP_IN}"
+PCAP_OUT=vlan_out.pcap
+odp_pktio${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 1 -m 0
+ret=$?
+rm -f ${PCAP_OUT}
+exit $ret
diff --git a/test/linux-generic/pktio/vlan.pcap 
b/test/linux-generic/pktio/vlan.pcap
new file mode 100644
index 
..106ccb682e51495b4025337518a0bce63c2c7681
GIT binary patch
literal 9728
zcmeHNeQXrR6@R<F^Iq)3b|{=(C16{8IUt}71RM^-2~wIU*pOl>ikyh3QAN~9xK+}$
z4T)^-QnlAgC4W>Yk*X>mRlo92km}Nw!c|oiNTn)LBLcyK0BKSYLZiA0xI}f|@6FEc
z}Zu4i?dS2hYnK$pf`MuxF}9(>lN6zOYfipb#)S3BqRK6jeva#{)P%KZ4H
z2`Z!uf1f`})Rm#nP-l2Nx8d?iyv8ohr8v56pV)=ly+yzZvNmzS?$(tvQ({
zN`3H(bKv=xSCLCcs6x0O=6jaXv{mjz%{=NyEc#gk|LwB0u=KHqz1)uIAM9Usn@mg_
zk2Z3jR&?;MUcTp8vTSb+>k8B@8d$;SEO~No<@;@ZpT?k%M|X%lk9|?s`aqYWyx8+Z
z0ekoid$_k!Cq3-<X$<;!oI~ik=uuzyOrT5ATGkaPBO2JlXV}BNmHltQH1XBQqGIxB
zljw+U^mWzt`dC-+XBzhK8TN2Tj(!$l@3W%oreFHHd@xpu)``6eKOy$gmCxBdp4?km
zcOk;wono&

Re: [lng-odp] [PATCHv2] linux-gen: crypto: fix aes gcm decryption

2016-10-31 Thread Maxim Uvarov
On 31 October 2016 at 17:51, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

> We should first initialize, then set up decryption
> and only then push blocks for decryption.
> https://bugs.linaro.org/show_bug.cgi?id=2571
>
> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
> ---
>  v2: clear reworking
>
>
rewording :)



>  btw, it was tested here:
>  https://s3.amazonaws.com/archive.travis-ci.org/jobs/171998583/log.txt
>
>  platform/linux-generic/odp_crypto.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/odp_crypto.c
> b/platform/linux-generic/odp_crypto.c
> index c7431e6..9e09d42 100644
> --- a/platform/linux-generic/odp_crypto.c
> +++ b/platform/linux-generic/odp_crypto.c
> @@ -398,6 +398,8 @@ odp_crypto_alg_err_t 
> aes_gcm_decrypt(odp_crypto_op_params_t
> *params,
>
> EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_enc);
>
> +   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
> +
> /* Authenticate header data (if any) without encrypting them */
> if (aad_head < cipherdata) {
> EVP_DecryptUpdate(ctx, NULL, _len,
> @@ -414,8 +416,6 @@ odp_crypto_alg_err_t 
> aes_gcm_decrypt(odp_crypto_op_params_t
> *params,
>   auth_len - (aad_tail - aad_head));
> }
>
> -   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
> -
> if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, _len)
> < 0)
> return ODP_CRYPTO_ALG_ERR_ICV_CHECK;
>
> --
> 2.7.1.250.gff4ea60
>
>


[lng-odp] [PATCHv2] linux-gen: crypto: fix aes gcm decryption

2016-10-31 Thread Maxim Uvarov
We should first initialize, then set up decryption
and only then push blocks for decryption.
https://bugs.linaro.org/show_bug.cgi?id=2571

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 v2: clear reworking

 btw, it was tested here:
 https://s3.amazonaws.com/archive.travis-ci.org/jobs/171998583/log.txt

 platform/linux-generic/odp_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index c7431e6..9e09d42 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -398,6 +398,8 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_params_t 
*params,
 
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_enc);
 
+   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
+
/* Authenticate header data (if any) without encrypting them */
if (aad_head < cipherdata) {
EVP_DecryptUpdate(ctx, NULL, _len,
@@ -414,8 +416,6 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_params_t 
*params,
  auth_len - (aad_tail - aad_head));
}
 
-   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
-
if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, _len) < 0)
return ODP_CRYPTO_ALG_ERR_ICV_CHECK;
 
-- 
2.7.1.250.gff4ea60



[lng-odp] [PATCH] linux-gen: crypto: fix aes gcm decryption

2016-10-31 Thread Maxim Uvarov
We should first initialize, then set up decryption also
and only then push blocks for decryption.
https://bugs.linaro.org/show_bug.cgi?id=2571

Signed-off-by: Max Uvarov <muva...@gmail.com>
Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 platform/linux-generic/odp_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index c7431e6..9e09d42 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -398,6 +398,8 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_params_t 
*params,
 
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_enc);
 
+   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
+
/* Authenticate header data (if any) without encrypting them */
if (aad_head < cipherdata) {
EVP_DecryptUpdate(ctx, NULL, _len,
@@ -414,8 +416,6 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_params_t 
*params,
  auth_len - (aad_tail - aad_head));
}
 
-   EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag);
-
if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, _len) < 0)
return ODP_CRYPTO_ALG_ERR_ICV_CHECK;
 
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH v2 2/2] add travis.yml for gitub automation

2016-10-31 Thread Maxim Uvarov

will send a fix in few minutes :)

Maxim.

On 10/31/16 17:18, Maxim Uvarov wrote:
I did test if the latest 1.1.1-dev ssl from github (master branch for 
today). And the same tests fail.

Log is attached.

Maxim.



On 10/28/16 19:24, Mike Holmes wrote:



On 28 October 2016 at 10:16, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Mike,

all crypto tests failed for me. On laptop I have "Version:
1.0.1f-1ubuntu2.19" which is about the same as Travis uses.
Do you see the same errors?


Yes, the travis is working perfectly and has found an issue already :)

My run just now 
https://travis-ci.org/mike-holmes-linaro/odp/builds/171432977


I expect it to fail often becasue without the  capability structs 
being implemented and used properly our tests expect too much of the 
HW when run in the cloud, but this is something else it appears


Our Jenkins nightly from yesterday sees no issue

https://ci.linaro.org/view/odp-ci/job/odp-api-check/ARCH=x86-64,label=docker-jessie-amd64,pktio=none/882/console 



*19:50:10* PASS: 
../../test/common_plat/validation/api/cpumask/cpumask_main




Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.38 [1,581 kB]

Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl1.0.0 amd64 1.0.1-4ubuntu5.38 [1,055 kB]



  Test: crypto_test_dec_alg_aes128_gcm ...FAILED

1.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

  Test: crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED

1.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

Test: crypto_test_dec_alg_aes128_gcm ...FAILED Test:
crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED


Maxim.




On 10/21/16 21:40, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically
trigger CI builds

Signed-off-by: Mike Holmes <mike.hol...@linaro.org
<mailto:mike.hol...@linaro.org>>
---
  .travis.yml | 35 +++
  1 file changed, 35 insertions(+)
  create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0d1add3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+language: c
+compiler: clang
+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool
libssl-dev graphviz mscgen doxygen
+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro
version is too old and fails C99 compile
+- export CUNIT_VERSION=2.1-3
+- curl -sSOL
http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2
<http://sourceforge.net/projects/cunit/files/CUnit/$%7BCUNIT_VERSION%7D/CUnit-$%7BCUNIT_VERSION%7D.tar.bz2>
+- tar -jxf *.bz2
+- cd CUnit*
+- ./bootstrap
+- ./configure --enable-debug --enable-automated
--enable-basic --enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
+- ./configure --enable-test-cpp --en

Re: [lng-odp] [API-NEXT PATCHv6 05/13] api: shm: add flags to shm_reserve and function to find external mem

2016-10-31 Thread Maxim Uvarov

Petri,

please review API patch.


On 10/31/16 11:52, Christophe Milard wrote:

The ODP_SHM_SINGLE_VA flag is created: when set (at odp_shm_reserve()),
this flag guarantees that all ODP threads sharing this memory
block will see the block at the same address (regadless of ODP
thread type -pthread vs process- or fork time)

The flag ODP_SHM_EXPORT is added: when passed at odp_shm_reserve() time
the memory block becomes visible to other ODP instances.
The function odp_shm_find_exported() is added: this function enables to
reserve block of memories exported by other ODP instances (using the
ODP_SHM_EXPORT flag).

Signed-off-by: Christophe Milard 
---
  include/odp/api/spec/shared_memory.h | 38 +++-
  1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/include/odp/api/spec/shared_memory.h 
b/include/odp/api/spec/shared_memory.h
index 8c76807..80cc143 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -14,6 +14,7 @@
  #ifndef ODP_API_SHARED_MEMORY_H_
  #define ODP_API_SHARED_MEMORY_H_
  #include 
+#include 
  
  #ifdef __cplusplus

  extern "C" {
@@ -43,12 +44,25 @@ extern "C" {
  #define ODP_SHM_NAME_LEN 32
  
  /*

- * Shared memory flags
+ * Shared memory flags:
   */
-
-/* Share level */
-#define ODP_SHM_SW_ONLY 0x1 /**< Application SW only, no HW access */
-#define ODP_SHM_PROC0x2 /**< Share with external processes */
+#define ODP_SHM_SW_ONLY0x1 /**< Application SW only, no HW 
access   */
+#define ODP_SHM_PROC   0x2 /**< Share with external processes   */
+/**
+ * Single virtual address
+ *
+ * When set, this flag guarantees that all ODP threads sharing this
+ * memory block will see the block at the same address - regardless
+ * of ODP thread type (e.g. pthread vs. process (or fork process time)).
+ */
+#define ODP_SHM_SINGLE_VA  0x4
+/**
+ * Export memory
+ *
+ * When set, the memory block becomes visible to other ODP instances
+ * through odp_shm_find_exported().
+ */
+#define ODP_SHM_EXPORT 0x08
  
  /**

   * Shared memory block info
@@ -135,6 +149,20 @@ int odp_shm_free(odp_shm_t shm);
   */
  odp_shm_t odp_shm_lookup(const char *name);
  
+/**

+ * Get and reserve a block of shared memory, exported by another ODP instance
+ *
+ * @param remote_name  Name of the block, in the remote ODP instance
+ * @param odp_inst Remote ODP instance, as returned by odp_init_global()
+ * @param local_name   Name given to the block, in the local ODP instance
+ *(or NULL, if the application doesn't care)
+ *
+ * @return A new handle to the block if it is found (must be freed when done).
+ * @retval ODP_SHM_INVALID on failure
+ */
+odp_shm_t odp_shm_find_exported(const char *remote_name,
+   odp_instance_t odp_inst,
+   const char *local_name);
  

I might lost some discussion. But for now it looks like we can
extend odp_shm_lookup() with that arguments. I.e. if odp_inst = 0,
local look up will be done.

Maxim.


  /**
   * Shared memory block address




Re: [lng-odp] [PATCH v2 2/2] add travis.yml for gitub automation

2016-10-28 Thread Maxim Uvarov

On 10/28/16 19:24, Mike Holmes wrote:



On 28 October 2016 at 10:16, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Mike,

all crypto tests failed for me. On laptop I have "Version:
1.0.1f-1ubuntu2.19" which is about the same as Travis uses.
Do you see the same errors?


Yes, the travis is working perfectly and has found an issue already :)

My run just now 
https://travis-ci.org/mike-holmes-linaro/odp/builds/171432977


I expect it to fail often becasue without the  capability structs 
being implemented and used properly our tests expect too much of the 
HW when run in the cloud, but this is something else it appears




In general it has not fail and aes128_gcm has to be implemented in 
software if hardware does not support test.

I think we need a little bit dig into issue before committing this change.

Maxim.



Our Jenkins nightly from yesterday sees no issue

https://ci.linaro.org/view/odp-ci/job/odp-api-check/ARCH=x86-64,label=docker-jessie-amd64,pktio=none/882/console

*19:50:10* PASS: ../../test/common_plat/validation/api/cpumask/cpumask_main



Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.38 [1,581 kB]

Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu/
<http://us-central1.gce.archive.ubuntu.com/ubuntu/>
precise-updates/main libssl1.0.0 amd64 1.0.1-4ubuntu5.38 [1,055 kB]



  Test: crypto_test_dec_alg_aes128_gcm ...FAILED

1.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

  Test: crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED

1.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

2.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

3.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

4.

../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181
- !memcmp(data_addr, ciphertext, ciphertext_len)

Test: crypto_test_dec_alg_aes128_gcm ...FAILED Test:
crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED


Maxim.




On 10/21/16 21:40, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically
trigger CI builds

Signed-off-by: Mike Holmes <mike.hol...@linaro.org
<mailto:mike.hol...@linaro.org>>
---
  .travis.yml | 35 +++
  1 file changed, 35 insertions(+)
  create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0d1add3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+language: c
+compiler: clang
+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool
libssl-dev graphviz mscgen doxygen
+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro
version is too old and fails C99 compile
+- export CUNIT_VERSION=2.1-3
+- curl -sSOL

http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2

<http://sourceforge.net/projects/cunit/files/CUnit/$%7BCUNIT_VERSION%7D/CUnit-$%7BCUNIT_VERSION%7D.tar.bz2>
+- tar -jxf *.bz2
+- cd CUnit*
+- ./bootstrap
+- ./configure --enable-debug --enable-automated
--enable-basic --enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
 

Re: [lng-odp] driver test autotools issue

2016-10-28 Thread Maxim Uvarov

On 10/28/16 16:58, Christophe Milard wrote:

Hi,

The ODP driver development is does not progress due to an autotool
problem to which I didn't find any nice solution:

INTRODUCTION:

ODP will be given the possibility to "include" user space NIC drivers.
By "include", I mean either staticaly linked or dlopen()'d. I wish
Both methods to be supported.
The same driver should be loadable both ways (simply said for linux, a
driverX.a and driverX.so should be built from driverX.c). Many drivers
might be loaded at the same time (for different NICs).

Because many drivers might be loaded at the same time, no
'known-symbol' can be exported by the driver to ODP to perform its
initialisation: defining a driver_init() function in all drivers (that
ODP could call) would result in double definition of driver_init() as
soon as more than one driver is loaded.


For dynamic loading dl_open("drv-arm.so);  sym = dl_sym("drv_init"); it 
has to work.


For static obviously you need ifdef that with some prefix and add 
reference somewhere

in odp to initialization functions.




Defining a driverX_init() in each driver would require ODP to know the
list of driver in advance, which is simply not acceptable.


Two options:

1. Strict name or  name template. Like your "driverX_init()", where in X 
decoded name of the driver.
Then on open you walk over all symbols and find which one matches your 
template. To walk you use

dlinfo():
http://man7.org/linux/man-pages/man3/dlinfo.3.html

2.  As you said previously " Initialization and finalization functions"
http://man7.org/linux/man-pages/man3/dlopen.3.html
Especially:

"""

A shared object may export multiple constructors and
   destructors, and priorities can be associated with each function to
   determine the order in which they are executed.

"""

can allow you to link all initialization things in right order.


So the drivers should use a private "startup" function to perform
their initialization. By this I mean a function that is put in the
.init section or a function on which the __constructor__ gcc attribute
has been applied, i.e. a function that gets called automatically at
init time.


yes.



ODP (the main lib) would then export an odp_driver_register() function
which would be called by each registering driver from its startup
function.
Nothing special so far.
just note that the driver is using an interface exported by ODP.


Function to load and register all drivers can be inside 
odp_global_init() or _odp_pktio_init().
Or inside odp_pktio_open(). Drivers just provide you interface functions 
which are called inside
odp_init_global(). No reason to export function inside odplib. (If I 
correctly understand your statement

here.).


The problem is to write autotools tests to test the driver. Each test
should include a test main program linked to ODP, and test-driver,
test_xxx_driver.la.
The test should load the driver (or be staticaly linked to it before running).
Being able to test both "loading" ways would be great, but at this
stage, I would be very pleased to succeed with one way (static linking
or "dlopen")...
The driver should initialize as described above.
These tests should be passing make check, distcheck, out of tree build...
And should be OS independent (no hack to tune LD_LIBRARY_PATH which
would assume linux)


Ok.




LINKING STATICALLY:

Regarding statically linking, I reached a dead-end (I feel) as I could
not affect the order in which the libs are passed to the linker by
autotools. Autotools would pass  the test program and the ODP lib
before the driver lib, hence assuming that the driver would define
symbols used by {ODP+test}. But  we have the reverse situation, as we
know. If the linker has options to handle this situation
(--start-group, whole archive), it feels that autotools cannot handle
them.

As I remember priority of targets separated with "-". Like
TARGET = "a b - c d"

and on make -j 4,  it will build a and b, and only then c and d.



You can refer to the following mail,
http://lists.gnu.org/archive/html/automake/2016-10/msg0.html
which I sent on the automake mailing list. The mail includes another
link that I suggest you should follow, if any of you would feel like
investigating this track.

My current branch if you wish something to play with:
https://git.linaro.org/people/christophe.milard/odp.git/shortlog/refs/heads/drv_init_autohell_static_fail_v0.0


I will try to take a look.


DYNAMIC LINKING

The other approach is to use dynamic linking: Not linking at program
start, but really linking at run-time using dl_open(): This is really
what is going to happen (application may ask to load specific
drivers), so probably, it is not a too bad approach!

But, it seems to be hard to get autotools to know what should be
loaded (in a platform independent way)  and the path to it, as it
varies for different cases (make check, distcheck, VPATH...): *.so
files are naturally hidden by autotools (behind *.la), and autotools
does not provide 

Re: [lng-odp] [PATCH v2 2/2] add travis.yml for gitub automation

2016-10-28 Thread Maxim Uvarov

Mike,

all crypto tests failed for me. On laptop I have "Version: 
1.0.1f-1ubuntu2.19" which is about the same as Travis uses.

Do you see the same errors?

Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu/ 
precise-updates/main libssl-dev amd64 1.0.1-4ubuntu5.38 [1,581 kB]


Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu/ 
precise-updates/main libssl1.0.0 amd64 1.0.1-4ubuntu5.38 [1,055 kB]




  Test: crypto_test_dec_alg_aes128_gcm ...FAILED

1. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


2. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


3. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


4. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


  Test: crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED

1. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


2. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


3. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


4. 
../../../../../../test/common_plat/validation/api/crypto/odp_crypto_test_inp.c:181 
- !memcmp(data_addr, ciphertext, ciphertext_len)


Test: crypto_test_dec_alg_aes128_gcm ...FAILED Test: 
crypto_test_dec_alg_aes128_gcm_ovr_iv ...FAILED



Maxim.



On 10/21/16 21:40, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically trigger CI builds

Signed-off-by: Mike Holmes 
---
  .travis.yml | 35 +++
  1 file changed, 35 insertions(+)
  create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0d1add3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+# Copyright (c) 2016, Linaro Limited
+# All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+
+
+language: c
+compiler: clang
+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool libssl-dev graphviz 
mscgen doxygen
+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro version is too 
old and fails C99 compile
+- export CUNIT_VERSION=2.1-3
+- curl -sSOL 
http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2
+- tar -jxf *.bz2
+- cd CUnit*
+- ./bootstrap
+- ./configure --enable-debug --enable-automated --enable-basic 
--enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
+- ./configure --enable-test-cpp --enable-test-vald 
--enable-test-helper --enable-test-perf --enable-user-guides 
--enable-test-perf-proc --enable-test-example
+- make check
+- make doxygen-doc
+- make distcheck




Re: [lng-odp] [PATCH] example: l3fwd: prevent possible use of uninitialised variables

2016-10-28 Thread Maxim Uvarov

Merged,
Maxim.

On 10/27/16 17:04, Bill Fischofer wrote:

On Thu, Oct 27, 2016 at 8:42 AM, Matias Elo  wrote:


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

Signed-off-by: Matias Elo 


Reviewed-by: Bill Fischofer 



---
  example/l3fwd/odp_l3fwd.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c
index fa1b299..8919bd3 100644
--- a/example/l3fwd/odp_l3fwd.c
+++ b/example/l3fwd/odp_l3fwd.c
@@ -309,7 +309,9 @@ static int run_worker(void *arg)
 }
 }

-   num_pktio = thr_arg->nb_pktio;
+   if (num_pktio == 0)
+   LOG_ABORT("No pktio devices found\n");
+
 if_idx = input_ifs[pktio];
 inq = input_queues[pktio];

--
2.7.4






Re: [lng-odp] [PATCH 1/2] test: perf: add new ordered pktio application

2016-10-27 Thread Maxim Uvarov

On 10/27/16 16:51, Elo, Matias (Nokia - FI/Espoo) wrote:

Ping.



On 11 Oct 2016, at 16:21, Matias Elo  wrote:

Add new test application for ordered queue functionality and performance
validation. The application sets sequence numbers to incoming packets using
ordered pktin queues and ordered context locks. After being tagged packets
are enqueued to atomic queues based on flow hash (IPv4 5-tuple). In atomic
flow processing the sequence number is validated and packet is sent to
selected output interface.

Main options:
-m: Input queue type can be changed to atomic or parallel to enable easy
performance comparison. With parallel input queues the packet order is
not maintained.
-r: Number of input queues per interface
-f: Number of atomic flow queues per interface
-e: Number of extra input processing rounds. This can be used to simulate
"fat pipe" traffic processing.

Signed-off-by: Matias Elo 
---
test/common_plat/performance/.gitignore  |1 +
test/common_plat/performance/Makefile.am |7 +-
test/common_plat/performance/dummy_crc.h |  493 
test/common_plat/performance/odp_pktio_ordered.c | 1331 ++
4 files changed, 1831 insertions(+), 1 deletion(-)
create mode 100644 test/common_plat/performance/dummy_crc.h
create mode 100644 test/common_plat/performance/odp_pktio_ordered.c

diff --git a/test/common_plat/performance/.gitignore 
b/test/common_plat/performance/.gitignore
index 1527d25..8bb18f5 100644
--- a/test/common_plat/performance/.gitignore
+++ b/test/common_plat/performance/.gitignore
@@ -3,6 +3,7 @@
odp_atomic
odp_crypto
odp_l2fwd
+odp_pktio_ordered
odp_pktio_perf
odp_sched_latency
odp_scheduling
diff --git a/test/common_plat/performance/Makefile.am 
b/test/common_plat/performance/Makefile.am
index f184609..790ddae 100644
--- a/test/common_plat/performance/Makefile.am
+++ b/test/common_plat/performance/Makefile.am
@@ -5,6 +5,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
EXECUTABLES = odp_crypto$(EXEEXT) odp_pktio_perf$(EXEEXT)

COMPILE_ONLY = odp_l2fwd$(EXEEXT) \
+  odp_pktio_ordered$(EXEEXT) \
   odp_sched_latency$(EXEEXT) \
   odp_scheduling$(EXEEXT)

@@ -22,15 +23,19 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)

odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static
odp_crypto_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
+odp_pktio_ordered_LDFLAGS = $(AM_LDFLAGS) -static
+odp_pktio_ordered_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
odp_sched_latency_LDFLAGS = $(AM_LDFLAGS) -static
odp_sched_latency_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test

noinst_HEADERS = \
- $(top_srcdir)/test/test_debug.h
+ $(top_srcdir)/test/test_debug.h \
+ dummy_crc.h

dist_odp_crypto_SOURCES = odp_crypto.c
+dist_odp_pktio_ordered_SOURCES = odp_pktio_ordered.c
dist_odp_sched_latency_SOURCES = odp_sched_latency.c
dist_odp_scheduling_SOURCES = odp_scheduling.c
dist_odp_pktio_perf_SOURCES = odp_pktio_perf.c
diff --git a/test/common_plat/performance/dummy_crc.h 
b/test/common_plat/performance/dummy_crc.h
new file mode 100644
index 000..38da444
--- /dev/null
+++ b/test/common_plat/performance/dummy_crc.h
@@ -0,0 +1,493 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in
+ *   the documentation and/or other materials provided with the
+ *   distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, 

Re: [lng-odp] [PATCH 1/2] test: perf: add new ordered pktio application

2016-10-27 Thread Maxim Uvarov

On 10/27/16 16:51, Elo, Matias (Nokia - FI/Espoo) wrote:

+  "Usage: %s OPTIONS\n"
>+  "  E.g. %s -i eth0,eth1 -t 1\n"
>+  " In the above example,\n"
>+  " eth0 will send pkts to eth1 and vice versa\n"
>+  " eth2 will send pkts to eth3 and vice versa\n"
>+  "\n"

that need to be corrected.

Maxim.


Re: [lng-odp] [PATCH] linux-generic: packet: add fall through comments to parser

2016-10-27 Thread Maxim Uvarov

On 10/27/16 10:56, Elo, Matias (Nokia - FI/Espoo) wrote:

Reviewed-by: Matias Elo 


On 26 Oct 2016, at 15:47, Bill Fischofer  wrote:

Address bug https://bugs.linaro.org/show_bug.cgi?id=2565 by adding
comments to the parser's switch statement to document the fact that
fall through is intentional.

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

diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 714794a..e43636b 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1182,6 +1182,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,

switch (prs->parsed_layers) {
case LAYER_NONE:
+   /* Fall through */


indent here is 1 tab from 'case' in over 2 cases it's the same. Please 
make code look more nice with

same indent level.

Maxim.

+
case LAYER_L2:
{
const _odp_ethhdr_t *eth;
@@ -1254,6 +1256,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L2)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L3:
{
offset = prs->l3_offset;
@@ -1292,6 +1296,8 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
if (layer == LAYER_L3)
return prs->error_flags.all != 0;
}
+   /* Fall through */
+
case LAYER_L4:
{
offset = prs->l4_offset;
@@ -1341,6 +1347,7 @@ int packet_parse_common(packet_parser_t *prs, const 
uint8_t *ptr,
prs->parsed_layers = LAYER_L4;
break;
}
+
case LAYER_ALL:
break;

--
2.7.4





[lng-odp] [PATCH] linux-gen: sysinfo: check for overflow

2016-10-27 Thread Maxim Uvarov
In near future cpu mhz more likely will not overflow 64
bit value, but it makes sense to add  assert for
overflow check.
https://bugs.linaro.org/show_bug.cgi?id=2425

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
index 96127ec..5aefd81 100644
--- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c
@@ -5,7 +5,9 @@
  */
 
 #include 
+#include 
 #include 
+#include 
 
 int cpuinfo_parser(FILE *file, system_info_t *sysinfo)
 {
@@ -68,8 +70,11 @@ uint64_t odp_cpu_hz_current(int id)
}
 
fclose(file);
-   if (mhz)
+   if (mhz) {
+   /* check for overflow */
+   ODP_ASSERT((ULLONG_MAX / 100) > mhz);
return (uint64_t)(mhz * 100.0);
+   }
 
return 0;
 }
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH] linux-generic: config: add missing doxygen documentation for abi macros

2016-10-27 Thread Maxim Uvarov

Merged,
Maxim.

On 10/19/16 18:01, Mike Holmes wrote:

On 19 October 2016 at 08:09, Bill Fischofer  wrote:

Fix Bug https://bugs.linaro.org/show_bug.cgi?id=2553 by adding missing
doxygen documentation for the internal macros ODP_ABI_COMPAT and _STATIC.

Signed-off-by: Bill Fischofer 

Reviewed-by: Mike Holmes 



---
  .../linux-generic/include/odp/api/plat/static_inline.h.in | 11 +++
  1 file changed, 11 insertions(+)

diff --git a/platform/linux-generic/include/odp/api/plat/static_inline.h.in 
b/platform/linux-generic/include/odp/api/plat/static_inline.h.in
index acee5f3..4562a22 100644
--- a/platform/linux-generic/include/odp/api/plat/static_inline.h.in
+++ b/platform/linux-generic/include/odp/api/plat/static_inline.h.in
@@ -17,6 +17,17 @@
  extern "C" {
  #endif

+/**
+ * @internal
+ * @def ODP_ABI_COMPAT
+ * Control ABI compatibility
+ */
+
+/**
+ * @internal
+ * @def _STATIC
+ * Control conditional static inline expansions for ABI compatibility
+ */
  #if @ODP_ABI_COMPAT@
  #define ODP_ABI_COMPAT 1
  #define _STATIC
--
2.7.4








Re: [lng-odp] [PATCH] linux-generic: fix ISO C compiling issue with -Werror=pedantic

2016-10-26 Thread Maxim Uvarov

Merged,
Maxim.

On 10/25/16 04:55, Bill Fischofer wrote:



On Mon, Oct 24, 2016 at 2:02 AM, > wrote:


From: Xuelin Shi >

ISO C does not allow extra ‘;’ outside of a function.

Signed-off-by: Xuelin Shi >


Reviewed-by: Bill Fischofer >


---
 platform/linux-generic/include/odp/api/plat/atomic_types.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git
a/platform/linux-generic/include/odp/api/plat/atomic_types.h
b/platform/linux-generic/include/odp/api/plat/atomic_types.h
index 3bb2bbd..33a0565 100644
--- a/platform/linux-generic/include/odp/api/plat/atomic_types.h
+++ b/platform/linux-generic/include/odp/api/plat/atomic_types.h
@@ -32,7 +32,7 @@ struct odp_atomic_u64_s {
 * data types. We use a spin lock to ensure atomicity. */
char lock; /**< Spin lock (if needed) used to ensure
atomic access */
 #endif
-} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */;
+} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */

 /**
  * @internal
@@ -40,7 +40,7 @@ struct odp_atomic_u64_s {
  */
 struct odp_atomic_u32_s {
uint32_t v; /**< Actual storage for the atomic variable */
-} ODP_ALIGNED(sizeof(uint32_t)); /* Enforce alignement! */;
+} ODP_ALIGNED(sizeof(uint32_t)); /* Enforce alignement! */

 #if __GCC_ATOMIC_LLONG_LOCK_FREE < 2

--
2.7.4






Re: [lng-odp] [PATCHv2] fix out of tree build

2016-10-26 Thread Maxim Uvarov

Merged,
Maxim.

On 10/26/16 00:05, Mike Holmes wrote:

On 25 October 2016 at 16:28, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

Commit:
 eebd6b0 configure: the version cannot use a script
Did generation of version.h which is done in $dest_dir. Includes
paths have to be corrected accordingly.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>

Reviewed-and tested-by: Mike Holmes <mike.hol...@linaro.org>


---
  v2: build.sh in some combination did not pass on v1, fix it (Mike).


  example/Makefile.inc   | 3 ++-
  helper/Makefile.am | 1 +
  platform/Makefile.inc  | 4 ++--
  platform/linux-generic/Makefile.am | 1 +
  test/Makefile.inc  | 3 ++-
  test/linux-generic/Makefile.inc| 1 +
  6 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/example/Makefile.inc b/example/Makefile.inc
index 9fb2f29..19d3994 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -7,6 +7,7 @@ AM_CFLAGS += \
 -I$(top_srcdir)/platform/@with_platform@/include \
 -I$(top_srcdir)/include/ \
 -I$(top_srcdir)/helper/include \
-   -I$(top_builddir)/platform/@with_platform@/include
+   -I$(top_builddir)/platform/@with_platform@/include \
+   -I$(top_builddir)/include

  AM_LDFLAGS += -L$(LIB)
diff --git a/helper/Makefile.am b/helper/Makefile.am
index b6e6a1d..d09d900 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -8,6 +8,7 @@ AM_CFLAGS  = -I$(srcdir)/include
  AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
  AM_CFLAGS += -I$(top_srcdir)/include
  AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include
+AM_CFLAGS += -I$(top_builddir)/include

  AM_LDFLAGS += -version-number '$(ODPHELPER_LIBSO_VERSION)'

diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 432d1fd..2722946 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -57,8 +57,8 @@ odpapispecinclude_HEADERS = \
   $(top_srcdir)/include/odp/api/spec/ticketlock.h \
   $(top_srcdir)/include/odp/api/spec/time.h \
   $(top_srcdir)/include/odp/api/spec/timer.h \
- $(top_srcdir)/include/odp/api/spec/traffic_mngr.h \
- $(top_srcdir)/include/odp/api/spec/version.h
+ $(top_builddir)/include/odp/api/spec/version.h \
+ $(top_srcdir)/include/odp/api/spec/traffic_mngr.h

  EXTRA_DIST = \
  arch/arm/odp/api/cpu_arch.h \
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0ec13d4..22cf6f3 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -6,6 +6,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc

  AM_CFLAGS +=  -I$(srcdir)/include
  AM_CFLAGS +=  -I$(top_srcdir)/include
+AM_CFLAGS +=  -I$(top_builddir)/include
  AM_CFLAGS +=  -Iinclude

  include_HEADERS = \
diff --git a/test/Makefile.inc b/test/Makefile.inc
index db5a2fa..1ebc047 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -11,7 +11,8 @@ INCFLAGS = \
 -I$(top_srcdir)/helper/include \
 -I$(top_srcdir)/include \
 -I$(top_srcdir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/test
+   -I$(top_srcdir)/test \
+   -I$(top_builddir)/include

  AM_CFLAGS += $(INCFLAGS)
  AM_CXXFLAGS = $(INCFLAGS)
diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc
index eba1d2d..36745fe 100644
--- a/test/linux-generic/Makefile.inc
+++ b/test/linux-generic/Makefile.inc
@@ -10,6 +10,7 @@ LIBODP = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la

  INCCUNIT_COMMON = -I$(top_srcdir)/test/common_plat/common
  INCODP =  \
+-I$(top_builddir)/include \
  -I$(top_builddir)/platform/@with_platform@/include \
  -I$(top_srcdir)/helper/include \
  -I$(top_srcdir)/include \
--
2.7.1.250.gff4ea60








[lng-odp] [PATCHv2] fix out of tree build

2016-10-25 Thread Maxim Uvarov
Commit:
eebd6b0 configure: the version cannot use a script
Did generation of version.h which is done in $dest_dir. Includes
paths have to be corrected accordingly.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 v2: build.sh in some combination did not pass on v1, fix it (Mike).


 example/Makefile.inc   | 3 ++-
 helper/Makefile.am | 1 +
 platform/Makefile.inc  | 4 ++--
 platform/linux-generic/Makefile.am | 1 +
 test/Makefile.inc  | 3 ++-
 test/linux-generic/Makefile.inc| 1 +
 6 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/example/Makefile.inc b/example/Makefile.inc
index 9fb2f29..19d3994 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -7,6 +7,7 @@ AM_CFLAGS += \
-I$(top_srcdir)/platform/@with_platform@/include \
-I$(top_srcdir)/include/ \
-I$(top_srcdir)/helper/include \
-   -I$(top_builddir)/platform/@with_platform@/include
+   -I$(top_builddir)/platform/@with_platform@/include \
+   -I$(top_builddir)/include
 
 AM_LDFLAGS += -L$(LIB)
diff --git a/helper/Makefile.am b/helper/Makefile.am
index b6e6a1d..d09d900 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -8,6 +8,7 @@ AM_CFLAGS  = -I$(srcdir)/include
 AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
 AM_CFLAGS += -I$(top_srcdir)/include
 AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include
+AM_CFLAGS += -I$(top_builddir)/include
 
 AM_LDFLAGS += -version-number '$(ODPHELPER_LIBSO_VERSION)'
 
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 432d1fd..2722946 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -57,8 +57,8 @@ odpapispecinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/spec/ticketlock.h \
  $(top_srcdir)/include/odp/api/spec/time.h \
  $(top_srcdir)/include/odp/api/spec/timer.h \
- $(top_srcdir)/include/odp/api/spec/traffic_mngr.h \
- $(top_srcdir)/include/odp/api/spec/version.h
+ $(top_builddir)/include/odp/api/spec/version.h \
+ $(top_srcdir)/include/odp/api/spec/traffic_mngr.h
 
 EXTRA_DIST = \
 arch/arm/odp/api/cpu_arch.h \
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0ec13d4..22cf6f3 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -6,6 +6,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
+AM_CFLAGS +=  -I$(top_builddir)/include
 AM_CFLAGS +=  -Iinclude
 
 include_HEADERS = \
diff --git a/test/Makefile.inc b/test/Makefile.inc
index db5a2fa..1ebc047 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -11,7 +11,8 @@ INCFLAGS = \
-I$(top_srcdir)/helper/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/test
+   -I$(top_srcdir)/test \
+   -I$(top_builddir)/include
 
 AM_CFLAGS += $(INCFLAGS)
 AM_CXXFLAGS = $(INCFLAGS)
diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc
index eba1d2d..36745fe 100644
--- a/test/linux-generic/Makefile.inc
+++ b/test/linux-generic/Makefile.inc
@@ -10,6 +10,7 @@ LIBODP = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la
 
 INCCUNIT_COMMON = -I$(top_srcdir)/test/common_plat/common
 INCODP =  \
+-I$(top_builddir)/include \
 -I$(top_builddir)/platform/@with_platform@/include \
 -I$(top_srcdir)/helper/include \
 -I$(top_srcdir)/include \
-- 
2.7.1.250.gff4ea60



[lng-odp] [PATCH] fix out of tree build

2016-10-25 Thread Maxim Uvarov
Commit:
eebd6b0 configure: the version cannot use a script
Did generation of version.h which is done in $dest_dir. Includes
paths have to be corrected accordingly.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 example/Makefile.inc   | 3 ++-
 helper/Makefile.am | 1 +
 platform/Makefile.inc  | 4 ++--
 platform/linux-generic/Makefile.am | 1 +
 test/Makefile.inc  | 3 ++-
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/example/Makefile.inc b/example/Makefile.inc
index 9fb2f29..19d3994 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -7,6 +7,7 @@ AM_CFLAGS += \
-I$(top_srcdir)/platform/@with_platform@/include \
-I$(top_srcdir)/include/ \
-I$(top_srcdir)/helper/include \
-   -I$(top_builddir)/platform/@with_platform@/include
+   -I$(top_builddir)/platform/@with_platform@/include \
+   -I$(top_builddir)/include
 
 AM_LDFLAGS += -L$(LIB)
diff --git a/helper/Makefile.am b/helper/Makefile.am
index b6e6a1d..d09d900 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -8,6 +8,7 @@ AM_CFLAGS  = -I$(srcdir)/include
 AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
 AM_CFLAGS += -I$(top_srcdir)/include
 AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include
+AM_CFLAGS += -I$(top_builddir)/include
 
 AM_LDFLAGS += -version-number '$(ODPHELPER_LIBSO_VERSION)'
 
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 432d1fd..2722946 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -57,8 +57,8 @@ odpapispecinclude_HEADERS = \
  $(top_srcdir)/include/odp/api/spec/ticketlock.h \
  $(top_srcdir)/include/odp/api/spec/time.h \
  $(top_srcdir)/include/odp/api/spec/timer.h \
- $(top_srcdir)/include/odp/api/spec/traffic_mngr.h \
- $(top_srcdir)/include/odp/api/spec/version.h
+ $(top_builddir)/include/odp/api/spec/version.h \
+ $(top_srcdir)/include/odp/api/spec/traffic_mngr.h
 
 EXTRA_DIST = \
 arch/arm/odp/api/cpu_arch.h \
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0ec13d4..22cf6f3 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -6,6 +6,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
+AM_CFLAGS +=  -I$(top_builddir)/include
 AM_CFLAGS +=  -Iinclude
 
 include_HEADERS = \
diff --git a/test/Makefile.inc b/test/Makefile.inc
index db5a2fa..1ebc047 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -11,7 +11,8 @@ INCFLAGS = \
-I$(top_srcdir)/helper/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/platform/@with_platform@/include \
-   -I$(top_srcdir)/test
+   -I$(top_srcdir)/test \
+   -I$(top_builddir)/include
 
 AM_CFLAGS += $(INCFLAGS)
 AM_CXXFLAGS = $(INCFLAGS)
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [API-NEXT PATCHv2 1/3] api: dev: add device apis for numa support

2016-10-24 Thread Maxim Uvarov

On 10/24/16 22:56, Bill Fischofer wrote:

Add the odp_dev_id() API used for NUMA support


probably log also needs to be corrected with removing reference to NUMA.

Maxim.


Signed-off-by: Bill Fischofer 
---
Changes for v2:
- Incorporate changes suggested by Petri

  include/odp/api/spec/dev.h | 89 ++
  1 file changed, 89 insertions(+)
  create mode 100644 include/odp/api/spec/dev.h

diff --git a/include/odp/api/spec/dev.h b/include/odp/api/spec/dev.h
new file mode 100644
index 000..1f7ed8b
--- /dev/null
+++ b/include/odp/api/spec/dev.h
@@ -0,0 +1,89 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP device
+ */
+
+#ifndef ODP_API_DEV_H_
+#define ODP_API_DEV_H_
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @defgroup odp_dev ODP DEVICE
+ *  Operations on devices
+ *  @{
+ */
+
+/**
+ * @typedef odp_dev_t
+ * ODP Device
+ */
+
+/**
+ * @def ODP_DEV_NAME_LEN
+ * Maximum device name length in chars
+ */
+
+/**
+ * @def ODP_DEV_ANY
+ * Any device
+ */
+
+/**
+ * @def ODP_DEV_INVALID
+ * Invalid device
+ */
+
+/**
+ * Get Device ID by Name
+ *
+ * Get an implementation-defined device identifier from a device name. Device
+ * names are supplied as parameter info (command line, file, etc.) to the
+ * application. This routine translates this symbolic name into an internal
+ * identifier that can be used to define a device connection hierarchy for
+ * NUMA or other purposes.
+ *
+ * The reserved id ODP_DEV_ANY may be used as a "don't care" placeholder
+ * wherever a device id is required.
+ *
+ * @param name Name of the device
+ *
+ * @return Device ID
+ * @retval ODP_DEV_INVALID Device is unknown
+ */
+odp_dev_t odp_dev_id(const char *name);
+
+/**
+ * Get printable value for an odp_dev_t
+ *
+ * @param hdl  odp_dev_t handle to be printed
+ * @return uint64_t value that can be used to print/display this
+ * handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_dev_t handle.
+ */
+uint64_t odp_dev_to_u64(odp_dev_t hdl);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#include 
+#endif




Re: [lng-odp] [PATCH v2 1/2] configure: the version cannot use a script

2016-10-24 Thread Maxim Uvarov

first patch is merged with Brian review.

Will test second patch tomorrow.

Maxim.

On 10/21/16 21:40, Mike Holmes wrote:

Use of a script in the autotools breaks github CI
Define the API version in configure and reuse it in the code

Benefits:
removes dependence on scripts to build
removes scripts and the make file from odp/scripts
removes generated .scmversion file
places api versioning right next to lib versioning in the configure.ac
allows github to auto build odp repos

Signed-off-by: Mike Holmes 
---
  .gitignore   |  1 -
  Makefile.am  |  5 ++--
  configure.ac | 21 +++--
  include/odp/api/spec/.gitignore  |  1 +
  include/odp/api/spec/{version.h => version.h.in} |  6 ++---
  platform/Makefile.inc|  3 +--
  scripts/Makefile.am  |  1 -
  scripts/get_impl_str.sh  | 11 -
  scripts/git_hash.sh  | 29 
  9 files changed, 26 insertions(+), 52 deletions(-)
  create mode 100644 include/odp/api/spec/.gitignore
  rename include/odp/api/spec/{version.h => version.h.in} (93%)
  delete mode 100644 scripts/Makefile.am
  delete mode 100755 scripts/get_impl_str.sh
  delete mode 100755 scripts/git_hash.sh

diff --git a/.gitignore b/.gitignore
index d4e7d02..fbc0eab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
  .deps/
  .dirstamp
  .libs/
-.scmversion
  CUnit-Memory-Dump.xml
  ID
  Makefile
diff --git a/Makefile.am b/Makefile.am
index 625748a..2a9a658 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,9 +11,8 @@ SUBDIRS = @platform_with_platform@ \
  test \
  helper/test \
  doc \
- example \
- scripts
+ example
  
  @DX_RULES@
  
-EXTRA_DIST = bootstrap $(DX_CONFIG) CHANGELOG config/README .scmversion

+EXTRA_DIST = bootstrap $(DX_CONFIG) CHANGELOG config/README
diff --git a/configure.ac b/configure.ac
index f081c51..ab19084 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,23 @@
  AC_PREREQ([2.5])
-AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/git_hash.sh .), 
[lng-odp@lists.linaro.org])
+##
+# Set correct API version
+##
+m4_define([odpapi_generation_version], [1])
+m4_define([odpapi_major_version], [11])
+m4_define([odpapi_minor_version], [0])
+m4_define([odpapi_point_version], [0])
+m4_define([odpapi_version],
+
[odpapi_generation_version.odpapi_major_version.odpapi_minor_version.odpapi_point_version])
+AC_INIT([OpenDataPlane],[odpapi_version],[lng-odp@lists.linaro.org])
+
+ODP_VERSION_API_GENERATION=odpapi_generation_version
+AC_SUBST(ODP_VERSION_API_GENERATION)
+ODP_VERSION_API_MAJOR=odpapi_major_version
+AC_SUBST(ODP_VERSION_API_MAJOR)
+ODP_VERSION_API_MINOR=odpapi_minor_version
+AC_SUBST(ODP_VERSION_API_MINOR)
+AC_CONFIG_FILES([include/odp/api/spec/version.h])
+
  AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects])
  AC_CONFIG_SRCDIR([helper/config.h.in])
  AM_CONFIG_HEADER([helper/config.h])
@@ -271,7 +289,6 @@ AC_CONFIG_FILES([Makefile
 helper/test/Makefile
 pkgconfig/libodp-linux.pc
 pkgconfig/libodphelper-linux.pc
-scripts/Makefile
 ])
  
  AC_SEARCH_LIBS([timer_create],[rt posix4])

diff --git a/include/odp/api/spec/.gitignore b/include/odp/api/spec/.gitignore
new file mode 100644
index 000..6702033
--- /dev/null
+++ b/include/odp/api/spec/.gitignore
@@ -0,0 +1 @@
+version.h
diff --git a/include/odp/api/spec/version.h b/include/odp/api/spec/version.h.in
similarity index 93%
rename from include/odp/api/spec/version.h
rename to include/odp/api/spec/version.h.in
index aa3f3ab..4b16dcc 100644
--- a/include/odp/api/spec/version.h
+++ b/include/odp/api/spec/version.h.in
@@ -37,7 +37,7 @@ extern "C" {
   * very significant changes to the API. APIs with different
   * versions are likely not backward compatible.
   */
-#define ODP_VERSION_API_GENERATION 1
+#define ODP_VERSION_API_GENERATION @ODP_VERSION_API_GENERATION@
  
  /**

   * ODP API major version
@@ -45,7 +45,7 @@ extern "C" {
   * Introduction of major new features or changes. APIs with different major
   * versions are likely not backward compatible.
   */
-#define ODP_VERSION_API_MAJOR 10
+#define  ODP_VERSION_API_MAJOR @ODP_VERSION_API_MAJOR@
  
  /**

   * ODP API minor version
@@ -54,7 +54,7 @@ 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 @ODP_VERSION_API_MINOR@
  
  /**

   * ODP API version string
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 

Re: [lng-odp] [PATCH v3 1/5] example: l3fwd: add missing gitignores

2016-10-24 Thread Maxim Uvarov

Merged.

On 10/21/16 17:31, Mike Holmes wrote:

On 3 October 2016 at 07:49, Matias Elo  wrote:

Signed-off-by: Matias Elo 

Reviewed-by: Mike Holmes 

But I wonder if we should at some point  ignore these in the root of
odp/example and odp/test to save repeating them ?

maybe even to global root.

Maxim.



---
  example/l3fwd/.gitignore | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/example/l3fwd/.gitignore b/example/l3fwd/.gitignore
index 74e501f..3411830 100644
--- a/example/l3fwd/.gitignore
+++ b/example/l3fwd/.gitignore
@@ -1 +1,3 @@
  odp_l3fwd
+*.log
+*.trs
--
2.7.4








Re: [lng-odp] [PATCH 1/3] linux-gen: packet: enable parsing only selected packet header layers

2016-10-24 Thread Maxim Uvarov

Merged,
Maxim.

On 10/24/16 14:48, Elo, Matias (Nokia - FI/Espoo) wrote:

Ping. This patch set has been reviewed and tested.

-Matias


On 21 Sep 2016, at 22.36, Bill Fischofer 
> wrote:

For this series:

Reviewed-and-tested-by: Bill Fischofer 
>

On Tue, Sep 13, 2016 at 9:30 AM, Matias Elo 
> wrote:
Enable parsing packet headers up to a given protocol layer.

Signed-off-by: Matias Elo >
---
  .../linux-generic/include/odp_packet_internal.h|  24 +-
  platform/linux-generic/odp_classification.c|   2 +-
  platform/linux-generic/odp_packet.c| 293 -
  3 files changed, 193 insertions(+), 126 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 392d670..9b4f59e 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -41,7 +41,6 @@ typedef union {

 struct {
 uint64_t parsed_l2:1; /**< L2 parsed */
-   uint64_t parsed_all:1;/**< Parsing complete */
 uint64_t dst_queue:1; /**< Dst queue present */

 uint64_t flow_hash:1; /**< Flow hash present */
@@ -131,6 +130,18 @@ ODP_STATIC_ASSERT(sizeof(output_flags_t) == 
sizeof(uint32_t),
   "OUTPUT_FLAGS_SIZE_ERROR");

  /**
+ * Protocol stack layers
+ */
+typedef enum {
+   LAYER_NONE = 0,
+   LAYER_L1,
+   LAYER_L2,
+   LAYER_L3,
+   LAYER_L4,
+   LAYER_ALL
+} layer_t;
+
+/**
   * Packet parser metadata
   */
  typedef struct {
@@ -145,6 +156,10 @@ typedef struct {
 uint32_t l3_len;/**< Layer 3 length */
 uint32_t l4_len;/**< Layer 4 length */

+   layer_t parsed_layers;  /**< Highest parsed protocol stack layer */
+   uint16_t ethtype;   /**< EtherType */
+   uint8_t ip_proto;   /**< IP protocol */
+
  } packet_parser_t;

  /**
@@ -300,7 +315,7 @@ static inline int packet_parse_l2_not_done(packet_parser_t 
*prs)

  static inline int packet_parse_not_complete(odp_packet_hdr_t *pkt_hdr)
  {
-   return !pkt_hdr->p.input_flags.parsed_all;
+   return pkt_hdr->p.parsed_layers != LAYER_ALL;
  }

  /* Forward declarations */
@@ -316,6 +331,9 @@ void packet_parse_l2(packet_parser_t *prs, uint32_t 
frame_len);
  /* Perform full packet parse */
  int packet_parse_full(odp_packet_hdr_t *pkt_hdr);

+/* Perform packet parse up to a given protocol layer */
+int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, layer_t layer);
+
  /* Reset parser metadata for a new parse */
  void packet_parse_reset(odp_packet_hdr_t *pkt_hdr);

@@ -349,7 +367,7 @@ static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, 
odp_time_t *ts)
  }

  int packet_parse_common(packet_parser_t *pkt_hdr, const uint8_t *ptr,
-   uint32_t pkt_len, uint32_t seg_len);
+   uint32_t pkt_len, uint32_t seg_len, layer_t layer);

  int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr);

diff --git a/platform/linux-generic/odp_classification.c 
b/platform/linux-generic/odp_classification.c
index ea223bf..868058d 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -821,7 +821,7 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t 
*base,
 packet_parse_reset(pkt_hdr);
 packet_set_len(pkt_hdr, pkt_len);

-   packet_parse_common(_hdr->p, base, pkt_len, seg_len);
+   packet_parse_common(_hdr->p, base, pkt_len, seg_len, LAYER_ALL);
 cos = cls_select_cos(entry, base, pkt_hdr);

 if (cos == NULL)
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index c4cf324..5f84869 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -30,12 +30,13 @@
  static inline void packet_parse_disable(odp_packet_hdr_t *pkt_hdr)
  {
 pkt_hdr->p.input_flags.parsed_l2  = 1;
-   pkt_hdr->p.input_flags.parsed_all = 1;
+   pkt_hdr->p.parsed_layers = LAYER_ALL;
  }

  void packet_parse_reset(odp_packet_hdr_t *pkt_hdr)
  {
 /* Reset parser metadata before new parse */
+   pkt_hdr->p.parsed_layers= LAYER_NONE;
 pkt_hdr->p.error_flags.all  = 0;
 pkt_hdr->p.input_flags.all  = 0;
 pkt_hdr->p.output_flags.all = 0;
@@ -50,6 +51,8 @@ void packet_parse_reset(odp_packet_hdr_t *pkt_hdr)
  static void packet_init(pool_entry_t *pool, odp_packet_hdr_t *pkt_hdr,
 size_t size, int parse)
  {
+   pkt_hdr->p.parsed_layers= LAYER_NONE;
+
 pkt_hdr->p.input_flags.all  = 0;
 pkt_hdr->p.output_flags.all = 0;
 pkt_hdr->p.error_flags.all  = 0;
@@ -1166,151 

Re: [lng-odp] [PATCHv3] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-24 Thread Maxim Uvarov

Merged,
Maxim.

On 10/21/16 17:12, Mike Holmes wrote:

On 14 October 2016 at 07:51, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>

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


---

  v3: update if logic (found just after apply.)
  v2: update description (Mike)
  test/common_plat/performance/odp_pktio_perf.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..483f067 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
  #include 
  #include 

+#define TEST_SKIP 77
+
  #define PKT_BUF_NUM   8192
  #define MAX_NUM_IFACES2
  #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
gbl_args->args.cpu_count);
 if (num_workers < 2) {
 LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
 }

 if (gbl_args->args.num_tx_workers) {
@@ -659,7 +661,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,

  static int run_test(void)
  {
-   int ret = 1;
+   int ret;
 int i;
 odp_cpumask_t txmask, rxmask;
 test_status_t status = {
@@ -669,8 +671,9 @@ static int run_test(void)
 .warmup = 1,
 };

-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;

 printf("Starting test with params:\n");
 printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
 run_test_single(, , );
 status.warmup = 0;

-   while (ret > 0)
+   while (1) {
 ret = run_test_single(, , );
+   if (ret <= 0)
+   break;
+   }

 return ret;
  }
--
2.7.1.250.gff4ea60








Re: [lng-odp] [PATCHv3] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-21 Thread Maxim Uvarov

please review v3.

Maxim.

On 10/14/16 14:51, Maxim Uvarov wrote:

Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---

  v3: update if logic (found just after apply.)
  v2: update description (Mike)
  test/common_plat/performance/odp_pktio_perf.c | 16 +++-
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..483f067 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
  #include 
  #include 
  
+#define TEST_SKIP 77

+
  #define PKT_BUF_NUM   8192
  #define MAX_NUM_IFACES2
  #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
   gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}
  
  	if (gbl_args->args.num_tx_workers) {

@@ -659,7 +661,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
  
  static int run_test(void)

  {
-   int ret = 1;
+   int ret;
int i;
odp_cpumask_t txmask, rxmask;
test_status_t status = {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};
  
-	if (setup_txrx_masks(, ) != 0)

-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;
  
  	printf("Starting test with params:\n");

printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;
  
-	while (ret > 0)

+   while (1) {
ret = run_test_single(, , );
+   if (ret <= 0)
+   break;
+   }
  
  	return ret;

  }




Re: [lng-odp] [PATCH 02/10] linux-gen: pktio: do not free zero packets

2016-10-21 Thread Maxim Uvarov

On 10/20/16 14:52, Savolainen, Petri (Nokia - FI/Espoo) wrote:



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
Uvarov
Sent: Wednesday, October 19, 2016 3:49 PM
To: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH 02/10] linux-gen: pktio: do not free zero
packets

On 10/19/16 15:09, Petri Savolainen wrote:

In some error cases, netmap and dpdk pktios were calling
odp_packet_free_multi with zero packets. Moved existing error
check to avoid a free call with zero packets.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
   platform/linux-generic/pktio/dpdk.c   | 10 ++
   platform/linux-generic/pktio/netmap.c | 10 ++
   2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-

generic/pktio/dpdk.c

index 11f3509..0eb025a 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -956,10 +956,12 @@ static int dpdk_send(pktio_entry_t *pktio_entry,

int index,

rte_pktmbuf_free(tx_mbufs[i]);
}

-   odp_packet_free_multi(pkt_table, tx_pkts);
-
-   if (odp_unlikely(tx_pkts == 0 && __odp_errno != 0))
-   return -1;
+   if (odp_unlikely(tx_pkts == 0)) {
+   if (__odp_errno != 0)
+   return -1;

no need to modify original code for 2 ifs. One if and && usually
generates faster code.

The else branch underneath is the actual bug correction ==> call free only when 
tx_pkts != 0. Errno is not always set.

-Petri
I agree with that so that no need splitting  this if on 2. You can just 
add 'else' in the bottom.


Maxim.


+   } else {
+   odp_packet_free_multi(pkt_table, tx_pkts);
+   }

return tx_pkts;
   }
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-

generic/pktio/netmap.c

index 412beec..c1cdf72 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -830,10 +830,12 @@ static int netmap_send(pktio_entry_t *pktio_entry,

int index,

if (!pkt_nm->lockless_tx)
odp_ticketlock_unlock(_nm->tx_desc_ring[index].s.lock);

-   odp_packet_free_multi(pkt_table, nb_tx);
-
-   if (odp_unlikely(nb_tx == 0 && __odp_errno != 0))
-   return -1;
+   if (odp_unlikely(nb_tx == 0)) {
+   if (__odp_errno != 0)
+   return -1;

same here.

Maxim.

+   } else {
+   odp_packet_free_multi(pkt_table, nb_tx);
+   }

return nb_tx;
   }




Re: [lng-odp] [PATCH 01/10] linux-gen: ipc: disable build of ipc pktio

2016-10-21 Thread Maxim Uvarov

On 10/20/16 15:00, Savolainen, Petri (Nokia - FI/Espoo) wrote:



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
Uvarov
Sent: Wednesday, October 19, 2016 3:59 PM
To: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH 01/10] linux-gen: ipc: disable build of ipc
pktio

On 10/19/16 15:09, Petri Savolainen wrote:

IPC pktio implementation depends heavily on pool internals. It's
build is disabled due to pool re-implementation. IPC should be
re-implemented with a cleaner internal interface towards pool and
shm.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
   platform/linux-generic/Makefile.am | 2 --
   1 file changed, 2 deletions(-)

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-

generic/Makefile.am

index 0ec13d4..0fba393 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -111,7 +111,6 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_name_table_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 \
@@ -158,7 +157,6 @@ __LIB__libodp_linux_la_SOURCES = \
   odp_packet_io.c \
   pktio/ethtool.c \
   pktio/io_ops.c \
-  pktio/ipc.c \
   pktio/pktio_common.c \
   pktio/loop.c \
   pktio/netmap.c \

you just not need to turn on  -D_ODP_PKTIO_IPC from configure. If it's
not enough add ifdefs inside pktio/ipc.c.
Or with your changes tests will be built and run.

Maxim.


Entire IPC code won't build after pool structure changes. So, entire ipc.c file 
would need to be #ifdef'ed. I think this was a cleaner way to disable entirely 
the build of IPC code.

-Petri
yes. You can ifdef it. Then we merge Christophe changes and ipc repair. 
Than your changes and I will try to fix it again.


Maxim.






Re: [lng-odp] [PATCH 1/2] example: odp_timer_simple: decrease timer pool resolution

2016-10-21 Thread Maxim Uvarov

Merged both patches. Second one with my review only.

Maxim.

On 10/21/16 10:10, Kevin Wang wrote:

Reviewed-by: Kevin Wang 

On 21 October 2016 at 14:17, Yi He  wrote:


Reply for Kevin Wang to add his review.

Best Regards, Yi

On 19 July 2016 at 02:29, Brian Brooks  wrote:


On 07/18 13:41:32, Mike Holmes wrote:

Is 10 milliseconds adequate for real work ?

Should this be in some way calculated depending on the platform
capabilities where it is executes since this example will also be run

on

real HW accelerated systems and for those I assume we want the better
resolution.

I think you just created a new feature request. :) Enable applications to
discover the maximum timer pool resolution supported by the platform.

This example app expires its timers every two seconds, so this patch just
tweaks it to work (it failed on my machine) with the reference
implementation
on a generic Linux platform.









Re: [lng-odp] [PATCH v3 1/5] example: l3fwd: add missing gitignores

2016-10-21 Thread Maxim Uvarov

Does somebody review test this?

Maxim.

On 10/03/16 14:49, Matias Elo wrote:

Signed-off-by: Matias Elo 
---
  example/l3fwd/.gitignore | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/example/l3fwd/.gitignore b/example/l3fwd/.gitignore
index 74e501f..3411830 100644
--- a/example/l3fwd/.gitignore
+++ b/example/l3fwd/.gitignore
@@ -1 +1,3 @@
  odp_l3fwd
+*.log
+*.trs




Re: [lng-odp] [API-NEXT PATCH] test: drv: shm: decrease test memory requirement

2016-10-21 Thread Maxim Uvarov

Merged,

Maxim.

On 10/21/16 11:21, Elo, Matias (Nokia - FI/Espoo) wrote:

Reviewed-and-tested-by: Matias Elo 


-Original Message-
From: Christophe Milard [mailto:christophe.mil...@linaro.org]
Sent: Wednesday, October 19, 2016 5:30 PM
To: bill.fischo...@linaro.org; Elo, Matias (Nokia - FI/Espoo) ; lng-odp@lists.linaro.org
Cc: Christophe Milard 
Subject: [API-NEXT PATCH] test: drv: shm: decrease test memory requirement

The memory consumption is proporsional to the number of ODP threads
available. The test failed on systems with large number of CPU, due
to outage ot pre-allocaed address space. This patch shrinks the test
requirement.

Signed-off-by: Christophe Milard 
---
  test/common_plat/validation/drv/drvshmem/drvshmem.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/common_plat/validation/drv/drvshmem/drvshmem.c
b/test/common_plat/validation/drv/drvshmem/drvshmem.c
index 5e6d2e5..559c55d 100644
--- a/test/common_plat/validation/drv/drvshmem/drvshmem.c
+++ b/test/common_plat/validation/drv/drvshmem/drvshmem.c
@@ -16,7 +16,7 @@
  #define TEST_SHARE_BAR (0xf0f0f0f)
  #define SMALL_MEM 10
  #define MEDIUM_MEM 4096
-#define BIG_MEM 16777216
+#define BIG_MEM 65536
  #define STRESS_SIZE 32/* power of 2 and <=256 */
  #define STRESS_RANDOM_SZ 5
  #define STRESS_ITERATION 5000
--
2.7.4




Re: [lng-odp] api-next needs update

2016-10-21 Thread Maxim Uvarov
Done.

On 21 October 2016 at 11:21, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia-bell-labs.com> wrote:

> Hi,
>
> Api-next needs a *quick* update to the latest level of master branch.
>
> There's now about 20 commit gap. For example, "Revert example: generator:
> actually use specified default" is not yet on api-next, which breaks 'sudo
> make check'. Also my pool optimizations cannot be rebased to api-next until
> is up to date. I guess also Christophe's patch set should be rebased on top
> of the updated api-next (latest development in master).
>
> -Petri
>
>


[lng-odp] [API-NEXT PATCH 4/4] linix-gen: pktio ipc: fix race with start 2 process at the same time

2016-10-20 Thread Maxim Uvarov
Fix race when 2 process start at the same time with delay slave until
master will allow to map it's shared rings

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 .../include/odp_packet_io_ipc_internal.h   |  2 ++
 platform/linux-generic/pktio/ipc.c |  7 
 test/linux-generic/pktio_ipc/pktio_ipc1.c  | 42 +-
 test/linux-generic/pktio_ipc/pktio_ipc2.c  | 35 ++
 test/linux-generic/pktio_ipc/pktio_ipc_run.sh  |  4 ---
 5 files changed, 63 insertions(+), 27 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_ipc_internal.h 
b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
index 1190e1e..0f3e6ea 100644
--- a/platform/linux-generic/include/odp_packet_io_ipc_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
@@ -34,6 +34,8 @@ struct pktio_info {
 * to pool_mdata_addr (odp-linux pool specific) */
size_t mdata_offset;
char pool_name[ODP_POOL_NAME_LEN];
+   /* 1 if master finished creation of all shared objects */
+   int init_done;
} master;
struct {
/* offset from shared memory block start
diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index 490abc5..669737b 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -155,6 +155,7 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
pktio_entry->s.ipc.pool = pool;
 
ODP_DBG("Pre init... DONE.\n");
+   pinfo->master.init_done = 1;
 
_ipc_master_start(pktio_entry);
 
@@ -363,6 +364,11 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED,
if (ODP_SHM_INVALID == shm)
return -1;
pinfo = odp_shm_addr(shm);
+
+   if (!pinfo->master.init_done) {
+   odp_shm_free(shm);
+   return -1;
+   }
pktio_entry->s.ipc.pinfo = pinfo;
pktio_entry->s.ipc.pinfo_shm = shm;
ODP_DBG("process %d is slave\n", getpid());
@@ -379,6 +385,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED,
}
 
pinfo = odp_shm_addr(shm);
+   pinfo->master.init_done = 0;
pinfo->master.pool_name[0] = 0;
pktio_entry->s.ipc.pinfo = pinfo;
pktio_entry->s.ipc.pinfo_shm = shm;
diff --git a/test/linux-generic/pktio_ipc/pktio_ipc1.c 
b/test/linux-generic/pktio_ipc/pktio_ipc1.c
index 654b506..4f85b1d 100644
--- a/test/linux-generic/pktio_ipc/pktio_ipc1.c
+++ b/test/linux-generic/pktio_ipc/pktio_ipc1.c
@@ -25,7 +25,7 @@ static int pktio_run_loop(odp_pool_t pool)
 {
int thr;
int pkts;
-   odp_pktio_t ipc_pktio;
+   odp_pktio_t ipc_pktio = ODP_PKTIO_INVALID;
odp_packet_t pkt_tbl[MAX_PKT_BURST];
uint64_t cnt = 0; /* increasing counter on each send packet */
uint64_t cnt_recv = 0; /* increasing counter to validate
@@ -51,19 +51,34 @@ static int pktio_run_loop(odp_pool_t pool)
else
sprintf(name, TEST_IPC_PKTIO_NAME);
 
-   ipc_pktio = odp_pktio_lookup(name);
-   if (ipc_pktio == ODP_PKTIO_INVALID) {
-   EXAMPLE_ERR("  [%02i] Error: lookup of pktio %s failed\n",
-   thr, "ipc_pktio");
-   return -2;
-   }
-   printf("  [%02i] looked up ipc_pktio:%02" PRIu64 ", burst mode\n",
-  thr, odp_pktio_to_u64(ipc_pktio));
-
wait = odp_time_local_from_ns(run_time_sec * ODP_TIME_SEC_IN_NS);
start_cycle = odp_time_local();
current_cycle = start_cycle;
 
+   /* slave process should always be run after master process to be
+* able to create the same pktio.
+*/
+   for (;;) {
+   if (run_time_sec) {
+   cycle = odp_time_local();
+   diff = odp_time_diff(cycle, start_cycle);
+   if (odp_time_cmp(wait, diff) < 0) {
+   printf("timeout exit, run_time_sec %d\n",
+  run_time_sec);
+   return -1;
+   }
+   }
+
+   ipc_pktio = create_pktio(pool, master_pid);
+   if (ipc_pktio != ODP_PKTIO_INVALID)
+   break;
+   if (!master_pid)
+   break;
+   }
+
+   if (ipc_pktio == ODP_PKTIO_INVALID)
+   return -1;
+
if (odp_pktin_queue(ipc_pktio, , 1) != 1) {
EXAMPLE_ERR("no input queue\n");
return -1;
@@ -320,12 +335,7 @@ int main(int argc, char *argv[])
 
odp_pool_print(pool);
 
-   if (create_pktio(po

[lng-odp] [API-NEXT PATCH 3/4] linix-gen: pktio ipc: allow the same pool name

2016-10-20 Thread Maxim Uvarov
Allow the same pool name for master and slave processes.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 .../linux-generic/include/odp_packet_io_ipc_internal.h  |  2 --
 platform/linux-generic/pktio/ipc.c  | 17 +++--
 test/linux-generic/pktio_ipc/ipc_common.h   |  3 +++
 test/linux-generic/pktio_ipc/pktio_ipc1.c   |  2 +-
 test/linux-generic/pktio_ipc/pktio_ipc2.c   |  2 +-
 5 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_ipc_internal.h 
b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
index 0ad2b22..1190e1e 100644
--- a/platform/linux-generic/include/odp_packet_io_ipc_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
@@ -28,8 +28,6 @@ struct pktio_info {
struct {
/* number of buffer in remote pool */
int shm_pool_bufs_num;
-   /* size of remote pool */
-   size_t shm_pkt_pool_size;
/* size of packet/segment in remote pool */
uint32_t shm_pkt_size;
/* offset from shared memory block start
diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index a322f51..490abc5 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -17,7 +17,7 @@
 /* MAC address for the "ipc" interface */
 static const char pktio_ipc_mac[] = {0x12, 0x12, 0x12, 0x12, 0x12, 0x12};
 
-static void *_ipc_map_remote_pool(const char *name, size_t size, int pid);
+static void *_ipc_map_remote_pool(const char *name, int pid);
 
 static const char *_ipc_odp_buffer_pool_shm_name(odp_pool_t pool_hdl)
 {
@@ -44,7 +44,6 @@ static int _ipc_master_start(pktio_entry_t *pktio_entry)
return -1;
 
ipc_pool_base = _ipc_map_remote_pool(pinfo->slave.pool_name,
-pinfo->master.shm_pkt_pool_size,
 pinfo->slave.pid);
if (ipc_pool_base == NULL) {
ODP_DBG("no pool file %s for pid %d\n",
@@ -147,7 +146,6 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
}
 
memcpy(pinfo->master.pool_name, pool_name, strlen(pool_name));
-   pinfo->master.shm_pkt_pool_size = pool_entry->s.pool_size;
pinfo->master.shm_pool_bufs_num = pool_entry->s.buf_num;
pinfo->master.shm_pkt_size = pool_entry->s.seg_size;
pinfo->master.mdata_offset =  pool_entry->s.pool_mdata_addr -
@@ -192,23 +190,23 @@ static void _ipc_export_pool(struct pktio_info *pinfo,
pool_entry->s.pool_base_addr;
 }
 
-static void *_ipc_map_remote_pool(const char *name, size_t size, int pid)
+static void *_ipc_map_remote_pool(const char *name, int pid)
 {
odp_shm_t shm;
void *addr;
+   char rname[ODP_SHM_NAME_LEN];
 
-   ODP_DBG("Mapping remote pool %s, size %ld\n", name, size);
-
+   snprintf(rname, ODP_SHM_NAME_LEN, "remote-%s", name);
shm = odp_shm_reserve_exported(name, pid,
-  name, 4096, 0);
+  rname, 4096, 0);
if (shm == ODP_SHM_INVALID) {
ODP_ERR("unable map %s\n", name);
return NULL;
}
 
addr = odp_shm_addr(shm);
-   ODP_DBG("MAP master: %p - %p size %ld, pool %s\n",
-   addr, (char *)addr + size, size, name);
+
+   ODP_DBG("Mapped remote pool %s to local %s\n", name, rname);
return addr;
 }
 
@@ -302,7 +300,6 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry)
/* Get info about remote pool */
pinfo = pktio_entry->s.ipc.pinfo;
ipc_pool_base = _ipc_map_remote_pool(pinfo->master.pool_name,
-pinfo->master.shm_pkt_pool_size,
 pid);
pktio_entry->s.ipc.pool_mdata_base = (char *)ipc_pool_base +
 pinfo->master.mdata_offset;
diff --git a/test/linux-generic/pktio_ipc/ipc_common.h 
b/test/linux-generic/pktio_ipc/ipc_common.h
index 5cc1cb4..430d7b6 100644
--- a/test/linux-generic/pktio_ipc/ipc_common.h
+++ b/test/linux-generic/pktio_ipc/ipc_common.h
@@ -49,6 +49,9 @@
 #define TEST_IPC_PKTIO_NAME"ipc:ipktio"
 #define TEST_IPC_PKTIO_PID_NAME "ipc:%d:ipktio"
 
+/** Can be any name, same or not the same. */
+#define TEST_IPC_POOL_NAME "ipc_packet_pool"
+
 /** magic number and sequence at start of packet payload */
 typedef struct ODP_PACKED {
odp_u32be_t magic;
diff --git a/test/linux-generic/pktio_ipc/pktio_ipc1.c 
b/test/linux-generic/pktio_ipc/pktio_ipc1.c
index e646fcf..654b506 100644
--- a/test/linux-generic/pktio_ipc/

[lng-odp] [API-NEXT PATCH 2/4] linux-gen: pktio ipc: remove ipc name space

2016-10-20 Thread Maxim Uvarov
Remove ipc name space and pass pid of master process to slave.
If master does odp_pktio_open("ipc:name"), slave to connect to
the same pktio referes to it by pid odp_pktio_open("ipc::name").

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 platform/linux-generic/include/odp_internal.h  |   1 -
 .../include/odp_packet_io_ipc_internal.h   |   4 +
 platform/linux-generic/odp_init.c  |   4 +-
 platform/linux-generic/pktio/ipc.c | 124 ++---
 test/linux-generic/pktio_ipc/ipc_common.c  |  39 ---
 test/linux-generic/pktio_ipc/ipc_common.h  |  10 +-
 test/linux-generic/pktio_ipc/pktio_ipc1.c  |  23 ++--
 test/linux-generic/pktio_ipc/pktio_ipc2.c  |  17 +--
 test/linux-generic/pktio_ipc/pktio_ipc_run.sh  |  29 +++--
 9 files changed, 130 insertions(+), 121 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h 
b/platform/linux-generic/include/odp_internal.h
index e9d03bb..3f64e21 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -51,7 +51,6 @@ struct odp_global_data_s {
odp_cpumask_t control_cpus;
odp_cpumask_t worker_cpus;
int num_cpus_installed;
-   int ipc_ns;
 };
 
 enum init_stage {
diff --git a/platform/linux-generic/include/odp_packet_io_ipc_internal.h 
b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
index 1b81e2c..0ad2b22 100644
--- a/platform/linux-generic/include/odp_packet_io_ipc_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
@@ -43,6 +43,10 @@ struct pktio_info {
 * (odp-linux pool specific) */
size_t mdata_offset;
char pool_name[ODP_POOL_NAME_LEN];
+   /* pid of the slave process written to shm and
+* used by master to look up memory created by
+* slave
+*/
int pid;
} slave;
 } ODP_PACKED;
diff --git a/platform/linux-generic/odp_init.c 
b/platform/linux-generic/odp_init.c
index 90662c6..7e8dfb9 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -15,12 +15,10 @@ struct odp_global_data_s odp_global_data;
 
 int odp_init_global(odp_instance_t *instance,
const odp_init_t *params,
-   const odp_platform_init_t *platform_params)
+   const odp_platform_init_t *platform_params ODP_UNUSED)
 {
memset(_global_data, 0, sizeof(struct odp_global_data_s));
odp_global_data.main_pid = getpid();
-   if (platform_params)
-   odp_global_data.ipc_ns = platform_params->ipc_ns;
 
enum init_stage stage = NO_INIT;
odp_global_data.log_fn = odp_override_log;
diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index 9b064dd..a322f51 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -35,44 +35,6 @@ static const char *_ipc_odp_buffer_pool_shm_name(odp_pool_t 
pool_hdl)
return info.name;
 }
 
-static int _ipc_map_pktio_info(pktio_entry_t *pktio_entry,
-  const char *dev,
-  int *slave)
-{
-   struct pktio_info *pinfo;
-   char name[ODP_POOL_NAME_LEN + sizeof("_info")];
-   uint32_t flags;
-   odp_shm_t shm;
-
-   /* Create info about remote pktio */
-   snprintf(name, sizeof(name), "%s_info", dev);
-
-   flags = ODP_SHM_PROC | _ODP_SHM_O_EXCL;
-
-   shm = odp_shm_reserve_exported(name, odp_global_data.ipc_ns,
-  name, 4096, 0);
-   if (ODP_SHM_INVALID == shm) {
-   flags = ODP_SHM_EXPORT | ODP_SHM_LOCK;
-   shm = odp_shm_reserve(name, sizeof(struct pktio_info),
- ODP_CACHE_LINE_SIZE,
- flags);
-   if (ODP_SHM_INVALID == shm)
-   ODP_ABORT("can not create shm %s\n", name);
-
-   pinfo = odp_shm_addr(shm);
-   pinfo->master.pool_name[0] = 0;
-   *slave = 0;
-   } else {
-   pinfo = odp_shm_addr(shm);
-   *slave = 1;
-   }
-
-   pktio_entry->s.ipc.pinfo = pinfo;
-   pktio_entry->s.ipc.pinfo_shm = shm;
-
-   return 0;
-}
-
 static int _ipc_master_start(pktio_entry_t *pktio_entry)
 {
struct pktio_info *pinfo = pktio_entry->s.ipc.pinfo;
@@ -250,11 +212,11 @@ static void *_ipc_map_remote_pool(const char *name, 
size_t size, int pid)
return addr;
 }
 
-static void *_ipc_shm_map(char *name, size_t size ODP_UNUSED)
+static void *_ipc_shm_map(char *name, int pid)
 {
odp_shm_t shm;
 
-   shm = odp_shm_reserve_exported(name, odp_global_data.ipc_ns,
+   shm = odp_shm_reserve_exported(name, pid,
   

[lng-odp] [API-NEXT PATCH 1/4] linux-gen: pktio ipc: repair ipc pktio

2016-10-20 Thread Maxim Uvarov
Repair ipc after shared memory implementation and keep
original logic.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 .../include/odp_packet_io_ipc_internal.h   |   1 +
 platform/linux-generic/pktio/ipc.c | 104 +++--
 platform/linux-generic/pktio/ring.c|   2 +-
 3 files changed, 37 insertions(+), 70 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_ipc_internal.h 
b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
index 851114d..1b81e2c 100644
--- a/platform/linux-generic/include/odp_packet_io_ipc_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_ipc_internal.h
@@ -43,5 +43,6 @@ struct pktio_info {
 * (odp-linux pool specific) */
size_t mdata_offset;
char pool_name[ODP_POOL_NAME_LEN];
+   int pid;
} slave;
 } ODP_PACKED;
diff --git a/platform/linux-generic/pktio/ipc.c 
b/platform/linux-generic/pktio/ipc.c
index b779ab7..9b064dd 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -17,7 +17,7 @@
 /* MAC address for the "ipc" interface */
 static const char pktio_ipc_mac[] = {0x12, 0x12, 0x12, 0x12, 0x12, 0x12};
 
-static void *_ipc_map_remote_pool(const char *name, size_t size);
+static void *_ipc_map_remote_pool(const char *name, size_t size, int pid);
 
 static const char *_ipc_odp_buffer_pool_shm_name(odp_pool_t pool_hdl)
 {
@@ -35,38 +35,6 @@ static const char *_ipc_odp_buffer_pool_shm_name(odp_pool_t 
pool_hdl)
return info.name;
 }
 
-/**
-* Look up for shared memory object.
-*
-* @param name   name of shm object
-*
-* @return 0 on success, otherwise non-zero
-*/
-static int _ipc_shm_lookup(const char *name)
-{
-   int shm;
-   char shm_devname[SHM_DEVNAME_MAXLEN];
-
-   if (!odp_global_data.ipc_ns)
-   ODP_ABORT("ipc_ns not set\n");
-
-   snprintf(shm_devname, SHM_DEVNAME_MAXLEN,
-SHM_DEVNAME_FORMAT,
-odp_global_data.ipc_ns, name);
-
-   shm = shm_open(shm_devname, O_RDWR, S_IRUSR | S_IWUSR);
-   if (shm == -1) {
-   if (errno == ENOENT) {
-   ODP_DBG("no file %s\n", shm_devname);
-   return -1;
-   }
-   ODP_ABORT("shm_open for %s err %s\n",
- shm_devname, strerror(errno));
-   }
-   close(shm);
-   return 0;
-}
-
 static int _ipc_map_pktio_info(pktio_entry_t *pktio_entry,
   const char *dev,
   int *slave)
@@ -81,22 +49,21 @@ static int _ipc_map_pktio_info(pktio_entry_t *pktio_entry,
 
flags = ODP_SHM_PROC | _ODP_SHM_O_EXCL;
 
-   shm = odp_shm_reserve(name, sizeof(struct pktio_info),
- ODP_CACHE_LINE_SIZE,
- flags);
-   if (ODP_SHM_INVALID != shm) {
-   pinfo = odp_shm_addr(shm);
-   pinfo->master.pool_name[0] = 0;
-   *slave = 0;
-   } else {
-   flags = _ODP_SHM_PROC_NOCREAT | _ODP_SHM_O_EXCL;
+   shm = odp_shm_reserve_exported(name, odp_global_data.ipc_ns,
+  name, 4096, 0);
+   if (ODP_SHM_INVALID == shm) {
+   flags = ODP_SHM_EXPORT | ODP_SHM_LOCK;
shm = odp_shm_reserve(name, sizeof(struct pktio_info),
  ODP_CACHE_LINE_SIZE,
  flags);
if (ODP_SHM_INVALID == shm)
-   ODP_ABORT("can not connect to shm\n");
+   ODP_ABORT("can not create shm %s\n", name);
 
pinfo = odp_shm_addr(shm);
+   pinfo->master.pool_name[0] = 0;
+   *slave = 0;
+   } else {
+   pinfo = odp_shm_addr(shm);
*slave = 1;
}
 
@@ -109,20 +76,20 @@ static int _ipc_map_pktio_info(pktio_entry_t *pktio_entry,
 static int _ipc_master_start(pktio_entry_t *pktio_entry)
 {
struct pktio_info *pinfo = pktio_entry->s.ipc.pinfo;
-   int ret;
void *ipc_pool_base;
 
if (pinfo->slave.mdata_offset == 0)
return -1;
 
-   ret = _ipc_shm_lookup(pinfo->slave.pool_name);
-   if (ret) {
-   ODP_DBG("no pool file %s\n", pinfo->slave.pool_name);
-   return -1;
-   }
-
ipc_pool_base = _ipc_map_remote_pool(pinfo->slave.pool_name,
-pinfo->master.shm_pkt_pool_size);
+pinfo->master.shm_pkt_pool_size,
+pinfo->slave.pid);
+   if (ipc_pool_base == NULL) {
+   ODP_DBG("no pool file %s for pid %d\n",
+   pinfo->slave.pool_name, pinfo

[lng-odp] [API-NEXT PATCH 0/4] linix-gen: pktio ipc: recover after shm patches

2016-10-20 Thread Maxim Uvarov
First version of patches to recover ipc pktio after Christophe's serries
for shm changes.

Maxim Uvarov (4):
  linux-gen: pktio ipc: repair ipc pktio
  linux-gen: pktio ipc: remove ipc name space
  linix-gen: pktio ipc: allow the same pool name
  linix-gen: pktio ipc: fix race with start 2 process at the same time

 platform/linux-generic/include/odp_internal.h  |   1 -
 .../include/odp_packet_io_ipc_internal.h   |   9 +-
 platform/linux-generic/odp_init.c  |   4 +-
 platform/linux-generic/pktio/ipc.c | 216 +
 platform/linux-generic/pktio/ring.c|   2 +-
 test/linux-generic/pktio_ipc/ipc_common.c  |  39 ++--
 test/linux-generic/pktio_ipc/ipc_common.h  |  13 +-
 test/linux-generic/pktio_ipc/pktio_ipc1.c  |  49 +++--
 test/linux-generic/pktio_ipc/pktio_ipc2.c  |  44 +++--
 test/linux-generic/pktio_ipc/pktio_ipc_run.sh  |  25 +--
 10 files changed, 206 insertions(+), 196 deletions(-)

-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH 04/10] linux-gen: align: added round up power of two

2016-10-20 Thread Maxim Uvarov

On 10/20/16 15:05, Savolainen, Petri (Nokia - FI/Espoo) wrote:



-Original Message-
From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Maxim
Uvarov
Sent: Wednesday, October 19, 2016 4:01 PM
To: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] [PATCH 04/10] linux-gen: align: added round up
power of two

On 10/19/16 15:09, Petri Savolainen wrote:

Added a macro to round up a value to the next power of two,
if it's not already a power of two. Also removed duplicated
code from the same file.

Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
---
   .../linux-generic/include/odp_align_internal.h | 34 +-



   1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/platform/linux-generic/include/odp_align_internal.h

b/platform/linux-generic/include/odp_align_internal.h

index 9ccde53..d2e9f4f 100644
--- a/platform/linux-generic/include/odp_align_internal.h
+++ b/platform/linux-generic/include/odp_align_internal.h
@@ -29,24 +29,18 @@ extern "C" {

   /**
* @internal
- * Round up pointer 'x' to alignment 'align'
- */
-#define ODP_ALIGN_ROUNDUP_PTR(x, align)\
-   ((void *)ODP_ALIGN_ROUNDUP((uintptr_t)(x), (uintptr_t)(align)))
-
-/**
- * @internal
- * Round up pointer 'x' to cache line size alignment
+ * Round up 'x' to alignment 'align'
*/
-#define ODP_CACHE_LINE_SIZE_ROUNDUP_PTR(x)\
-   ((void *)ODP_CACHE_LINE_SIZE_ROUNDUP((uintptr_t)(x)))
+#define ODP_ALIGN_ROUNDUP(x, align)\
+   ((align) * (((x) + align - 1) / (align)))


name has to be _ODP_ALIGN_ROUNDUP  as it's not public API. This patch is
easy to review,
but it will be good to change naming also.

Maxim.

This piece of code was just moved inside the file. Everything is ODP_ prefixed. 
I think it's better to remove prefix from everything in the file as a separate 
patch.

-Petri


I'm ok with both 1) remove prefix completely 2) separate patch.

Maxim.







   /**
* @internal
- * Round up 'x' to alignment 'align'
+ * When 'x' is not already a power of two, round it up to the next
+ * power of two value. Zero is not supported as an input value.
*/
-#define ODP_ALIGN_ROUNDUP(x, align)\
-   ((align) * (((x) + align - 1) / (align)))
+#define ODP_ROUNDUP_POWER_2(x)\
+   (1 << (((int)(8 * sizeof(x))) - __builtin_clz(x - 1)))

   /**
* @internal
@@ -82,20 +76,6 @@ extern "C" {

   /**
* @internal
- * Round down pointer 'x' to 'align' alignment, which is a power of two
- */
-#define ODP_ALIGN_ROUNDDOWN_PTR_POWER_2(x, align)\
-((void *)ODP_ALIGN_ROUNDDOWN_POWER_2((uintptr_t)(x),

(uintptr_t)(align)))

-
-/**
- * @internal
- * Round down pointer 'x' to cache line size alignment
- */
-#define ODP_CACHE_LINE_SIZE_ROUNDDOWN_PTR(x)\
-   ((void *)ODP_CACHE_LINE_SIZE_ROUNDDOWN((uintptr_t)(x)))
-
-/**
- * @internal
* Round down 'x' to 'align' alignment, which is a power of two
*/
   #define ODP_ALIGN_ROUNDDOWN_POWER_2(x, align)\




Re: [lng-odp] [PATCH 04/10] linux-gen: align: added round up power of two

2016-10-19 Thread Maxim Uvarov

On 10/19/16 15:09, Petri Savolainen wrote:

Added a macro to round up a value to the next power of two,
if it's not already a power of two. Also removed duplicated
code from the same file.

Signed-off-by: Petri Savolainen 
---
  .../linux-generic/include/odp_align_internal.h | 34 +-
  1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/platform/linux-generic/include/odp_align_internal.h 
b/platform/linux-generic/include/odp_align_internal.h
index 9ccde53..d2e9f4f 100644
--- a/platform/linux-generic/include/odp_align_internal.h
+++ b/platform/linux-generic/include/odp_align_internal.h
@@ -29,24 +29,18 @@ extern "C" {
  
  /**

   * @internal
- * Round up pointer 'x' to alignment 'align'
- */
-#define ODP_ALIGN_ROUNDUP_PTR(x, align)\
-   ((void *)ODP_ALIGN_ROUNDUP((uintptr_t)(x), (uintptr_t)(align)))
-
-/**
- * @internal
- * Round up pointer 'x' to cache line size alignment
+ * Round up 'x' to alignment 'align'
   */
-#define ODP_CACHE_LINE_SIZE_ROUNDUP_PTR(x)\
-   ((void *)ODP_CACHE_LINE_SIZE_ROUNDUP((uintptr_t)(x)))
+#define ODP_ALIGN_ROUNDUP(x, align)\
+   ((align) * (((x) + align - 1) / (align)))
  


name has to be _ODP_ALIGN_ROUNDUP  as it's not public API. This patch is 
easy to review,

but it will be good to change naming also.

Maxim.



  /**
   * @internal
- * Round up 'x' to alignment 'align'
+ * When 'x' is not already a power of two, round it up to the next
+ * power of two value. Zero is not supported as an input value.
   */
-#define ODP_ALIGN_ROUNDUP(x, align)\
-   ((align) * (((x) + align - 1) / (align)))
+#define ODP_ROUNDUP_POWER_2(x)\
+   (1 << (((int)(8 * sizeof(x))) - __builtin_clz(x - 1)))
  
  /**

   * @internal
@@ -82,20 +76,6 @@ extern "C" {
  
  /**

   * @internal
- * Round down pointer 'x' to 'align' alignment, which is a power of two
- */
-#define ODP_ALIGN_ROUNDDOWN_PTR_POWER_2(x, align)\
-((void *)ODP_ALIGN_ROUNDDOWN_POWER_2((uintptr_t)(x), (uintptr_t)(align)))
-
-/**
- * @internal
- * Round down pointer 'x' to cache line size alignment
- */
-#define ODP_CACHE_LINE_SIZE_ROUNDDOWN_PTR(x)\
-   ((void *)ODP_CACHE_LINE_SIZE_ROUNDDOWN((uintptr_t)(x)))
-
-/**
- * @internal
   * Round down 'x' to 'align' alignment, which is a power of two
   */
  #define ODP_ALIGN_ROUNDDOWN_POWER_2(x, align)\




Re: [lng-odp] [PATCH 01/10] linux-gen: ipc: disable build of ipc pktio

2016-10-19 Thread Maxim Uvarov

On 10/19/16 15:09, Petri Savolainen wrote:

IPC pktio implementation depends heavily on pool internals. It's
build is disabled due to pool re-implementation. IPC should be
re-implemented with a cleaner internal interface towards pool and
shm.

Signed-off-by: Petri Savolainen 
---
  platform/linux-generic/Makefile.am | 2 --
  1 file changed, 2 deletions(-)

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0ec13d4..0fba393 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -111,7 +111,6 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_name_table_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 \
@@ -158,7 +157,6 @@ __LIB__libodp_linux_la_SOURCES = \
   odp_packet_io.c \
   pktio/ethtool.c \
   pktio/io_ops.c \
-  pktio/ipc.c \
   pktio/pktio_common.c \
   pktio/loop.c \
   pktio/netmap.c \


you just not need to turn on  -D_ODP_PKTIO_IPC from configure. If it's 
not enough add ifdefs inside pktio/ipc.c.

Or with your changes tests will be built and run.

Maxim.


Re: [lng-odp] [PATCH 03/10] linux-gen: ring: created common ring implementation

2016-10-19 Thread Maxim Uvarov

On 10/19/16 15:09, Petri Savolainen wrote:

Moved scheduler ring code into a new header file, so that
it can be used also in other parts of the implementation.

Signed-off-by: Petri Savolainen 
---
  platform/linux-generic/Makefile.am |   1 +
  platform/linux-generic/include/odp_ring_internal.h | 109 +
  platform/linux-generic/odp_schedule.c  | 102 ++-
  3 files changed, 118 insertions(+), 94 deletions(-)
  create mode 100644 platform/linux-generic/include/odp_ring_internal.h

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 0fba393..63f9ce7 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -121,6 +121,7 @@ noinst_HEADERS = \
  ${srcdir}/include/odp_pool_internal.h \
  ${srcdir}/include/odp_posix_extensions.h \
  ${srcdir}/include/odp_queue_internal.h \
+ ${srcdir}/include/odp_ring_internal.h \
  ${srcdir}/include/odp_schedule_if.h \
  ${srcdir}/include/odp_schedule_internal.h \
  ${srcdir}/include/odp_schedule_ordered_internal.h \
diff --git a/platform/linux-generic/include/odp_ring_internal.h 
b/platform/linux-generic/include/odp_ring_internal.h
new file mode 100644
index 000..c89b298
--- /dev/null
+++ b/platform/linux-generic/include/odp_ring_internal.h
@@ -0,0 +1,109 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_RING_INTERNAL_H_
+#define ODP_RING_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+#include 
+#include 
+
+/* Ring empty, not a valid data value. */
+#define RING_EMPTY ((uint32_t)-1)
+
+/* Ring of uint32_t data
+ *
+ * Ring stores head and tail counters. Ring indexes are formed from these
+ * counters with a mask (mask = ring_size - 1), which requires that ring size
+ * must be a power of two. */
+typedef struct {
+   /* Writer head and tail */
+   odp_atomic_u32_t w_head;
+   odp_atomic_u32_t w_tail;
+   uint8_t pad[ODP_CACHE_LINE_SIZE - (2 * sizeof(odp_atomic_u32_t))];
+
+   /* Reader head and tail */
+   odp_atomic_u32_t r_head;
+   odp_atomic_u32_t r_tail;
+
+   uint32_t data[0];
+} ring_t ODP_ALIGNED_CACHE;
+
+/* Initialize ring */
+static inline void ring_init(ring_t *ring)
+{
+   odp_atomic_init_u32(>w_head, 0);
+   odp_atomic_init_u32(>w_tail, 0);
+   odp_atomic_init_u32(>r_head, 0);
+   odp_atomic_init_u32(>r_tail, 0);
+}
+
+/* Dequeue data from the ring head */
+static inline uint32_t ring_deq(ring_t *ring, uint32_t mask)
+{
+   uint32_t head, tail, new_head;
+   uint32_t data;
+
+   head = odp_atomic_load_u32(>r_head);
+
+   /* Move reader head. This thread owns data at the new head. */
+   do {
+   tail = odp_atomic_load_u32(>w_tail);
+
+   if (head == tail)
+   return RING_EMPTY;
+
+   new_head = head + 1;
+
+   } while (odp_unlikely(odp_atomic_cas_acq_u32(>r_head, ,
+ new_head) == 0));
+
+   /* Read queue index */
+   data = ring->data[new_head & mask];
+
+   /* Wait until other readers have updated the tail */
+   while (odp_unlikely(odp_atomic_load_acq_u32(>r_tail) != head))
+   odp_cpu_pause();
+
+   /* Now update the reader tail */
+   odp_atomic_store_rel_u32(>r_tail, new_head);
+
+   return data;
+}
+
+/* Enqueue data into the ring tail */
+static inline void ring_enq(ring_t *ring, uint32_t mask, uint32_t data)
+{
+   uint32_t old_head, new_head;
+
+   /* Reserve a slot in the ring for writing */
+   old_head = odp_atomic_fetch_inc_u32(>w_head);
+   new_head = old_head + 1;
+
+   /* Ring is full. Wait for the last reader to finish. */
+   while (odp_unlikely(odp_atomic_load_acq_u32(>r_tail) == new_head))
+   odp_cpu_pause();


Should here be some logical timeout? For example in odp process mode if 
other process will die and not release
atomic counter you will hang here forever. The same thing can be with 
abnormal thread termination.


Maxim.


+
+   /* Write data */
+   ring->data[new_head & mask] = data;
+
+   /* Wait until other writers have updated the tail */
+   while (odp_unlikely(odp_atomic_load_acq_u32(>w_tail) != old_head))
+   odp_cpu_pause();
+
+   /* Now update the writer tail */
+   odp_atomic_store_rel_u32(>w_tail, new_head);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index 81e79c9..86c98fe 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -17,12 +17,12 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
  #include 
  #include 
  

Re: [lng-odp] [PATCH 02/10] linux-gen: pktio: do not free zero packets

2016-10-19 Thread Maxim Uvarov

On 10/19/16 15:09, Petri Savolainen wrote:

In some error cases, netmap and dpdk pktios were calling
odp_packet_free_multi with zero packets. Moved existing error
check to avoid a free call with zero packets.

Signed-off-by: Petri Savolainen 
---
  platform/linux-generic/pktio/dpdk.c   | 10 ++
  platform/linux-generic/pktio/netmap.c | 10 ++
  2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 11f3509..0eb025a 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -956,10 +956,12 @@ static int dpdk_send(pktio_entry_t *pktio_entry, int 
index,
rte_pktmbuf_free(tx_mbufs[i]);
}
  
-	odp_packet_free_multi(pkt_table, tx_pkts);

-
-   if (odp_unlikely(tx_pkts == 0 && __odp_errno != 0))
-   return -1;
+   if (odp_unlikely(tx_pkts == 0)) {
+   if (__odp_errno != 0)
+   return -1;
no need to modify original code for 2 ifs. One if and && usually 
generates faster code.



+   } else {
+   odp_packet_free_multi(pkt_table, tx_pkts);
+   }
  
  	return tx_pkts;

  }
diff --git a/platform/linux-generic/pktio/netmap.c 
b/platform/linux-generic/pktio/netmap.c
index 412beec..c1cdf72 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -830,10 +830,12 @@ static int netmap_send(pktio_entry_t *pktio_entry, int 
index,
if (!pkt_nm->lockless_tx)
odp_ticketlock_unlock(_nm->tx_desc_ring[index].s.lock);
  
-	odp_packet_free_multi(pkt_table, nb_tx);

-
-   if (odp_unlikely(nb_tx == 0 && __odp_errno != 0))
-   return -1;
+   if (odp_unlikely(nb_tx == 0)) {
+   if (__odp_errno != 0)
+   return -1;


same here.

Maxim.

+   } else {
+   odp_packet_free_multi(pkt_table, nb_tx);
+   }
  
  	return nb_tx;

  }




Re: [lng-odp] [PATCH 2/2] add travis.yml for gitub automation

2016-10-18 Thread Maxim Uvarov

btw,

can you also add call for:
./scripts/build-pktio-dpdk

to compile dpdk pktio?

And I think something similar for netmap.

Maxim.

On 10/18/16 19:06, Mike Holmes wrote:

On 18 October 2016 at 11:52, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

On 10/18/16 18:24, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically trigger CI builds

Signed-off-by: Mike Holmes <mike.hol...@linaro.org>
---
   .travis.yml | 35 +++
   1 file changed, 35 insertions(+)
   create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0675952
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@

copyright is missing.

I can add that, thanks


+
+language: c
+compiler: clang


will be good to add also gcc and cross compilation.

It fails as it is an old version of GCC on that platform, I wan to
keep this as minimal as possible, full CI is not my intent


+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool libssl-dev
graphviz mscgen git doxygen


after patch 1 you don't need git in dependencies. Do you also need -f option
to  apt-get install?

I can remove git, but I have not needed -f


+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro version is
too old and fails C99 compile
+- export CUNIT_VERSION=2.1-3

export should not be needed, just set up variable.

This is exactly how we state to do it in Dependencies in our repo so I
wont change it now. Some could change both in another patch.


+- curl -sSOL
http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2
+- tar -jxf *.bz2
+- cd CUnit*

cd and cd - change to pushd popd.


+- ./bootstrap
+- ./configure --enable-debug --enable-automated --enable-basic
--enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
+- ./configure --enable-user-guides && make
+- ./configure --enable-test-cpp && make check
+- ./configure --enable-test-vald && make check
+- ./configure --enable-test-helper && make check
+- ./configure --enable-test-perf && make check
+- ./configure --enable-test-perf-proc && make check
+- ./configure --enable-test-example && make check

why not combine options together in one line?

So that you know where the issue is, I found it very handy to split them out.
Not adverse to merging some of them BUT then the perf tests for
example which often fail will mean you have to look at the whole log
to know where the issue was, rather than just look at say the examples
to say what happened.


+- ./configure && make doxygen-doc

no need to configure for generation docs.  configure takes a lot of lines
and it's better to have something readable in the longs.

I like that this will ensure that changes to the config that has
occurred previously will not affect it.
It costs so little, but I can remove it


+- ./configure && make distcheck

Does this script does clean up? If not it will be better to do in script:
  git clean -f -d -x; ./bootstrap; ./configure && make distcheck

It does only what autotools expects it to, I dont want to add any more
than that, if we go that add scripting route maybe we start to call
check-odp, but really this is all about doing only what autotools
expect.
This is really ALL about making it possible to have coverity static
analysis run, this is not intended to be as thorough as check-odp











Re: [lng-odp] [PATCH 2/2] add travis.yml for gitub automation

2016-10-18 Thread Maxim Uvarov

On 10/18/16 18:24, Mike Holmes wrote:

allows pushes to a github clone of ODP to automatically trigger CI builds

Signed-off-by: Mike Holmes 
---
  .travis.yml | 35 +++
  1 file changed, 35 insertions(+)
  create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..0675952
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@

copyright is missing.


+
+language: c
+compiler: clang


will be good to add also gcc and cross compilation.

+sudo: required
+
+before_install:
+- sudo apt-get -qq update
+- sudo apt-get install automake autoconf libtool libssl-dev graphviz 
mscgen git doxygen


after patch 1 you don't need git in dependencies. Do you also need -f 
option to  apt-get install?

+- gem install asciidoctor
+
+#   Install cunit for the validation tests because distro version is too 
old and fails C99 compile
+- export CUNIT_VERSION=2.1-3

export should not be needed, just set up variable.


+- curl -sSOL 
http://sourceforge.net/projects/cunit/files/CUnit/${CUNIT_VERSION}/CUnit-${CUNIT_VERSION}.tar.bz2
+- tar -jxf *.bz2
+- cd CUnit*

cd and cd - change to pushd popd.


+- ./bootstrap
+- ./configure --enable-debug --enable-automated --enable-basic 
--enable-console --enable-examples --enable-test
+- make
+- sudo make install
+- cd ..
+- export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
+
+install:
+- ./bootstrap
+
+script:
+- ./configure --enable-user-guides && make
+- ./configure --enable-test-cpp && make check
+- ./configure --enable-test-vald && make check
+- ./configure --enable-test-helper && make check
+- ./configure --enable-test-perf && make check
+- ./configure --enable-test-perf-proc && make check
+- ./configure --enable-test-example && make check

why not combine options together in one line?


+- ./configure && make doxygen-doc
no need to configure for generation docs.  configure takes a lot of 
lines and it's better to have something readable in the longs.



+- ./configure && make distcheck

Does this script does clean up? If not it will be better to do in script:
 git clean -f -d -x; ./bootstrap; ./configure && make distcheck




Re: [lng-odp] [API-NEXT PATCHv2 1/2] api: dev: add device apis for numa support

2016-10-17 Thread Maxim Uvarov

On 10/13/16 03:44, Bill Fischofer wrote:

+
+#ifndef ODP_API_DEV_H_
+#define ODP_API_DEV_H_
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** @defgroup odp_dev ODP DEVICE
+ *  Operations on devices
+ *  @{
+ */
+
+/**
+ * @typedef odp_dev_t
+ * ODP Device
+ */
+
+/**
+ * @def ODP_DEV_NAME_LEN
+ * Maximum device name length in chars
+ */
+
+/**
+ * @def ODP_DEV_ANY
+ * Any device
+ */
+
+/**
+ * @def ODP_DEV_INVALID
+ * Invalid device
+ */


By defining INVALID and ANY will we miss SOME? Maybe on memory 
allocation it makes sense to provide mask of possible numa nodes and

implementation will choose what is the best?

Maxim.


Re: [lng-odp] [PATCH] timers: fix off by one tick in timer expiration processing

2016-10-17 Thread Maxim Uvarov

Merged.

On 10/14/16 14:45, Mike Holmes wrote:

also need to put
Fixes https://bugs.linaro.org/show_bug.cgi?id=2552


I put this link to git log.

Maxim.


Into the patch description, maybe that can happen as it is pushed ?

On 13 October 2016 at 17:46, Bill Fischofer 
wrote:


Since this is a bug fix, please open a Bug for it so that this can be
tracked as a defect closure.

On Thu, Oct 13, 2016 at 4:18 PM, Brian Brooks 
wrote:


A timer pool's tick starts at t0 (zero). Once the first period has

passed,

the timer pool is scanned for any timers that have expired since t0 + 1.

Current code does an atomic fetch increment on the tick, but uses the
previous tick during timer expiration processing. What is needed is the
previous tick + 1.

The observable effect without this patch is that timers are expired one
tick
period (timer resolution) later than they should be.

Signed-off-by: Brian Brooks 


Reviewed-by: Bill Fischofer 



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

diff --git a/platform/linux-generic/odp_timer.c
b/platform/linux-generic/odp_timer.c
index becea9d..b26ac6b 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -691,7 +691,7 @@ static void timer_notify(odp_timer_pool *tp)
 prev_tick = odp_atomic_fetch_inc_u64(>cur_tick);

 /* Scan timer array, looking for timers to expire */
-   (void)odp_timer_pool_expire(tp, prev_tick);
+   (void)odp_timer_pool_expire(tp, prev_tick + 1);

 /* Else skip scan of timers. cur_tick was updated and next itimer
  * invocation will process older expiration ticks as well */
--
2.7.4









Re: [lng-odp] [PATCH] linux-generic: ticketlock: add missing doxygen for ticketlock_inlines.h

2016-10-17 Thread Maxim Uvarov

Merged,
Maxim.

On 10/14/16 18:03, Mike Holmes wrote:

On 22 September 2016 at 15:04, Bill Fischofer 
wrote:


Add the missing internal doxygen documentation for the ticketlock_inlines
functions used to accelerate odp-linux even when building with
--enable-abi-compat=yes

Signed-off-by: Bill Fischofer 


Reviewed-and-tested-by: Mike Holmes 



---
  .../include/odp/api/plat/ticketlock_inlines.h  | 26
++
  1 file changed, 26 insertions(+)

diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
index 957d22e..87432a7 100644
--- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
@@ -18,6 +18,11 @@
  #include 
  #include 

+/** @internal
+ * Acquire ticket lock.
+ *
+ * @param ticketlock Pointer to a ticket lock
+ */
  static inline void _odp_ticketlock_lock(odp_ticketlock_t *ticketlock)
  {
 uint32_t ticket;
@@ -33,6 +38,14 @@ static inline void _odp_ticketlock_lock(odp_ticketlock_t
*ticketlock)
 odp_cpu_pause();
  }

+/** @internal
+ * Try to acquire ticket lock.
+ *
+ * @param tklock Pointer to a ticket lock
+ *
+ * @retval 1 lock acquired
+ * @retval 0 lock not acquired
+ */
  static inline int _odp_ticketlock_trylock(odp_ticketlock_t *tklock)
  {
 /* We read 'next_ticket' and 'cur_ticket' non-atomically which
should
@@ -61,6 +74,11 @@ static inline int _odp_ticketlock_trylock(odp_ticketlock_t
*tklock)
 return 0;
  }

+/** @internal
+ * Release ticket lock
+ *
+ * @param ticketlock Pointer to a ticket lock
+ */
  static inline void _odp_ticketlock_unlock(odp_ticketlock_t *ticketlock)
  {
 /* Release the lock by incrementing 'cur_ticket'. As we are the
@@ -73,6 +91,14 @@ static inline void _odp_ticketlock_unlock(odp_ticketlock_t
*ticketlock)
 odp_atomic_store_rel_u32(>cur_ticket, cur + 1);
  }

+/** @internal
+ * Check if ticket lock is locked
+ *
+ * @param ticketlock Pointer to a ticket lock
+ *
+ * @retval 1 the lock is busy (locked)
+ * @retval 0 the lock is available (unlocked)
+ */
  static inline int _odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock)
  {
 /* Compare 'cur_ticket' with 'next_ticket'. Ideally we should read
--
2.7.4








Re: [lng-odp] [PATCH] example: generator: actually use specified default

2016-10-14 Thread Maxim Uvarov

Retested this patch again. Now I can not reproduce issue. Merged.

Maxim.

On 10/12/16 21:42, Mike Holmes wrote:



On 22 September 2016 at 10:33, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Reverted this patch due to have issues with performance/odp_l2fwd


The patch is correct I think, the intended default is not being honored.
If the odp_l2fwd app depends on the incorrect behavior and actually 
requires a flood, that needs a patch to specify the behavior it 
actually needs.
I did not see the failure on my platform, so I cannot confirm this, 
but I think this will do it


diff --git a/test/common_plat/performance/odp_l2fwd_run.sh 
b/test/common_plat/performance/odp_l2fwd_run.sh

index e64aa47..757cf53 100755
--- a/test/common_plat/performance/odp_l2fwd_run.sh
+++ b/test/common_plat/performance/odp_l2fwd_run.sh
@@ -32,6 +32,8 @@ TEST_SKIPPED=77
 PLATFORM_VALIDATION=${TEST_SRC_DIR}/../../$ODP_PLATFORM/validation
+FLOOD_MODE=0
+
 # Use installed pktio env or for make check take it from platform 
directory

 if [ -f "./pktio_env" ]; then
. ./pktio_env
@@ -66,7 +68,7 @@ run_l2fwd()
#@todo: limit odp_generator to cores
#https://bugs.linaro.org/show_bug.cgi?id=1398
-   (odp_generator${EXEEXT} -I $IF0 \
+   (odp_generator${EXEEXT} --interval $FLOOD_MODE -I $IF0 \
--srcip 192.168.0.1 --dstip 192.168.0.2 \
-m u 2>&1 > /dev/null) \
2>&1 > /dev/null &

 I will post the pair as a new series.



Maxim.

On 09/14/16 05:50, Bill Fischofer wrote:

On Tue, Sep 13, 2016 at 12:35 PM, Mike Holmes
<mike.hol...@linaro.org <mailto:mike.hol...@linaro.org>>
wrote:

The help states default is 1000ms. 0 for flood mode,
however the
default was incorrectly set to zero.

Signed-off-by: Mike Holmes <mike.hol...@linaro.org
<mailto:mike.hol...@linaro.org>>

Reviewed-by: Bill Fischofer <bill.fischo...@linaro.org
<mailto:bill.fischo...@linaro.org>>


---
  example/generator/odp_generator.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/example/generator/odp_generator.c
b/example/generator/odp_
generator.c
index b0053b9..48d7f5f 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -946,6 +946,7 @@ static void parse_args(int argc, char
*argv[],
appl_args_t *appl_args)
 appl_args->number = -1;
 appl_args->payload = 56;
 appl_args->timeout = -1;
+   appl_args->interval = DEFAULT_PKT_INTERVAL;

 opterr = 0; /* do not issue errors on helper
options */

--
2.7.4






--
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"





[lng-odp] [PATCHv3] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-14 Thread Maxim Uvarov
Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---

 v3: update if logic (found just after apply.)
 v2: update description (Mike)
 test/common_plat/performance/odp_pktio_perf.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..483f067 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+#define TEST_SKIP 77
+
 #define PKT_BUF_NUM   8192
 #define MAX_NUM_IFACES2
 #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
   gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}
 
if (gbl_args->args.num_tx_workers) {
@@ -659,7 +661,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
 
 static int run_test(void)
 {
-   int ret = 1;
+   int ret;
int i;
odp_cpumask_t txmask, rxmask;
test_status_t status = {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};
 
-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;
 
printf("Starting test with params:\n");
printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;
 
-   while (ret > 0)
+   while (1) {
ret = run_test_single(, , );
+   if (ret <= 0)
+   break;
+   }
 
return ret;
 }
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCHv2] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-14 Thread Maxim Uvarov

Reverted patch.

I must be more careful with review my own patches.

On 10/13/16 23:57, Mike Holmes wrote:



On 13 October 2016 at 12:37, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org
<mailto:maxim.uva...@linaro.org>


Reviewed-and-tested-by: Mike Holmes <mike.hol...@linaro.org 
<mailto:mike.hol...@linaro.org>>


Using .travis.yml script added to the root of odp  to get github to 
run on every push you make to git hub.


before
https://travis-ci.org/mike-holmes-linaro/odp/builds/167472534#L1595
after
https://travis-ci.org/mike-holmes-linaro/odp/builds/167474316

---

 v2: update description (Mike)

 test/common_plat/performance/odp_pktio_perf.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..846dfaa 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
 #include 
 #include 

+#define TEST_SKIP 77
+
 #define PKT_BUF_NUM   8192
 #define MAX_NUM_IFACES2
 #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t
*thd_mask_tx,
 gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}

if (gbl_args->args.num_tx_workers) {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};

-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;

printf("Starting test with params:\n");
printf("\tTransmit workers: \t%d\n",
odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;

-   while (ret > 0)
+   while (1) {
ret = run_test_single(, , );
+   if (ret)
+   break;



has to be if (ret <= 0)




+   }

return ret;
 }
--
2.7.1.250.gff4ea60




--
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"





Re: [lng-odp] [PATCHv2] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-14 Thread Maxim Uvarov

Merged.

I think it will be good to commit .travis.yml into repo. So that any git 
push to github will run tests.


Maxim.

On 10/13/16 23:57, Mike Holmes wrote:



On 13 October 2016 at 12:37, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org
<mailto:maxim.uva...@linaro.org>


Reviewed-and-tested-by: Mike Holmes <mike.hol...@linaro.org 
<mailto:mike.hol...@linaro.org>>


Using .travis.yml script added to the root of odp  to get github to 
run on every push you make to git hub.


before
https://travis-ci.org/mike-holmes-linaro/odp/builds/167472534#L1595
after
https://travis-ci.org/mike-holmes-linaro/odp/builds/167474316

---

 v2: update description (Mike)

 test/common_plat/performance/odp_pktio_perf.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..846dfaa 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
 #include 
 #include 

+#define TEST_SKIP 77
+
 #define PKT_BUF_NUM   8192
 #define MAX_NUM_IFACES2
 #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t
*thd_mask_tx,
 gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}

if (gbl_args->args.num_tx_workers) {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};

-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;

printf("Starting test with params:\n");
printf("\tTransmit workers: \t%d\n",
odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;

-   while (ret > 0)
+   while (1) {
ret = run_test_single(, , );
+   if (ret)
+   break;
+   }

return ret;
 }
--
2.7.1.250.gff4ea60




--
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"





Re: [lng-odp] [API-NEXT PATCH 1/5] api: improve name argument definitions in *_create() functions

2016-10-14 Thread Maxim Uvarov

On 10/14/16 11:49, Matias Elo wrote:

The current APIs don't always define valid name argument values. Fix this
by stating when NULL is a valid value and when the name string doesn't have
to be unique.

Signed-off-by: Matias Elo 
---
  include/odp/api/spec/classification.h | 10 ++
  include/odp/api/spec/pool.h   | 17 ++---
  include/odp/api/spec/queue.h  |  9 ++---
  include/odp/api/spec/schedule.h   | 12 ++--
  include/odp/api/spec/timer.h  |  5 -
  5 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/include/odp/api/spec/classification.h 
b/include/odp/api/spec/classification.h
index 189c91f..0e442c7 100644
--- a/include/odp/api/spec/classification.h
+++ b/include/odp/api/spec/classification.h
@@ -193,12 +193,14 @@ int odp_cls_capability(odp_cls_capability_t *capability);
  /**
   * Create a class-of-service
   *
- * @param  nameString intended for debugging purposes.
+ * The use of class-of-service name is optional. Unique names are not required.
   *
- * @param  param   class of service parameters
+ * @param   nameName of the class-of-service or NULL. Maximum string
+ *  length is ODP_COS_NAME_LEN.
+ * @param   param   Class-of-service parameters
   *
- * @retval class of service handle
- * @retval ODP_COS_INVALID on failure.
+ * @retval  Class-of-service handle
+ * @retval  ODP_COS_INVALID on failure.
   *
   * @note ODP_QUEUE_INVALID and ODP_POOL_INVALID are valid values for queue
   * and pool associated with a class of service and when any one of these 
values
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h
index c80c98a..a1331e3 100644
--- a/include/odp/api/spec/pool.h
+++ b/include/odp/api/spec/pool.h
@@ -220,14 +220,12 @@ typedef struct odp_pool_param_t {
  /**
   * Create a pool
   *
- * This routine is used to create a pool. It take two arguments: the optional
- * name of the pool to be created and a parameter struct that describes the
- * pool to be created. If a name is not specified the result is an anonymous
- * pool that cannot be referenced by odp_pool_lookup().
- *
- * @param name Name of the pool, max ODP_POOL_NAME_LEN-1 chars.
- * May be specified as NULL for anonymous pools.
+ * This routine is used to create a pool. The use of pool name is optional.
+ * Unique names are not required. However, odp_pool_lookup() returns only a
+ * single matching pool.
   *
+ * @param name Name of the pool or NULL. Maximum string length is
+ * ODP_POOL_NAME_LEN.
   * @param params   Pool parameters.
   *
   * @return Handle of the created pool
@@ -256,11 +254,8 @@ int odp_pool_destroy(odp_pool_t pool);
   *
   * @param name  Name of the pool
   *
- * @return Handle of found pool
+ * @return Handle of the first matching pool
   * @retval ODP_POOL_INVALID  Pool could not be found
- *
- * @note This routine cannot be used to look up an anonymous pool (one created
- * with no name).
   */
  odp_pool_t odp_pool_lookup(const char *name);
  
diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h

index 31dc9f5..b0c5e31 100644
--- a/include/odp/api/spec/queue.h
+++ b/include/odp/api/spec/queue.h
@@ -173,9 +173,12 @@ typedef struct odp_queue_param_t {
   * Create a queue according to the queue parameters. Queue type is specified 
by
   * queue parameter 'type'. Use odp_queue_param_init() to initialize parameters
   * into their default values. Default values are also used when 'param' 
pointer
- * is NULL. The default queue type is ODP_QUEUE_TYPE_PLAIN.
+ * is NULL. The default queue type is ODP_QUEUE_TYPE_PLAIN. The use of queue
+ * name is optional. Unique names are not required. However, odp_queue_lookup()
+ * returns only a single matching queue.
   *
- * @param nameQueue name
+ * @param nameName of the queue or NULL. Maximum string length is
+ *ODP_QUEUE_NAME_LEN.
   * @param param   Queue parameters. Uses defaults if NULL.
   *
   * @return Queue handle
@@ -203,7 +206,7 @@ int odp_queue_destroy(odp_queue_t queue);
   *
   * @param nameQueue name
   *
- * @return Queue handle
+ * @return Handle of the first matching queue
   * @retval ODP_QUEUE_INVALID on failure
   */
  odp_queue_t odp_queue_lookup(const char *name);
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h
index d924da2..f976a4c 100644
--- a/include/odp/api/spec/schedule.h
+++ b/include/odp/api/spec/schedule.h
@@ -214,10 +214,12 @@ int odp_schedule_num_prio(void);
   * mask will receive events from a queue that belongs to the schedule group.
   * Thread masks of various schedule groups may overlap. There are predefined
   * groups such as ODP_SCHED_GROUP_ALL and ODP_SCHED_GROUP_WORKER, which are
- * always present and automatically updated. Group name is optional
- * (may be NULL) and can have 

Re: [lng-odp] [PATCH v2] linux-gen: build: de-couple abi compatibility from shared lib

2016-10-13 Thread Maxim Uvarov

On 10/13/16 19:33, Mike Holmes wrote:

Anders comments have not been addressed on the list, are they resloved ?



In current patch set - no. Because it's subject for separate patch. But 
we need resolve version name before tagging.


Maxim.


On 13 October 2016 at 11:40, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Merged,

we also need this option to be tested in CI.

Maxim.


On 10/12/16 18:21, Bill Fischofer wrote:

This version resolves the issue with running from an installed
copy of ODP.

On Thu, Sep 29, 2016 at 6:46 PM, Petri Savolainen <
petri.savolai...@nokia.com
<mailto:petri.savolai...@nokia.com>> wrote:

Building ABI compatible or shared library are two different
targets. A shared library may be used also without ABI
compatibility. A new --enable-abi-compat configuration option
is introduced. By default libraries are not built in ABI
compat
mode to enable function inlining. There is a noticeable
performance difference when e.g. odp_atomic_xxx calls
are not inlined.

Signed-off-by: Petri Savolainen
<petri.savolai...@nokia.com
<mailto:petri.savolai...@nokia.com>>

Reviewed-and-tested-by: Bill Fischofer
<bill.fischo...@linaro.org <mailto:bill.fischo...@linaro.org>>


---
configure.ac <http://configure.ac>  |
26 -
  platform/linux-generic/.gitignore   |  2 +-
  platform/linux-generic/Makefile.am <http://e.am>
   |  2 +-

  platform/linux-generic/include/odp/api/atomic.h   |  4 +--
  platform/linux-generic/include/odp/api/byteorder.h |  4 +--
  .../include/odp/api/plat/inlines.h.in
<http://inlines.h.in> | 33
--
  .../include/odp/api/plat/static_inline.h.in
<http://static_inline.h.in> | 32
+
  platform/linux-generic/include/odp/api/std_clib.h |  4 +--
  platform/linux-generic/include/odp/api/sync.h |  4 +--
  platform/linux-generic/m4/configure.m4  |  2 +-
  platform/linux-generic/odp_atomic.c   |  2 +-
  platform/linux-generic/odp_byteorder.c  |  2 +-
  platform/linux-generic/odp_std_clib.c   |  2 +-
  platform/linux-generic/odp_sync.c   |  2 +-
  14 files changed, 66 insertions(+), 55 deletions(-)
  delete mode 100644
platform/linux-generic/include/odp/api/plat/inlines.
h.in <http://h.in>
  create mode 100644
platform/linux-generic/include/odp/api/plat/static_
inline.h.in <http://inline.h.in>

diff --git a/configure.ac <http://configure.ac>
b/configure.ac <http://configure.ac>
index 982aff7..f081c51 100644
--- a/configure.ac <http://configure.ac>
+++ b/configure.ac <http://configure.ac>
@@ -176,13 +176,6 @@ AM_CONDITIONAL([test_example], [test
x$test_example =
xyes ])
  AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" =
"xdoxygen"])
  AM_CONDITIONAL([user_guide], [test "x${user_guides}" =
"xyes" ])
  AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" =
"xmscgen"])
-if test x$enable_shared != xyes;
-then
-   _ODP_INLINES="_ODP_INLINES"
-else
-   _ODP_INLINES="_ODP_NO_INLINES"
-fi
-AC_SUBST(_ODP_INLINES)

  
##
  # Setup doxygen documentation
@@ -225,6 +218,22 @@ AC_ARG_ENABLE([debug],
  ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"

  
##
+# Enable/disable ABI compatible build
+###
###
+ODP_ABI_COMPAT=1
+abi_compat=yes
+AC_ARG_ENABLE([abi-compat],
+[  --enable-abi-compat build all targets in ABI
compatible mode
(default=yes)],
+[if test "x$enableval" = "xyes"; then
+   ODP_ABI_COMPAT=1
+   abi_compat=yes
+ else
+   ODP_ABI_COMPAT=0
+   abi_comp

[lng-odp] [PATCHv2] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-13 Thread Maxim Uvarov
Make check should skip the test instead of failing it.
Test splits RX and TX cores for packet processing. Core
0 bind to control thread. So running machine should have
at least 2 worker threads which is not enough on 1 and 2
cpus machine. CUnit uses special value 77 to mark test as
SKIPPED and not fail on it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---

 v2: update description (Mike)

 test/common_plat/performance/odp_pktio_perf.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..846dfaa 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+#define TEST_SKIP 77
+
 #define PKT_BUF_NUM   8192
 #define MAX_NUM_IFACES2
 #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
   gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}
 
if (gbl_args->args.num_tx_workers) {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};
 
-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;
 
printf("Starting test with params:\n");
printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;
 
-   while (ret > 0)
+   while (1) {
ret = run_test_single(, , );
+   if (ret)
+   break;
+   }
 
return ret;
 }
-- 
2.7.1.250.gff4ea60



Re: [lng-odp] [PATCH v2] linux-gen: build: de-couple abi compatibility from shared lib

2016-10-13 Thread Maxim Uvarov

Merged,

we also need this option to be tested in CI.

Maxim.

On 10/12/16 18:21, Bill Fischofer wrote:

This version resolves the issue with running from an installed copy of ODP.

On Thu, Sep 29, 2016 at 6:46 PM, Petri Savolainen <
petri.savolai...@nokia.com> wrote:


Building ABI compatible or shared library are two different
targets. A shared library may be used also without ABI
compatibility. A new --enable-abi-compat configuration option
is introduced. By default libraries are not built in ABI compat
mode to enable function inlining. There is a noticeable
performance difference when e.g. odp_atomic_xxx calls
are not inlined.

Signed-off-by: Petri Savolainen 


Reviewed-and-tested-by: Bill Fischofer 



---
  configure.ac   | 26 -
  platform/linux-generic/.gitignore  |  2 +-
  platform/linux-generic/Makefile.am |  2 +-
  platform/linux-generic/include/odp/api/atomic.h|  4 +--
  platform/linux-generic/include/odp/api/byteorder.h |  4 +--
  .../include/odp/api/plat/inlines.h.in  | 33
--
  .../include/odp/api/plat/static_inline.h.in| 32
+
  platform/linux-generic/include/odp/api/std_clib.h  |  4 +--
  platform/linux-generic/include/odp/api/sync.h  |  4 +--
  platform/linux-generic/m4/configure.m4 |  2 +-
  platform/linux-generic/odp_atomic.c|  2 +-
  platform/linux-generic/odp_byteorder.c |  2 +-
  platform/linux-generic/odp_std_clib.c  |  2 +-
  platform/linux-generic/odp_sync.c  |  2 +-
  14 files changed, 66 insertions(+), 55 deletions(-)
  delete mode 100644 platform/linux-generic/include/odp/api/plat/inlines.
h.in
  create mode 100644 platform/linux-generic/include/odp/api/plat/static_
inline.h.in

diff --git a/configure.ac b/configure.ac
index 982aff7..f081c51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,13 +176,6 @@ AM_CONDITIONAL([test_example], [test x$test_example =
xyes ])
  AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = "xdoxygen"])
  AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ])
  AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"])
-if test x$enable_shared != xyes;
-then
-   _ODP_INLINES="_ODP_INLINES"
-else
-   _ODP_INLINES="_ODP_NO_INLINES"
-fi
-AC_SUBST(_ODP_INLINES)

  
##
  # Setup doxygen documentation
@@ -225,6 +218,22 @@ AC_ARG_ENABLE([debug],
  ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"

  
##
+# Enable/disable ABI compatible build
+###
###
+ODP_ABI_COMPAT=1
+abi_compat=yes
+AC_ARG_ENABLE([abi-compat],
+[  --enable-abi-compat build all targets in ABI compatible mode
(default=yes)],
+[if test "x$enableval" = "xyes"; then
+   ODP_ABI_COMPAT=1
+   abi_compat=yes
+ else
+   ODP_ABI_COMPAT=0
+   abi_compat=no
+fi])
+AC_SUBST(ODP_ABI_COMPAT)
+
+###
###
  # Default warning setup
  
##
  ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes
-Wmissing-prototypes"
@@ -307,6 +316,9 @@ AC_MSG_RESULT([
 am_ldflags: ${AM_LDFLAGS}
 libs:   ${LIBS}
 defs:   ${DEFS}
+   static libraries:   ${enable_static}
+   shared libraries:   ${enable_shared}
+   ABI compatible: ${abi_compat}
 cunit:  ${cunit_support}
 test_vald:  ${test_vald}
 test_perf:  ${test_perf}
diff --git a/platform/linux-generic/.gitignore b/platform/linux-generic/.
gitignore
index ec6ca37..909756a 100644
--- a/platform/linux-generic/.gitignore
+++ b/platform/linux-generic/.gitignore
@@ -1 +1 @@
-include/odp/api/plat/inlines.h
+include/odp/api/plat/static_inline.h
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/
Makefile.am
index 900ac08..0ec13d4 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -61,7 +61,7 @@ odpapiinclude_HEADERS = \

  odpapiplatincludedir= $(includedir)/odp/api/plat
  odpapiplatinclude_HEADERS = \
- $(builddir)/include/odp/api/plat/inlines.h \
+ $(builddir)/include/odp/api/plat/static_inline.h \
   $(srcdir)/include/odp/api/plat/atomic_inlines.h \
   $(srcdir)/include/odp/api/plat/atomic_types.h \
   $(srcdir)/include/odp/api/plat/barrier_types.h \
diff --git a/platform/linux-generic/include/odp/api/atomic.h
b/platform/linux-generic/include/odp/api/atomic.h
index c18e68b..7886cb4 100644
--- 

Re: [lng-odp] ODPèDPDK Documentation & build

2016-10-11 Thread Maxim Uvarov
Try to clone it by name, not by IP address:
git clone git://dpdk.org/dpdk

Get this link from here:
http://dpdk.org/dev

and please be free to provide link correction patch.


Maxim.




On 11 October 2016 at 16:51, Elo, Matias (Nokia - FI/Espoo) <
matias@nokia-bell-labs.com> wrote:

> > -Original Message-
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Francois
> > Ozog
> > Sent: Tuesday, October 11, 2016 4:23 PM
> > To: LNG ODP Mailman List 
> > Subject: [lng-odp] ODPèDPDK Documentation & build
> >
> > Building on a vanilla Debian following the README.DPDK has not been
> totally
> > seamless...
> >
> > As I am not fully sure about my workarounds, it would be nice somebody
> > check and corrects the README.DPDK.
> >
> > Cordially,
>
> Hi Francois,
>
> The README file seems to be badly outdated. I'll create a patch to fix the
> file tomorrow.
>
> P.S.  odp-dpdk has own mailing list: lng-odp-d...@lists.linaro.org.
>
> -Matias
>
>
> >
> > François-Frédéric
> >
> >  *git clone http://92.243.14.124/git/dpdk
> >  ./dpdk*
> >
> > but this does not work:
> > Cloning into './dpdk'...
> > fatal: repository 'http://92.243.14.124/git/dpdk/' not found
> >
> >
> > so why not using the official link???
> >
> > git clone git://dpdk.org/dpdk
> > Cloning into 'dpdk'...
> > remote: Counting objects: 54717, done.
> > remote: Compressing objects: 100% (11606/11606), done.
> > remote: Total 54717 (delta 43712), reused 53550 (delta 42797)
> > Receiving objects: 100% (54717/54717), 26.80 MiB | 425.00 KiB/s, done.
> > Resolving deltas: 100% (43712/43712), done.
> > Checking connectivity... done.
> >
> >
> >
> > *Set CONFIG_RTE_BUILD_COMBINE_LIBS=y*
> > This parameter does not exist (anymore ?)
> >
> >
> > *CONFIG_RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP=y*
> > This parameter does not exist (anymore?)
> >
> > *build with EXTRA_CFLAGS="-fPIC"*
> > Does not produce the best code. Is there a reason for that ?
> >
> > *Dependence DPDK build*
> > No information on pre-requisites. You need to point to DPDK doc or to
> give
> > full build intructions or pre-requisites.
> > On a fresh Debian install you need:
> > apt-get install dkms libncurses5-dev libpcap-dev
> >
> > the make command lacks the DESTDIR parameter
> >  make install T=x86_64-native-linuxapp-gcc EXTRA_CFLAGS="-fPIC"
> > DESTDIR=../dpdk-16.07/
> >
> >
> > *odp-dpdk build*
> >
> > ./configure --with-platform=linux-dpdk --with-sdk-install-path= > dir>/x86_64-native-linuxapp-gcc
> > Should say it is the DPDK ABSOLUTE PATH, not relative!
> >
> >
> > lacks:
> > export RTE_SDK=
> > export RTE_TARGET=x86_64-native-linuxapp-gcc
> >
> > *Checking compiled ODP with sample app*
> >
> > to run an ODP-dpdk app, it should be clear that it must be run as root
> and
> > that DPDK parameters are to be in a variable.
> >
> >  sudo ODP_PLATFORM_PARAMS="-l0 --no-huge" ./odp_hello -c 0 -n 1
> >
> > doing an export and just a sudo does not work.
> >
> >
> > --
> > [image: Linaro] 
> > François-Frédéric Ozog | *Director Linaro Networking Group*
> > T: +33.67221.6485
> > francois.o...@linaro.org | Skype: ffozog
>


Re: [lng-odp] [API-NEXT PATCH 04/14] api: shm: add flag to guarantee address unicity on all ODP threads

2016-10-07 Thread Maxim Uvarov

On 10/07/16 13:35, Christophe Milard wrote:

The ODP_SHM_SINGLE_VA flag is created: when set (at odp_shm_reserve()),
this flag guarantees that all ODP threads sharing this memory
block will see the block at the same address (regadless of ODP
thread type -pthread vs process- or fork time)

Signed-off-by: Christophe Milard 
---
  include/odp/api/spec/shared_memory.h | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/spec/shared_memory.h 
b/include/odp/api/spec/shared_memory.h
index 8c76807..fefb5d6 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -45,10 +45,9 @@ extern "C" {
  /*
   * Shared memory flags
   */
-
-/* Share level */
-#define ODP_SHM_SW_ONLY 0x1 /**< Application SW only, no HW access */
-#define ODP_SHM_PROC0x2 /**< Share with external processes */
+#define ODP_SHM_SW_ONLY0x1 /**< Application SW only, no HW 
access   */
+#define ODP_SHM_PROC   0x2 /**< Share with external processes   */
+#define ODP_SHM_SINGLE_VA  0x4 /**< guarantee unique addr on all threads*/


Please merge it to patch 6 and do not modify original lines. (don't 
forget about no create flag).


Maxim.

  
  /**

   * Shared memory block info




Re: [lng-odp] [API-NEXT PATCH 06/14] api: shm: add flag to lock memory

2016-10-07 Thread Maxim Uvarov

On 10/07/16 13:35, Christophe Milard wrote:

The ODP_SHM_LOCK flag is created: when set (at odp_shm_reserve()),
this flag locks the reserved memory (prevent swapping)

Signed-off-by: Christophe Milard 
---
  include/odp/api/spec/shared_memory.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/include/odp/api/spec/shared_memory.h 
b/include/odp/api/spec/shared_memory.h
index fefb5d6..fe683d4 100644
--- a/include/odp/api/spec/shared_memory.h
+++ b/include/odp/api/spec/shared_memory.h
@@ -48,6 +48,7 @@ extern "C" {
  #define ODP_SHM_SW_ONLY   0x1 /**< Application SW only, no HW 
access   */
  #define ODP_SHM_PROC  0x2 /**< Share with external processes   */
  #define ODP_SHM_SINGLE_VA 0x4 /**< guarantee unique addr on all threads*/
+#define ODP_SHM_LOCK   0x8 /**< prevent swapping this memory*/
  

this patch also should change no create to 16:

#define _ODP_SHM_PROC_NOCREAT 0x4

  /**
   * Shared memory block info




Re: [lng-odp] [API-NEXT PATCH 10/14] linux-gen: _ishm: adding function to map memory from other ODP

2016-10-07 Thread Maxim Uvarov

On 10/07/16 13:35, Christophe Milard wrote:

functionality to export and map memory between ODP instance is added:
This includes:
- a bit of simplification in _odp_ishm_reserve() for externaly provided
   file descriptors.
- a new function, _odp_ishm_reserve_exported() to map memory from
   other ODP instances (On same OS)

Signed-off-by: Christophe Milard 
---
  platform/linux-generic/_ishm.c  | 119 ++--
  platform/linux-generic/include/_ishm_internal.h |   7 ++
  2 files changed, 97 insertions(+), 29 deletions(-)

diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c
index dabd426..7624eca 100644
--- a/platform/linux-generic/_ishm.c
+++ b/platform/linux-generic/_ishm.c
@@ -141,6 +141,7 @@ typedef struct ishm_fragment {
   * will allocate both a block and a fragment.
   * Blocks contain only global data common to all processes.
   */
+typedef enum {UNKNOWN, HUGE, NORMAL, EXTERNAL} huge_flag_t;


We should be careful with huge / normal pages. Huge pages might be 
different size even on the same machine (2M, 1G).

Maybe it's better to have size of page instead of if it's huge or not.

Maxim.

  typedef struct ishm_block {
char name[ISHM_NAME_MAXLEN];/* name for the ishm block (if any) */
char filename[ISHM_FILENAME_MAXLEN]; /* name of the .../odp-* file  */
@@ -151,7 +152,7 @@ typedef struct ishm_block {
void *start; /* only valid if _ODP_ISHM_SINGLE_VA is set*/
uint64_t len;/* length. multiple of page size. 0 if free*/
ishm_fragment_t *fragment; /* used when _ODP_ISHM_SINGLE_VA is used */
-   int   huge; /* true if this segment is mapped using huge pages  */
+   huge_flag_t huge;/* page type: external means unknown here. */
uint64_t seq;   /* sequence number, incremented on alloc and free   */
uint64_t refcnt;/* number of linux processes mapping this block */
  } ishm_block_t;
@@ -389,7 +390,8 @@ static void free_fragment(ishm_fragment_t *fragmnt)
   * or /mnt/huge/odp-- (for huge pages)
   * Return the new file descriptor, or -1 on error.
   */
-static int create_file(int block_index, int huge, uint64_t len, uint32_t flags)
+static int create_file(int block_index, huge_flag_t huge,
+  uint64_t len, uint32_t flags)
  {
char *name;
int  fd;
@@ -406,10 +408,11 @@ static int create_file(int block_index, int huge, 
uint64_t len, uint32_t flags)
 ishm_tbl->dev_seq++);
  
  	/* huge dir must be known to create files there!: */

-   if (huge && !odp_global_data.hugepage_info.default_huge_page_dir)
+   if ((huge == HUGE) &&
+   (!odp_global_data.hugepage_info.default_huge_page_dir))
return -1;
  
-	if (huge)

+   if (huge == HUGE)
snprintf(filename, ISHM_FILENAME_MAXLEN,
 ISHM_FILENAME_FORMAT,
 odp_global_data.hugepage_info.default_huge_page_dir,
@@ -465,7 +468,7 @@ static int create_file(int block_index, int huge, uint64_t 
len, uint32_t flags)
   * Mutex must be assured by the caller.
   */
  static void *do_map(int block_index, uint64_t len, uint32_t align,
-   uint32_t flags, int huge, int *fd)
+   uint32_t flags, huge_flag_t huge, int *fd)
  {
ishm_block_t *new_block;  /* entry in the main block table   */
void *addr = NULL;
@@ -519,8 +522,6 @@ static void *do_map(int block_index, uint64_t len, uint32_t 
align,
return NULL;
}
  
-	new_block->huge = huge;

-
return mapped_addr;
  }
  
@@ -723,27 +724,21 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd,

int new_index;/* index in the main block table*/
ishm_block_t *new_block;  /* entry in the main block table*/
uint64_t page_sz; /* normal page size. usually 4K*/
-   uint64_t alloc_size;  /* includes extra for alignement*/
uint64_t page_hp_size;/* huge page size */
-   uint64_t alloc_hp_size;   /* includes extra for alignement*/
uint32_t hp_align;
uint64_t len; /* mapped length */
void *addr = NULL;/* mapping address */
int new_proc_entry;
-
-   page_sz = odp_sys_page_size();
+   struct stat statbuf;
  
  	odp_spinlock_lock(_tbl->lock);
  
  	/* update this process view... */

procsync();
  
-	/* roundup to page size */

-   alloc_size = (size + (page_sz - 1)) & (-page_sz);
-
+   /* Get system page sizes: page_hp_size is 0 if no huge page available*/
+   page_sz  = odp_sys_page_size();
page_hp_size = odp_sys_huge_page_size();
-   /* roundup to page size */
-   alloc_hp_size = (size + (page_hp_size - 1)) & (-page_hp_size);
  
  	/* check if name already 

Re: [lng-odp] [PATCH] validation: packet: remove todos from packet tests

2016-10-06 Thread Maxim Uvarov

ping, please review.

Maxim.

On 09/12/16 23:48, Bill Fischofer wrote:

Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2405 by removing
todos in packet validation test. Add additional tests for todos that can
be resolved within current ODP API set and remove the rest to be deferred
for latest updates.

Signed-off-by: Bill Fischofer 
---
  test/common_plat/validation/api/packet/packet.c | 56 -
  1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/test/common_plat/validation/api/packet/packet.c 
b/test/common_plat/validation/api/packet/packet.c
index a4426e2..c75cde9 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -32,6 +32,28 @@ static struct udata_struct {
"abcdefg",
  };
  
+static void _packet_compare_data(odp_packet_t pkt1, odp_packet_t pkt2)

+{
+   uint32_t len = odp_packet_len(pkt1);
+   uint32_t offset = 0;
+   uint32_t seglen1, seglen2, cmplen;
+
+   CU_ASSERT_FATAL(len == odp_packet_len(pkt2));
+
+   while (len > 0) {
+   void *pkt1map = odp_packet_offset(pkt1, offset, , NULL);
+   void *pkt2map = odp_packet_offset(pkt2, offset, , NULL);
+
+   CU_ASSERT_PTR_NOT_NULL_FATAL(pkt1map);
+   CU_ASSERT_PTR_NOT_NULL_FATAL(pkt2map);
+   cmplen = seglen1 < seglen2 ? seglen1 : seglen2;
+   CU_ASSERT(!memcmp(pkt1map, pkt2map, cmplen));
+
+   offset += cmplen;
+   len-= cmplen;
+   }
+}
+
  int packet_suite_init(void)
  {
odp_pool_param_t params;
@@ -298,7 +320,8 @@ void packet_test_event_conversion(void)
  
  	tmp_pkt = odp_packet_from_event(ev);

CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID);
-   /** @todo: Need an API to compare packets */
+   CU_ASSERT(tmp_pkt == pkt);
+   _packet_compare_data(tmp_pkt, pkt);
  }
  
  void packet_test_basic_metadata(void)

@@ -502,7 +525,7 @@ void packet_test_headroom(void)
  
  	seg_data_len = odp_packet_seg_len(pkt);

CU_ASSERT(seg_data_len >= 1);
-   /** @todo: should be len - 1 */
+
pull_val = seg_data_len / 2;
push_val = room;
  
@@ -625,7 +648,7 @@ void packet_test_tailroom(void)
  
  	seg_data_len = odp_packet_seg_data_len(pkt, segment);

CU_ASSERT(seg_data_len >= 1);
-   /** @todo: should be len - 1 */
+
pull_val = seg_data_len / 2;
/* Leave one byte in a tailroom for odp_packet_tail() to succeed */
push_val = (room > 0) ? room - 1 : room;
@@ -681,10 +704,10 @@ void packet_test_segments(void)
CU_ASSERT_PTR_NOT_NULL(seg_data);
CU_ASSERT(odp_packet_seg_to_u64(seg) !=
  odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID));
+   CU_ASSERT(odp_memcmp(seg_data, seg_data, seg_data_len) == 0);
  
  		data_len += seg_data_len;
  
-		/** @todo: touch memory in a segment */

seg_index++;
seg = odp_packet_next_seg(pkt, seg);
}
@@ -713,10 +736,10 @@ void packet_test_segments(void)
CU_ASSERT(seg_data != NULL);
CU_ASSERT(odp_packet_seg_to_u64(seg) !=
  odp_packet_seg_to_u64(ODP_PACKET_SEG_INVALID));
+   CU_ASSERT(odp_memcmp(seg_data, seg_data, seg_data_len) == 0);
  
  		data_len += seg_data_len;
  
-		/** @todo: touch memory in a segment */

seg_index++;
seg = odp_packet_next_seg(seg_pkt, seg);
}
@@ -784,7 +807,6 @@ void packet_test_error_flags(void)
/**
 * The packet have not been classified so it doesn't have error flags
 * properly set. Just check that functions return one of allowed values.
-* @todo: try with known good and bad packets.
 */
err = odp_packet_has_error(pkt);
CU_ASSERT(err == 0 || err == 1);
@@ -922,28 +944,6 @@ static void _packet_compare_inflags(odp_packet_t pkt1, 
odp_packet_t pkt2)
COMPARE_INFLAG(pkt1, pkt2, shaper_len_adjust);
  }
  
-static void _packet_compare_data(odp_packet_t pkt1, odp_packet_t pkt2)

-{
-   uint32_t len = odp_packet_len(pkt1);
-   uint32_t offset = 0;
-   uint32_t seglen1, seglen2, cmplen;
-
-   CU_ASSERT_FATAL(len == odp_packet_len(pkt2));
-
-   while (len > 0) {
-   void *pkt1map = odp_packet_offset(pkt1, offset, , NULL);
-   void *pkt2map = odp_packet_offset(pkt2, offset, , NULL);
-
-   CU_ASSERT_PTR_NOT_NULL_FATAL(pkt1map);
-   CU_ASSERT_PTR_NOT_NULL_FATAL(pkt2map);
-   cmplen = seglen1 < seglen2 ? seglen1 : seglen2;
-   CU_ASSERT(!memcmp(pkt1map, pkt2map, cmplen));
-
-   offset += cmplen;
-   len-= cmplen;
-   }
-}
-
  static void _packet_compare_udata(odp_packet_t pkt1, odp_packet_t pkt2)
  {
uint32_t usize1 = odp_packet_user_area_size(pkt1);




Re: [lng-odp] [PATCH 1/1] validation: classification: fix TCP/UDP checksum update

2016-10-06 Thread Maxim Uvarov

On 09/23/16 01:22, Bala Manoharan wrote:

Yes. We have to free the packet and mark the test case as failure.
Will update the same in next version.

Regards,
Bala


Needed v2 here.

Maxim.


Re: [lng-odp] [PATCH] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-10-06 Thread Maxim Uvarov

please review.

Maxim.

On 09/23/16 16:44, Maxim Uvarov wrote:

Make check should skip the test instead of failing it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
  test/common_plat/performance/odp_pktio_perf.c | 14 ++
  1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..846dfaa 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
  #include 
  #include 
  
+#define TEST_SKIP 77

+
  #define PKT_BUF_NUM   8192
  #define MAX_NUM_IFACES2
  #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
   gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}
  
  	if (gbl_args->args.num_tx_workers) {

@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};
  
-	if (setup_txrx_masks(, ) != 0)

-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;
  
  	printf("Starting test with params:\n");

printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;
  
-	while (ret > 0)

+   while (1) {
ret = run_test_single(, , );
+   if (ret)
+   break;
+   }
  
  	return ret;

  }




Re: [lng-odp] [PATCH] linux-gen: pktio: handle exit if ipc app was killed

2016-10-04 Thread Maxim Uvarov

ping,  please review (after this patch ipc pktio test passes on odp-check).

Maxim.

On 09/07/16 23:50, Maxim Uvarov wrote:

In test script let master process finish his work and
don't try to kill him if killing can be avoided. If
kill invoked than do not dequeue from empty rings. Also it
looks like there is some race exist on defining which
app will be master and which will be slave if they run
at the same time. After long run following script I
do not see fails anymore:
while true; do ./test/linux-generic/pktio_ipc/pktio_ipc_run.sh || exit 1; done
https://bugs.linaro.org/show_bug.cgi?id=2505

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
  test/linux-generic/pktio_ipc/pktio_ipc_run.sh | 13 +
  1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh 
b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
index bd64baf..86b7c82 100755
--- a/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
+++ b/test/linux-generic/pktio_ipc/pktio_ipc_run.sh
@@ -30,8 +30,9 @@ run()
rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null
  
  	echo " run pktio_ipc1 then pktio_ipc2 "

-   pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 30 &
+   pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20 &
IPC_PID=$!
+   sleep 1
  
  	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10

ret=$?
@@ -57,12 +58,16 @@ run()
IPC_NS=`expr $IPC_NS - 1`
echo "Using ns ${IPC_NS}"
  
-	pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 10 &

+   pktio_ipc2${EXEEXT} -n ${IPC_NS} -t 20 &
IPC_PID=$!
+   sleep 1
  
-	pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 20

+   pktio_ipc1${EXEEXT} -n ${IPC_NS} -t 10
ret=$?
-   (kill ${IPC_PID} 2>&1 > /dev/null) > /dev/null || true
+   kill ${IPC_PID} 2>&1 > /dev/null
+   if [ $? -eq 0 ]; then
+   rm -rf /dev/shm/odp-${IPC_NS}* 2>&1 > /dev/null
+   fi
  
  	if [ $ret -ne 0 ]; then

echo "!!! FAILED !!!"




Re: [lng-odp] [PATCH] linux-gen: pktio: ipc: remove todos

2016-10-04 Thread Maxim Uvarov

Merged,
Maxim.

On 09/12/16 21:11, Mike Holmes wrote:



On 8 September 2016 at 11:53, Maxim Uvarov <maxim.uva...@linaro.org 
<mailto:maxim.uva...@linaro.org>> wrote:


Remove todo around copying packet data from
shared pool as it's not a bug and can be
considered as future request. But left small
comment that we coping packet data to make
it more  visible.
https://bugs.linaro.org/show_bug.cgi?id=2408
<https://bugs.linaro.org/show_bug.cgi?id=2408>

    Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org
<mailto:maxim.uva...@linaro.org>>


I think this is reasonable, if someone starts to use this I assume we 
will get patches to remove the copy becasue the performance will suffer.


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


---
 platform/linux-generic/pktio/ipc.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/platform/linux-generic/pktio/ipc.c
b/platform/linux-generic/pktio/ipc.c
index b779ab7..c1f28db 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -373,11 +373,6 @@ static int _ipc_slave_start(pktio_entry_t
*pktio_entry)
 pinfo->master.mdata_offset;
pktio_entry->s.ipc.pkt_size = pinfo->master.shm_pkt_size;

-   /* @todo: to simplify in odp-linux implementation we
create pool for
-* packets from IPC queue. On receive implementation
copies packets to
-* that pool. Later we can try to reuse original pool
without packets
-* copying. (pkt refcounts needs to be implemented).
-*/
_ipc_export_pool(pinfo, pktio_entry->s.ipc.pool);

odp_atomic_store_u32(_entry->s.ipc.ready, 1);
@@ -573,7 +568,7 @@ static int
ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
  (PKTIO_TYPE_IPC_SLAVE ==
pktio_entry->s.ipc.type));

-   /* @todo fix copy packet!!! */
+   /* Copy packet data from shared pool to local pool. */
memcpy(pkt_data, remote_pkt_data, phdr.frame_len);

/* Copy packets L2, L3 parsed offsets and size */
--
2.7.1.250.gff4ea60




--
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"





Re: [lng-odp] [PATCH] linux-gen: using ODP instantiation pid as odp instance

2016-10-04 Thread Maxim Uvarov

Merged.
Maxim.

On 10/04/16 16:35, Christophe Milard wrote:

Ping.
This has been reviewed and agreed at ARCH call. Any reason not to merge?
Christophe

On 20 September 2016 at 04:34, Bill Fischofer  wrote:


On Mon, Sep 19, 2016 at 10:56 AM, Christophe Milard
 wrote:

Rather than using INSTANCE_ID (constant 0xdeadbeef), the ODP main
instantiation process ID is used as instance ID in the linux-generic
implementation. This is a simple way to guarantee instance uniqueness
on linux systems.

Signed-off-by: Christophe Milard 


Reviewed-and-tested-by: Bill Fischofer 


---
  platform/linux-generic/include/odp_internal.h | 1 -
  platform/linux-generic/odp_init.c | 7 +++
  platform/linux-generic/odp_traffic_mngr.c | 3 ++-
  3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_internal.h
b/platform/linux-generic/include/odp_internal.h
index 8bad450..3429781 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -25,7 +25,6 @@ extern "C" {

  extern __thread int __odp_errno;

-#define INSTANCE_ID0xdeadbeef
  #define MAX_CPU_NUMBER 128

  typedef struct {
diff --git a/platform/linux-generic/odp_init.c
b/platform/linux-generic/odp_init.c
index f534759..77f4f8a 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -116,8 +116,7 @@ int odp_init_global(odp_instance_t *instance,
 goto init_failed;
 }

-   /* Dummy support for single instance */
-   *instance = INSTANCE_ID;
+   *instance = (odp_instance_t)odp_global_data.main_pid;

 return 0;

@@ -128,7 +127,7 @@ init_failed:

  int odp_term_global(odp_instance_t instance)
  {
-   if (instance != INSTANCE_ID) {
+   if (instance != (odp_instance_t)odp_global_data.main_pid) {
 ODP_ERR("Bad instance.\n");
 return -1;
 }
@@ -250,7 +249,7 @@ int odp_init_local(odp_instance_t instance,
odp_thread_type_t thr_type)
  {
 enum init_stage stage = NO_INIT;

-   if (instance != INSTANCE_ID) {
+   if (instance != (odp_instance_t)odp_global_data.main_pid) {
 ODP_ERR("Bad instance.\n");
 goto init_fail;
 }
diff --git a/platform/linux-generic/odp_traffic_mngr.c
b/platform/linux-generic/odp_traffic_mngr.c
index 4fe07ef..85228cd 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -2317,7 +2317,8 @@ static void *tm_system_thread(void *arg)
 uint32_t destroying, work_queue_cnt, timer_cnt;
 int rc;

-   rc = odp_init_local(INSTANCE_ID, ODP_THREAD_WORKER);
+   rc = odp_init_local((odp_instance_t)odp_global_data.main_pid,
+   ODP_THREAD_WORKER);
 ODP_ASSERT(rc == 0);
 tm_group = arg;

--
2.7.4





[lng-odp] [PATCH] test: skip pktio_perf tests on 1 and 2 cpus machines

2016-09-23 Thread Maxim Uvarov
Make check should skip the test instead of failing it.

Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
---
 test/common_plat/performance/odp_pktio_perf.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/common_plat/performance/odp_pktio_perf.c 
b/test/common_plat/performance/odp_pktio_perf.c
index f041b13..846dfaa 100644
--- a/test/common_plat/performance/odp_pktio_perf.c
+++ b/test/common_plat/performance/odp_pktio_perf.c
@@ -34,6 +34,8 @@
 #include 
 #include 
 
+#define TEST_SKIP 77
+
 #define PKT_BUF_NUM   8192
 #define MAX_NUM_IFACES2
 #define TEST_HDR_MAGIC0x92749451
@@ -558,7 +560,7 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
   gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
-   return -1;
+   return TEST_SKIP;
}
 
if (gbl_args->args.num_tx_workers) {
@@ -669,8 +671,9 @@ static int run_test(void)
.warmup = 1,
};
 
-   if (setup_txrx_masks(, ) != 0)
-   return -1;
+   ret = setup_txrx_masks(, );
+   if (ret)
+   return ret;
 
printf("Starting test with params:\n");
printf("\tTransmit workers: \t%d\n", odp_cpumask_count());
@@ -691,8 +694,11 @@ static int run_test(void)
run_test_single(, , );
status.warmup = 0;
 
-   while (ret > 0)
+   while (1) {
ret = run_test_single(, , );
+   if (ret)
+   break;
+   }
 
return ret;
 }
-- 
2.7.4



Re: [lng-odp] [PATCH] api:crypto: Adding IPSEC protocol APIs.

2016-09-23 Thread Maxim Uvarov

patch prefix has to be API-NEXT
and comments <*! - looks very stange. At least we did not have such 
styled comments before.


Maxim.

On 09/23/16 18:42, Nikhil Agarwal wrote:

TODO items:
- Event Notification(Eg. Seq Number overflow, SA not found, SA hard/soft expiry)
- statistics APIs
- Encrpt and send APIs

Signed-off-by: Nikhil Agarwal 
---
  include/odp/api/spec/crypto.h   |  29 +++
  include/odp/api/spec/crypto_ipsec.h | 345 
  2 files changed, 374 insertions(+)
  create mode 100644 include/odp/api/spec/crypto_ipsec.h

diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h
index dea1fe9..b629b82 100644
--- a/include/odp/api/spec/crypto.h
+++ b/include/odp/api/spec/crypto.h
@@ -144,6 +144,27 @@ typedef union odp_crypto_auth_algos_t {
uint32_t all_bits;
  } odp_crypto_auth_algos_t;
  
+

+/**
+ * Network security protocols in bit field structure
+ */
+typedef union odp_crypto_protocol_t {
+   /** Network security protocols */
+   struct {
+   /** ODP_AUTH_ALG_NULL */
+   uint32_t ipsec_esp: 1;
+
+   /** ODP_AUTH_ALG_MD5_96 */
+   uint32_t ipsec_ah : 1;
+
+   } bit;
+
+   /** All bits of the bit field structure
+ *
+ * This field can be used to set/clear all flags, or bitwise
+ * operations over the entire structure. */
+   uint32_t all_bits;
+} odp_crypto_protocol_t;
  /**
   * Crypto API key structure
   */
@@ -264,6 +285,8 @@ typedef enum {
ODP_CRYPTO_SES_CREATE_ERR_INV_CIPHER,
/** Creation failed, bad auth params */
ODP_CRYPTO_SES_CREATE_ERR_INV_AUTH,
+   /** Creation failed, bad protocol params */
+   ODP_CRYPTO_SES_CREATE_ERR_INV_PROTO,
  } odp_crypto_ses_create_err_t;
  
  /**

@@ -332,6 +355,12 @@ typedef struct odp_crypto_capability_t {
/** Authentication algorithms implemented with HW offload */
odp_crypto_auth_algos_t   hw_auths;
  
+	/** Supported authentication algorithms */

+   odp_crypto_protocol_t   protocols;
+
+   /** Authentication algorithms implemented with HW offload */
+   odp_crypto_protocol_t   hw_protocols;
+
  } odp_crypto_capability_t;
  
  /**

diff --git a/include/odp/api/spec/crypto_ipsec.h 
b/include/odp/api/spec/crypto_ipsec.h
new file mode 100644
index 000..6a0cee0
--- /dev/null
+++ b/include/odp/api/spec/crypto_ipsec.h
@@ -0,0 +1,345 @@
+/* Copyright (c) 2014, Linaro Limited
+ * Copyright (c) 2015 - 2016 Freescale Semiconductor, Inc.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP crypto IPSec extension
+ */
+
+#ifndef ODP_API_CRYPTO_IPSEC_H_
+#define ODP_API_CRYPTO_IPSEC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef enum odp_ipsec_mode {
+   ODP_IPSEC_MODE_TUNNEL,  /**< IPSec tunnel mode */
+   ODP_IPSEC_MODE_TRANSPORT,   /**< IPSec transport mode */
+} odp_ipsec_mode_t;
+
+typedef enum odp_ipsec_proto {
+   ODP_IPSEC_ESP, /**< ESP protocol */
+} odp_ipsec_proto_t;
+
+typedef enum odp_ipsec_outhdr_type {
+   ODP_IPSEC_OUTHDR_IPV4,/**< Outer header is IPv4 */
+   ODP_IPSEC_OUTHDR_IPV6,/**< Outer header is IPv6 */
+} odp_ipsec_outhdr_type_t;
+
+typedef enum odp_ipsec_ar_ws {
+   ODP_IPSEC_AR_WS_NONE,  /**< Anti-replay is not enabled */
+   ODP_IPSEC_AR_WS_32,/**< Anti-replay window size 32 */
+   ODP_IPSEC_AR_WS_64,/**< Anti-replay window size 64 */
+   ODP_IPSEC_AR_WS_128,   /**< Anti-replay window size 128 */
+} odp_ipsec_ar_ws_t;
+
+typedef struct odp_ipsec_params {
+   odp_ipsec_mode_t ipsec_mode; /** Transport or Tunnel */
+   uint32_t spi;/** SPI value */
+   uint32_t seq;/** Initial SEQ number */
+   odp_ipsec_ar_ws_t ar_ws; /** Anti-replay window size -
+   inbound session with authentication */
+   odp_bool_t esn; /** Use extended sequence numbers */
+   odp_bool_t auto_iv; /** Auto IV generation for each operation. */
+   uint16_t out_hdr_size;   /** outer header size - tunnel mode */
+   uint8_t *out_hdr;/** outer header - tunnel mode */
+   odp_ipsec_outhdr_type_t out_hdr_type; /* outer header type -
+   tunnel mode */
+   odp_bool_t ip_csum; /** update/verify ip header checksum */
+   odp_bool_t ip_dttl; /** decrement ttl - tunnel mode encap & decap */
+   odp_bool_t remove_outer_hdr; /** remove outer header - tunnel mode 
decap */
+   odp_bool_t copy_dscp;   /** DiffServ Copy - Copy the IPv4 TOS or
+   IPv6 Traffic Class byte from the inner/outer
+   IP header to the outer/inner IP header -
+   tunnel mode encap & decap */
+   odp_bool_t copy_df; /** Copy DF 

Re: [lng-odp] [PATCH v2 1/2] test: perf: add new scheduling latency test

2016-09-22 Thread Maxim Uvarov

Merged,
Maxim.

On 09/22/16 01:11, Brian Brooks wrote:

For series:

Reviewed-and-tested-by: Brian Brooks 

On 09/14 11:53:06, Matias Elo wrote:

Add new scheduling latency benchmark application. The application
measures delays (avg, min, max) for high and low priority events.

The test has a configurable number of TRAFFIC events and few SAMPLE events
(one common or one per priority). The scheduling latency is only measured
from the SAMPLE events to minimize measurement overhead.

The application's command line arguments enable configuring:
- Number of processing threads
- Number of high/low priority queues
- Number of high/low priority events
- Use separate SAMPLE events for each priority
- Scheduled queue type (PARALLEL, ATOMIC, ORDERED)

Signed-off-by: Matias Elo 
---

V2:
- Remove unnecessary 'num_workers' initialization (Maxim)

  test/common_plat/performance/.gitignore  |   1 +
  test/common_plat/performance/Makefile.am |   4 +
  test/common_plat/performance/odp_sched_latency.c | 767 +++
  3 files changed, 772 insertions(+)
  create mode 100644 test/common_plat/performance/odp_sched_latency.c

diff --git a/test/common_plat/performance/.gitignore 
b/test/common_plat/performance/.gitignore
index edcc832..1527d25 100644
--- a/test/common_plat/performance/.gitignore
+++ b/test/common_plat/performance/.gitignore
@@ -4,4 +4,5 @@ odp_atomic
  odp_crypto
  odp_l2fwd
  odp_pktio_perf
+odp_sched_latency
  odp_scheduling
diff --git a/test/common_plat/performance/Makefile.am 
b/test/common_plat/performance/Makefile.am
index d23bb3e..f5dd8dd 100644
--- a/test/common_plat/performance/Makefile.am
+++ b/test/common_plat/performance/Makefile.am
@@ -5,6 +5,7 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
  EXECUTABLES = odp_crypto$(EXEEXT) odp_pktio_perf$(EXEEXT)
  
  COMPILE_ONLY = odp_l2fwd$(EXEEXT) \

+  odp_sched_latency$(EXEEXT) \
   odp_scheduling$(EXEEXT)
  
  TESTSCRIPTS = odp_l2fwd_run.sh \

@@ -20,6 +21,8 @@ bin_PROGRAMS = $(EXECUTABLES) $(COMPILE_ONLY)
  
  odp_crypto_LDFLAGS = $(AM_LDFLAGS) -static

  odp_crypto_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
+odp_sched_latency_LDFLAGS = $(AM_LDFLAGS) -static
+odp_sched_latency_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
  odp_scheduling_LDFLAGS = $(AM_LDFLAGS) -static
  odp_scheduling_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/test
  
@@ -27,6 +30,7 @@ noinst_HEADERS = \

  $(top_srcdir)/test/test_debug.h
  
  dist_odp_crypto_SOURCES = odp_crypto.c

+dist_odp_sched_latency_SOURCES = odp_sched_latency.c
  dist_odp_scheduling_SOURCES = odp_scheduling.c
  dist_odp_pktio_perf_SOURCES = odp_pktio_perf.c
  
diff --git a/test/common_plat/performance/odp_sched_latency.c b/test/common_plat/performance/odp_sched_latency.c

new file mode 100644
index 000..063fb21
--- /dev/null
+++ b/test/common_plat/performance/odp_sched_latency.c
@@ -0,0 +1,767 @@
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * @example odp_sched_latency.c  ODP scheduling latency benchmark application
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+/* ODP main header */
+#include 
+
+/* ODP helper for Linux apps */
+#include 
+
+/* GNU lib C */
+#include 
+
+#define MAX_WORKERS  64/**< Maximum number of worker threads */
+#define MAX_QUEUES   4096  /**< Maximum number of queues */
+#define EVENT_POOL_SIZE  (1024 * 1024) /**< Event pool size */
+#define TEST_ROUNDS (4 * 1024 * 1024)  /**< Test rounds for each thread */
+#define MAIN_THREAD   1 /**< Thread ID performing maintenance tasks */
+
+/* Default values for command line arguments */
+#define SAMPLE_EVENT_PER_PRIO0 /**< Allocate a separate sample event for
+each priority */
+#define HI_PRIO_EVENTS   0 /**< Number of high priority events */
+#define LO_PRIO_EVENTS  32 /**< Number of low priority events */
+#define HI_PRIO_QUEUES  16 /**< Number of high priority queues */
+#define LO_PRIO_QUEUES  64 /**< Number of low priority queues */
+
+#define EVENTS_PER_HI_PRIO_QUEUE 0  /**< Alloc HI_PRIO_QUEUES x HI_PRIO_EVENTS
+events */
+#define EVENTS_PER_LO_PRIO_QUEUE 1  /**< Alloc LO_PRIO_QUEUES x LO_PRIO_EVENTS
+events */
+ODP_STATIC_ASSERT(HI_PRIO_QUEUES <= MAX_QUEUES, "Too many HI priority queues");
+ODP_STATIC_ASSERT(LO_PRIO_QUEUES <= MAX_QUEUES, "Too many LO priority queues");
+
+#define CACHE_ALIGN_ROUNDUP(x)\
+   ((ODP_CACHE_LINE_SIZE) * \
+(((x) + ODP_CACHE_LINE_SIZE - 1) / (ODP_CACHE_LINE_SIZE)))
+
+/* Test priorities */
+#define NUM_PRIOS 2 /**< Number of tested priorities */
+#define HI_PRIO  0
+#define LO_PRIO  1
+
+/** Test event types */
+typedef enum {
+   WARM_UP, /**< Warm up event */
+   

Re: [lng-odp] [PATCH 1/6] linux-gen: queue: reuse enq_ and deq_multi

2016-09-22 Thread Maxim Uvarov

that was merged but doxygen needs refining:

/opt/Linaro/odp3.git/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h:21: 
warning: Member _odp_ticketlock_lock(odp_ticketlock_t *ticketlock) 
(function) of file ticketlock_inlines.h is not documented.
/opt/Linaro/odp3.git/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h:36: 
warning: Member _odp_ticketlock_trylock(odp_ticketlock_t *tklock) 
(function) of file ticketlock_inlines.h is not documented.
/opt/Linaro/odp3.git/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h:64: 
warning: Member _odp_ticketlock_unlock(odp_ticketlock_t *ticketlock) 
(function) of file ticketlock_inlines.h is not documented.
/opt/Linaro/odp3.git/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h:76: 
warning: Member _odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock) 
(function) of file ticketlock_inlines.h is not documented.



On 09/20/16 06:35, Bill Fischofer wrote:

For this series:

Reviewed-and-tested-by: Bill Fischofer 

On Thu, Sep 15, 2016 at 8:39 AM, Petri Savolainen <
petri.savolai...@nokia.com> wrote:


Reuse multi enqueue and dequeue implementations for single
enq/deq operations. This enables implementation to
concentrate on optimizing the multi operations. Single
operations do not suffer a major performance decrease since
compiler likely optimizes the inlined code for single
operations (num is fixed to 1).

Signed-off-by: Petri Savolainen 
---
  platform/linux-generic/include/odp_schedule_if.h |   3 -
  platform/linux-generic/odp_queue.c   | 134
+++
  platform/linux-generic/odp_schedule.c|   1 -
  platform/linux-generic/odp_schedule_ordered.c|  20 
  platform/linux-generic/odp_schedule_sp.c |  12 --
  5 files changed, 41 insertions(+), 129 deletions(-)

diff --git a/platform/linux-generic/include/odp_schedule_if.h
b/platform/linux-generic/include/odp_schedule_if.h
index 13cdfb3..df73e70 100644
--- a/platform/linux-generic/include/odp_schedule_if.h
+++ b/platform/linux-generic/include/odp_schedule_if.h
@@ -30,8 +30,6 @@ typedef int (*schedule_init_queue_fn_t)(uint32_t
queue_index,
);
  typedef void (*schedule_destroy_queue_fn_t)(uint32_t queue_index);
  typedef int (*schedule_sched_queue_fn_t)(uint32_t queue_index);
-typedef int (*schedule_ord_enq_fn_t)(uint32_t queue_index, void *buf_hdr,
-int sustain, int *ret);
  typedef int (*schedule_ord_enq_multi_fn_t)(uint32_t queue_index,
void *buf_hdr[], int num,
int sustain, int *ret);
@@ -48,7 +46,6 @@ typedef struct schedule_fn_t {
 schedule_init_queue_fn_tinit_queue;
 schedule_destroy_queue_fn_t destroy_queue;
 schedule_sched_queue_fn_t   sched_queue;
-   schedule_ord_enq_fn_t   ord_enq;
 schedule_ord_enq_multi_fn_t ord_enq_multi;
 schedule_init_global_fn_t   init_global;
 schedule_term_global_fn_t   term_global;
diff --git a/platform/linux-generic/odp_queue.c
b/platform/linux-generic/odp_queue.c
index bec1e51..80d99e8 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -65,19 +65,6 @@ static inline int queue_is_ordered(queue_entry_t *qe)
 return qe->s.param.sched.sync == ODP_SCHED_SYNC_ORDERED;
  }

-static inline void queue_add(queue_entry_t *queue,
-odp_buffer_hdr_t *buf_hdr)
-{
-   buf_hdr->next = NULL;
-
-   if (queue->s.head)
-   queue->s.tail->next = buf_hdr;
-   else
-   queue->s.head = buf_hdr;
-
-   queue->s.tail = buf_hdr;
-}
-
  queue_entry_t *get_qentry(uint32_t queue_id)
  {
 return _tbl->queue[queue_id];
@@ -396,37 +383,8 @@ odp_queue_t odp_queue_lookup(const char *name)
 return ODP_QUEUE_INVALID;
  }

-int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, int
sustain)
-{
-   int ret;
-
-   if (sched_fn->ord_enq(queue->s.index, buf_hdr, sustain, ))
-   return ret;
-
-   LOCK(>s.lock);
-
-   if (odp_unlikely(queue->s.status < QUEUE_STATUS_READY)) {
-   UNLOCK(>s.lock);
-   ODP_ERR("Bad queue status\n");
-   return -1;
-   }
-
-   queue_add(queue, buf_hdr);
-
-   if (queue->s.status == QUEUE_STATUS_NOTSCHED) {
-   queue->s.status = QUEUE_STATUS_SCHED;
-   UNLOCK(>s.lock);
-   if (sched_fn->sched_queue(queue->s.index))
-   ODP_ABORT("schedule_queue failed\n");
-   return 0;
-   }
-
-   UNLOCK(>s.lock);
-   return 0;
-}
-
-int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[],
-   int num, int sustain)
+static inline int enq_multi(queue_entry_t *queue, odp_buffer_hdr_t
*buf_hdr[],
+   

<    4   5   6   7   8   9   10   11   12   13   >