[lng-odp] [Bug 3517] timer test might fail

2018-01-31 Thread bugzilla-daemon
https://bugs.linaro.org/show_bug.cgi?id=3517

--- Comment #7 from Dmitry Eremin-Solenikov  
---
Note, it also occurs in Travis, so it is not limited to Shippable (ThunderX).

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.

[lng-odp] [PATCH v7 0/4] Shippable: fix tests statistics and upload code coverage stats

2018-01-31 Thread Github ODP bot


github
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: d9c58cbd5f1f1b9ef4c36b96ec24cd0f139dc28d
 **/
/github

checkpatch.pl
WARNING: line over 80 characters
#54: FILE: scripts/shippable-post.sh:3:
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl

total: 0 errors, 1 warnings, 0 checks, 26 lines checked


to_send-p-000.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 11 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#55: FILE: scripts/shippable-post.sh:12:
+gcovr -r . --xml-pretty --exclude-dir=example --exclude-dir=test -o 
shippable/codecoverage/coverage.xml

total: 0 errors, 1 warnings, 0 checks, 21 lines checked


to_send-p-003.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
/checkpatch.pl


[lng-odp] [PATCH v7 4/4] shippable: generate code coverage reports

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: d9c58cbd5f1f1b9ef4c36b96ec24cd0f139dc28d
 **/
 .shippable.yml| 2 +-
 scripts/Dockerfile| 1 +
 scripts/shippable-post.sh | 3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index d17319e70..c46baf3ef 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -37,7 +37,7 @@ build:
 - mkdir -p /dev/shm/odp
 - ./bootstrap
 - if [ "${CC#clang}" != "${CC}" ] ; then export CXX="${CC/clang/clang++}"; 
fi
-- ./configure --disable-test-perf
+- ./configure --disable-test-perf CFLAGS="-O0 --coverage" CXXFLAGS="-O0 
--coverage" LDFLAGS="--coverage"
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 3e1d54dbd..dc4411aa1 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -10,6 +10,7 @@ RUN sudo apt-get update && sudo apt-get install -yy \
   ccache \
   clang-3.8 \
   gcc-4.8 \
+  gcovr \
   graphviz \
   kmod \
   libconfig-dev \
diff --git a/scripts/shippable-post.sh b/scripts/shippable-post.sh
index ed5a44168..0d2e08874 100755
--- a/scripts/shippable-post.sh
+++ b/scripts/shippable-post.sh
@@ -7,3 +7,6 @@ for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
xsltproc --novalid cunit-to-junit.xsl "$FILE" > \
"$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}"
 done
+
+mkdir -p shippable/codecoverage
+gcovr -r . --xml-pretty --exclude-dir=example --exclude-dir=test -o 
shippable/codecoverage/coverage.xml



[lng-odp] [PATCH v7 3/4] shippable: set CXX for clang case

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: d9c58cbd5f1f1b9ef4c36b96ec24cd0f139dc28d
 **/
 .shippable.yml | 1 +
 scripts/Dockerfile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/.shippable.yml b/.shippable.yml
index a9e008439..d17319e70 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -36,6 +36,7 @@ build:
 - sudo mount -t hugetlbfs nodev /mnt/huge
 - mkdir -p /dev/shm/odp
 - ./bootstrap
+- if [ "${CC#clang}" != "${CC}" ] ; then export CXX="${CC/clang/clang++}"; 
fi
 - ./configure --disable-test-perf
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 7e117971d..3e1d54dbd 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -25,3 +25,4 @@ RUN sudo apt-get update && sudo apt-get install -yy \
 
 RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
 RUN sudo ln -s /usr/bin/clang-3.8 /usr/bin/clang
+RUN sudo ln -s /usr/bin/clang++-3.8 /usr/bin/clang++



[lng-odp] [PATCH v7 2/4] shippable: run all tests

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Use `make check -k' to run testsuite, so that all tests have a chance to
be executed, not stopping after first failure.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: d9c58cbd5f1f1b9ef4c36b96ec24cd0f139dc28d
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 35292d983..a9e008439 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -38,7 +38,7 @@ build:
 - ./bootstrap
 - ./configure --disable-test-perf
 - make
-- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
+- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:
 - ./scripts/shippable-post.sh



[lng-odp] [PATCH v7 1/4] shippable: report test results even if ci step failed

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

According to the documentation post_ci is executed only if ci finished
successfully. Move test result reporting to separate script and call it
from on_success and on_failure steps.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: d9c58cbd5f1f1b9ef4c36b96ec24cd0f139dc28d
 **/
 .shippable.yml| 10 +++---
 scripts/shippable-post.sh |  9 +
 2 files changed, 12 insertions(+), 7 deletions(-)
 create mode 100755 scripts/shippable-post.sh

diff --git a/.shippable.yml b/.shippable.yml
index 9bc2cb6f7..35292d983 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -40,14 +40,10 @@ build:
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
-  post_ci:
-- wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
-- |
-  for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
- bname=`basename $FILE`;
- xsltproc --novalid cunit-to-junit.xsl $FILE > 
$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}
-  done
+  on_success:
+- ./scripts/shippable-post.sh
 
   on_failure:
+- ./scripts/shippable-post.sh
 - cat config.log
 - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read 
trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done
diff --git a/scripts/shippable-post.sh b/scripts/shippable-post.sh
new file mode 100755
index 0..ed5a44168
--- /dev/null
+++ b/scripts/shippable-post.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
+
+for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
+   bname="`basename $FILE`";
+   xsltproc --novalid cunit-to-junit.xsl "$FILE" > \
+   "$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}"
+done



Re: [lng-odp] Compilation flags for release build and performance evaluation

2018-01-31 Thread Maxim Uvarov
./configure --help

for linux-generic and linux-dpdk platforms.

Maxim.

On 31 January 2018 at 22:41, gyanesh patra  wrote:

> Hi,
> I am curious if there are any specific flags available for ODP for release
> builds or performance evaluation?
>
> Also where can i find the list of features i can disable by passing to
> configure scripts? I found couple of options in odp-thunderx project such
> as  "-DODP_DISABLE_CLASSIFICATION and -DNIC_DISABLE_PACKET_PARSING".
> Is there any other such flags available?
>
> Thank you,
> P Gyanesh Kumar Patra
>


[lng-odp] [PATCH v5 1/1] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

gcc-built DPDK is not fully compatible with clang (see
https://travis-ci.org/lumag/odp/jobs/335324053 for example). Use clang
to compile DPDK if selected compiler is clang.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 439 (lumag:dpdk-clang)
 ** https://github.com/Linaro/odp/pull/439
 ** Patch: https://github.com/Linaro/odp/pull/439.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 9e35d43844e9bc6eb28af8307ec91125c5022bc0
 **/
 .travis.yml | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b7d6cd415..faf477b53 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -101,6 +101,7 @@ before_install:
 DPDK_CFLAGS="-m32" ;
 else
 DPDK_CROSS="$CROSS_GNU_TYPE-" ;
+DPDK_CFLAGS="--target=$CROSS_GNU_TYPE" ;
 fi
 fi ;
 export CXX="${CC/clang/clang++}";
@@ -161,30 +162,36 @@ install:
 - |
   case "$CROSS_ARCH" in
 "arm64")
-  DPDK_TARGET="arm64-armv8a-linuxapp-gcc"
+  DPDK_TARGET="arm64-armv8a-linuxapp-"
   ;;
 "armhf")
-  DPDK_TARGET="arm-armv7a-linuxapp-gcc"
+  DPDK_TARGET="arm-armv7a-linuxapp-"
   ;;
 "i386")
-  DPDK_TARGET="i686-native-linuxapp-gcc"
+  DPDK_TARGET="i686-native-linuxapp-"
   ;;
 "")
-  DPDK_TARGET="x86_64-native-linuxapp-gcc"
+  DPDK_TARGET="x86_64-native-linuxapp-"
   DPDK_MACHINE=snb
   ;;
   esac
 - |
   if [ -n "$DPDK_TARGET" ] ; then
+   if [ "${CC#clang}" != "${CC}" ] ; then
+DPDKCC=clang ;
+   else
+DPDKCC=gcc ;
+   fi
if [ -n "$DPDK_SHARED" ] ; then
-TARGET="$DPDK_TARGET"-shared
+TARGET="${DPDK_TARGET}$DPDKCC"-shared
 LIBDPDKEXT=so
 export LD_LIBRARY_PATH="`pwd`/${TARGET}:$LD_LIBRARY_PATH"
 echo $LD_LIBRARY_PATH
else
-TARGET="$DPDK_TARGET"
+TARGET="${DPDK_TARGET}$DPDKCC"
 LIBDPDKEXT=a
fi
+   DPDK_TARGET="${DPDK_TARGET}gcc"
if [ ! -f "dpdk/${TARGET}/lib/libdpdk.$LIBDPDKEXT" ]; then
 git -c advice.detachedHead=false clone -q --depth=1 
--single-branch --branch=v${DPDK_VERS} http://dpdk.org/git/dpdk dpdk
 pushd dpdk
@@ -193,6 +200,7 @@ install:
 sed -i -e 's/40900/40800/g' 
lib/librte_eal/common/include/arch/arm/rte_vect.h
 sed -i -e 's/!(/!(defined(__arm__) \&\& defined(__clang__) || /g' 
lib/librte_eal/common/include/arch/arm/rte_byteorder.h
 sed -i -e 's/__GNUC__/defined(__arm__) \&\& defined(__clang__) || 
__GNUC__/' lib/librte_eal/common/include/generic/rte_byteorder.h
+sed -i -e 's,\$(CC),\0 $(EXTRA_CFLAGS),g' lib/librte_acl/Makefile
 make config T=${DPDK_TARGET} O=${TARGET}
 pushd ${TARGET}
 sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
@@ -206,8 +214,11 @@ install:
   sed -ri -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' .config
   sed -ri -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' .config
 fi
+sed -ri -e 's,(CONFIG_RTE_TOOLCHAIN=).*,\1"'${DPDKCC}'",' .config
+sed -ri -e '/CONFIG_RTE_TOOLCHAIN_.*/d' .config
+echo CONFIG_RTE_TOOLCHAIN_${DPDKCC^^}=y >> .config
 popd
-make build T=${DPDK_TARGET} O=${TARGET} EXTRA_CFLAGS="-fPIC 
$DPDK_CFLAGS" CROSS="$DPDK_CROSS" -j $(nproc)
+make build O=${TARGET} EXTRA_CFLAGS="-fPIC $DPDK_CFLAGS" 
CROSS="$DPDK_CROSS" CC="$CC" HOSTCC=gcc -j $(nproc)
 rm -r ./doc ./${TARGET}/app ./${TARGET}/build
 popd
fi



[lng-odp] [PATCH v5 3/5] shippable: generate code coverage reports

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
 .shippable.yml | 2 +-
 scripts/Dockerfile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index a9e008439..dc28b2cba 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -36,7 +36,7 @@ build:
 - sudo mount -t hugetlbfs nodev /mnt/huge
 - mkdir -p /dev/shm/odp
 - ./bootstrap
-- ./configure --disable-test-perf
+- ./configure --disable-test-perf CFLAGS="-O0 --coverage" CXXFLAGS="-O0 
--coverage" LDFLAGS="--coverage"
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 7e117971d..012c1a070 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -10,6 +10,7 @@ RUN sudo apt-get update && sudo apt-get install -yy \
   ccache \
   clang-3.8 \
   gcc-4.8 \
+  gcovr \
   graphviz \
   kmod \
   libconfig-dev \



[lng-odp] [PATCH v5 2/5] shippable: run all tests

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Use `make check -k' to run testsuite, so that all tests have a chance to
be executed, not stopping after first failure.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 35292d983..a9e008439 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -38,7 +38,7 @@ build:
 - ./bootstrap
 - ./configure --disable-test-perf
 - make
-- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
+- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:
 - ./scripts/shippable-post.sh



[lng-odp] [PATCH v5 0/1] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
gcc-built DPDK is not fully compatible with clang (see
https://travis-ci.org/lumag/odp/jobs/335324053 for example). Use clang
to compile DPDK if selected compiler is clang.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsoleni...@linaro.org

github
/** Email created from pull request 439 (lumag:dpdk-clang)
 ** https://github.com/Linaro/odp/pull/439
 ** Patch: https://github.com/Linaro/odp/pull/439.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 9e35d43844e9bc6eb28af8307ec91125c5022bc0
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 68 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v5 5/5] shippable: set CXX for clang case

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
 .shippable.yml | 1 +
 scripts/Dockerfile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/.shippable.yml b/.shippable.yml
index 2469c82f2..3ab930b3f 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -36,6 +36,7 @@ build:
 - sudo mount -t hugetlbfs nodev /mnt/huge
 - mkdir -p /dev/shm/odp
 - ./bootstrap
+- if [ "${CC#clang}" != "${CC}" ] ; then export CXX="${CC/clang/clang++}"; 
fi
 - ./configure --disable-test-perf CFLAGS="-O0 --coverage" CXXFLAGS="-O0 
--coverage" LDFLAGS="--coverage"
 - make V=1
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 012c1a070..dc4411aa1 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -26,3 +26,4 @@ RUN sudo apt-get update && sudo apt-get install -yy \
 
 RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
 RUN sudo ln -s /usr/bin/clang-3.8 /usr/bin/clang
+RUN sudo ln -s /usr/bin/clang++-3.8 /usr/bin/clang++



[lng-odp] [PATCH v5 4/5] shippable: pass V=1, trying to solve linking issue

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index dc28b2cba..2469c82f2 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -37,7 +37,7 @@ build:
 - mkdir -p /dev/shm/odp
 - ./bootstrap
 - ./configure --disable-test-perf CFLAGS="-O0 --coverage" CXXFLAGS="-O0 
--coverage" LDFLAGS="--coverage"
-- make
+- make V=1
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:



[lng-odp] [PATCH v5 1/5] shippable: report test results even if ci step failed

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

According to the documentation post_ci is executed only if ci finished
successfully. Move test result reporting to separate script and call it
from on_success and on_failure steps.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
 .shippable.yml| 10 +++---
 scripts/shippable-post.sh | 12 
 2 files changed, 15 insertions(+), 7 deletions(-)
 create mode 100755 scripts/shippable-post.sh

diff --git a/.shippable.yml b/.shippable.yml
index 9bc2cb6f7..35292d983 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -40,14 +40,10 @@ build:
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
-  post_ci:
-- wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
-- |
-  for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
- bname=`basename $FILE`;
- xsltproc --novalid cunit-to-junit.xsl $FILE > 
$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}
-  done
+  on_success:
+- ./scripts/shippable-post.sh
 
   on_failure:
+- ./scripts/shippable-post.sh
 - cat config.log
 - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read 
trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done
diff --git a/scripts/shippable-post.sh b/scripts/shippable-post.sh
new file mode 100755
index 0..0f57c24ff
--- /dev/null
+++ b/scripts/shippable-post.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
+
+for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
+   bname="`basename $FILE`";
+   xsltproc --novalid cunit-to-junit.xsl "$FILE" > \
+   "$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}"
+done
+
+mkdir -p shippable/codecoverage
+gcovr -r . --xml-pretty > shippable/codecoverage/coverage.xml



[lng-odp] [PATCH v5 0/5] Shippable: fix tests statistics and upload code coverage stats

2018-01-31 Thread Github ODP bot


github
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: eb9e424b83553d93732577a9ba50c59a684ca7ea
 **/
/github

checkpatch.pl
WARNING: line over 80 characters
#54: FILE: scripts/shippable-post.sh:3:
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl

total: 0 errors, 1 warnings, 0 checks, 29 lines checked


to_send-p-000.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 15 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 11 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] Compilation flags for release build and performance evaluation

2018-01-31 Thread gyanesh patra
Hi,
I am curious if there are any specific flags available for ODP for release
builds or performance evaluation?

Also where can i find the list of features i can disable by passing to
configure scripts? I found couple of options in odp-thunderx project such
as  "-DODP_DISABLE_CLASSIFICATION and -DNIC_DISABLE_PACKET_PARSING".
Is there any other such flags available?

Thank you,
P Gyanesh Kumar Patra


Re: [lng-odp] [PATCH API-NEXT v5] api: ipsec: TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

include/odp/api/spec/ipsec.h
line 179
@@ -1226,12 +1226,23 @@ typedef struct odp_ipsec_status_t {
  * e.g. RFC 4302 and 4303). Resulting packets are well formed, reconstructed
  * original IP packets, with IPSEC headers removed and valid header field 
values
  * restored. The amount and content of packet data before the IP header is
- * undefined.
+ * undefined. Some amount of TFC padding may follow the IP packet payload,
+ * in which case packet length is larger than protocol headers indicate.
+ * TFC dummy packets have l3_type set to ODP_PROTO_L3_TYPE_NONE in tunnel mode
+ * or l4_type set to ODP_PROTO_L4_TYPE_NO_NEXT in transport mode. Dummy
+ * packets contain implementation specific amount of (dummy) data. Furthermore,
+ * inline IPSEC processing may drop dummy packets.
  *
  * Each successfully transformed packet has a valid value for these metadata
  * regardless of the inner packet parse configuration
  * (odp_ipsec_inbound_config_t):
- * - L3 offset: Offset to the first byte of the (outmost) IP header
+ * - l3_offset: Offset to the first byte of the original IP packet. The value
+ *  is implementation specific for tunnel mode TFC dummy packets.
+ * - l3_type:   Specifies if the original packet is IPv4 or IPv6. For tunnel
+ *  mode TFC dummy packets set to ODP_PROTO_L3_TYPE_NONE.


Comment:
And here.

> Dmitry Eremin-Solenikov(lumag) wrote:
> It also should be NO_NEXT, shouldn't it?


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> In fact I'm more biased towards 
>> `odp_packet_get_l3_proto()`/`odp_packet_get_l4_proto()` functions.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> @lumag Would exposing he next header byte also be acceptable? That would 
>>> similarly seem to be future-proof and would also avoid having to introduce 
>>> an `odp_packet_has_dummy()` predicate function.


 Dmitry Eremin-Solenikov(lumag) wrote:
 It seems @bala-manoharan and me would still prefer separate is_dummy flag. 
 We don't even have to limit it to TFC dummy packets, but might use it 
 later for all kinds of dummy packets.


> Balasubramanian Manoharan(bala-manoharan) wrote:
> Yes. Just to be clear even if the implementation know that its a dummy 
> packet in Transport mode the application/implementation will have to 
> parse the IP header to know the dummy packet and drop the packet.


>> JannePeltonen wrote
>> Transport mode dummy packets _are_ IP packets. The protocol field of the 
>> IP header (which is constructed based on the IP header of the ESP 
>> packet) is 59.


>>> Balasubramanian Manoharan(bala-manoharan) wrote:
>>> In tunnel mode not setting ipv4/v6 flag for dummy packet should be 
>>> fine. But how do Dummy packets get handled in transport mode? coz if 
>>> the implementation does inner packet parsing then transport mode dummy 
>>> packet will have the valid ipv4/v6 flag set.


 Dmitry Eremin-Solenikov(lumag) wrote:
 After discussion during the call: this needs to be rephrased to point 
 that TFC dummy packets can be truncated by an implementation. Maybe we 
 should not mention that "restructured data" is returned for TFC dummy 
 packet.


> JannePeltonen wrote
> On January 17 pvanlee...@insidesecure.com wrote in the lng-odp list:
> 
> "However, for the EIP96 - EIP197PP range of solutions our HW /is/ 
> capable of TFC padding insertion, we would just need to expose this 
> through our driver and firmware. So API-wise you might want to 
> support adding n bytes of TFC padding for outbound. "
> 
> So apparently such HW exists. And even with pure SW solution, I do 
> not see why buffer space would need to be allocated from application 
> specific pools for the padding data.


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> I have mixed feelings towards this option. Allocating additional 
>> buffer space from application-specific pools seems fragile to me. 
>> Maybe we can leave this out for now till there is hardware which 
>> actually supports generating additional TFC padding?


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> Limiting this option to tunnel mode only seems logical but not that 
>>> effective for an application. Maybe we can allow using this option 
>>> together with L3 header override to create transport mode dummy 
>>> packets. Then it would be just easier to inject dummy packets in 
>>> transport case.


 Dmitry Eremin-Solenikov(lumag) wrote:
 @psavol I don't feel good about the 'if dummy flag is set, only 
 tfc_padding length defines the dummy packet length' proposal. Your 
 current phrase (`packet_len + tfc_padding` seems better to me).
 @bala-manoharan if we do no

Re: [lng-odp] [PATCH API-NEXT v5] api: ipsec: TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

include/odp/api/spec/ipsec.h
line 167
@@ -1226,12 +1226,23 @@ typedef struct odp_ipsec_status_t {
  * e.g. RFC 4302 and 4303). Resulting packets are well formed, reconstructed
  * original IP packets, with IPSEC headers removed and valid header field 
values
  * restored. The amount and content of packet data before the IP header is
- * undefined.
+ * undefined. Some amount of TFC padding may follow the IP packet payload,
+ * in which case packet length is larger than protocol headers indicate.
+ * TFC dummy packets have l3_type set to ODP_PROTO_L3_TYPE_NONE in tunnel mode


Comment:
It also should be NO_NEXT, shouldn't it?

> Dmitry Eremin-Solenikov(lumag) wrote:
> In fact I'm more biased towards 
> `odp_packet_get_l3_proto()`/`odp_packet_get_l4_proto()` functions.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> @lumag Would exposing he next header byte also be acceptable? That would 
>> similarly seem to be future-proof and would also avoid having to introduce 
>> an `odp_packet_has_dummy()` predicate function.


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> It seems @bala-manoharan and me would still prefer separate is_dummy flag. 
>>> We don't even have to limit it to TFC dummy packets, but might use it later 
>>> for all kinds of dummy packets.


 Balasubramanian Manoharan(bala-manoharan) wrote:
 Yes. Just to be clear even if the implementation know that its a dummy 
 packet in Transport mode the application/implementation will have to parse 
 the IP header to know the dummy packet and drop the packet.


> JannePeltonen wrote
> Transport mode dummy packets _are_ IP packets. The protocol field of the 
> IP header (which is constructed based on the IP header of the ESP packet) 
> is 59.


>> Balasubramanian Manoharan(bala-manoharan) wrote:
>> In tunnel mode not setting ipv4/v6 flag for dummy packet should be fine. 
>> But how do Dummy packets get handled in transport mode? coz if the 
>> implementation does inner packet parsing then transport mode dummy 
>> packet will have the valid ipv4/v6 flag set.


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> After discussion during the call: this needs to be rephrased to point 
>>> that TFC dummy packets can be truncated by an implementation. Maybe we 
>>> should not mention that "restructured data" is returned for TFC dummy 
>>> packet.


 JannePeltonen wrote
 On January 17 pvanlee...@insidesecure.com wrote in the lng-odp list:
 
 "However, for the EIP96 - EIP197PP range of solutions our HW /is/ 
 capable of TFC padding insertion, we would just need to expose this 
 through our driver and firmware. So API-wise you might want to support 
 adding n bytes of TFC padding for outbound. "
 
 So apparently such HW exists. And even with pure SW solution, I do not 
 see why buffer space would need to be allocated from application 
 specific pools for the padding data.


