This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via c317e53fa7268154ca5a50cc2685ca9cdf2a89d8 (commit) via 5a57b8d273a8325418b536fdc01ba745383c3473 (commit) via 6b86d7138744731f30cab9b8a24bddb34a83941c (commit) via afe842d93388ddf461e6af3ab3a8d5a252f0094e (commit) via 3d618f4324066cc93ce271665e6d5c7b593a5b7e (commit) via 4505a83d3f7bbda476f629765be67834e5f268eb (commit) via 7fb84a671f571d462f63f08c447c79d856426d0f (commit) via 7bd3ad1f4d8ec2f2dbb49da08031e8a0f1219b4c (commit) via 99040617d930f25c2c130cfdf723b7f3fa0be28e (commit) via 159da2538ea888a04caea621d5a8dc4f5ab6e2b7 (commit) via e2dcc95d50f850a8a703d1d0449f4875eda40e76 (commit) from 56834f66e317f4bf941de808cb6529bad3d3baa6 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit c317e53fa7268154ca5a50cc2685ca9cdf2a89d8 Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu Jun 13 09:22:21 2019 +0300
test: ipsec: run ipsec example in make check
Run ipsec examples under linux-generic platform specific test cases, as these examples assume that loop1 and loop2 interfaces are available.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/Makefile.am b/example/ipsec/Makefile.am index 786507afd..f4b150d28 100644 --- a/example/ipsec/Makefile.am +++ b/example/ipsec/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/example/Makefile.inc
bin_PROGRAMS = odp_ipsec
-dist_bin_SCRIPTS = \ +dist_check_SCRIPTS = \ odp_ipsec_run_ah_in.sh \ odp_ipsec_run_ah_out.sh \ odp_ipsec_run_both_in.sh \ diff --git a/example/ipsec/odp_ipsec_run_esp_out.sh b/example/ipsec/odp_ipsec_run_esp_out.sh index b5a541eda..f8645f0fb 100755 --- a/example/ipsec/odp_ipsec_run_esp_out.sh +++ b/example/ipsec/odp_ipsec_run_esp_out.sh @@ -4,10 +4,15 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec -i loop1,loop2 \ + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:esp \ -e 192.168.111.2:192.168.222.2:\ 3des:201:656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \ -s 192.168.111.2:192.168.222.2:loop1:loop2:10:100 \ --c 2 -m $1 +-c 2 "$@" diff --git a/example/ipsec/odp_ipsec_run_simple.sh b/example/ipsec/odp_ipsec_run_simple.sh index 462279161..3c3710f5f 100755 --- a/example/ipsec/odp_ipsec_run_simple.sh +++ b/example/ipsec/odp_ipsec_run_simple.sh @@ -4,7 +4,12 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec -i loop1,loop2 \ + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -s 192.168.111.2:192.168.222.2:loop1:loop2:10:100 \ --c 2 -m $1 +-c 2 "$@" diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index daeb779fb..f2ffe995a 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -13,9 +13,12 @@ if test_vald TESTS = validation/api/pktio/pktio_run.sh \ validation/api/pktio/pktio_run_tap.sh \ validation/api/shmem/shmem_linux$(EXEEXT) \ - ipsec/ipsec_api_example.sh + ipsec/ipsec_api_example.sh \ + ipsec/ipsec_example.sh + +dist_check_SCRIPTS = ipsec/ipsec_api_example.sh \ + ipsec/ipsec_example.sh
-dist_check_SCRIPTS = ipsec/ipsec_api_example.sh test_SCRIPTS = $(dist_check_SCRIPTS)
SUBDIRS += validation/api/pktio\ diff --git a/platform/linux-generic/test/ipsec/ipsec_example.sh b/platform/linux-generic/test/ipsec/ipsec_example.sh new file mode 100755 index 000000000..e38350c03 --- /dev/null +++ b/platform/linux-generic/test/ipsec/ipsec_example.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) 2019, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Skip IPsec example tests when there's no OpenSSL. +if [ -n "$WITH_OPENSSL" ] && [ ${WITH_OPENSSL} -eq 0 ]; then +echo "Crypto not supported. Skipping." +exit 77 +fi + +# Absolute path to the example binary. This is needed during distcheck, which +# keeps scripts and binaries in different directories (scripts are not copied +# into the distribution directory). +export IPSEC_EXAMPLE_PATH=$(pwd)/../../../example/ipsec + +declare -i RESULT=0 + +pushd $(dirname $0)/../../../../example/ipsec + +./odp_ipsec_run_simple.sh +RESULT+=$? + +./odp_ipsec_run_esp_out.sh +RESULT+=$? + +popd + +exit ${RESULT}
commit 5a57b8d273a8325418b536fdc01ba745383c3473 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Jun 7 11:11:52 2019 +0300
test: ipsec: run ipsec_api example in make check
Run ipsec examples under linux-generic platform specific test cases, as these examples assume that loop1 and loop2 interfaces are available.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec_api/Makefile.am b/example/ipsec_api/Makefile.am index 8f81e3233..16b1fbfd0 100644 --- a/example/ipsec_api/Makefile.am +++ b/example/ipsec_api/Makefile.am @@ -2,18 +2,18 @@ include $(top_srcdir)/example/Makefile.inc
bin_PROGRAMS = odp_ipsec_api
-dist_bin_SCRIPTS = \ - $(srcdir)/odp_ipsec_api_run_ah_in.sh \ - $(srcdir)/odp_ipsec_api_run_ah_out.sh \ - $(srcdir)/odp_ipsec_api_run_ah_tun_in.sh \ - $(srcdir)/odp_ipsec_api_run_ah_tun_out.sh \ - $(srcdir)/odp_ipsec_api_run_esp_in.sh \ - $(srcdir)/odp_ipsec_api_run_esp_out.sh \ - $(srcdir)/odp_ipsec_api_run_esp_tun_in.sh \ - $(srcdir)/odp_ipsec_api_run_esp_tun_out.sh \ - $(srcdir)/odp_ipsec_api_run_live.sh \ - $(srcdir)/odp_ipsec_api_run_router.sh \ - $(srcdir)/odp_ipsec_api_run_simple.sh +dist_check_SCRIPTS = \ + odp_ipsec_api_run_ah_in.sh \ + odp_ipsec_api_run_ah_out.sh \ + odp_ipsec_api_run_ah_tun_in.sh \ + odp_ipsec_api_run_ah_tun_out.sh \ + odp_ipsec_api_run_esp_in.sh \ + odp_ipsec_api_run_esp_out.sh \ + odp_ipsec_api_run_esp_tun_in.sh \ + odp_ipsec_api_run_esp_tun_out.sh \ + odp_ipsec_api_run_live.sh \ + odp_ipsec_api_run_router.sh \ + odp_ipsec_api_run_simple.sh
odp_ipsec_api_SOURCES = \ odp_ipsec.c \ diff --git a/example/ipsec_api/odp_ipsec_api_run_esp_out.sh b/example/ipsec_api/odp_ipsec_api_run_esp_out.sh index d5dc6e0e6..e846dfbec 100755 --- a/example/ipsec_api/odp_ipsec_api_run_esp_out.sh +++ b/example/ipsec_api/odp_ipsec_api_run_esp_out.sh @@ -4,7 +4,12 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_api -i loop1,loop2 \ + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:esp \ -e 192.168.111.2:192.168.222.2:\ diff --git a/example/ipsec_api/odp_ipsec_api_run_simple.sh b/example/ipsec_api/odp_ipsec_api_run_simple.sh index e1698bd2b..8b9b9d7b9 100755 --- a/example/ipsec_api/odp_ipsec_api_run_simple.sh +++ b/example/ipsec_api/odp_ipsec_api_run_simple.sh @@ -4,7 +4,12 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -./odp_ipsec_api -i loop1,loop2 \ + +if [ -z "$IPSEC_EXAMPLE_PATH" ]; then +IPSEC_EXAMPLE_PATH=. +fi + +${IPSEC_EXAMPLE_PATH}/odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -s 192.168.111.2:192.168.222.2:loop1:loop2:10:100 \ -c 2 "$@" diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 03a1474da..daeb779fb 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -1,12 +1,22 @@ include $(top_srcdir)/test/Makefile.inc TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
+if WITH_OPENSSL +TESTS_ENVIRONMENT += WITH_OPENSSL=1 +else +TESTS_ENVIRONMENT += WITH_OPENSSL=0 +endif + SUBDIRS =
if test_vald TESTS = validation/api/pktio/pktio_run.sh \ validation/api/pktio/pktio_run_tap.sh \ - validation/api/shmem/shmem_linux$(EXEEXT) + validation/api/shmem/shmem_linux$(EXEEXT) \ + ipsec/ipsec_api_example.sh + +dist_check_SCRIPTS = ipsec/ipsec_api_example.sh +test_SCRIPTS = $(dist_check_SCRIPTS)
SUBDIRS += validation/api/pktio\ validation/api/shmem\ diff --git a/platform/linux-generic/test/ipsec/ipsec_api_example.sh b/platform/linux-generic/test/ipsec/ipsec_api_example.sh new file mode 100755 index 000000000..82fd193d9 --- /dev/null +++ b/platform/linux-generic/test/ipsec/ipsec_api_example.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) 2019, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# Skip IPsec example tests when there's no OpenSSL. +if [ -n "$WITH_OPENSSL" ] && [ ${WITH_OPENSSL} -eq 0 ]; then +echo "Crypto not supported. Skipping." +exit 77 +fi + +# Absolute path to the example binary. This is needed during distcheck, which +# keeps scripts and binaries in different directories (scripts are not copied +# into the distribution directory). +export IPSEC_EXAMPLE_PATH=$(pwd)/../../../example/ipsec_api + +declare -i RESULT=0 + +pushd $(dirname $0)/../../../../example/ipsec_api + +./odp_ipsec_api_run_simple.sh +RESULT+=$? + +./odp_ipsec_api_run_esp_out.sh +RESULT+=$? + +popd + +exit ${RESULT}
commit 6b86d7138744731f30cab9b8a24bddb34a83941c Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu Jun 6 15:05:45 2019 +0300
example: ipsec: rename scripts with .sh postfix
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/Makefile.am b/example/ipsec/Makefile.am index 67b5a6f5d..786507afd 100644 --- a/example/ipsec/Makefile.am +++ b/example/ipsec/Makefile.am @@ -3,15 +3,15 @@ include $(top_srcdir)/example/Makefile.inc bin_PROGRAMS = odp_ipsec
dist_bin_SCRIPTS = \ - odp_ipsec_run_ah_in \ - odp_ipsec_run_ah_out \ - odp_ipsec_run_both_in \ - odp_ipsec_run_both_out \ - odp_ipsec_run_esp_in \ - odp_ipsec_run_esp_out \ - odp_ipsec_run_live \ - odp_ipsec_run_router \ - odp_ipsec_run_simple + odp_ipsec_run_ah_in.sh \ + odp_ipsec_run_ah_out.sh \ + odp_ipsec_run_both_in.sh \ + odp_ipsec_run_both_out.sh \ + odp_ipsec_run_esp_in.sh \ + odp_ipsec_run_esp_out.sh \ + odp_ipsec_run_live.sh \ + odp_ipsec_run_router.sh \ + odp_ipsec_run_simple.sh
odp_ipsec_SOURCES = odp_ipsec.c \ odp_ipsec_sa_db.c \ diff --git a/example/ipsec/odp_ipsec_run_ah_in b/example/ipsec/odp_ipsec_run_ah_in.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_ah_in rename to example/ipsec/odp_ipsec_run_ah_in.sh diff --git a/example/ipsec/odp_ipsec_run_ah_out b/example/ipsec/odp_ipsec_run_ah_out.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_ah_out rename to example/ipsec/odp_ipsec_run_ah_out.sh diff --git a/example/ipsec/odp_ipsec_run_both_in b/example/ipsec/odp_ipsec_run_both_in.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_both_in rename to example/ipsec/odp_ipsec_run_both_in.sh diff --git a/example/ipsec/odp_ipsec_run_both_out b/example/ipsec/odp_ipsec_run_both_out.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_both_out rename to example/ipsec/odp_ipsec_run_both_out.sh diff --git a/example/ipsec/odp_ipsec_run_esp_in b/example/ipsec/odp_ipsec_run_esp_in.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_esp_in rename to example/ipsec/odp_ipsec_run_esp_in.sh diff --git a/example/ipsec/odp_ipsec_run_esp_out b/example/ipsec/odp_ipsec_run_esp_out.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_esp_out rename to example/ipsec/odp_ipsec_run_esp_out.sh diff --git a/example/ipsec/odp_ipsec_run_live b/example/ipsec/odp_ipsec_run_live.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_live rename to example/ipsec/odp_ipsec_run_live.sh diff --git a/example/ipsec/odp_ipsec_run_router b/example/ipsec/odp_ipsec_run_router.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_router rename to example/ipsec/odp_ipsec_run_router.sh diff --git a/example/ipsec/odp_ipsec_run_simple b/example/ipsec/odp_ipsec_run_simple.sh similarity index 100% rename from example/ipsec/odp_ipsec_run_simple rename to example/ipsec/odp_ipsec_run_simple.sh
commit afe842d93388ddf461e6af3ab3a8d5a252f0094e Author: Petri Savolainen petri.savolainen@nokia.com Date: Wed Jun 5 15:07:34 2019 +0300
example: ipsec: fix script path to binary
Binaries are not in PATH, so need to use ./ prefix.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec_run_ah_in b/example/ipsec/odp_ipsec_run_ah_in index 252f44bfd..5ff168760 100755 --- a/example/ipsec/odp_ipsec_run_ah_in +++ b/example/ipsec/odp_ipsec_run_ah_in @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:ah \ -a 192.168.222.2:192.168.111.2:md5:300:27f6d123d7077b361662fc6e451f65d8 \ diff --git a/example/ipsec/odp_ipsec_run_ah_out b/example/ipsec/odp_ipsec_run_ah_out index 9256c0723..53ddd2fb1 100755 --- a/example/ipsec/odp_ipsec_run_ah_out +++ b/example/ipsec/odp_ipsec_run_ah_out @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:ah \ -a 192.168.111.2:192.168.222.2:md5:200:a731649644c5dee92cbd9c2e7e188ee6 \ diff --git a/example/ipsec/odp_ipsec_run_both_in b/example/ipsec/odp_ipsec_run_both_in index c3f169cec..502f14a7d 100755 --- a/example/ipsec/odp_ipsec_run_both_in +++ b/example/ipsec/odp_ipsec_run_both_in @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:both \ -a 192.168.222.2:192.168.111.2:md5:300:27f6d123d7077b361662fc6e451f65d8 \ diff --git a/example/ipsec/odp_ipsec_run_both_out b/example/ipsec/odp_ipsec_run_both_out index 8ba067223..3086e6f12 100755 --- a/example/ipsec/odp_ipsec_run_both_out +++ b/example/ipsec/odp_ipsec_run_both_out @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:both \ -e 192.168.111.2:192.168.222.2:\ diff --git a/example/ipsec/odp_ipsec_run_esp_in b/example/ipsec/odp_ipsec_run_esp_in index 12fdae691..a206cc401 100755 --- a/example/ipsec/odp_ipsec_run_esp_in +++ b/example/ipsec/odp_ipsec_run_esp_in @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:esp \ -e 192.168.222.2:192.168.111.2:\ diff --git a/example/ipsec/odp_ipsec_run_esp_out b/example/ipsec/odp_ipsec_run_esp_out index 73c4ff0ef..b5a541eda 100755 --- a/example/ipsec/odp_ipsec_run_esp_out +++ b/example/ipsec/odp_ipsec_run_esp_out @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:esp \ -e 192.168.111.2:192.168.222.2:\ diff --git a/example/ipsec/odp_ipsec_run_live b/example/ipsec/odp_ipsec_run_live index 90947ad7e..f61d4e38f 100755 --- a/example/ipsec/odp_ipsec_run_live +++ b/example/ipsec/odp_ipsec_run_live @@ -3,7 +3,7 @@ # Live router test # - 2 interfaces interfaces # - Specify API mode on command line -sudo odp_ipsec -i p7p1,p8p1 \ +sudo ./odp_ipsec -i p7p1,p8p1 \ -r 192.168.111.2/32:p7p1:08.00.27.76.B5.E0 \ -r 192.168.222.2/32:p8p1:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:both \ diff --git a/example/ipsec/odp_ipsec_run_router b/example/ipsec/odp_ipsec_run_router index 363029737..55ad766f5 100755 --- a/example/ipsec/odp_ipsec_run_router +++ b/example/ipsec/odp_ipsec_run_router @@ -3,7 +3,7 @@ # Live router test # - 2 interfaces interfaces # - Specify API mode on command line -sudo odp_ipsec -i p7p1,p8p1 \ +sudo ./odp_ipsec -i p7p1,p8p1 \ -r 192.168.111.2/32:p7p1:08.00.27.76.B5.E0 \ -r 192.168.222.2/32:p8p1:08.00.27.F5.8B.DB \ -c 1 -m $1 diff --git a/example/ipsec/odp_ipsec_run_simple b/example/ipsec/odp_ipsec_run_simple index 12115838d..462279161 100755 --- a/example/ipsec/odp_ipsec_run_simple +++ b/example/ipsec/odp_ipsec_run_simple @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec -i loop1,loop2 \ +./odp_ipsec -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -s 192.168.111.2:192.168.222.2:loop1:loop2:10:100 \ -c 2 -m $1 diff --git a/example/ipsec_api/odp_ipsec_api_run_ah_in.sh b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh index becfc8928..4f92849b2 100755 --- a/example/ipsec_api/odp_ipsec_api_run_ah_in.sh +++ b/example/ipsec_api/odp_ipsec_api_run_ah_in.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:ah \ -a 192.168.222.2:192.168.111.2:md5:300:27f6d123d7077b361662fc6e451f65d8 \ diff --git a/example/ipsec_api/odp_ipsec_api_run_ah_out.sh b/example/ipsec_api/odp_ipsec_api_run_ah_out.sh index 023809a18..67dff4c32 100755 --- a/example/ipsec_api/odp_ipsec_api_run_ah_out.sh +++ b/example/ipsec_api/odp_ipsec_api_run_ah_out.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:ah \ -a 192.168.111.2:192.168.222.2:md5:200:a731649644c5dee92cbd9c2e7e188ee6 \ diff --git a/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh b/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh index 40c488f04..fa33f260c 100755 --- a/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh +++ b/example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:ah \ -a 192.168.222.2:192.168.111.2:md5:300:27f6d123d7077b361662fc6e451f65d8 \ diff --git a/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh b/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh index d7118586f..acc25e8b2 100755 --- a/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh +++ b/example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:ah \ -a 192.168.111.2:192.168.222.2:md5:200:a731649644c5dee92cbd9c2e7e188ee6 \ diff --git a/example/ipsec_api/odp_ipsec_api_run_esp_in.sh b/example/ipsec_api/odp_ipsec_api_run_esp_in.sh index cdb302ef4..d71c6f567 100755 --- a/example/ipsec_api/odp_ipsec_api_run_esp_in.sh +++ b/example/ipsec_api/odp_ipsec_api_run_esp_in.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:esp \ -e 192.168.222.2:192.168.111.2:\ diff --git a/example/ipsec_api/odp_ipsec_api_run_esp_out.sh b/example/ipsec_api/odp_ipsec_api_run_esp_out.sh index f1c15ffee..d5dc6e0e6 100755 --- a/example/ipsec_api/odp_ipsec_api_run_esp_out.sh +++ b/example/ipsec_api/odp_ipsec_api_run_esp_out.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:esp \ -e 192.168.111.2:192.168.222.2:\ diff --git a/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh b/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh index 5d78479e4..def6f6abd 100755 --- a/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh +++ b/example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.111.2/32:loop1:08.00.27.76.B5.E0 \ -p 192.168.222.0/24:192.168.111.0/24:in:esp \ -e 192.168.222.2:192.168.111.2:\ diff --git a/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh b/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh index f1c15ffee..d5dc6e0e6 100755 --- a/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh +++ b/example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:esp \ -e 192.168.111.2:192.168.222.2:\ diff --git a/example/ipsec_api/odp_ipsec_api_run_live.sh b/example/ipsec_api/odp_ipsec_api_run_live.sh index 9bc0a60f3..4a455ba85 100755 --- a/example/ipsec_api/odp_ipsec_api_run_live.sh +++ b/example/ipsec_api/odp_ipsec_api_run_live.sh @@ -3,7 +3,7 @@ # Live router test # - 2 interfaces interfaces # - Specify API mode on command line -sudo odp_ipsec_api -i p7p1,p8p1 \ +sudo ./odp_ipsec_api -i p7p1,p8p1 \ -r 192.168.111.2/32:p7p1:08.00.27.76.B5.E0 \ -r 192.168.222.2/32:p8p1:08.00.27.F5.8B.DB \ -p 192.168.111.0/24:192.168.222.0/24:out:both \ diff --git a/example/ipsec_api/odp_ipsec_api_run_router.sh b/example/ipsec_api/odp_ipsec_api_run_router.sh index 982a27e97..34573d47f 100755 --- a/example/ipsec_api/odp_ipsec_api_run_router.sh +++ b/example/ipsec_api/odp_ipsec_api_run_router.sh @@ -3,7 +3,7 @@ # Live router test # - 2 interfaces interfaces # - Specify API mode on command line -sudo odp_ipsec_api -i p7p1,p8p1 \ +sudo ./odp_ipsec_api -i p7p1,p8p1 \ -r 192.168.111.2/32:p7p1:08.00.27.76.B5.E0 \ -r 192.168.222.2/32:p8p1:08.00.27.F5.8B.DB \ -c 1 "$@" diff --git a/example/ipsec_api/odp_ipsec_api_run_simple.sh b/example/ipsec_api/odp_ipsec_api_run_simple.sh index bdc2777c9..e1698bd2b 100755 --- a/example/ipsec_api/odp_ipsec_api_run_simple.sh +++ b/example/ipsec_api/odp_ipsec_api_run_simple.sh @@ -4,7 +4,7 @@ # - 2 loop interfaces # - 10 packets # - Specify API mode on command line -odp_ipsec_api -i loop1,loop2 \ +./odp_ipsec_api -i loop1,loop2 \ -r 192.168.222.2/32:loop2:08.00.27.F5.8B.DB \ -s 192.168.111.2:192.168.222.2:loop1:loop2:10:100 \ -c 2 "$@"
commit 3d618f4324066cc93ce271665e6d5c7b593a5b7e Author: Petri Savolainen petri.savolainen@nokia.com Date: Tue Jun 18 10:28:09 2019 +0300
example: ipsec: rename schedule function pointer
Rename function pointer to schedule_fn. When the name differs from other schedule definitions it's easier to find references to it and code is more readable.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 96c0fe613..1c26e405c 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -242,7 +242,7 @@ typedef odp_queue_t (*queue_create_func_t) typedef odp_event_t (*schedule_func_t) (odp_queue_t *);
static queue_create_func_t queue_create; -static schedule_func_t schedule; +static schedule_func_t schedule_fn;
/** * odp_queue_create wrapper to enable polling versus scheduling @@ -1062,7 +1062,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_event_subtype_t subtype;
/* Use schedule to get event from any input queue */ - ev = schedule(&dispatchq); + ev = schedule_fn(&dispatchq);
if (ev == ODP_EVENT_INVALID) continue; @@ -1211,12 +1211,12 @@ main(int argc, char *argv[])
/* create by default scheduled queues */ queue_create = odp_queue_create; - schedule = odp_schedule_cb; + schedule_fn = odp_schedule_cb;
/* check for using poll queues */ if (getenv("ODP_IPSEC_USE_POLL_QUEUES")) { queue_create = polled_odp_queue_create; - schedule = polled_odp_schedule_cb; + schedule_fn = polled_odp_schedule_cb; }
/* Let helper collect its own arguments (e.g. --odph_proc) */ diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 73f5be19f..fa977db8e 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -193,7 +193,7 @@ typedef odp_queue_t (*queue_create_func_t) typedef odp_event_t (*schedule_func_t) (odp_queue_t *);
static queue_create_func_t queue_create; -static schedule_func_t schedule; +static schedule_func_t schedule_fn;
/** * odp_queue_create wrapper to enable polling versus scheduling @@ -744,7 +744,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_event_subtype_t subtype;
/* Use schedule to get event from any input queue */ - ev = schedule(&dispatchq); + ev = schedule_fn(&dispatchq);
if (ev == ODP_EVENT_INVALID) continue; @@ -905,12 +905,12 @@ main(int argc, char *argv[])
/* create by default scheduled queues */ queue_create = odp_queue_create; - schedule = odp_schedule_cb; + schedule_fn = odp_schedule_cb;
/* check for using poll queues */ if (getenv("ODP_IPSEC_USE_POLL_QUEUES")) { queue_create = polled_odp_queue_create; - schedule = polled_odp_schedule_cb; + schedule_fn = polled_odp_schedule_cb; }
/* Let helper collect its own arguments (e.g. --odph_proc) */ @@ -1076,7 +1076,7 @@ main(int argc, char *argv[])
/* Drop any remaining events. ipsec_sa_disable sends status event in * async mode */ - while ((ev = schedule(NULL)) != ODP_EVENT_INVALID) + while ((ev = schedule_fn(NULL)) != ODP_EVENT_INVALID) odp_event_free(ev);
if (odp_queue_destroy(global->completionq))
commit 4505a83d3f7bbda476f629765be67834e5f268eb Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jun 17 14:54:26 2019 +0300
example: ipsec_api: exit workers and destroy resources
Modified worker main loop to exit when the main thread commands. Clean up resources before exiting.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index b73cfe90f..73f5be19f 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -96,6 +96,7 @@ typedef struct { odp_barrier_t sync_barrier; odp_queue_t poll_queues[MAX_POLL_QUEUES]; int num_polled_queues; + volatile int stop_workers; } global_data_t;
/* helper funcs */ @@ -230,7 +231,7 @@ odp_queue_t polled_odp_queue_create(const char *name, static inline odp_event_t odp_schedule_cb(odp_queue_t *from) { - return odp_schedule(from, ODP_SCHED_WAIT); + return odp_schedule(from, ODP_SCHED_NO_WAIT); }
/** @@ -241,22 +242,23 @@ odp_event_t polled_odp_schedule_cb(odp_queue_t *from) { int idx = 0;
- while (1) { - if (idx >= global->num_polled_queues) - idx = 0; - + while (idx < global->num_polled_queues) { odp_queue_t queue = global->poll_queues[idx++]; - odp_event_t buf; + odp_event_t ev; + + ev = odp_queue_deq(queue);
- buf = odp_queue_deq(queue); + if (ODP_EVENT_INVALID != ev) { + if (from) + *from = queue;
- if (ODP_EVENT_INVALID != buf) { - *from = queue; - return buf; + return ev; } }
- *from = ODP_QUEUE_INVALID; + if (from) + *from = ODP_QUEUE_INVALID; + return ODP_EVENT_INVALID; }
@@ -735,7 +737,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_barrier_wait(&global->sync_barrier);
/* Loop packets */ - for (;;) { + while (global->stop_workers == 0) { pkt_disposition_e rc = PKT_CONTINUE; pkt_ctx_t *ctx; odp_queue_t dispatchq; @@ -744,6 +746,9 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) /* Use schedule to get event from any input queue */ ev = schedule(&dispatchq);
+ if (ev == ODP_EVENT_INVALID) + continue; + /* Determine new work versus completion or sequence number */ if (ODP_EVENT_PACKET == odp_event_types(ev, &subtype)) { pkt = odp_packet_from_event(ev); @@ -875,7 +880,6 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) } }
- /* unreachable */ return 0; }
@@ -897,6 +901,7 @@ main(int argc, char *argv[]) odp_instance_t instance; odp_init_t init_param; odph_odpthread_params_t thr_params; + odp_event_t ev;
/* create by default scheduled queues */ queue_create = odp_queue_create; @@ -1022,6 +1027,7 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ + memset(thread_tbl, 0, sizeof(thread_tbl)); memset(&thr_params, 0, sizeof(thr_params)); thr_params.start = pktio_thread; thr_params.arg = NULL; @@ -1041,10 +1047,13 @@ main(int argc, char *argv[]) sleep(1); } while (!done); printf("All received\n"); - } else { - odph_odpthreads_join(thread_tbl); }
+ global->stop_workers = 1; + odp_mb_full(); + + odph_odpthreads_join(thread_tbl); + /* Stop and close used pktio devices */ for (i = 0; i < global->appl.if_count; i++) { odp_pktio_t pktio = odp_pktio_lookup(global->appl.if_names[i]); @@ -1062,6 +1071,22 @@ main(int argc, char *argv[]) free(global->appl.if_names); free(global->appl.if_str);
+ if (destroy_ipsec_cache()) + EXAMPLE_ERR("Error: crypto session destroy failed\n"); + + /* Drop any remaining events. ipsec_sa_disable sends status event in + * async mode */ + while ((ev = schedule(NULL)) != ODP_EVENT_INVALID) + odp_event_free(ev); + + if (odp_queue_destroy(global->completionq)) + EXAMPLE_ERR("Error: queue destroy failed\n"); + + if (odp_pool_destroy(global->pkt_pool)) + EXAMPLE_ERR("Error: pool destroy failed\n"); + if (odp_pool_destroy(global->ctx_pool)) + EXAMPLE_ERR("Error: pool destroy failed\n"); + shm = odp_shm_lookup("shm_ipsec_cache"); if (odp_shm_free(shm) != 0) EXAMPLE_ERR("Error: shm free shm_ipsec_cache failed\n"); @@ -1085,6 +1110,16 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ if (odp_term_local()) { + EXAMPLE_ERR("Error: term local failed\n"); + exit(EXIT_FAILURE); + } + + if (odp_term_global(instance)) { + EXAMPLE_ERR("Error: term global failed\n"); + exit(EXIT_FAILURE); + } + printf("Exit\n\n");
return 0; diff --git a/example/ipsec_api/odp_ipsec_cache.c b/example/ipsec_api/odp_ipsec_cache.c index 3a28410eb..e408899ac 100644 --- a/example/ipsec_api/odp_ipsec_cache.c +++ b/example/ipsec_api/odp_ipsec_cache.c @@ -21,6 +21,7 @@ ipsec_cache_t *ipsec_cache; void init_ipsec_cache(void) { odp_shm_t shm; + int i;
shm = odp_shm_reserve("shm_ipsec_cache", sizeof(ipsec_cache_t), @@ -39,6 +40,9 @@ void init_ipsec_cache(void) exit(EXIT_FAILURE); } memset(ipsec_cache, 0, sizeof(*ipsec_cache)); + + for (i = 0; i < MAX_DB; i++) + ipsec_cache->array[i].ipsec_sa = ODP_IPSEC_SA_INVALID; }
int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, @@ -183,3 +187,20 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, } return entry; } + +int destroy_ipsec_cache(void) +{ + ipsec_cache_entry_t *entry; + int i; + int ret = 0; + + for (i = 0; i < MAX_DB; i++) { + entry = &ipsec_cache->array[i]; + if (entry->ipsec_sa != ODP_IPSEC_SA_INVALID) { + ret += odp_ipsec_sa_disable(entry->ipsec_sa); + ret += odp_ipsec_sa_destroy(entry->ipsec_sa); + } + } + + return ret; +} diff --git a/example/ipsec_api/odp_ipsec_cache.h b/example/ipsec_api/odp_ipsec_cache.h index 0454ab1b6..b0e1fa3f0 100644 --- a/example/ipsec_api/odp_ipsec_cache.h +++ b/example/ipsec_api/odp_ipsec_cache.h @@ -105,6 +105,8 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, uint32_t dst_ip, uint8_t proto);
+int destroy_ipsec_cache(void); + #ifdef __cplusplus } #endif
commit 7fb84a671f571d462f63f08c447c79d856426d0f Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jun 17 13:58:50 2019 +0300
example: ipsec: exit workers and destroy resources
Modified worker main loop to exit when the main thread commands. Added destroy and terminate calls to clean up resources before exiting. For example, ODP linux-generic implementation does not free shm memory without proper destroy and terminate calls.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 10bd06e0b..96c0fe613 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -98,6 +98,7 @@ typedef struct { odp_barrier_t sync_barrier; odp_queue_t poll_queues[MAX_POLL_QUEUES]; int num_polled_queues; + volatile int stop_workers; } global_data_t;
/* helper funcs */ @@ -279,7 +280,7 @@ odp_queue_t polled_odp_queue_create(const char *name, static inline odp_event_t odp_schedule_cb(odp_queue_t *from) { - return odp_schedule(from, ODP_SCHED_WAIT); + return odp_schedule(from, ODP_SCHED_NO_WAIT); }
/** @@ -290,18 +291,15 @@ odp_event_t polled_odp_schedule_cb(odp_queue_t *from) { int idx = 0;
- while (1) { - if (idx >= global->num_polled_queues) - idx = 0; - + while (idx < global->num_polled_queues) { odp_queue_t queue = global->poll_queues[idx++]; - odp_event_t buf; + odp_event_t ev;
- buf = odp_queue_deq(queue); + ev = odp_queue_deq(queue);
- if (ODP_EVENT_INVALID != buf) { + if (ODP_EVENT_INVALID != ev) { *from = queue; - return buf; + return ev; } }
@@ -1057,7 +1055,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_barrier_wait(&global->sync_barrier);
/* Loop packets */ - for (;;) { + while (global->stop_workers == 0) { pkt_disposition_e rc; pkt_ctx_t *ctx; odp_queue_t dispatchq; @@ -1066,10 +1064,8 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) /* Use schedule to get event from any input queue */ ev = schedule(&dispatchq);
- if (ev == ODP_EVENT_INVALID) { - EXAMPLE_ERR("Error: Bad event handle\n"); - exit(EXIT_FAILURE); - } + if (ev == ODP_EVENT_INVALID) + continue;
/* Determine new work versus completion or sequence number */ if (ODP_EVENT_PACKET == odp_event_types(ev, &subtype)) { @@ -1191,7 +1187,6 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) } }
- /* unreachable */ return 0; }
@@ -1338,6 +1333,7 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ + memset(thread_tbl, 0, sizeof(thread_tbl)); memset(&thr_params, 0, sizeof(thr_params)); thr_params.start = pktio_thread; thr_params.arg = NULL; @@ -1356,10 +1352,13 @@ main(int argc, char *argv[]) sleep(1); } while (!done); printf("All received\n"); - } else { - odph_odpthreads_join(thread_tbl); }
+ global->stop_workers = 1; + odp_mb_full(); + + odph_odpthreads_join(thread_tbl); + /* Stop and close used pktio devices */ for (i = 0; i < global->appl.if_count; i++) { odp_pktio_t pktio = odp_pktio_lookup(global->appl.if_names[i]); @@ -1377,6 +1376,21 @@ main(int argc, char *argv[]) free(global->appl.if_names); free(global->appl.if_str);
+ if (destroy_ipsec_cache()) + EXAMPLE_ERR("Error: crypto session destroy failed\n"); + + if (odp_queue_destroy(global->completionq)) + EXAMPLE_ERR("Error: queue destroy failed\n"); + if (odp_queue_destroy(global->seqnumq)) + EXAMPLE_ERR("Error: queue destroy failed\n"); + + if (odp_pool_destroy(global->pkt_pool)) + EXAMPLE_ERR("Error: pool destroy failed\n"); + if (odp_pool_destroy(global->ctx_pool)) + EXAMPLE_ERR("Error: pool destroy failed\n"); + if (odp_pool_destroy(global->out_pool)) + EXAMPLE_ERR("Error: pool destroy failed\n"); + shm = odp_shm_lookup("shm_ipsec_cache"); if (odp_shm_free(shm) != 0) EXAMPLE_ERR("Error: shm free shm_ipsec_cache failed\n"); @@ -1400,6 +1414,16 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
+ if (odp_term_local()) { + EXAMPLE_ERR("Error: term local failed\n"); + exit(EXIT_FAILURE); + } + + if (odp_term_global(instance)) { + EXAMPLE_ERR("Error: term global failed\n"); + exit(EXIT_FAILURE); + } + printf("Exit\n\n");
return 0; diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 5bbc497cf..362e64a44 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -21,6 +21,7 @@ ipsec_cache_t *ipsec_cache; void init_ipsec_cache(void) { odp_shm_t shm; + int i;
shm = odp_shm_reserve("shm_ipsec_cache", sizeof(ipsec_cache_t), @@ -38,6 +39,10 @@ void init_ipsec_cache(void) exit(EXIT_FAILURE); } memset(ipsec_cache, 0, sizeof(*ipsec_cache)); + + for (i = 0; i < MAX_DB; i++) + ipsec_cache->array[i].state.session = + ODP_CRYPTO_SESSION_INVALID; }
int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, @@ -223,3 +228,18 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, } return entry; } + +int destroy_ipsec_cache(void) +{ + ipsec_cache_entry_t *entry; + int i; + int ret = 0; + + for (i = 0; i < MAX_DB; i++) { + entry = &ipsec_cache->array[i]; + if (entry->state.session != ODP_CRYPTO_SESSION_INVALID) + ret += odp_crypto_session_destroy(entry->state.session); + } + + return ret; +} diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h index fb2416823..1523778ff 100644 --- a/example/ipsec/odp_ipsec_cache.h +++ b/example/ipsec/odp_ipsec_cache.h @@ -127,6 +127,8 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, uint32_t dst_ip, uint8_t proto);
+int destroy_ipsec_cache(void); + #ifdef __cplusplus } #endif
commit 7bd3ad1f4d8ec2f2dbb49da08031e8a0f1219b4c Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu Jun 13 13:37:29 2019 +0300
example: ipsec: fix short options without argument
Short option notation has ":" after an option that has arguments. Remove ":" after short options that do not have arguments.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index b39e2eac0..10bd06e0b 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1435,7 +1435,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} };
- static const char *shortopts = "+c:i:m:h:r:p:a:e:t:s:"; + static const char *shortopts = "+c:i:m:r:p:a:e:t:s:h";
printf("\nParsing command line options\n");
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index e6f085ca7..b73cfe90f 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -1109,7 +1109,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const struct option longopts[] = { {"count", required_argument, NULL, 'c'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ - {"lookup", 0, NULL, 'l'}, + {"lookup", no_argument, NULL, 'l'}, {"mode", required_argument, NULL, 'm'}, /* return 'm' */ {"route", required_argument, NULL, 'r'}, /* return 'r' */ {"policy", required_argument, NULL, 'p'}, /* return 'p' */ @@ -1121,7 +1121,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} };
- static const char *shortopts = "+c:i:h:lm:r:p:a:e:t:s:"; + static const char *shortopts = "+c:i:m:r:p:a:e:t:s:lh";
appl_args->cpu_count = 1; /* use one worker by default */
commit 99040617d930f25c2c130cfdf723b7f3fa0be28e Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu Jun 13 10:49:46 2019 +0300
example: ipsec: fix crypto_op return value check
Crypto_op() and crypto_op_enq() return number of input packets consumed. So, return value from a successful operation is the number of input packets.
Also, changed abort() calls to error print plus exit() for easier debugging.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 0e726d4b3..b39e2eac0 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -664,13 +664,17 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t *pkt, *skip = FALSE; ctx->state = PKT_STATE_IPSEC_IN_FINISH; if (entry->async) { - if (odp_crypto_op_enq(pkt, &out_pkt, ¶ms, 1)) - abort(); + if (odp_crypto_op_enq(pkt, &out_pkt, ¶ms, 1) != 1) { + EXAMPLE_ERR("Error: odp_crypto_op_enq() failed\n"); + exit(EXIT_FAILURE); + } return PKT_POSTED; }
- if (odp_crypto_op(pkt, &out_pkt, ¶ms, 1)) - abort(); + if (odp_crypto_op(pkt, &out_pkt, ¶ms, 1) != 1) { + EXAMPLE_ERR("Error: odp_crypto_op() failed\n"); + exit(EXIT_FAILURE); + } *pkt = out_pkt;
return PKT_CONTINUE; @@ -958,8 +962,10 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt, ret = odp_random_data((uint8_t *)ctx->ipsec.tun_hdr_id, sizeof(*ctx->ipsec.tun_hdr_id), 1); - if (ret != sizeof(*ctx->ipsec.tun_hdr_id)) - abort(); + if (ret != sizeof(*ctx->ipsec.tun_hdr_id)) { + EXAMPLE_ERR("Error: Not enough random data\n"); + exit(EXIT_FAILURE); + } } }
@@ -968,14 +974,17 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt, /* Issue crypto request */ if (entry->async) { if (odp_crypto_op_enq(pkt, &out_pkt, - &ctx->ipsec.params, 1)) - abort(); + &ctx->ipsec.params, 1) != 1) { + EXAMPLE_ERR("Error: odp_crypto_op_enq() failed\n"); + exit(EXIT_FAILURE); + } return PKT_POSTED; }
- if (odp_crypto_op(pkt, &out_pkt, - &ctx->ipsec.params, 1)) - abort(); + if (odp_crypto_op(pkt, &out_pkt, &ctx->ipsec.params, 1) != 1) { + EXAMPLE_ERR("Error: odp_crypto_op() failed\n"); + exit(EXIT_FAILURE); + } *pkt = out_pkt;
return PKT_CONTINUE; @@ -1057,6 +1066,11 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) /* Use schedule to get event from any input queue */ ev = schedule(&dispatchq);
+ if (ev == ODP_EVENT_INVALID) { + EXAMPLE_ERR("Error: Bad event handle\n"); + exit(EXIT_FAILURE); + } + /* Determine new work versus completion or sequence number */ if (ODP_EVENT_PACKET == odp_event_types(ev, &subtype)) { pkt = odp_packet_from_event(ev); @@ -1072,7 +1086,8 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) ctx->state = PKT_STATE_INPUT_VERIFY; } } else { - abort(); + EXAMPLE_ERR("Error: Bad event type\n"); + exit(EXIT_FAILURE); }
/*
commit 159da2538ea888a04caea621d5a8dc4f5ab6e2b7 Author: Petri Savolainen petri.savolainen@nokia.com Date: Thu Jun 6 13:54:22 2019 +0300
example: ipsec: do schedule config earlier
Scheduler needs to be configured before used.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index d11898810..0e726d4b3 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1249,6 +1249,9 @@ main(int argc, char *argv[]) memset(global, 0, sizeof(global_data_t)); global->shm = shm;
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Must init our databases before parsing args */ ipsec_init_pre(); init_fwd_db(); @@ -1302,9 +1305,6 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
- /* Configure scheduler */ - odp_schedule_config(NULL); - /* Populate our IPsec cache */ printf("Using %s mode for crypto API\n\n", (CRYPTO_API_SYNC == global->appl.mode) ? "SYNC" : diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 5b83e8b37..e6f085ca7 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -948,6 +948,9 @@ main(int argc, char *argv[]) memset(global, 0, sizeof(global_data_t)); global->shm = shm;
+ /* Configure scheduler */ + odp_schedule_config(NULL); + /* Must init our databases before parsing args */ ipsec_init_pre(); init_fwd_db(); @@ -1001,9 +1004,6 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); }
- /* Configure scheduler */ - odp_schedule_config(NULL); - /* Populate our IPsec cache */ printf("Using %s mode for IPsec API\n\n", (ODP_IPSEC_OP_MODE_SYNC == global->appl.mode) ? "SYNC" :
commit e2dcc95d50f850a8a703d1d0449f4875eda40e76 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Jun 14 12:54:07 2019 +0300
linux-gen: dpdk: reset getopt state after usage
Reset getopt library internal state after usage. Otherwise, the next getopt() / getopt_long() call may fail in various ways.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Dmitry Eremin-Solenikov deremin-solenikov@cavium.com
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 1d3220578..deef0b31c 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -1240,6 +1240,9 @@ static int dpdk_pktio_init(void)
i = rte_eal_init(dpdk_argc, dpdk_argv);
+ /* Force getopt() to reset its internal state */ + optind = 0; + if (i < 0) { ODP_ERR("Cannot init the Intel DPDK EAL!\n"); return -1;
-----------------------------------------------------------------------
Summary of changes: example/ipsec/Makefile.am | 20 ++-- example/ipsec/odp_ipsec.c | 105 ++++++++++++++------- example/ipsec/odp_ipsec_cache.c | 20 ++++ example/ipsec/odp_ipsec_cache.h | 2 + ...{odp_ipsec_run_ah_in => odp_ipsec_run_ah_in.sh} | 2 +- ...dp_ipsec_run_ah_out => odp_ipsec_run_ah_out.sh} | 2 +- ..._ipsec_run_both_in => odp_ipsec_run_both_in.sh} | 2 +- ...psec_run_both_out => odp_ipsec_run_both_out.sh} | 2 +- ...dp_ipsec_run_esp_in => odp_ipsec_run_esp_in.sh} | 2 +- ..._ipsec_run_esp_out => odp_ipsec_run_esp_out.sh} | 9 +- .../{odp_ipsec_run_live => odp_ipsec_run_live.sh} | 2 +- ...dp_ipsec_run_router => odp_ipsec_run_router.sh} | 2 +- ...dp_ipsec_run_simple => odp_ipsec_run_simple.sh} | 9 +- example/ipsec_api/Makefile.am | 24 ++--- example/ipsec_api/odp_ipsec.c | 83 +++++++++++----- example/ipsec_api/odp_ipsec_api_run_ah_in.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_ah_out.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_ah_tun_in.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_ah_tun_out.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_esp_in.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_esp_out.sh | 7 +- example/ipsec_api/odp_ipsec_api_run_esp_tun_in.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_esp_tun_out.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_live.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_router.sh | 2 +- example/ipsec_api/odp_ipsec_api_run_simple.sh | 7 +- example/ipsec_api/odp_ipsec_cache.c | 21 +++++ example/ipsec_api/odp_ipsec_cache.h | 2 + platform/linux-generic/pktio/dpdk.c | 3 + platform/linux-generic/test/Makefile.am | 15 ++- .../linux-generic/test/ipsec/ipsec_api_example.sh | 32 +++++++ platform/linux-generic/test/ipsec/ipsec_example.sh | 32 +++++++ 32 files changed, 321 insertions(+), 102 deletions(-) rename example/ipsec/{odp_ipsec_run_ah_in => odp_ipsec_run_ah_in.sh} (92%) rename example/ipsec/{odp_ipsec_run_ah_out => odp_ipsec_run_ah_out.sh} (92%) rename example/ipsec/{odp_ipsec_run_both_in => odp_ipsec_run_both_in.sh} (93%) rename example/ipsec/{odp_ipsec_run_both_out => odp_ipsec_run_both_out.sh} (93%) rename example/ipsec/{odp_ipsec_run_esp_in => odp_ipsec_run_esp_in.sh} (92%) rename example/ipsec/{odp_ipsec_run_esp_out => odp_ipsec_run_esp_out.sh} (73%) rename example/ipsec/{odp_ipsec_run_live => odp_ipsec_run_live.sh} (95%) rename example/ipsec/{odp_ipsec_run_router => odp_ipsec_run_router.sh} (86%) rename example/ipsec/{odp_ipsec_run_simple => odp_ipsec_run_simple.sh} (63%) create mode 100755 platform/linux-generic/test/ipsec/ipsec_api_example.sh create mode 100755 platform/linux-generic/test/ipsec/ipsec_example.sh
hooks/post-receive