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 6576ed1f000f326a44c636a3e5d832a7a2cfd4f7 (commit) via 5f95fc513d87d46753cf81a5da20b5ff4852eeff (commit) via 4fd6b609766aa741617e3fa443dd5d9c0bb9eb71 (commit) via e9bdfb477cc3c329e443cb8d2ffe5ce6ead7de8b (commit) via 21bdc8b9d58ba5bf0dd3cb569587f4c53edd7ee3 (commit) via 0748e9fc9fcc121ceb4e914870145461cc0a87eb (commit) via 0b511f3fdd3cbea300fa3108c17b1f8fcfe75da4 (commit) via dbaed696a6409093dc9d387c8ea946362b6ce212 (commit) via a4d92554bdb13f7aa3a1ab2ef212f080d5b5abcd (commit) via 1ecf1ddef06e0bb00641f2eb6605c34640c603ff (commit) via c80718ccd7b16d959a08292bc527f9bd66d5d1a2 (commit) via 1065c7735a98611308f7430839a62e8a1fab40da (commit) via 5d002e728f60be318f235cc610b4f1dd631a34ba (commit) via 48f8e6319df988f70bf9efde1cfab76ca4fa4549 (commit) via 47d3ace1c522e193cefb9730d046350817d31ecd (commit) via 0c0a0fc7fba874f14821e096c62b7fbeecd9b25a (commit) via b277ad28d344aa9bb98c26cc84bc071d57559a41 (commit) via b2be0e3688db91640882eb9df24a3a9f43cb3d88 (commit) via ed4270a59273b13619bda3a903fe83bb47ea6087 (commit) via cc7bc42309d5d1bf844af376f13a981cf57cb76b (commit) via 20a76096f5bbc87f545f16be72f766d26d5865c5 (commit) via 8ea3be29a66bd7bfe2776f5117f3c8bac78668ea (commit) via ec16951089de3ed475570d253f1f0b0746304cc9 (commit) via 7b23d26816a334804277a87e5ea93f2958e5a6ec (commit) via 9e1d151f2f308c16ed542a7fa1ab0f0cf1e7a0fc (commit) via d867eedd6987daba2f03f3b036601708969528f1 (commit) via 411a07b61019cece7545fb325cc77a328a657f83 (commit) via 3d1711bc27a819876552e1104a3f2fdfb0760a4e (commit) via 9504a42688ff7242317b0aa4669dff2bf7aa9d93 (commit) via e5f7c8fd4249b11a86715cd31394c73145cc674e (commit) via 3bd31be9ea2f5e96e96a638a081d8223d1734e6c (commit) via 9cd5b915b1b65e4e5fc83dedf9afa7029f1d3274 (commit) via 6afbe90158988dc36e25b1954fe1fe9124ae7df1 (commit) via 48e3615af2cf18136a32b5a0afa0d05303bd4d36 (commit) via 9b11cef7a44294ec094e508f8090d77c2284728e (commit) via 0485bc704a497ca482fe47228d6295fac661d947 (commit) via 7b9a1713a148fffff7095215b661f37ffc2a681b (commit) via ca71292dbadc5959ebcfaeda0c071ed558359b8b (commit) via a89e63bb67bfc163ac67aed49a3e3b733aca8384 (commit) via f9bb28e43836da8183276199f888fb8ee612defa (commit) via 2411cd30bfc38651860fcc0e9f1331c3a37ccfbe (commit) via e49af8a47be1f267a9d0a50066f9b7ba2f8bd774 (commit) via e06d1f6cfb34e13b6a3bc81220f07c1207c04248 (commit) via 97bb0f3801f2f1692a12e24d9aa4fadf0b8ce477 (commit) via 62782960967bd58553139d6b20f91a5849a2c288 (commit) via e6a9fa3c8d910fcc0f31cf5f3334addf3246d482 (commit) via bfc48dbed3d58f7f3325cd0a05445f2ab537c38e (commit) via 59a26fc8cc0be0be0e30144389cfee2e55a88ab2 (commit) via cb5ed2680f28412e72aa59f5769581bdb19d4ebd (commit) from 686811c2f3961f3fb26c862059fb690443567e73 (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 6576ed1f000f326a44c636a3e5d832a7a2cfd4f7 Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Tue Nov 27 18:01:38 2018 +0300
linux-gen: drop performance.m4
performance.m4 which provides --enable-test-perf-proc is not needed now because process mode is tested with standard tests.
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-and-tested-by Matias Elo matias.elo@nokia.com
diff --git a/configure.ac b/configure.ac index 2ce476a6..5dd2e777 100644 --- a/configure.ac +++ b/configure.ac @@ -410,7 +410,6 @@ AC_MSG_RESULT([ with_tests: ${with_tests} test_vald: ${test_vald} test_perf: ${test_perf} - test_perf_proc: ${test_perf_proc} test_cpp: ${test_cpp} test_helper: ${test_helper} test_example: ${test_example} diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index c3aa7396..1dd14cd4 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -20,8 +20,6 @@ m4_include([platform/linux-generic/m4/odp_netmap.m4]) m4_include([platform/linux-generic/m4/odp_dpdk.m4]) ODP_SCHEDULER
-m4_include([platform/linux-generic/m4/performance.m4]) - AC_CONFIG_COMMANDS_PRE([dnl AM_CONDITIONAL([PLATFORM_IS_LINUX_GENERIC], [test "${with_platform}" = "linux-generic"]) diff --git a/platform/linux-generic/m4/performance.m4 b/platform/linux-generic/m4/performance.m4 deleted file mode 100644 index f2e7107c..00000000 --- a/platform/linux-generic/m4/performance.m4 +++ /dev/null @@ -1,10 +0,0 @@ -########################################################################## -# Enable/disable test-perf-proc -########################################################################## -AC_ARG_ENABLE([test-perf-proc], - [AS_HELP_STRING([--enable-test-perf-proc], [run test in test/performance in process mode])], - [test_perf_proc=$enableval], - [test_perf_proc=yes]) -AC_CONFIG_COMMANDS_PRE([dnl -AM_CONDITIONAL([test_perf_proc], [test x$test_perf_proc = xyes ]) -])
commit 5f95fc513d87d46753cf81a5da20b5ff4852eeff Author: Matias Elo matias.elo@nokia.com Date: Mon Nov 26 15:57:33 2018 +0200
example: generator: add signal handler for SIGINT
Free used resources after receiving SIGINT.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index e3d76cb9..1093454c 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -15,6 +15,7 @@ #include <unistd.h> #include <inttypes.h> #include <sys/time.h> +#include <signal.h>
#include <example_debug.h>
@@ -168,6 +169,14 @@ static void usage(char *progname); static int scan_ip(char *buf, unsigned int *paddr); static void print_global_stats(int num_workers);
+static void sig_handler(int signo ODP_UNUSED) +{ + int i; + + for (i = 0; i < args->thread_cnt; i++) + args->thread[i].stop = 1; +} + /** * Scan ip * Parse ip address. @@ -1105,6 +1114,10 @@ int main(int argc, char *argv[]) odp_init_t init_param; odph_odpthread_params_t thr_params;
+ /* Signal handler has to be registered before global init in case ODP + * implementation creates internal threads/processes. */ + signal(SIGINT, sig_handler); + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { diff --git a/test/performance/odp_l2fwd_run.sh b/test/performance/odp_l2fwd_run.sh index 6166c8b2..5745d327 100755 --- a/test/performance/odp_l2fwd_run.sh +++ b/test/performance/odp_l2fwd_run.sh @@ -88,7 +88,7 @@ run_l2fwd() $STDBUF odp_l2fwd${EXEEXT} -i $IF1,$IF2 -m 0 -t 30 -c 2 | tee $LOG ret=$?
- kill ${GEN_PID} + kill -2 ${GEN_PID}
if [ ! -f $LOG ]; then echo "FAIL: $LOG not found" diff --git a/test/performance/odp_sched_pktio_run.sh b/test/performance/odp_sched_pktio_run.sh index db14fb59..1c8d2945 100755 --- a/test/performance/odp_sched_pktio_run.sh +++ b/test/performance/odp_sched_pktio_run.sh @@ -72,7 +72,7 @@ run_sched_pktio() # Run test for 5 sec sleep 5
- kill ${GEN_PID} + kill -2 ${GEN_PID} wait ${GEN_PID}
# Kill with SIGINT to output statistics
commit 4fd6b609766aa741617e3fa443dd5d9c0bb9eb71 Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Mon Nov 26 17:23:28 2018 +0300
text: perf odp_sched_pktio: try to terminate on failure
try to do clean up even if error was detected (try to remove openned files for mmap.)
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 4bc5be7b..878dcad0 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -1548,17 +1548,17 @@ quit:
if (odp_shm_free(shm)) { printf("Error: shm free failed.\n"); - return -1; + ret = -1; }
if (odp_term_local()) { printf("Error: term local failed.\n"); - return -1; + ret = -1; }
if (odp_term_global(instance)) { printf("Error: term global failed.\n"); - return -1; + ret = -1; }
return ret;
commit e9bdfb477cc3c329e443cb8d2ffe5ce6ead7de8b Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Mon Nov 26 17:21:00 2018 +0300
linux-gen: ishm: add missing cast to calculate max_memory
Fix integer overflow doing math for max_memory.
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index eceadd99..875f9f9d 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -1646,7 +1646,7 @@ int _odp_ishm_init_global(const odp_init_t *init)
ODP_DBG("Shm single VA size: %dkB\n", val_kb);
- max_memory = val_kb * 1024; + max_memory = (uint64_t)val_kb * 1024; internal = max_memory / 8;
if (!_odp_libconfig_lookup_ext_int("shm", NULL, "huge_page_limit_kb",
commit 21bdc8b9d58ba5bf0dd3cb569587f4c53edd7ee3 Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Mon Nov 26 12:32:15 2018 +0300
linux-gen: remove performance test for process mode
process mode tests run when process mode config is specified. Here it has to be dropped.
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index f9e9c494..c3aa7396 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -33,6 +33,5 @@ AC_CONFIG_FILES([platform/linux-generic/Makefile platform/linux-generic/test/validation/api/pktio/Makefile platform/linux-generic/test/mmap_vlan_ins/Makefile platform/linux-generic/test/pktio_ipc/Makefile - platform/linux-generic/test/ring/Makefile - platform/linux-generic/test/performance/Makefile]) + platform/linux-generic/test/ring/Makefile]) ]) diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 99934099..03a1474d 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/test/Makefile.inc TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation
-SUBDIRS = performance +SUBDIRS =
if test_vald TESTS = validation/api/pktio/pktio_run.sh \ @@ -9,10 +9,10 @@ TESTS = validation/api/pktio/pktio_run.sh \ validation/api/shmem/shmem_linux$(EXEEXT)
SUBDIRS += validation/api/pktio\ - validation/api/shmem\ - mmap_vlan_ins\ - pktio_ipc\ - ring + validation/api/shmem\ + mmap_vlan_ins\ + pktio_ipc\ + ring
if HAVE_PCAP TESTS += validation/api/pktio/pktio_run_pcap.sh diff --git a/platform/linux-generic/test/performance/.gitignore b/platform/linux-generic/test/performance/.gitignore deleted file mode 100644 index 7e563b8b..00000000 --- a/platform/linux-generic/test/performance/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.log -*.trs diff --git a/platform/linux-generic/test/performance/Makefile.am b/platform/linux-generic/test/performance/Makefile.am deleted file mode 100644 index 0b5da671..00000000 --- a/platform/linux-generic/test/performance/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -include $(top_srcdir)/test/Makefile.inc - -TESTS_ENVIRONMENT += TEST_DIR=${builddir} - -TESTSCRIPTS = odp_scheduling_run_proc.sh - -TEST_EXTENSIONS = .sh - -if test_perf_proc -TESTS = $(TESTSCRIPTS) -endif - -dist_check_SCRIPTS = $(TESTSCRIPTS) diff --git a/platform/linux-generic/test/performance/odp_scheduling_run_proc.sh b/platform/linux-generic/test/performance/odp_scheduling_run_proc.sh deleted file mode 100755 index c16bcb86..00000000 --- a/platform/linux-generic/test/performance/odp_scheduling_run_proc.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2016-2018, Linaro Limited -# All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -# Script that passes command line arguments to odp_scheduling test when -# launched by 'make check' - -TEST_DIR="${TEST_DIR:-$(dirname $0)}" -PERFORMANCE="$TEST_DIR/../../../../test/performance" -ret=0 -ALL=0 - -run() -{ - echo odp_scheduling_run starts requesting $1 worker threads - echo ===================================================== - - $PERFORMANCE/odp_scheduling${EXEEXT} --odph_proc -c $1 || ret=1 -} - -run 1 -run 5 -run 8 -run 11 -run $ALL - -exit $ret
commit 0748e9fc9fcc121ceb4e914870145461cc0a87eb Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Fri Nov 23 22:34:16 2018 +0300
travis: check.sh request huge pages at early start
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org
diff --git a/scripts/ci/check.sh b/scripts/ci/check.sh index 43168680..85cee498 100755 --- a/scripts/ci/check.sh +++ b/scripts/ci/check.sh @@ -1,14 +1,14 @@ #!/bin/bash set -e
-"`dirname "$0"`"/build_x86_64.sh - -cd "$(dirname "$0")"/../.. - echo 1000 | tee /proc/sys/vm/nr_hugepages mkdir -p /mnt/huge mount -t hugetlbfs nodev /mnt/huge
+"`dirname "$0"`"/build_x86_64.sh + +cd "$(dirname "$0")"/../.. + # Ignore possible failures there because these tests depends on measurements # and systems might differ in performance. export CI="true"
commit 0b511f3fdd3cbea300fa3108c17b1f8fcfe75da4 Author: Matias Elo matias.elo@nokia.com Date: Mon Oct 15 13:45:30 2018 +0300
linux-gen: shm: remove single_va configuration option
Process mode is now enabled by setting odp_init_global() parameter odp_init_t.mem_model to ODP_MEM_MODEL_PROCESS.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 8a1eddbd..e00e4a51 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -16,7 +16,7 @@
# Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.5" +config_file_version = "0.1.6"
# Shared memory options shm: { @@ -39,10 +39,6 @@ shm: { # reservations are done using normal pages to conserve memory. huge_page_limit_kb = 64
- # Allocate internal shared memory using a single virtual address space. - # Set to 1 to enable using process mode. - single_va = 0 - # Amount of memory pre-reserved for ODP_SHM_SINGLE_VA usage in kilobytes single_va_size_kb = 131072 } diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index d02e5ee9..eceadd99 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -298,15 +298,8 @@ static void hp_init(void) char filename[ISHM_FILENAME_MAXLEN]; char dir[ISHM_FILENAME_MAXLEN]; int count; - int single_va = 0; void *addr;
- if (_odp_libconfig_lookup_ext_int("shm", NULL, "single_va", - &single_va)) { - odp_global_ro.shm_single_va = single_va; - ODP_DBG("Shm single VA: %d\n", odp_global_ro.shm_single_va); - } - if (!_odp_libconfig_lookup_ext_int("shm", NULL, "num_cached_hp", &count)) { return; diff --git a/platform/linux-generic/test/inline-timer.conf b/platform/linux-generic/test/inline-timer.conf index cc9f2037..6cae241d 100644 --- a/platform/linux-generic/test/inline-timer.conf +++ b/platform/linux-generic/test/inline-timer.conf @@ -1,6 +1,6 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.5" +config_file_version = "0.1.6"
timer: { # Enable inline timer implementation diff --git a/platform/linux-generic/test/process-mode.conf b/platform/linux-generic/test/process-mode.conf index e3e6b55b..fc897494 100644 --- a/platform/linux-generic/test/process-mode.conf +++ b/platform/linux-generic/test/process-mode.conf @@ -1,13 +1,9 @@ # Mandatory fields odp_implementation = "linux-generic" -config_file_version = "0.1.5" +config_file_version = "0.1.6"
# Shared memory options shm: { - # Override default option and allocate internal shms using single - # virtual address space. - single_va = 1 - # Increase the amount of single VA memory single_va_size_kb = 1048576 }
commit dbaed696a6409093dc9d387c8ea946362b6ce212 Author: Matias Elo matias.elo@nokia.com Date: Mon Oct 15 15:27:11 2018 +0300
validation: use use mem_model from helper options
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index 6b9ded4a..4db6c32d 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -79,7 +79,18 @@ int odp_cunit_thread_exit(pthrd_arg *arg)
static int tests_global_init(odp_instance_t *inst) { - if (0 != odp_init_global(inst, NULL, NULL)) { + odp_init_t init_param; + odph_helper_options_t helper_options; + + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/atomic/atomic.c b/test/validation/api/atomic/atomic.c index a755aef9..9530df9c 100644 --- a/test/validation/api/atomic/atomic.c +++ b/test/validation/api/atomic/atomic.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -554,8 +555,18 @@ static int atomic_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/barrier/barrier.c b/test/validation/api/barrier/barrier.c index a3be4be4..806f2486 100644 --- a/test/validation/api/barrier/barrier.c +++ b/test/validation/api/barrier/barrier.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -329,8 +330,18 @@ static int barrier_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 76215bc2..b2f599ec 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -7,6 +7,7 @@ #include "config.h"
#include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include "test_vectors.h" @@ -2033,8 +2034,18 @@ static int crypto_init(odp_instance_t *inst) odp_queue_t out_queue; odp_pool_capability_t pool_capa; odp_crypto_capability_t crypto_capa; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index f10c4c29..f82c561a 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -910,8 +910,18 @@ int ipsec_init(odp_instance_t *inst) odp_queue_t out_queue; odp_pool_capability_t pool_capa; odp_pktio_t pktio; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/lock/lock.c b/test/validation/api/lock/lock.c index 67e1e3c8..b8502f01 100644 --- a/test/validation/api/lock/lock.c +++ b/test/validation/api/lock/lock.c @@ -8,6 +8,7 @@
#include <malloc.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> #include <CUnit/Basic.h> #include <odp_cunit_common.h> #include <unistd.h> @@ -1163,8 +1164,18 @@ static int lock_init(odp_instance_t *inst) uint32_t workers_count, max_threads; int ret = 0; odp_cpumask_t mask; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c index d977f977..7b40cda6 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread/thread.c @@ -7,6 +7,7 @@ #include "config.h"
#include <odp_api.h> +#include <odp/helper/odph_api.h> #include <odp_cunit_common.h> #include <mask_common.h> #include <test_debug.h> @@ -24,8 +25,18 @@ static global_shared_mem_t *global_mem; static int thread_global_init(odp_instance_t *inst) { odp_shm_t global_shm; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; } diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index eb8df665..72294c5c 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -61,8 +61,18 @@ static global_shared_mem_t *global_mem; static int timer_global_init(odp_instance_t *inst) { odp_shm_t global_shm; + odp_init_t init_param; + odph_helper_options_t helper_options;
- if (0 != odp_init_global(inst, NULL, NULL)) { + if (odph_options(&helper_options)) { + fprintf(stderr, "error: odph_options() failed.\n"); + return -1; + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (0 != odp_init_global(inst, &init_param, NULL)) { fprintf(stderr, "error: odp_init_global() failed.\n"); return -1; }
commit a4d92554bdb13f7aa3a1ab2ef212f080d5b5abcd Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 15:51:07 2018 +0300
example: use mem_model from helper options
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 22dae395..43d40c53 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -468,6 +468,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -481,10 +482,21 @@ int main(int argc, char *argv[]) odp_shm_t shm; int ret; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -802,9 +814,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:t:i:p:m:t:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* Use one worker by default */
while (1) { diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 54194c66..e3d76cb9 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1090,6 +1090,7 @@ static void print_global_stats(int num_workers) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -1101,10 +1102,21 @@ int main(int argc, char *argv[]) odp_pool_param_t params; interface_t *ifs; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1424,9 +1436,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:j:f:k" ":yr:z";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->mode = -1; /* Invalid, must be changed by parsing */ appl_args->number = -1; appl_args->payload = 56; diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index b45a82d7..52ccce22 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1186,6 +1186,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; @@ -1195,6 +1196,7 @@ main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
/* create by default scheduled queues */ @@ -1207,8 +1209,18 @@ main(int argc, char *argv[]) schedule = polled_odp_schedule_cb; }
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1402,9 +1414,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:i:m:h:r:p:a:e:t:s:";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - printf("\nParsing command line options\n");
appl_args->cpu_count = 1; /* use one worker by default */ diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index d72109cf..fb0d9049 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -885,6 +885,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; @@ -894,6 +895,7 @@ main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
/* create by default scheduled queues */ @@ -906,8 +908,18 @@ main(int argc, char *argv[]) schedule = polled_odp_schedule_cb; }
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1103,9 +1115,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:i:h:lm:r:p:a:e:t:s:";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */
printf("\nParsing command line options\n"); diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index 8daeec4c..f7e7ba53 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -139,17 +139,29 @@ static int run_worker(void *arg ODP_UNUSED)
int main(int argc, char **argv) { + odph_helper_options_t helper_options; odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; odph_odpthread_t thd[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odph_ethaddr_t correct_src; uint32_t mtu1, mtu2; odp_shm_t shm;
- if (odp_init_global(&instance, NULL, NULL)) { + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (odp_init_global(&instance, &init_param, NULL)) { printf("Error: ODP global init failed.\n"); exit(1); } @@ -171,9 +183,6 @@ int main(int argc, char **argv) memset(global, 0, sizeof(global_data_t)); global->shm = shm;
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - if (argc > 7 || odph_eth_addr_parse(&global->dst, argv[3]) != 0 || odph_eth_addr_parse(&global->src, argv[4]) != 0) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 9d96dd2c..e73e903c 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -343,6 +343,7 @@ static int pktio_ifburst_thread(void *arg) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int num_workers; @@ -352,11 +353,22 @@ int main(int argc, char *argv[]) char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { EXAMPLE_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -582,9 +594,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:i:+m:t:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */ appl_args->mode = APPL_MODE_PKT_SCHED; appl_args->time = 0; /**< loop forever */ diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index a67fa180..a0162145 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -758,9 +758,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:+t:+a:i:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->cpu_count = 1; /* use one worker by default */ appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 10; /* get and print pps stats second */ @@ -870,6 +867,7 @@ static void gbl_args_init(args_t *args)
int main(int argc, char **argv) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int i, j; int cpu; @@ -882,10 +880,21 @@ int main(int argc, char **argv) stats_t (*stats)[MAX_PKTIOS]; int if_count; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { printf("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 317f9a27..6c56d6c6 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -254,16 +254,25 @@ int main(int argc, char *argv[]) odp_shm_t shm_glbls = ODP_SHM_INVALID; odp_shm_t shm_log = ODP_SHM_INVALID; int log_size, log_enries_num; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params;
- /* let helper collect its own arguments (e.g. --odph_proc) */ + printf("\nODP global time test starts\n"); + + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + }
- printf("\nODP global time test starts\n"); + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model;
- if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { err = 1; EXAMPLE_ERR("ODP global init failed.\n"); goto end; diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 9e431b47..192a61d3 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -274,9 +274,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:r:m:x:p:t:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - /* defaults */ odp_timer_capability(ODP_CLOCK_CPU, &timer_capa);
@@ -334,6 +331,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; int num_workers; odp_queue_t queue; @@ -345,6 +343,7 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm = ODP_SHM_INVALID; test_globals_t *gbls = NULL; @@ -352,7 +351,17 @@ int main(int argc, char *argv[])
printf("\nODP timer example starts\n");
- if (odp_init_global(&instance, NULL, NULL)) { + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (odp_init_global(&instance, &init_param, NULL)) { err = 1; printf("ODP global init failed.\n"); goto err_global;
commit 1ecf1ddef06e0bb00641f2eb6605c34640c603ff Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 16:14:26 2018 +0300
test: performance: use mem_model from helper options
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c index faa51dad..75ea0a7a 100644 --- a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c +++ b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c @@ -135,14 +135,20 @@ int main(int argc, char **argv) odp_pool_t pool; odp_pool_param_t params; odp_cpumask_t cpumask; + odph_helper_options_t helper_options; odph_odpthread_t thd[MAX_WORKERS]; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_shm_t shm; int ret;
- /* let helper collect its own arguments (e.g. --odph_proc) */ + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + }
if (argc < 3) { printf("Too few arguments (%i).\n" @@ -150,7 +156,10 @@ int main(int argc, char **argv) exit(0); }
- if (odp_init_global(&instance, NULL, NULL)) { + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + + if (odp_init_global(&instance, &init_param, NULL)) { printf("Error: ODP global init failed.\n"); exit(1); } diff --git a/test/performance/odp_bench_packet.c b/test/performance/odp_bench_packet.c index a4493139..9b779e98 100644 --- a/test/performance/odp_bench_packet.c +++ b/test/performance/odp_bench_packet.c @@ -1315,9 +1315,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "b:i:h";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->bench_idx = 0; /* Run all benchmarks */ appl_args->burst_size = TEST_DEF_BURST;
@@ -1511,6 +1508,7 @@ bench_info_t test_suite[] = { */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t worker_thread; int cpu; odp_shm_t shm; @@ -1519,11 +1517,22 @@ int main(int argc, char *argv[]) odp_pool_capability_t capa; odp_pool_param_t params; odp_instance_t instance; + odp_init_t init_param; uint32_t pkt_num; uint8_t ret;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index 196af346..402ab4a1 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -382,9 +382,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+a:+c:+l:+t:h";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->accuracy = 1; /* Get and print pps stats second */ appl_args->cpu_count = 1; appl_args->lookup_tbl_size = DEF_LOOKUP_TBL_SIZE; @@ -524,6 +521,7 @@ static void gbl_args_init(args_t *args) int main(int argc, char *argv[]) { stats_t *stats[MAX_WORKERS]; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_cpumask_t cpumask; odp_pool_capability_t pool_capa; @@ -546,6 +544,13 @@ int main(int argc, char *argv[]) int cpu; int ret = 0;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + odp_init_param_init(&init);
/* List features not to be used (may optimize performance) */ @@ -555,6 +560,8 @@ int main(int argc, char *argv[]) init.not_used.feat.timer = 1; init.not_used.feat.tm = 1;
+ init.mem_model = helper_options.mem_model; + /* Signal handler has to be registered before global init in case ODP * implementation creates internal threads/processes. */ signal(SIGINT, sig_handler); diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index 61da80e8..d175bb7e 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -1033,20 +1033,32 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; int num_workers = 1; + odph_helper_options_t helper_options; odph_odpthread_t thr[num_workers]; odp_instance_t instance; + odp_init_t init_param; odp_pool_capability_t pool_capa; odp_crypto_capability_t crypto_capa; uint32_t max_seg_len; unsigned i;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + app_err("Reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&cargs, 0, sizeof(cargs));
/* Parse and store the application arguments */ parse_args(argc, argv, &cargs);
/* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { app_err("ODP global init failed.\n"); exit(EXIT_FAILURE); } @@ -1196,9 +1208,6 @@ static void parse_args(int argc, char *argv[], crypto_args_t *cargs)
static const char *shortopts = "+a:c:df:hi:m:nl:spr";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - cargs->in_place = 0; cargs->in_flight = 1; cargs->debug_packets = 0; diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c index 2184c7a9..5a5824e8 100644 --- a/test/performance/odp_ipsec.c +++ b/test/performance/odp_ipsec.c @@ -936,9 +936,6 @@ static void parse_args(int argc, char *argv[], ipsec_args_t *cargs)
static const char *shortopts = "+a:c:df:hi:m:nl:sptu";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - cargs->in_place = 0; cargs->in_flight = 1; cargs->debug_packets = 0; @@ -1020,20 +1017,32 @@ int main(int argc, char *argv[]) odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; int num_workers = 1; + odph_helper_options_t helper_options; odph_odpthread_t thr[num_workers]; odp_instance_t instance; + odp_init_t init_param; odp_pool_capability_t capa; odp_ipsec_config_t config; uint32_t max_seg_len; unsigned int i;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + app_err("Reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&cargs, 0, sizeof(cargs));
/* Parse and store the application arguments */ parse_args(argc, argv, &cargs);
/* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { app_err("ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index e1eddb13..c9243184 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1184,9 +1184,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:+t:+a:i:m:o:r:d:s:e:k:g:vh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 1; /* get and print pps stats second */ appl_args->cpu_count = 1; /* use one worker by default */ @@ -1428,6 +1425,7 @@ static void create_groups(int num, odp_schedule_group_t *group) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; odp_pool_t pool; int i; @@ -1449,6 +1447,13 @@ int main(int argc, char *argv[]) odp_pool_capability_t pool_capa; uint32_t pkt_len, pkt_num;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + odp_init_param_init(&init);
/* List features not to be used (may optimize performance) */ @@ -1458,6 +1463,8 @@ int main(int argc, char *argv[]) init.not_used.feat.timer = 1; init.not_used.feat.tm = 1;
+ init.mem_model = helper_options.mem_model; + /* Signal handler has to be registered before global init in case ODP * implementation creates internal threads/processes. */ signal(SIGINT, sig_handler); diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index faf41b02..2e0ff578 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -866,9 +866,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static const char *shortopts = "+c:+t:+a:i:m:d:r:f:e:h";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = DEF_STATS_INT; appl_args->cpu_count = 1; /* use one worker by default */ @@ -1060,12 +1057,14 @@ int main(int argc, char *argv[]) { odp_cpumask_t cpumask; odp_instance_t instance; + odp_init_t init_param; odp_pool_t pool; odp_pool_param_t params; odp_shm_t shm; odp_queue_capability_t queue_capa; odp_pool_capability_t pool_capa; odph_ethaddr_t new_addr; + odph_helper_options_t helper_options; odph_odpthread_t thread_tbl[MAX_WORKERS]; stats_t *stats; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; @@ -1077,8 +1076,18 @@ int main(int argc, char *argv[]) int in_mode; uint32_t queue_size, pool_size;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 7e8a03ee..b86d437e 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -957,9 +957,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:t:b:pR:l:r:i:d:vh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 2; args->num_tx_workers = 0; /* defaults to cpu_count+1/2 */ args->tx_batch_len = BATCH_LEN_MAX; @@ -1040,9 +1037,21 @@ int main(int argc, char **argv) int ret; odp_shm_t shm; int max_thrs; + odph_helper_options_t helper_options; odp_instance_t instance; + odp_init_t init_param; + + /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model;
- if (odp_init_global(&instance, NULL, NULL) != 0) + if (odp_init_global(&instance, &init_param, NULL) != 0) LOG_ABORT("Failed global init.\n");
if (odp_init_local(instance, ODP_THREAD_CONTROL) != 0) diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index 873738ef..b6299141 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -549,9 +549,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:s:l:t:m:n:o:p:rh";
- /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 1; args->sync_type = ODP_SCHED_SYNC_PARALLEL; args->sample_per_prio = SAMPLE_EVENT_PER_PRIO; @@ -637,6 +634,8 @@ static void parse_args(int argc, char *argv[], test_args_t *args) int main(int argc, char *argv[]) { odp_instance_t instance; + odp_init_t init_param; + odph_helper_options_t helper_options; odph_odpthread_t *thread_tbl; odph_odpthread_params_t thr_params; odp_cpumask_t cpumask; @@ -654,11 +653,21 @@ int main(int argc, char *argv[])
printf("\nODP scheduling latency benchmark starts\n\n");
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&args, 0, sizeof(args)); parse_args(argc, argv, &args);
/* ODP global init */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("ODP global init failed.\n"); return -1; } diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index 82f74422..4bc5be7b 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -578,9 +578,6 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options) test_options->burst_size = 32; test_options->pipe_queue_size = 256;
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - while (1) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -1431,10 +1428,18 @@ int main(int argc, char *argv[]) odp_init_t init; odp_shm_t shm; odp_time_t t1, t2; + odph_helper_options_t helper_options; odph_odpthread_t thread[MAX_WORKERS]; test_options_t test_options; int ret = 0;
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + printf("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + signal(SIGINT, sig_handler);
if (parse_options(argc, argv, &test_options)) @@ -1451,6 +1456,8 @@ int main(int argc, char *argv[]) if (test_options.timeout_us) init.not_used.feat.timer = 0;
+ init.mem_model = helper_options.mem_model; + /* Init ODP before calling anything else */ if (odp_init_global(&instance, &init, NULL)) { printf("Error: Global init failed.\n"); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index 5eeb6926..acc401e0 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -762,9 +762,6 @@ static void parse_args(int argc, char *argv[], test_args_t *args)
static const char *shortopts = "+c:fh";
- /* let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - args->cpu_count = 1; /* use one worker by default */
while (1) { @@ -798,6 +795,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_t *thread_tbl; test_args_t args; int num_workers; @@ -811,6 +809,7 @@ int main(int argc, char *argv[]) odp_pool_param_t params; int ret = 0; odp_instance_t instance; + odp_init_t init_param; odph_odpthread_params_t thr_params; odp_queue_capability_t capa; odp_pool_capability_t pool_capa; @@ -818,11 +817,21 @@ int main(int argc, char *argv[])
printf("\nODP example starts\n\n");
+ /* Let helper collect its own arguments (e.g. --odph_proc) */ + argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + LOG_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model; + memset(&args, 0, sizeof(args)); parse_args(argc, argv, &args);
/* ODP global init */ - if (odp_init_global(&instance, NULL, NULL)) { + if (odp_init_global(&instance, &init_param, NULL)) { LOG_ERR("ODP global init failed.\n"); return -1; }
commit c80718ccd7b16d959a08292bc527f9bd66d5d1a2 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:02:05 2018 +0300
helper: test: add test for new odph_options() function
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index ad48ec2d..55db37e0 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -64,18 +64,27 @@ static int worker_fn(void *arg ODPH_UNUSED) /* Create additional dataplane opdthreads */ int main(int argc, char *argv[]) { + odph_helper_options_t helper_options; odph_odpthread_params_t thr_params; odph_odpthread_t thread_tbl[NUMBER_WORKERS]; odp_cpumask_t cpu_mask; + odp_init_t init_param; int num_workers; int cpu, affinity; int ret; char cpumaskstr[ODP_CPUMASK_STR_SIZE];
- /* let helper collect its own arguments (e.g. --odph_proc) */ + /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); + if (odph_options(&helper_options)) { + ODPH_ERR("Error: reading ODP helper options failed.\n"); + exit(EXIT_FAILURE); + } + + odp_init_param_init(&init_param); + init_param.mem_model = helper_options.mem_model;
- if (odp_init_global(&odp_instance, NULL, NULL)) { + if (odp_init_global(&odp_instance, &init_param, NULL)) { ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
commit 1065c7735a98611308f7430839a62e8a1fab40da Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 10:43:34 2018 +0300
helper: threads: add odph_options() getter function
Add function for reading parsed linux helper options.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index f4e8a785..6cee2522 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -88,6 +88,11 @@ typedef struct { }; } odph_odpthread_t;
+/** Linux helper options */ +typedef struct { + odp_mem_model_t mem_model; /**< Process or thread */ +} odph_helper_options_t; + /** * Creates and launches odpthreads (as linux threads or processes) * @@ -153,6 +158,18 @@ int odph_odpthread_getaffinity(void); */ int odph_parse_options(int argc, char *argv[]);
+/** + * Get linux helper options + * + * Return used ODP helper options. odph_parse_options() must be called before + * using this function. + * + * @param[out] options ODP helper options + * + * @return 0 on success, -1 on failure + */ +int odph_options(odph_helper_options_t *options); + /** * @} */ diff --git a/helper/threads.c b/helper/threads.c index 1e03ce02..01bc33ea 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -23,9 +23,7 @@
#define FAILED_CPU -1
-static struct { - int proc; /* true when process mode is required, false otherwise */ -} helper_options; +static odph_helper_options_t helper_options;
/* * wrapper for odpthreads, either implemented as linux threads or processes. @@ -181,7 +179,7 @@ int odph_odpthreads_create(odph_odpthread_t *thread_tbl,
cpu = odp_cpumask_first(mask); for (i = 0; i < num; i++) { - if (!helper_options.proc) { + if (helper_options.mem_model == ODP_MEM_MODEL_THREAD) { if (odph_linux_thread_create(&thread_tbl[i], cpu, thr_params)) @@ -330,19 +328,19 @@ int odph_parse_options(int argc, char *argv[]) char *env; int i, j;
- helper_options.proc = 0; + helper_options.mem_model = ODP_MEM_MODEL_THREAD;
/* Enable process mode using environment variable. Setting environment * variable is easier for CI testing compared to command line * argument. */ env = getenv("ODPH_PROC_MODE"); if (env && atoi(env)) - helper_options.proc = 1; + helper_options.mem_model = ODP_MEM_MODEL_PROCESS;
/* Find and remove option */ for (i = 0; i < argc;) { if (strcmp(argv[i], "--odph_proc") == 0) { - helper_options.proc = 1; + helper_options.mem_model = ODP_MEM_MODEL_PROCESS;
for (j = i; j < argc - 1; j++) argv[j] = argv[j + 1]; @@ -356,3 +354,12 @@ int odph_parse_options(int argc, char *argv[])
return argc; } + +int odph_options(odph_helper_options_t *options) +{ + memset(options, 0, sizeof(odph_helper_options_t)); + + options->mem_model = helper_options.mem_model; + + return 0; +}
commit 5d002e728f60be318f235cc610b4f1dd631a34ba Author: Matias Elo matias.elo@nokia.com Date: Thu Oct 11 17:00:27 2018 +0300
helper: threads: replace odph_linux_thread_type_t with odp_mem_model_t
Replace enum odph_odpthread_linuxtype_t with odp_mem_model_t.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index 9d03c719..f4e8a785 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -54,13 +54,6 @@ typedef struct { int status; /**< Process state change status */ } odph_linux_process_t;
-/** odpthread linux type: whether an ODP thread is a linux thread or process */ -typedef enum odph_odpthread_linuxtype_e { - ODPTHREAD_NOT_STARTED = 0, - ODPTHREAD_PROCESS, - ODPTHREAD_PTHREAD -} odph_odpthread_linuxtype_t; - /** odpthread parameters for odp threads (pthreads and processes) */ typedef struct { int (*start)(void *); /**< Thread entry point function */ @@ -71,7 +64,7 @@ typedef struct {
/** The odpthread starting arguments, used both in process or thread mode */ typedef struct { - odph_odpthread_linuxtype_t linuxtype; /**< process or pthread */ + odp_mem_model_t mem_model; /**< process or thread */ odph_odpthread_params_t thr_params; /**< odpthread start parameters */ } odph_odpthread_start_args_t;
diff --git a/helper/threads.c b/helper/threads.c index f1f63875..1e03ce02 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -21,6 +21,8 @@ #include <odp/helper/threads.h> #include "odph_debug.h"
+#define FAILED_CPU -1 + static struct { int proc; /* true when process mode is required, false otherwise */ } helper_options; @@ -42,7 +44,7 @@ static void *_odph_thread_run_start_routine(void *arg) /* ODP thread local init */ if (odp_init_local(thr_params->instance, thr_params->thr_type)) { ODPH_ERR("Local init failed\n"); - if (start_args->linuxtype == ODPTHREAD_PROCESS) + if (start_args->mem_model == ODP_MEM_MODEL_PROCESS) _exit(EXIT_FAILURE); return (void *)-1; } @@ -50,7 +52,7 @@ static void *_odph_thread_run_start_routine(void *arg) ODPH_DBG("helper: ODP %s thread started as linux %s. (pid=%d)\n", thr_params->thr_type == ODP_THREAD_WORKER ? "worker" : "control", - (start_args->linuxtype == ODPTHREAD_PTHREAD) ? + (start_args->mem_model == ODP_MEM_MODEL_THREAD) ? "pthread" : "process", (int)getpid());
@@ -61,7 +63,7 @@ static void *_odph_thread_run_start_routine(void *arg) ODPH_ERR("Local term failed\n");
/* for process implementation of odp threads, just return status... */ - if (start_args->linuxtype == ODPTHREAD_PROCESS) + if (start_args->mem_model == ODP_MEM_MODEL_PROCESS) _exit(status);
/* threads implementation return void* pointers: cast status to that. */ @@ -81,14 +83,14 @@ static int _odph_linux_process_create(odph_odpthread_t *thread_tbl, CPU_ZERO(&cpu_set); CPU_SET(cpu, &cpu_set);
- thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.linuxtype = ODPTHREAD_PROCESS; + thread_tbl->start_args.thr_params = *thr_params; /* copy */ + thread_tbl->start_args.mem_model = ODP_MEM_MODEL_PROCESS; thread_tbl->cpu = cpu;
pid = fork(); if (pid < 0) { ODPH_ERR("fork() failed\n"); - thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; + thread_tbl->cpu = FAILED_CPU; return -1; }
@@ -136,8 +138,8 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, pthread_attr_setaffinity_np(&thread_tbl->thread.attr, sizeof(cpu_set_t), &cpu_set);
- thread_tbl->start_args.thr_params = *thr_params; /* copy */ - thread_tbl->start_args.linuxtype = ODPTHREAD_PTHREAD; + thread_tbl->start_args.thr_params = *thr_params; /* copy */ + thread_tbl->start_args.mem_model = ODP_MEM_MODEL_THREAD;
ret = pthread_create(&thread_tbl->thread.thread_id, &thread_tbl->thread.attr, @@ -145,7 +147,7 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, &thread_tbl->start_args); if (ret != 0) { ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); - thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; + thread_tbl->cpu = FAILED_CPU; return ret; }
@@ -215,9 +217,13 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl)
/* joins linux threads or wait for processes */ do { + if (thread_tbl[i].cpu == FAILED_CPU) { + ODPH_DBG("ODP thread %d not started.\n", i); + continue; + } /* pthreads: */ - switch (thread_tbl[i].start_args.linuxtype) { - case ODPTHREAD_PTHREAD: + if (thread_tbl[i].start_args.mem_model == + ODP_MEM_MODEL_THREAD) { /* Wait thread to exit */ ret = pthread_join(thread_tbl[i].thread.thread_id, &thread_ret); @@ -234,10 +240,7 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl) } } pthread_attr_destroy(&thread_tbl[i].thread.attr); - break; - - case ODPTHREAD_PROCESS: - + } else { /* processes: */ pid = waitpid(thread_tbl[i].proc.pid, &status, 0);
@@ -263,16 +266,7 @@ int odph_odpthreads_join(odph_odpthread_t *thread_tbl) signo, strsignal(signo), (int)pid); retval = -1; } - break; - - case ODPTHREAD_NOT_STARTED: - ODPH_DBG("No join done on not started ODPthread.\n"); - break; - default: - ODPH_DBG("Invalid case statement value!\n"); - break; } - } while (!thread_tbl[i++].last);
return (retval < 0) ? retval : terminated;
commit 48f8e6319df988f70bf9efde1cfab76ca4fa4549 Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:40:33 2018 +0300
validation: init: add test for odp_init_t.mem_model
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/init/init_main_ok.c b/test/validation/api/init/init_main_ok.c index a97db8e7..651989ae 100644 --- a/test/validation/api/init/init_main_ok.c +++ b/test/validation/api/init/init_main_ok.c @@ -14,8 +14,12 @@ static void init_test_odp_init_global(void) { int status; odp_instance_t instance; + odp_init_t init_data;
- status = odp_init_global(&instance, NULL, NULL); + odp_init_param_init(&init_data); + init_data.mem_model = ODP_MEM_MODEL_THREAD; + + status = odp_init_global(&instance, &init_data, NULL); CU_ASSERT_FATAL(status == 0);
status = odp_term_global(instance);
commit 47d3ace1c522e193cefb9730d046350817d31ecd Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 13:07:29 2018 +0300
linux-gen: init: use new odp_init_t.mem_model parameter
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 132ada03..9e648075 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -275,6 +275,8 @@ int odp_init_global(odp_instance_t *instance, odp_global_ro.log_fn = params->log_fn; if (params->abort_fn != NULL) odp_global_ro.abort_fn = params->abort_fn; + if (params->mem_model == ODP_MEM_MODEL_PROCESS) + odp_global_ro.shm_single_va = 1; }
if (_odp_libconfig_init_global()) {
commit 0c0a0fc7fba874f14821e096c62b7fbeecd9b25a Author: Matias Elo matias.elo@nokia.com Date: Fri Oct 12 11:08:34 2018 +0300
api: init: add new mem_model member to odp_init_t
Add new odp_mem_model_t enum for configuring application memory model. This enables an application to operate in process mode without the need to modify ODP configuration file.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index ee33e7cd..c37af464 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -106,6 +106,32 @@ typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...); /** Replaceable abort function */ typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
+/** + * Application memory model + */ +typedef enum { + /** Thread memory model: by default all memory is shareable between + * threads. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data may be shared amongst threads independent of data + * allocation time (e.g. before or after thread creation). */ + ODP_MEM_MODEL_THREAD = 0, + + /** Process memory model: by default all memory is not shareable between + * processes. + * + * Within a single ODP instance all ODP handles and pointers to ODP + * allocated data (excluding non-single VA SHM blocks) may be shared + * amongst processes independent of data allocation time (e.g. before + * or after fork). + * + * @see ODP_SHM_SINGLE_VA + */ + ODP_MEM_MODEL_PROCESS + +} odp_mem_model_t; + /** * Global initialization parameters * @@ -172,6 +198,12 @@ typedef struct odp_init_t { */ odp_feature_t not_used;
+ /** Application memory model. The main application thread has to call + * odp_init_global() and odp_init_local() before creating threads that + * share ODP data. The default value is ODP_MEM_MODEL_THREAD. + */ + odp_mem_model_t mem_model; + /** Shared memory parameters */ struct { /** Maximum memory usage in bytes. This is the maximum
commit b277ad28d344aa9bb98c26cc84bc071d57559a41 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Nov 8 14:29:17 2018 +0200
validation: sched: add test case for wait and no_wait
Added a test case for the new odp_schedule_multi_wait() and _no_wait() functions.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 63ceb6ea..2f66f526 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -291,6 +291,114 @@ static void scheduler_test_queue_destroy(void) CU_ASSERT_FATAL(odp_pool_destroy(p) == 0); }
+static void scheduler_test_wait(void) +{ + odp_pool_t p; + odp_pool_param_t pool_param; + odp_queue_param_t queue_param; + odp_queue_t queue, from; + odp_buffer_t buf; + odp_event_t ev; + uint32_t *u32; + uint32_t i, j, num_enq, retry; + int ret; + uint32_t num_ev = 50; + uint32_t num_retry = 1000; + + odp_pool_param_init(&pool_param); + pool_param.buf.size = 10; + pool_param.buf.num = num_ev; + pool_param.type = ODP_POOL_BUFFER; + + p = odp_pool_create("sched_test_wait", &pool_param); + + CU_ASSERT_FATAL(p != ODP_POOL_INVALID); + + odp_queue_param_init(&queue_param); + queue_param.type = ODP_QUEUE_TYPE_SCHED; + queue_param.sched.prio = odp_schedule_default_prio(); + queue_param.sched.sync = ODP_SCHED_SYNC_PARALLEL; + queue_param.sched.group = ODP_SCHED_GROUP_ALL; + + queue = odp_queue_create("sched_test_wait", &queue_param); + + CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); + + for (i = 0; i < 4; i++) { + num_enq = 0; + + for (j = 0; j < num_ev; j++) { + buf = odp_buffer_alloc(p); + + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + + u32 = odp_buffer_addr(buf); + u32[0] = MAGIC; + + ev = odp_buffer_to_event(buf); + if (!(CU_ASSERT(odp_queue_enq(queue, ev) == 0))) { + odp_buffer_free(buf); + continue; + } + + num_enq++; + } + + CU_ASSERT(num_enq == num_ev); + + for (j = 0; j < num_enq; j++) { + if (i == 0) { + ev = odp_schedule(&from, ODP_SCHED_WAIT); + } else if (i == 1) { + ret = odp_schedule_multi_wait(&from, &ev, 1); + CU_ASSERT_FATAL(ret == 1); + } else if (i == 2) { + retry = 0; + do { + ev = odp_schedule(&from, + ODP_SCHED_NO_WAIT); + retry++; + } while (ev == ODP_EVENT_INVALID && + retry < num_retry); + } else { + retry = 0; + do { + ret = odp_schedule_multi_no_wait(&from, + &ev, + 1); + retry++; + } while (ret == 0 && retry < num_retry); + CU_ASSERT_FATAL(ret == 1); + } + + CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); + CU_ASSERT(from == queue); + + buf = odp_buffer_from_event(ev); + u32 = odp_buffer_addr(buf); + + CU_ASSERT(u32[0] == MAGIC); + + odp_buffer_free(buf); + } + } + + /* Make sure that scheduler is empty */ + retry = 0; + do { + ret = odp_schedule_multi_no_wait(NULL, &ev, 1); + CU_ASSERT(ret == 0 || ret == 1); + + if (ret) + odp_event_free(ev); + else + retry++; + } while (ret || retry < num_retry); + + CU_ASSERT_FATAL(odp_queue_destroy(queue) == 0); + CU_ASSERT_FATAL(odp_pool_destroy(p) == 0); +} + static void scheduler_test_queue_size(void) { odp_queue_capability_t queue_capa; @@ -1844,6 +1952,7 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_wait_time), ODP_TEST_INFO(scheduler_test_num_prio), ODP_TEST_INFO(scheduler_test_queue_destroy), + ODP_TEST_INFO(scheduler_test_wait), ODP_TEST_INFO(scheduler_test_queue_size), ODP_TEST_INFO(scheduler_test_groups), ODP_TEST_INFO(scheduler_test_pause_resume),
commit b2be0e3688db91640882eb9df24a3a9f43cb3d88 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Nov 6 16:27:44 2018 +0200
linux-gen: sched: implement wait and no_wait functions
Implemented the new odp_schedule_multi_wait() and _no_wait() functions.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 8c00f922..5f7f2c4d 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -89,9 +89,14 @@ void sched_cb_pktio_stop_finalize(int pktio_index);
/* API functions */ typedef struct { - uint64_t (*schedule_wait_time)(uint64_t); - odp_event_t (*schedule)(odp_queue_t *, uint64_t); - int (*schedule_multi)(odp_queue_t *, uint64_t, odp_event_t [], int); + uint64_t (*schedule_wait_time)(uint64_t ns); + odp_event_t (*schedule)(odp_queue_t *from, uint64_t wait); + int (*schedule_multi)(odp_queue_t *from, uint64_t wait, + odp_event_t events[], int num); + int (*schedule_multi_wait)(odp_queue_t *from, odp_event_t events[], + int num); + int (*schedule_multi_no_wait)(odp_queue_t *from, odp_event_t events[], + int num); void (*schedule_pause)(void); void (*schedule_resume)(void); void (*schedule_release_atomic)(void); diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 3ce25147..0b226e4f 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -1163,6 +1163,14 @@ static inline int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], return 0; }
+static inline int schedule_run(odp_queue_t *out_queue, odp_event_t out_ev[], + unsigned int max_num) +{ + timer_run(1); + + return do_schedule(out_queue, out_ev, max_num); +} + static inline int schedule_loop(odp_queue_t *out_queue, uint64_t wait, odp_event_t out_ev[], unsigned int max_num) { @@ -1216,6 +1224,24 @@ static int schedule_multi(odp_queue_t *out_queue, uint64_t wait, return schedule_loop(out_queue, wait, events, num); }
+static int schedule_multi_no_wait(odp_queue_t *out_queue, odp_event_t events[], + int num) +{ + return schedule_run(out_queue, events, num); +} + +static int schedule_multi_wait(odp_queue_t *out_queue, odp_event_t events[], + int num) +{ + int ret; + + do { + ret = schedule_run(out_queue, events, num); + } while (ret == 0); + + return ret; +} + static inline void order_lock(void) { if (sched_local.sync_ctx != ODP_SCHED_SYNC_ORDERED) @@ -1551,6 +1577,8 @@ const schedule_api_t schedule_basic_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic, diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 084dced6..4d50a13f 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -41,6 +41,16 @@ int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], return sched_api->schedule_multi(from, wait, events, num); }
+int odp_schedule_multi_wait(odp_queue_t *from, odp_event_t events[], int num) +{ + return sched_api->schedule_multi_wait(from, events, num); +} + +int odp_schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], int num) +{ + return sched_api->schedule_multi_no_wait(from, events, num); +} + void odp_schedule_pause(void) { return sched_api->schedule_pause(); diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 05e28532..957398ca 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -1341,6 +1341,18 @@ static odp_event_t schedule(odp_queue_t *from, uint64_t wait) return ev; }
+static int schedule_multi_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_WAIT, events, max_num); +} + +static int schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_NO_WAIT, events, max_num); +} + static void schedule_pause(void) { sched_ts->pause = true; @@ -2117,6 +2129,8 @@ const schedule_api_t schedule_scalable_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic, diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 055ee35f..f55e2151 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -646,6 +646,18 @@ static odp_event_t schedule(odp_queue_t *from, uint64_t wait) return ODP_EVENT_INVALID; }
+static int schedule_multi_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_WAIT, events, max_num); +} + +static int schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int max_num) +{ + return schedule_multi(from, ODP_SCHED_NO_WAIT, events, max_num); +} + static void schedule_pause(void) { sched_local.pause = 1; @@ -937,6 +949,8 @@ const schedule_api_t schedule_sp_api = { .schedule_wait_time = schedule_wait_time, .schedule = schedule, .schedule_multi = schedule_multi, + .schedule_multi_wait = schedule_multi_wait, + .schedule_multi_no_wait = schedule_multi_no_wait, .schedule_pause = schedule_pause, .schedule_resume = schedule_resume, .schedule_release_atomic = schedule_release_atomic,
commit ed4270a59273b13619bda3a903fe83bb47ea6087 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Nov 6 15:09:10 2018 +0200
api: sched: add wait and no_wait schedule functions
Schedule call is one of the most used ODP API calls. Introduce versions without the wait parameter as wait / no_wait are the most used wait options. Implementation saves a number of if-conditions per schedule call.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index ae4894fc..d9b868e3 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -112,6 +112,35 @@ odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait); int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], int num);
+/** + * Schedule, wait for events + * + * Like odp_schedule_multi(), but waits infinitely for events. + * + * @param[out] from Output parameter for the source queue (where the event + * was dequeued from). Ignored if NULL. + * @param[out] events Event array for output + * @param num Maximum number of events to output + * + * @return Number of events outputted (1 ... num) + */ +int odp_schedule_multi_wait(odp_queue_t *from, odp_event_t events[], int num); + +/** + * Schedule, do not wait for events + * + * Like odp_schedule_multi(), but does not wait for events. + * + * @param[out] from Output parameter for the source queue (where the event + * was dequeued from). Ignored if NULL. + * @param[out] events Event array for output + * @param num Maximum number of events to output + * + * @return Number of events outputted (0 ... num) + */ +int odp_schedule_multi_no_wait(odp_queue_t *from, odp_event_t events[], + int num); + /** * Pause scheduling *
commit cc7bc42309d5d1bf844af376f13a981cf57cb76b Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 17:04:06 2018 +0200
validation: queue: default queue parameter values
Check that queue_param_init sets default queue parameter values correctly.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index 87939c24..cf081a99 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -605,8 +605,21 @@ static void queue_test_param(void) odp_queue_param_t qparams; odp_buffer_t enbuf;
- /* Schedule type queue */ + /* Defaults */ odp_queue_param_init(&qparams); + CU_ASSERT(qparams.type == ODP_QUEUE_TYPE_PLAIN); + CU_ASSERT(qparams.enq_mode == ODP_QUEUE_OP_MT); + CU_ASSERT(qparams.deq_mode == ODP_QUEUE_OP_MT); + CU_ASSERT(qparams.sched.prio == odp_schedule_default_prio()); + CU_ASSERT(qparams.sched.sync == ODP_SCHED_SYNC_PARALLEL); + CU_ASSERT(qparams.sched.group == ODP_SCHED_GROUP_ALL); + CU_ASSERT(qparams.sched.lock_count == 0); + CU_ASSERT(qparams.nonblocking == ODP_BLOCKING); + CU_ASSERT(qparams.context == NULL); + CU_ASSERT(qparams.context_len == 0); + CU_ASSERT(qparams.size == 0); + + /* Schedule type queue */ qparams.type = ODP_QUEUE_TYPE_SCHED; qparams.sched.prio = odp_schedule_min_prio(); qparams.sched.sync = ODP_SCHED_SYNC_PARALLEL;
commit 20a76096f5bbc87f545f16be72f766d26d5865c5 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 17:03:07 2018 +0200
validation: sched: add priority function tests
Test priority functions and macros.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index 7afd0382..63ceb6ea 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -206,12 +206,24 @@ static void scheduler_test_wait_time(void)
static void scheduler_test_num_prio(void) { - int prio; + int num_prio, min_prio, max_prio, default_prio;
- prio = odp_schedule_num_prio(); + num_prio = odp_schedule_num_prio(); + CU_ASSERT(num_prio > 0);
- CU_ASSERT(prio > 0); - CU_ASSERT(prio == odp_schedule_num_prio()); + min_prio = odp_schedule_min_prio(); + max_prio = odp_schedule_max_prio(); + default_prio = odp_schedule_default_prio(); + + CU_ASSERT(min_prio <= max_prio); + CU_ASSERT(min_prio <= default_prio); + CU_ASSERT(default_prio <= max_prio); + CU_ASSERT(num_prio == (max_prio - min_prio + 1)); + + CU_ASSERT(min_prio == ODP_SCHED_PRIO_LOWEST); + CU_ASSERT(max_prio == ODP_SCHED_PRIO_HIGHEST); + CU_ASSERT(default_prio == ODP_SCHED_PRIO_DEFAULT); + CU_ASSERT(default_prio == ODP_SCHED_PRIO_NORMAL); }
static void scheduler_test_queue_destroy(void)
commit 8ea3be29a66bd7bfe2776f5117f3c8bac78668ea Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 16:40:31 2018 +0200
validation: sched: convert priority macros to function calls
Prefer direct function calls over macros. Macros will be deprecated.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c index 7b54ef15..9b5d8ec0 100644 --- a/test/validation/api/classification/odp_classification_common.c +++ b/test/validation/api/classification/odp_classification_common.c @@ -201,7 +201,7 @@ odp_queue_t queue_create(const char *queuename, bool sched) if (sched) { odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; + qparam.sched.prio = odp_schedule_max_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL;
diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index a5de458c..41201d4a 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -158,7 +158,7 @@ void configure_cls_pmr_chain(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_NORMAL; + qparam.sched.prio = odp_schedule_default_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; qparam.sched.lock_count = queue_capa.max_ordered_locks; @@ -183,7 +183,7 @@ void configure_cls_pmr_chain(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_NORMAL; + qparam.sched.prio = odp_schedule_default_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; sprintf(queuename, "%s", "DstQueue"); @@ -293,7 +293,7 @@ void configure_pktio_default_cos(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT; + qparam.sched.prio = odp_schedule_default_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; sprintf(queuename, "%s", "DefaultQueue"); @@ -356,7 +356,7 @@ void configure_pktio_error_cos(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_LOWEST; + qparam.sched.prio = odp_schedule_min_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; sprintf(queuename, "%s", "ErrorCos"); @@ -468,7 +468,7 @@ void configure_cos_with_l2_priority(void) qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; for (i = 0; i < num_qos; i++) { - qparam.sched.prio = ODP_SCHED_PRIO_LOWEST + i; + qparam.sched.prio = odp_schedule_min_prio() + i; sprintf(queuename, "%s_%d", "L2_Queue", i); queue_tbl[i] = odp_queue_create(queuename, &qparam); CU_ASSERT_FATAL(queue_tbl[i] != ODP_QUEUE_INVALID); @@ -544,7 +544,7 @@ void configure_pmr_cos(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; + qparam.sched.prio = odp_schedule_max_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; sprintf(queuename, "%s", "PMR_CoS"); @@ -619,7 +619,7 @@ void configure_pktio_pmr_composite(void)
odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; - qparam.sched.prio = ODP_SCHED_PRIO_HIGHEST; + qparam.sched.prio = odp_schedule_max_prio(); qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; sprintf(queuename, "%s", "cos_pmr_composite_queue"); diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index 0bd1a06a..87939c24 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -608,7 +608,7 @@ static void queue_test_param(void) /* Schedule type queue */ odp_queue_param_init(&qparams); qparams.type = ODP_QUEUE_TYPE_SCHED; - qparams.sched.prio = ODP_SCHED_PRIO_LOWEST; + qparams.sched.prio = odp_schedule_min_prio(); qparams.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparams.sched.group = ODP_SCHED_GROUP_WORKER;
@@ -618,7 +618,7 @@ static void queue_test_param(void) odp_queue_to_u64(ODP_QUEUE_INVALID)); CU_ASSERT(queue == odp_queue_lookup("test_queue")); CU_ASSERT(ODP_QUEUE_TYPE_SCHED == odp_queue_type(queue)); - CU_ASSERT(ODP_SCHED_PRIO_LOWEST == odp_queue_sched_prio(queue)); + CU_ASSERT(odp_schedule_min_prio() == odp_queue_sched_prio(queue)); CU_ASSERT(ODP_SCHED_SYNC_PARALLEL == odp_queue_sched_type(queue)); CU_ASSERT(ODP_SCHED_GROUP_WORKER == odp_queue_sched_group(queue));
@@ -719,7 +719,7 @@ static void queue_test_info(void) /* Create a scheduled ordered queue with explicitly set params */ odp_queue_param_init(¶m); param.type = ODP_QUEUE_TYPE_SCHED; - param.sched.prio = ODP_SCHED_PRIO_NORMAL; + param.sched.prio = odp_schedule_default_prio(); param.sched.sync = ODP_SCHED_SYNC_ORDERED; param.sched.group = ODP_SCHED_GROUP_ALL; param.sched.lock_count = capability.max_ordered_locks; diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index a4e8e218..7afd0382 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -158,7 +158,7 @@ static void scheduler_test_wait_time(void) odp_queue_param_init(&qp); qp.type = ODP_QUEUE_TYPE_SCHED; qp.sched.sync = ODP_SCHED_SYNC_PARALLEL; - qp.sched.prio = ODP_SCHED_PRIO_NORMAL; + qp.sched.prio = odp_schedule_default_prio(); qp.sched.group = ODP_SCHED_GROUP_ALL; queue = odp_queue_create("dummy_queue", &qp); CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID); @@ -241,7 +241,7 @@ static void scheduler_test_queue_destroy(void)
for (i = 0; i < 3; i++) { qp.type = ODP_QUEUE_TYPE_SCHED; - qp.sched.prio = ODP_SCHED_PRIO_DEFAULT; + qp.sched.prio = odp_schedule_default_prio(); qp.sched.sync = sync[i]; qp.sched.group = ODP_SCHED_GROUP_ALL;
@@ -324,7 +324,7 @@ static void scheduler_test_queue_size(void)
odp_queue_param_init(&queue_param); queue_param.type = ODP_QUEUE_TYPE_SCHED; - queue_param.sched.prio = ODP_SCHED_PRIO_DEFAULT; + queue_param.sched.prio = odp_schedule_default_prio(); queue_param.sched.sync = sync[i]; queue_param.sched.group = ODP_SCHED_GROUP_ALL; queue_param.size = queue_size; @@ -483,7 +483,7 @@ static void scheduler_test_groups(void)
odp_queue_param_init(&qp); qp.type = ODP_QUEUE_TYPE_SCHED; - qp.sched.prio = ODP_SCHED_PRIO_DEFAULT; + qp.sched.prio = odp_schedule_default_prio(); qp.sched.sync = sync[i]; qp.sched.group = mygrp1;
@@ -701,7 +701,7 @@ static void chaos_run(unsigned int qtype) pool = odp_pool_create("sched_chaos_pool", ¶ms); CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); qp.type = ODP_QUEUE_TYPE_SCHED; - qp.sched.prio = ODP_SCHED_PRIO_DEFAULT; + qp.sched.prio = odp_schedule_default_prio(); qp.sched.group = ODP_SCHED_GROUP_ALL;
for (i = 0; i < CHAOS_NUM_QUEUES; i++) { diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 4561e688..eb8df665 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -321,7 +321,6 @@ static void timer_test_queue_type(odp_queue_type_t queue_type) odp_queue_param_init(&queue_param); if (queue_type == ODP_QUEUE_TYPE_SCHED) { queue_param.type = ODP_QUEUE_TYPE_SCHED; - queue_param.sched.prio = ODP_SCHED_PRIO_DEFAULT; queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; queue_param.sched.group = ODP_SCHED_GROUP_ALL; }
commit ec16951089de3ed475570d253f1f0b0746304cc9 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 15:46:52 2018 +0200
linux-gen: sched: implement min/max/default prio functions
Implemented the new functions for all schedulers. API defines now that priority level increases with the integer value. Implementations use internally inversed priority levels (max == 0).
Classifier test had wrong assumption about previous API priority level specification, and needed fixing. Previously, integer values were implementation specific, i.e. it was possible that value of PRIO_LOWEST < PRIO_HIGHEST, or PRIO_LOWEST > PRIO_HIGHEST.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/schedule_types.h b/include/odp/api/abi-default/schedule_types.h index e7258f0c..6c7730cd 100644 --- a/include/odp/api/abi-default/schedule_types.h +++ b/include/odp/api/abi-default/schedule_types.h @@ -21,13 +21,13 @@ extern "C" { * @{ */
-#define ODP_SCHED_PRIO_HIGHEST 0 +#define ODP_SCHED_PRIO_HIGHEST (odp_schedule_max_prio())
-#define ODP_SCHED_PRIO_NORMAL 4 +#define ODP_SCHED_PRIO_NORMAL (odp_schedule_default_prio())
-#define ODP_SCHED_PRIO_LOWEST 7 +#define ODP_SCHED_PRIO_LOWEST (odp_schedule_min_prio())
-#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL +#define ODP_SCHED_PRIO_DEFAULT (odp_schedule_default_prio())
typedef int odp_schedule_sync_t;
diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index a131b6eb..8c00f922 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -97,6 +97,9 @@ typedef struct { void (*schedule_release_atomic)(void); void (*schedule_release_ordered)(void); void (*schedule_prefetch)(int); + int (*schedule_min_prio)(void); + int (*schedule_max_prio)(void); + int (*schedule_default_prio)(void); int (*schedule_num_prio)(void); odp_schedule_group_t (*schedule_group_create)(const char *, const odp_thrmask_t *); diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index 5790e1c3..f02a9a32 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -270,21 +270,31 @@ static odp_queue_t queue_create(const char *name, uint32_t i; queue_entry_t *queue; void *queue_lf; - odp_queue_t handle = ODP_QUEUE_INVALID; - odp_queue_type_t type = ODP_QUEUE_TYPE_PLAIN; + odp_queue_type_t type; odp_queue_param_t default_param; + odp_queue_t handle = ODP_QUEUE_INVALID;
if (param == NULL) { odp_queue_param_init(&default_param); param = &default_param; }
+ type = param->type; + + if (type == ODP_QUEUE_TYPE_SCHED) { + if (param->sched.prio < odp_schedule_min_prio() || + param->sched.prio > odp_schedule_max_prio()) { + ODP_ERR("Bad queue priority: %i\n", param->sched.prio); + return ODP_QUEUE_INVALID; + } + } + if (param->nonblocking == ODP_BLOCKING) { if (param->size > queue_glb->config.max_queue_size) return ODP_QUEUE_INVALID; } else if (param->nonblocking == ODP_NONBLOCKING_LF) { /* Only plain type lock-free queues supported */ - if (param->type != ODP_QUEUE_TYPE_PLAIN) + if (type != ODP_QUEUE_TYPE_PLAIN) return ODP_QUEUE_INVALID; if (param->size > queue_glb->queue_lf_size) return ODP_QUEUE_INVALID; @@ -327,8 +337,6 @@ static odp_queue_t queue_create(const char *name, queue->s.orig_dequeue_multi = lf_fn->deq_multi; }
- type = queue->s.type; - if (type == ODP_QUEUE_TYPE_SCHED) queue->s.status = QUEUE_STATUS_NOTSCHED; else @@ -607,7 +615,7 @@ static void queue_param_init(odp_queue_param_t *params) params->enq_mode = ODP_QUEUE_OP_MT; params->deq_mode = ODP_QUEUE_OP_MT; params->nonblocking = ODP_BLOCKING; - params->sched.prio = ODP_SCHED_PRIO_DEFAULT; + params->sched.prio = odp_schedule_default_prio(); params->sched.sync = ODP_SCHED_SYNC_PARALLEL; params->sched.group = ODP_SCHED_GROUP_ALL; } diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 4f2c1b6c..5bff1354 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -167,6 +167,8 @@ static int queue_init(queue_entry_t *queue, const char *name,
/* Queue initialized successfully, add it to the sched group */ if (queue->s.type == ODP_QUEUE_TYPE_SCHED) { + int prio = odp_schedule_max_prio() - param->sched.prio; + if (queue->s.param.sched.sync == ODP_SCHED_SYNC_ORDERED) { sched_elem->rwin = rwin_alloc(queue_shm_pool, @@ -177,9 +179,9 @@ static int queue_init(queue_entry_t *queue, const char *name, } } sched_elem->sched_grp = param->sched.group; - sched_elem->sched_prio = param->sched.prio; + sched_elem->sched_prio = prio; sched_elem->schedq = - sched_queue_add(param->sched.group, param->sched.prio); + sched_queue_add(param->sched.group, prio); ODP_ASSERT(sched_elem->schedq != NULL);
} @@ -356,15 +358,26 @@ static odp_queue_t queue_create(const char *name, const odp_queue_param_t *param) { int queue_idx; - odp_queue_t handle = ODP_QUEUE_INVALID; queue_entry_t *queue; + odp_queue_type_t type; odp_queue_param_t default_param; + odp_queue_t handle = ODP_QUEUE_INVALID;
if (param == NULL) { odp_queue_param_init(&default_param); param = &default_param; }
+ type = param->type; + + if (type == ODP_QUEUE_TYPE_SCHED) { + if (param->sched.prio < odp_schedule_min_prio() || + param->sched.prio > odp_schedule_max_prio()) { + ODP_ERR("Bad queue priority: %i\n", param->sched.prio); + return ODP_QUEUE_INVALID; + } + } + for (queue_idx = 0; queue_idx < ODP_CONFIG_QUEUES; queue_idx++) { queue = &queue_tbl->queue[queue_idx];
@@ -872,7 +885,7 @@ static void queue_param_init(odp_queue_param_t *params) params->enq_mode = ODP_QUEUE_OP_MT; params->deq_mode = ODP_QUEUE_OP_MT; params->nonblocking = ODP_BLOCKING; - params->sched.prio = ODP_SCHED_PRIO_DEFAULT; + params->sched.prio = odp_schedule_default_prio(); params->sched.sync = ODP_SCHED_SYNC_PARALLEL; params->sched.group = ODP_SCHED_GROUP_ALL; } diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 22eb6ff1..3ce25147 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -36,13 +36,6 @@ /* Number of priority levels */ #define NUM_PRIO 8
-ODP_STATIC_ASSERT(ODP_SCHED_PRIO_LOWEST == (NUM_PRIO - 1), - "lowest_prio_does_not_match_with_num_prios"); - -ODP_STATIC_ASSERT((ODP_SCHED_PRIO_NORMAL > 0) && - (ODP_SCHED_PRIO_NORMAL < (NUM_PRIO - 1)), - "normal_prio_is_not_between_highest_and_lowest"); - /* Number of scheduling groups */ #define NUM_SCHED_GRPS 32
@@ -195,6 +188,7 @@ typedef struct {
struct { uint8_t grp; + /* Inverted prio value (max = 0) vs API (min = 0)*/ uint8_t prio; uint8_t spread; uint8_t sync; @@ -537,6 +531,31 @@ static uint32_t schedule_max_ordered_locks(void) return CONFIG_QUEUE_MAX_ORD_LOCKS; }
+static int schedule_min_prio(void) +{ + return 0; +} + +static int schedule_max_prio(void) +{ + return NUM_PRIO - 1; +} + +static int schedule_default_prio(void) +{ + return schedule_max_prio() / 2; +} + +static int schedule_num_prio(void) +{ + return NUM_PRIO; +} + +static inline int prio_level_from_api(int api_prio) +{ + return schedule_max_prio() - api_prio; +} + static void pri_set(int id, int prio) { odp_spinlock_lock(&sched->mask_lock); @@ -576,7 +595,7 @@ static int schedule_init_queue(uint32_t queue_index, { uint32_t ring_size; int i; - int prio = sched_param->prio; + int prio = prio_level_from_api(sched_param->prio);
pri_set_queue(queue_index, prio); sched->queue[queue_index].grp = sched_param->group; @@ -1289,11 +1308,6 @@ static uint64_t schedule_wait_time(uint64_t ns) return ns; }
-static int schedule_num_prio(void) -{ - return NUM_PRIO; -} - static odp_schedule_group_t schedule_group_create(const char *name, const odp_thrmask_t *mask) { @@ -1542,6 +1556,9 @@ const schedule_api_t schedule_basic_api = { .schedule_release_atomic = schedule_release_atomic, .schedule_release_ordered = schedule_release_ordered, .schedule_prefetch = schedule_prefetch, + .schedule_min_prio = schedule_min_prio, + .schedule_max_prio = schedule_max_prio, + .schedule_default_prio = schedule_default_prio, .schedule_num_prio = schedule_num_prio, .schedule_group_create = schedule_group_create, .schedule_group_destroy = schedule_group_destroy, diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index c88b35fd..084dced6 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -66,6 +66,21 @@ void odp_schedule_prefetch(int num) return sched_api->schedule_prefetch(num); }
+int odp_schedule_min_prio(void) +{ + return sched_api->schedule_min_prio(); +} + +int odp_schedule_max_prio(void) +{ + return sched_api->schedule_max_prio(); +} + +int odp_schedule_default_prio(void) +{ + return sched_api->schedule_default_prio(); +} + int odp_schedule_num_prio(void) { return sched_api->schedule_num_prio(); diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index ccafcb77..05e28532 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -46,13 +46,6 @@
#define FLAG_PKTIN 0x80
-ODP_STATIC_ASSERT(ODP_SCHED_PRIO_LOWEST == (ODP_SCHED_PRIO_NUM - 2), - "lowest_prio_does_not_match_with_num_prios"); - -ODP_STATIC_ASSERT((ODP_SCHED_PRIO_NORMAL > 0) && - (ODP_SCHED_PRIO_NORMAL < (ODP_SCHED_PRIO_NUM - 2)), - "normal_prio_is_not_between_highest_and_lowest"); - ODP_STATIC_ASSERT(CHECK_IS_POWER2(ODP_CONFIG_QUEUES), "Number_of_queues_is_not_power_of_two");
@@ -1368,6 +1361,21 @@ static int schedule_num_prio(void) return ODP_SCHED_PRIO_NUM - 1; /* Discount the pktin priority level */ }
+static int schedule_min_prio(void) +{ + return 0; +} + +static int schedule_max_prio(void) +{ + return schedule_num_prio() - 1; +} + +static int schedule_default_prio(void) +{ + return schedule_max_prio() / 2; +} + static int schedule_group_update(sched_group_t *sg, uint32_t sgi, const odp_thrmask_t *mask, @@ -2114,6 +2122,9 @@ const schedule_api_t schedule_scalable_api = { .schedule_release_atomic = schedule_release_atomic, .schedule_release_ordered = schedule_release_ordered, .schedule_prefetch = schedule_prefetch, + .schedule_min_prio = schedule_min_prio, + .schedule_max_prio = schedule_max_prio, + .schedule_default_prio = schedule_default_prio, .schedule_num_prio = schedule_num_prio, .schedule_group_create = schedule_group_create, .schedule_group_destroy = schedule_group_destroy, diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 52c8873c..055ee35f 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -26,11 +26,12 @@ #define NUM_QUEUE ODP_CONFIG_QUEUES #define NUM_PKTIO ODP_CONFIG_PKTIO_ENTRIES #define NUM_ORDERED_LOCKS 1 -#define NUM_PRIO 3 #define NUM_STATIC_GROUP 3 #define NUM_GROUP (NUM_STATIC_GROUP + 9) #define NUM_PKTIN 32 -#define LOWEST_QUEUE_PRIO (NUM_PRIO - 2) +#define NUM_PRIO 3 +#define MAX_API_PRIO (NUM_PRIO - 2) +/* Lowest internal priority */ #define PKTIN_PRIO (NUM_PRIO - 1) #define CMD_QUEUE 0 #define CMD_PKTIO 1 @@ -367,8 +368,8 @@ static int init_queue(uint32_t qi, const odp_schedule_param_t *sched_param) if (!sched_group->s.group[group].allocated) return -1;
- if (sched_param->prio > 0) - prio = LOWEST_QUEUE_PRIO; + /* Inverted prio value (max = 0) vs API */ + prio = MAX_API_PRIO - sched_param->prio;
sched_global->queue_cmd[qi].s.prio = prio; sched_global->queue_cmd[qi].s.group = group; @@ -668,6 +669,21 @@ static void schedule_prefetch(int num) (void)num; }
+static int schedule_min_prio(void) +{ + return 0; +} + +static int schedule_max_prio(void) +{ + return MAX_API_PRIO; +} + +static int schedule_default_prio(void) +{ + return schedule_max_prio() / 2; +} + static int schedule_num_prio(void) { /* Lowest priority is used for pktin polling and is internal @@ -926,6 +942,9 @@ const schedule_api_t schedule_sp_api = { .schedule_release_atomic = schedule_release_atomic, .schedule_release_ordered = schedule_release_ordered, .schedule_prefetch = schedule_prefetch, + .schedule_min_prio = schedule_min_prio, + .schedule_max_prio = schedule_max_prio, + .schedule_default_prio = schedule_default_prio, .schedule_num_prio = schedule_num_prio, .schedule_group_create = schedule_group_create, .schedule_group_destroy = schedule_group_destroy, diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index 3b9e0276..a5de458c 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -18,6 +18,7 @@ static odp_pool_t pool_list[CLS_ENTRIES]; static odp_pool_t pool_default; static odp_pktio_t pktio_loop; static odp_cls_testcase_u tc; +static int global_num_l2_qos;
#define NUM_COS_PMR_CHAIN 2 #define NUM_COS_DEFAULT 1 @@ -457,12 +458,17 @@ void configure_cos_with_l2_priority(void) for (i = 0; i < CLS_L2_QOS_MAX; i++) qos_tbl[i] = 0;
+ if (odp_schedule_num_prio() < num_qos) + num_qos = odp_schedule_num_prio(); + + global_num_l2_qos = num_qos; + odp_queue_param_init(&qparam); qparam.type = ODP_QUEUE_TYPE_SCHED; qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL; qparam.sched.group = ODP_SCHED_GROUP_ALL; for (i = 0; i < num_qos; i++) { - qparam.sched.prio = ODP_SCHED_PRIO_LOWEST - i; + qparam.sched.prio = ODP_SCHED_PRIO_LOWEST + i; sprintf(queuename, "%s_%d", "L2_Queue", i); queue_tbl[i] = odp_queue_create(queuename, &qparam); CU_ASSERT_FATAL(queue_tbl[i] != ODP_QUEUE_INVALID); @@ -506,7 +512,7 @@ void test_cos_with_l2_priority(void) pkt_info.udp = true; pkt_info.vlan = true;
- for (i = 0; i < CLS_L2_QOS_MAX; i++) { + for (i = 0; i < global_num_l2_qos; i++) { pkt = create_packet(pkt_info); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); seqno = cls_pkt_get_seq(pkt);
commit 7b23d26816a334804277a87e5ea93f2958e5a6ec Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 16:27:24 2018 +0200
api: sched: favor priority functions over macros
Priority macros will be deprecated, function calls should be used instead.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 24663f69..76afc6dd 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -24,24 +24,26 @@ extern "C" {
/** * @def ODP_SCHED_PRIO_HIGHEST - * Highest scheduling priority + * This macro is equivalent of calling odp_schedule_max_prio() and will be + * deprecated. Use direct function call instead. */
/** * @def ODP_SCHED_PRIO_NORMAL - * Normal scheduling priority + * This macro is equivalent of calling odp_schedule_default_prio() and will be + * deprecated. Use direct function call instead. */
/** * @def ODP_SCHED_PRIO_LOWEST - * Lowest scheduling priority + * This macro is equivalent of calling odp_schedule_min_prio() and will be + * deprecated. Use direct function call instead. */
/** * @def ODP_SCHED_PRIO_DEFAULT - * Default scheduling priority. User does not care about the selected priority - * level - throughput, load balancing and synchronization features are more - * important than priority scheduling. + * This macro is equivalent of calling odp_schedule_default_prio() and will be + * deprecated. Use direct function call instead. */
/** @@ -144,7 +146,7 @@ typedef int odp_schedule_prio_t; typedef struct odp_schedule_param_t { /** Priority level * - * Default value is ODP_SCHED_PRIO_DEFAULT. */ + * Default value is returned by odp_schedule_default_prio(). */ odp_schedule_prio_t prio;
/** Synchronization method
commit 9e1d151f2f308c16ed542a7fa1ab0f0cf1e7a0fc Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 12:31:45 2018 +0200
api: sched: odp_schedule_prio_t is an integer
Change odp_schedule_prio_t from an implementation specific type to integer. Application needs to be able to calculate priority values between min/default/max, so the type cannot be abstract. Since type is used in slow path (queue creation), a fixed type does not harm performance. A fixed type helps in portability (ABI compatibility).
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/schedule_types.h b/include/odp/api/abi-default/schedule_types.h index 31ee27f1..e7258f0c 100644 --- a/include/odp/api/abi-default/schedule_types.h +++ b/include/odp/api/abi-default/schedule_types.h @@ -21,8 +21,6 @@ extern "C" { * @{ */
-typedef int odp_schedule_prio_t; - #define ODP_SCHED_PRIO_HIGHEST 0
#define ODP_SCHED_PRIO_NORMAL 4 diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 44eb663a..24663f69 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -22,11 +22,6 @@ extern "C" { * @{ */
-/** - * @typedef odp_schedule_prio_t - * Scheduler priority level - */ - /** * @def ODP_SCHED_PRIO_HIGHEST * Highest scheduling priority @@ -136,6 +131,15 @@ extern "C" { * Predefined scheduler group of all control threads */
+/** + * Scheduling priority level + * + * Priority level is an integer value between odp_schedule_min_prio() and + * odp_schedule_max_prio(). Queues with a higher priority value are served with + * higher priority than queues with a lower priority value. + */ +typedef int odp_schedule_prio_t; + /** Scheduler parameters */ typedef struct odp_schedule_param_t { /** Priority level
commit d867eedd6987daba2f03f3b036601708969528f1 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Oct 30 12:17:34 2018 +0200
api: sched: add priority min/max/default functions
Added functions to read min/max/default priority levels. Priority level is an integer, higher value means higher priority and thus max >= min.
Functions are needed to allow number of priorities to be dynamic. Especially, ABI compat mode needs functions instead of macros (#defines).
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index bbc74983..ae4894fc 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -180,9 +180,50 @@ void odp_schedule_release_ordered(void); */ void odp_schedule_prefetch(int num);
+/** + * Maximum scheduling priority level + * + * This is the maximum value that can be set to 'prio' field in + * odp_schedule_param_t (e.g. @see odp_queue_create()). Queues with a higher + * priority value are served with higher priority than queues with a lower + * priority value. + * + * @return Maximum scheduling priority level + */ +int odp_schedule_max_prio(void); + +/** + * Minimum scheduling priority level + * + * This is the minimum value that can be set to 'prio' field in + * odp_schedule_param_t (e.g. @see odp_queue_create()). Queues with a higher + * priority value are served with higher priority than queues with a lower + * priority value. + * + * @return Minimum scheduling priority level + */ +int odp_schedule_min_prio(void); + +/** + * Default scheduling priority level + * + * This is the default value of 'prio' field in odp_schedule_param_t + * (e.g. @see odp_queue_param_init()). The default value should be suitable for + * an application that uses single priority level for all its queues (uses + * scheduler only for load balancing and synchronization). Typically, + * the default value is between minimum and maximum values, but with a few + * priority levels it may be close or equal to those. + * + * @return Default scheduling priority level + */ +int odp_schedule_default_prio(void); + /** * Number of scheduling priorities * + * The number of priority levels support by the scheduler. It equals to + * odp_schedule_max_prio() - odp_schedule_min_prio() + 1. + * * @return Number of scheduling priorities */ int odp_schedule_num_prio(void);
commit 411a07b61019cece7545fb325cc77a328a657f83 Author: Petri Savolainen petri.savolainen@linaro.org Date: Mon Nov 5 15:44:05 2018 +0200
linux-gen: ipsec: use new auth_key_extra
Change implementation and validation test to use the new authentication algorithm extra keying material. It is set only in GMAC test cases.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 630af5a4..6eb12f95 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -582,7 +582,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa->esp_block_len = 16; crypto_param.auth_iv.length = 12; ipsec_sa->salt_length = 4; - salt_param = ¶m->crypto.cipher_key_extra; + salt_param = ¶m->crypto.auth_key_extra; break; case ODP_AUTH_ALG_CHACHA20_POLY1305: crypto_param.auth_aad_len = sizeof(ipsec_aad_t); diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c index 28903af7..2184c7a9 100644 --- a/test/performance/odp_ipsec.c +++ b/test/performance/odp_ipsec.c @@ -345,7 +345,7 @@ static ipsec_alg_config_t algs_config[] = { .data = test_key16, .length = sizeof(test_key16) }, - .cipher_key_extra = { + .auth_key_extra = { .data = test_salt, .length = 4, }, diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index aece2115..f10c4c29 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -345,7 +345,8 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param, const odp_crypto_key_t *cipher_key, odp_auth_alg_t auth_alg, const odp_crypto_key_t *auth_key, - const odp_crypto_key_t *extra_key) + const odp_crypto_key_t *cipher_key_extra, + const odp_crypto_key_t *auth_key_extra) { odp_ipsec_sa_param_init(param); param->dir = in ? ODP_IPSEC_DIR_INBOUND : @@ -378,8 +379,11 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param, if (auth_key) param->crypto.auth_key = *auth_key;
- if (extra_key) - param->crypto.cipher_key_extra = *extra_key; + if (cipher_key_extra) + param->crypto.cipher_key_extra = *cipher_key_extra; + + if (auth_key_extra) + param->crypto.auth_key_extra = *auth_key_extra; }
void ipsec_sa_destroy(odp_ipsec_sa_t sa) diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h index b2d6df69..2a6713d1 100644 --- a/test/validation/api/ipsec/ipsec.h +++ b/test/validation/api/ipsec/ipsec.h @@ -68,7 +68,8 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param, const odp_crypto_key_t *cipher_key, odp_auth_alg_t auth_alg, const odp_crypto_key_t *auth_key, - const odp_crypto_key_t *extra_key); + const odp_crypto_key_t *cipher_key_extra, + const odp_crypto_key_t *auth_key_extra);
void ipsec_sa_destroy(odp_ipsec_sa_t sa); odp_packet_t ipsec_packet(const ipsec_test_packet *itp); diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 9c111200..51533148 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -19,7 +19,7 @@ static void test_in_ipv4_ah_sha256(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -52,7 +52,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv4(void) true, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -85,7 +85,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv6(void) true, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -117,7 +117,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv4_notun(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -150,7 +150,7 @@ static void test_in_ipv4_esp_null_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -182,7 +182,7 @@ static void test_in_ipv4_esp_aes_cbc_null(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -214,7 +214,7 @@ static void test_in_ipv4_esp_aes_cbc_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -246,7 +246,7 @@ static void test_in_ipv4_esp_aes_ctr_null(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CTR, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - &key_mcgrew_gcm_salt_3); + &key_mcgrew_gcm_salt_3, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -278,7 +278,7 @@ static void test_in_ipv4_ah_sha256_lookup(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -311,7 +311,7 @@ static void test_in_ipv4_esp_null_sha256_lookup(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -345,7 +345,7 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv4(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -378,7 +378,7 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv6(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -410,7 +410,7 @@ static void test_in_ipv4_esp_udp_null_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); @@ -443,7 +443,7 @@ static void test_in_ipv4_esp_udp_null_sha256_lookup(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); @@ -477,7 +477,7 @@ static void test_in_ipv4_ah_sha256_noreplay(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.inbound.antireplay_ws = 0;
sa = odp_ipsec_sa_create(¶m); @@ -525,7 +525,7 @@ static void test_in_ipv4_ah_sha256_replay(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.inbound.antireplay_ws = 32;
sa = odp_ipsec_sa_create(¶m); @@ -583,7 +583,7 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.inbound.antireplay_ws = 0;
sa = odp_ipsec_sa_create(¶m); @@ -631,7 +631,7 @@ static void test_in_ipv4_esp_null_sha256_replay(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.inbound.antireplay_ws = 32;
sa = odp_ipsec_sa_create(¶m); @@ -694,7 +694,7 @@ static void test_in_ipv4_ah_esp_pkt(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -729,7 +729,7 @@ static void test_in_ipv4_esp_ah_pkt(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -759,7 +759,7 @@ static void test_in_ipv4_ah_esp_pkt_lookup(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -790,7 +790,7 @@ static void test_in_ipv4_esp_ah_pkt_lookup(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -821,7 +821,7 @@ static void test_in_ipv4_ah_sha256_bad1(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -851,7 +851,7 @@ static void test_in_ipv4_ah_sha256_bad2(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -881,7 +881,7 @@ static void test_in_ipv4_esp_null_sha256_bad1(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -911,7 +911,7 @@ static void test_in_ipv4_rfc3602_5_esp(void) true, false, 0x4321, NULL, ODP_CIPHER_ALG_AES_CBC, &key_rfc3602, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -943,7 +943,7 @@ static void test_in_ipv4_rfc3602_6_esp(void) true, false, 0x4321, NULL, ODP_CIPHER_ALG_AES_CBC, &key_rfc3602, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -976,7 +976,7 @@ static void test_in_ipv4_rfc3602_7_esp(void) true, false, 0x8765, &tunnel, ODP_CIPHER_ALG_AES_CBC, &key_rfc3602_2, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1009,7 +1009,7 @@ static void test_in_ipv4_rfc3602_8_esp(void) true, false, 0x8765, &tunnel, ODP_CIPHER_ALG_AES_CBC, &key_rfc3602_2, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1042,7 +1042,7 @@ static void test_in_ipv4_mcgrew_gcm_2_esp(void) true, false, 0xa5f8, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_2, ODP_AUTH_ALG_AES_GCM, NULL, - &key_mcgrew_gcm_salt_2); + &key_mcgrew_gcm_salt_2, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1075,7 +1075,7 @@ static void test_in_ipv4_mcgrew_gcm_3_esp(void) true, false, 0x4a2cbfe3, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_3, ODP_AUTH_ALG_AES_GCM, NULL, - &key_mcgrew_gcm_salt_3); + &key_mcgrew_gcm_salt_3, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1108,7 +1108,7 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void) true, false, 0x00000000, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_4, ODP_AUTH_ALG_AES_GCM, NULL, - &key_mcgrew_gcm_salt_4); + &key_mcgrew_gcm_salt_4, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1146,7 +1146,7 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void) true, false, 0x335467ae, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, ODP_AUTH_ALG_AES_GCM, NULL, - &key_mcgrew_gcm_salt_12); + &key_mcgrew_gcm_salt_12, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1178,7 +1178,7 @@ static void test_in_ipv4_mcgrew_gcm_12_esp_notun(void) true, false, 0x335467ae, NULL, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, ODP_AUTH_ALG_AES_GCM, NULL, - &key_mcgrew_gcm_salt_12); + &key_mcgrew_gcm_salt_12, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1211,7 +1211,7 @@ static void test_in_ipv4_mcgrew_gcm_15_esp(void) true, false, 0x00004321, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_AES_GMAC, &key_mcgrew_gcm_15, - &key_mcgrew_gcm_salt_15); + NULL, &key_mcgrew_gcm_salt_15);
sa = odp_ipsec_sa_create(¶m);
@@ -1244,7 +1244,7 @@ static void test_in_ipv4_rfc7634_chacha(void) true, false, 0x01020304, &tunnel, ODP_CIPHER_ALG_CHACHA20_POLY1305, &key_rfc7634, ODP_AUTH_ALG_CHACHA20_POLY1305, NULL, - &key_rfc7634_salt); + &key_rfc7634_salt, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1276,7 +1276,7 @@ static void test_in_ipv4_ah_aes_gmac_128(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_AES_GMAC, &key_a5_128, - &key_mcgrew_gcm_salt_2); + NULL, &key_mcgrew_gcm_salt_2);
sa = odp_ipsec_sa_create(¶m);
@@ -1308,7 +1308,7 @@ static void test_in_ipv4_esp_null_aes_gmac_128(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_AES_GMAC, &key_a5_128, - &key_mcgrew_gcm_salt_2); + NULL, &key_mcgrew_gcm_salt_2);
sa = odp_ipsec_sa_create(¶m);
@@ -1340,7 +1340,7 @@ static void test_in_ipv6_ah_sha256(void) true, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1373,7 +1373,7 @@ static void test_in_ipv6_ah_sha256_tun_ipv4(void) true, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1406,7 +1406,7 @@ static void test_in_ipv6_ah_sha256_tun_ipv6(void) true, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1438,7 +1438,7 @@ static void test_in_ipv6_esp_null_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1471,7 +1471,7 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv4(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1504,7 +1504,7 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv6(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1536,7 +1536,7 @@ static void test_in_ipv6_esp_udp_null_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); @@ -1569,7 +1569,7 @@ static void test_in_ipv6_esp_udp_null_sha256_lookup(void) true, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 59c631b5..ee3fd43f 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -19,7 +19,7 @@ static void test_out_ipv4_ah_sha256(void) false, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -62,7 +62,7 @@ static void test_out_ipv4_ah_sha256_tun_ipv4(void) false, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -106,7 +106,7 @@ static void test_out_ipv4_ah_sha256_tun_ipv6(void) false, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -136,7 +136,7 @@ static void test_out_ipv4_esp_null_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -174,7 +174,7 @@ static void test_out_ipv4_esp_null_sha256_tun_ipv4(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -219,7 +219,7 @@ static void test_out_ipv4_esp_null_sha256_tun_ipv6(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -251,7 +251,7 @@ static void test_out_ipv4_esp_aes_cbc_null(void) false, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -261,7 +261,7 @@ static void test_out_ipv4_esp_aes_cbc_null(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - NULL); + NULL, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -294,7 +294,7 @@ static void test_out_ipv4_esp_udp_null_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); @@ -326,7 +326,7 @@ static void test_out_ipv4_esp_aes_cbc_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -336,7 +336,7 @@ static void test_out_ipv4_esp_aes_cbc_sha256(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CBC, &key_a5_128, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -370,7 +370,7 @@ static void test_out_ipv4_esp_aes_ctr_null(void) false, false, 123, NULL, ODP_CIPHER_ALG_AES_CTR, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - &key_mcgrew_gcm_salt_3); + &key_mcgrew_gcm_salt_3, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -380,7 +380,7 @@ static void test_out_ipv4_esp_aes_ctr_null(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_CTR, &key_a5_128, ODP_AUTH_ALG_NULL, NULL, - &key_mcgrew_gcm_salt_3); + &key_mcgrew_gcm_salt_3, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -414,7 +414,7 @@ static void test_out_ipv4_esp_aes_gcm128(void) false, false, 123, NULL, ODP_CIPHER_ALG_AES_GCM, &key_a5_128, ODP_AUTH_ALG_AES_GCM, &key_a5_128, - &key_mcgrew_gcm_salt_2); + &key_mcgrew_gcm_salt_2, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -424,7 +424,7 @@ static void test_out_ipv4_esp_aes_gcm128(void) true, false, 123, NULL, ODP_CIPHER_ALG_AES_GCM, &key_a5_128, ODP_AUTH_ALG_AES_GCM, &key_a5_128, - &key_mcgrew_gcm_salt_2); + &key_mcgrew_gcm_salt_2, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -457,7 +457,7 @@ static void test_out_ipv4_ah_aes_gmac_128(void) false, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_AES_GMAC, &key_a5_128, - &key_mcgrew_gcm_salt_2); + NULL, &key_mcgrew_gcm_salt_2);
sa = odp_ipsec_sa_create(¶m);
@@ -487,7 +487,7 @@ static void test_out_ipv4_esp_null_aes_gmac_128(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_AES_GMAC, &key_a5_128, - &key_mcgrew_gcm_salt_2); + NULL, &key_mcgrew_gcm_salt_2);
sa = odp_ipsec_sa_create(¶m);
@@ -518,7 +518,7 @@ static void test_out_ipv4_esp_chacha20_poly1305(void) false, false, 123, NULL, ODP_CIPHER_ALG_CHACHA20_POLY1305, &key_rfc7634, ODP_AUTH_ALG_CHACHA20_POLY1305, NULL, - &key_rfc7634_salt); + &key_rfc7634_salt, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -528,7 +528,7 @@ static void test_out_ipv4_esp_chacha20_poly1305(void) true, false, 123, NULL, ODP_CIPHER_ALG_CHACHA20_POLY1305, &key_rfc7634, ODP_AUTH_ALG_CHACHA20_POLY1305, NULL, - &key_rfc7634_salt); + &key_rfc7634_salt, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -561,7 +561,7 @@ static void test_out_ipv4_ah_sha256_frag_check(void) false, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.outbound.frag_mode = ODP_IPSEC_FRAG_CHECK; param.outbound.mtu = 100;
@@ -608,7 +608,7 @@ static void test_out_ipv4_ah_sha256_frag_check_2(void) false, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.outbound.frag_mode = ODP_IPSEC_FRAG_CHECK; param.outbound.mtu = 100;
@@ -654,7 +654,7 @@ static void test_out_ipv4_esp_null_sha256_frag_check(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
param.outbound.frag_mode = ODP_IPSEC_FRAG_CHECK; param.outbound.mtu = 100; @@ -702,7 +702,7 @@ static void test_out_ipv4_esp_null_sha256_frag_check_2(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
param.outbound.frag_mode = ODP_IPSEC_FRAG_CHECK; param.outbound.mtu = 100; @@ -749,7 +749,7 @@ static void test_out_ipv6_ah_sha256(void) false, true, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -787,7 +787,7 @@ static void test_out_ipv6_ah_sha256_tun_ipv4(void) false, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -831,7 +831,7 @@ static void test_out_ipv6_ah_sha256_tun_ipv6(void) false, true, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -861,7 +861,7 @@ static void test_out_ipv6_esp_null_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -899,7 +899,7 @@ static void test_out_ipv6_esp_null_sha256_tun_ipv4(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -944,7 +944,7 @@ static void test_out_ipv6_esp_null_sha256_tun_ipv6(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -975,7 +975,7 @@ static void test_out_ipv6_esp_udp_null_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL); param.opt.udp_encap = 1;
sa = odp_ipsec_sa_create(¶m); @@ -1020,7 +1020,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv4(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1030,7 +1030,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv4(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -1102,7 +1102,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv6(void) false, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
@@ -1112,7 +1112,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv6(void) true, false, 123, &tunnel, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa2 = odp_ipsec_sa_create(¶m);
@@ -1164,7 +1164,7 @@ static void test_out_ipv4_udp_esp_null_sha256(void) false, false, 123, NULL, ODP_CIPHER_ALG_NULL, NULL, ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, - NULL); + NULL, NULL);
sa = odp_ipsec_sa_create(¶m);
commit 3d1711bc27a819876552e1104a3f2fdfb0760a4e Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Nov 1 10:06:25 2018 +0200
api: ipsec: add auth_key_extra IPSEC crypto param
IPSEC needs salt (extra keying material) when GMAC authentication algorithm is used. Added auth_key_extra for that use case.
Also improved algorithm, key and key_extra usage documentation. All algorithms that need salt/nonce are now listed. Cipher side key information need to be set always when algorithm is not NULL. Authentication side key information is ignored when a single algorithm (AEAD) does both cipher and authentication.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 2d1c4d9b..1b65e8d0 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -364,27 +364,65 @@ typedef enum odp_ipsec_tunnel_type_t { * IPSEC crypto parameters */ typedef struct odp_ipsec_crypto_param_t { - /** Cipher algorithm */ + /** Cipher algorithm + * + * Select cipher algorithm to be used. ODP_CIPHER_ALG_NULL indicates + * that ciphering is disabled. See 'ciphers' field of + * odp_ipsec_capability_t for supported cipher algorithms. Algorithm + * descriptions can be found from odp_cipher_alg_t documentation. Note + * that some algorithms restrict choice of the pairing authentication + * algorithm. When ciphering is enabled, cipher key and potential extra + * key material (cipher_key_extra) need to be set. The default value + * is ODP_CIPHER_ALG_NULL. + */ odp_cipher_alg_t cipher_alg;
/** Cipher key */ odp_crypto_key_t cipher_key;
- /** Extra keying material for cipher key + /** Extra keying material for cipher algorithm * * Additional data used as salt or nonce if the algorithm requires it, * other algorithms ignore this field. These algorithms require this - * field set: - * - AES_GCM: 4 bytes of salt - **/ + * field to be set: + * - ODP_CIPHER_ALG_AES_CTR: 4 bytes of nonce + * - ODP_CIPHER_ALG_AES_GCM: 4 bytes of salt + * - ODP_CIPHER_ALG_AES_CCM: 3 bytes of salt + * - ODP_CIPHER_ALG_CHACHA20_POLY1305: 4 bytes of salt + */ odp_crypto_key_t cipher_key_extra;
- /** Authentication algorithm */ + /** Authentication algorithm + * + * Select authentication algorithm to be used. ODP_AUTH_ALG_NULL + * indicates that authentication is disabled. See 'auths' field of + * odp_ipsec_capability_t for supported authentication algorithms. + * Algorithm descriptions can be found from odp_auth_alg_t + * documentation. Note that some algorithms restrict choice of the + * pairing cipher algorithm. When single algorithm provides both + * ciphering and authentication (i.e. Authenticated Encryption), + * authentication side key information ('auth_key' and + * 'auth_key_extra') is ignored, and cipher side values are + * used instead. These algorithms ignore authentication side key + * information: ODP_AUTH_ALG_AES_GCM, ODP_AUTH_ALG_AES_CCM and + * ODP_AUTH_ALG_CHACHA20_POLY1305. Otherwise, authentication side + * parameters must be set when authentication is enabled. The default + * value is ODP_AUTH_ALG_NULL. + */ odp_auth_alg_t auth_alg;
/** Authentication key */ odp_crypto_key_t auth_key;
+ /** Extra keying material for authentication algorithm + * + * Additional data used as salt or nonce if the algorithm requires it, + * other algorithms ignore this field. These algorithms require this + * field to be set: + * - ODP_AUTH_ALG_AES_GMAC: 4 bytes of salt + */ + odp_crypto_key_t auth_key_extra; + } odp_ipsec_crypto_param_t;
/** IPv4 header parameters */
commit 9504a42688ff7242317b0aa4669dff2bf7aa9d93 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Nov 2 14:09:59 2018 +0200
api: crypto: improve odp_crypto_session_param_t documentation
Added default values. Documented when key and IV parameters need to be set. AEAD algorithm use cipher side key/IV and ignore authentication side key/IV. These specification updates confirm current reference implementation and validation test cases.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 843fdefe..cfb2bc42 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -422,7 +422,10 @@ typedef odp_packet_data_range_t ODP_DEPRECATE(odp_crypto_data_range_t); * Crypto API session creation parameters */ typedef struct odp_crypto_session_param_t { - /** Encode vs. decode operation */ + /** Encode vs. decode operation + * + * The default value is ODP_CRYPTO_OP_ENCODE. + */ odp_crypto_op_t op;
/** Authenticate cipher vs. plain text @@ -435,18 +438,31 @@ typedef struct odp_crypto_session_param_t { * * true: Authenticate cipher text * false: Authenticate plain text + * + * The default value is false. */ odp_bool_t auth_cipher_text;
- /** Preferred sync vs. async for odp_crypto_operation() */ + /** Preferred sync vs. async for odp_crypto_operation() + * + * The default value is ODP_CRYPTO_SYNC. + */ odp_crypto_op_mode_t pref_mode;
- /** Operation mode when using packet interface: sync or async */ + /** Operation mode when using packet interface: sync or async + * + * The default value is ODP_CRYPTO_SYNC. + */ odp_crypto_op_mode_t op_mode;
/** Cipher algorithm * - * Use odp_crypto_capability() for supported algorithms. + * Select cipher algorithm to be used. ODP_CIPHER_ALG_NULL indicates + * that ciphering is disabled. Use odp_crypto_capability() for + * supported algorithms. Note that some algorithms restrict choice of + * the pairing authentication algorithm. When ciphering is enabled + * cipher key and IV need to be set. The default value is + * ODP_CIPHER_ALG_NULL. */ odp_cipher_alg_t cipher_alg;
@@ -467,7 +483,18 @@ typedef struct odp_crypto_session_param_t {
/** Authentication algorithm * - * Use odp_crypto_capability() for supported algorithms. + * Select authentication algorithm to be used. ODP_AUTH_ALG_NULL + * indicates that authentication is disabled. Use + * odp_crypto_capability() for supported algorithms. Note that some + * algorithms restrict choice of the pairing cipher algorithm. When + * single algorithm provides both ciphering and authentication + * (i.e. Authenticated Encryption), authentication side key + * (auth_key) and IV (auth_iv) are ignored, and cipher side values are + * used instead. These algorithms ignore authentication side key + * and IV: ODP_AUTH_ALG_AES_GCM, ODP_AUTH_ALG_AES_CCM and + * ODP_AUTH_ALG_CHACHA20_POLY1305. Otherwise, all authentication side + * parameters must be set when authentication is enabled. The default + * value is ODP_AUTH_ALG_NULL. */ odp_auth_alg_t auth_alg;
commit e5f7c8fd4249b11a86715cd31394c73145cc674e Author: Matias Elo matias.elo@nokia.com Date: Wed Aug 1 10:30:51 2018 +0300
validation: timer: use new timer pool capabilities
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed by Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 281e02c5..4561e688 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -828,6 +828,7 @@ static void timer_test_odp_timer_all(void) odp_timer_capability_t timer_capa; odp_pool_t tbp; odp_timer_pool_t tp; + uint32_t num_timers;
/* Reserve at least one core for running other processes so the timer * test hopefully can run undisturbed and thus get better timing @@ -842,10 +843,15 @@ static void timer_test_odp_timer_all(void) if (num_workers < 1) num_workers = 1;
+ num_timers = num_workers * NTIMERS; + CU_ASSERT_FATAL(!odp_timer_capability(ODP_CLOCK_CPU, &timer_capa)); + if (timer_capa.max_timers && timer_capa.max_timers < num_timers) + num_timers = timer_capa.max_timers; + /* Create timeout pools */ odp_pool_param_init(¶ms); params.type = ODP_POOL_TIMEOUT; - params.tmo.num = (NTIMERS + 1) * num_workers; + params.tmo.num = num_timers + num_workers;
global_mem->tbp = odp_pool_create("tmo_pool", ¶ms); if (global_mem->tbp == ODP_POOL_INVALID) @@ -853,14 +859,11 @@ static void timer_test_odp_timer_all(void) tbp = global_mem->tbp;
/* Create a timer pool */ - if (odp_timer_capability(ODP_CLOCK_CPU, &timer_capa)) - CU_FAIL("Error: get timer capacity failed.\n"); - resolution_ns = MAX(RES, timer_capa.highest_res_ns); tparam.res_ns = resolution_ns; tparam.min_tmo = MIN_TMO; tparam.max_tmo = MAX_TMO; - tparam.num_timers = num_workers * NTIMERS; + tparam.num_timers = num_timers; tparam.priv = 0; tparam.clk_src = ODP_CLOCK_CPU; global_mem->tp = odp_timer_pool_create(NAME, &tparam); @@ -884,9 +887,13 @@ static void timer_test_odp_timer_all(void) LOG_DBG("Resolution: %" PRIu64 "\n", tparam.res_ns); LOG_DBG("Min timeout: %" PRIu64 "\n", tparam.min_tmo); LOG_DBG("Max timeout: %" PRIu64 "\n", tparam.max_tmo); - LOG_DBG("Num timers..: %u\n", tparam.num_timers); - LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS, + LOG_DBG("Num timers: %u\n", tparam.num_timers); + LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS, odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); + LOG_DBG("Max timers: %" PRIu32 "\n", timer_capa.max_timers); + LOG_DBG("Max timer pools: %" PRIu32 "\n", timer_capa.max_pools); + LOG_DBG("Max timer pools combined: %" PRIu32 "\n", + timer_capa.max_pools_combined);
tick = odp_timer_ns_to_tick(tp, 0); CU_ASSERT(tick == 0); @@ -932,7 +939,7 @@ static void timer_test_odp_timer_all(void) /* Check some statistics after the test */ if (odp_timer_pool_info(tp, &tpinfo) != 0) CU_FAIL("odp_timer_pool_info"); - CU_ASSERT(tpinfo.param.num_timers == (unsigned)num_workers * NTIMERS); + CU_ASSERT(tpinfo.param.num_timers == num_timers); CU_ASSERT(tpinfo.cur_timers == 0); timers_allocated = odp_atomic_load_u32(&global_mem->timers_allocated); CU_ASSERT(tpinfo.hwm_timers == timers_allocated);
commit 3bd31be9ea2f5e96e96a638a081d8223d1734e6c Author: Matias Elo matias.elo@nokia.com Date: Wed Aug 1 10:44:46 2018 +0300
linux-gen: timer: implement new timer pool capabilities
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed by Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 3fb50a91..6446b1c9 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -1117,6 +1117,9 @@ int odp_timer_capability(odp_timer_clk_src_t clk_src, int ret = 0;
if (clk_src == ODP_CLOCK_CPU) { + capa->max_pools_combined = MAX_TIMER_POOLS; + capa->max_pools = MAX_TIMER_POOLS; + capa->max_timers = 0; capa->highest_res_ns = timer_global->highest_res_ns; } else { ODP_ERR("ODP timer system doesn't support external clock source currently\n");
commit 9cd5b915b1b65e4e5fc83dedf9afa7029f1d3274 Author: Matias Elo matias.elo@nokia.com Date: Wed Aug 1 09:05:39 2018 +0300
api: timer: add timer pool capabilities
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed by Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h index d88faaae..c5c85514 100644 --- a/include/odp/api/spec/timer.h +++ b/include/odp/api/spec/timer.h @@ -135,6 +135,22 @@ typedef struct { * Timer capability */ typedef struct { + /** Maximum number of timer pools over all clock sources + * + * The total number of timer pools that can be created combining + * different clock sources. + */ + uint32_t max_pools_combined; + + /** Maximum number of timer pools for the requested clock source */ + uint32_t max_pools; + + /** Maximum number of timers in a pool + * + * The value of zero means that limited only by the available + * memory size for the pool. */ + uint32_t max_timers; + /** Highest timer resolution in nanoseconds. * * This defines the highest resolution supported by a timer.
commit 6afbe90158988dc36e25b1954fe1fe9124ae7df1 Author: Bogdan Pricope bogdan.pricope@linaro.org Date: Thu Aug 23 10:06:02 2018 +0300
validation: pktio: test per queue pktin configuration
Signed-off-by: Bogdan Pricope bogdan.pricope@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 3f082674..a4f7cecd 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -1482,6 +1482,42 @@ static void pktio_test_pktin_queue_config_sched(void) CU_ASSERT_FATAL(odp_pktio_close(pktio) == 0); }
+static void pktio_test_pktin_queue_config_multi_sched(void) +{ + odp_pktio_t pktio; + odp_pktio_capability_t capa; + odp_pktin_queue_param_t queue_param; + odp_queue_t in_queues[MAX_QUEUES]; + odp_pktin_queue_param_ovr_t queue_param_ovr[MAX_QUEUES]; + int num_queues, i; + + pktio = create_pktio(0, ODP_PKTIN_MODE_SCHED, ODP_PKTOUT_MODE_DIRECT); + CU_ASSERT_FATAL(pktio != ODP_PKTIO_INVALID); + + CU_ASSERT_FATAL(odp_pktio_capability(pktio, &capa) == 0 && + capa.max_input_queues > 0); + num_queues = (capa.max_input_queues < MAX_QUEUES) ? + capa.max_input_queues : MAX_QUEUES; + + odp_pktin_queue_param_init(&queue_param); + + queue_param.hash_enable = 0; + queue_param.num_queues = num_queues; + queue_param.queue_param.sched.group = ODP_SCHED_GROUP_ALL; + queue_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; + + for (i = 0; i < num_queues; i++) + queue_param_ovr[i].group = ODP_SCHED_GROUP_ALL; + queue_param.queue_param_ovr = queue_param_ovr; + + CU_ASSERT_FATAL(odp_pktin_queue_config(pktio, &queue_param) == 0); + + CU_ASSERT(odp_pktin_event_queue(pktio, in_queues, MAX_QUEUES) + == num_queues); + + CU_ASSERT_FATAL(odp_pktio_close(pktio) == 0); +} + static void pktio_test_pktin_queue_config_queue(void) { odp_pktio_t pktio; @@ -2794,6 +2830,7 @@ odp_testinfo_t pktio_suite_unsegmented[] = { ODP_TEST_INFO(pktio_test_info), ODP_TEST_INFO(pktio_test_pktin_queue_config_direct), ODP_TEST_INFO(pktio_test_pktin_queue_config_sched), + ODP_TEST_INFO(pktio_test_pktin_queue_config_multi_sched), ODP_TEST_INFO(pktio_test_pktin_queue_config_queue), ODP_TEST_INFO(pktio_test_pktout_queue_config), ODP_TEST_INFO(pktio_test_plain_queue),
commit 48e3615af2cf18136a32b5a0afa0d05303bd4d36 Author: Bogdan Pricope bogdan.pricope@linaro.org Date: Fri Aug 10 10:45:43 2018 +0300
linux-gen: pktio: implement per queue pktin configuration
Enables advanced usecases where heterogeneous settings are needed on input queues of the same interface.
Signed-off-by: Bogdan Pricope bogdan.pricope@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 3a788f04..4954d5f0 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1441,15 +1441,23 @@ int odp_pktin_queue_config(odp_pktio_t pktio, odp_queue_param_t queue_param; char name[ODP_QUEUE_NAME_LEN]; int pktio_id = odp_pktio_index(pktio); + odp_pktin_queue_param_ovr_t *queue_param_ovr = NULL; + + if (param->queue_param_ovr) + queue_param_ovr = param->queue_param_ovr + i;
snprintf(name, sizeof(name), "odp-pktin-%i-%i", pktio_id, i);
- if (param->classifier_enable) + if (param->classifier_enable) { odp_queue_param_init(&queue_param); - else + } else { memcpy(&queue_param, ¶m->queue_param, sizeof(odp_queue_param_t)); + if (queue_param_ovr) + queue_param.sched.group = + queue_param_ovr->group; + }
queue_param.type = ODP_QUEUE_TYPE_PLAIN;
commit 9b11cef7a44294ec094e508f8090d77c2284728e Author: Bogdan Pricope bogdan.pricope@linaro.org Date: Fri Aug 10 10:30:08 2018 +0300
api: pktio: extend odp_pktin_queue_param_t to support per queue configuration
Per queue configuration enables advanced usecases where input queues of the same interface may belong to different scheduler groups.
Signed-off-by: Bogdan Pricope bogdan.pricope@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index a55c2678..d3e1d405 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -148,6 +148,17 @@ typedef enum odp_pktio_op_mode_t {
} odp_pktio_op_mode_t;
+/** + * Packet input queue parameters override + */ +typedef struct odp_pktin_queue_param_ovr_t { + /** Override for schedule group in odp_schedule_param_t + * + * This parameter is considered only when queue type is + * ODP_QUEUE_TYPE_SCHED. */ + odp_schedule_group_t group; +} odp_pktin_queue_param_ovr_t; + /** * Packet input queue parameters */ @@ -203,6 +214,18 @@ typedef struct odp_pktin_queue_param_t { * value is ignored. */ odp_queue_param_t queue_param;
+ /** Queue parameters override + * + * When the override array is defined, the same parameter value + * in 'queue_param' is ignored and these per queue parameter + * values are used instead. Array elements are used in order + * (i.e. the first queue gets parameters from the first array + * element, etc). + * Must point to an array of num_queues elements or NULL to + * disable queue parameters override. The default value is + * NULL. + */ + odp_pktin_queue_param_ovr_t *queue_param_ovr; } odp_pktin_queue_param_t;
/**
commit 0485bc704a497ca482fe47228d6295fac661d947 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Aug 10 15:06:37 2018 +0300
validation: packet: add parse result test
Test new parse result functions.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ea67f3cd..0f019f6c 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -3383,6 +3383,114 @@ static void parse_eth_ipv4_rr_nop_icmp(void) odp_packet_free_multi(pkt, num_pkt); }
+static void parse_result(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + odp_packet_parse_result_t result[num_pkt]; + odp_packet_parse_result_t *result_ptr[num_pkt]; + + /* Ethernet/VLAN/IPv6/UDP */ + parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, + sizeof(test_packet_vlan_ipv6_udp), num_pkt); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_ALL; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + result_ptr[i] = &result[i]; + memset(&result[i], 0, sizeof(odp_packet_parse_result_t)); + } + + odp_packet_parse_result(pkt[0], result_ptr[0]); + odp_packet_parse_result_multi(&pkt[1], &result_ptr[1], num_pkt - 1); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(odp_packet_l2_type(pkt[i]) == ODP_PROTO_L2_TYPE_ETH); + CU_ASSERT(odp_packet_l3_type(pkt[i]) == ODP_PROTO_L3_TYPE_IPV6); + CU_ASSERT(odp_packet_l4_type(pkt[i]) == ODP_PROTO_L4_TYPE_UDP); + + CU_ASSERT(result[i].flag.all != 0); + CU_ASSERT(result[i].flag.has_error == + odp_packet_has_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2_error == + odp_packet_has_l2_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l3_error == + odp_packet_has_l3_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l4_error == + odp_packet_has_l4_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2 == + odp_packet_has_l2(pkt[i])); + CU_ASSERT(result[i].flag.has_l3 == + odp_packet_has_l3(pkt[i])); + CU_ASSERT(result[i].flag.has_l4 == + odp_packet_has_l4(pkt[i])); + CU_ASSERT(result[i].flag.has_eth == + odp_packet_has_eth(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_bcast == + odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_mcast == + odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_jumbo == + odp_packet_has_jumbo(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan == + odp_packet_has_vlan(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan_qinq == + odp_packet_has_vlan_qinq(pkt[i])); + CU_ASSERT(result[i].flag.has_arp == + odp_packet_has_arp(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv4 == + odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv6 == + odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_bcast == + odp_packet_has_ip_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_mcast == + odp_packet_has_ip_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ipfrag == + odp_packet_has_ipfrag(pkt[i])); + CU_ASSERT(result[i].flag.has_ipopt == + odp_packet_has_ipopt(pkt[i])); + CU_ASSERT(result[i].flag.has_ipsec == + odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(result[i].flag.has_udp == + odp_packet_has_udp(pkt[i])); + CU_ASSERT(result[i].flag.has_tcp == + odp_packet_has_tcp(pkt[i])); + CU_ASSERT(result[i].flag.has_sctp == + odp_packet_has_sctp(pkt[i])); + CU_ASSERT(result[i].flag.has_icmp == + odp_packet_has_icmp(pkt[i])); + + CU_ASSERT(result[i].packet_len == odp_packet_len(pkt[i])); + CU_ASSERT(result[i].l2_offset == odp_packet_l2_offset(pkt[i])); + CU_ASSERT(result[i].l3_offset == odp_packet_l3_offset(pkt[i])); + CU_ASSERT(result[i].l4_offset == odp_packet_l4_offset(pkt[i])); + CU_ASSERT(result[i].l3_chksum_status == + odp_packet_l3_chksum_status(pkt[i])); + CU_ASSERT(result[i].l4_chksum_status == + odp_packet_l4_chksum_status(pkt[i])); + CU_ASSERT(result[i].l2_type == odp_packet_l2_type(pkt[i])); + CU_ASSERT(result[i].l3_type == odp_packet_l3_type(pkt[i])); + CU_ASSERT(result[i].l4_type == odp_packet_l4_type(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -3441,6 +3549,7 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_udp_first_frag), ODP_TEST_INFO(parse_eth_ipv4_udp_last_frag), ODP_TEST_INFO(parse_eth_ipv4_rr_nop_icmp), + ODP_TEST_INFO(parse_result), ODP_TEST_INFO_NULL, };
commit 7b9a1713a148fffff7095215b661f37ffc2a681b Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Aug 10 14:31:38 2018 +0300
validation: packet: add num_pkt parameter to parse_test_alloc
It's more robust to use a parameter instead of assuming that a fixed number of packets are allocated.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index f1ec4f46..ea67f3cd 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2638,10 +2638,9 @@ static int packet_parse_suite_term(void) }
static void parse_test_alloc(odp_packet_t pkt[], const uint8_t test_packet[], - uint32_t len) + uint32_t len, int num_pkt) { int ret, i; - int num_pkt = PARSE_TEST_NUM_PKT;
ret = odp_packet_alloc_multi(parse_test.pool, len, pkt, num_pkt); CU_ASSERT_FATAL(ret == num_pkt); @@ -2662,7 +2661,7 @@ static void parse_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_udp, - sizeof(test_packet_ipv4_udp)); + sizeof(test_packet_ipv4_udp), num_pkt);
for (i = 0; i < num_pkt; i++) { chksum_status = odp_packet_l3_chksum_status(pkt[i]); @@ -2706,7 +2705,7 @@ static void parse_ipv4_udp(void) uint32_t offset[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_udp, - sizeof(test_packet_ipv4_udp)); + sizeof(test_packet_ipv4_udp), num_pkt);
for (i = 0; i < num_pkt; i++) offset[i] = 14; @@ -2742,7 +2741,7 @@ static void parse_eth_ipv4_tcp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_tcp, - sizeof(test_packet_ipv4_tcp)); + sizeof(test_packet_ipv4_tcp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2778,7 +2777,7 @@ static void parse_eth_ipv6_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv6_udp, - sizeof(test_packet_ipv6_udp)); + sizeof(test_packet_ipv6_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2808,7 +2807,7 @@ static void parse_eth_ipv6_tcp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv6_tcp, - sizeof(test_packet_ipv6_tcp)); + sizeof(test_packet_ipv6_tcp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_ALL; @@ -2838,7 +2837,7 @@ static void parse_eth_vlan_ipv4_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_vlan_ipv4_udp, - sizeof(test_packet_vlan_ipv4_udp)); + sizeof(test_packet_vlan_ipv4_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2869,7 +2868,7 @@ static void parse_eth_vlan_ipv6_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, - sizeof(test_packet_vlan_ipv6_udp)); + sizeof(test_packet_vlan_ipv6_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2906,7 +2905,7 @@ static void parse_eth_vlan_qinq_ipv4_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_vlan_qinq_ipv4_udp, - sizeof(test_packet_vlan_qinq_ipv4_udp)); + sizeof(test_packet_vlan_qinq_ipv4_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2938,7 +2937,7 @@ static void parse_eth_arp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_arp, - sizeof(test_packet_arp)); + sizeof(test_packet_arp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2970,7 +2969,7 @@ static void parse_eth_ipv4_icmp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_icmp, - sizeof(test_packet_ipv4_icmp)); + sizeof(test_packet_ipv4_icmp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3001,7 +3000,7 @@ static void parse_eth_ipv6_icmp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv6_icmp, - sizeof(test_packet_ipv6_icmp)); + sizeof(test_packet_ipv6_icmp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3032,7 +3031,7 @@ static void parse_eth_ipv4_sctp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_sctp, - sizeof(test_packet_ipv4_sctp)); + sizeof(test_packet_ipv4_sctp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3063,7 +3062,7 @@ static void parse_eth_ipv4_ipsec_ah(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_ipsec_ah, - sizeof(test_packet_ipv4_ipsec_ah)); + sizeof(test_packet_ipv4_ipsec_ah), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3094,7 +3093,7 @@ static void parse_eth_ipv4_ipsec_esp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_ipsec_esp, - sizeof(test_packet_ipv4_ipsec_esp)); + sizeof(test_packet_ipv4_ipsec_esp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3125,7 +3124,7 @@ static void parse_eth_ipv6_ipsec_ah(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv6_ipsec_ah, - sizeof(test_packet_ipv6_ipsec_ah)); + sizeof(test_packet_ipv6_ipsec_ah), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3162,7 +3161,7 @@ static void parse_eth_ipv6_ipsec_esp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv6_ipsec_esp, - sizeof(test_packet_ipv6_ipsec_esp)); + sizeof(test_packet_ipv6_ipsec_esp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3193,7 +3192,7 @@ static void parse_mcast_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_mcast_eth_ipv4_udp, - sizeof(test_packet_mcast_eth_ipv4_udp)); + sizeof(test_packet_mcast_eth_ipv4_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3227,7 +3226,7 @@ static void parse_bcast_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_bcast_eth_ipv4_udp, - sizeof(test_packet_bcast_eth_ipv4_udp)); + sizeof(test_packet_bcast_eth_ipv4_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3262,7 +3261,7 @@ static void parse_mcast_eth_ipv6_udp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_mcast_eth_ipv6_udp, - sizeof(test_packet_mcast_eth_ipv6_udp)); + sizeof(test_packet_mcast_eth_ipv6_udp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3296,7 +3295,7 @@ static void parse_eth_ipv4_udp_first_frag(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_udp_first_frag, - sizeof(test_packet_ipv4_udp_first_frag)); + sizeof(test_packet_ipv4_udp_first_frag), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3328,7 +3327,7 @@ static void parse_eth_ipv4_udp_last_frag(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_udp_last_frag, - sizeof(test_packet_ipv4_udp_last_frag)); + sizeof(test_packet_ipv4_udp_last_frag), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3360,7 +3359,7 @@ static void parse_eth_ipv4_rr_nop_icmp(void) odp_packet_t pkt[num_pkt];
parse_test_alloc(pkt, test_packet_ipv4_rr_nop_icmp, - sizeof(test_packet_ipv4_rr_nop_icmp)); + sizeof(test_packet_ipv4_rr_nop_icmp), num_pkt);
parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4;
commit ca71292dbadc5959ebcfaeda0c071ed558359b8b Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Aug 10 14:10:59 2018 +0300
linux-gen: packet: implement packet result calls
Simple implementation of the new packet result calls. Especially, flag copy needs to be optimized by storing flag bits directly into API defined format (packet_parse_result_flag_t) in the packet header.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 356ba5e6..f4c99ce1 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2835,6 +2835,59 @@ int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], return num; }
+void odp_packet_parse_result(odp_packet_t pkt, + odp_packet_parse_result_t *result) +{ + /* TODO: optimize to single word copy when packet header stores bits + * directly into odp_packet_parse_result_flag_t */ + result->flag.all = 0; + result->flag.has_error = odp_packet_has_error(pkt); + result->flag.has_l2_error = odp_packet_has_l2_error(pkt); + result->flag.has_l3_error = odp_packet_has_l3_error(pkt); + result->flag.has_l4_error = odp_packet_has_l4_error(pkt); + result->flag.has_l2 = odp_packet_has_l2(pkt); + result->flag.has_l3 = odp_packet_has_l3(pkt); + result->flag.has_l4 = odp_packet_has_l4(pkt); + result->flag.has_eth = odp_packet_has_eth(pkt); + result->flag.has_eth_bcast = odp_packet_has_eth_bcast(pkt); + result->flag.has_eth_mcast = odp_packet_has_eth_mcast(pkt); + result->flag.has_jumbo = odp_packet_has_jumbo(pkt); + result->flag.has_vlan = odp_packet_has_vlan(pkt); + result->flag.has_vlan_qinq = odp_packet_has_vlan_qinq(pkt); + result->flag.has_arp = odp_packet_has_arp(pkt); + result->flag.has_ipv4 = odp_packet_has_ipv4(pkt); + result->flag.has_ipv6 = odp_packet_has_ipv6(pkt); + result->flag.has_ip_bcast = odp_packet_has_ip_bcast(pkt); + result->flag.has_ip_mcast = odp_packet_has_ip_mcast(pkt); + result->flag.has_ipfrag = odp_packet_has_ipfrag(pkt); + result->flag.has_ipopt = odp_packet_has_ipopt(pkt); + result->flag.has_ipsec = odp_packet_has_ipsec(pkt); + result->flag.has_udp = odp_packet_has_udp(pkt); + result->flag.has_tcp = odp_packet_has_tcp(pkt); + result->flag.has_sctp = odp_packet_has_sctp(pkt); + result->flag.has_icmp = odp_packet_has_icmp(pkt); + + result->packet_len = odp_packet_len(pkt); + result->l2_offset = odp_packet_l2_offset(pkt); + result->l3_offset = odp_packet_l3_offset(pkt); + result->l4_offset = odp_packet_l4_offset(pkt); + result->l3_chksum_status = odp_packet_l3_chksum_status(pkt); + result->l4_chksum_status = odp_packet_l4_chksum_status(pkt); + result->l2_type = odp_packet_l2_type(pkt); + result->l3_type = odp_packet_l3_type(pkt); + result->l4_type = odp_packet_l4_type(pkt); +} + +void odp_packet_parse_result_multi(const odp_packet_t pkt[], + odp_packet_parse_result_t *result[], + int num) +{ + int i; + + for (i = 0; i < num; i++) + odp_packet_parse_result(pkt[i], result[i]); +} + uint64_t odp_packet_to_u64(odp_packet_t hdl) { return _odp_pri(hdl);
commit a89e63bb67bfc163ac67aed49a3e3b733aca8384 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Aug 10 11:04:29 2018 +0300
api: packet: add parse result call
This enables application to read all commonly used packet parser results with a single function call. This may improve performance when multiple results are needed, especially in ABI compatible builds where function inlining is likely disabled.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h index b5380b04..c8eecbac 100644 --- a/include/odp/api/abi-default/packet.h +++ b/include/odp/api/abi-default/packet.h @@ -72,6 +72,70 @@ typedef enum {
#define ODP_NUM_PACKET_COLORS 3
+/** Parse result flags */ +typedef struct odp_packet_parse_result_flag_t { + /** Flags union */ + union { + /** All flags as a 64 bit word */ + uint64_t all; + + /** Flags as a bitfield struct */ + struct { + /** @see odp_packet_has_error() */ + uint64_t has_error : 1; + /** @see odp_packet_has_l2_error() */ + uint64_t has_l2_error : 1; + /** @see odp_packet_has_l3_error() */ + uint64_t has_l3_error : 1; + /** @see odp_packet_has_l4_error() */ + uint64_t has_l4_error : 1; + /** @see odp_packet_has_l2() */ + uint64_t has_l2 : 1; + /** @see odp_packet_has_l3() */ + uint64_t has_l3 : 1; + /** @see odp_packet_has_l4() */ + uint64_t has_l4 : 1; + /** @see odp_packet_has_eth() */ + uint64_t has_eth : 1; + /** @see odp_packet_has_eth_bcast() */ + uint64_t has_eth_bcast : 1; + /** @see odp_packet_has_eth_mcast() */ + uint64_t has_eth_mcast : 1; + /** @see odp_packet_has_jumbo() */ + uint64_t has_jumbo : 1; + /** @see odp_packet_has_vlan() */ + uint64_t has_vlan : 1; + /** @see odp_packet_has_vlan_qinq() */ + uint64_t has_vlan_qinq : 1; + /** @see odp_packet_has_arp() */ + uint64_t has_arp : 1; + /** @see odp_packet_has_ipv4() */ + uint64_t has_ipv4 : 1; + /** @see odp_packet_has_ipv6() */ + uint64_t has_ipv6 : 1; + /** @see odp_packet_has_ip_bcast() */ + uint64_t has_ip_bcast : 1; + /** @see odp_packet_has_ip_mcast() */ + uint64_t has_ip_mcast : 1; + /** @see odp_packet_has_ipfrag() */ + uint64_t has_ipfrag : 1; + /** @see odp_packet_has_ipopt() */ + uint64_t has_ipopt : 1; + /** @see odp_packet_has_ipsec() */ + uint64_t has_ipsec : 1; + /** @see odp_packet_has_udp() */ + uint64_t has_udp : 1; + /** @see odp_packet_has_tcp() */ + uint64_t has_tcp : 1; + /** @see odp_packet_has_sctp() */ + uint64_t has_sctp : 1; + /** @see odp_packet_has_icmp() */ + uint64_t has_icmp : 1; + }; + }; + +} odp_packet_parse_result_flag_t; + /** * @} */ diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 78e519ac..3fd571a3 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1428,6 +1428,62 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], int num, const odp_packet_parse_param_t *param);
+/** Packet parse results */ +typedef struct odp_packet_parse_result_t { + /** Parse result flags */ + odp_packet_parse_result_flag_t flag; + + /** @see odp_packet_len() */ + uint32_t packet_len; + + /** @see odp_packet_l2_offset() */ + uint32_t l2_offset; + /** @see odp_packet_l3_offset() */ + uint32_t l3_offset; + /** @see odp_packet_l4_offset() */ + uint32_t l4_offset; + + /** @see odp_packet_l3_chksum_status() */ + odp_packet_chksum_status_t l3_chksum_status; + /** @see odp_packet_l4_chksum_status() */ + odp_packet_chksum_status_t l4_chksum_status; + + /** @see odp_packet_l2_type() */ + odp_proto_l2_type_t l2_type; + /** @see odp_packet_l3_type() */ + odp_proto_l3_type_t l3_type; + /** @see odp_packet_l4_type() */ + odp_proto_l4_type_t l4_type; + +} odp_packet_parse_result_t; + +/** + * Read parse results + * + * Read out the most commonly used packet parse results. The same information is + * available through individual function calls, but this call may be more + * efficient when reading multiple results from a packet. + * + * @param pkt Packet handle + * @param[out] result Pointer for parse result output + */ +void odp_packet_parse_result(odp_packet_t pkt, + odp_packet_parse_result_t *result); + +/** + * Read parse results from multiple packets + * + * Otherwise same functionality as odp_packet_parse_result() but handles + * multiple packets. + * + * @param pkt Packet handle array + * @param[out] result Parse result array for output + * @param num Number of packets and results + */ +void odp_packet_parse_result_multi(const odp_packet_t pkt[], + odp_packet_parse_result_t *result[], + int num); + /** * Packet pool * 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 fe21c7d9..e11aed97 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/packet.h +++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h @@ -89,6 +89,41 @@ typedef enum {
#define ODP_NUM_PACKET_COLORS 3
+typedef struct odp_packet_parse_result_flag_t { + union { + uint64_t all; + + struct { + uint64_t has_error : 1; + uint64_t has_l2_error : 1; + uint64_t has_l3_error : 1; + uint64_t has_l4_error : 1; + uint64_t has_l2 : 1; + uint64_t has_l3 : 1; + uint64_t has_l4 : 1; + uint64_t has_eth : 1; + uint64_t has_eth_bcast : 1; + uint64_t has_eth_mcast : 1; + uint64_t has_jumbo : 1; + uint64_t has_vlan : 1; + uint64_t has_vlan_qinq : 1; + uint64_t has_arp : 1; + uint64_t has_ipv4 : 1; + uint64_t has_ipv6 : 1; + uint64_t has_ip_bcast : 1; + uint64_t has_ip_mcast : 1; + uint64_t has_ipfrag : 1; + uint64_t has_ipopt : 1; + uint64_t has_ipsec : 1; + uint64_t has_udp : 1; + uint64_t has_tcp : 1; + uint64_t has_sctp : 1; + uint64_t has_icmp : 1; + }; + }; + +} odp_packet_parse_result_flag_t; + #include <odp/api/plat/packet_inlines.h>
/**
commit f9bb28e43836da8183276199f888fb8ee612defa Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Aug 9 14:11:53 2018 +0300
validation: packet: add packet subtype tests
Check that packet subtype is correct.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 29563552..76215bc2 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -225,6 +225,7 @@ static int alg_packet_op(odp_packet_t pkt, CU_ASSERT(ODP_EVENT_PACKET == odp_event_types(odp_packet_to_event(pkt), &subtype)); CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype); + CU_ASSERT(odp_packet_subtype(pkt) == ODP_EVENT_PACKET_CRYPTO);
rc = odp_crypto_result(&result, pkt); if (rc < 0) { @@ -298,6 +299,7 @@ static int alg_packet_op_enq(odp_packet_t pkt, CU_ASSERT(ODP_EVENT_PACKET == odp_event_types(odp_packet_to_event(pkt), &subtype)); CU_ASSERT(ODP_EVENT_PACKET_CRYPTO == subtype); + CU_ASSERT(odp_packet_subtype(pkt) == ODP_EVENT_PACKET_CRYPTO);
rc = odp_crypto_result(&result, pkt); if (rc < 0) { diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index b50a5ef9..aece2115 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -538,6 +538,7 @@ static int ipsec_send_in_one(const ipsec_test_part *part, pkto, &num_out, ¶m)); CU_ASSERT_EQUAL(num_out, part->out_pkt); + CU_ASSERT(odp_packet_subtype(*pkto) == ODP_EVENT_PACKET_IPSEC); } else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.inbound_op_mode) { CU_ASSERT_EQUAL(1, odp_ipsec_in_enq(&pkt, 1, ¶m));
@@ -553,6 +554,8 @@ static int ipsec_send_in_one(const ipsec_test_part *part, odp_event_types(event, &subtype)); CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC, subtype); pkto[i] = odp_ipsec_packet_from_event(event); + CU_ASSERT(odp_packet_subtype(pkto[i]) == + ODP_EVENT_PACKET_IPSEC); } } else { odp_queue_t queue; @@ -591,7 +594,10 @@ static int ipsec_send_in_one(const ipsec_test_part *part, subtype); CU_ASSERT(!part->out[i].status.error.sa_lookup);
- pkto[i++] = odp_ipsec_packet_from_event(ev); + pkto[i] = odp_ipsec_packet_from_event(ev); + CU_ASSERT(odp_packet_subtype(pkto[i]) == + ODP_EVENT_PACKET_IPSEC); + i++; continue; } } @@ -622,6 +628,8 @@ static int ipsec_send_out_one(const ipsec_test_part *part, pkto, &num_out, ¶m)); CU_ASSERT_EQUAL(num_out, part->out_pkt); + CU_ASSERT(odp_packet_subtype(*pkto) == + ODP_EVENT_PACKET_IPSEC); } else if (ODP_IPSEC_OP_MODE_ASYNC == suite_context.outbound_op_mode) { CU_ASSERT_EQUAL(1, odp_ipsec_out_enq(&pkt, 1, ¶m));
@@ -637,6 +645,8 @@ static int ipsec_send_out_one(const ipsec_test_part *part, odp_event_types(event, &subtype)); CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC, subtype); pkto[i] = odp_ipsec_packet_from_event(event); + CU_ASSERT(odp_packet_subtype(pkto[i]) == + ODP_EVENT_PACKET_IPSEC); } } else { struct odp_ipsec_out_inline_param_t inline_param; @@ -693,7 +703,10 @@ static int ipsec_send_out_one(const ipsec_test_part *part, subtype); CU_ASSERT(part->out[i].status.error.all);
- pkto[i++] = odp_ipsec_packet_from_event(ev); + pkto[i] = odp_ipsec_packet_from_event(ev); + CU_ASSERT(odp_packet_subtype(pkto[i]) == + ODP_EVENT_PACKET_IPSEC); + i++; continue; } } diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index a6e44f45..f1ec4f46 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -332,6 +332,7 @@ static void packet_test_alloc_free(void) CU_ASSERT(odp_event_types(odp_packet_to_event(packet), &subtype) == ODP_EVENT_PACKET); CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_packet_subtype(packet) == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID));
@@ -415,6 +416,8 @@ static void packet_test_alloc_free_multi(void) &subtype) == ODP_EVENT_PACKET); CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_packet_subtype(packet[i]) == + ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID));
commit 2411cd30bfc38651860fcc0e9f1331c3a37ccfbe Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Aug 9 11:44:20 2018 +0300
linux-gen: packet: implementation subtype api
Add inlined implementation of the new subtype API call and use that internally.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 25510298..71065172 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -45,6 +45,7 @@ typedef struct _odp_packet_inline_offset_t { uint16_t timestamp; uint16_t input_flags; uint16_t flags; + uint16_t subtype;
} _odp_packet_inline_offset_t;
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 602d3344..3851af4c 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -19,6 +19,7 @@ #include <odp/api/hints.h> #include <odp/api/time.h> #include <odp/api/abi/buffer.h> +#include <odp/api/abi/event.h>
#include <odp/api/plat/packet_inline_types.h> #include <odp/api/plat/pool_inline_types.h> @@ -64,6 +65,7 @@ #define odp_packet_to_event __odp_packet_to_event #define odp_packet_from_event_multi __odp_packet_from_event_multi #define odp_packet_to_event_multi __odp_packet_to_event_multi + #define odp_packet_subtype __odp_packet_subtype #else #undef _ODP_INLINE #define _ODP_INLINE @@ -355,6 +357,11 @@ _ODP_INLINE void odp_packet_to_event_multi(const odp_packet_t pkt[], ev[i] = odp_packet_to_event(pkt[i]); }
+_ODP_INLINE odp_event_subtype_t odp_packet_subtype(odp_packet_t pkt) +{ + return (odp_event_subtype_t)_odp_pkt_get(pkt, int8_t, subtype); +} + /** @endcond */
#endif diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index d17a61a0..b9b11770 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -147,11 +147,6 @@ static inline seg_entry_t *seg_entry_last(odp_packet_hdr_t *hdr) return &last->buf_hdr.seg[last_seg]; }
-static inline odp_event_subtype_t packet_subtype(odp_packet_t pkt) -{ - return packet_hdr(pkt)->subtype; -} - static inline void packet_subtype_set(odp_packet_t pkt, int ev) { packet_hdr(pkt)->subtype = ev; diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index fa20af5f..bb378528 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -19,6 +19,7 @@
/* Inlined API functions */ #include <odp/api/plat/event_inlines.h> +#include <odp/api/plat/packet_inlines.h>
odp_event_subtype_t odp_event_subtype(odp_event_t event) { @@ -26,7 +27,7 @@ odp_event_subtype_t odp_event_subtype(odp_event_t event) ODP_EVENT_PACKET) return ODP_EVENT_NO_SUBTYPE;
- return packet_subtype(odp_packet_from_event(event)); + return odp_packet_subtype(odp_packet_from_event(event)); }
odp_event_type_t odp_event_types(odp_event_t event, @@ -36,7 +37,7 @@ odp_event_type_t odp_event_types(odp_event_t event, odp_event_type_t event_type = _odp_buffer_event_type(buf);
*subtype = event_type == ODP_EVENT_PACKET ? - packet_subtype(odp_packet_from_event(event)) : + odp_packet_subtype(odp_packet_from_event(event)) : ODP_EVENT_NO_SUBTYPE;
return event_type; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index ae63ef4a..356ba5e6 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -51,7 +51,8 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { .flow_hash = offsetof(odp_packet_hdr_t, flow_hash), .timestamp = offsetof(odp_packet_hdr_t, timestamp), .input_flags = offsetof(odp_packet_hdr_t, p.input_flags), - .flags = offsetof(odp_packet_hdr_t, p.flags) + .flags = offsetof(odp_packet_hdr_t, p.flags), + .subtype = offsetof(odp_packet_hdr_t, subtype)
};
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index e01dd458..206f43f6 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -319,7 +319,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, for (i = 0; i < nb_tx; ++i) { odp_ipsec_packet_result_t result;
- if (packet_subtype(pkt_tbl[i]) == + if (odp_packet_subtype(pkt_tbl[i]) == ODP_EVENT_PACKET_IPSEC && pktio_entry->s.config.outbound_ipsec) {
commit e49af8a47be1f267a9d0a50066f9b7ba2f8bd774 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Aug 9 10:59:25 2018 +0300
api: packet: add subtype call
This call is useful when packet subtype needs to be checked sometime after an event has been converted into a packet. The first application stage (receiving and converting events) does not have to record packet subtype for following application stages that process only packets, not events.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 66665e12..78e519ac 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -224,6 +224,19 @@ typedef enum odp_packet_chksum_status_t {
} odp_packet_chksum_status_t;
+/** + * Event subtype of a packet + * + * Returns the subtype of a packet event. Subtype tells if the packet contains + * only basic metadata (ODP_EVENT_PACKET_BASIC) or in addition to that some + * specific metadata (e.g. ODP_EVENT_PACKET_CRYPTO or ODP_EVENT_PACKET_IPSEC). + * + * @param packet Packet handle + * + * @return Packet subtype + */ +odp_event_subtype_t odp_packet_subtype(odp_packet_t packet); + /* * * Alloc and free
commit e06d1f6cfb34e13b6a3bc81220f07c1207c04248 Author: Matias Elo matias.elo@nokia.com Date: Thu Aug 9 13:28:48 2018 +0300
api: classifier: rename ODP_PMR_INVAL to ODP_PMR_INVALID
Deprecates ODP_PMR_INVAL.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 26ad67ee..22dae395 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -453,7 +453,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args)
stats->pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, stats->cos); - if (stats->pmr == ODP_PMR_INVAL) { + if (stats->pmr == ODP_PMR_INVALID) { EXAMPLE_ERR("odp_pktio_pmr_cos failed"); exit(EXIT_FAILURE); } diff --git a/include/odp/api/abi-default/classification.h b/include/odp/api/abi-default/classification.h index ef102731..e0573fd4 100644 --- a/include/odp/api/abi-default/classification.h +++ b/include/odp/api/abi-default/classification.h @@ -11,6 +11,8 @@ extern "C" { #endif
+#include <odp/api/deprecated.h> + /** @internal Dummy type for strong typing */ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_cos_t;
@@ -25,7 +27,15 @@ typedef _odp_abi_cos_t *odp_cos_t; typedef _odp_abi_pmr_t *odp_pmr_t;
#define ODP_COS_INVALID ((odp_cos_t)0) -#define ODP_PMR_INVAL ((odp_pmr_t)0) +#define ODP_PMR_INVALID ((odp_pmr_t)0) + +#if ODP_DEPRECATED_API +#define ODP_PMR_INVAL ODP_PMR_INVALID +#else +/* Required to prevent Doxygen warning */ +#define ODP_PMR_INVAL +#undef ODP_PMR_INVAL +#endif
#define ODP_COS_NAME_LEN 32
diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 38389301..043059fa 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -44,12 +44,17 @@ extern "C" { */
/** - * @def ODP_PMR_INVAL + * @def ODP_PMR_INVALID * Invalid odp_pmr_t value. * This value is returned from odp_cls_pmr_create() * function on failure. */
+/** + * @def ODP_PMR_INVAL + * @deprecated Use ODP_PMR_INVALID instead + */ + /** * Supported PMR term values * @@ -558,7 +563,7 @@ void odp_cls_pmr_param_init(odp_pmr_param_t *param); * @param dst_cos destination CoS handle * * @return Handle to the Packet Match Rule. - * @retval ODP_PMR_INVAL on failure + * @retval ODP_PMR_INVALID on failure */ odp_pmr_t odp_cls_pmr_create(const odp_pmr_param_t *terms, int num_terms, odp_cos_t src_cos, odp_cos_t dst_cos); diff --git a/platform/linux-generic/include-abi/odp/api/abi/classification.h b/platform/linux-generic/include-abi/odp/api/abi/classification.h index 92b926cd..843e15f6 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/classification.h +++ b/platform/linux-generic/include-abi/odp/api/abi/classification.h @@ -18,6 +18,7 @@ extern "C" { #endif
#include <odp/api/plat/strong_types.h> +#include <odp/api/deprecated.h>
/** @ingroup odp_classification * @{ @@ -27,7 +28,15 @@ typedef ODP_HANDLE_T(odp_cos_t); #define ODP_COS_INVALID _odp_cast_scalar(odp_cos_t, 0)
typedef ODP_HANDLE_T(odp_pmr_t); -#define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, 0) +#define ODP_PMR_INVALID _odp_cast_scalar(odp_pmr_t, 0) + +#if ODP_DEPRECATED_API +#define ODP_PMR_INVAL ODP_PMR_INVALID +#else +/* Required to prevent Doxygen warning */ +#define ODP_PMR_INVAL +#undef ODP_PMR_INVAL +#endif
#define ODP_COS_NAME_LEN 32
diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index c7007fb7..e3f1cc6e 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -287,7 +287,7 @@ odp_pmr_t alloc_pmr(pmr_t **pmr) UNLOCK(&pmr_tbl->pmr[i].s.lock); } ODP_ERR("CLS_PMR_MAX_ENTRY reached"); - return ODP_PMR_INVAL; + return ODP_PMR_INVALID; }
static @@ -307,7 +307,8 @@ pmr_t *get_pmr_entry(odp_pmr_t pmr) { uint32_t pmr_id = _odp_pmr_to_ndx(pmr);
- if (pmr_id >= CLS_PMR_MAX_ENTRY || pmr == ODP_PMR_INVAL) + if (pmr_id >= CLS_PMR_MAX_ENTRY || + pmr == ODP_PMR_INVALID) return NULL; if (pmr_tbl->pmr[pmr_id].s.valid == 0) return NULL; @@ -652,20 +653,20 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_param_t *terms, int num_terms,
if (NULL == cos_src || NULL == cos_dst) { ODP_ERR("Invalid input handle"); - return ODP_PMR_INVAL; + return ODP_PMR_INVALID; }
if (num_terms > CLS_PMRTERM_MAX) { ODP_ERR("no of terms greater than supported CLS_PMRTERM_MAX"); - return ODP_PMR_INVAL; + return ODP_PMR_INVALID; }
if (CLS_PMR_PER_COS_MAX == odp_atomic_load_u32(&cos_src->s.num_rule)) - return ODP_PMR_INVAL; + return ODP_PMR_INVALID;
id = alloc_pmr(&pmr); /*if alloc_pmr is successful it returns with the acquired lock*/ - if (id == ODP_PMR_INVAL) + if (id == ODP_PMR_INVALID) return id;
pmr->s.num_pmr = num_terms; @@ -673,12 +674,12 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_param_t *terms, int num_terms, val_sz = terms[i].val_sz; if (val_sz > CLS_PMR_TERM_BYTES_MAX) { pmr->s.valid = 0; - return ODP_PMR_INVAL; + return ODP_PMR_INVALID; } if (0 > odp_pmr_create_term(&pmr->s.pmr_term_value[i], &terms[i])) { UNLOCK(&pmr->s.lock); - return ODP_PMR_INVAL; + return ODP_PMR_INVALID; } }
diff --git a/test/validation/api/classification/odp_classification_basic.c b/test/validation/api/classification/odp_classification_basic.c index 31067345..8a4e21d3 100644 --- a/test/validation/api/classification/odp_classification_basic.c +++ b/test/validation/api/classification/odp_classification_basic.c @@ -119,14 +119,14 @@ static void classification_test_create_pmr_match(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); - CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVAL)); + CU_ASSERT(pmr != ODP_PMR_INVALID); + CU_ASSERT(odp_pmr_to_u64(pmr) != odp_pmr_to_u64(ODP_PMR_INVALID)); /* destroy the created PMR */ retval = odp_cls_pmr_destroy(pmr); CU_ASSERT(retval == 0);
/* destroy an INVALID PMR */ - retval = odp_cls_pmr_destroy(ODP_PMR_INVAL); + retval = odp_cls_pmr_destroy(ODP_PMR_INVALID); CU_ASSERT(retval < 0);
odp_queue_destroy(queue); @@ -309,7 +309,7 @@ static void classification_test_pmr_composite_create(void) pmr_composite = odp_cls_pmr_create(pmr_terms, PMR_SET_NUM, default_cos, cos); CU_ASSERT(odp_pmr_to_u64(pmr_composite) != - odp_pmr_to_u64(ODP_PMR_INVAL)); + odp_pmr_to_u64(ODP_PMR_INVALID));
retval = odp_cls_pmr_destroy(pmr_composite); CU_ASSERT(retval == 0); diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index 4b90d783..55a86f5b 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -146,7 +146,7 @@ static void classification_test_pktin_classifier_flag(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt = create_packet(default_pkt_info); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); @@ -240,7 +240,7 @@ static void _classification_test_pmr_term_tcp_dport(int num_pkt) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
for (i = 0; i < num_pkt; i++) { pkt = create_packet(default_pkt_info); @@ -412,7 +412,7 @@ static void classification_test_pmr_term_tcp_sport(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt = create_packet(default_pkt_info); CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); @@ -525,7 +525,7 @@ static void classification_test_pmr_term_udp_dport(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.udp = true; @@ -641,7 +641,7 @@ static void classification_test_pmr_term_udp_sport(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.udp = true; @@ -755,7 +755,7 @@ static void classification_test_pmr_term_ipproto(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.udp = true; @@ -864,7 +864,7 @@ static void classification_test_pmr_term_dmac(void) pmr_param.val_sz = ODPH_ETHADDR_LEN;
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.udp = true; @@ -971,7 +971,7 @@ static void classification_test_pmr_term_packet_len(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
/* create packet of payload length 1024 */ pkt_info = default_pkt_info; @@ -1083,7 +1083,7 @@ static void classification_test_pmr_term_vlan_id_0(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
/* create packet of payload length 1024 */ pkt_info = default_pkt_info; @@ -1196,7 +1196,7 @@ static void classification_test_pmr_term_vlan_id_x(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
/* create packet of payload length 1024 */ pkt_info = default_pkt_info; @@ -1309,7 +1309,7 @@ static void classification_test_pmr_term_eth_type_0(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.vlan = true; @@ -1419,7 +1419,7 @@ static void classification_test_pmr_term_eth_type_x(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
/* create packet of payload length 1024 */ pkt_info = default_pkt_info; @@ -1539,7 +1539,7 @@ static void classification_test_pmr_pool_set(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID);
pkt_info = default_pkt_info; pkt_info.udp = true; @@ -1638,7 +1638,7 @@ static void classification_test_pmr_queue_set(void) pmr_param.val_sz = sizeof(val);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT(pmr != ODP_PMR_INVAL); + CU_ASSERT(pmr != ODP_PMR_INVALID); pkt_info = default_pkt_info; pkt_info.udp = true; pkt = create_packet(pkt_info); @@ -1724,7 +1724,7 @@ static void classification_test_pmr_term_daddr(void) pmr_param.val_sz = sizeof(addr);
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr != ODP_PMR_INVALID);
/* packet with dst ip address matching PMR rule to be received in the CoS queue*/ @@ -1834,7 +1834,7 @@ static void classification_test_pmr_term_ipv6daddr(void) pmr_param.val_sz = ODPH_IPV6ADDR_LEN;
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr != ODP_PMR_INVALID);
/* packet with dst ip address matching PMR rule to be received in the CoS queue*/ @@ -1944,7 +1944,7 @@ static void classification_test_pmr_term_ipv6saddr(void) pmr_param.val_sz = ODPH_IPV6ADDR_LEN;
pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, cos); - CU_ASSERT_FATAL(pmr != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr != ODP_PMR_INVALID);
/* packet with dst ip address matching PMR rule to be received in the CoS queue*/ diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index 42d0c412..3b9e0276 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -79,7 +79,7 @@ int classification_suite_init(void) cos_list[i] = ODP_COS_INVALID;
for (i = 0; i < CLS_ENTRIES; i++) - pmr_list[i] = ODP_PMR_INVAL; + pmr_list[i] = ODP_PMR_INVALID;
for (i = 0; i < CLS_ENTRIES; i++) queue_list[i] = ODP_QUEUE_INVALID; @@ -211,7 +211,7 @@ void configure_cls_pmr_chain(void) pmr_list[CLS_PMR_CHAIN_SRC] = odp_cls_pmr_create(&pmr_param, 1, cos_list[CLS_DEFAULT], cos_list[CLS_PMR_CHAIN_SRC]); - CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_SRC] != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_SRC] != ODP_PMR_INVALID);
val = CLS_PMR_CHAIN_PORT; maskport = 0xffff; @@ -223,7 +223,7 @@ void configure_cls_pmr_chain(void) pmr_list[CLS_PMR_CHAIN_DST] = odp_cls_pmr_create(&pmr_param, 1, cos_list[CLS_PMR_CHAIN_SRC], cos_list[CLS_PMR_CHAIN_DST]); - CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_DST] != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr_list[CLS_PMR_CHAIN_DST] != ODP_PMR_INVALID); }
void test_cls_pmr_chain(void) @@ -569,7 +569,7 @@ void configure_pmr_cos(void) pmr_list[CLS_PMR] = odp_cls_pmr_create(&pmr_param, 1, cos_list[CLS_DEFAULT], cos_list[CLS_PMR]); - CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr_list[CLS_PMR] != ODP_PMR_INVALID); }
void test_pmr_cos(void) @@ -652,7 +652,7 @@ void configure_pktio_pmr_composite(void) pmr_list[CLS_PMR_SET] = odp_cls_pmr_create(pmr_params, num_terms, cos_list[CLS_DEFAULT], cos_list[CLS_PMR_SET]); - CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVAL); + CU_ASSERT_FATAL(pmr_list[CLS_PMR_SET] != ODP_PMR_INVALID); }
void test_pktio_pmr_composite_cos(void)
commit 97bb0f3801f2f1692a12e24d9aa4fadf0b8ce477 Author: Matias Elo matias.elo@nokia.com Date: Fri Aug 10 13:49:20 2018 +0300
abi: timer: use strong type for odp_timer_pool_t
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/timer.h b/include/odp/api/abi-default/timer.h index a7da8ff7..566d199e 100644 --- a/include/odp/api/abi-default/timer.h +++ b/include/odp/api/abi-default/timer.h @@ -23,13 +23,14 @@ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_timer_t; /** @internal Dummy type for strong typing */ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_timeout_t;
+/** @internal Dummy type for strong typing */ +typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_timer_pool_t; + /** @addtogroup odp_timer * @{ **/
-struct timer_pool_s; /**< Forward declaration */ - -typedef struct timer_pool_s *odp_timer_pool_t; +typedef _odp_abi_timer_pool_t *odp_timer_pool_t;
#define ODP_TIMER_POOL_INVALID ((odp_timer_pool_t)0)
diff --git a/platform/linux-generic/include-abi/odp/api/abi/timer.h b/platform/linux-generic/include-abi/odp/api/abi/timer.h index 48138f72..c08da1ce 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/timer.h +++ b/platform/linux-generic/include-abi/odp/api/abi/timer.h @@ -24,9 +24,7 @@ extern "C" { * @{ **/
-struct timer_pool_s; /**< Forward declaration */ - -typedef struct timer_pool_s *odp_timer_pool_t; +typedef ODP_HANDLE_T(odp_timer_pool_t);
#define ODP_TIMER_POOL_INVALID _odp_cast_scalar(odp_timer_pool_t, 0)
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 7e2848c7..3fb50a91 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -224,6 +224,16 @@ typedef struct timer_global_t {
static timer_global_t *timer_global;
+static inline timer_pool_t *timer_pool_from_hdl(odp_timer_pool_t hdl) +{ + return (timer_pool_t *)(uintptr_t)hdl; +} + +static inline odp_timer_pool_t timer_pool_to_hdl(timer_pool_t *tp) +{ + return (odp_timer_pool_t)tp; +} + static inline timer_pool_t *handle_to_tp(odp_timer_t hdl) { uint32_t tp_idx = _odp_typeval(hdl) >> INDEX_BITS; @@ -315,8 +325,10 @@ static odp_timer_pool_t timer_pool_new(const char *name, } tp->shm = shm; tp->param = *param; - tp->min_rel_tck = odp_timer_ns_to_tick(tp, param->min_tmo); - tp->max_rel_tck = odp_timer_ns_to_tick(tp, param->max_tmo); + tp->min_rel_tck = odp_timer_ns_to_tick(timer_pool_to_hdl(tp), + param->min_tmo); + tp->max_rel_tck = odp_timer_ns_to_tick(timer_pool_to_hdl(tp), + param->max_tmo); tp->num_alloc = 0; odp_atomic_init_u32(&tp->high_wm, 0); tp->first_free = 0; @@ -349,7 +361,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, if (tp->param.clk_src == ODP_CLOCK_CPU) itimer_init(tp); } - return tp; + return timer_pool_to_hdl(tp); }
static void block_sigalarm(void) @@ -798,13 +810,14 @@ static unsigned timer_expire(timer_pool_t *tp, uint32_t idx, uint64_t tick)
static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) { - tick_buf_t *array = &tpid->tick_buf[0]; - uint32_t high_wm = _odp_atomic_u32_load_mm(&tpid->high_wm, + timer_pool_t *tp = timer_pool_from_hdl(tpid); + tick_buf_t *array = &tp->tick_buf[0]; + uint32_t high_wm = _odp_atomic_u32_load_mm(&tp->high_wm, _ODP_MEMMODEL_ACQ); unsigned nexp = 0; uint32_t i;
- ODP_ASSERT(high_wm <= tpid->param.num_timers); + ODP_ASSERT(high_wm <= tp->param.num_timers); for (i = 0; i < high_wm;) { /* As a rare occurrence, we can outsmart the HW prefetcher * and the compiler (GCC -fprefetch-loop-arrays) with some @@ -815,7 +828,7 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) uint64_t exp_tck = array[i++].exp_tck.v; if (odp_unlikely(exp_tck <= tick)) { /* Attempt to expire timer */ - nexp += timer_expire(tpid, i - 1, tick); + nexp += timer_expire(tp, i - 1, tick); } } return nexp; @@ -863,7 +876,8 @@ static unsigned process_timer_pools(void) nticks - 1, tp->name); tp->notify_overrun = 0; } - nexp += odp_timer_pool_expire(tp, tp_tick + nticks); + nexp += odp_timer_pool_expire(timer_pool_to_hdl(tp), + tp_tick + nticks); } } return nexp; @@ -924,7 +938,7 @@ static void timer_notify(timer_pool_t *tp) prev_tick = odp_atomic_fetch_inc_u64(&tp->cur_tick);
/* Scan timer array, looking for timers to expire */ - (void)odp_timer_pool_expire(tp, prev_tick + 1); + (void)odp_timer_pool_expire(timer_pool_to_hdl(tp), prev_tick + 1);
/* Else skip scan of timers. cur_tick was updated and next itimer * invocation will process older expiration ticks as well */ @@ -1140,32 +1154,40 @@ void odp_timer_pool_start(void)
void odp_timer_pool_destroy(odp_timer_pool_t tpid) { - odp_timer_pool_del(tpid); + odp_timer_pool_del(timer_pool_from_hdl(tpid)); }
uint64_t odp_timer_tick_to_ns(odp_timer_pool_t tpid, uint64_t ticks) { - return ticks * tpid->param.res_ns; + timer_pool_t *tp = timer_pool_from_hdl(tpid); + + return ticks * tp->param.res_ns; }
uint64_t odp_timer_ns_to_tick(odp_timer_pool_t tpid, uint64_t ns) { - return (uint64_t)(ns / tpid->param.res_ns); + timer_pool_t *tp = timer_pool_from_hdl(tpid); + + return (uint64_t)(ns / tp->param.res_ns); }
uint64_t odp_timer_current_tick(odp_timer_pool_t tpid) { + timer_pool_t *tp = timer_pool_from_hdl(tpid); + /* Relaxed atomic read for lowest overhead */ - return odp_atomic_load_u64(&tpid->cur_tick); + return odp_atomic_load_u64(&tp->cur_tick); }
int odp_timer_pool_info(odp_timer_pool_t tpid, odp_timer_pool_info_t *buf) { - buf->param = tpid->param; - buf->cur_timers = tpid->num_alloc; - buf->hwm_timers = odp_atomic_load_u32(&tpid->high_wm); - buf->name = tpid->name; + timer_pool_t *tp = timer_pool_from_hdl(tpid); + + buf->param = tp->param; + buf->cur_timers = tp->num_alloc; + buf->hwm_timers = odp_atomic_load_u32(&tp->high_wm); + buf->name = tp->name; return 0; }
@@ -1178,18 +1200,20 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, odp_queue_t queue, void *user_ptr) { + timer_pool_t *tp = timer_pool_from_hdl(tpid); + if (odp_unlikely(tpid == ODP_TIMER_POOL_INVALID)) { ODP_ERR("Invalid timer pool.\n"); return ODP_TIMER_INVALID; }
if (odp_unlikely(queue == ODP_QUEUE_INVALID)) { - ODP_ERR("%s: Invalid queue handle\n", tpid->name); + ODP_ERR("%s: Invalid queue handle\n", tp->name); return ODP_TIMER_INVALID; } /* We don't care about the validity of user_ptr because we will not * attempt to dereference it */ - return timer_alloc(tpid, queue, user_ptr); + return timer_alloc(tp, queue, user_ptr); }
odp_event_t odp_timer_free(odp_timer_t hdl)
commit 62782960967bd58553139d6b20f91a5849a2c288 Author: Matias Elo matias.elo@nokia.com Date: Thu Aug 9 11:19:28 2018 +0300
api: shm: remove unused ODP_SHM_NULL define
ODP_SHM_INVALID should be used instead.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/abi-default/shared_memory.h b/include/odp/api/abi-default/shared_memory.h index 888e140b..fdc93ea1 100644 --- a/include/odp/api/abi-default/shared_memory.h +++ b/include/odp/api/abi-default/shared_memory.h @@ -21,7 +21,6 @@ typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_shm_t; typedef _odp_abi_shm_t *odp_shm_t;
#define ODP_SHM_INVALID ((odp_shm_t)0) -#define ODP_SHM_NULL ODP_SHM_INVALID #define ODP_SHM_NAME_LEN 32
/** diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 898f4123..c18275cb 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -35,11 +35,6 @@ extern "C" { * Invalid shared memory block */
-/** - * @def ODP_SHM_NULL - * Synonym for buffer pool use - */ - /** * @def ODP_SHM_NAME_LEN * Maximum shared memory block name length in chars including null char diff --git a/platform/linux-generic/include-abi/odp/api/abi/shared_memory.h b/platform/linux-generic/include-abi/odp/api/abi/shared_memory.h index 4e6d4805..648bd1ee 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/shared_memory.h +++ b/platform/linux-generic/include-abi/odp/api/abi/shared_memory.h @@ -28,7 +28,6 @@ extern "C" { typedef ODP_HANDLE_T(odp_shm_t);
#define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0) -#define ODP_SHM_NULL ODP_SHM_INVALID
#define ODP_SHM_NAME_LEN 32
commit e6a9fa3c8d910fcc0f31cf5f3334addf3246d482 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Dec 26 01:27:07 2017 +0300
validation: crypto: 3GPP crypto algorightms support
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 8c73f49e..29563552 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -61,6 +61,12 @@ static const char *auth_alg_name(odp_auth_alg_t auth) return "ODP_AUTH_ALG_AES_CMAC"; case ODP_AUTH_ALG_CHACHA20_POLY1305: return "ODP_AUTH_ALG_CHACHA20_POLY1305"; + case ODP_AUTH_ALG_KASUMI_F9: + return "ODP_AUTH_ALG_KASUMI_F9"; + case ODP_AUTH_ALG_SNOW3G_UIA2: + return "ODP_AUTH_ALG_SNOW3G_UIA2"; + case ODP_AUTH_ALG_ZUC_EIA3: + return "ODP_AUTH_ALG_ZUC_EIA3"; default: return "Unknown"; } @@ -85,6 +91,12 @@ static const char *cipher_alg_name(odp_cipher_alg_t cipher) return "ODP_CIPHER_ALG_AES_CCM"; case ODP_CIPHER_ALG_CHACHA20_POLY1305: return "ODP_CIPHER_ALG_CHACHA20_POLY1305"; + case ODP_CIPHER_ALG_KASUMI_F8: + return "ODP_CIPHER_ALG_KASUMI_F8"; + case ODP_CIPHER_ALG_SNOW3G_UEA2: + return "ODP_CIPHER_ALG_SNOW3G_UEA2"; + case ODP_CIPHER_ALG_ZUC_EEA3: + return "ODP_CIPHER_ALG_ZUC_EEA3"; default: return "Unknown"; } @@ -507,6 +519,15 @@ static void check_alg(odp_crypto_op_t op, if (cipher_alg == ODP_CIPHER_ALG_CHACHA20_POLY1305 && !(capa.ciphers.bit.chacha20_poly1305)) rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_KASUMI_F8 && + !(capa.ciphers.bit.kasumi_f8)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_SNOW3G_UEA2 && + !(capa.ciphers.bit.snow3g_uea2)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_ZUC_EEA3 && + !(capa.ciphers.bit.zuc_eea3)) + rc = -1; if (cipher_alg == ODP_CIPHER_ALG_DES && !(capa.ciphers.bit.des)) rc = -1; @@ -532,6 +553,15 @@ static void check_alg(odp_crypto_op_t op, if (auth_alg == ODP_AUTH_ALG_CHACHA20_POLY1305 && !(capa.auths.bit.chacha20_poly1305)) rc = -1; + if (auth_alg == ODP_AUTH_ALG_KASUMI_F9 && + !(capa.auths.bit.kasumi_f9)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_SNOW3G_UIA2 && + !(capa.auths.bit.snow3g_uia2)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_ZUC_EIA3 && + !(capa.auths.bit.zuc_eia3)) + rc = -1; if (auth_alg == ODP_AUTH_ALG_MD5_HMAC && !(capa.auths.bit.md5_hmac)) rc = -1; @@ -712,6 +742,18 @@ static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth) if (!capability.ciphers.bit.chacha20_poly1305) return ODP_TEST_INACTIVE; break; + case ODP_CIPHER_ALG_KASUMI_F8: + if (!capability.ciphers.bit.kasumi_f8) + return ODP_TEST_INACTIVE; + break; + case ODP_CIPHER_ALG_SNOW3G_UEA2: + if (!capability.ciphers.bit.snow3g_uea2) + return ODP_TEST_INACTIVE; + break; + case ODP_CIPHER_ALG_ZUC_EEA3: + if (!capability.ciphers.bit.zuc_eea3) + return ODP_TEST_INACTIVE; + break; default: fprintf(stderr, "Unsupported cipher algorithm\n"); return ODP_TEST_INACTIVE; @@ -767,6 +809,18 @@ static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth) if (!capability.auths.bit.chacha20_poly1305) return ODP_TEST_INACTIVE; break; + case ODP_AUTH_ALG_KASUMI_F9: + if (!capability.auths.bit.kasumi_f9) + return ODP_TEST_INACTIVE; + break; + case ODP_AUTH_ALG_SNOW3G_UIA2: + if (!capability.auths.bit.snow3g_uia2) + return ODP_TEST_INACTIVE; + break; + case ODP_AUTH_ALG_ZUC_EIA3: + if (!capability.auths.bit.zuc_eia3) + return ODP_TEST_INACTIVE; + break; default: fprintf(stderr, "Unsupported authentication algorithm\n"); return ODP_TEST_INACTIVE; @@ -1167,6 +1221,153 @@ static void crypto_test_dec_alg_aes_ctr_ovr_iv(void) false); }
+static int check_alg_kasumi_f8(void) +{ + return check_alg_support(ODP_CIPHER_ALG_KASUMI_F8, ODP_AUTH_ALG_NULL); +} + +static void crypto_test_enc_alg_kasumi_f8(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_KASUMI_F8, + ODP_AUTH_ALG_NULL, + kasumi_f8_reference, + ARRAY_SIZE(kasumi_f8_reference), + false, + true); +} + +static void crypto_test_enc_alg_kasumi_f8_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_KASUMI_F8, + ODP_AUTH_ALG_NULL, + kasumi_f8_reference, + ARRAY_SIZE(kasumi_f8_reference), + true, + true); +} + +static void crypto_test_dec_alg_kasumi_f8(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_KASUMI_F8, + ODP_AUTH_ALG_NULL, + kasumi_f8_reference, + ARRAY_SIZE(kasumi_f8_reference), + false, + true); +} + +static void crypto_test_dec_alg_kasumi_f8_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_KASUMI_F8, + ODP_AUTH_ALG_NULL, + kasumi_f8_reference, + ARRAY_SIZE(kasumi_f8_reference), + true, + true); +} + +static int check_alg_snow3g_uea2(void) +{ + return check_alg_support(ODP_CIPHER_ALG_SNOW3G_UEA2, ODP_AUTH_ALG_NULL); +} + +static void crypto_test_enc_alg_snow3g_uea2(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_SNOW3G_UEA2, + ODP_AUTH_ALG_NULL, + snow3g_uea2_reference, + ARRAY_SIZE(snow3g_uea2_reference), + false, + true); +} + +static void crypto_test_enc_alg_snow3g_uea2_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_SNOW3G_UEA2, + ODP_AUTH_ALG_NULL, + snow3g_uea2_reference, + ARRAY_SIZE(snow3g_uea2_reference), + true, + true); +} + +static void crypto_test_dec_alg_snow3g_uea2(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_SNOW3G_UEA2, + ODP_AUTH_ALG_NULL, + snow3g_uea2_reference, + ARRAY_SIZE(snow3g_uea2_reference), + false, + true); +} + +static void crypto_test_dec_alg_snow3g_uea2_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_SNOW3G_UEA2, + ODP_AUTH_ALG_NULL, + snow3g_uea2_reference, + ARRAY_SIZE(snow3g_uea2_reference), + true, + true); +} + +static int check_alg_zuc_eea3(void) +{ + return check_alg_support(ODP_CIPHER_ALG_ZUC_EEA3, ODP_AUTH_ALG_NULL); +} + +static void crypto_test_enc_alg_zuc_eea3(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_ZUC_EEA3, + ODP_AUTH_ALG_NULL, + zuc_eea3_reference, + ARRAY_SIZE(zuc_eea3_reference), + false, + true); +} + +static void crypto_test_enc_alg_zuc_eea3_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_ZUC_EEA3, + ODP_AUTH_ALG_NULL, + zuc_eea3_reference, + ARRAY_SIZE(zuc_eea3_reference), + true, + true); +} + +static void crypto_test_dec_alg_zuc_eea3(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_ZUC_EEA3, + ODP_AUTH_ALG_NULL, + zuc_eea3_reference, + ARRAY_SIZE(zuc_eea3_reference), + false, + true); +} + +static void crypto_test_dec_alg_zuc_eea3_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_ZUC_EEA3, + ODP_AUTH_ALG_NULL, + zuc_eea3_reference, + ARRAY_SIZE(zuc_eea3_reference), + true, + true); +} + static int check_alg_hmac_md5(void) { return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC); @@ -1448,6 +1649,153 @@ static void crypto_test_check_alg_aes_cmac(void) false); }
+static int check_alg_kasumi_f9(void) +{ + return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_KASUMI_F9); +} + +static void crypto_test_gen_alg_kasumi_f9(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_KASUMI_F9, + kasumi_f9_reference, + ARRAY_SIZE(kasumi_f9_reference), + false, + true); +} + +static void crypto_test_gen_alg_kasumi_f9_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_KASUMI_F9, + kasumi_f9_reference, + ARRAY_SIZE(kasumi_f9_reference), + true, + true); +} + +static void crypto_test_check_alg_kasumi_f9(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_KASUMI_F9, + kasumi_f9_reference, + ARRAY_SIZE(kasumi_f9_reference), + false, + true); +} + +static void crypto_test_check_alg_kasumi_f9_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_KASUMI_F9, + kasumi_f9_reference, + ARRAY_SIZE(kasumi_f9_reference), + true, + true); +} + +static int check_alg_snow3g_uia2(void) +{ + return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SNOW3G_UIA2); +} + +static void crypto_test_gen_alg_snow3g_uia2(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SNOW3G_UIA2, + snow3g_uia2_reference, + ARRAY_SIZE(snow3g_uia2_reference), + false, + true); +} + +static void crypto_test_gen_alg_snow3g_uia2_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SNOW3G_UIA2, + snow3g_uia2_reference, + ARRAY_SIZE(snow3g_uia2_reference), + true, + true); +} + +static void crypto_test_check_alg_snow3g_uia2(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SNOW3G_UIA2, + snow3g_uia2_reference, + ARRAY_SIZE(snow3g_uia2_reference), + false, + true); +} + +static void crypto_test_check_alg_snow3g_uia2_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_SNOW3G_UIA2, + snow3g_uia2_reference, + ARRAY_SIZE(snow3g_uia2_reference), + true, + true); +} + +static int check_alg_zuc_eia3(void) +{ + return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_ZUC_EIA3); +} + +static void crypto_test_gen_alg_zuc_eia3(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_ZUC_EIA3, + zuc_eia3_reference, + ARRAY_SIZE(zuc_eia3_reference), + false, + true); +} + +static void crypto_test_gen_alg_zuc_eia3_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_ENCODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_ZUC_EIA3, + zuc_eia3_reference, + ARRAY_SIZE(zuc_eia3_reference), + true, + true); +} + +static void crypto_test_check_alg_zuc_eia3(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_ZUC_EIA3, + zuc_eia3_reference, + ARRAY_SIZE(zuc_eia3_reference), + false, + true); +} + +static void crypto_test_check_alg_zuc_eia3_ovr_iv(void) +{ + check_alg(ODP_CRYPTO_OP_DECODE, + ODP_CIPHER_ALG_NULL, + ODP_AUTH_ALG_ZUC_EIA3, + zuc_eia3_reference, + ARRAY_SIZE(zuc_eia3_reference), + true, + true); +} + static int crypto_suite_sync_init(void) { suite_context.pool = odp_pool_lookup("packet_pool"); @@ -1529,6 +1877,30 @@ odp_testinfo_t crypto_suite[] = { check_alg_aes_ctr), ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_aes_ctr_ovr_iv, check_alg_aes_ctr), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_kasumi_f8, + check_alg_kasumi_f8), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_kasumi_f8, + check_alg_kasumi_f8), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_kasumi_f8_ovr_iv, + check_alg_kasumi_f8), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_kasumi_f8_ovr_iv, + check_alg_kasumi_f8), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_snow3g_uea2, + check_alg_snow3g_uea2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_snow3g_uea2, + check_alg_snow3g_uea2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_snow3g_uea2_ovr_iv, + check_alg_snow3g_uea2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_snow3g_uea2_ovr_iv, + check_alg_snow3g_uea2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_zuc_eea3, + check_alg_zuc_eea3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_zuc_eea3, + check_alg_zuc_eea3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_zuc_eea3_ovr_iv, + check_alg_zuc_eea3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_dec_alg_zuc_eea3_ovr_iv, + check_alg_zuc_eea3), ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm, check_alg_aes_gcm), ODP_TEST_INFO_CONDITIONAL(crypto_test_enc_alg_aes_gcm_ovr_iv, @@ -1589,6 +1961,30 @@ odp_testinfo_t crypto_suite[] = { check_alg_aes_cmac), ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_aes_cmac, check_alg_aes_cmac), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_kasumi_f9, + check_alg_kasumi_f9), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_kasumi_f9, + check_alg_kasumi_f9), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_kasumi_f9_ovr_iv, + check_alg_kasumi_f9), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_kasumi_f9_ovr_iv, + check_alg_kasumi_f9), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_snow3g_uia2, + check_alg_snow3g_uia2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_snow3g_uia2, + check_alg_snow3g_uia2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_snow3g_uia2_ovr_iv, + check_alg_snow3g_uia2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_snow3g_uia2_ovr_iv, + check_alg_snow3g_uia2), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_zuc_eia3, + check_alg_zuc_eia3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_zuc_eia3, + check_alg_zuc_eia3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_gen_alg_zuc_eia3_ovr_iv, + check_alg_zuc_eia3), + ODP_TEST_INFO_CONDITIONAL(crypto_test_check_alg_zuc_eia3_ovr_iv, + check_alg_zuc_eia3), ODP_TEST_INFO_NULL, };
diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h index 9adb4332..3e40d708 100644 --- a/test/validation/api/crypto/test_vectors.h +++ b/test/validation/api/crypto/test_vectors.h @@ -1534,4 +1534,186 @@ static crypto_test_reference_t aes_xcbc_reference[] = { } };
+/* + * Kasumi F8 and F9 test vectors are taken from + * 3GPP TS 35.203 V9.0.0 (2009-12) + * 3rd Generation Partnership Project; + * Technical Specification Group Services and System Aspects; + * 3G Security; + * Specification of the 3GPP Confidentiality + * and Integrity Algorithms; + * Document 3: Implementors' Test Data + * (Release 9) + */ +static crypto_test_reference_t kasumi_f8_reference[] = { + { + .cipher_key_length = KASUMI_F8_KEY_LEN, + .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20, + 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52}, + .cipher_iv_length = KASUMI_F8_IV_LEN, + .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, + .length = 120, /* 15 bytes */ + .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, + 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 }, + .ciphertext = { 0x9b, 0xc9, 0x2c, 0xa8, 0x03, 0xc6, 0x7b, 0x28, + 0xa1, 0x1a, 0x4b, 0xee, 0x5a, 0x0c, 0x25 } + } +}; + +static crypto_test_reference_t kasumi_f9_reference[] = { + { + .auth_key_length = KASUMI_F9_KEY_LEN, + .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9, + 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e }, + .auth_iv_length = KASUMI_F9_IV_LEN, + .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd, + 0x01, }, + .length = 384, /* 48 bytes */ + .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2, + 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1, + 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29, + 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0, + 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20, + 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09}, + .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2, + 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1, + 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29, + 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0, + 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20, + 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09}, + .digest_length = KASUMI_F9_DIGEST_LEN, + .digest = { 0xdd, 0x7d, 0xfa, 0xdd }, + } +}; + +/* + * Snow3G UEA2 & UIA2 test vectors are taken from + * Specification of the 3GPP Confidentiality and + * Integrity Algorithms UEA2 & UIA2 + * Document 3: Implementors’ Test Data + * Version: 1.1 + * Date: 25 th October 2012 + */ +static crypto_test_reference_t snow3g_uea2_reference[] = { + { + .cipher_key_length = SNOW3G_UEA2_KEY_LEN, + .cipher_key = { 0x5a, 0xcb, 0x1d, 0x64, 0x4c, 0x0d, 0x51, 0x20, + 0x4e, 0xa5, 0xf1, 0x45, 0x10, 0x10, 0xd8, 0x52}, + .cipher_iv_length = SNOW3G_UEA2_IV_LEN, + .cipher_iv = { 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00, + 0xfa, 0x55, 0x6b, 0x26, 0x1c, 0x00, 0x00, 0x00}, + .length = 120, /* 15 bytes */ + .plaintext = { 0xad, 0x9c, 0x44, 0x1f, 0x89, 0x0b, 0x38, 0xc4, + 0x57, 0xa4, 0x9d, 0x42, 0x14, 0x07, 0xe8 }, + .ciphertext = { 0xba, 0x0f, 0x31, 0x30, 0x03, 0x34, 0xc5, 0x6b, + 0x52, 0xa7, 0x49, 0x7c, 0xba, 0xc0, 0x46 } + } +}; + +static crypto_test_reference_t snow3g_uia2_reference[] = { + { + .auth_key_length = SNOW3G_UIA2_KEY_LEN, + .auth_key = { 0xc7, 0x36, 0xc6, 0xaa, 0xb2, 0x2b, 0xff, 0xf9, + 0x1e, 0x26, 0x98, 0xd2, 0xe2, 0x2a, 0xd5, 0x7e}, + .auth_iv_length = SNOW3G_UIA2_IV_LEN, + .auth_iv = { 0x14, 0x79, 0x3e, 0x41, 0x03, 0x97, 0xe8, 0xfd, + 0x94, 0x79, 0x3e, 0x41, 0x03, 0x97, 0x68, 0xfd }, + .length = 384, /* 48 bytes */ + .plaintext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2, + 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1, + 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29, + 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0, + 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20, + 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09}, + .ciphertext = { 0xd0, 0xa7, 0xd4, 0x63, 0xdf, 0x9f, 0xb2, 0xb2, + 0x78, 0x83, 0x3f, 0xa0, 0x2e, 0x23, 0x5a, 0xa1, + 0x72, 0xbd, 0x97, 0x0c, 0x14, 0x73, 0xe1, 0x29, + 0x07, 0xfb, 0x64, 0x8b, 0x65, 0x99, 0xaa, 0xa0, + 0xb2, 0x4a, 0x03, 0x86, 0x65, 0x42, 0x2b, 0x20, + 0xa4, 0x99, 0x27, 0x6a, 0x50, 0x42, 0x70, 0x09}, + .digest_length = SNOW3G_UIA2_DIGEST_LEN, + .digest = { 0x38, 0xb5, 0x54, 0xc0 } + } +}; + +/* + * ZUC EEA3 and EIA3 test vectors from + * Specification of the 3GPP Confidentiality and Integrity + * Algorithms 128-EEA3 & 128-EIA3 + * Document 3: Implementor’s Test Data + * Version: 1.1 + * Date: 4 th Jan. 2011 + */ +static crypto_test_reference_t zuc_eea3_reference[] = { + { + .cipher_key_length = ZUC_EIA3_KEY_LEN, + .cipher_key = { 0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8, + 0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a}, + .cipher_iv_length = ZUC_EEA3_IV_LEN, + .cipher_iv = { 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xc4, 0x00, 0x00, 0x00 }, + .length = 800, /* 100 bytes */ + .plaintext = { 0x14, 0xa8, 0xef, 0x69, 0x3d, 0x67, 0x85, 0x07, + 0xbb, 0xe7, 0x27, 0x0a, 0x7f, 0x67, 0xff, 0x50, + 0x06, 0xc3, 0x52, 0x5b, 0x98, 0x07, 0xe4, 0x67, + 0xc4, 0xe5, 0x60, 0x00, 0xba, 0x33, 0x8f, 0x5d, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xc8, 0x0d, 0x3b, 0x38, 0xf0, 0x7f, 0x4b, + 0xe2, 0xd8, 0xff, 0x58, 0x05, 0xf5, 0x13, 0x22, + 0x29, 0xbd, 0xe9, 0x3b, 0xbb, 0xdc, 0xaf, 0x38, + 0x2b, 0xf1, 0xee, 0x97, 0x2f, 0xbf, 0x99, 0x77, + 0xba, 0xda, 0x89, 0x45, 0x84, 0x7a, 0x2a, 0x6c, + 0x9a, 0xd3, 0x4a, 0x66, 0x75, 0x54, 0xe0, 0x4d, + 0x1f, 0x7f, 0xa2, 0xc3, 0x32, 0x41, 0xbd, 0x8f, + 0x01, 0xba, 0x22, 0x0d }, + .ciphertext = { 0x13, 0x1d, 0x43, 0xe0, 0xde, 0xa1, 0xbe, 0x5c, + 0x5a, 0x1b, 0xfd, 0x97, 0x1d, 0x85, 0x2c, 0xbf, + 0x71, 0x2d, 0x7b, 0x4f, 0x57, 0x96, 0x1f, 0xea, + 0x32, 0x08, 0xaf, 0xa8, 0xbc, 0xa4, 0x33, 0xf4, + 0x56, 0xad, 0x09, 0xc7, 0x41, 0x7e, 0x58, 0xbc, + 0x69, 0xcf, 0x88, 0x66, 0xd1, 0x35, 0x3f, 0x74, + 0x86, 0x5e, 0x80, 0x78, 0x1d, 0x20, 0x2d, 0xfb, + 0x3e, 0xcf, 0xf7, 0xfc, 0xbc, 0x3b, 0x19, 0x0f, + 0xe8, 0x2a, 0x20, 0x4e, 0xd0, 0xe3, 0x50, 0xfc, + 0x0f, 0x6f, 0x26, 0x13, 0xb2, 0xf2, 0xbc, 0xa6, + 0xdf, 0x5a, 0x47, 0x3a, 0x57, 0xa4, 0xa0, 0x0d, + 0x98, 0x5e, 0xba, 0xd8, 0x80, 0xd6, 0xf2, 0x38, + 0x64, 0xa0, 0x7b, 0x01 } + } +}; + +static crypto_test_reference_t zuc_eia3_reference[] = { + { + .auth_key_length = ZUC_EIA3_KEY_LEN, + .auth_key = { 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb, + 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a }, + .auth_iv_length = ZUC_EIA3_IV_LEN, + .auth_iv = { 0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00 }, + .length = 584, /* 73 bytes */ + .plaintext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e, + 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1, + 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83, + 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0, + 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9, + 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9, + 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d, + 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c, + 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81, + 0x00, 0x00, 0x00, 0x00 }, + .ciphertext = { 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e, + 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1, + 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83, + 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0, + 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9, + 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9, + 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d, + 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c, + 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81, + 0x00, 0x00, 0x00, 0x00 }, + .digest_length = ZUC_EIA3_DIGEST_LEN, + .digest = { 0x24, 0xa8, 0x42, 0xb3 } + } +}; + #endif diff --git a/test/validation/api/crypto/test_vectors_len.h b/test/validation/api/crypto/test_vectors_len.h index 95d202b6..3418ef27 100644 --- a/test/validation/api/crypto/test_vectors_len.h +++ b/test/validation/api/crypto/test_vectors_len.h @@ -70,4 +70,31 @@ #define AES_XCBC_MAC_96_CHECK_LEN 12 #define AES_XCBC_MAC_CHECK_LEN 16
+/* KASUMI_F8 */ +#define KASUMI_F8_KEY_LEN 16 +#define KASUMI_F8_IV_LEN 8 + +/* SNOW3G_UEA2 */ +#define SNOW3G_UEA2_KEY_LEN 16 +#define SNOW3G_UEA2_IV_LEN 16 + +/* ZUC_EEA3 */ +#define ZUC_EEA3_KEY_LEN 16 +#define ZUC_EEA3_IV_LEN 16 + +/* KASUMI_F9 */ +#define KASUMI_F9_KEY_LEN 16 +#define KASUMI_F9_IV_LEN 9 +#define KASUMI_F9_DIGEST_LEN 4 + +/* SNOW3G_UIA2 */ +#define SNOW3G_UIA2_KEY_LEN 16 +#define SNOW3G_UIA2_IV_LEN 16 +#define SNOW3G_UIA2_DIGEST_LEN 4 + +/* ZUC_EIA3 */ +#define ZUC_EIA3_KEY_LEN 16 +#define ZUC_EIA3_IV_LEN 16 +#define ZUC_EIA3_DIGEST_LEN 4 + #endif
commit bfc48dbed3d58f7f3325cd0a05445f2ab537c38e Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Mon Jul 16 15:34:54 2018 +0300
validation: crypto: add support for bit mode algorithm testing
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index 361e6ac9..8c73f49e 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -320,13 +320,15 @@ static void alg_test(odp_crypto_op_t op, odp_cipher_alg_t cipher_alg, odp_auth_alg_t auth_alg, crypto_test_reference_t *ref, - odp_bool_t ovr_iv) + odp_bool_t ovr_iv, + odp_bool_t bit_mode) { odp_crypto_session_t session; int rc; odp_crypto_ses_create_err_t status; odp_bool_t ok = false; int iteration; + uint32_t reflength; odp_crypto_session_param_t ses_params; odp_packet_data_range_t cipher_range; odp_packet_data_range_t auth_range; @@ -375,9 +377,14 @@ static void alg_test(odp_crypto_op_t op, auth_range.offset = 0; auth_range.length = ref->length;
+ if (bit_mode) + reflength = (ref->length + 7) / 8; + else + reflength = ref->length; + /* Prepare input data */ odp_packet_t pkt = odp_packet_alloc(suite_context.pool, - ref->length + ref->digest_length); + reflength + ref->digest_length); CU_ASSERT(pkt != ODP_PACKET_INVALID); if (pkt == ODP_PACKET_INVALID) goto cleanup; @@ -391,18 +398,18 @@ static void alg_test(odp_crypto_op_t op, continue;
if (op == ODP_CRYPTO_OP_ENCODE) { - odp_packet_copy_from_mem(pkt, 0, ref->length, + odp_packet_copy_from_mem(pkt, 0, reflength, ref->plaintext); } else { - odp_packet_copy_from_mem(pkt, 0, ref->length, + odp_packet_copy_from_mem(pkt, 0, reflength, ref->ciphertext); - odp_packet_copy_from_mem(pkt, ref->length, + odp_packet_copy_from_mem(pkt, reflength, ref->digest_length, ref->digest); if (iteration == WRONG_DIGEST_TEST) { uint8_t byte = ~ref->digest[0];
- odp_packet_copy_from_mem(pkt, ref->length, + odp_packet_copy_from_mem(pkt, reflength, 1, &byte); } } @@ -412,19 +419,19 @@ static void alg_test(odp_crypto_op_t op, ovr_iv ? ref->cipher_iv : NULL, ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, - ref->aad, ref->length); + ref->aad, reflength); else if (ODP_CRYPTO_ASYNC == suite_context.op_mode) rc = alg_packet_op_enq(pkt, &ok, session, ovr_iv ? ref->cipher_iv : NULL, ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, - ref->aad, ref->length); + ref->aad, reflength); else rc = alg_packet_op(pkt, &ok, session, ovr_iv ? ref->cipher_iv : NULL, ovr_iv ? ref->auth_iv : NULL, &cipher_range, &auth_range, - ref->aad, ref->length); + ref->aad, reflength); if (rc < 0) break;
@@ -438,14 +445,14 @@ static void alg_test(odp_crypto_op_t op, if (op == ODP_CRYPTO_OP_ENCODE) { CU_ASSERT(!packet_cmp_mem(pkt, 0, ref->ciphertext, - ref->length)); - CU_ASSERT(!packet_cmp_mem(pkt, ref->length, + reflength)); + CU_ASSERT(!packet_cmp_mem(pkt, reflength, ref->digest, ref->digest_length)); } else { CU_ASSERT(!packet_cmp_mem(pkt, 0, ref->plaintext, - ref->length)); + reflength)); } }
@@ -461,7 +468,8 @@ static void check_alg(odp_crypto_op_t op, odp_auth_alg_t auth_alg, crypto_test_reference_t *ref, size_t count, - odp_bool_t ovr_iv) + odp_bool_t ovr_iv, + odp_bool_t bit_mode) { odp_crypto_capability_t capa; int rc, i; @@ -565,7 +573,9 @@ static void check_alg(odp_crypto_op_t op, if (cipher_capa[i].key_len == ref[idx].cipher_key_length && cipher_capa[i].iv_len == - ref[idx].cipher_iv_length) { + ref[idx].cipher_iv_length && + cipher_capa[i].bit_mode == + bit_mode) { cipher_idx = i; break; } @@ -573,10 +583,11 @@ static void check_alg(odp_crypto_op_t op,
if (cipher_idx < 0) { printf("\n Unsupported: alg=%s, key_len=%" PRIu32 - ", iv_len=%" PRIu32 "\n", + ", iv_len=%" PRIu32 "%s\n", cipher_alg_name(cipher_alg), ref[idx].cipher_key_length, - ref[idx].cipher_iv_length); + ref[idx].cipher_iv_length, + bit_mode ? " using bits" : ""); continue; }
@@ -586,7 +597,9 @@ static void check_alg(odp_crypto_op_t op, auth_capa[i].iv_len == ref[idx].auth_iv_length && auth_capa[i].key_len == - ref[idx].auth_key_length) { + ref[idx].auth_key_length && + auth_capa[i].bit_mode == + bit_mode) { auth_idx = i; break; } @@ -594,15 +607,17 @@ static void check_alg(odp_crypto_op_t op,
if (auth_idx < 0) { printf("\n Unsupported: alg=%s, key_len=%" PRIu32 - ", iv_len=%" PRIu32 ", digest_len=%" PRIu32 "\n", + ", iv_len=%" PRIu32 ", digest_len=%" PRIu32 + "%s\n", auth_alg_name(auth_alg), ref[idx].auth_key_length, ref[idx].auth_iv_length, - ref[idx].digest_length); + ref[idx].digest_length, + bit_mode ? " using bits" : ""); continue; }
- alg_test(op, cipher_alg, auth_alg, &ref[idx], ovr_iv); + alg_test(op, cipher_alg, auth_alg, &ref[idx], ovr_iv, bit_mode);
cipher_tested[cipher_idx] = true; auth_tested[auth_idx] = true; @@ -610,23 +625,24 @@ static void check_alg(odp_crypto_op_t op,
for (i = 0; i < cipher_num; i++) { cipher_ok |= cipher_tested[i]; - if (!cipher_tested[i]) { + if (!cipher_tested[i] && cipher_capa[i].bit_mode == bit_mode) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " - "iv_len=%" PRIu32 "\n", + "iv_len=%" PRIu32 "%s\n", cipher_alg_name(cipher_alg), cipher_capa[i].key_len, - cipher_capa[i].iv_len); - } + cipher_capa[i].iv_len, + cipher_capa[i].bit_mode ? " using bits" : ""); }
for (i = 0; i < auth_num; i++) { auth_ok |= auth_tested[i]; - if (!auth_tested[i]) + if (!auth_tested[i] && auth_capa[i].bit_mode == bit_mode) printf("\n Untested: alg=%s, key_len=%" PRIu32 ", " - "digest_len=%" PRIu32 "\n", + "digest_len=%" PRIu32 "%s\n", auth_alg_name(auth_alg), auth_capa[i].key_len, - auth_capa[i].digest_len); + auth_capa[i].digest_len, + auth_capa[i].bit_mode ? " using bits" : ""); }
/* Verify that we were able to run at least several tests */ @@ -772,6 +788,7 @@ static void crypto_test_enc_alg_null(void) ODP_AUTH_ALG_NULL, null_reference, ARRAY_SIZE(null_reference), + false, false); }
@@ -782,6 +799,7 @@ static void crypto_test_dec_alg_null(void) ODP_AUTH_ALG_NULL, null_reference, ARRAY_SIZE(null_reference), + false, false); }
@@ -801,6 +819,7 @@ static void crypto_test_enc_alg_3des_cbc(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), + false, false); }
@@ -814,7 +833,8 @@ static void crypto_test_enc_alg_3des_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -829,6 +849,7 @@ static void crypto_test_dec_alg_3des_cbc(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), + false, false); }
@@ -844,7 +865,8 @@ static void crypto_test_dec_alg_3des_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, tdes_cbc_reference, ARRAY_SIZE(tdes_cbc_reference), - true); + true, + false); }
static int check_alg_chacha20_poly1305(void) @@ -860,6 +882,7 @@ static void crypto_test_enc_alg_chacha20_poly1305(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), + false, false); }
@@ -870,7 +893,8 @@ static void crypto_test_enc_alg_chacha20_poly1305_ovr_iv(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), - true); + true, + false); }
static void crypto_test_dec_alg_chacha20_poly1305(void) @@ -880,6 +904,7 @@ static void crypto_test_dec_alg_chacha20_poly1305(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), + false, false); }
@@ -890,7 +915,8 @@ static void crypto_test_dec_alg_chacha20_poly1305_ovr_iv(void) ODP_AUTH_ALG_CHACHA20_POLY1305, chacha20_poly1305_reference, ARRAY_SIZE(chacha20_poly1305_reference), - true); + true, + false); }
static int check_alg_aes_gcm(void) @@ -909,6 +935,7 @@ static void crypto_test_enc_alg_aes_gcm(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), + false, false); }
@@ -923,7 +950,8 @@ static void crypto_test_enc_alg_aes_gcm_ovr_iv(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -938,6 +966,7 @@ static void crypto_test_dec_alg_aes_gcm(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), + false, false); }
@@ -953,7 +982,8 @@ static void crypto_test_dec_alg_aes_gcm_ovr_iv(void) ODP_AUTH_ALG_AES_GCM, aes_gcm_reference, ARRAY_SIZE(aes_gcm_reference), - true); + true, + false); }
static int check_alg_aes_ccm(void) @@ -968,6 +998,7 @@ static void crypto_test_enc_alg_aes_ccm(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), + false, false); }
@@ -978,7 +1009,8 @@ static void crypto_test_enc_alg_aes_ccm_ovr_iv(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), - true); + true, + false); }
static void crypto_test_dec_alg_aes_ccm(void) @@ -988,6 +1020,7 @@ static void crypto_test_dec_alg_aes_ccm(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), + false, false); }
@@ -998,7 +1031,8 @@ static void crypto_test_dec_alg_aes_ccm_ovr_iv(void) ODP_AUTH_ALG_AES_CCM, aes_ccm_reference, ARRAY_SIZE(aes_ccm_reference), - true); + true, + false); }
static int check_alg_aes_cbc(void) @@ -1017,6 +1051,7 @@ static void crypto_test_enc_alg_aes_cbc(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), + false, false); }
@@ -1030,7 +1065,8 @@ static void crypto_test_enc_alg_aes_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -1045,6 +1081,7 @@ static void crypto_test_dec_alg_aes_cbc(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), + false, false); }
@@ -1060,7 +1097,8 @@ static void crypto_test_dec_alg_aes_cbc_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_cbc_reference, ARRAY_SIZE(aes_cbc_reference), - true); + true, + false); }
static int check_alg_aes_ctr(void) @@ -1079,6 +1117,7 @@ static void crypto_test_enc_alg_aes_ctr(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), + false, false); }
@@ -1092,7 +1131,8 @@ static void crypto_test_enc_alg_aes_ctr_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), - true); + true, + false); }
/* This test verifies the correctness of decode (ciphertext -> plaintext) @@ -1107,6 +1147,7 @@ static void crypto_test_dec_alg_aes_ctr(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), + false, false); }
@@ -1122,7 +1163,8 @@ static void crypto_test_dec_alg_aes_ctr_ovr_iv(void) ODP_AUTH_ALG_NULL, aes_ctr_reference, ARRAY_SIZE(aes_ctr_reference), - true); + true, + false); }
static int check_alg_hmac_md5(void) @@ -1144,6 +1186,7 @@ static void crypto_test_gen_alg_hmac_md5(void) ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, ARRAY_SIZE(hmac_md5_reference), + false, false); }
@@ -1154,6 +1197,7 @@ static void crypto_test_check_alg_hmac_md5(void) ODP_AUTH_ALG_MD5_HMAC, hmac_md5_reference, ARRAY_SIZE(hmac_md5_reference), + false, false); }
@@ -1176,6 +1220,7 @@ static void crypto_test_gen_alg_hmac_sha1(void) ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, ARRAY_SIZE(hmac_sha1_reference), + false, false); }
@@ -1186,6 +1231,7 @@ static void crypto_test_check_alg_hmac_sha1(void) ODP_AUTH_ALG_SHA1_HMAC, hmac_sha1_reference, ARRAY_SIZE(hmac_sha1_reference), + false, false); }
@@ -1208,6 +1254,7 @@ static void crypto_test_gen_alg_hmac_sha256(void) ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, ARRAY_SIZE(hmac_sha256_reference), + false, false); }
@@ -1218,6 +1265,7 @@ static void crypto_test_check_alg_hmac_sha256(void) ODP_AUTH_ALG_SHA256_HMAC, hmac_sha256_reference, ARRAY_SIZE(hmac_sha256_reference), + false, false); }
@@ -1240,6 +1288,7 @@ static void crypto_test_gen_alg_hmac_sha384(void) ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, ARRAY_SIZE(hmac_sha384_reference), + false, false); }
@@ -1250,6 +1299,7 @@ static void crypto_test_check_alg_hmac_sha384(void) ODP_AUTH_ALG_SHA384_HMAC, hmac_sha384_reference, ARRAY_SIZE(hmac_sha384_reference), + false, false); }
@@ -1272,6 +1322,7 @@ static void crypto_test_gen_alg_hmac_sha512(void) ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, ARRAY_SIZE(hmac_sha512_reference), + false, false); }
@@ -1282,6 +1333,7 @@ static void crypto_test_check_alg_hmac_sha512(void) ODP_AUTH_ALG_SHA512_HMAC, hmac_sha512_reference, ARRAY_SIZE(hmac_sha512_reference), + false, false); }
@@ -1305,6 +1357,7 @@ static void crypto_test_gen_alg_aes_xcbc(void) ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, ARRAY_SIZE(aes_xcbc_reference), + false, false); }
@@ -1315,6 +1368,7 @@ static void crypto_test_check_alg_aes_xcbc(void) ODP_AUTH_ALG_AES_XCBC_MAC, aes_xcbc_reference, ARRAY_SIZE(aes_xcbc_reference), + false, false); }
@@ -1330,6 +1384,7 @@ static void crypto_test_gen_alg_aes_gmac(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1340,7 +1395,8 @@ static void crypto_test_gen_alg_aes_gmac_ovr_iv(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), - true); + true, + false); }
static void crypto_test_check_alg_aes_gmac(void) @@ -1350,6 +1406,7 @@ static void crypto_test_check_alg_aes_gmac(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1360,6 +1417,7 @@ static void crypto_test_check_alg_aes_gmac_ovr_iv(void) ODP_AUTH_ALG_AES_GMAC, aes_gmac_reference, ARRAY_SIZE(aes_gmac_reference), + false, false); }
@@ -1375,6 +1433,7 @@ static void crypto_test_gen_alg_aes_cmac(void) ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, ARRAY_SIZE(aes_cmac_reference), + false, false); }
@@ -1385,6 +1444,7 @@ static void crypto_test_check_alg_aes_cmac(void) ODP_AUTH_ALG_AES_CMAC, aes_cmac_reference, ARRAY_SIZE(aes_cmac_reference), + false, false); }
commit 59a26fc8cc0be0be0e30144389cfee2e55a88ab2 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Sat Feb 3 05:27:10 2018 +0300
api: crypto: add bitstring operation capability
For several wireless communication algorithms it is expected that they operate on bit strings, which are not byte-aligned. Add cipher and auth flags, denoting that this cipher/auth can be enabled to work in bit-string mode.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 654ae7bb..843fdefe 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -755,6 +755,22 @@ typedef struct odp_crypto_cipher_capability_t { /** IV length in bytes */ uint32_t iv_len;
+ /** Cipher is operating in bitwise mode + * + * This cipher works on series of bits, rather than sequences of bytes: + * cipher_range in odp_crypto_op_param_t and + * odp_crypto_packet_op_param_t will use bits, rather than bytes. + * + * Note: data buffer MUST start on the byte boundary, using offset + * which is not divisible by 8 is unsupported and will result in + * unspecified behaviour. + * + * Note2: currently data length MUST be divisible by 8. Specifying data + * which does not consist of full bytes will result in unspecified + * behaviour. + */ + odp_bool_t bit_mode; + } odp_crypto_cipher_capability_t;
/** @@ -783,6 +799,18 @@ typedef struct odp_crypto_auth_capability_t { uint32_t inc; } aad_len;
+ /** Auth is operating in bitstring mode + * + * This auth works on series of bits, rather than sequences of bytes: + * auth_range in odp_crypto_op_param_t and + * odp_crypto_packet_op_param_t will use bits, rather than bytes. + * + * Note: data buffer MUST start on the byte boundary, using offset + * which is not divisible by 8 is unsupported and will result in + * unpredictable behaviour. + */ + odp_bool_t bit_mode; + } odp_crypto_auth_capability_t;
/**
commit cb5ed2680f28412e72aa59f5769581bdb19d4ebd Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Tue Dec 26 01:26:25 2017 +0300
api: crypto: provide definitions for 3GPP crypto algorithms
Add enumeration definitions for KASUMI F8/F9, SNOW 3G UEA2/UIA2 and ZUC 128-EEA3/128-EIA3 algorithms.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index c59f6602..654ae7bb 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -110,6 +110,24 @@ typedef enum { */ ODP_CIPHER_ALG_CHACHA20_POLY1305,
+ /** Confidentiality F8 algorithm (UEA1) + * + * KASUMI-based F8 algorithm (also known as UEA1). + */ + ODP_CIPHER_ALG_KASUMI_F8, + + /** Confidentiality UEA2 algorithm (128-EEA1) + * + * SNOW 3G-based UEA2 algorithm (also known as 128-EEA1). + */ + ODP_CIPHER_ALG_SNOW3G_UEA2, + + /** Confidentiality 128-EEA3 algorithm + * + * ZUC-based 128-EEA3 algorithm. + */ + ODP_CIPHER_ALG_ZUC_EEA3, + /** @deprecated Use ODP_CIPHER_ALG_AES_CBC instead */ ODP_DEPRECATE(ODP_CIPHER_ALG_AES128_CBC),
@@ -214,6 +232,27 @@ typedef enum { */ ODP_AUTH_ALG_CHACHA20_POLY1305,
+ /** Integrity F9 algorithm (UIA1) + * + * KASUMI-based F9 algorithm (also known as UIA1). + * + * IV (9 bytes) is a concatenation of COUNT (32b), FRESH (32b) and + * DIRECTION (LSB-aligned, 1b). + */ + ODP_AUTH_ALG_KASUMI_F9, + + /** Integrity UIA2 algorithm (128-EEA1) + * + * SNOW 3G-based UIA2 algorithm (also known as 128-EIA1). + */ + ODP_AUTH_ALG_SNOW3G_UIA2, + + /** Integrity 128-EIA3 algorithm + * + * ZUC-based 128-EIA3 algorithm. + */ + ODP_AUTH_ALG_ZUC_EIA3, + /** @deprecated Use ODP_AUTH_ALG_MD5_HMAC instead */ ODP_DEPRECATE(ODP_AUTH_ALG_MD5_96),
@@ -255,6 +294,15 @@ typedef union odp_crypto_cipher_algos_t { /** ODP_CIPHER_ALG_CHACHA20_POLY1305 */ uint32_t chacha20_poly1305 : 1;
+ /** ODP_CIPHER_ALG_KASUMI_F8 */ + uint32_t kasumi_f8 : 1; + + /** ODP_CIPHER_ALG_SNOW3G_UEA2 */ + uint32_t snow3g_uea2 : 1; + + /** ODP_CIPHER_ALG_ZUC_EEA3 */ + uint32_t zuc_eea3 : 1; + /** @deprecated Use aes_cbc instead */ uint32_t ODP_DEPRECATE(aes128_cbc) : 1;
@@ -312,6 +360,15 @@ typedef union odp_crypto_auth_algos_t { /** ODP_AUTH_ALG_CHACHA20_POLY1305 */ uint32_t chacha20_poly1305 : 1;
+ /** ODP_AUTH_ALG_KASUMI_F9 */ + uint32_t kasumi_f9 : 1; + + /** ODP_AUTH_ALG_SNOW3G_UIA2 */ + uint32_t snow3g_uia2 : 1; + + /** ODP_AUTH_ALG_ZUC_EIA3 */ + uint32_t zuc_eia3 : 1; + /** @deprecated Use md5_hmac instead */ uint32_t ODP_DEPRECATE(md5_96) : 1;
-----------------------------------------------------------------------
Summary of changes: config/odp-linux-generic.conf | 6 +- configure.ac | 1 - example/classifier/odp_classifier.c | 19 +- example/generator/odp_generator.c | 30 +- example/ipsec/odp_ipsec.c | 17 +- example/ipsec_api/odp_ipsec.c | 17 +- example/l2fwd_simple/odp_l2fwd_simple.c | 17 +- example/packet/odp_pktio.c | 17 +- example/switch/odp_switch.c | 17 +- example/time/time_global_test.c | 15 +- example/timer/odp_timer_test.c | 17 +- helper/include/odp/helper/threads.h | 26 +- helper/test/odpthreads.c | 13 +- helper/threads.c | 63 +-- include/odp/api/abi-default/classification.h | 12 +- include/odp/api/abi-default/packet.h | 64 +++ include/odp/api/abi-default/schedule_types.h | 10 +- include/odp/api/abi-default/shared_memory.h | 1 - include/odp/api/abi-default/timer.h | 7 +- include/odp/api/spec/classification.h | 9 +- include/odp/api/spec/crypto.h | 122 ++++- include/odp/api/spec/init.h | 32 ++ include/odp/api/spec/ipsec.h | 50 +- include/odp/api/spec/packet.h | 69 +++ include/odp/api/spec/packet_io.h | 23 + include/odp/api/spec/schedule.h | 70 +++ include/odp/api/spec/schedule_types.h | 30 +- include/odp/api/spec/shared_memory.h | 5 - include/odp/api/spec/timer.h | 16 + .../include-abi/odp/api/abi/classification.h | 11 +- .../linux-generic/include-abi/odp/api/abi/packet.h | 35 ++ .../include-abi/odp/api/abi/shared_memory.h | 1 - .../linux-generic/include-abi/odp/api/abi/timer.h | 4 +- .../include/odp/api/plat/packet_inline_types.h | 1 + .../include/odp/api/plat/packet_inlines.h | 7 + .../linux-generic/include/odp_packet_internal.h | 5 - platform/linux-generic/include/odp_schedule_if.h | 14 +- platform/linux-generic/m4/configure.m4 | 5 +- platform/linux-generic/m4/performance.m4 | 10 - platform/linux-generic/odp_classification.c | 17 +- platform/linux-generic/odp_event.c | 5 +- platform/linux-generic/odp_init.c | 2 + platform/linux-generic/odp_ipsec_sad.c | 2 +- platform/linux-generic/odp_ishm.c | 9 +- platform/linux-generic/odp_packet.c | 56 ++- platform/linux-generic/odp_packet_io.c | 12 +- platform/linux-generic/odp_queue_basic.c | 20 +- platform/linux-generic/odp_queue_scalable.c | 21 +- platform/linux-generic/odp_schedule_basic.c | 71 ++- platform/linux-generic/odp_schedule_if.c | 25 + platform/linux-generic/odp_schedule_scalable.c | 39 +- platform/linux-generic/odp_schedule_sp.c | 41 +- platform/linux-generic/odp_timer.c | 65 ++- platform/linux-generic/pktio/loop.c | 2 +- platform/linux-generic/test/Makefile.am | 10 +- platform/linux-generic/test/inline-timer.conf | 2 +- .../test/mmap_vlan_ins/mmap_vlan_ins.c | 13 +- platform/linux-generic/test/performance/.gitignore | 2 - .../linux-generic/test/performance/Makefile.am | 13 - .../test/performance/odp_scheduling_run_proc.sh | 30 -- platform/linux-generic/test/process-mode.conf | 6 +- scripts/ci/check.sh | 8 +- test/common/odp_cunit_common.c | 13 +- test/performance/odp_bench_packet.c | 17 +- test/performance/odp_cpu_bench.c | 13 +- test/performance/odp_crypto.c | 17 +- test/performance/odp_ipsec.c | 19 +- test/performance/odp_l2fwd.c | 13 +- test/performance/odp_l2fwd_run.sh | 2 +- test/performance/odp_pktio_ordered.c | 17 +- test/performance/odp_pktio_perf.c | 17 +- test/performance/odp_sched_latency.c | 17 +- test/performance/odp_sched_pktio.c | 19 +- test/performance/odp_sched_pktio_run.sh | 2 +- test/performance/odp_scheduling.c | 17 +- test/validation/api/atomic/atomic.c | 13 +- test/validation/api/barrier/barrier.c | 13 +- .../api/classification/odp_classification_basic.c | 8 +- .../api/classification/odp_classification_common.c | 2 +- .../classification/odp_classification_test_pmr.c | 34 +- .../api/classification/odp_classification_tests.c | 32 +- test/validation/api/crypto/odp_crypto_test_inp.c | 549 +++++++++++++++++++-- test/validation/api/crypto/test_vectors.h | 182 +++++++ test/validation/api/crypto/test_vectors_len.h | 27 + test/validation/api/init/init_main_ok.c | 6 +- test/validation/api/ipsec/ipsec.c | 39 +- test/validation/api/ipsec/ipsec.h | 3 +- test/validation/api/ipsec/ipsec_test_in.c | 92 ++-- test/validation/api/ipsec/ipsec_test_out.c | 70 +-- test/validation/api/lock/lock.c | 13 +- test/validation/api/packet/packet.c | 159 +++++- test/validation/api/pktio/pktio.c | 37 ++ test/validation/api/queue/queue.c | 21 +- test/validation/api/scheduler/scheduler.c | 139 +++++- test/validation/api/thread/thread.c | 13 +- test/validation/api/timer/timer.c | 36 +- 96 files changed, 2482 insertions(+), 548 deletions(-) delete mode 100644 platform/linux-generic/m4/performance.m4 delete mode 100644 platform/linux-generic/test/performance/.gitignore delete mode 100644 platform/linux-generic/test/performance/Makefile.am delete mode 100755 platform/linux-generic/test/performance/odp_scheduling_run_proc.sh
hooks/post-receive