> Dmitry Eremin-Solenikov(lumag) wrote:
> I have mixed feelings towards this option. Allocating additional 
> buffer space from application-specific pools seems fragile to me. 
> Maybe we can leave this out for now till there is hardware which 
> actually supports generating additional TFC padding?


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> Limiting this option to tunnel mode only seems logical but not that 
>> effective for an application. Maybe we can allow using this option 
>> together with L3 header override to create transport mode dummy 
>> packets. Then it would be just easier to inject dummy packets in 
>> transport case.


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> @psavol I don't feel good about the 'if dummy flag is set, only 
>>> tfc_padding length defines the dummy packet length' proposal. Your 
>>> current phrase (`packet_len + tfc_padding` seems better to me).
>>> @bala-manoharan if we do not provide a packet, how will 
>>> implementation allocate a packet for SYNC/ASYNC modes?


 Dmitry Eremin-Solenikov(lumag) wrote:
 Also it should be documented that in INLINE mode hardware might 
 drop dummy packets on its own, without reporting them to an 
 application.


> Dmitry Eremin-Solenikov(lumag) wrote:
> I'm actually thinking about adding special `is_dummy` flag here. 
> Transport mode TFC packets should have `has_ipv4`/`has_ipv6` flag 
> according to their headers. However having special flag which can 
> be checked by an application will allow one to drop them without 
> going to L3 headers.


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> This will cause troubles for NXP hardware, which does 

[lng-odp] [PATCH v3 4/4] shippable: pass V=1, trying to solve linking issue

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 22d348a5e4c7d4dd75556f0252f3a76da3f4bd26
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 76a8c42fe..b99e59ccb 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -37,7 +37,7 @@ build:
 - mkdir -p /dev/shm/odp
 - ./bootstrap
 - ./configure --disable-test-perf CFLAGS="-O0 -coverage" CXXFLAGS="-O0 
-coverage" LDFLAGS="--coverage"
-- make
+- make V=1
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:



[lng-odp] [PATCH v3 0/4] Shippable: fix tests statistics and upload code coverage stats

2018-01-31 Thread Github ODP bot


github
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 22d348a5e4c7d4dd75556f0252f3a76da3f4bd26
 **/
/github

checkpatch.pl
WARNING: line over 80 characters
#54: FILE: scripts/shippable-post.sh:3:
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl

total: 0 errors, 1 warnings, 0 checks, 29 lines checked


to_send-p-000.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 15 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v3 3/4] shippable: run all tests

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Use `make check -k' to run testsuite, so that all tests have a chance to
be executed, not stopping after first failure.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 22d348a5e4c7d4dd75556f0252f3a76da3f4bd26
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 42786e0dc..76a8c42fe 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -38,7 +38,7 @@ build:
 - ./bootstrap
 - ./configure --disable-test-perf CFLAGS="-O0 -coverage" CXXFLAGS="-O0 
-coverage" LDFLAGS="--coverage"
 - make
-- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
+- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:
 - ./scripts/shippable-post.sh



[lng-odp] [PATCH v3 2/4] shippable: generate code coverage reports

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 22d348a5e4c7d4dd75556f0252f3a76da3f4bd26
 **/
 .shippable.yml | 2 +-
 scripts/Dockerfile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 35292d983..42786e0dc 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -36,7 +36,7 @@ build:
 - sudo mount -t hugetlbfs nodev /mnt/huge
 - mkdir -p /dev/shm/odp
 - ./bootstrap
-- ./configure --disable-test-perf
+- ./configure --disable-test-perf CFLAGS="-O0 -coverage" CXXFLAGS="-O0 
-coverage" LDFLAGS="--coverage"
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 7e117971d..012c1a070 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -10,6 +10,7 @@ RUN sudo apt-get update && sudo apt-get install -yy \
   ccache \
   clang-3.8 \
   gcc-4.8 \
+  gcovr \
   graphviz \
   kmod \
   libconfig-dev \



[lng-odp] [PATCH v3 1/4] shippable: report test results even if ci step failed

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

According to the documentation post_ci is executed only if ci finished
successfully. Move test result reporting to separate script and call it
from on_success and on_failure steps.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 22d348a5e4c7d4dd75556f0252f3a76da3f4bd26
 **/
 .shippable.yml| 10 +++---
 scripts/shippable-post.sh | 12 
 2 files changed, 15 insertions(+), 7 deletions(-)
 create mode 100755 scripts/shippable-post.sh

diff --git a/.shippable.yml b/.shippable.yml
index 9bc2cb6f7..35292d983 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -40,14 +40,10 @@ build:
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
-  post_ci:
-- wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
-- |
-  for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
- bname=`basename $FILE`;
- xsltproc --novalid cunit-to-junit.xsl $FILE > 
$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}
-  done
+  on_success:
+- ./scripts/shippable-post.sh
 
   on_failure:
+- ./scripts/shippable-post.sh
 - cat config.log
 - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read 
trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done
diff --git a/scripts/shippable-post.sh b/scripts/shippable-post.sh
new file mode 100755
index 0..0f57c24ff
--- /dev/null
+++ b/scripts/shippable-post.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
+
+for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
+   bname="`basename $FILE`";
+   xsltproc --novalid cunit-to-junit.xsl "$FILE" > \
+   "$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}"
+done
+
+mkdir -p shippable/codecoverage
+gcovr -r . --xml-pretty > shippable/codecoverage/coverage.xml



Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

test/validation/api/pktio/pktio.c
line 16
@@ -1195,10 +1195,8 @@ void pktio_test_index(void)
 
ndx = odp_pktio_index(pktio);
CU_ASSERT(ndx >= 0);
-   CU_ASSERT(odp_pktio_index(pktio_inval) < 0);
 
CU_ASSERT(odp_pktio_close(pktio) == 0);
-   CU_ASSERT(odp_pktio_index(pktio) < 0);


Comment:
Generally I would agree. However we explicitly have the invalid usecase in API:
```
@retval <0 On failure (e.g., handle not valid)
```


> Dmitry Eremin-Solenikov(lumag) wrote:
> Is there a reason to move function bodies?


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> Maybe `(uintptr_t)(handle) == (uintptr_t)0` would do the trick?


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> Very strange. I'm Ok with this workaround, but a comment about clang 
>>> version might be appropriate. Don't know if it's worth doing a clang 
>>> version check. We do things like that in the `ODP_STATIC_ASSERT()` macro 
>>> itself for similar reasons.


 Petri Savolainen(psavol) wrote:
 odp_packet.c:52:19: error: static_assert expression is not an integral 
 constant
   expression
 ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval not 
 0");
 ~~^~~~
 ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: 
 note: 
   expanded from macro '_odp_typeval'
 #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
  ^
 ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
   'ODP_STATIC_ASSERT'
 #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
 ^~~~
 odp_packet.c:52:19: note: cast that performs the conversions of a
   reinterpret_cast is not allowed in a constant expression
 ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: 
 note: 
   expanded from macro '_odp_typeval'
 #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))


> Petri Savolainen(psavol) wrote:
> static_assert() seems special. The clang version in Travis does not 
> accept type casts with static_assert(). The cast confuses it to think 
> that (uintptr_t)0 == 0 is not an integral constant.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `_odp_typeval()` is defined as:
>> ```
>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>> ```
>> It's used elsewhere in the ODP code and clang doesn't have any problem 
>> with it. I've verified this works for clang 4.2.1.  Since it works 
>> elsewhere on Travis I'm not sure why it wouldn't in this instance.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> I'm OK with just a modified commit name. I agree we needn't be too 
>>> granular about these things.


 Petri Savolainen(psavol) wrote:
 I could rename the patch to:
 "linux-gen: packet: use inlined flow hash and ts set"
 
 ... if necessary. The comment says already that also ts set is 
 modified the same way.


> Petri Savolainen(psavol) wrote:
> I did try several combinations of type casts of invalid values, also 
> cast to uintptr_t. The problem is that gcc and clang (clang version 
> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the 
> clang version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does 
> not accept anything.
> 
> Maybe it's a bug in the particular version of clang. Anyway, addition 
> of this check even only on gcc side is improvement against what we 
> currently have (no check). Packet invalid is currently 0xfff in 
> ABI spec, but event/buffer invalid are 0.
> 
> odp_packet.c:55:19: error: static_assert expression is not an 
> integral constant
>   expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet 
> invalid not 0");
> ~~^
> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from 
> macro
>   'ODP_STATIC_ASSERT'
> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
> ^~~~
> odp_packet.c:55:20: note: cast that performs the conversions of a
>   reinterpret_cast is not allowed in a constant expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet 
> invalid not 0");
>^


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Since you want to breech the strong type you need to use the 
>> internal `odp_typ

Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

test/validation/api/pktio/pktio.c
line 16
@@ -1195,10 +1195,8 @@ void pktio_test_index(void)
 
ndx = odp_pktio_index(pktio);
CU_ASSERT(ndx >= 0);
-   CU_ASSERT(odp_pktio_index(pktio_inval) < 0);
 
CU_ASSERT(odp_pktio_close(pktio) == 0);
-   CU_ASSERT(odp_pktio_index(pktio) < 0);


Comment:
We can have `_odp_pktio_index()` which does not perform such checks and 
`odp_pktio_index()` which does `ODP_PKTIO_INVALID` check.

> Dmitry Eremin-Solenikov(lumag) wrote:
> Generally I would agree. However we explicitly have the invalid usecase in 
> API:
> ```
> @retval <0 On failure (e.g., handle not valid)
> ```


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> Is there a reason to move function bodies?


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> Maybe `(uintptr_t)(handle) == (uintptr_t)0` would do the trick?


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 Very strange. I'm Ok with this workaround, but a comment about clang 
 version might be appropriate. Don't know if it's worth doing a clang 
 version check. We do things like that in the `ODP_STATIC_ASSERT()` macro 
 itself for similar reasons.


> Petri Savolainen(psavol) wrote:
> odp_packet.c:52:19: error: static_assert expression is not an integral 
> constant
>   expression
> ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval 
> not 0");
> ~~^~~~
> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: 
> note: 
>   expanded from macro '_odp_typeval'
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>  ^
> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>   'ODP_STATIC_ASSERT'
> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
> ^~~~
> odp_packet.c:52:19: note: cast that performs the conversions of a
>   reinterpret_cast is not allowed in a constant expression
> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: 
> note: 
>   expanded from macro '_odp_typeval'
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))


>> Petri Savolainen(psavol) wrote:
>> static_assert() seems special. The clang version in Travis does not 
>> accept type casts with static_assert(). The cast confuses it to think 
>> that (uintptr_t)0 == 0 is not an integral constant.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `_odp_typeval()` is defined as:
>>> ```
>>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>>> ```
>>> It's used elsewhere in the ODP code and clang doesn't have any problem 
>>> with it. I've verified this works for clang 4.2.1.  Since it works 
>>> elsewhere on Travis I'm not sure why it wouldn't in this instance.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 I'm OK with just a modified commit name. I agree we needn't be too 
 granular about these things.


> Petri Savolainen(psavol) wrote:
> I could rename the patch to:
> "linux-gen: packet: use inlined flow hash and ts set"
> 
> ... if necessary. The comment says already that also ts set is 
> modified the same way.


>> Petri Savolainen(psavol) wrote:
>> I did try several combinations of type casts of invalid values, also 
>> cast to uintptr_t. The problem is that gcc and clang (clang version 
>> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the 
>> clang version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does 
>> not accept anything.
>> 
>> Maybe it's a bug in the particular version of clang. Anyway, 
>> addition of this check even only on gcc side is improvement against 
>> what we currently have (no check). Packet invalid is currently 
>> 0xfff in ABI spec, but event/buffer invalid are 0.
>> 
>> odp_packet.c:55:19: error: static_assert expression is not an 
>> integral constant
>>   expression
>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet 
>> invalid not 0");
>> ~~^
>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from 
>> macro
>>   'ODP_STATIC_ASSERT'
>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>> ^~~~
>> odp_packet.c:55:20: note: cast that performs the conversions of a
>>   reinterpret_cast is not allowed in a constant expression
>> ODP_STATIC_ASSERT(((u

Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
Maybe `(uintptr_t)(handle) == (uintptr_t)0` would do the trick?

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> Very strange. I'm Ok with this workaround, but a comment about clang version 
> might be appropriate. Don't know if it's worth doing a clang version check. 
> We do things like that in the `ODP_STATIC_ASSERT()` macro itself for similar 
> reasons.


>> Petri Savolainen(psavol) wrote:
>> odp_packet.c:52:19: error: static_assert expression is not an integral 
>> constant
>>   expression
>> ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval not 
>> 0");
>> ~~^~~~
>> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: 
>> note: 
>>   expanded from macro '_odp_typeval'
>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>>  ^
>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>>   'ODP_STATIC_ASSERT'
>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>> ^~~~
>> odp_packet.c:52:19: note: cast that performs the conversions of a
>>   reinterpret_cast is not allowed in a constant expression
>> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: 
>> note: 
>>   expanded from macro '_odp_typeval'
>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))


>>> Petri Savolainen(psavol) wrote:
>>> static_assert() seems special. The clang version in Travis does not accept 
>>> type casts with static_assert(). The cast confuses it to think that 
>>> (uintptr_t)0 == 0 is not an integral constant.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 `_odp_typeval()` is defined as:
 ```
 #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
 ```
 It's used elsewhere in the ODP code and clang doesn't have any problem 
 with it. I've verified this works for clang 4.2.1.  Since it works 
 elsewhere on Travis I'm not sure why it wouldn't in this instance.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> I'm OK with just a modified commit name. I agree we needn't be too 
> granular about these things.


>> Petri Savolainen(psavol) wrote:
>> I could rename the patch to:
>> "linux-gen: packet: use inlined flow hash and ts set"
>> 
>> ... if necessary. The comment says already that also ts set is modified 
>> the same way.


>>> Petri Savolainen(psavol) wrote:
>>> I did try several combinations of type casts of invalid values, also 
>>> cast to uintptr_t. The problem is that gcc and clang (clang version 
>>> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the 
>>> clang version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does not 
>>> accept anything.
>>> 
>>> Maybe it's a bug in the particular version of clang. Anyway, addition 
>>> of this check even only on gcc side is improvement against what we 
>>> currently have (no check). Packet invalid is currently 0xfff in ABI 
>>> spec, but event/buffer invalid are 0.
>>> 
>>> odp_packet.c:55:19: error: static_assert expression is not an integral 
>>> constant
>>>   expression
>>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
>>> not 0");
>>> ~~^
>>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from 
>>> macro
>>>   'ODP_STATIC_ASSERT'
>>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>>> ^~~~
>>> odp_packet.c:55:20: note: cast that performs the conversions of a
>>>   reinterpret_cast is not allowed in a constant expression
>>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
>>> not 0");
>>>^


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 Since you want to

Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

platform/linux-generic/odp_packet.c
line 72
@@ -334,6 +334,54 @@ void *_odp_packet_map(void *pkt_ptr, uint32_t offset, 
uint32_t *seg_len,
return packet_map(pkt_ptr, offset, seg_len, seg_idx);
 }
 
+int _odp_packet_copy_from_mem_seg(odp_packet_t pkt, uint32_t offset,
+ uint32_t len, const void *src)
+{
+   void *mapaddr;
+   uint32_t seglen = 0; /* GCC */
+   uint32_t cpylen;
+   const uint8_t *srcaddr = (const uint8_t *)src;
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+   if (offset + len > pkt_hdr->frame_len)
+   return -1;
+
+   while (len > 0) {
+   mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL);
+   cpylen = len > seglen ? seglen : len;
+   memcpy(mapaddr, srcaddr, cpylen);
+   offset  += cpylen;
+   srcaddr += cpylen;
+   len -= cpylen;
+   }
+
+   return 0;
+}
+
+int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset,
+   uint32_t len, void *dst)
+{
+   void *mapaddr;
+   uint32_t seglen = 0; /* GCC */
+   uint32_t cpylen;
+   uint8_t *dstaddr = (uint8_t *)dst;
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+   if (offset + len > pkt_hdr->frame_len)
+   return -1;
+
+   while (len > 0) {
+   mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL);
+   cpylen = len > seglen ? seglen : len;
+   memcpy(dstaddr, mapaddr, cpylen);
+   offset  += cpylen;
+   dstaddr += cpylen;
+   len -= cpylen;
+   }
+
+   return 0;
+}


Comment:
Is there a reason to move function bodies?

> Dmitry Eremin-Solenikov(lumag) wrote:
> Maybe `(uintptr_t)(handle) == (uintptr_t)0` would do the trick?


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Very strange. I'm Ok with this workaround, but a comment about clang version 
>> might be appropriate. Don't know if it's worth doing a clang version check. 
>> We do things like that in the `ODP_STATIC_ASSERT()` macro itself for similar 
>> reasons.


>>> Petri Savolainen(psavol) wrote:
>>> odp_packet.c:52:19: error: static_assert expression is not an integral 
>>> constant
>>>   expression
>>> ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval not 
>>> 0");
>>> ~~^~~~
>>> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: 
>>> note: 
>>>   expanded from macro '_odp_typeval'
>>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>>>  ^
>>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>>>   'ODP_STATIC_ASSERT'
>>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>>> ^~~~
>>> odp_packet.c:52:19: note: cast that performs the conversions of a
>>>   reinterpret_cast is not allowed in a constant expression
>>> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: 
>>> note: 
>>>   expanded from macro '_odp_typeval'
>>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))


 Petri Savolainen(psavol) wrote:
 static_assert() seems special. The clang version in Travis does not accept 
 type casts with static_assert(). The cast confuses it to think that 
 (uintptr_t)0 == 0 is not an integral constant.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `_odp_typeval()` is defined as:
> ```
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
> ```
> It's used elsewhere in the ODP code and clang doesn't have any problem 
> with it. I've verified this works for clang 4.2.1.  Since it works 
> elsewhere on Travis I'm not sure why it wouldn't in this instance.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> I'm OK with just a modified commit name. I agree we needn't be too 
>> granular about these things.


>>> Petri Savolainen(psavol) wrote:
>>> I could rename the patch to:
>>> "linux-gen: packet: use inlined flow hash and ts set"
>>> 
>>> ... if necessary. The comment says already that also ts set is modified 
>>> the same way.


 Petri Savolainen(psavol) wrote:
 I did try several combinations of type casts of invalid values, also 
 cast to uintptr_t. The problem is that gcc and clang (clang version 
 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the 
 clang version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does 
 not accept anything.
 
 Maybe it's a bug in the particular version of clang. Anyway, addition 
 of this check even only on gcc side is improvement against what we 
 currently have (no check). Packet inv

Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
Very strange. I'm Ok with this workaround, but a comment about clang version 
might be appropriate. Don't know if it's worth doing a clang version check. We 
do things like that in the `ODP_STATIC_ASSERT()` macro itself for similar 
reasons.

> Petri Savolainen(psavol) wrote:
> odp_packet.c:52:19: error: static_assert expression is not an integral 
> constant
>   expression
> ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval not 
> 0");
> ~~^~~~
> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: note: 
>   expanded from macro '_odp_typeval'
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>  ^
> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>   'ODP_STATIC_ASSERT'
> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
> ^~~~
> odp_packet.c:52:19: note: cast that performs the conversions of a
>   reinterpret_cast is not allowed in a constant expression
> ../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: note: 
>   expanded from macro '_odp_typeval'
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))


>> Petri Savolainen(psavol) wrote:
>> static_assert() seems special. The clang version in Travis does not accept 
>> type casts with static_assert(). The cast confuses it to think that 
>> (uintptr_t)0 == 0 is not an integral constant.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> `_odp_typeval()` is defined as:
>>> ```
>>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>>> ```
>>> It's used elsewhere in the ODP code and clang doesn't have any problem with 
>>> it. I've verified this works for clang 4.2.1.  Since it works elsewhere on 
>>> Travis I'm not sure why it wouldn't in this instance.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 I'm OK with just a modified commit name. I agree we needn't be too 
 granular about these things.


> Petri Savolainen(psavol) wrote:
> I could rename the patch to:
> "linux-gen: packet: use inlined flow hash and ts set"
> 
> ... if necessary. The comment says already that also ts set is modified 
> the same way.


>> Petri Savolainen(psavol) wrote:
>> I did try several combinations of type casts of invalid values, also 
>> cast to uintptr_t. The problem is that gcc and clang (clang version 
>> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the clang 
>> version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does not accept 
>> anything.
>> 
>> Maybe it's a bug in the particular version of clang. Anyway, addition of 
>> this check even only on gcc side is improvement against what we 
>> currently have (no check). Packet invalid is currently 0xfff in ABI 
>> spec, but event/buffer invalid are 0.
>> 
>> odp_packet.c:55:19: error: static_assert expression is not an integral 
>> constant
>>   expression
>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
>> not 0");
>> ~~^
>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from 
>> macro
>>   'ODP_STATIC_ASSERT'
>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>> ^~~~
>> odp_packet.c:55:20: note: cast that performs the conversions of a
>>   reinterpret_cast is not allowed in a constant expression
>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
>> not 0");
>>^


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> Since you want to breech the strong type you need to use the internal 
>>> `odp_typeval()` macro here. 
>>> ```
>>> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid 
>>> no

[lng-odp] [PATCH v2 3/3] shippable: run all tests

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Use `make check -k' to run testsuite, so that all tests have a chance to
be executed, not stopping after first failure.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 211b88e1f213011f9a540affe8d5c6a86e9bfd14
 **/
 .shippable.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 42786e0dc..76a8c42fe 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -38,7 +38,7 @@ build:
 - ./bootstrap
 - ./configure --disable-test-perf CFLAGS="-O0 -coverage" CXXFLAGS="-O0 
-coverage" LDFLAGS="--coverage"
 - make
-- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
+- sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check -k
 
   on_success:
 - ./scripts/shippable-post.sh



[lng-odp] [PATCH v2 2/3] shippable: generate code coverage reports

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 211b88e1f213011f9a540affe8d5c6a86e9bfd14
 **/
 .shippable.yml | 2 +-
 scripts/Dockerfile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.shippable.yml b/.shippable.yml
index 35292d983..42786e0dc 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -36,7 +36,7 @@ build:
 - sudo mount -t hugetlbfs nodev /mnt/huge
 - mkdir -p /dev/shm/odp
 - ./bootstrap
-- ./configure --disable-test-perf
+- ./configure --disable-test-perf CFLAGS="-O0 -coverage" CXXFLAGS="-O0 
-coverage" LDFLAGS="--coverage"
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 7e117971d..012c1a070 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -10,6 +10,7 @@ RUN sudo apt-get update && sudo apt-get install -yy \
   ccache \
   clang-3.8 \
   gcc-4.8 \
+  gcovr \
   graphviz \
   kmod \
   libconfig-dev \



[lng-odp] [PATCH v2 1/3] shippable: report test results even if ci step failed

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

According to the documentation post_ci is executed only if ci finished
successfully. Move test result reporting to separate script and call it
from on_success and on_failure steps.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 211b88e1f213011f9a540affe8d5c6a86e9bfd14
 **/
 .shippable.yml| 10 +++---
 scripts/shippable-post.sh | 12 
 2 files changed, 15 insertions(+), 7 deletions(-)
 create mode 100755 scripts/shippable-post.sh

diff --git a/.shippable.yml b/.shippable.yml
index 9bc2cb6f7..35292d983 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -40,14 +40,10 @@ build:
 - make
 - sudo env ODP_SHM_DIR=/dev/shm/odp ODP_TEST_OUT_XML=yes make check
 
-  post_ci:
-- wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
-- |
-  for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
- bname=`basename $FILE`;
- xsltproc --novalid cunit-to-junit.xsl $FILE > 
$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}
-  done
+  on_success:
+- ./scripts/shippable-post.sh
 
   on_failure:
+- ./scripts/shippable-post.sh
 - cat config.log
 - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read 
trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done
diff --git a/scripts/shippable-post.sh b/scripts/shippable-post.sh
new file mode 100755
index 0..0f57c24ff
--- /dev/null
+++ b/scripts/shippable-post.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl
+
+for FILE in `find  ./test ./platform/ -name  "*.xml"`; do
+   bname="`basename $FILE`";
+   xsltproc --novalid cunit-to-junit.xsl "$FILE" > \
+   "$SHIPPABLE_BUILD_DIR/shippable/testresults/${bname}"
+done
+
+mkdir -p shippable/codecoverage
+gcovr -r . --xml-pretty > shippable/codecoverage/coverage.xml



[lng-odp] [PATCH v2 0/3] Shippable: fix tests statistics and upload code coverage stats

2018-01-31 Thread Github ODP bot


github
/** Email created from pull request 441 (lumag:shippable-ci)
 ** https://github.com/Linaro/odp/pull/441
 ** Patch: https://github.com/Linaro/odp/pull/441.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 211b88e1f213011f9a540affe8d5c6a86e9bfd14
 **/
/github

checkpatch.pl
WARNING: line over 80 characters
#54: FILE: scripts/shippable-post.sh:3:
+wget 
https://raw.githubusercontent.com/shawnliang/cunit-to-junit/master/cunit-to-junit.xsl

total: 0 errors, 1 warnings, 0 checks, 29 lines checked


to_send-p-000.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 15 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 8 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
odp_packet.c:52:19: error: static_assert expression is not an integral constant
  expression
ODP_STATIC_ASSERT(_odp_typeval(ODP_BUFFER_INVALID) == 0, "Buffer inval not 0");
~~^~~~
../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:30: note: 
  expanded from macro '_odp_typeval'
#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
 ^
../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
  'ODP_STATIC_ASSERT'
#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
^~~~
odp_packet.c:52:19: note: cast that performs the conversions of a
  reinterpret_cast is not allowed in a constant expression
../../platform/linux-generic/include/odp/api/plat/strong_types.h:32:41: note: 
  expanded from macro '_odp_typeval'
#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))

> Petri Savolainen(psavol) wrote:
> static_assert() seems special. The clang version in Travis does not accept 
> type casts with static_assert(). The cast confuses it to think that 
> (uintptr_t)0 == 0 is not an integral constant.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> `_odp_typeval()` is defined as:
>> ```
>> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>> ```
>> It's used elsewhere in the ODP code and clang doesn't have any problem with 
>> it. I've verified this works for clang 4.2.1.  Since it works elsewhere on 
>> Travis I'm not sure why it wouldn't in this instance.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> I'm OK with just a modified commit name. I agree we needn't be too granular 
>>> about these things.


 Petri Savolainen(psavol) wrote:
 I could rename the patch to:
 "linux-gen: packet: use inlined flow hash and ts set"
 
 ... if necessary. The comment says already that also ts set is modified 
 the same way.


> Petri Savolainen(psavol) wrote:
> I did try several combinations of type casts of invalid values, also cast 
> to uintptr_t. The problem is that gcc and clang (clang version 
> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the clang 
> version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does not accept 
> anything.
> 
> Maybe it's a bug in the particular version of clang. Anyway, addition of 
> this check even only on gcc side is improvement against what we currently 
> have (no check). Packet invalid is currently 0xfff in ABI spec, but 
> event/buffer invalid are 0.
> 
> odp_packet.c:55:19: error: static_assert expression is not an integral 
> constant
>   expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
> not 0");
> ~~^
> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>   'ODP_STATIC_ASSERT'
> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
> ^~~~
> odp_packet.c:55:20: note: cast that performs the conversions of a
>   reinterpret_cast is not allowed in a constant expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
> not 0");
>^


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Since you want to breech the strong type you need to use the internal 
>> `odp_typeval()` macro here. 
>> ```
>> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid 
>> not 0");
>> ```
>> etc. I've verified that this works fine for clang, so no need for the 
>> conditional compilation.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r165060781
updated_at 2018-01-31 14:05:40


[lng-odp] [PATCH API-NEXT v5 6/7] api: ipsec: outbound TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Specify how application can request TFC padding and dummy
packet creation at output. Application can use
odp_ipsec_out_opt_t options to reguest addition of TFC
padding, or creation of a TFC dummy packet
(next header = 59). IP parameter override options are needed
for tunnel mode dummy packet creation as there's no IP header
to copy e.g. DSCP or flow label values to tunnel IP header.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h | 44 +++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 721f96856..665dc07bc 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -991,6 +991,22 @@ typedef struct odp_ipsec_out_opt_t {
/** Use fragmentation mode option */
uint32_t frag_mode: 1;
 
+   /** Use TFC padding length option */
+   uint32_t tfc_pad:   1;
+
+   /** Tunnel mode TFC dummy packet. This can be used only
+*  in tunnel mode. When the flag is set, packet length
+*  and content is ignored and instead a TFC dummy
+*  packet is created during IPSEC operation. The dummy
+*  packet length is defined by 'tfc_pad_len' option.
+*  If the SA is configured to copy IP header fields
+*  from inner IP packet, those fields must be passed
+*  with IP parameters option. */
+   uint32_t tfc_dummy: 1;
+
+   /** Use IP parameters option */
+   uint32_t ip_param:  1;
+
} flag;
 
/** All flag bits */
@@ -1000,6 +1016,26 @@ typedef struct odp_ipsec_out_opt_t {
/** Fragmentation mode */
odp_ipsec_frag_mode_t frag_mode;
 
+   /** TFC padding length
+*
+*  Number of TFC padding bytes added to the packet during IPSEC
+*  processing. Resulting packet should not exceed the maximum packet
+*  length of the pool, otherwise IPSEC operation may fail.
+*  Implementation guarantees that the padding does not contain any
+*  confidential information. */
+   uint32_t tfc_pad_len;
+
+   /** Union of IP parameters */
+   union {
+   /** Override IPv4 parameters in outer header creation.
+*  IP addresses are ignored. */
+   odp_ipsec_ipv4_param_t ipv4;
+
+   /** Override IPv6 parameters in outer header creation.
+*  IP addresses are ignored. */
+   odp_ipsec_ipv6_param_t ipv6;
+   };
+
 } odp_ipsec_out_opt_t;
 
 /**
@@ -1302,7 +1338,13 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in,
  * The operation does packet transformation according to IPSEC standards (see
  * e.g. RFC 4302 and 4303). Resulting packets are well formed IP packets
  * with IPSEC, etc headers constructed according to the standards. The amount
- * and content of packet data before the IP header is undefined.
+ * and content of packet data before the IP header is undefined. Use outbound
+ * operation parameters to specify the amount of TFC padding appended to
+ * the packet during IPSEC transformation. Options can be used also to create
+ * TFC dummy packets. Packet data content is ignored in tunnel mode TFC dummy
+ * packet creation as tfc_pad_len option defines solely the packet length.
+ * In all other cases, payload length for the IPSEC transformation is specified
+ * by odp_packet_len() minus odp_packet_l3_offset() plus tfc_pad_len option.
  *
  * Each successfully transformed packet has a valid value for these metadata:
  * - L3 offset: Offset to the first byte of the (outmost) IP header



[lng-odp] [PATCH API-NEXT v5 7/7] api: ipsec: inbound inner packet checksum capability

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Add inbound inner packet checksum check capability. When
e.g. L4 checksum checking is not implemented in HW, it may
be better to leave checking for application, as it would
check only those packets that need the check.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 665dc07bc..2d1c4d9ba 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -238,6 +238,11 @@ typedef struct odp_ipsec_capability_t {
 */
odp_support_t retain_header;
 
+   /**
+* Inner packet checksum check offload support in inbound direction.
+*/
+   odp_proto_chksums_t chksums_in;
+
/** Maximum number of different destination CoSes in classification
 *  pipelining. The same CoS may be used for many SAs. This is equal or
 *  less than 'max_cos' capability in classifier API.



[lng-odp] [PATCH API-NEXT v5 4/7] api: ipsec: outbound operation option flags

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Add flags to select which options application uses. Currently,
there's no ambiguity, but as soon as there are multiple options
implementation needs to know which options are used and which
are ignored.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 1060a3ee2..08533d80d 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -983,6 +983,20 @@ typedef struct odp_ipsec_op_flag_t {
  * These may be used to override some SA level options
  */
 typedef struct odp_ipsec_out_opt_t {
+   /** Union of all flag bits */
+   union {
+   /** Option flags. Set flag for those options that are
+*  used, all other options are ignored. */
+   struct {
+   /** Use fragmentation mode option */
+   uint32_t frag_mode: 1;
+
+   } flag;
+
+   /** All flag bits */
+   uint32_t all_flags;
+   };
+
/** Fragmentation mode */
odp_ipsec_frag_mode_t frag_mode;
 



[lng-odp] [PATCH API-NEXT v5 5/7] api: ipsec: inbound TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Specify how application can recognize TFC padding and dummy
packets at input. Packet metadata for L3/L4 protocol type
indicate if the original packet was an IP or a TFC dummy packet.
When packet length is larger than protocol fields indicate,
some TFC padding remain in the packet.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 08533d80d..721f96856 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -1226,12 +1226,23 @@ typedef struct odp_ipsec_status_t {
  * e.g. RFC 4302 and 4303). Resulting packets are well formed, reconstructed
  * original IP packets, with IPSEC headers removed and valid header field 
values
  * restored. The amount and content of packet data before the IP header is
- * undefined.
+ * undefined. Some amount of TFC padding may follow the IP packet payload,
+ * in which case packet length is larger than protocol headers indicate.
+ * TFC dummy packets have l3_type set to ODP_PROTO_L3_TYPE_NONE in tunnel mode
+ * or l4_type set to ODP_PROTO_L4_TYPE_NO_NEXT in transport mode. Dummy
+ * packets contain implementation specific amount of (dummy) data. Furthermore,
+ * inline IPSEC processing may drop dummy packets.
  *
  * Each successfully transformed packet has a valid value for these metadata
  * regardless of the inner packet parse configuration
  * (odp_ipsec_inbound_config_t):
- * - L3 offset: Offset to the first byte of the (outmost) IP header
+ * - l3_offset: Offset to the first byte of the original IP packet. The value
+ *  is implementation specific for tunnel mode TFC dummy packets.
+ * - l3_type:   Specifies if the original packet is IPv4 or IPv6. For tunnel
+ *  mode TFC dummy packets set to ODP_PROTO_L3_TYPE_NONE.
+ * - l4_type:   Always set to ODP_PROTO_L4_TYPE_NO_NEXT for transport mode 
dummy
+ *  packets. Otherwise, depends on parse configuration. Default
+ *  value is ODP_PROTO_L4_TYPE_NONE.
  * - pktio: For inline IPSEC processed packets, original packet input
  *  interface
  *



[lng-odp] [PATCH API-NEXT v5 1/7] api: packet: add protocol type enumeration

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Add enumerations for L3 and L4 protocol types, and functions
to request those.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/abi-default/packet.h   | 28 +++
 include/odp/api/spec/packet.h  | 95 ++
 .../linux-generic/include-abi/odp/api/abi/packet.h | 28 +++
 3 files changed, 151 insertions(+)

diff --git a/include/odp/api/abi-default/packet.h 
b/include/odp/api/abi-default/packet.h
index 3d6876731..b83288d4c 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -30,6 +30,34 @@ typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
 #define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)0x)
 #define ODP_PACKET_OFFSET_INVALID 0x
 
+typedef uint8_t odp_proto_l3_type_t;
+
+#define ODP_PROTO_L3_TYPE_NONE   0
+#define ODP_PROTO_L3_TYPE_ARP1
+#define ODP_PROTO_L3_TYPE_RARP   2
+#define ODP_PROTO_L3_TYPE_MPLS   3
+#define ODP_PROTO_L3_TYPE_IPV4   4
+#define ODP_PROTO_L3_TYPE_IPV6   6
+
+typedef uint8_t odp_proto_l4_type_t;
+
+/* Numbers from IANA Assigned Internet Protocol Numbers list */
+#define ODP_PROTO_L4_TYPE_NONE  0
+#define ODP_PROTO_L4_TYPE_ICMPV41
+#define ODP_PROTO_L4_TYPE_IGMP  2
+#define ODP_PROTO_L4_TYPE_IPV4  4
+#define ODP_PROTO_L4_TYPE_TCP   6
+#define ODP_PROTO_L4_TYPE_UDP   17
+#define ODP_PROTO_L4_TYPE_IPV6  41
+#define ODP_PROTO_L4_TYPE_GRE   47
+#define ODP_PROTO_L4_TYPE_ESP   50
+#define ODP_PROTO_L4_TYPE_AH51
+#define ODP_PROTO_L4_TYPE_ICMPV658
+#define ODP_PROTO_L4_TYPE_NO_NEXT   59
+#define ODP_PROTO_L4_TYPE_IPCOMP108
+#define ODP_PROTO_L4_TYPE_SCTP  132
+#define ODP_PROTO_L4_TYPE_ROHC  142
+
 typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 3222ff5c2..4be515c7b 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -71,6 +71,79 @@ extern "C" {
   * Packet is red
   */
 
+/**
+ * @typedef odp_proto_l3_type_t
+ * Layer 3 protocol type
+ */
+
+/**
+ * @def ODP_PROTO_L3_TYPE_NONE
+ * Layer 3 protocol type not defined
+ *
+ * @def ODP_PROTO_L3_TYPE_ARP
+ * Layer 3 protocol is ARP
+ *
+ * @def ODP_PROTO_L3_TYPE_RARP
+ * Layer 3 protocol is RARP
+ *
+ * @def ODP_PROTO_L3_TYPE_MPLS
+ * Layer 3 protocol is MPLS
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV4
+ * Layer 3 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV6
+ * Layer 3 protocol type is IPv6
+ */
+
+/**
+ * @def ODP_PROTO_L4_TYPE_NONE
+ * Layer 4 protocol type not defined
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV4
+ * Layer 4 protocol type is ICMPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_IGMP
+ * Layer 4 protocol type is IGMP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV4
+ * Layer 4 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_TCP
+ * Layer 4 protocol type is TCP
+ *
+ * @def ODP_PROTO_L4_TYPE_UDP
+ * Layer 4 protocol type is UDP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV6
+ * Layer 4 protocol type is IPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_GRE
+ * Layer 4 protocol type is GRE
+ *
+ * @def ODP_PROTO_L4_TYPE_ESP
+ * Layer 4 protocol type is IPSEC ESP
+ *
+ * @def ODP_PROTO_L4_TYPE_AH
+ * Layer 4 protocol type is IPSEC AH
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV6
+ * Layer 4 protocol type is ICMPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_NO_NEXT
+ * Layer 4 protocol type is "No Next Header".
+ * Protocol / next header number is 59.
+ *
+ * @def ODP_PROTO_L4_TYPE_IPCOMP
+ * Layer 4 protocol type is IP Payload Compression Protocol
+ *
+ * @def ODP_PROTO_L4_TYPE_SCTP
+ * Layer 4 protocol type is SCTP
+ *
+ * @def ODP_PROTO_L4_TYPE_ROHC
+ * Layer 4 protocol type is ROHC
+ */
+
 /**
  * Protocol
  */
@@ -1542,6 +1615,28 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
  */
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
+/**
+ * Layer 3 protocol type
+ *
+ * Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE.
+ *
+ * @param  pkt  Packet handle
+ *
+ * @return Layer 3 protocol type
+ */
+odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt);
+
+/**
+ * Layer 4 protocol type
+ *
+ * Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE.
+ *
+ * @param  pkt  Packet handle
+ *
+ * @return Layer 4 protocol type
+ */
+odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt);
+
 /**
  * Layer 3 checksum check status
  *
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h 
b/platform/linux-generic/include-abi/odp/api/abi/packet.h
index 1aa7cbd58..137cd3ec4 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/packet.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/

[lng-odp] [PATCH API-NEXT v5 3/7] api: ipsec: rename fragmentation mode option

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Rename outbound operation fragmentation options to frag_mode.
Frag_mode is used elsewhere in the API and "mode" is too generic
term for it (not future proof).

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h   | 2 +-
 platform/linux-generic/odp_ipsec.c | 2 +-
 test/validation/api/ipsec/ipsec_test_out.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index c78afbe3f..1060a3ee2 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -984,7 +984,7 @@ typedef struct odp_ipsec_op_flag_t {
  */
 typedef struct odp_ipsec_out_opt_t {
/** Fragmentation mode */
-   odp_ipsec_frag_mode_t mode;
+   odp_ipsec_frag_mode_t frag_mode;
 
 } odp_ipsec_out_opt_t;
 
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index b6192377e..9f08b228c 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1306,7 +1306,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ipsec_sa = _odp_ipsec_sa_use(sa);
ODP_ASSERT(NULL != ipsec_sa);
 
-   if ((opt && opt->mode == ODP_IPSEC_FRAG_CHECK) ||
+   if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) ||
(!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK))
mtu = ipsec_sa->out.mtu;
else
diff --git a/test/validation/api/ipsec/ipsec_test_out.c 
b/test/validation/api/ipsec/ipsec_test_out.c
index 971fbbf8d..4940efa5a 100644
--- a/test/validation/api/ipsec/ipsec_test_out.c
+++ b/test/validation/api/ipsec/ipsec_test_out.c
@@ -530,7 +530,7 @@ static void test_out_ipv4_ah_sha256_frag_check(void)
ipsec_test_part test2 = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_opt = 1,
-   .opt = { .mode = ODP_IPSEC_FRAG_DISABLED, },
+   .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, },
.out_pkt = 1,
.out = {
{ .status.warn.all = 0,
@@ -623,7 +623,7 @@ static void test_out_ipv4_esp_null_sha256_frag_check(void)
ipsec_test_part test2 = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_opt = 1,
-   .opt = { .mode = ODP_IPSEC_FRAG_DISABLED, },
+   .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, },
.out_pkt = 1,
.out = {
{ .status.warn.all = 0,



[lng-odp] [PATCH API-NEXT v5 2/7] api: ipsec: IP header parameter types

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Create IP header parameter types, so that those can be used
also outside of SA parameter struct.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
 include/odp/api/spec/ipsec.h | 72 
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 47e3045f3..c78afbe3f 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -382,6 +382,44 @@ typedef struct odp_ipsec_crypto_param_t {
 
 } odp_ipsec_crypto_param_t;
 
+/** IPv4 header parameters */
+typedef struct odp_ipsec_ipv4_param_t {
+   /** IPv4 source address (NETWORK ENDIAN) */
+   void *src_addr;
+
+   /** IPv4 destination address (NETWORK ENDIAN) */
+   void *dst_addr;
+
+   /** IPv4 Differentiated Services Code Point */
+   uint8_t dscp;
+
+   /** IPv4 Don't Fragment bit */
+   uint8_t df;
+
+   /** IPv4 Time To Live */
+   uint8_t ttl;
+
+} odp_ipsec_ipv4_param_t;
+
+/** IPv6 header parameters */
+typedef struct odp_ipsec_ipv6_param_t {
+   /** IPv6 source address (NETWORK ENDIAN) */
+   void *src_addr;
+
+   /** IPv6 destination address (NETWORK ENDIAN) */
+   void *dst_addr;
+
+   /** IPv6 flow label */
+   uint32_t flabel;
+
+   /** IPv6 Differentiated Services Code Point */
+   uint8_t dscp;
+
+   /** IPv6 hop limit */
+   uint8_t hlimit;
+
+} odp_ipsec_ipv6_param_t;
+
 /**
  * IPSEC tunnel parameters
  *
@@ -397,40 +435,10 @@ typedef struct odp_ipsec_tunnel_param_t {
/** Variant mappings for tunnel parameters */
union {
/** IPv4 header parameters */
-   struct {
-   /** IPv4 source address (NETWORK ENDIAN) */
-   void *src_addr;
-
-   /** IPv4 destination address (NETWORK ENDIAN) */
-   void *dst_addr;
-
-   /** IPv4 Differentiated Services Code Point */
-   uint8_t dscp;
-
-   /** IPv4 Don't Fragment bit */
-   uint8_t df;
-
-   /** IPv4 Time To Live */
-   uint8_t ttl;
-   } ipv4;
+   odp_ipsec_ipv4_param_t ipv4;
 
/** IPv6 header parameters */
-   struct {
-   /** IPv6 source address (NETWORK ENDIAN) */
-   void *src_addr;
-
-   /** IPv6 destination address (NETWORK ENDIAN) */
-   void *dst_addr;
-
-   /** IPv6 Differentiated Services Code Point */
-   uint8_t dscp;
-
-   /** IPv6 flow label */
-   uint32_t flabel;
-
-   /** IPv6 hop limit */
-   uint8_t hlimit;
-   } ipv6;
+   odp_ipsec_ipv6_param_t ipv6;
};
 } odp_ipsec_tunnel_param_t;
 



[lng-odp] [PATCH API-NEXT v5 0/7] api: ipsec: TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
Specify how application can recognize and create TFC padding and dummy packets, 
both in inbound and outbound directions.

github
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 175 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 86 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 32 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 20 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 25 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 62 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 11 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
`_odp_typeval()` is defined as:
```
#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
```
It's used elsewhere in the ODP code and clang doesn't have any problem with it. 
I've verified this works for clang 4.2.1.  Since it works elsewhere on Travis 
I'm not sure why it wouldn't in this instance.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> I'm OK with just a modified commit name. I agree we needn't be too granular 
> about these things.


>> Petri Savolainen(psavol) wrote:
>> I could rename the patch to:
>> "linux-gen: packet: use inlined flow hash and ts set"
>> 
>> ... if necessary. The comment says already that also ts set is modified the 
>> same way.


>>> Petri Savolainen(psavol) wrote:
>>> I did try several combinations of type casts of invalid values, also cast 
>>> to uintptr_t. The problem is that gcc and clang (clang version 
>>> 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the clang 
>>> version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does not accept 
>>> anything.
>>> 
>>> Maybe it's a bug in the particular version of clang. Anyway, addition of 
>>> this check even only on gcc side is improvement against what we currently 
>>> have (no check). Packet invalid is currently 0xfff in ABI spec, but 
>>> event/buffer invalid are 0.
>>> 
>>> odp_packet.c:55:19: error: static_assert expression is not an integral 
>>> constant
>>>   expression
>>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
>>> 0");
>>> ~~^
>>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>>>   'ODP_STATIC_ASSERT'
>>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>>> ^~~~
>>> odp_packet.c:55:20: note: cast that performs the conversions of a
>>>   reinterpret_cast is not allowed in a constant expression
>>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
>>> 0");
>>>^


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 Since you want to breech the strong type you need to use the internal 
 `odp_typeval()` macro here. 
 ```
 ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid not 
 0");
 ```
 etc. I've verified that this works fine for clang, so no need for the 
 conditional compilation.


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r165046194
updated_at 2018-01-31 13:54:27


Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
static_assert() seems special. The clang version in Travis does not accept type 
casts with static_assert(). The cast confuses it to think that (uintptr_t)0 == 
0 is not an integral constant.

> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> `_odp_typeval()` is defined as:
> ```
> #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
> ```
> It's used elsewhere in the ODP code and clang doesn't have any problem with 
> it. I've verified this works for clang 4.2.1.  Since it works elsewhere on 
> Travis I'm not sure why it wouldn't in this instance.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> I'm OK with just a modified commit name. I agree we needn't be too granular 
>> about these things.


>>> Petri Savolainen(psavol) wrote:
>>> I could rename the patch to:
>>> "linux-gen: packet: use inlined flow hash and ts set"
>>> 
>>> ... if necessary. The comment says already that also ts set is modified the 
>>> same way.


 Petri Savolainen(psavol) wrote:
 I did try several combinations of type casts of invalid values, also cast 
 to uintptr_t. The problem is that gcc and clang (clang version 
 3.8.0-2ubuntu4) of my machine accepted all of those casts, but the clang 
 version in Travis (clang version 3.8.0-2ubuntu3~trusty5) does not accept 
 anything.
 
 Maybe it's a bug in the particular version of clang. Anyway, addition of 
 this check even only on gcc side is improvement against what we currently 
 have (no check). Packet invalid is currently 0xfff in ABI spec, but 
 event/buffer invalid are 0.
 
 odp_packet.c:55:19: error: static_assert expression is not an integral 
 constant
   expression
 ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
 not 0");
 ~~^
 ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
   'ODP_STATIC_ASSERT'
 #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
 ^~~~
 odp_packet.c:55:20: note: cast that performs the conversions of a
   reinterpret_cast is not allowed in a constant expression
 ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid 
 not 0");
^


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> Since you want to breech the strong type you need to use the internal 
> `odp_typeval()` macro here. 
> ```
> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid 
> not 0");
> ```
> etc. I've verified that this works fine for clang, so no need for the 
> conditional compilation.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r165047601
updated_at 2018-01-31 13:54:27


Re: [lng-odp] [PATCH v2] Packet function inlines

2018-01-31 Thread Github ODP bot
Bill Fischofer(Bill-Fischofer-Linaro) replied on github web page:

platform/linux-generic/odp_packet.c
line 169
@@ -1352,16 +1352,14 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, 
uint32_t flow_hash)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->flow_hash = flow_hash;
-   pkt_hdr->p.input_flags.flow_hash = 1;
+   packet_set_flow_hash(pkt_hdr, flow_hash);
 }
 
 void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->timestamp = timestamp;
-   pkt_hdr->p.input_flags.timestamp = 1;
+   packet_set_ts(pkt_hdr, ×tamp);


Comment:
I'm OK with just a modified commit name. I agree we needn't be too granular 
about these things.

> Petri Savolainen(psavol) wrote:
> I could rename the patch to:
> "linux-gen: packet: use inlined flow hash and ts set"
> 
> ... if necessary. The comment says already that also ts set is modified the 
> same way.


>> Petri Savolainen(psavol) wrote:
>> I did try several combinations of type casts of invalid values, also cast to 
>> uintptr_t. The problem is that gcc and clang (clang version 3.8.0-2ubuntu4) 
>> of my machine accepted all of those casts, but the clang version in Travis 
>> (clang version 3.8.0-2ubuntu3~trusty5) does not accept anything.
>> 
>> Maybe it's a bug in the particular version of clang. Anyway, addition of 
>> this check even only on gcc side is improvement against what we currently 
>> have (no check). Packet invalid is currently 0xfff in ABI spec, but 
>> event/buffer invalid are 0.
>> 
>> odp_packet.c:55:19: error: static_assert expression is not an integral 
>> constant
>>   expression
>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
>> 0");
>> ~~^
>> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>>   'ODP_STATIC_ASSERT'
>> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
>> ^~~~
>> odp_packet.c:55:20: note: cast that performs the conversions of a
>>   reinterpret_cast is not allowed in a constant expression
>> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
>> 0");
>>^


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> Since you want to breech the strong type you need to use the internal 
>>> `odp_typeval()` macro here. 
>>> ```
>>> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid not 
>>> 0");
>>> ```
>>> etc. I've verified that this works fine for clang, so no need for the 
>>> conditional compilation.


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r165045138
updated_at 2018-01-31 13:54:27


[lng-odp] [PATCH API-NEXT v4 0/7] api: ipsec: TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
Specify how application can recognize and create TFC padding and dummy packets, 
both in inbound and outbound directions.

github
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 175 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 86 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 32 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 20 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 25 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 62 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 11 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v2 9/11] validation: pktio: don't pass invalid handle to index conversion

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Fast path functions cannot be expected to always check against
invalid handles. Also a handle that has been closed (or destroyed)
must not be passed to any API function.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 test/validation/api/pktio/pktio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/test/validation/api/pktio/pktio.c 
b/test/validation/api/pktio/pktio.c
index a23641036..b20272ffc 100644
--- a/test/validation/api/pktio/pktio.c
+++ b/test/validation/api/pktio/pktio.c
@@ -1183,7 +1183,7 @@ void pktio_test_lookup(void)
 
 void pktio_test_index(void)
 {
-   odp_pktio_t pktio, pktio_inval = ODP_PKTIO_INVALID;
+   odp_pktio_t pktio;
odp_pktio_param_t pktio_param;
int ndx;
 
@@ -1195,10 +1195,8 @@ void pktio_test_index(void)
 
ndx = odp_pktio_index(pktio);
CU_ASSERT(ndx >= 0);
-   CU_ASSERT(odp_pktio_index(pktio_inval) < 0);
 
CU_ASSERT(odp_pktio_close(pktio) == 0);
-   CU_ASSERT(odp_pktio_index(pktio) < 0);
 }
 
 static void pktio_test_print(void)



[lng-odp] [PATCH v2 3/11] linux-gen: packet: inline copy functions

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Inline commonly used packet to/from memory copy functions.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 .../include/odp/api/plat/packet_inlines.h  | 36 
 .../include/odp/api/plat/packet_inlines_api.h  | 12 +++
 platform/linux-generic/odp_packet.c| 96 +++---
 3 files changed, 96 insertions(+), 48 deletions(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index 765bafb4f..90e205fd4 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -23,11 +23,19 @@
 #include 
 #include 
 
+#include 
+
 /** @cond _ODP_HIDE_FROM_DOXYGEN_ */
 
 void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len,
  int *seg_idx);
 
+int _odp_packet_copy_from_mem_seg(odp_packet_t pkt, uint32_t offset,
+ uint32_t len, const void *src);
+
+int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset,
+   uint32_t len, void *dst);
+
 extern const _odp_packet_inline_offset_t _odp_packet_inline;
 extern const _odp_pool_inline_offset_t   _odp_pool_inline;
 
@@ -225,6 +233,34 @@ static inline odp_buffer_t packet_to_buffer(odp_packet_t 
pkt)
return (odp_buffer_t)pkt;
 }
 
+static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset,
+   uint32_t len, const void *src)
+{
+   uint32_t seg_len = _odp_packet_seg_len(pkt);
+   uint8_t *data= (uint8_t *)_odp_packet_data(pkt);
+
+   if (odp_unlikely(offset + len > seg_len))
+   return _odp_packet_copy_from_mem_seg(pkt, offset, len, src);
+
+   memcpy(data + offset, src, len);
+
+   return 0;
+}
+
+static inline int _odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset,
+ uint32_t len, void *dst)
+{
+   uint32_t seg_len = _odp_packet_seg_len(pkt);
+   uint8_t *data= (uint8_t *)_odp_packet_data(pkt);
+
+   if (odp_unlikely(offset + len > seg_len))
+   return _odp_packet_copy_to_mem_seg(pkt, offset, len, dst);
+
+   memcpy(dst, data + offset, len);
+
+   return 0;
+}
+
 /** @endcond */
 
 #endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
index c90a69c52..9b31c923f 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
@@ -140,4 +140,16 @@ _ODP_INLINE void odp_packet_prefetch(odp_packet_t pkt, 
uint32_t offset,
return _odp_packet_prefetch(pkt, offset, len);
 }
 
+_ODP_INLINE int odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset,
+uint32_t len, const void *src)
+{
+   return _odp_packet_copy_from_mem(pkt, offset, len, src);
+}
+
+_ODP_INLINE int odp_packet_copy_to_mem(odp_packet_t pkt, uint32_t offset,
+  uint32_t len, void *dst)
+{
+   return _odp_packet_copy_to_mem(pkt, offset, len, dst);
+}
+
 #endif
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 8d6185987..2867e67e9 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -334,6 +334,54 @@ void *_odp_packet_map(void *pkt_ptr, uint32_t offset, 
uint32_t *seg_len,
return packet_map(pkt_ptr, offset, seg_len, seg_idx);
 }
 
+int _odp_packet_copy_from_mem_seg(odp_packet_t pkt, uint32_t offset,
+ uint32_t len, const void *src)
+{
+   void *mapaddr;
+   uint32_t seglen = 0; /* GCC */
+   uint32_t cpylen;
+   const uint8_t *srcaddr = (const uint8_t *)src;
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+   if (offset + len > pkt_hdr->frame_len)
+   return -1;
+
+   while (len > 0) {
+   mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL);
+   cpylen = len > seglen ? seglen : len;
+   memcpy(mapaddr, srcaddr, cpylen);
+   offset  += cpylen;
+   srcaddr += cpylen;
+   len -= cpylen;
+   }
+
+   return 0;
+}
+
+int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset,
+   uint32_t len, void *dst)
+{
+   void *mapaddr;
+   uint32_t seglen = 0; /* GCC */
+   uint32_t cpylen;
+   uint8_t *dstaddr = (uint8_t *)dst;
+   odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt)

[lng-odp] [PATCH CATERPILLAR v4 6/7] example: instrum: update DEPENDENCIES

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Describe configuration and requirements of code instrumentation
library.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 DEPENDENCIES | 82 
 1 file changed, 82 insertions(+)

diff --git a/DEPENDENCIES b/DEPENDENCIES
index 008c4df4d..898132cdc 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -202,6 +202,88 @@ Prerequisites for building the OpenDataPlane (ODP) API
1024MB of memory:
$ sudo ODP_PKTIO_DPDK_PARAMS="-m 1024" ./test/performance/odp_l2fwd -i 0 -c 
1
 
+3.5 Code instrumentation with PAPI library (optional)
+
+   PAPI library is used to instrument ODP API.
+
+3.5.1 Building PAPI library
+
+   ODP example library 'instrum' is using PAPI library to retrieve performance
+   counters associated with execution of ODP API. PAPI library is currently at 
5.6.0.
+   However, if possible one should try to use the latest PAPI master branch 
commit for
+   the best performance and the latest bug fixes.
+
+   # Checkout PAPI code
+   $ git clone https://bitbucket.org/icl/papi.git
+   $ cd papi
+   $ git checkout papi-5-6-0-t (optional)
+
+   # Build PAPI
+   $ cd ./src/
+   $ ./configure --prefix=
+   $ make clean
+   $ make
+   $ make install
+
+   Alternatively, one may install PAPI from packages, if available.
+   # apt-get install libpapi-dev
+
+3.5.2 Building ODP with PAPI support
+
+   $ cd 
+   $ ./bootstrap
+   $ ./configure --enable-code-instrum --with-papi-path=
+   $ make clean
+   $ make
+
+   Note 1: Specifying PAPI install path (with '--with-papi-path' option) is 
not required if
+   PAPI was installed from packages.
+   Note 2: Building ODP with PAPI support forces dynamic linkage of ODP 
example applications with
+   ODP library.
+
+3.5.3 Configuration of instrumented API set
+
+   Instrumentation profile option can be applied at configure time to select 
API set to
+   be instrumented. By default, all ODP APIs stated in 'instrum' example are 
instrumented.
+
+   $ ./configure --with-papi-path= 
--with-code-instrum-profile=
+
+3.5.4 Running ODP application with code instrumentation
+
+   ODP example library 'instrum' is preloaded before execution of ODP 
application. ODP application
+   must link dynamically with ODP library.
+
+   # LD_PRELOAD=libinstrum.so.0.0.0 ./odp_application
+
+   Note: ODP and PAPI shared libraries must be accessible at runtime. Use 
LD_LIBRARY_PATH for
+   non-standard locations.
+
+   # export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib
+
+3.5.5 Retrieving performance counters
+
+   Performance counters are acquired per ODP worker and dumped in fix size 
sample chunks to CSV files.
+
+   CSV file name is composed as follows: profile__.csv
+
+   Default CSV files storage folder is '/tmp'. Use ODP_INSTRUM_STORE_DIR 
environment variable to
+   select a different folder.
+
+   # export ODP_INSTRUM_STORE_DIR=
+
+   CSV row contains the counters for execution of one API call: timestamp (ns) 
for the start of API call,
+   duration (cycles), API name and the differences between end and start for 
the list of PAPI counters.
+
+3.5.6 Selecting performance counters
+
+   By default, PAPI_BR_CN and PAPI_L2_DCM are acquired. Use 
ODP_INSTRUM_PAPI_EVENTS environment variable
+   to configure the list of PAPI counters (events).
+
+   # export ODP_INSTRUM_PAPI_EVENTS=PAPI_BR_CN,PAPI_L2_DCM,PAPI_BR_UCN
+
+   Note: Some PAPI counters may not be available for some architectures. Use 
papi tools 'papi_avail' and
+   'papi_native_avail' to retrieve the list of available counters.
+
 4.0 Packages needed to build API tests
 
CUnit test framework version 2.1-3 is required



[lng-odp] [PATCH v2 8/11] test: l2fwd: use multi conversion functions

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Use multi versions of packet / event conversion functions.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 test/performance/odp_l2fwd.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 09a12b050..a2b9a9ca0 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -270,12 +270,10 @@ static inline int event_queue_send(odp_queue_t queue, 
odp_packet_t *pkt_tbl,
   unsigned pkts)
 {
int ret;
-   unsigned i;
unsigned sent = 0;
odp_event_t ev_tbl[pkts];
 
-   for (i = 0; i < pkts; i++)
-   ev_tbl[i] = odp_packet_to_event(pkt_tbl[i]);
+   odp_packet_to_event_multi(pkt_tbl, ev_tbl, pkts);
 
while (sent < pkts) {
ret = odp_queue_enq_multi(queue, &ev_tbl[sent], pkts - sent);
@@ -373,8 +371,7 @@ static int run_worker_sched_mode(void *arg)
if (pkts <= 0)
continue;
 
-   for (i = 0; i < pkts; i++)
-   pkt_tbl[i] = odp_packet_from_event(ev_tbl[i]);
+   odp_packet_from_event_multi(pkt_tbl, ev_tbl, pkts);
 
if (odp_unlikely(gbl_args->appl.extra_check)) {
if (gbl_args->appl.chksum)
@@ -499,8 +496,7 @@ static int run_worker_plain_queue_mode(void *arg)
if (odp_unlikely(pkts <= 0))
continue;
 
-   for (i = 0; i < pkts; i++)
-   pkt_tbl[i] = odp_packet_from_event(event[i]);
+   odp_packet_from_event_multi(pkt_tbl, event, pkts);
 
if (odp_unlikely(gbl_args->appl.extra_check)) {
if (gbl_args->appl.chksum)



[lng-odp] [PATCH API-NEXT v4 6/7] api: ipsec: outbound TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Specify how application can request TFC padding and dummy
packet creation at output. Application can use
odp_ipsec_out_opt_t options to reguest addition of TFC
padding, or creation of a TFC dummy packet
(next header = 59). IP parameter override options are needed
for tunnel mode dummy packet creation as there's no IP header
to copy e.g. DSCP or flow label values to tunnel IP header.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/spec/ipsec.h | 44 +++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 721f96856..665dc07bc 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -991,6 +991,22 @@ typedef struct odp_ipsec_out_opt_t {
/** Use fragmentation mode option */
uint32_t frag_mode: 1;
 
+   /** Use TFC padding length option */
+   uint32_t tfc_pad:   1;
+
+   /** Tunnel mode TFC dummy packet. This can be used only
+*  in tunnel mode. When the flag is set, packet length
+*  and content is ignored and instead a TFC dummy
+*  packet is created during IPSEC operation. The dummy
+*  packet length is defined by 'tfc_pad_len' option.
+*  If the SA is configured to copy IP header fields
+*  from inner IP packet, those fields must be passed
+*  with IP parameters option. */
+   uint32_t tfc_dummy: 1;
+
+   /** Use IP parameters option */
+   uint32_t ip_param:  1;
+
} flag;
 
/** All flag bits */
@@ -1000,6 +1016,26 @@ typedef struct odp_ipsec_out_opt_t {
/** Fragmentation mode */
odp_ipsec_frag_mode_t frag_mode;
 
+   /** TFC padding length
+*
+*  Number of TFC padding bytes added to the packet during IPSEC
+*  processing. Resulting packet should not exceed the maximum packet
+*  length of the pool, otherwise IPSEC operation may fail.
+*  Implementation guarantees that the padding does not contain any
+*  confidential information. */
+   uint32_t tfc_pad_len;
+
+   /** Union of IP parameters */
+   union {
+   /** Override IPv4 parameters in outer header creation.
+*  IP addresses are ignored. */
+   odp_ipsec_ipv4_param_t ipv4;
+
+   /** Override IPv6 parameters in outer header creation.
+*  IP addresses are ignored. */
+   odp_ipsec_ipv6_param_t ipv6;
+   };
+
 } odp_ipsec_out_opt_t;
 
 /**
@@ -1302,7 +1338,13 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in,
  * The operation does packet transformation according to IPSEC standards (see
  * e.g. RFC 4302 and 4303). Resulting packets are well formed IP packets
  * with IPSEC, etc headers constructed according to the standards. The amount
- * and content of packet data before the IP header is undefined.
+ * and content of packet data before the IP header is undefined. Use outbound
+ * operation parameters to specify the amount of TFC padding appended to
+ * the packet during IPSEC transformation. Options can be used also to create
+ * TFC dummy packets. Packet data content is ignored in tunnel mode TFC dummy
+ * packet creation as tfc_pad_len option defines solely the packet length.
+ * In all other cases, payload length for the IPSEC transformation is specified
+ * by odp_packet_len() minus odp_packet_l3_offset() plus tfc_pad_len option.
  *
  * Each successfully transformed packet has a valid value for these metadata:
  * - L3 offset: Offset to the first byte of the (outmost) IP header



[lng-odp] [PATCH CATERPILLAR v4 5/7] example: instrum: configure instrumented API set

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Add configure time option to trim API set to be instrumented.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 example/instrum/Makefile.am| 16 +---
 example/instrum/instrum.c  |  4 
 example/instrum/pktio_direct.h |  3 +++
 example/instrum/sched.h|  3 +++
 example/m4/configure.m4|  8 
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am
index 42c8161bf..fc4f5dcff 100644
--- a/example/instrum/Makefile.am
+++ b/example/instrum/Makefile.am
@@ -16,13 +16,11 @@ AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi
 
 lib_LTLIBRARIES = $(LIB)/libinstrum.la
 
-__LIB__libinstrum_la_SOURCES = \
+INSTRUM_SRC = \
instrum.c \
store.c \
papi_cnt.c \
init.c \
-   pktio_direct.c\
-   sched.c \
instrum_common.h \
sample.h \
store.h \
@@ -30,3 +28,15 @@ __LIB__libinstrum_la_SOURCES = \
init.h \
pktio_direct.h \
sched.h
+
+if CODE_INSTRUM_SCHED
+AM_CFLAGS += -DCODE_INSTRUM_SCHED
+INSTRUM_SRC += sched.c
+endif
+
+if CODE_INSTRUM_PKTIO_DIRECT
+AM_CFLAGS += -DCODE_INSTRUM_PKTIO_DIRECT
+INSTRUM_SRC += pktio_direct.c
+endif
+
+__LIB__libinstrum_la_SOURCES = $(INSTRUM_SRC)
diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c
index 605675154..aba07e0c2 100644
--- a/example/instrum/instrum.c
+++ b/example/instrum/instrum.c
@@ -21,11 +21,15 @@ static __attribute__((constructor)) void 
setup_wrappers(void)
if (instr_odpinit_init())
return;
 
+#ifdef CODE_INSTRUM_SCHED
if (instr_odpsched_init())
return;
+#endif /* CODE_INSTRUM_SCHED */
 
+#ifdef CODE_INSTRUM_PKTIO_DIRECT
if (instr_odppktio_direct_init())
return;
+#endif /* CODE_INSTRUM_PKTIO_DIRECT */
 }
 
 static __attribute__((destructor)) void teardown_wrappers(void)
diff --git a/example/instrum/pktio_direct.h b/example/instrum/pktio_direct.h
index b028c3a4f..1d30a3db0 100644
--- a/example/instrum/pktio_direct.h
+++ b/example/instrum/pktio_direct.h
@@ -7,6 +7,8 @@
 #ifndef __INSTRUM_PKTIO_DIRECT_H__
 #define __INSTRUM_PKTIO_DIRECT_H__
 
+#ifdef CODE_INSTRUM_PKTIO_DIRECT
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -16,5 +18,6 @@ int instr_odppktio_direct_init(void);
 #ifdef __cplusplus
 }
 #endif
+#endif /* CODE_INSTRUM_PKTIO_DIRECT */
 #endif /* __INSTRUM_PKTIO_DIRECT_H__ */
 
diff --git a/example/instrum/sched.h b/example/instrum/sched.h
index 2a092b0ed..6cfc40bdc 100644
--- a/example/instrum/sched.h
+++ b/example/instrum/sched.h
@@ -7,6 +7,8 @@
 #ifndef __INSTRUM_SCHED_H__
 #define __INSTRUM_SCHED_H__
 
+#ifdef CODE_INSTRUM_SCHED
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -16,4 +18,5 @@ int instr_odpsched_init(void);
 #ifdef __cplusplus
 }
 #endif
+#endif /* CODE_INSTRUM_SCHED */
 #endif /* __INSTRUM_SCHED_H__ */
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 5a05717b8..2d4e095c3 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -23,6 +23,14 @@ AS_HELP_STRING([--with-papi-path=DIR   path to papi install 
directory]),
 AC_SUBST([PAPI_PATH])
 AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ])
 
+AC_ARG_WITH([code-instrum-profile],
+AS_HELP_STRING([--with-code-instrum-profile=all|scheduler|pktio_direct   set 
code instrumentation profile]),
+[code_instrum_profile="$withval"],
+[code_instrum_profile="all"])
+
+AM_CONDITIONAL([CODE_INSTRUM_SCHED],[test $code_instrum_profile = "all" || 
test $code_instrum_profile = "scheduler"])
+AM_CONDITIONAL([CODE_INSTRUM_PKTIO_DIRECT],[test $code_instrum_profile = "all" 
|| test $code_instrum_profile = "pktio_direct"])
+
 AC_CONFIG_FILES([example/classifier/Makefile
 example/generator/Makefile
 example/hello/Makefile



[lng-odp] [PATCH v2 10/11] linux-gen: pktio: inline pktio index function

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Inline packet IO interface handle to index conversion function
which may be used frequently.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/Makefile.am |  3 +++
 .../include-abi/odp/api/abi/packet_io.h|  4 +++
 .../include/odp/api/plat/pktio_inlines.h   | 27 +++
 .../include/odp/api/plat/pktio_inlines_api.h   | 31 ++
 .../linux-generic/include/odp_packet_io_internal.h | 13 -
 platform/linux-generic/odp_packet.c|  4 ++-
 platform/linux-generic/odp_packet_io.c | 17 +++-
 platform/linux-generic/odp_pktio_api.c | 14 ++
 8 files changed, 93 insertions(+), 20 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/api/plat/pktio_inlines.h
 create mode 100644 
platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h
 create mode 100644 platform/linux-generic/odp_pktio_api.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 10e38ac3c..1c2b625cb 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -30,6 +30,8 @@ odpapiplatinclude_HEADERS = \
  include/odp/api/plat/packet_inline_types.h \
  include/odp/api/plat/packet_inlines.h \
  include/odp/api/plat/packet_inlines_api.h \
+ include/odp/api/plat/pktio_inlines.h \
+ include/odp/api/plat/pktio_inlines_api.h \
  include/odp/api/plat/pool_inline_types.h \
  include/odp/api/plat/std_clib_inlines.h \
  include/odp/api/plat/strong_types.h \
@@ -205,6 +207,7 @@ __LIB__libodp_linux_la_SOURCES += \
   odp_byteorder.c \
   odp_packet_api.c \
   odp_packet_flags_api.c \
+  odp_pktio_api.c \
   odp_std_clib.c \
   odp_sync.c \
   odp_thread_api.c \
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h 
b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
index a84e858e6..07931b817 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/packet_io.h
@@ -51,6 +51,10 @@ typedef struct odp_pktout_queue_t {
  * @}
  */
 
+#define _ODP_INLINE static inline
+#include 
+#include 
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/include/odp/api/plat/pktio_inlines.h 
b/platform/linux-generic/include/odp/api/plat/pktio_inlines.h
new file mode 100644
index 0..6a2aa72d8
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/pktio_inlines.h
@@ -0,0 +1,27 @@
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_PKTIO_INLINES_H_
+#define ODP_PLAT_PKTIO_INLINES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
+static inline int _odp_pktio_index(odp_pktio_t pktio)
+{
+   return (int)(uintptr_t)pktio - 1;
+}
+
+/** @endcond */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h 
b/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h
new file mode 100644
index 0..5b59a4378
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/pktio_inlines_api.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ */
+
+#ifndef ODP_PLAT_PKTIO_INLINES_API_H_
+#define ODP_PLAT_PKTIO_INLINES_API_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_ODP_INLINE int odp_pktio_index(odp_pktio_t pktio)
+{
+   return _odp_pktio_index(pktio);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index ad34e964a..1de0cbf90 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -18,6 +18,8 @@
 extern "C" {
 #endif
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -235,13 +237,10 @@ typedef struct pktio_if_ops {
 
 extern void *pktio_entry_ptr[];
 
-static inline int pktio_to_id(odp_pktio_t pktio)
-{
-   return _odp_typeval(pktio) - 1;
-}
-
 static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio)
 {
+   int idx;
+
if (odp_unlikely(pktio == ODP_PKTIO_INVALID))
r

[lng-odp] [PATCH CATERPILLAR v4 0/7] Code instrumentation with PAPI library

2018-01-31 Thread Github ODP bot
ODP API instrumentation with PAPI (Performance API) library 
(http://icl.cs.utk.edu/papi)
"instrum" example is using library preload, symbols overloading and PAPI to 
obtain performance counters (like data cache miss or conditional branch count) 
for execution of ODP API calls. Performance counters are saved in CSV file 
format and can be presented in a graphical form (with Excel or similar).
Build:
./bootstrap
./configure --with-papi-path=< path to papi install> 
--with-code-instrum-profile=
make clean
make
Configure path to papi install:
--with-papi-path= < path to papi install>
Configure instrumented ODP API:
--with-code-instrum-profile=
Default: all
Storage directory:
export ODP_INSTRUM_STORE_DIR= < folder to store csv files >
Default directory: /tmp
e.g.
export ODP_INSTRUM_STORE_DIR=/home/bopi/Work/linaro/store
Configure PAPI events set:
export ODP_INSTRUM_PAPI_EVENTS=
Default: PAPI_BR_CN,PAPI_L2_DCM
e.g:
export ODP_INSTRUM_PAPI_EVENTS=PAPI_BR_CN,PAPI_L2_DCM,PAPI_BR_UCN
Set load library path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH::
e.g.
export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/bopi/Work/linaro/odp/lib/.libs:/home/bopi/Work/linaro/papi_inst/lib
Run:
LD_PRELOAD=libinstrum.so.0.0.0 ./example/generator/.libs/odp_generator -I eth1 
-m r -c 0x8

github
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 27 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 59 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 676 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 128 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 85 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 88 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 33 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH CATERPILLAR v4 2/7] example: instrum: add skeleton

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Add instrumentation library as odp example.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 example/Makefile.am |  4 
 example/Makefile.inc|  4 
 example/instrum/Makefile.am | 20 
 example/instrum/instrum.c   | 18 ++
 example/m4/configure.m4 |  1 +
 5 files changed, 47 insertions(+)
 create mode 100644 example/instrum/Makefile.am
 create mode 100644 example/instrum/instrum.c

diff --git a/example/Makefile.am b/example/Makefile.am
index b6e8d81fe..99c5726f7 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -13,4 +13,8 @@ SUBDIRS = classifier \
  ddf_ifs \
  ddf_app
 
+if CODE_INSTRUM
+SUBDIRS += instrum
+endif
+
 noinst_HEADERS = example_debug.h
diff --git a/example/Makefile.inc b/example/Makefile.inc
index 31bf7c435..78b750cda 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -13,4 +13,8 @@ AM_CFLAGS = \
-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
-I$(top_builddir)/include
 
+if CODE_INSTRUM
+AM_LDFLAGS = -L$(LIB) -lssl -lcrypto -latomic
+else
 AM_LDFLAGS = -L$(LIB) -static
+endif
diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am
new file mode 100644
index 0..bf2a19c0d
--- /dev/null
+++ b/example/instrum/Makefile.am
@@ -0,0 +1,20 @@
+LIB   = $(top_builddir)/lib
+
+AM_CFLAGS = \
+-I$(srcdir) \
+-I$(top_srcdir)/example \
+-I$(top_srcdir)/platform/@with_platform@/include \
+-I$(top_srcdir)/include/ \
+-I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
+-I$(top_srcdir)/helper/include \
+-I$(top_builddir)/platform/@with_platform@/include \
+-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
+-I$(top_builddir)/include \
+-I$(PAPI_PATH)/include
+
+AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi
+
+lib_LTLIBRARIES = $(LIB)/libinstrum.la
+
+__LIB__libinstrum_la_SOURCES = \
+   instrum.c
diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c
new file mode 100644
index 0..88580c58f
--- /dev/null
+++ b/example/instrum/instrum.c
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+
+static __attribute__((constructor)) void setup_wrappers(void)
+{
+   printf("Setup Wrappers\n");
+}
+
+static __attribute__((destructor)) void teardown_wrappers(void)
+{
+   printf("Teardown Wrappers\n");
+}
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 5122d19b6..5a05717b8 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -37,4 +37,5 @@ AC_CONFIG_FILES([example/classifier/Makefile
 example/traffic_mgmt/Makefile
 example/ddf_ifs/Makefile
 example/ddf_app/Makefile
+example/instrum/Makefile
 example/Makefile])



[lng-odp] [PATCH CATERPILLAR v4 1/7] example: add basic papi configuration option

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Add configuration options to enable code instrumentation and set
PAPI installation folder.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 configure.ac|  1 +
 example/m4/configure.m4 | 16 
 2 files changed, 17 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3f5092320..bd0fbf3ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,4 +411,5 @@ AC_MSG_RESULT([
test_example:   ${test_example}
user_guides:${user_guides}
mdev:   ${mdev_support}
+   code instrumentation:   ${code_instrumentation}
 ])
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 208c5d6d7..5122d19b6 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -7,6 +7,22 @@ AC_ARG_ENABLE([test-example],
 [test_example=yes])
 AM_CONDITIONAL([test_example], [test x$test_example = xyes ])
 
+code_instrumentation=no
+AC_ARG_ENABLE([code-instrum],
+[  --enable-code-instrum   enable code instrumentation support],
+[if test x$enableval = xyes; then
+code_instrumentation=yes
+fi])
+
+PAPI_PATH=""
+AC_ARG_WITH([papi-path],
+AS_HELP_STRING([--with-papi-path=DIR   path to papi install directory]),
+[PAPI_PATH="$withval"
+code_instrumentation=yes],[])
+
+AC_SUBST([PAPI_PATH])
+AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ])
+
 AC_CONFIG_FILES([example/classifier/Makefile
 example/generator/Makefile
 example/hello/Makefile



[lng-odp] [PATCH v2 4/11] linux-gen: packet: use inlined copy functions

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Use always inlined versions of packet to/from memory copy
functions.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/odp_traffic_mngr.c  | 24 
 platform/linux-generic/pktio/dpdk.c|  4 ++--
 platform/linux-generic/pktio/netmap.c  |  4 ++--
 platform/linux-generic/pktio/pcap.c|  5 +++--
 platform/linux-generic/pktio/socket_mmap.c |  7 ---
 platform/linux-generic/pktio/tap.c |  5 +++--
 6 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/platform/linux-generic/odp_traffic_mngr.c 
b/platform/linux-generic/odp_traffic_mngr.c
index 557e77ba3..03094cc37 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -1941,8 +1941,8 @@ static void egress_vlan_marking(tm_vlan_marking_t 
*vlan_marking,
 * correctness rather then performance. */
split_hdr = hdr_len < (_ODP_ETHHDR_LEN + _ODP_VLANHDR_LEN);
if (split_hdr) {
-   odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN,
-  _ODP_VLANHDR_LEN, &vlan_hdr);
+   _odp_packet_copy_to_mem(odp_pkt, _ODP_ETHHDR_LEN,
+   _ODP_VLANHDR_LEN, &vlan_hdr);
vlan_hdr_ptr = &vlan_hdr;
}
 
@@ -1956,8 +1956,8 @@ static void egress_vlan_marking(tm_vlan_marking_t 
*vlan_marking,
 
vlan_hdr_ptr->tci = _odp_cpu_to_be_16(new_tci);
if (split_hdr)
-   odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN,
-_ODP_VLANHDR_LEN, &vlan_hdr);
+   _odp_packet_copy_from_mem(odp_pkt, _ODP_ETHHDR_LEN,
+ _ODP_VLANHDR_LEN, &vlan_hdr);
 }
 
 static void egress_ipv4_tos_marking(tm_tos_marking_t *tos_marking,
@@ -1980,8 +1980,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t 
*tos_marking,
 * correctness rather then performance. */
split_hdr = hdr_len < 12;
if (split_hdr) {
-   odp_packet_copy_to_mem(odp_pkt, l3_offset,
-  _ODP_IPV4HDR_LEN, &ipv4_hdr);
+   _odp_packet_copy_to_mem(odp_pkt, l3_offset,
+   _ODP_IPV4HDR_LEN, &ipv4_hdr);
ipv4_hdr_ptr = &ipv4_hdr;
}
 
@@ -2022,8 +2022,8 @@ static void egress_ipv4_tos_marking(tm_tos_marking_t 
*tos_marking,
ipv4_hdr_ptr->tos= new_tos;
ipv4_hdr_ptr->chksum = _odp_cpu_to_be_16((~ones_compl_sum) & 0x);
if (split_hdr)
-   odp_packet_copy_from_mem(odp_pkt, l3_offset,
-_ODP_IPV4HDR_LEN, &ipv4_hdr);
+   _odp_packet_copy_from_mem(odp_pkt, l3_offset,
+ _ODP_IPV4HDR_LEN, &ipv4_hdr);
 }
 
 static void egress_ipv6_tc_marking(tm_tos_marking_t *tos_marking,
@@ -2046,8 +2046,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t 
*tos_marking,
 * correctness rather then performance. */
split_hdr = hdr_len < 4;
if (split_hdr) {
-   odp_packet_copy_to_mem(odp_pkt, l3_offset,
-  _ODP_IPV6HDR_LEN, &ipv6_hdr);
+   _odp_packet_copy_to_mem(odp_pkt, l3_offset,
+   _ODP_IPV6HDR_LEN, &ipv6_hdr);
ipv6_hdr_ptr = &ipv6_hdr;
}
 
@@ -2075,8 +2075,8 @@ static void egress_ipv6_tc_marking(tm_tos_marking_t 
*tos_marking,
ipv6_hdr_ptr->ver_tc_flow = _odp_cpu_to_be_32(new_ver_tc_flow);
 
if (split_hdr)
-   odp_packet_copy_from_mem(odp_pkt, l3_offset,
-_ODP_IPV6HDR_LEN, &ipv6_hdr);
+   _odp_packet_copy_from_mem(odp_pkt, l3_offset,
+ _ODP_IPV6HDR_LEN, &ipv6_hdr);
 }
 
 static void tm_egress_marking(tm_system_t *tm_system, odp_packet_t odp_pkt)
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 4ae72e10a..86d7a4513 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -471,7 +471,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
pkt_hdr = odp_packet_hdr(pkt);
pull_tail(pkt_hdr, alloc_len - pkt_len);
 
-   if (odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0)
+   if (_odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0)
goto fail;
 
pkt_hdr->input = pktio_entry->s.handle;
@@ -649,7 +649,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
/* Packet always 

[lng-odp] [PATCH API-NEXT v4 5/7] api: ipsec: inbound TFC padding and dummy packets

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Specify how application can recognize TFC padding and dummy
packets at input. Packet metadata for L3/L4 protocol type
indicate if the original packet was an IP or a TFC dummy packet.
When packet length is larger than protocol fields indicate,
some TFC padding remain in the packet.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/spec/ipsec.h | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 08533d80d..721f96856 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -1226,12 +1226,23 @@ typedef struct odp_ipsec_status_t {
  * e.g. RFC 4302 and 4303). Resulting packets are well formed, reconstructed
  * original IP packets, with IPSEC headers removed and valid header field 
values
  * restored. The amount and content of packet data before the IP header is
- * undefined.
+ * undefined. Some amount of TFC padding may follow the IP packet payload,
+ * in which case packet length is larger than protocol headers indicate.
+ * TFC dummy packets have l3_type set to ODP_PROTO_L3_TYPE_NONE in tunnel mode
+ * or l4_type set to ODP_PROTO_L4_TYPE_NO_NEXT in transport mode. Dummy
+ * packets contain implementation specific amount of (dummy) data. Furthermore,
+ * inline IPSEC processing may drop dummy packets.
  *
  * Each successfully transformed packet has a valid value for these metadata
  * regardless of the inner packet parse configuration
  * (odp_ipsec_inbound_config_t):
- * - L3 offset: Offset to the first byte of the (outmost) IP header
+ * - l3_offset: Offset to the first byte of the original IP packet. The value
+ *  is implementation specific for tunnel mode TFC dummy packets.
+ * - l3_type:   Specifies if the original packet is IPv4 or IPv6. For tunnel
+ *  mode TFC dummy packets set to ODP_PROTO_L3_TYPE_NONE.
+ * - l4_type:   Always set to ODP_PROTO_L4_TYPE_NO_NEXT for transport mode 
dummy
+ *  packets. Otherwise, depends on parse configuration. Default
+ *  value is ODP_PROTO_L4_TYPE_NONE.
  * - pktio: For inline IPSEC processed packets, original packet input
  *  interface
  *



[lng-odp] [PATCH API-NEXT v4 4/7] api: ipsec: outbound operation option flags

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Add flags to select which options application uses. Currently,
there's no ambiguity, but as soon as there are multiple options
implementation needs to know which options are used and which
are ignored.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/spec/ipsec.h | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 1060a3ee2..08533d80d 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -983,6 +983,20 @@ typedef struct odp_ipsec_op_flag_t {
  * These may be used to override some SA level options
  */
 typedef struct odp_ipsec_out_opt_t {
+   /** Union of all flag bits */
+   union {
+   /** Option flags. Set flag for those options that are
+*  used, all other options are ignored. */
+   struct {
+   /** Use fragmentation mode option */
+   uint32_t frag_mode: 1;
+
+   } flag;
+
+   /** All flag bits */
+   uint32_t all_flags;
+   };
+
/** Fragmentation mode */
odp_ipsec_frag_mode_t frag_mode;
 



[lng-odp] [PATCH API-NEXT v4 3/7] api: ipsec: rename fragmentation mode option

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Rename outbound operation fragmentation options to frag_mode.
Frag_mode is used elsewhere in the API and "mode" is too generic
term for it (not future proof).

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/spec/ipsec.h   | 2 +-
 platform/linux-generic/odp_ipsec.c | 2 +-
 test/validation/api/ipsec/ipsec_test_out.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index c78afbe3f..1060a3ee2 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -984,7 +984,7 @@ typedef struct odp_ipsec_op_flag_t {
  */
 typedef struct odp_ipsec_out_opt_t {
/** Fragmentation mode */
-   odp_ipsec_frag_mode_t mode;
+   odp_ipsec_frag_mode_t frag_mode;
 
 } odp_ipsec_out_opt_t;
 
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index b6192377e..9f08b228c 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1306,7 +1306,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,
ipsec_sa = _odp_ipsec_sa_use(sa);
ODP_ASSERT(NULL != ipsec_sa);
 
-   if ((opt && opt->mode == ODP_IPSEC_FRAG_CHECK) ||
+   if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) ||
(!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK))
mtu = ipsec_sa->out.mtu;
else
diff --git a/test/validation/api/ipsec/ipsec_test_out.c 
b/test/validation/api/ipsec/ipsec_test_out.c
index 971fbbf8d..4940efa5a 100644
--- a/test/validation/api/ipsec/ipsec_test_out.c
+++ b/test/validation/api/ipsec/ipsec_test_out.c
@@ -530,7 +530,7 @@ static void test_out_ipv4_ah_sha256_frag_check(void)
ipsec_test_part test2 = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_opt = 1,
-   .opt = { .mode = ODP_IPSEC_FRAG_DISABLED, },
+   .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, },
.out_pkt = 1,
.out = {
{ .status.warn.all = 0,
@@ -623,7 +623,7 @@ static void test_out_ipv4_esp_null_sha256_frag_check(void)
ipsec_test_part test2 = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_opt = 1,
-   .opt = { .mode = ODP_IPSEC_FRAG_DISABLED, },
+   .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, },
.out_pkt = 1,
.out = {
{ .status.warn.all = 0,



[lng-odp] [PATCH API-NEXT v4 2/7] api: ipsec: IP header parameter types

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Create IP header parameter types, so that those can be used
also outside of SA parameter struct.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/spec/ipsec.h | 72 
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 47e3045f3..c78afbe3f 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -382,6 +382,44 @@ typedef struct odp_ipsec_crypto_param_t {
 
 } odp_ipsec_crypto_param_t;
 
+/** IPv4 header parameters */
+typedef struct odp_ipsec_ipv4_param_t {
+   /** IPv4 source address (NETWORK ENDIAN) */
+   void *src_addr;
+
+   /** IPv4 destination address (NETWORK ENDIAN) */
+   void *dst_addr;
+
+   /** IPv4 Differentiated Services Code Point */
+   uint8_t dscp;
+
+   /** IPv4 Don't Fragment bit */
+   uint8_t df;
+
+   /** IPv4 Time To Live */
+   uint8_t ttl;
+
+} odp_ipsec_ipv4_param_t;
+
+/** IPv6 header parameters */
+typedef struct odp_ipsec_ipv6_param_t {
+   /** IPv6 source address (NETWORK ENDIAN) */
+   void *src_addr;
+
+   /** IPv6 destination address (NETWORK ENDIAN) */
+   void *dst_addr;
+
+   /** IPv6 flow label */
+   uint32_t flabel;
+
+   /** IPv6 Differentiated Services Code Point */
+   uint8_t dscp;
+
+   /** IPv6 hop limit */
+   uint8_t hlimit;
+
+} odp_ipsec_ipv6_param_t;
+
 /**
  * IPSEC tunnel parameters
  *
@@ -397,40 +435,10 @@ typedef struct odp_ipsec_tunnel_param_t {
/** Variant mappings for tunnel parameters */
union {
/** IPv4 header parameters */
-   struct {
-   /** IPv4 source address (NETWORK ENDIAN) */
-   void *src_addr;
-
-   /** IPv4 destination address (NETWORK ENDIAN) */
-   void *dst_addr;
-
-   /** IPv4 Differentiated Services Code Point */
-   uint8_t dscp;
-
-   /** IPv4 Don't Fragment bit */
-   uint8_t df;
-
-   /** IPv4 Time To Live */
-   uint8_t ttl;
-   } ipv4;
+   odp_ipsec_ipv4_param_t ipv4;
 
/** IPv6 header parameters */
-   struct {
-   /** IPv6 source address (NETWORK ENDIAN) */
-   void *src_addr;
-
-   /** IPv6 destination address (NETWORK ENDIAN) */
-   void *dst_addr;
-
-   /** IPv6 Differentiated Services Code Point */
-   uint8_t dscp;
-
-   /** IPv6 flow label */
-   uint32_t flabel;
-
-   /** IPv6 hop limit */
-   uint8_t hlimit;
-   } ipv6;
+   odp_ipsec_ipv6_param_t ipv6;
};
 } odp_ipsec_tunnel_param_t;
 



[lng-odp] [PATCH API-NEXT v4 1/7] api: packet: add protocol type enumeration

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Add enumerations for L3 and L4 protocol types, and functions
to request those.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 403 (psavol:next-ipsec-tfc)
 ** https://github.com/Linaro/odp/pull/403
 ** Patch: https://github.com/Linaro/odp/pull/403.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de
 **/
 include/odp/api/abi-default/packet.h   | 28 +++
 include/odp/api/spec/packet.h  | 95 ++
 .../linux-generic/include-abi/odp/api/abi/packet.h | 28 +++
 3 files changed, 151 insertions(+)

diff --git a/include/odp/api/abi-default/packet.h 
b/include/odp/api/abi-default/packet.h
index 3d6876731..349b6b1fa 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -30,6 +30,34 @@ typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
 #define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)0x)
 #define ODP_PACKET_OFFSET_INVALID 0x
 
+typedef uint8_t odp_proto_l3_type_t;
+
+#define ODP_PROTO_L3_TYPE_NONE   0
+#define ODP_PROTO_L3_TYPE_ARP1
+#define ODP_PROTO_L3_TYPE_RARP   2
+#define ODP_PROTO_L3_TYPE_MPLS   3
+#define ODP_PROTO_L3_TYPE_IPV4   4
+#define ODP_PROTO_L3_TYPE_IPV6   6
+
+typedef uint8_t odp_proto_l4_type_t;
+
+/* Numbers from IANA Assigned Internet Protocol Numbers list */
+#define ODP_PROTO_L4_TYPE_NONE  0
+#define ODP_PROTO_L4_TYPE_ICMPV41
+#define ODP_PROTO_L4_TYPE_IGMP  2
+#define ODP_PROTO_L4_TYPE_IPV4  4
+#define ODP_PROTO_L4_TYPE_TCP   6
+#define ODP_PROTO_L4_TYPE_UDP   17
+#define ODP_PROTO_L4_TYPE_IPV6  41
+#define ODP_PROTO_L4_TYPE_GRE   47
+#define ODP_PROTO_L4_TYPE_ESP   50
+#define ODP_PROTO_L4_TYPE_AH51
+#define ODP_PROTO_L4_TYPE_ICMPV658
+#define ODP_PROTO_L4_TYPE_NO_NEXT   59
+#define ODP_PROTO_L4_TYPE_IPCOMP108
+#define ODP_PROTO_L4_TYPE_SCTP  132
+#define ODP_PROTO_L4_TYPE_ROCH  142
+
 typedef enum {
ODP_PACKET_GREEN = 0,
ODP_PACKET_YELLOW = 1,
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index 3222ff5c2..6f6aa0658 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -71,6 +71,79 @@ extern "C" {
   * Packet is red
   */
 
+/**
+ * @typedef odp_proto_l3_type_t
+ * Layer 3 protocol type
+ */
+
+/**
+ * @def ODP_PROTO_L3_TYPE_NONE
+ * Layer 3 protocol type not defined
+ *
+ * @def ODP_PROTO_L3_TYPE_ARP
+ * Layer 3 protocol is ARP
+ *
+ * @def ODP_PROTO_L3_TYPE_RARP
+ * Layer 3 protocol is RARP
+ *
+ * @def ODP_PROTO_L3_TYPE_MPLS
+ * Layer 3 protocol is MPLS
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV4
+ * Layer 3 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L3_TYPE_IPV6
+ * Layer 3 protocol type is IPv6
+ */
+
+/**
+ * @def ODP_PROTO_L4_TYPE_NONE
+ * Layer 4 protocol type not defined
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV4
+ * Layer 4 protocol type is ICMPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_IGMP
+ * Layer 4 protocol type is IGMP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV4
+ * Layer 4 protocol type is IPv4
+ *
+ * @def ODP_PROTO_L4_TYPE_TCP
+ * Layer 4 protocol type is TCP
+ *
+ * @def ODP_PROTO_L4_TYPE_UDP
+ * Layer 4 protocol type is UDP
+ *
+ * @def ODP_PROTO_L4_TYPE_IPV6
+ * Layer 4 protocol type is IPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_GRE
+ * Layer 4 protocol type is GRE
+ *
+ * @def ODP_PROTO_L4_TYPE_ESP
+ * Layer 4 protocol type is IPSEC ESP
+ *
+ * @def ODP_PROTO_L4_TYPE_AH
+ * Layer 4 protocol type is IPSEC AH
+ *
+ * @def ODP_PROTO_L4_TYPE_ICMPV6
+ * Layer 4 protocol type is ICMPv6
+ *
+ * @def ODP_PROTO_L4_TYPE_NO_NEXT
+ * Layer 4 protocol type is "No Next Header".
+ * Protocol / next header number is 59.
+ *
+ * @def ODP_PROTO_L4_TYPE_IPCOMP
+ * Layer 4 protocol type is IP Payload Compression Protocol
+ *
+ * @def ODP_PROTO_L4_TYPE_SCTP
+ * Layer 4 protocol type is SCTP
+ *
+ * @def ODP_PROTO_L4_TYPE_ROCH
+ * Layer 4 protocol type is ROCH
+ */
+
 /**
  * Protocol
  */
@@ -1542,6 +1615,28 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt);
  */
 int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset);
 
+/**
+ * Layer 3 protocol type
+ *
+ * Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE.
+ *
+ * @param  pkt  Packet handle
+ *
+ * @return Layer 3 protocol type
+ */
+odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt);
+
+/**
+ * Layer 4 protocol type
+ *
+ * Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE.
+ *
+ * @param  pkt  Packet handle
+ *
+ * @return Layer 4 protocol type
+ */
+odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt);
+
 /**
  * Layer 3 checksum check status
  *
diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h 
b/platform/linux-generic/include-abi/odp/api/abi/packet.h
index 1aa7cbd58..c68ac7b48 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/packet.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/

[lng-odp] [PATCH CATERPILLAR v4 7/7] example: instrum: add travis test

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Add test to validate ODP build with papi library.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 .travis.yml | 21 +
 1 file changed, 21 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index f5a67781e..f4ed4736d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -205,6 +205,16 @@ install:
 fi
 sudo insmod ./netmap/LINUX/netmap.ko
   fi
+#  PAPI library
+- |
+  if [ -z "$CROSS_ARCH" -a ! -f "$HOME/papi-install/lib/libpapi.so" ]; 
then
+git -c advice.detachedHead=false clone -q --depth=1 
--single-branch --branch=papi-5-6-0-t https://bitbucket.org/icl/papi.git
+pushd papi/src
+./configure --prefix=$HOME/papi-install
+make
+make install
+popd
+  fi
 
 script:
 - if [ -z "$CROSS_ARCH" ] ; then
@@ -307,6 +317,17 @@ jobs:
   - ./configure --with-platform=linux-dpdk 
--enable-test-cpp --enable-test-vald --enable-test-helper --enable-test-perf 
--enable-user-guides --enable-test-perf-proc --enable-test-example 
--with-sdk-install-path=`pwd`/dpdk-17.02/${TARGET} 
--with-cunit-path=$HOME/cunit-install/$CROSS_ARCH $CONF
   - make -j $(nproc)
   - sudo 
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" make check
+- stage: test
+  env: TEST=code_instrum
+  compiler: gcc
+  script:
+  - ./bootstrap
+  - ./configure --prefix=$HOME/odp-papi-install 
--enable-test-cpp --enable-test-vald --enable-test-helper --enable-test-perf 
--enable-user-guides --enable-test-perf-proc --enable-test-example 
--with-cunit-path=$HOME/cunit-install/$CROSS_ARCH 
--with-papi-path=$HOME/papi-install $CONF
+  - make -j $(nproc)
+  - make install
+  - sudo $HOME/papi-install/bin/papi_avail
+  - mkdir $HOME/store
+  - sudo 
LD_LIBRARY_PATH="/usr/local/lib:$HOME/odp-papi-install/lib:$HOME/papi-install/lib:$LD_LIBRARY_PATH"
 ODP_INSTRUM_STORE_DIR=$HOME/store LD_PRELOAD=libinstrum.so.0.0.0 
$HOME/odp-papi-install/bin/odp_generator -I lo --srcmac a0:36:9f:28:e2:57 
--dstmac 00:0f:fe:c5:73:66 --srcip 192.168.150.1 --dstip 192.168.150.2 -m u -n 
200
 after_failure:
   - cat config.log
   - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read 
trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done



[lng-odp] [PATCH CATERPILLAR v4 4/7] example: instrum: configure papi event set

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Configure the set of papi counters to be acquired via an
environment variable.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 example/instrum/papi_cnt.c | 44 +++-
 example/instrum/papi_cnt.h |  2 ++
 example/instrum/sample.h   |  2 +-
 example/instrum/store.c|  4 +++-
 4 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/example/instrum/papi_cnt.c b/example/instrum/papi_cnt.c
index c38c856a0..da8267834 100644
--- a/example/instrum/papi_cnt.c
+++ b/example/instrum/papi_cnt.c
@@ -6,17 +6,25 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-static int papi_event_tab[SAMPLE_COUNTER_TAB_SIZE] = {PAPI_BR_CN, PAPI_L2_DCM};
+#define PAPI_EVENTS_ENV "ODP_INSTRUM_PAPI_EVENTS"
+
+#define PAPI_EVENT_TAB_SIZE_DFLT 2
+int papi_event_tab_dflt[PAPI_EVENT_TAB_SIZE_DFLT] = {PAPI_BR_CN, PAPI_L2_DCM};
+
+static int papi_event_tab[SAMPLE_COUNTER_TAB_SIZE];
+static int papi_event_tab_size;
 
 static __thread int event_set = PAPI_NULL;
 
 int papi_init(void)
 {
int retval, i;
+   char *papi_events_env = NULL;
 
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT) {
@@ -35,7 +43,28 @@ int papi_init(void)
goto err_shutdown;
}
 
-   for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) {
+   papi_events_env = getenv(PAPI_EVENTS_ENV);
+   if (papi_events_env) {
+   char *tk = strtok(papi_events_env, ",");
+   int papi_event;
+
+   while (tk != NULL &&
+  papi_event_tab_size < SAMPLE_COUNTER_TAB_SIZE) {
+   if (PAPI_event_name_to_code(tk, &papi_event) == PAPI_OK)
+   papi_event_tab[papi_event_tab_size++] =
+   papi_event;
+
+   tk = strtok(NULL, ",");
+   }
+   }
+
+   if (!papi_event_tab_size) {
+   for (i = 0; i < PAPI_EVENT_TAB_SIZE_DFLT; i++)
+   papi_event_tab[i] = papi_event_tab_dflt[i];
+   papi_event_tab_size = PAPI_EVENT_TAB_SIZE_DFLT;
+   }
+
+   for (i = 0; i < papi_event_tab_size; i++) {
retval = PAPI_query_event(papi_event_tab[i]);
if (retval != PAPI_OK) {
printf("PAPI_query_event %d - error\n", i);
@@ -75,7 +104,7 @@ int papi_init_local(void)
}
 
retval = PAPI_add_events(event_set, papi_event_tab,
-SAMPLE_COUNTER_TAB_SIZE);
+papi_event_tab_size);
if (retval != PAPI_OK) {
printf("PAPI_add_events error: %d\n", retval);
goto err_clean_evset;
@@ -103,7 +132,7 @@ int papi_term_local(void)
if (PAPI_stop(event_set, last_counters) == PAPI_OK) {
int i;
 
-   for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++)
+   for (i = 0; i < papi_event_tab_size; i++)
printf("Counter[%d] = %lld\n", i, last_counters[i]);
}
 
@@ -113,6 +142,11 @@ int papi_term_local(void)
return 0;
 }
 
+int papi_counters_cnt(void)
+{
+   return papi_event_tab_size;
+}
+
 int papi_sample_start(profiling_sample_t *spl)
 {
spl->timestamp_ns = PAPI_get_real_nsec();
@@ -134,7 +168,7 @@ int papi_sample_end(profiling_sample_t *spl)
return -1;
}
 
-   for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++)
+   for (i = 0; i < papi_event_tab_size; i++)
spl->counters[i] = end_counters[i] - spl->counters[i];
 
spl->diff_cyc = end_cyc - spl->diff_cyc;
diff --git a/example/instrum/papi_cnt.h b/example/instrum/papi_cnt.h
index a4546c954..21ffbb7ca 100644
--- a/example/instrum/papi_cnt.h
+++ b/example/instrum/papi_cnt.h
@@ -18,6 +18,8 @@ void papi_term(void);
 int papi_init_local(void);
 int papi_term_local(void);
 
+int papi_counters_cnt(void);
+
 int papi_sample_start(profiling_sample_t *spl);
 int papi_sample_end(profiling_sample_t *spl);
 
diff --git a/example/instrum/sample.h b/example/instrum/sample.h
index 090308348..7ed03fb9b 100644
--- a/example/instrum/sample.h
+++ b/example/instrum/sample.h
@@ -12,7 +12,7 @@ extern "C" {
 #endif
 
 #define SAMPLE_NAME_SIZE_MAX 20
-#define SAMPLE_COUNTER_TAB_SIZE 2
+#define SAMPLE_COUNTER_TAB_SIZE 10
 
 typedef struct {
char name[SAMPLE_NAME_SIZE_MAX];
diff --git a/example/instrum/store.c b/example/instrum/store.c
index 77137aad8..6f7294f24 100644
--- a/example/instrum/store.c
+++ b/example/instrum/store.c
@@ -23,6 +23,7 @@ static __thread uint64_t profile_sample_ovf;
 #define STORE_FILE_NAME_SIZE_MAX 250
 
 static char store_d

[lng-odp] [PATCH CATERPILLAR v4 3/7] example: instrum: use low level API to retrieve performance counters

2018-01-31 Thread Github ODP bot
From: Bogdan Pricope 

Use low level PAPI API to get performance counters.
Exemplify on some ODP APIs.

Signed-off-by: Bogdan Pricope 
---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: 079b524277414f57411d3223563353bbdbc1a536
 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851
 **/
 example/instrum/Makefile.am  |  14 +++-
 example/instrum/init.c   |  54 +++
 example/instrum/init.h   |  19 ++
 example/instrum/instrum.c|  19 +-
 example/instrum/instrum_common.h |  34 ++
 example/instrum/papi_cnt.c   | 143 +++
 example/instrum/papi_cnt.h   |  27 
 example/instrum/pktio_direct.c   |  68 +++
 example/instrum/pktio_direct.h   |  20 ++
 example/instrum/sample.h |  28 
 example/instrum/sched.c  |  43 
 example/instrum/sched.h  |  19 ++
 example/instrum/store.c  | 133 
 example/instrum/store.h  |  36 ++
 14 files changed, 655 insertions(+), 2 deletions(-)
 create mode 100644 example/instrum/init.c
 create mode 100644 example/instrum/init.h
 create mode 100644 example/instrum/instrum_common.h
 create mode 100644 example/instrum/papi_cnt.c
 create mode 100644 example/instrum/papi_cnt.h
 create mode 100644 example/instrum/pktio_direct.c
 create mode 100644 example/instrum/pktio_direct.h
 create mode 100644 example/instrum/sample.h
 create mode 100644 example/instrum/sched.c
 create mode 100644 example/instrum/sched.h
 create mode 100644 example/instrum/store.c
 create mode 100644 example/instrum/store.h

diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am
index bf2a19c0d..42c8161bf 100644
--- a/example/instrum/Makefile.am
+++ b/example/instrum/Makefile.am
@@ -17,4 +17,16 @@ AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi
 lib_LTLIBRARIES = $(LIB)/libinstrum.la
 
 __LIB__libinstrum_la_SOURCES = \
-   instrum.c
+   instrum.c \
+   store.c \
+   papi_cnt.c \
+   init.c \
+   pktio_direct.c\
+   sched.c \
+   instrum_common.h \
+   sample.h \
+   store.h \
+   papi_cnt.h \
+   init.h \
+   pktio_direct.h \
+   sched.h
diff --git a/example/instrum/init.c b/example/instrum/init.c
new file mode 100644
index 0..8691ff978
--- /dev/null
+++ b/example/instrum/init.c
@@ -0,0 +1,54 @@
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int (*instr_odp_init_local)(odp_instance_t instance,
+  odp_thread_type_t thr_type);
+
+static int (*instr_odp_term_local)(void);
+
+int instr_odpinit_init(void)
+{
+   INSTR_FUNCTION(odp_init_local);
+
+   if (!instr_odp_init_local) {
+   printf("odp_init_local: Not Found\n");
+   return -1;
+   }
+
+   INSTR_FUNCTION(odp_term_local);
+
+   if (!instr_odp_term_local) {
+   printf("odp_term_local: Not Found\n");
+   return -1;
+   }
+
+   return 0;
+}
+
+int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type)
+{
+   int ret;
+
+   ret = (*instr_odp_init_local)(instance, thr_type);
+
+   instr_store_init_local();
+
+   return ret;
+}
+
+int odp_term_local(void)
+{
+   instr_store_term_local();
+
+   return (*instr_odp_term_local)();
+}
diff --git a/example/instrum/init.h b/example/instrum/init.h
new file mode 100644
index 0..b92e9d4a3
--- /dev/null
+++ b/example/instrum/init.h
@@ -0,0 +1,19 @@
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef __INSTRUM_INIT_H__
+#define __INSTRUM_INIT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int instr_odpinit_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*__INSTRUM_INIT_H__*/
diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c
index 88580c58f..605675154 100644
--- a/example/instrum/instrum.c
+++ b/example/instrum/instrum.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017, Linaro Limited
+/* Copyright (c) 2018, Linaro Limited
  * All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
@@ -6,13 +6,30 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 static __attribute__((constructor)) void setup_wrappers(void)
 {
printf("Setup Wrappers\n");
+
+   if (instr_store_init())
+   return;
+
+   if (instr_odpinit_init())
+   return;
+
+   if (instr_odpsched_init())
+   return;
+
+   if (instr_odppktio_direct_init())
+

[lng-odp] [PATCH v2 11/11] linux-gen: packet: inline packet input index function

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Inline packet input interface index function which may
be used frequently.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/include/odp/api/plat/packet_inlines.h | 8 
 platform/linux-generic/include/odp/api/plat/packet_inlines_api.h | 5 +
 platform/linux-generic/odp_packet.c  | 5 -
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index dc7d464f2..0704abb2f 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -89,6 +90,13 @@ static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt)
return _odp_pkt_get(pkt, odp_pktio_t, input);
 }
 
+static inline int _odp_packet_input_index(odp_packet_t pkt)
+{
+   odp_pktio_t pktio = _odp_packet_input(pkt);
+
+   return _odp_pktio_index(pktio);
+}
+
 static inline int _odp_packet_num_segs(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint8_t, segcount);
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
index 95adec66f..c451c4d6c 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h
@@ -48,6 +48,11 @@ _ODP_INLINE odp_pktio_t odp_packet_input(odp_packet_t pkt)
return _odp_packet_input(pkt);
 }
 
+_ODP_INLINE int odp_packet_input_index(odp_packet_t pkt)
+{
+   return _odp_packet_input_index(pkt);
+}
+
 _ODP_INLINE int odp_packet_num_segs(odp_packet_t pkt)
 {
return _odp_packet_num_segs(pkt);
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 1909bae25..9c3be1bcc 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1269,11 +1269,6 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t 
offset, uint32_t *len,
  *
  */
 
-int odp_packet_input_index(odp_packet_t pkt)
-{
-   return _odp_pktio_index(packet_hdr(pkt)->input);
-}
-
 void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx)
 {
packet_hdr(pkt)->buf_hdr.buf_cctx = ctx;



[lng-odp] [PATCH v2 7/11] linux-gen: packet: inline conversions between packet and event

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Inline implementation of packet_from_event and packet_to_event
functions.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 include/odp/api/abi-default/buffer.h   |  2 +-
 include/odp/api/abi-default/event.h|  2 +-
 include/odp/api/abi-default/packet.h   |  2 +-
 .../linux-generic/include-abi/odp/api/abi/buffer.h |  2 +-
 .../linux-generic/include-abi/odp/api/abi/event.h  |  2 +-
 .../include/odp/api/plat/packet_inlines.h  | 29 
 .../include/odp/api/plat/packet_inlines_api.h  | 21 +
 platform/linux-generic/odp_packet.c| 51 --
 8 files changed, 63 insertions(+), 48 deletions(-)

diff --git a/include/odp/api/abi-default/buffer.h 
b/include/odp/api/abi-default/buffer.h
index d8bfc9131..980528ba7 100644
--- a/include/odp/api/abi-default/buffer.h
+++ b/include/odp/api/abi-default/buffer.h
@@ -20,7 +20,7 @@ typedef struct { char dummy; /**< @internal Dummy */ } 
_odp_abi_buffer_t;
 
 typedef _odp_abi_buffer_t *odp_buffer_t;
 
-#define ODP_BUFFER_INVALID   ((odp_buffer_t)NULL)
+#define ODP_BUFFER_INVALID   ((odp_buffer_t)0)
 
 /**
  * @}
diff --git a/include/odp/api/abi-default/event.h 
b/include/odp/api/abi-default/event.h
index b52a1a222..0ed6dd094 100644
--- a/include/odp/api/abi-default/event.h
+++ b/include/odp/api/abi-default/event.h
@@ -22,7 +22,7 @@ typedef struct { char dummy; /**< @internal Dummy */ } 
_odp_abi_event_t;
 
 typedef _odp_abi_event_t *odp_event_t;
 
-#define ODP_EVENT_INVALID  ((odp_event_t)NULL)
+#define ODP_EVENT_INVALID  ((odp_event_t)0)
 
 typedef enum odp_event_type_t {
ODP_EVENT_BUFFER   = 1,
diff --git a/include/odp/api/abi-default/packet.h 
b/include/odp/api/abi-default/packet.h
index 15cf081bf..086c4d3bd 100644
--- a/include/odp/api/abi-default/packet.h
+++ b/include/odp/api/abi-default/packet.h
@@ -26,7 +26,7 @@ typedef struct { char dummy; /**< *internal Dummy */ } 
_odp_abi_packet_seg_t;
 typedef _odp_abi_packet_t *odp_packet_t;
 typedef _odp_abi_packet_seg_t *odp_packet_seg_t;
 
-#define ODP_PACKET_INVALID((odp_packet_t)0x)
+#define ODP_PACKET_INVALID((odp_packet_t)0)
 #define ODP_PACKET_SEG_INVALID((odp_packet_seg_t)0x)
 #define ODP_PACKET_OFFSET_INVALID 0x
 
diff --git a/platform/linux-generic/include-abi/odp/api/abi/buffer.h 
b/platform/linux-generic/include-abi/odp/api/abi/buffer.h
index 90b6653a6..879c88afa 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/buffer.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/buffer.h
@@ -26,7 +26,7 @@ extern "C" {
 
 typedef ODP_HANDLE_T(odp_buffer_t);
 
-#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, NULL)
+#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0)
 
 /**
  * @}
diff --git a/platform/linux-generic/include-abi/odp/api/abi/event.h 
b/platform/linux-generic/include-abi/odp/api/abi/event.h
index 802e431f3..49dde956c 100644
--- a/platform/linux-generic/include-abi/odp/api/abi/event.h
+++ b/platform/linux-generic/include-abi/odp/api/abi/event.h
@@ -26,7 +26,7 @@ extern "C" {
 
 typedef ODP_HANDLE_T(odp_event_t);
 
-#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, NULL)
+#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0)
 
 typedef enum odp_event_type_t {
ODP_EVENT_BUFFER   = 1,
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index 4c0f88aa2..dc7d464f2 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -263,6 +263,35 @@ static inline int _odp_packet_copy_to_mem(odp_packet_t 
pkt, uint32_t offset,
return 0;
 }
 
+static inline odp_packet_t _odp_packet_from_event(odp_event_t ev)
+{
+   return (odp_packet_t)ev;
+}
+
+static inline odp_event_t _odp_packet_to_event(odp_packet_t pkt)
+{
+   return (odp_event_t)pkt;
+}
+
+static inline void _odp_packet_from_event_multi(odp_packet_t pkt[],
+   const odp_event_t ev[],
+   int num)
+{
+   int i;
+
+   for (i = 0; i < num; i++)
+   pkt[i] = _odp_packet_from_event(ev[i]);
+}
+
+static inline void _odp_packet_to_event_multi(const odp_packet_t pkt[],
+ odp_event_t ev[], int num)
+{
+   int i;
+
+   for (i = 0; i < num; i++)
+   ev[i] = _odp_packet_to_event(pkt[i]);
+}
+
 /** @endcond */
 
 #endif
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h 
b/platform/linux-generic/include/odp/api

[lng-odp] [PATCH v2 5/11] linux-gen: packet: remove odp_packet_hdr function

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Use only one function (packet_hdr) in handle to header pointer
conversion. odp_packet_hdr is bad name for an implementation
internal function as API function prefix is odp_packet_.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 .../include/odp/api/plat/packet_inlines.h  |  5 -
 .../linux-generic/include/odp_packet_internal.h|  8 
 platform/linux-generic/odp_crypto.c|  4 ++--
 platform/linux-generic/odp_ipsec.c |  8 
 platform/linux-generic/odp_packet.c| 10 +-
 platform/linux-generic/odp_packet_flags.c  | 22 +++---
 platform/linux-generic/odp_packet_io.c |  4 ++--
 platform/linux-generic/pktio/dpdk.c| 12 ++--
 platform/linux-generic/pktio/ipc.c | 14 +++---
 platform/linux-generic/pktio/loop.c|  2 +-
 platform/linux-generic/pktio/netmap.c  |  2 +-
 platform/linux-generic/pktio/pcap.c|  2 +-
 platform/linux-generic/pktio/socket.c  |  2 +-
 platform/linux-generic/pktio/socket_mmap.c |  2 +-
 platform/linux-generic/pktio/tap.c |  2 +-
 15 files changed, 47 insertions(+), 52 deletions(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index 90e205fd4..dee8f71ce 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -228,11 +228,6 @@ static inline void _odp_packet_prefetch(odp_packet_t pkt, 
uint32_t offset,
(void)pkt; (void)offset; (void)len;
 }
 
-static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt)
-{
-   return (odp_buffer_t)pkt;
-}
-
 static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset,
uint32_t len, const void *src)
 {
diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 32e41d7f5..89009a021 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -169,7 +169,7 @@ typedef struct {
 /**
  * Return the packet header
  */
-static inline odp_packet_hdr_t *odp_packet_hdr(odp_packet_t pkt)
+static inline odp_packet_hdr_t *packet_hdr(odp_packet_t pkt)
 {
return (odp_packet_hdr_t *)(uintptr_t)pkt;
 }
@@ -181,7 +181,7 @@ static inline odp_packet_t packet_handle(odp_packet_hdr_t 
*pkt_hdr)
 
 static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt)
 {
-   return &odp_packet_hdr(pkt)->buf_hdr;
+   return &packet_hdr(pkt)->buf_hdr;
 }
 
 static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr)
@@ -201,12 +201,12 @@ static inline seg_entry_t 
*seg_entry_last(odp_packet_hdr_t *hdr)
 
 static inline odp_event_subtype_t packet_subtype(odp_packet_t pkt)
 {
-   return odp_packet_hdr(pkt)->subtype;
+   return packet_hdr(pkt)->subtype;
 }
 
 static inline void packet_subtype_set(odp_packet_t pkt, int ev)
 {
-   odp_packet_hdr(pkt)->subtype = ev;
+   packet_hdr(pkt)->subtype = ev;
 }
 
 /**
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 8ae484fd8..325a9d066 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -1434,7 +1434,7 @@ odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt)
 static
 odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt)
 {
-   odp_packet_hdr_t *hdr = odp_packet_hdr(pkt);
+   odp_packet_hdr_t *hdr = packet_hdr(pkt);
 
return &hdr->crypto_op_result;
 }
@@ -1520,7 +1520,7 @@ int odp_crypto_int(odp_packet_t pkt_in,
(rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) &&
(rc_auth == ODP_CRYPTO_ALG_ERR_NONE);
 
-   pkt_hdr = odp_packet_hdr(out_pkt);
+   pkt_hdr = packet_hdr(out_pkt);
pkt_hdr->p.error_flags.crypto_err = !op_result->ok;
 
/* Synchronous, simply return results */
diff --git a/platform/linux-generic/odp_ipsec.c 
b/platform/linux-generic/odp_ipsec.c
index 521627f1d..586653d4e 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -158,7 +158,7 @@ static odp_ipsec_packet_result_t 
*ipsec_pkt_result(odp_packet_t packet)
ODP_ASSERT(ODP_EVENT_PACKET_IPSEC ==
   odp_event_subtype(odp_packet_to_event(packet)));
 
-   return &odp_packet_hdr(packet)->ipsec_ctx;
+   return &packet_hdr(packet)->ipsec_ctx;
 }
 
 static inline int _odp_ipv4_csum(odp_packet_t pkt,

[lng-odp] [PATCH v2 6/11] linux-gen: packet: implement packet prefetch

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

For minimal code complexity and negative impact, prefetch
only when the requested address is in the first segment and
prefetch only one cache line.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/include/odp/api/plat/packet_inlines.h | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index dee8f71ce..4c0f88aa2 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -225,7 +225,14 @@ static inline odp_packet_seg_t 
_odp_packet_next_seg(odp_packet_t pkt,
 static inline void _odp_packet_prefetch(odp_packet_t pkt, uint32_t offset,
uint32_t len)
 {
-   (void)pkt; (void)offset; (void)len;
+   uint32_t seg_len = _odp_packet_seg_len(pkt);
+   uint8_t *data= (uint8_t *)_odp_packet_data(pkt);
+   (void)len;
+
+   if (odp_unlikely(offset >= seg_len))
+   return;
+
+   odp_prefetch(data + offset);
 }
 
 static inline int _odp_packet_copy_from_mem(odp_packet_t pkt, uint32_t offset,



[lng-odp] [PATCH v2 2/11] linux-gen: packet: remove dummy doxygen documentation

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Use @cond tag to hide internal functions from Doxygen.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 .../include/odp/api/plat/packet_inlines.h  | 39 +++---
 1 file changed, 5 insertions(+), 34 deletions(-)

diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h 
b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
index fb9c524fb..765bafb4f 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h
@@ -23,63 +23,52 @@
 #include 
 #include 
 
-/** @internal Inline function @param pkt_ptr @param offset @param seg_len
- *  @param seg_idx @return */
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
 void *_odp_packet_map(void *pkt_ptr, uint32_t offset, uint32_t *seg_len,
  int *seg_idx);
 
-/** @internal Inline function offsets */
 extern const _odp_packet_inline_offset_t _odp_packet_inline;
-
-/** @internal Pool inline function offsets */
-extern const _odp_pool_inline_offset_t _odp_pool_inline;
+extern const _odp_pool_inline_offset_t   _odp_pool_inline;
 
 #ifndef _ODP_HAVE_PACKET_SEG_NDX
 #include 
-/** @internal Inline function @param seg @return */
 static inline uint32_t _odp_packet_seg_to_ndx(odp_packet_seg_t seg)
 {
return _odp_typeval(seg);
 }
 
-/** @internal Inline function @param ndx @return */
 static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint32_t ndx)
 {
return _odp_cast_scalar(odp_packet_seg_t, ndx);
 }
 #endif
 
-/** @internal Inline function @param pkt @return */
 static inline void *_odp_packet_data(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, void *, data);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_seg_len(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint32_t, seg_len);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_len(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint32_t, frame_len);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_headroom(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint16_t, headroom);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_tailroom(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint16_t, tailroom);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt)
 {
void *pool = _odp_pkt_get(pkt, void *, pool);
@@ -87,31 +76,26 @@ static inline odp_pool_t _odp_packet_pool(odp_packet_t pkt)
return _odp_pool_get(pool, odp_pool_t, pool_hdl);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline odp_pktio_t _odp_packet_input(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, odp_pktio_t, input);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline int _odp_packet_num_segs(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint8_t, segcount);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline void *_odp_packet_user_ptr(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, void *, user_ptr);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline void *_odp_packet_user_area(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, void *, user_area);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_user_area_size(odp_packet_t pkt)
 {
void *pool = _odp_pkt_get(pkt, void *, pool);
@@ -119,25 +103,21 @@ static inline uint32_t 
_odp_packet_user_area_size(odp_packet_t pkt)
return _odp_pool_get(pool, uint32_t, uarea_size);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_l2_offset(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint16_t, l2_offset);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_l3_offset(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint16_t, l3_offset);
 }
 
-/** @internal Inline function @param pkt @return */
 static inline uint32_t _odp_packet_l4_offset(odp_packet_t pkt)
 {
return _odp_pkt_get(pkt, uint16_t, l4_offset);
 }
 
-/** @internal Inline function @param pkt @param len @return */
 static inline void *_odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len)
 {
uint32_t offset  = _odp_packet_l2_offset(pkt);
@@ -156,7 +136,6 @@ static inline void *_odp_packet_l2_ptr(odp_packet_t pkt, 
uint32_t *len)
return data + offset;
 }
 
-/** @internal Inline function @param pkt @param len @return */
 static inline void *_odp_pac

[lng-odp] [PATCH v2 0/11] Packet function inlines

2018-01-31 Thread Github ODP bot
Continue inlining of commonly used small packet and pktio API functions. These 
improve few percents  packet rate of L2fwd (both direct/scheduled mode) and OFP 
burst test. Especially, in non-ABI compat mode and with copying pktios (test 
with DPDK).

github
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 47 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 199 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 177 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 163 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 343 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 15 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 163 lines checked


to_send-p-006.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 31 lines checked


to_send-p-007.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 18 lines checked


to_send-p-008.patch has no obvious style problems and is ready for submission.
ERROR: Macros with complex values should be enclosed in parentheses
#60: FILE: platform/linux-generic/include-abi/odp/api/abi/packet_io.h:54:
+#define _ODP_INLINE static inline

WARNING: storage class should be at the beginning of the declaration
#60: FILE: platform/linux-generic/include-abi/odp/api/abi/packet_io.h:54:
+#define _ODP_INLINE static inline

total: 1 errors, 1 warnings, 0 checks, 193 lines checked


to_send-p-009.patch has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 0 checks, 42 lines checked


to_send-p-010.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v2 1/11] linux-gen: packet: use inlined flow hash and ts set

2018-01-31 Thread Github ODP bot
From: Petri Savolainen 

Use inlined version of flow hash set function. Also changed API
to use inlined timestamp function, so that the same function is
not implemented twice.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 437 (psavol:master-packet-optim)
 ** https://github.com/Linaro/odp/pull/437
 ** Patch: https://github.com/Linaro/odp/pull/437.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 3c2134ecc18e4fd52cd526b5c067815ca73864cc
 **/
 platform/linux-generic/include/odp_packet_internal.h | 7 +++
 platform/linux-generic/odp_packet.c  | 6 ++
 platform/linux-generic/pktio/dpdk.c  | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 01e0cae17..32e41d7f5 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -331,6 +331,13 @@ static inline int packet_hdr_has_ipv6(odp_packet_hdr_t 
*pkt_hdr)
return pkt_hdr->p.input_flags.ipv6;
 }
 
+static inline void packet_set_flow_hash(odp_packet_hdr_t *pkt_hdr,
+   uint32_t flow_hash)
+{
+   pkt_hdr->flow_hash = flow_hash;
+   pkt_hdr->p.input_flags.flow_hash = 1;
+}
+
 static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, odp_time_t *ts)
 {
if (ts != NULL) {
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index a4cd05f62..8d6185987 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1352,16 +1352,14 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, 
uint32_t flow_hash)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->flow_hash = flow_hash;
-   pkt_hdr->p.input_flags.flow_hash = 1;
+   packet_set_flow_hash(pkt_hdr, flow_hash);
 }
 
 void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->timestamp = timestamp;
-   pkt_hdr->p.input_flags.timestamp = 1;
+   packet_set_ts(pkt_hdr, ×tamp);
 }
 
 /*
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 6fd4b1924..4ae72e10a 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -483,7 +483,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
   pktio_entry->s.config.parser.layer);
 
if (mbuf->ol_flags & PKT_RX_RSS_HASH)
-   odp_packet_flow_hash_set(pkt, mbuf->hash.rss);
+   packet_set_flow_hash(pkt_hdr, mbuf->hash.rss);
 
packet_set_ts(pkt_hdr, ts);
 
@@ -723,7 +723,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t 
*pktio_entry,
   pktio_entry->s.config.parser.layer);
 
if (mbuf->ol_flags & PKT_RX_RSS_HASH)
-   odp_packet_flow_hash_set(pkt, mbuf->hash.rss);
+   packet_set_flow_hash(pkt_hdr, mbuf->hash.rss);
 
packet_set_ts(pkt_hdr, ts);
 



[lng-odp] [PATCH v1 5/6] configure: move pthreads check to properly defined macro

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 m4/odp_pthread.m4| 7 +++
 platform/linux-generic/m4/configure.m4   | 2 +-
 platform/linux-generic/m4/odp_pthread.m4 | 8 
 3 files changed, 8 insertions(+), 9 deletions(-)
 create mode 100644 m4/odp_pthread.m4
 delete mode 100644 platform/linux-generic/m4/odp_pthread.m4

diff --git a/m4/odp_pthread.m4 b/m4/odp_pthread.m4
new file mode 100644
index 0..f2654ac4e
--- /dev/null
+++ b/m4/odp_pthread.m4
@@ -0,0 +1,7 @@
+# ODP_PTHREAD
+# ---
+# Check for pthreads availability
+AC_DEFUN([ODP_PTHREAD], [dnl
+AX_PTHREAD([CC="$PTHREAD_CC"],
+  [AC_MSG_FAILURE([We require pthreads to be available])])
+])
diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index 08ea1a338..7fa3652e2 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -3,7 +3,7 @@ IMPLEMENTATION_NAME="odp-linux"
 ODP_VISIBILITY
 ODP_ATOMIC
 
-m4_include([platform/linux-generic/m4/odp_pthread.m4])
+ODP_PTHREAD
 ODP_TIMER
 ODP_OPENSSL
 m4_include([platform/linux-generic/m4/odp_pcap.m4])
diff --git a/platform/linux-generic/m4/odp_pthread.m4 
b/platform/linux-generic/m4/odp_pthread.m4
deleted file mode 100644
index 486158942..0
--- a/platform/linux-generic/m4/odp_pthread.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-##
-# Check for pthreads availability
-##
-
-AX_PTHREAD([CC="$PTHREAD_CC"], [
-echo "Error! We require pthreads to be available"
-exit -1
-])



[lng-odp] [PATCH v1 4/6] configure: add ODP_CHECK_CXXFLAG

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 configure.ac |  1 +
 m4/odp_check_flag.m4 | 18 --
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 01fdc5a8c..7b90b2127 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,7 @@ CC_VERSION_PATCH=$(echo $CC_VERSION | cut -d'.' -f3)
 # Default warning setup
 ##
 ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror"
+ODP_CXXFLAGS="$ODP_CXXFLAGS -W -Wall -Werror"
 
 ODP_CHECK_CFLAG([-Wstrict-prototypes])
 ODP_CHECK_CFLAG([-Wmissing-prototypes])
diff --git a/m4/odp_check_flag.m4 b/m4/odp_check_flag.m4
index e3c8ef714..827f9f011 100644
--- a/m4/odp_check_flag.m4
+++ b/m4/odp_check_flag.m4
@@ -5,8 +5,22 @@ dnl an error when it encounters an unknown warning option.
 # -
 # Add FLAG to ODP_CFLAGS if compiler supports that option
 AC_DEFUN([ODP_CHECK_CFLAG],
-[AX_CHECK_COMPILE_FLAG([$1],
+[AC_LANG_PUSH([C])
+ AX_CHECK_COMPILE_FLAG([$1],
[ODP_CFLAGS="$ODP_CFLAGS $1"],
[], [-W -Wall -Werror],
[AC_LANG_SOURCE([int main(void)
-   {return 0;}])])])
+   {return 0;}])])
+ AC_LANG_POP([C])])
+
+# ODP_CHECK_CXXFLAG(FLAG)
+# -
+# Add FLAG to ODP_CFLAGS if compiler supports that option
+AC_DEFUN([ODP_CHECK_CXXFLAG],
+[AC_LANG_PUSH([C++])
+ AX_CHECK_COMPILE_FLAG([$1],
+   [ODP_CXXFLAGS="$ODP_CXXFLAGS $1"],
+   [], [-W -Wall -Werror],
+   [AC_LANG_SOURCE([int main(void)
+   {return 0;}])])
+ AC_LANG_POP([C++])])



[lng-odp] [PATCH v4 1/1] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

gcc-built DPDK is not fully compatible with clang (see
https://travis-ci.org/lumag/odp/jobs/335324053 for example). Use clang
to compile DPDK if selected compiler is clang.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 439 (lumag:dpdk-clang)
 ** https://github.com/Linaro/odp/pull/439
 ** Patch: https://github.com/Linaro/odp/pull/439.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: ee6b84c69a8604de3ee075fcc551ca6df617035e
 **/
 .travis.yml | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b7d6cd415..87f290092 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -100,9 +100,10 @@ before_install:
 then
 DPDK_CFLAGS="-m32" ;
 else
-DPDK_CROSS="$CROSS_GNU_TYPE-" ;
+DPDK_CFLAGS="--target=$CROSS_GNU_TYPE" ;
 fi
 fi ;
+DPDK_CROSS="$CROSS_GNU_TYPE-" ;
 export CXX="${CC/clang/clang++}";
   elif [ "$CROSS_ARCH" = "i386" ] ;
   then
@@ -161,30 +162,36 @@ install:
 - |
   case "$CROSS_ARCH" in
 "arm64")
-  DPDK_TARGET="arm64-armv8a-linuxapp-gcc"
+  DPDK_TARGET="arm64-armv8a-linuxapp-"
   ;;
 "armhf")
-  DPDK_TARGET="arm-armv7a-linuxapp-gcc"
+  DPDK_TARGET="arm-armv7a-linuxapp-"
   ;;
 "i386")
-  DPDK_TARGET="i686-native-linuxapp-gcc"
+  DPDK_TARGET="i686-native-linuxapp-"
   ;;
 "")
-  DPDK_TARGET="x86_64-native-linuxapp-gcc"
+  DPDK_TARGET="x86_64-native-linuxapp-"
   DPDK_MACHINE=snb
   ;;
   esac
 - |
   if [ -n "$DPDK_TARGET" ] ; then
+   if [ "${CC#clang}" != "${CC}" ] ; then
+DPDKCC=clang ;
+   else
+DPDKCC=gcc ;
+   fi
if [ -n "$DPDK_SHARED" ] ; then
-TARGET="$DPDK_TARGET"-shared
+TARGET="${DPDK_TARGET}$DPDKCC"-shared
 LIBDPDKEXT=so
 export LD_LIBRARY_PATH="`pwd`/${TARGET}:$LD_LIBRARY_PATH"
 echo $LD_LIBRARY_PATH
else
-TARGET="$DPDK_TARGET"
+TARGET="${DPDK_TARGET}$DPDKCC"
 LIBDPDKEXT=a
fi
+   DPDK_TARGET="${DPDK_TARGET}gcc"
if [ ! -f "dpdk/${TARGET}/lib/libdpdk.$LIBDPDKEXT" ]; then
 git -c advice.detachedHead=false clone -q --depth=1 
--single-branch --branch=v${DPDK_VERS} http://dpdk.org/git/dpdk dpdk
 pushd dpdk
@@ -193,6 +200,7 @@ install:
 sed -i -e 's/40900/40800/g' 
lib/librte_eal/common/include/arch/arm/rte_vect.h
 sed -i -e 's/!(/!(defined(__arm__) \&\& defined(__clang__) || /g' 
lib/librte_eal/common/include/arch/arm/rte_byteorder.h
 sed -i -e 's/__GNUC__/defined(__arm__) \&\& defined(__clang__) || 
__GNUC__/' lib/librte_eal/common/include/generic/rte_byteorder.h
+sed -i -e 's,\$(CC),\0 $(EXTRA_CFLAGS),g' lib/librte_acl/Makefile
 make config T=${DPDK_TARGET} O=${TARGET}
 pushd ${TARGET}
 sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
@@ -206,8 +214,11 @@ install:
   sed -ri -e 's,(CONFIG_RTE_EAL_IGB_UIO=).*,\1n,' .config
   sed -ri -e 's,(CONFIG_RTE_KNI_KMOD=).*,\1n,' .config
 fi
+sed -ri -e 's,(CONFIG_RTE_TOOLCHAIN=).*,\1"'${DPDKCC}'",' .config
+sed -ri -e '/CONFIG_RTE_TOOLCHAIN_.*/d' .config
+echo CONFIG_RTE_TOOLCHAIN_${DPDKCC^^}=y >> .config
 popd
-make build T=${DPDK_TARGET} O=${TARGET} EXTRA_CFLAGS="-fPIC 
$DPDK_CFLAGS" CROSS="$DPDK_CROSS" -j $(nproc)
+make build O=${TARGET} EXTRA_CFLAGS="-fPIC $DPDK_CFLAGS" 
CROSS="$DPDK_CROSS" CC="$CC" HOSTCC=gcc -j $(nproc)
 rm -r ./doc ./${TARGET}/app ./${TARGET}/build
 popd
fi



[lng-odp] [PATCH v4 0/1] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
gcc-built DPDK is not fully compatible with clang (see
https://travis-ci.org/lumag/odp/jobs/335324053 for example). Use clang
to compile DPDK if selected compiler is clang.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsoleni...@linaro.org

github
/** Email created from pull request 439 (lumag:dpdk-clang)
 ** https://github.com/Linaro/odp/pull/439
 ** Patch: https://github.com/Linaro/odp/pull/439.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: ee6b84c69a8604de3ee075fcc551ca6df617035e
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 72 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH v1 6/6] doc: move platform-specific doc distribution to platform/Makefile.inc

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

${with_platform} in doc/platform-api-guide/Makefile.am will add to
distro platform docs only for currently selected platform. Move this to
platform/Makefile.inc, so that every platform doc file gets included
into distro.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 doc/platform-api-guide/Makefile.am | 3 +--
 platform/Makefile.inc  | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/platform-api-guide/Makefile.am 
b/doc/platform-api-guide/Makefile.am
index 27cd902ee..d1b1b0dce 100644
--- a/doc/platform-api-guide/Makefile.am
+++ b/doc/platform-api-guide/Makefile.am
@@ -3,8 +3,7 @@
 #distribution.
 
 EXTRA_DIST = \
-Doxyfile \
-$(top_srcdir)/platform/${with_platform}/doc/*.dox
+Doxyfile
 
 
 clean-local:
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 4714de0ee..410204bfd 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -12,3 +12,5 @@ AM_CFLAGS = "-DGIT_HASH=$(VERSION)"
 AM_CFLAGS += $(VISIBILITY_CFLAGS)
 
 AM_CFLAGS += @PTHREAD_CFLAGS@
+
+EXTRA_DIST = doc/platform_specific.dox



[lng-odp] [PATCH v1 3/6] configure: set ODP_CFLAGS/CXXFLAGS before descending into platform

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

platform m4/configure.m4 file might want to change compiler flags. So let's
set them before calling into platform file.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 configure.ac | 74 ++--
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/configure.ac b/configure.ac
index 03a233d17..01fdc5a8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,43 @@ CC_VERSION_MAJOR=$(echo $CC_VERSION | cut -d'.' -f1)
 CC_VERSION_MINOR=$(echo $CC_VERSION | cut -d'.' -f2)
 CC_VERSION_PATCH=$(echo $CC_VERSION | cut -d'.' -f3)
 
+##
+# Default warning setup
+##
+ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror"
+
+ODP_CHECK_CFLAG([-Wstrict-prototypes])
+ODP_CHECK_CFLAG([-Wmissing-prototypes])
+ODP_CHECK_CFLAG([-Wmissing-declarations])
+ODP_CHECK_CFLAG([-Wold-style-definition])
+ODP_CHECK_CFLAG([-Wpointer-arith])
+ODP_CHECK_CFLAG([-Wcast-align])
+ODP_CHECK_CFLAG([-Wnested-externs])
+ODP_CHECK_CFLAG([-Wcast-qual])
+ODP_CHECK_CFLAG([-Wformat-nonliteral])
+ODP_CHECK_CFLAG([-Wformat-security])
+ODP_CHECK_CFLAG([-Wundef])
+ODP_CHECK_CFLAG([-Wwrite-strings])
+ODP_CHECK_CFLAG([-Wformat-truncation=0])
+ODP_CHECK_CFLAG([-Wformat-overflow=0])
+
+ODP_CFLAGS="$ODP_CFLAGS -std=c99"
+ODP_CXXFLAGS="$ODP_CXXFLAGS -std=c++11"
+
+# Extra flags for example to suppress certain warning types
+ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA"
+
+##
+# Check if compiler supports cmpxchng16 on x86-based architectures
+##
+case "${host}" in
+  i?86? | x86*)
+  if test "${CC}" != "gcc" -o ${CC_VERSION_MAJOR} -ge 5; then
+ ODP_CHECK_CFLAG([-mcx16])
+  fi
+  ;;
+esac
+
 ##
 # Allow valgrind suite to run against the defined tests
 ##
@@ -310,43 +347,6 @@ AC_ARG_ENABLE([deprecated],
 fi])
 AC_SUBST(ODP_DEPRECATED_API)
 
-##
-# Default warning setup
-##
-ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror"
-
-ODP_CHECK_CFLAG([-Wstrict-prototypes])
-ODP_CHECK_CFLAG([-Wmissing-prototypes])
-ODP_CHECK_CFLAG([-Wmissing-declarations])
-ODP_CHECK_CFLAG([-Wold-style-definition])
-ODP_CHECK_CFLAG([-Wpointer-arith])
-ODP_CHECK_CFLAG([-Wcast-align])
-ODP_CHECK_CFLAG([-Wnested-externs])
-ODP_CHECK_CFLAG([-Wcast-qual])
-ODP_CHECK_CFLAG([-Wformat-nonliteral])
-ODP_CHECK_CFLAG([-Wformat-security])
-ODP_CHECK_CFLAG([-Wundef])
-ODP_CHECK_CFLAG([-Wwrite-strings])
-ODP_CHECK_CFLAG([-Wformat-truncation=0])
-ODP_CHECK_CFLAG([-Wformat-overflow=0])
-
-ODP_CFLAGS="$ODP_CFLAGS -std=c99"
-ODP_CXXFLAGS="$ODP_CXXFLAGS -std=c++11"
-
-# Extra flags for example to suppress certain warning types
-ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA"
-
-##
-# Check if compiler supports cmpxchng16 on x86-based architectures
-##
-case "${host}" in
-  i?86? | x86*)
-  if test "${CC}" != "gcc" -o ${CC_VERSION_MAJOR} -ge 5; then
- ODP_CHECK_CFLAG([-mcx16])
-  fi
-  ;;
-esac
-
 ##
 # Default include setup
 ##



[lng-odp] [PATCH v1 2/6] configure: move ODP_CHECK_CFLAG to separate file

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 configure.ac |  8 
 m4/odp_check_flag.m4 | 12 
 2 files changed, 12 insertions(+), 8 deletions(-)
 create mode 100644 m4/odp_check_flag.m4

diff --git a/configure.ac b/configure.ac
index 1edc01f4e..03a233d17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,14 +315,6 @@ AC_SUBST(ODP_DEPRECATED_API)
 ##
 ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror"
 
-dnl Use -Werror in the checks below since Clang emits a warning instead of
-dnl an error when it encounters an unknown warning option.
-AC_DEFUN([ODP_CHECK_CFLAG],
-[AX_CHECK_COMPILE_FLAG([$1],
-   [ODP_CFLAGS="$ODP_CFLAGS $1"],
-   [], [-W -Wall -Werror],
-   [AC_LANG_SOURCE([int main(void)
-   {return 0;}])])])
 ODP_CHECK_CFLAG([-Wstrict-prototypes])
 ODP_CHECK_CFLAG([-Wmissing-prototypes])
 ODP_CHECK_CFLAG([-Wmissing-declarations])
diff --git a/m4/odp_check_flag.m4 b/m4/odp_check_flag.m4
new file mode 100644
index 0..e3c8ef714
--- /dev/null
+++ b/m4/odp_check_flag.m4
@@ -0,0 +1,12 @@
+dnl Use -Werror in the checks below since Clang emits a warning instead of
+dnl an error when it encounters an unknown warning option.
+
+# ODP_CHECK_CFLAG(FLAG)
+# -
+# Add FLAG to ODP_CFLAGS if compiler supports that option
+AC_DEFUN([ODP_CHECK_CFLAG],
+[AX_CHECK_COMPILE_FLAG([$1],
+   [ODP_CFLAGS="$ODP_CFLAGS $1"],
+   [], [-W -Wall -Werror],
+   [AC_LANG_SOURCE([int main(void)
+   {return 0;}])])])



[lng-odp] [PATCH v1 1/6] configure: set ODP_ABI_COMPAT before descending into platform

2018-01-31 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

platform m4/configure.m4 file can make use of ODP_ABI_COMPAT. So let's
set it before calling into platform file.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
 configure.ac | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d76bead8..1edc01f4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,6 +160,21 @@ fi
 PKGCONFIG_VERSION=$(echo $VERSION | awk -F '.git' '{print $1}')
 AC_SUBST(PKGCONFIG_VERSION)
 
+##
+# Enable/disable ABI compatible build
+##
+ODP_ABI_COMPAT=1
+abi_compat=yes
+AC_ARG_ENABLE([abi-compat],
+[  --disable-abi-compatdisables ABI compatible mode, enables inline 
code in header files],
+[if test "x$enableval" = "xno"; then
+   ODP_ABI_COMPAT=0
+   abi_compat=no
+   #if there is no ABI compatibility the .so numbers are meaningless
+   ODP_LIBSO_VERSION=0:0:0
+fi])
+AM_CONDITIONAL(ODP_ABI_COMPAT, [test "x$ODP_ABI_COMPAT" = "x1"])
+
 ##
 # Determine which platform to build for
 ##
@@ -282,21 +297,6 @@ AS_IF([test "x$enable_helper_debug_print" != "xno"], 
[ODPH_DEBUG_PRINT=1],
 AC_DEFINE_UNQUOTED([ODPH_DEBUG_PRINT], [$ODPH_DEBUG_PRINT],
   [Define to 1 to display helper debug information])
 
-##
-# Enable/disable ABI compatible build
-##
-ODP_ABI_COMPAT=1
-abi_compat=yes
-AC_ARG_ENABLE([abi-compat],
-[  --disable-abi-compatdisables ABI compatible mode, enables inline 
code in header files],
-[if test "x$enableval" = "xno"; then
-   ODP_ABI_COMPAT=0
-   abi_compat=no
-   #if there is no ABI compatibility the .so numbers are meaningless
-   ODP_LIBSO_VERSION=0:0:0
-fi])
-AM_CONDITIONAL(ODP_ABI_COMPAT, [test "x$ODP_ABI_COMPAT" = "x1"])
-
 ##
 # Enable/disable deprecated API definitions
 ##



[lng-odp] [PATCH v1 0/6] Several build system fixes

2018-01-31 Thread Github ODP bot
Few updates to make implementation life easier.

github
/** Email created from pull request 440 (lumag:build-fixes)
 ** https://github.com/Linaro/odp/pull/440
 ** Patch: https://github.com/Linaro/odp/pull/440.patch
 ** Base sha: b95ccd3db6eeb7358a877541747e06354429acdd
 ** Merge commit sha: 6f20299f993632a4dda987a31b37160d80c25279
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 42 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 26 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 86 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 31 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 15 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 14 lines checked


to_send-p-005.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


Re: [lng-odp] [PATCH v3] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

.travis.yml
line 60
@@ -193,6 +200,7 @@ install:
 sed -i -e 's/40900/40800/g' 
lib/librte_eal/common/include/arch/arm/rte_vect.h
 sed -i -e 's/!(/!(defined(__arm__) \&\& defined(__clang__) || /g' 
lib/librte_eal/common/include/arch/arm/rte_byteorder.h
 sed -i -e 's/__GNUC__/defined(__arm__) \&\& defined(__clang__) || 
__GNUC__/' lib/librte_eal/common/include/generic/rte_byteorder.h
+sed -i -e 's,\$(CC),\0 $(EXTRA_CFLAGS),g' lib/librte_acl/Makefile


Comment:
I know nothing about contributing to DPDK. Also what is the chance of fixing 
old DPDK releases (which we use)?

> Dmitry Eremin-Solenikov(lumag) wrote:
> It is used to:
>  - set DPDK target directory (`...-clang` vs `...-gcc`)
>  - set DPDK configuration items based on the toolchain selected


>> muvarov wrote
>> should this go to dpdk instead of odp?


>>> muvarov wrote
>>> why do we need this and not just $CC ?


https://github.com/Linaro/odp/pull/439#discussion_r165025116
updated_at 2018-01-31 11:29:48


Re: [lng-odp] [PATCH v3] travis: build DPDK with clang if it was selected

2018-01-31 Thread Github ODP bot
Dmitry Eremin-Solenikov(lumag) replied on github web page:

.travis.yml
line 15
@@ -158,33 +158,40 @@ install:
   if [ "${CACHED_DPDK_VERS}" != "${DPDK_VERS}" ]; then
 rm -rf dpdk
   fi
+- if [ "${CC#clang}" != "${CC}" ] ;
+  then
+DPDKCC=clang ;


Comment:
It is used to:
 - set DPDK target directory (`...-clang` vs `...-gcc`)
 - set DPDK configuration items based on the toolchain selected

> muvarov wrote
> should this go to dpdk instead of odp?


>> muvarov wrote
>> why do we need this and not just $CC ?


https://github.com/Linaro/odp/pull/439#discussion_r165025027
updated_at 2018-01-31 11:29:12


Re: [lng-odp] [PATCH CATERPILLAR v1] [RFC] odp: pktio: added tcpdump like functionality

2018-01-31 Thread Github ODP bot
Ilias Apalodimas(apalos) replied on github web page:

platform/linux-generic/odp_packet_io.c
line 237
@@ -89,6 +96,274 @@ int odp_pktio_init_local(void)
return odp_pktio_ops_init_local(true);
 }
 
+static int write_pcapng_hdr(pktio_entry_t *entry, int qidx)
+{
+   size_t len;
+   pcapng_section_hdr_block_t shb;
+   pcapng_interface_description_block_s idb;
+   int fd = entry->s.pcapng_info.pcapng_fd[qidx];
+
+   memset(&shb, 0, sizeof(shb));
+   memset(&idb, 0, sizeof(idb));
+
+   shb.block_type = PCAPNG_BLOCK_TYPE_SHB;
+   shb.block_total_length = sizeof(shb);
+   shb.block_total_length2 = sizeof(shb);
+   shb.magic = PCAPNG_ENDIAN_MAGIC;
+   shb.version_major = 0x1;
+   shb.version_minor = 0x0;
+   shb.section_len = -1;
+
+   len = write(fd, &shb, sizeof(shb));
+   fsync(fd);
+   /* fail to write shb/idb means the pcapng is unreadable */
+   if (!len) {
+   ODP_ERR("Failed to write pcapng section hdr\n");
+   close(fd);
+   return -1;
+   }
+
+   idb.block_type = PCAPNG_BLOCK_TYPE_IDB;
+   idb.block_total_length = sizeof(idb);
+   idb.block_total_length2 = sizeof(idb);
+   idb.linktype = 0x1; /* LINKTYPE_ETHERNET */
+   idb.snaplen = 0x0; /* unlimited */
+   len = write(fd, &idb, sizeof(idb));
+   if (!len) {
+   ODP_ERR("Failed to write pcapng interface description\n");
+   close(fd);
+   return -1;
+   }
+   fsync(fd);
+
+   entry->s.pcapng_info.state[qidx] = PCAPNG_WR_HDR;
+
+   return 0;
+}
+
+static int write_pcapng_pkts(pktio_entry_t *entry, int qidx,
+const odp_packet_t packets[], int num)
+{
+   int i = 0;
+   struct iovec packet_iov[3 * num];
+   pcapng_enhanced_packet_block_t epb;
+   int iovcnt = 0;
+   ssize_t len = 0;
+   int fd = entry->s.pcapng_info.pcapng_fd[qidx];
+
+   for (i = 0; i < num; i++) {
+   odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(packets[i]);
+   uint32_t pkt_len = _odp_packet_len(packets[i]);
+   char *buf = (char *)odp_packet_data(packets[i]);
+
+   epb.block_type = PCAPNG_BLOCK_TYPE_EPB;
+   epb.block_total_length = sizeof(epb) +
+   ROUNDUP_ALIGN(pkt_len, PCAP_DATA_ALIGN) +
+   PCAP_DATA_ALIGN;
+   epb.interface_idx = 0;
+   epb.timestamp_high = (uint32_t)(pkt_hdr->timestamp.u64 >> 32);
+   epb.timestamp_low = (uint32_t)(pkt_hdr->timestamp.u64);
+   epb.captured_len = pkt_len;
+   epb.packet_len = pkt_len;
+
+   /* epb */
+   packet_iov[iovcnt].iov_base = &epb;
+   packet_iov[iovcnt].iov_len = sizeof(epb);
+   iovcnt++;
+
+   /* data */
+   packet_iov[iovcnt].iov_base = buf;
+   packet_iov[iovcnt].iov_len =
+   ROUNDUP_ALIGN(pkt_len, PCAP_DATA_ALIGN);
+   iovcnt++;
+
+   /* trailing */
+   packet_iov[iovcnt].iov_base = &epb.block_total_length;
+   packet_iov[iovcnt].iov_len = sizeof(uint32_t);
+   iovcnt++;
+   }
+
+   /* we don't really care if we manage to write *all* data */
+   len = writev(fd, packet_iov, iovcnt);
+   if (!len)
+   ODP_ERR("Failed to write pcapng data\n");
+   fsync(fd);
+
+   return len;
+}
+
+static void pcapng_drain_fifo(int fd)
+{
+   char c;
+   ssize_t len;
+
+   do {
+   len = read(fd, &c, sizeof(c));
+   } while (len > 0 && len != -1);
+   ODP_DBG("Drain pcap fifo %d\n", len);
+}
+
+static void *inotify_update(void *arg)
+{
+   pktio_entry_t *entry = (pktio_entry_t *)arg;
+   struct timeval time;
+   int ret;
+   ssize_t rdlen;
+   int i;
+   char buffer[INOTIFY_BUF_LEN];
+   unsigned int max_queue =
+   MAX(entry->s.num_in_queue, entry->s.num_out_queue);
+   fd_set rfds;
+
+   while (1) {
+   i = 0;
+   FD_ZERO(&rfds);
+   FD_SET(entry->s.pcapng_info.inotify_pcapng_fd, &rfds);
+   time.tv_sec = 2;
+   time.tv_usec = 0;
+   select(entry->s.pcapng_info.inotify_pcapng_fd + 1, &rfds, NULL,
+  NULL, &time);
+   if (FD_ISSET(entry->s.pcapng_info.inotify_pcapng_fd, &rfds)) {
+   rdlen = read(entry->s.pcapng_info.inotify_pcapng_fd,
+buffer, INOTIFY_BUF_LEN);
+   while (i < rdlen) {
+   char *e;
+   unsigned int qidx;
+   struct inotify_event *event =
+   (struct inotify_event *)(void *)
+&buffer[i];
+
+   e 

Re: [lng-odp] [PATCH CATERPILLAR v3] Code instrumentation with PAPI library

2018-01-31 Thread Github ODP bot
bogdanPricope replied on github web page:

example/m4/configure.m4
line 18
@@ -7,6 +7,16 @@ AC_ARG_ENABLE([test-example],
 [test_example=yes])
 AM_CONDITIONAL([test_example], [test x$test_example = xyes ])
 
+PAPI_PATH=""
+code_instrumentation=no
+AC_ARG_WITH([papi-path],
+AS_HELP_STRING([--with-papi-path=DIR   path to papi install directory]),
+[PAPI_PATH="$withval"
+code_instrumentation=yes],[])
+
+AC_SUBST([PAPI_PATH])
+AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ])


Comment:
Ok.

> bogdanPricope wrote
> I am expecting to have more config time options in the future (symbols 
> visibility, etc.) that will affect building of  generic library code. 


>> bogdanPricope wrote
>> Don't know. I was not able to get it for my Ubuntu. You should get something 
>> like 'libpfm4 libpapi5.4 libpapi-dev' or newer.
>> Also, you get different PAPI versions for different releases and don't know 
>> if they have backward compats.
>> 
>> The Bionic Beaver (active development) papi trunk series
>>   5.6.0-1release (universe)  2018-01-26
>> The Artful Aardvark (current stable release) papi trunk series
>>   5.5.1-2release (universe)  2017-05-09
>> The Xenial Xerus (supported) papi trunk series
>>   5.4.3-2release (universe)  2016-04-19
>> The Trusty Tahr (supported)
>>   5.3.0-3release (universe)  2014-02-05


>>> bogdanPricope wrote
>>> I kind of expected to have *.h in noinst_HEADERS and *.c in _SOURCES.


 bogdanPricope wrote
 No need at this point (can be done at master ->caterpillar merge time). 
 Most likely, #390 will get into Caterpillar before this PR. 


> bogdanPricope wrote
> Yes, '--with-papi' will be added.


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> As we are not enabling instrumentation in generic library code, maybe 
>> this text should go to example/instrum/README with a note here that we 
>> support PAPI instrumentation?


>>> Dmitry Eremin-Solenikov(lumag) wrote:
>>> Isn't apt-get install libpapi-dev / yum install / etc. enough?


 Dmitry Eremin-Solenikov(lumag) wrote:
 Are these headers used by anybody else? If not, you can just add them 
 to _SOURCES. Also there is no need to specify $(srcdir) here.


> Dmitry Eremin-Solenikov(lumag) wrote:
> I suggest to pick up dynamic-examples-tests PR into your branch and 
> then base this code on top.


>> Dmitry Eremin-Solenikov(lumag) wrote:
>> Could you please support bare --with-papi, so that one can use 
>> system-provided PAPI?


>>> bogdanPricope wrote
>>> In 'example/m4/configure.m4' there is this conditional:
>>> AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes])
>>> 
>>> It is defined if PAPI path is set at configure time: 
>>> --with-papi-path=DIR
>>> We have similar arrangements for different  pktios  (netmap, etc)


 Bill Fischofer(Bill-Fischofer-Linaro) wrote:
 How does this get enabled/tested?


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> The PAPI enable/disable status should also be configured in the 
> `configure` summary.


https://github.com/Linaro/odp/pull/406#discussion_r164976139
updated_at 2018-01-31 08:02:27


Re: [lng-odp] [PATCH v1] Packet function inlines

2018-01-31 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

platform/linux-generic/odp_packet.c
line 169
@@ -1352,16 +1352,14 @@ void odp_packet_flow_hash_set(odp_packet_t pkt, 
uint32_t flow_hash)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->flow_hash = flow_hash;
-   pkt_hdr->p.input_flags.flow_hash = 1;
+   packet_set_flow_hash(pkt_hdr, flow_hash);
 }
 
 void odp_packet_ts_set(odp_packet_t pkt, odp_time_t timestamp)
 {
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 
-   pkt_hdr->timestamp = timestamp;
-   pkt_hdr->p.input_flags.timestamp = 1;
+   packet_set_ts(pkt_hdr, ×tamp);


Comment:
I could rename the patch to:
"linux-gen: packet: use inlined flow hash and ts set"

... if necessary. The comment says already that also ts set is modified the 
same way.

> Petri Savolainen(psavol) wrote:
> I did try several combinations of type casts of invalid values, also cast to 
> uintptr_t. The problem is that gcc and clang (clang version 3.8.0-2ubuntu4) 
> of my machine accepted all of those casts, but the clang version in Travis 
> (clang version 3.8.0-2ubuntu3~trusty5) does not accept anything.
> 
> Maybe it's a bug in the particular version of clang. Anyway, addition of this 
> check even only on gcc side is improvement against what we currently have (no 
> check). Packet invalid is currently 0xfff in ABI spec, but event/buffer 
> invalid are 0.
> 
> odp_packet.c:55:19: error: static_assert expression is not an integral 
> constant
>   expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
> 0");
> ~~^
> ../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
>   'ODP_STATIC_ASSERT'
> #define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
> ^~~~
> odp_packet.c:55:20: note: cast that performs the conversions of a
>   reinterpret_cast is not allowed in a constant expression
> ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 
> 0");
>^


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Since you want to breech the strong type you need to use the internal 
>> `odp_typeval()` macro here. 
>> ```
>> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid not 
>> 0");
>> ```
>> etc. I've verified that this works fine for clang, so no need for the 
>> conditional compilation.


>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>> Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r164982882
updated_at 2018-01-31 08:39:27


Re: [lng-odp] [PATCH v1] Packet function inlines

2018-01-31 Thread Github ODP bot
Petri Savolainen(psavol) replied on github web page:

platform/linux-generic/odp_packet.c
line 28
@@ -49,15 +49,14 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE 
_odp_packet_inline = {
 
 #include 
 
-static inline odp_buffer_t buffer_handle(odp_packet_hdr_t *pkt_hdr)
-{
-   return (odp_buffer_t)pkt_hdr;
-}
-
-static inline odp_packet_hdr_t *buf_to_packet_hdr(odp_buffer_t buf)
-{
-   return (odp_packet_hdr_t *)buf_hdl_to_hdr(buf);
-}
+/* Check that invalid values are the same. Some versions of Clang have trouble
+ * with the strong type casting, and complain that these invalid values are not
+ * integral constants. */
+#ifndef __clang__
+ODP_STATIC_ASSERT(ODP_PACKET_INVALID == 0, "Packet invalid not 0");
+ODP_STATIC_ASSERT(ODP_BUFFER_INVALID == 0, "Buffer invalid not 0");
+ODP_STATIC_ASSERT(ODP_EVENT_INVALID  == 0, "Event invalid not 0");


Comment:
I did try several combinations of type casts of invalid values, also cast to 
uintptr_t. The problem is that gcc and clang (clang version 3.8.0-2ubuntu4) of 
my machine accepted all of those casts, but the clang version in Travis (clang 
version 3.8.0-2ubuntu3~trusty5) does not accept anything.

Maybe it's a bug in the particular version of clang. Anyway, addition of this 
check even only on gcc side is improvement against what we currently have (no 
check). Packet invalid is currently 0xfff in ABI spec, but event/buffer 
invalid are 0.

odp_packet.c:55:19: error: static_assert expression is not an integral constant
  expression
ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 0");
~~^
../../include/odp/api/abi-default/debug.h:26:53: note: expanded from macro
  'ODP_STATIC_ASSERT'
#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
^~~~
odp_packet.c:55:20: note: cast that performs the conversions of a
  reinterpret_cast is not allowed in a constant expression
ODP_STATIC_ASSERT(((uintptr_t)ODP_PACKET_INVALID) == 0, "Packet invalid not 0");
   ^


> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
> Since you want to breech the strong type you need to use the internal 
> `odp_typeval()` macro here. 
> ```
> ODP_STATIC_ASSERT(_odp_typeval(ODP_EVENT_INVALID) == 0, "Event invalid not 
> 0");
> ```
> etc. I've verified that this works fine for clang, so no need for the 
> conditional compilation.


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> Should this be in its own commit? Different function.


https://github.com/Linaro/odp/pull/437#discussion_r164980772
updated_at 2018-01-31 08:29:26