aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2021-10-11 16:37:51 +0300
committerGitHub <noreply@github.com>2021-10-11 16:37:51 +0300
commit50c7b605b97474d26fcf600b4061968e3543b45b (patch)
treebb5541aab05c99d762a054a9f1fe64cd002d7f86 /test
parent54ca03915ddf070a3c67f6a3c89f442c202a1adb (diff)
parentec77bf59d3407278625c28a8d47c3dab9627a91f (diff)
Merge ODP v1.32.0.0v1.32.0.0_DPDK_19.11
Merge ODP linux-generic v1.32.0.0 into ODP-DPDK.
Diffstat (limited to 'test')
-rw-r--r--test/common/odp_cunit_common.c4
-rw-r--r--test/performance/odp_atomic_perf.c4
-rw-r--r--test/performance/odp_bench_packet.c29
-rw-r--r--test/performance/odp_cpu_bench.c36
-rw-r--r--test/performance/odp_crypto.c28
-rw-r--r--test/performance/odp_ipsec.c44
-rw-r--r--test/performance/odp_l2fwd.c37
-rw-r--r--test/performance/odp_mem_perf.c4
-rw-r--r--test/performance/odp_packet_gen.c5
-rw-r--r--test/performance/odp_pktio_ordered.c33
-rw-r--r--test/performance/odp_pktio_perf.c50
-rw-r--r--test/performance/odp_pool_perf.c27
-rw-r--r--test/performance/odp_queue_perf.c27
-rw-r--r--test/performance/odp_sched_latency.c26
-rw-r--r--test/performance/odp_sched_perf.c10
-rw-r--r--test/performance/odp_sched_pktio.c51
-rw-r--r--test/performance/odp_scheduling.c12
-rw-r--r--test/performance/odp_timer_perf.c5
-rw-r--r--test/validation/api/crypto/odp_crypto_test_inp.c486
-rw-r--r--test/validation/api/ipsec/Makefile.am3
-rw-r--r--test/validation/api/ipsec/ipsec.c227
-rw-r--r--test/validation/api/ipsec/ipsec.h9
-rw-r--r--test/validation/api/ipsec/ipsec_async.c19
-rw-r--r--test/validation/api/ipsec/ipsec_inline_in.c14
-rw-r--r--test/validation/api/ipsec/ipsec_inline_out.c14
-rw-r--r--test/validation/api/ipsec/ipsec_sync.c10
-rw-r--r--test/validation/api/ipsec/ipsec_test_in.c35
-rw-r--r--test/validation/api/ipsec/reass_test_vectors.c353
-rw-r--r--test/validation/api/ipsec/reass_test_vectors.h362
-rw-r--r--test/validation/api/pool/pool.c58
30 files changed, 1175 insertions, 847 deletions
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c
index f5c437344..c6e03dab2 100644
--- a/test/common/odp_cunit_common.c
+++ b/test/common/odp_cunit_common.c
@@ -54,8 +54,8 @@ int odp_cunit_thread_create(int func_ptr(void *), pthrd_arg *arg)
int num = arg->numthrds;
odph_thread_param_t thr_param;
- memset(&thr_common, 0, sizeof(thr_common));
- memset(&thr_param, 0, sizeof(thr_param));
+ odph_thread_common_param_init(&thr_common);
+ odph_thread_param_init(&thr_param);
thr_param.start = func_ptr;
thr_param.arg = arg;
diff --git a/test/performance/odp_atomic_perf.c b/test/performance/odp_atomic_perf.c
index b56135c35..ee760babf 100644
--- a/test/performance/odp_atomic_perf.c
+++ b/test/performance/odp_atomic_perf.c
@@ -1076,11 +1076,10 @@ static int start_workers(test_global_t *global, odp_instance_t instance,
int num_cpu = test_options->num_cpu;
odph_thread_param_t thr_param[num_cpu];
- memset(&param, 0, sizeof(odph_thread_common_param_t));
+ odph_thread_common_param_init(&param);
param.instance = instance;
param.cpumask = &global->cpumask;
- memset(thr_param, 0, sizeof(thr_param));
for (i = 0; i < num_cpu; i++) {
test_thread_ctx_t *thread_ctx = &global->thread_ctx[i];
@@ -1089,6 +1088,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance,
thread_ctx->func = func;
thread_ctx->type = type;
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].thr_type = ODP_THREAD_WORKER;
thr_param[i].start = run_test;
thr_param[i].arg = thread_ctx;
diff --git a/test/performance/odp_bench_packet.c b/test/performance/odp_bench_packet.c
index e80e823f6..0354ef9b8 100644
--- a/test/performance/odp_bench_packet.c
+++ b/test/performance/odp_bench_packet.c
@@ -1739,7 +1739,9 @@ bench_info_t test_suite[] = {
int main(int argc, char *argv[])
{
odph_helper_options_t helper_options;
- odph_odpthread_t worker_thread;
+ odph_thread_t worker_thread;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
int cpu;
odp_shm_t shm;
odp_cpumask_t cpumask;
@@ -1864,7 +1866,7 @@ int main(int argc, char *argv[])
odp_pool_print(gbl_args->pool);
- memset(&worker_thread, 0, sizeof(odph_odpthread_t));
+ memset(&worker_thread, 0, sizeof(odph_thread_t));
signal(SIGINT, sig_handler);
@@ -1872,20 +1874,23 @@ int main(int argc, char *argv[])
cpu = odp_cpumask_first(&cpumask);
odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_benchmarks;
- thr_params.arg = gbl_args;
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
odp_cpumask_zero(&thd_mask);
odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&worker_thread, &thd_mask,
- &thr_params);
- odph_odpthreads_join(&worker_thread);
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &thd_mask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_benchmarks;
+ thr_param.arg = gbl_args;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(&worker_thread, &thr_common, &thr_param, 1);
+
+ odph_thread_join(&worker_thread, 1);
ret = gbl_args->bench_failed;
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c
index a4999ae27..e0ac82846 100644
--- a/test/performance/odp_cpu_bench.c
+++ b/test/performance/odp_cpu_bench.c
@@ -521,7 +521,9 @@ int main(int argc, char *argv[])
{
stats_t *stats[MAX_WORKERS];
odph_helper_options_t helper_options;
- odph_odpthread_t thread_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
odp_cpumask_t cpumask;
odp_pool_capability_t pool_capa;
odp_pool_t pool;
@@ -540,7 +542,6 @@ int main(int argc, char *argv[])
uint32_t init_val;
unsigned int num_workers;
unsigned int i, j;
- int cpu;
int ret = 0;
/* Let helper collect its own arguments (e.g. --odph_proc) */
@@ -743,7 +744,6 @@ int main(int argc, char *argv[])
}
}
- memset(thread_tbl, 0, sizeof(thread_tbl));
odp_barrier_init(&gbl_args->init_barrier, num_workers + 1);
odp_barrier_init(&gbl_args->term_barrier, num_workers + 1);
@@ -762,34 +762,28 @@ int main(int argc, char *argv[])
}
/* Create worker threads */
- cpu = odp_cpumask_first(&cpumask);
- for (i = 0; i < num_workers; i++) {
- odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ for (i = 0; i < num_workers; i++) {
gbl_args->thread[i].idx = i;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_thread;
- thr_params.arg = &gbl_args->thread[i];
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
-
stats[i] = &gbl_args->thread[i].stats;
- odp_cpumask_zero(&thd_mask);
- odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&thread_tbl[i], &thd_mask,
- &thr_params);
- cpu = odp_cpumask_next(&cpumask, cpu);
+ odph_thread_param_init(&thr_param[i]);
+ thr_param[i].start = run_thread;
+ thr_param[i].arg = &gbl_args->thread[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, thr_param, num_workers);
+
ret = print_stats(num_workers, stats, gbl_args->appl.time,
gbl_args->appl.accuracy);
/* Master thread waits for other threads to exit */
- for (i = 0; i < num_workers; ++i)
- odph_odpthreads_join(&thread_tbl[i]);
+ odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < num_groups; i++) {
for (j = 0; j < QUEUES_PER_GROUP; j++) {
diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c
index 36324622a..4f81dab17 100644
--- a/test/performance/odp_crypto.c
+++ b/test/performance/odp_crypto.c
@@ -1032,7 +1032,9 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
int num_workers = 1;
odph_helper_options_t helper_options;
- odph_odpthread_t thr[num_workers];
+ odph_thread_t thread_tbl[num_workers];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_instance_t instance;
odp_init_t init_param;
odp_pool_capability_t pool_capa;
@@ -1146,24 +1148,26 @@ int main(int argc, char *argv[])
printf("Run in sync mode\n");
}
- memset(thr, 0, sizeof(thr));
-
test_run_arg.crypto_args = cargs;
test_run_arg.crypto_alg_config = cargs.alg_config;
test_run_arg.crypto_capa = crypto_capa;
if (cargs.alg_config) {
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_thr_func;
- thr_params.arg = &test_run_arg;
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
if (cargs.schedule) {
- odph_odpthreads_create(&thr[0], &cpumask, &thr_params);
- odph_odpthreads_join(&thr[0]);
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thr_func;
+ thr_param.arg = &test_run_arg;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
+
+ odph_thread_join(thread_tbl, num_workers);
} else {
run_measure_one_config(&test_run_arg);
}
diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c
index 05a22ff0d..04788995e 100644
--- a/test/performance/odp_ipsec.c
+++ b/test/performance/odp_ipsec.c
@@ -1027,9 +1027,12 @@ int main(int argc, char *argv[])
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
int num_workers = 1;
odph_helper_options_t helper_options;
- odph_odpthread_t thr[num_workers];
+ odph_thread_t thread_tbl[num_workers];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_instance_t instance;
odp_init_t init_param;
+ odp_ipsec_capability_t ipsec_capa;
odp_pool_capability_t capa;
odp_ipsec_config_t config;
uint32_t max_seg_len;
@@ -1092,6 +1095,21 @@ int main(int argc, char *argv[])
}
odp_pool_print(pool);
+ if (odp_ipsec_capability(&ipsec_capa) < 0) {
+ app_err("IPSEC capability call failed.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (cargs.schedule && !ipsec_capa.queue_type_sched) {
+ app_err("Scheduled type destination queue not supported.\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (cargs.poll && !ipsec_capa.queue_type_plain) {
+ app_err("Plain type destination queue not supported.\n");
+ exit(EXIT_FAILURE);
+ }
+
odp_ipsec_config_init(&config);
config.max_num_sa = 2;
config.inbound.chksums.all_chksum = 0;
@@ -1148,20 +1166,22 @@ int main(int argc, char *argv[])
printf("Run in sync mode\n");
}
- memset(thr, 0, sizeof(thr));
-
if (cargs.alg_config) {
- odph_odpthread_params_t thr_param;
-
- memset(&thr_param, 0, sizeof(thr_param));
- thr_param.start = run_thr_func;
- thr_param.arg = &thr_arg;
- thr_param.thr_type = ODP_THREAD_WORKER;
- thr_param.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
if (cargs.schedule) {
- odph_odpthreads_create(&thr[0], &cpumask, &thr_param);
- odph_odpthreads_join(&thr[0]);
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thr_func;
+ thr_param.arg = &thr_arg;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ memset(thread_tbl, 0, sizeof(thread_tbl));
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
+
+ odph_thread_join(thread_tbl, num_workers);
} else {
run_measure_one_config(&cargs, cargs.alg_config);
}
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 3da08661c..6aa98ce96 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2014-2018, Linaro Limited
* Copyright (c) 2019-2021, Nokia
- * Copyright (c) 2020, Marvell
+ * Copyright (c) 2020-2021, Marvell
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -108,6 +108,7 @@ typedef struct {
uint32_t packet_len; /* Maximum packet length supported */
uint32_t seg_len; /* Pool segment length */
int promisc_mode; /* Promiscuous mode enabled */
+ int flow_aware; /* Flow aware scheduling enabled */
int mtu; /* Interface MTU */
} appl_args_t;
@@ -1547,6 +1548,7 @@ static void usage(char *progname)
" -l, --packet_len <len> Maximum length of packets supported (default %d).\n"
" -L, --seg_len <len> Packet pool segment length\n"
" (default equal to packet length).\n"
+ " -f, --flow_aware Enable flow aware scheduling.\n"
" -v, --verbose Verbose output.\n"
" -h, --help Display help and exit.\n\n"
"\n", NO_PATH(progname), NO_PATH(progname), MAX_PKTIOS, DEFAULT_VEC_SIZE,
@@ -1594,12 +1596,13 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
{"promisc_mode", no_argument, NULL, 'P'},
{"packet_len", required_argument, NULL, 'l'},
{"seg_len", required_argument, NULL, 'L'},
+ {"flow_aware", no_argument, NULL, 'f'},
{"verbose", no_argument, NULL, 'v'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
- static const char *shortopts = "+c:t:a:i:m:o:r:d:s:e:k:g:b:p:y:n:l:L:w:x:z:M:uPvh";
+ static const char *shortopts = "+c:t:a:i:m:o:r:d:s:e:k:g:b:p:y:n:l:L:w:x:z:M:uPfvh";
appl_args->time = 0; /* loop forever if time to run is 0 */
appl_args->accuracy = 1; /* get and print pps stats second */
@@ -1622,6 +1625,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->num_vec = 0;
appl_args->vec_size = 0;
appl_args->vec_tmo_ns = 0;
+ appl_args->flow_aware = 0;
while (1) {
opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
@@ -1786,6 +1790,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
case 'z':
appl_args->vec_tmo_ns = atoi(optarg);
break;
+ case 'f':
+ appl_args->flow_aware = 1;
+ break;
case 'v':
appl_args->verbose = 1;
break;
@@ -1869,6 +1876,8 @@ static void print_info(appl_args_t *appl_args)
printf("interface default\n");
printf("Promisc mode: %s\n", appl_args->promisc_mode ?
"enabled" : "disabled");
+ printf("Flow aware: %s\n", appl_args->flow_aware ?
+ "yes" : "no");
printf("Burst size: %i\n", appl_args->burst_rx);
printf("Number of pools: %i\n", appl_args->pool_per_if ?
appl_args->if_count : 1);
@@ -1988,6 +1997,8 @@ int main(int argc, char *argv[])
odp_pool_t pool, vec_pool;
odp_init_t init;
odp_pool_capability_t pool_capa;
+ odp_schedule_config_t sched_config;
+ odp_schedule_capability_t sched_capa;
uint32_t pkt_len, num_pkt, seg_len;
/* Let helper collect its own arguments (e.g. --odph_proc) */
@@ -2210,7 +2221,23 @@ int main(int argc, char *argv[])
bind_workers();
- odp_schedule_config(NULL);
+ odp_schedule_config_init(&sched_config);
+
+ if (odp_schedule_capability(&sched_capa)) {
+ ODPH_ERR("Error: schedule capability failed\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (gbl_args->appl.flow_aware) {
+ if (sched_capa.max_flow_id) {
+ sched_config.max_flow_id = sched_capa.max_flow_id;
+ } else {
+ ODPH_ERR("Error: flow aware mode not supported\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ odp_schedule_config(&sched_config);
/* Default */
if (num_groups == 0) {
@@ -2296,8 +2323,7 @@ int main(int argc, char *argv[])
run_worker_sched_mode_vector : run_worker_sched_mode;
/* Create worker threads */
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &cpumask;
@@ -2306,6 +2332,7 @@ int main(int argc, char *argv[])
thr_common.sync = 1;
for (i = 0; i < num_workers; ++i) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = thr_run_func;
thr_param[i].arg = &gbl_args->thread_args[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_mem_perf.c b/test/performance/odp_mem_perf.c
index 1348eaaa2..56a3cdf9a 100644
--- a/test/performance/odp_mem_perf.c
+++ b/test/performance/odp_mem_perf.c
@@ -311,11 +311,10 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
int num_cpu = test_options->num_cpu;
odph_thread_param_t thr_param[num_cpu];
- memset(&param, 0, sizeof(odph_thread_common_param_t));
+ odph_thread_common_param_init(&param);
param.instance = instance;
param.cpumask = &global->cpumask;
- memset(thr_param, 0, sizeof(thr_param));
for (i = 0; i < num_cpu; i++) {
test_thread_ctx_t *thread_ctx = &global->thread_ctx[i];
@@ -324,6 +323,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
if (global->test_options.private)
thread_ctx->shm_addr = global->shm_addr[i];
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].thr_type = ODP_THREAD_WORKER;
thr_param[i].start = run_test;
thr_param[i].arg = thread_ctx;
diff --git a/test/performance/odp_packet_gen.c b/test/performance/odp_packet_gen.c
index f3919ebac..02704b195 100644
--- a/test/performance/odp_packet_gen.c
+++ b/test/performance/odp_packet_gen.c
@@ -1486,14 +1486,14 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odph_thread_param_t thr_param[num_cpu];
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
/* Receive threads */
for (i = 0; i < num_rx; i++) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = rx_thread;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
@@ -1513,6 +1513,7 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
global->thread_arg[i].pktout[j] = pktout;
}
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = tx_thread;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c
index d5ffcc8ab..e35386d52 100644
--- a/test/performance/odp_pktio_ordered.c
+++ b/test/performance/odp_pktio_ordered.c
@@ -1060,10 +1060,11 @@ int main(int argc, char *argv[])
odp_pool_capability_t pool_capa;
odph_ethaddr_t new_addr;
odph_helper_options_t helper_options;
- odph_odpthread_t thread_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
stats_t *stats;
char cpumaskstr[ODP_CPUMASK_STR_SIZE];
- int cpu;
int i, j;
int if_count;
int ret;
@@ -1281,26 +1282,21 @@ int main(int argc, char *argv[])
odp_barrier_init(&gbl_args->barrier, num_workers + 1);
/* Create worker threads */
- cpu = odp_cpumask_first(&cpumask);
- for (i = 0; i < num_workers; ++i) {
- odp_cpumask_t thd_mask;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = run_worker;
- thr_params.arg = &gbl_args->thread[i];
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ for (i = 0; i < num_workers; ++i) {
gbl_args->thread[i].stats = &stats[i];
- odp_cpumask_zero(&thd_mask);
- odp_cpumask_set(&thd_mask, cpu);
- odph_odpthreads_create(&thread_tbl[i], &thd_mask,
- &thr_params);
- cpu = odp_cpumask_next(&cpumask, cpu);
+ odph_thread_param_init(&thr_param[i]);
+ thr_param[i].start = run_worker;
+ thr_param[i].arg = &gbl_args->thread[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+ odph_thread_create(thread_tbl, &thr_common, thr_param, num_workers);
+
/* Start packet receive and transmit */
for (i = 0; i < if_count; ++i) {
odp_pktio_t pktio;
@@ -1324,8 +1320,7 @@ int main(int argc, char *argv[])
odp_atomic_store_u32(&gbl_args->exit_threads, 1);
/* Master thread waits for other threads to exit */
- for (i = 0; i < num_workers; ++i)
- odph_odpthreads_join(&thread_tbl[i]);
+ odph_thread_join(thread_tbl, num_workers);
for (i = 0; i < if_count; i++) {
odp_pktio_close(gbl_args->pktios[i].pktio);
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 3d70d7d2b..593465f4f 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -603,45 +603,61 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
odp_cpumask_t *thd_mask_rx,
test_status_t *status)
{
- odph_odpthread_t thd_tbl[MAX_WORKERS];
+ odph_thread_t thread_tbl[MAX_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
thread_args_t args_tx, args_rx;
uint64_t expected_tx_cnt;
int num_tx_workers, num_rx_workers;
- odph_odpthread_params_t thr_params;
-
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = gbl_args->instance;
odp_atomic_store_u32(&gbl_args->shutdown, 0);
- memset(thd_tbl, 0, sizeof(thd_tbl));
+ memset(thread_tbl, 0, sizeof(thread_tbl));
memset(gbl_args->rx_stats, 0, gbl_args->rx_stats_size);
memset(gbl_args->tx_stats, 0, gbl_args->tx_stats_size);
expected_tx_cnt = status->pps_curr * gbl_args->args.duration;
/* start receiver threads first */
- thr_params.start = run_thread_rx;
- thr_params.arg = &args_rx;
+
+ num_rx_workers = odp_cpumask_count(thd_mask_rx);
args_rx.batch_len = gbl_args->args.rx_batch_len;
- odph_odpthreads_create(&thd_tbl[0], thd_mask_rx, &thr_params);
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = gbl_args->instance;
+ thr_common.cpumask = thd_mask_rx;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread_rx;
+ thr_param.arg = &args_rx;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_rx_workers);
odp_barrier_wait(&gbl_args->rx_barrier);
- num_rx_workers = odp_cpumask_count(thd_mask_rx);
/* then start transmitters */
- thr_params.start = run_thread_tx;
- thr_params.arg = &args_tx;
+
num_tx_workers = odp_cpumask_count(thd_mask_tx);
args_tx.pps = status->pps_curr / num_tx_workers;
args_tx.duration = gbl_args->args.duration;
args_tx.batch_len = gbl_args->args.tx_batch_len;
- odph_odpthreads_create(&thd_tbl[num_rx_workers], thd_mask_tx,
- &thr_params);
+
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = gbl_args->instance;
+ thr_common.cpumask = thd_mask_tx;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread_tx;
+ thr_param.arg = &args_tx;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(&thread_tbl[num_rx_workers], &thr_common, &thr_param, num_tx_workers);
odp_barrier_wait(&gbl_args->tx_barrier);
/* wait for transmitter threads to terminate */
- odph_odpthreads_join(&thd_tbl[num_rx_workers]);
+ odph_thread_join(&thread_tbl[num_rx_workers], num_tx_workers);
/* delay to allow transmitted packets to reach the receivers */
odp_time_wait_ns(SHUTDOWN_DELAY_NS);
@@ -650,7 +666,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx,
odp_atomic_store_u32(&gbl_args->shutdown, 1);
/* wait for receivers */
- odph_odpthreads_join(&thd_tbl[0]);
+ odph_thread_join(thread_tbl, num_rx_workers);
if (!status->warmup)
return process_results(expected_tx_cnt, status);
diff --git a/test/performance/odp_pool_perf.c b/test/performance/odp_pool_perf.c
index ee97af519..957b1de00 100644
--- a/test/performance/odp_pool_perf.c
+++ b/test/performance/odp_pool_perf.c
@@ -43,7 +43,7 @@ typedef struct test_global_t {
odp_barrier_t barrier;
odp_pool_t pool;
odp_cpumask_t cpumask;
- odph_odpthread_t thread_tbl[ODP_THREAD_COUNT_MAX];
+ odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
test_stat_t stat[ODP_THREAD_COUNT_MAX];
} test_global_t;
@@ -445,23 +445,28 @@ static int test_packet_pool(void *arg)
static int start_workers(test_global_t *global, odp_instance_t instance)
{
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
test_options_t *test_options = &global->test_options;
int num_cpu = test_options->num_cpu;
int packet_pool = test_options->pool_type;
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
- thr_params.arg = global;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &global->cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.arg = global;
+ thr_param.thr_type = ODP_THREAD_WORKER;
if (packet_pool)
- thr_params.start = test_packet_pool;
+ thr_param.start = test_packet_pool;
else
- thr_params.start = test_buffer_pool;
+ thr_param.start = test_buffer_pool;
- if (odph_odpthreads_create(global->thread_tbl, &global->cpumask,
- &thr_params) != num_cpu)
+ if (odph_thread_create(global->thread_tbl, &thr_common, &thr_param,
+ num_cpu) != num_cpu)
return -1;
return 0;
@@ -608,7 +613,7 @@ int main(int argc, char **argv)
start_workers(global, instance);
/* Wait workers to exit */
- odph_odpthreads_join(global->thread_tbl);
+ odph_thread_join(global->thread_tbl, global->test_options.num_cpu);
print_stat(global);
diff --git a/test/performance/odp_queue_perf.c b/test/performance/odp_queue_perf.c
index 33284d312..320f2f35a 100644
--- a/test/performance/odp_queue_perf.c
+++ b/test/performance/odp_queue_perf.c
@@ -44,7 +44,7 @@ typedef struct test_global_t {
odp_shm_t shm;
odp_pool_t pool;
odp_queue_t queue[MAX_QUEUES];
- odph_odpthread_t thread_tbl[ODP_THREAD_COUNT_MAX];
+ odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
test_stat_t stat[ODP_THREAD_COUNT_MAX];
} test_global_t;
@@ -423,18 +423,13 @@ error:
static int start_workers(test_global_t *global)
{
- odph_odpthread_params_t thr_params;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_cpumask_t cpumask;
int ret;
test_options_t *test_options = &global->options;
int num_cpu = test_options->num_cpu;
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = global->instance;
- thr_params.start = run_test;
- thr_params.arg = global;
-
ret = odp_cpumask_default_worker(&cpumask, num_cpu);
if (num_cpu && ret != num_cpu) {
@@ -452,8 +447,18 @@ static int start_workers(test_global_t *global)
odp_barrier_init(&global->barrier, num_cpu);
- if (odph_odpthreads_create(global->thread_tbl, &cpumask, &thr_params)
- != num_cpu)
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = global->instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_test;
+ thr_param.arg = global;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ if (odph_thread_create(global->thread_tbl, &thr_common, &thr_param,
+ num_cpu) != num_cpu)
return -1;
return 0;
@@ -596,7 +601,7 @@ int main(int argc, char **argv)
}
/* Wait workers to exit */
- odph_odpthreads_join(global->thread_tbl);
+ odph_thread_join(global->thread_tbl, global->options.num_cpu);
print_stat(global);
diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c
index c6b659aac..2910dcdbc 100644
--- a/test/performance/odp_sched_latency.c
+++ b/test/performance/odp_sched_latency.c
@@ -705,8 +705,9 @@ 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;
+ odph_thread_t *thread_tbl;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_cpumask_t cpumask;
odp_pool_t pool;
odp_pool_capability_t pool_capa;
@@ -766,7 +767,7 @@ int main(int argc, char *argv[])
printf(" First CPU: %i\n", odp_cpumask_first(&cpumask));
printf(" CPU mask: %s\n", cpumaskstr);
- thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers);
+ thread_tbl = calloc(sizeof(odph_thread_t), num_workers);
if (!thread_tbl) {
ODPH_ERR("no memory for thread_tbl\n");
return -1;
@@ -858,15 +859,20 @@ int main(int argc, char *argv[])
odp_barrier_init(&globals->barrier, num_workers);
/* Create and launch worker threads */
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = instance;
- thr_params.start = run_thread;
- thr_params.arg = NULL;
- odph_odpthreads_create(thread_tbl, &cpumask, &thr_params);
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = instance;
+ thr_common.cpumask = &cpumask;
+ thr_common.share_param = 1;
+
+ odph_thread_param_init(&thr_param);
+ thr_param.start = run_thread;
+ thr_param.arg = NULL;
+ thr_param.thr_type = ODP_THREAD_WORKER;
+
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to terminate */
- odph_odpthreads_join(thread_tbl);
+ odph_thread_join(thread_tbl, num_workers);
free(thread_tbl);
printf("ODP scheduling latency test complete\n\n");
diff --git a/test/performance/odp_sched_perf.c b/test/performance/odp_sched_perf.c
index da818931c..f9b4ce548 100644
--- a/test/performance/odp_sched_perf.c
+++ b/test/performance/odp_sched_perf.c
@@ -979,10 +979,12 @@ static int test_sched(void *arg)
odp_event_t event;
uint64_t sched_wait = odp_schedule_wait_time(200 * ODP_TIME_MSEC_IN_NS);
- /* Print schedule status at the end of the test, before any queues
+ /* Print queue and scheduler status at the end of the test, before any queues
* are emptied or destroyed. */
- if (test_options->verbose)
+ if (test_options->verbose) {
+ odp_queue_print_all();
odp_schedule_print();
+ }
while ((event = odp_schedule(NULL, sched_wait)) != ODP_EVENT_INVALID)
odp_event_free(event);
@@ -1025,13 +1027,13 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odp_atomic_init_u32(&global->num_worker, num_cpu);
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
for (i = 0; i < num_cpu; i++) {
+ odph_thread_param_init(&thr_param[i]);
thr_param[i].start = test_sched;
thr_param[i].arg = &global->thread_arg[i];
thr_param[i].thr_type = ODP_THREAD_WORKER;
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c
index cbdbdf4aa..589b58d97 100644
--- a/test/performance/odp_sched_pktio.c
+++ b/test/performance/odp_sched_pktio.c
@@ -1396,45 +1396,50 @@ static void destroy_timers(test_global_t *test_global)
odp_timer_pool_destroy(timer_pool);
}
-static void start_workers(odph_odpthread_t thread[],
+static void start_workers(odph_thread_t thread[],
test_global_t *test_global)
{
int i;
odp_cpumask_t cpumask;
- odph_odpthread_params_t param;
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param[MAX_WORKERS];
int num = test_global->opt.num_worker;
- memset(&param, 0, sizeof(odph_odpthread_params_t));
+ odp_cpumask_zero(&cpumask);
- if (test_global->opt.timeout_us)
- param.start = worker_thread_timers;
- else if (test_global->opt.pipe_stages)
- param.start = worker_thread_pipeline;
- else
- param.start = worker_thread_direct;
-
- param.thr_type = ODP_THREAD_WORKER;
- param.instance = test_global->instance;
-
- memset(thread, 0, num * sizeof(odph_odpthread_t));
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = test_global->instance;
+ thr_common.cpumask = &cpumask;
for (i = 0; i < num; i++) {
- odp_cpumask_zero(&cpumask);
odp_cpumask_set(&cpumask, test_global->worker_cpu[i]);
test_global->worker_arg[i].worker_id = i;
test_global->worker_arg[i].test_global_ptr = test_global;
- param.arg = &test_global->worker_arg[i];
- odph_odpthreads_create(&thread[i], &cpumask, &param);
+ odph_thread_param_init(&thr_param[i]);
+
+ if (!i) {
+ if (test_global->opt.timeout_us)
+ thr_param[0].start = worker_thread_timers;
+ else if (test_global->opt.pipe_stages)
+ thr_param[0].start = worker_thread_pipeline;
+ else
+ thr_param[0].start = worker_thread_direct;
+ } else {
+ thr_param[i].start = thr_param[0].start;
+ }
+
+ thr_param[i].arg = &test_global->worker_arg[i];
+ thr_param[i].thr_type = ODP_THREAD_WORKER;
}
+
+ memset(thread, 0, num * sizeof(odph_thread_t));
+ odph_thread_create(thread, &thr_common, thr_param, num);
}
-static void wait_workers(odph_odpthread_t thread[], test_global_t *test_global)
+static void wait_workers(odph_thread_t thread[], test_global_t *test_global)
{
- int i;
-
- for (i = 0; i < test_global->opt.num_worker; ++i)
- odph_odpthreads_join(&thread[i]);
+ odph_thread_join(thread, test_global->opt.num_worker);
}
int main(int argc, char *argv[])
@@ -1444,7 +1449,7 @@ int main(int argc, char *argv[])
odp_shm_t shm;
odp_time_t t1 = ODP_TIME_NULL, t2 = ODP_TIME_NULL;
odph_helper_options_t helper_options;
- odph_odpthread_t thread[MAX_WORKERS];
+ odph_thread_t thread[MAX_WORKERS];
test_options_t test_options;
int ret = 0;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 76d767220..d52ad816a 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -997,17 +997,17 @@ int main(int argc, char *argv[])
globals->first_thr = -1;
/* Create and launch worker threads */
- memset(&thr_common, 0, sizeof(thr_common));
- memset(&thr_param, 0, sizeof(thr_param));
-
- thr_param.thr_type = ODP_THREAD_WORKER;
- thr_param.start = run_thread;
- thr_param.arg = NULL;
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &cpumask;
thr_common.share_param = 1;
+ odph_thread_param_init(&thr_param);
+ thr_param.thr_type = ODP_THREAD_WORKER;
+ thr_param.start = run_thread;
+ thr_param.arg = NULL;
+
odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
/* Wait for worker threads to terminate */
diff --git a/test/performance/odp_timer_perf.c b/test/performance/odp_timer_perf.c
index 6989d0d4c..a45081643 100644
--- a/test/performance/odp_timer_perf.c
+++ b/test/performance/odp_timer_perf.c
@@ -795,13 +795,14 @@ static int start_workers(test_global_t *global, odp_instance_t instance)
odph_thread_param_t thr_param[num_cpu];
memset(global->thread_tbl, 0, sizeof(global->thread_tbl));
- memset(thr_param, 0, sizeof(thr_param));
- memset(&thr_common, 0, sizeof(thr_common));
+ odph_thread_common_param_init(&thr_common);
thr_common.instance = instance;
thr_common.cpumask = &global->cpumask;
for (i = 0; i < num_cpu; i++) {
+ odph_thread_param_init(&thr_param[i]);
+
if (test_options->mode == MODE_SCHED_OVERH)
thr_param[i].start = sched_mode_worker;
else
diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c
index 7d6661be2..06ece9f50 100644
--- a/test/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/validation/api/crypto/odp_crypto_test_inp.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2021, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -174,7 +175,7 @@ static int alg_op(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_crypto_op_result_t result;
@@ -198,7 +199,7 @@ static int alg_op(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_operation(&op_params, &posted, &result);
if (rc < 0) {
@@ -254,7 +255,7 @@ static int alg_packet_op(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_crypto_packet_result_t result;
@@ -275,7 +276,7 @@ static int alg_packet_op(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_op(&pkt, &out_pkt, &op_params, 1);
if (rc <= 0) {
@@ -315,7 +316,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
odp_packet_data_range_t *cipher_range,
odp_packet_data_range_t *auth_range,
uint8_t *aad,
- unsigned int plaintext_len)
+ unsigned int hash_result_offset)
{
int rc;
odp_event_t event;
@@ -337,7 +338,7 @@ static int alg_packet_op_enq(odp_packet_t pkt,
op_params.aad_ptr = aad;
- op_params.hash_result_offset = plaintext_len;
+ op_params.hash_result_offset = hash_result_offset;
rc = odp_crypto_op_enq(&pkt, &pkt, &op_params, 1);
if (rc <= 0) {
@@ -381,6 +382,69 @@ static int alg_packet_op_enq(odp_packet_t pkt,
return 0;
}
+/*
+ * Try to adjust packet so that the first segment holds 'first_seg_len' bytes
+ * of packet data (+ tailroom if first_seg_len is longer than the packet).
+ *
+ * If 'first_seg_len' is zero, do not try to add segments but make headroom
+ * zero.
+ *
+ * Packet data bytes are not preserved.
+ */
+static void adjust_segments(odp_packet_t *pkt, uint32_t first_seg_len)
+{
+ uint32_t shift;
+
+ shift = odp_packet_headroom(*pkt) + first_seg_len;
+
+ if (odp_packet_extend_head(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_extend_head() failed\n");
+ return;
+ }
+ if (odp_packet_trunc_tail(pkt, shift, NULL, NULL) < 0) {
+ CU_FAIL("odp_packet_trunc_tail() failed\n");
+ return;
+ }
+ /*
+ * ODP API does not seem to guarantee that we ever have a multi-segment
+ * packet at this point, but we can print a message about it.
+ */
+ if (first_seg_len == 1 &&
+ first_seg_len != odp_packet_seg_len(*pkt))
+ printf("Could not create a segmented packet for testing.\n");
+}
+
+/*
+ * Generate or verify header and trailer bytes
+ */
+static void do_header_and_trailer(odp_packet_t pkt,
+ uint32_t header_len, uint32_t trailer_len,
+ odp_bool_t check)
+{
+ uint32_t trailer_offset = odp_packet_len(pkt) - trailer_len;
+ uint32_t max_len = header_len > trailer_len ? header_len : trailer_len;
+ uint8_t buffer[max_len];
+ uint32_t n;
+ int rc;
+
+ for (n = 0; n < max_len; n++)
+ buffer[n] = n;
+
+ if (check) {
+ CU_ASSERT(!packet_cmp_mem_bytes(pkt, 0,
+ buffer, header_len));
+ CU_ASSERT(!packet_cmp_mem_bytes(pkt, trailer_offset,
+ buffer, trailer_len));
+ } else {
+ rc = odp_packet_copy_from_mem(pkt, 0,
+ header_len, buffer);
+ CU_ASSERT(rc == 0);
+ rc = odp_packet_copy_from_mem(pkt, trailer_offset,
+ trailer_len, buffer);
+ CU_ASSERT(rc == 0);
+ }
+}
+
typedef enum crypto_test {
NORMAL_TEST = 0, /**< Plain execution */
REPEAT_TEST, /**< Rerun without reinitializing the session */
@@ -388,6 +452,135 @@ typedef enum crypto_test {
MAX_TEST, /**< Final mark */
} crypto_test;
+typedef struct alg_test_param_t {
+ odp_crypto_session_t session;
+ odp_crypto_op_t op;
+ odp_auth_alg_t auth_alg;
+ crypto_test_reference_t *ref;
+ odp_bool_t override_iv;
+ odp_bool_t bit_mode;
+ odp_bool_t adjust_segmentation;
+ uint32_t first_seg_len;
+ uint32_t header_len;
+ uint32_t trailer_len;
+} alg_test_param_t;
+
+static void alg_test_execute(const alg_test_param_t *param)
+{
+ int rc;
+ odp_bool_t ok = false;
+ int iteration;
+ uint32_t reflength;
+ odp_packet_data_range_t cipher_range;
+ odp_packet_data_range_t auth_range;
+ crypto_test_reference_t *ref = param->ref;
+ uint8_t *cipher_iv = param->override_iv ? ref->cipher_iv : NULL;
+ uint8_t *auth_iv = param->override_iv ? ref->auth_iv : NULL;
+
+ cipher_range.offset = param->header_len;
+ cipher_range.length = ref->length;
+ auth_range.offset = param->header_len;
+ auth_range.length = ref->length;
+
+ if (param->bit_mode) {
+ reflength = (ref->length + 7) / 8;
+ cipher_range.offset *= 8;
+ auth_range.offset *= 8;
+ } else {
+ reflength = ref->length;
+ }
+
+ for (iteration = NORMAL_TEST; iteration < MAX_TEST; iteration++) {
+ odp_packet_t pkt;
+ uint32_t digest_offset = param->header_len + reflength;
+
+ /*
+ * Test detection of wrong digest value in input packet
+ * only when decoding and using non-null auth algorithm.
+ */
+ if (iteration == WRONG_DIGEST_TEST &&
+ (param->auth_alg == ODP_AUTH_ALG_NULL ||
+ param->op == ODP_CRYPTO_OP_ENCODE))
+ continue;
+
+ pkt = odp_packet_alloc(suite_context.pool,
+ param->header_len + reflength +
+ ref->digest_length + param->trailer_len);
+ CU_ASSERT(pkt != ODP_PACKET_INVALID);
+ if (pkt == ODP_PACKET_INVALID)
+ continue;
+
+ if (param->adjust_segmentation)
+ adjust_segments(&pkt, param->first_seg_len);
+
+ do_header_and_trailer(pkt, param->header_len, param->trailer_len, false);
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->plaintext);
+ } else {
+ odp_packet_copy_from_mem(pkt, param->header_len,
+ reflength, ref->ciphertext);
+ odp_packet_copy_from_mem(pkt, digest_offset,
+ ref->digest_length,
+ ref->digest);
+ if (iteration == WRONG_DIGEST_TEST) {
+ uint8_t byte = ~ref->digest[0];
+
+ odp_packet_copy_from_mem(pkt, digest_offset,
+ 1, &byte);
+ }
+ }
+
+ if (!suite_context.packet)
+ rc = alg_op(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ else if (ODP_CRYPTO_ASYNC == suite_context.op_mode)
+ rc = alg_packet_op_enq(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ else
+ rc = alg_packet_op(pkt, &ok, param->session,
+ cipher_iv, auth_iv,
+ &cipher_range, &auth_range,
+ ref->aad, digest_offset);
+ if (rc < 0) {
+ odp_packet_free(pkt);
+ break;
+ }
+
+ if (iteration == WRONG_DIGEST_TEST) {
+ CU_ASSERT(!ok);
+ odp_packet_free(pkt);
+ continue;
+ }
+
+ CU_ASSERT(ok);
+
+ do_header_and_trailer(pkt, param->header_len, param->trailer_len, true);
+
+ if (param->op == ODP_CRYPTO_OP_ENCODE) {
+ CU_ASSERT(!packet_cmp_mem(pkt, param->header_len,
+ ref->ciphertext,
+ ref->length,
+ param->bit_mode));
+ CU_ASSERT(!packet_cmp_mem(pkt, digest_offset,
+ ref->digest,
+ ref->digest_length,
+ param->bit_mode));
+ } else {
+ CU_ASSERT(!packet_cmp_mem(pkt, param->header_len,
+ ref->plaintext,
+ ref->length,
+ param->bit_mode));
+ }
+ odp_packet_free(pkt);
+ }
+}
+
/* Basic algorithm run function for async inplace mode.
* Creates a session from input parameters and runs one operation
* on input_vec. Checks the output of the crypto operation against
@@ -404,15 +597,14 @@ static void alg_test(odp_crypto_op_t op,
odp_bool_t ovr_iv,
odp_bool_t bit_mode)
{
+ unsigned int initial_num_failures = CU_get_number_of_failures();
odp_crypto_session_t session;
int rc;
- odp_crypto_ses_create_err_t status;
- odp_bool_t ok = false;
- int iteration;
uint32_t reflength;
+ uint32_t seg_len;
+ uint32_t max_shift;
+ odp_crypto_ses_create_err_t status;
odp_crypto_session_param_t ses_params;
- odp_packet_data_range_t cipher_range;
- odp_packet_data_range_t auth_range;
odp_crypto_key_t cipher_key = {
.data = ref->cipher_key,
.length = ref->cipher_key_length
@@ -429,6 +621,7 @@ static void alg_test(odp_crypto_op_t op,
.data = ovr_iv ? NULL : ref->auth_iv,
.length = ref->auth_iv_length
};
+ alg_test_param_t test_param;
/* Create a crypto session */
odp_crypto_session_param_init(&ses_params);
@@ -453,96 +646,47 @@ static void alg_test(odp_crypto_op_t op,
CU_ASSERT(odp_crypto_session_to_u64(session) !=
odp_crypto_session_to_u64(ODP_CRYPTO_SESSION_INVALID));
- cipher_range.offset = 0;
- cipher_range.length = ref->length;
- auth_range.offset = 0;
- auth_range.length = ref->length;
+ memset(&test_param, 0, sizeof(test_param));
+ test_param.session = session;
+ test_param.op = op;
+ test_param.auth_alg = auth_alg;
+ test_param.ref = ref;
+ test_param.override_iv = ovr_iv;
+ test_param.bit_mode = bit_mode;
+
+ alg_test_execute(&test_param);
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,
- reflength + ref->digest_length);
- CU_ASSERT(pkt != ODP_PACKET_INVALID);
- if (pkt == ODP_PACKET_INVALID)
- goto cleanup;
-
- for (iteration = NORMAL_TEST; iteration < MAX_TEST; iteration++) {
- /* checking against wrong digest is meaningless for NULL digest
- * or when generating digest */
- if (iteration == WRONG_DIGEST_TEST &&
- (auth_alg == ODP_AUTH_ALG_NULL ||
- op == ODP_CRYPTO_OP_ENCODE))
- continue;
-
- if (op == ODP_CRYPTO_OP_ENCODE) {
- odp_packet_copy_from_mem(pkt, 0, reflength,
- ref->plaintext);
- } else {
- odp_packet_copy_from_mem(pkt, 0, reflength,
- ref->ciphertext);
- 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, reflength,
- 1, &byte);
- }
- }
-
- if (!suite_context.packet)
- rc = alg_op(pkt, &ok, session,
- ovr_iv ? ref->cipher_iv : NULL,
- ovr_iv ? ref->auth_iv : NULL,
- &cipher_range, &auth_range,
- 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, 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, reflength);
- if (rc < 0)
+ max_shift = reflength + ref->digest_length;
+
+ /*
+ * Test with segmented packets with all possible segment boundaries
+ * within the packet data (including boundary after the packet data
+ * in the location where the digest will be written).
+ */
+ for (seg_len = 0; seg_len <= max_shift; seg_len++) {
+ /*
+ * CUnit chokes on too many assertion failures, so bail
+ * out if this test has already failed.
+ */
+ if (CU_get_number_of_failures() > initial_num_failures)
break;
- if (iteration == WRONG_DIGEST_TEST) {
- CU_ASSERT(!ok);
- continue;
- }
-
- CU_ASSERT(ok);
+ test_param.adjust_segmentation = true;
+ test_param.first_seg_len = seg_len;
+ test_param.header_len = 0;
+ test_param.trailer_len = 0;
+ alg_test_execute(&test_param);
- if (op == ODP_CRYPTO_OP_ENCODE) {
- CU_ASSERT(!packet_cmp_mem(pkt, 0,
- ref->ciphertext,
- ref->length,
- bit_mode));
- CU_ASSERT(!packet_cmp_mem(pkt, reflength,
- ref->digest,
- ref->digest_length,
- bit_mode));
- } else {
- CU_ASSERT(!packet_cmp_mem(pkt, 0,
- ref->plaintext,
- ref->length,
- bit_mode));
- }
+ /* Test partial packet crypto with odd alignment. */
+ test_param.header_len = 3;
+ test_param.trailer_len = 32;
+ alg_test_execute(&test_param);
}
- odp_packet_free(pkt);
-
-cleanup:
rc = odp_crypto_session_destroy(session);
CU_ASSERT(!rc);
}
@@ -1035,10 +1179,6 @@ static int check_alg_3des_cbc(void)
return check_alg_support(ODP_CIPHER_ALG_3DES_CBC, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for 3DES_CBC algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1050,9 +1190,6 @@ static void crypto_test_enc_alg_3des_cbc(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for 3DES_CBC algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1064,11 +1201,6 @@ static void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_3des_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1080,11 +1212,6 @@ static void crypto_test_dec_alg_3des_cbc(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1101,8 +1228,6 @@ static int check_alg_3des_ecb(void)
return check_alg_support(ODP_CIPHER_ALG_3DES_ECB, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for 3DES_ECB algorithm. */
static void crypto_test_enc_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1114,11 +1239,6 @@ static void crypto_test_enc_alg_3des_ecb(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_ECB algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_3des_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1185,10 +1305,6 @@ static int check_alg_aes_gcm(void)
return check_alg_support(ODP_CIPHER_ALG_AES_GCM, ODP_AUTH_ALG_AES_GCM);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_GCM algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1200,10 +1316,6 @@ static void crypto_test_enc_alg_aes_gcm(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_GCM algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_gcm_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1215,11 +1327,6 @@ static void crypto_test_enc_alg_aes_gcm_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_gcm(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1231,11 +1338,6 @@ static void crypto_test_dec_alg_aes_gcm(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for 3DES_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_gcm_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1301,10 +1403,6 @@ static int check_alg_aes_cbc(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CBC, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CBC algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1316,9 +1414,6 @@ static void crypto_test_enc_alg_aes_cbc(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CBC algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1330,11 +1425,6 @@ static void crypto_test_enc_alg_aes_cbc_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_cbc(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1346,11 +1436,6 @@ static void crypto_test_dec_alg_aes_cbc(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CBC algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_cbc_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1367,10 +1452,6 @@ static int check_alg_aes_ctr(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CTR, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CTR algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1382,9 +1463,6 @@ static void crypto_test_enc_alg_aes_ctr(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CTR algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_ctr_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1396,11 +1474,6 @@ static void crypto_test_enc_alg_aes_ctr_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CTR algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_ctr(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1412,11 +1485,6 @@ static void crypto_test_dec_alg_aes_ctr(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CTR algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_ctr_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1433,9 +1501,6 @@ static int check_alg_aes_ecb(void)
return check_alg_support(ODP_CIPHER_ALG_AES_ECB, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_ECB algorithm.
- */
static void crypto_test_enc_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1447,9 +1512,6 @@ static void crypto_test_enc_alg_aes_ecb(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_ECB algorithm.
- * */
static void crypto_test_dec_alg_aes_ecb(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1466,11 +1528,6 @@ static int check_alg_aes_cfb128(void)
return check_alg_support(ODP_CIPHER_ALG_AES_CFB128, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CFB128 algorithm. IV for the operation is the session
- * IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1482,10 +1539,6 @@ static void crypto_test_enc_alg_aes_cfb128(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_CFB128 algorithm. IV for the operation is the operation
- * IV.
- * */
static void crypto_test_enc_alg_aes_cfb128_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1497,11 +1550,6 @@ static void crypto_test_enc_alg_aes_cfb128_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CFB128 algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_cfb128(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1513,11 +1561,6 @@ static void crypto_test_dec_alg_aes_cfb128(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_CFB128 algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_cfb128_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1534,10 +1577,6 @@ static int check_alg_aes_xts(void)
return check_alg_support(ODP_CIPHER_ALG_AES_XTS, ODP_AUTH_ALG_NULL);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_XTS algorithm. IV for the operation is the session IV.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.*/
static void crypto_test_enc_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1549,9 +1588,6 @@ static void crypto_test_enc_alg_aes_xts(void)
false);
}
-/* This test verifies the correctness of encode (plaintext -> ciphertext)
- * operation for AES128_XTS algorithm. IV for the operation is the operation IV.
- * */
static void crypto_test_enc_alg_aes_xts_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1563,11 +1599,6 @@ static void crypto_test_enc_alg_aes_xts_ovr_iv(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_XTS algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_xts(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1579,11 +1610,6 @@ static void crypto_test_dec_alg_aes_xts(void)
false);
}
-/* This test verifies the correctness of decode (ciphertext -> plaintext)
- * operation for AES128_XTS algorithm. IV for the operation is the session IV
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_dec_alg_aes_xts_ovr_iv(void)
{
check_alg(ODP_CRYPTO_OP_DECODE,
@@ -1797,13 +1823,6 @@ static int check_alg_hmac_md5(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_MD5_HMAC);
}
-/* This test verifies the correctness of HMAC_MD5 digest operation.
- * The output check length is truncated to 12 bytes (96 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_md5(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1831,13 +1850,6 @@ static int check_alg_hmac_sha1(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA1 digest operation.
- * The output check length is truncated to 12 bytes (96 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha1(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1892,13 +1904,6 @@ static int check_alg_hmac_sha256(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA256_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA256 digest operation.
- * The output check length is truncated to 16 bytes (128 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha256(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1926,13 +1931,6 @@ static int check_alg_hmac_sha384(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA384_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA384 digest operation.
- * The output check length is truncated to 24 bytes (192 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha384(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1960,13 +1958,6 @@ static int check_alg_hmac_sha512(void)
return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC);
}
-/* This test verifies the correctness of HMAC_SHA512 digest operation.
- * The output check length is truncated to 32 bytes (256 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_hmac_sha512(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
@@ -1995,13 +1986,6 @@ static int check_alg_aes_xcbc(void)
ODP_AUTH_ALG_AES_XCBC_MAC);
}
-/* This test verifies the correctness of AES_XCBC_MAC digest operation.
- * The output check length is truncated to 16 bytes (128 bits) as
- * returned by the crypto operation API call.
- * Note that hash digest is a one-way operation.
- * In addition the test verifies if the implementation can use the
- * packet buffer as completion event buffer.
- * */
static void crypto_test_gen_alg_aes_xcbc(void)
{
check_alg(ODP_CRYPTO_OP_ENCODE,
diff --git a/test/validation/api/ipsec/Makefile.am b/test/validation/api/ipsec/Makefile.am
index 8417a5776..1a29d687d 100644
--- a/test/validation/api/ipsec/Makefile.am
+++ b/test/validation/api/ipsec/Makefile.am
@@ -7,7 +7,8 @@ libtestipsec_la_SOURCES = \
ipsec_test_in.c \
ipsec_test_out.c \
ipsec.h \
- ipsec.c
+ ipsec.c \
+ reass_test_vectors.c
test_PROGRAMS = \
ipsec_sync \
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index 5bbc9c025..c6fbe6f91 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -20,6 +20,7 @@ struct suite_context_s suite_context;
static odp_ipsec_capability_t capa;
#define PKT_POOL_NUM 64
+#define EVENT_WAIT_TIME ODP_TIME_SEC_IN_NS
#define PACKET_USER_PTR ((void *)0x1212fefe)
#define IPSEC_SA_CTX ((void *)0xfefefafa)
@@ -100,6 +101,41 @@ static int pktio_start(odp_pktio_t pktio, odp_bool_t in, odp_bool_t out)
return 1;
}
+static odp_event_t sched_queue_deq(uint64_t wait_ns)
+{
+ uint64_t wait = odp_schedule_wait_time(wait_ns);
+
+ return odp_schedule(NULL, wait);
+}
+
+static odp_event_t plain_queue_deq(odp_queue_t queue, uint64_t wait_ns)
+{
+ odp_time_t cur, wait, next;
+ odp_event_t event;
+
+ wait = odp_time_local_from_ns(wait_ns);
+ next = odp_time_sum(odp_time_local(), wait);
+
+ do {
+ event = odp_queue_deq(queue);
+ cur = odp_time_local();
+ } while (event == ODP_EVENT_INVALID && odp_time_cmp(next, cur) >= 0);
+
+ return event;
+}
+
+static odp_event_t recv_event(odp_queue_t queue, uint64_t wait_ns)
+{
+ odp_event_t event;
+
+ if (odp_queue_type(queue) == ODP_QUEUE_TYPE_PLAIN)
+ event = plain_queue_deq(queue, wait_ns);
+ else
+ event = sched_queue_deq(wait_ns);
+
+ return event;
+}
+
static void pktio_stop(odp_pktio_t pktio)
{
odp_queue_t queue = ODP_QUEUE_INVALID;
@@ -110,7 +146,7 @@ static void pktio_stop(odp_pktio_t pktio)
fprintf(stderr, "IPsec pktio stop failed.\n");
while (1) {
- odp_event_t ev = odp_queue_deq(queue);
+ odp_event_t ev = recv_event(queue, 0);
if (ev != ODP_EVENT_INVALID)
odp_event_free(ev);
@@ -139,6 +175,17 @@ int ipsec_check(odp_bool_t ah,
ODP_SUPPORT_NO == capa.op_mode_inline_out))
return ODP_TEST_INACTIVE;
+ if (!(ODP_IPSEC_OP_MODE_SYNC == suite_context.inbound_op_mode &&
+ ODP_IPSEC_OP_MODE_SYNC == suite_context.outbound_op_mode) &&
+ ODP_QUEUE_INVALID != suite_context.queue) {
+ if (suite_context.q_type == ODP_QUEUE_TYPE_PLAIN &&
+ !capa.queue_type_plain)
+ return ODP_TEST_INACTIVE;
+ if (suite_context.q_type == ODP_QUEUE_TYPE_SCHED &&
+ !capa.queue_type_sched)
+ return ODP_TEST_INACTIVE;
+ }
+
/* suite_context.pktio is set to ODP_PKTIO_INVALID in ipsec_suite_init()
* if the pktio device doesn't support inline IPsec processing. */
if (suite_context.pktio == ODP_PKTIO_INVALID &&
@@ -356,9 +403,7 @@ void ipsec_sa_destroy(odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa));
if (ODP_QUEUE_INVALID != suite_context.queue) {
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_event(suite_context.queue, EVENT_WAIT_TIME);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_IPSEC_STATUS, odp_event_type(event));
@@ -516,12 +561,27 @@ static int send_pkts(const ipsec_test_part part[], int num_part)
return num_part;
}
+/* Receive async inbound packet */
+static odp_event_t recv_pkt_async_inbound(odp_ipsec_op_status_t status)
+{
+ odp_queue_t queue;
+
+ /*
+ * In case of SA lookup failure, the event is enqueued to the default
+ * queue specified during odp_ipsec_config()
+ */
+ if (status.error.sa_lookup == 0)
+ queue = suite_context.queue;
+ else
+ queue = suite_context.default_queue;
+
+ return recv_event(queue, EVENT_WAIT_TIME);
+}
+
/* Receive inline processed packets */
static int recv_pkts_inline(const ipsec_test_part *part,
odp_packet_t *pkto)
{
- odp_packet_reass_partial_state_t reass_state;
- odp_packet_reass_status_t reass_status;
odp_queue_t queue = ODP_QUEUE_INVALID;
int i;
@@ -532,7 +592,7 @@ static int recv_pkts_inline(const ipsec_test_part *part,
odp_event_t ev;
odp_event_subtype_t subtype;
- ev = odp_queue_deq(queue);
+ ev = recv_event(queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -547,10 +607,15 @@ static int recv_pkts_inline(const ipsec_test_part *part,
continue;
}
- ev = odp_queue_deq(suite_context.queue);
+ ev = recv_event(suite_context.queue, 0);
if (ODP_EVENT_INVALID != ev) {
odp_packet_t pkt;
int num_pkts = 0;
+ odp_packet_reass_status_t reass_status;
+ odp_packet_reass_info_t reass = {0};
+ odp_packet_reass_partial_state_t reass_state;
+ odp_packet_t frags[MAX_FRAGS];
+ int j;
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET, odp_event_type(ev));
@@ -559,13 +624,18 @@ static int recv_pkts_inline(const ipsec_test_part *part,
CU_ASSERT(!part->out[i].status.error.sa_lookup);
reass_status = odp_packet_reass_status(pkt);
- if (ODP_PACKET_REASS_INCOMPLETE != reass_status) {
+ CU_ASSERT(reass_status == part->out[i].reass_status);
+
+ switch (reass_status) {
+ case ODP_PACKET_REASS_COMPLETE:
+ CU_ASSERT(odp_packet_reass_info(pkt, &reass) == 0);
+ CU_ASSERT(part->out[i].num_frags == reass.num_frags);
+ /* FALLTHROUGH */
+ case ODP_PACKET_REASS_NONE:
pkto[i] = pkt;
num_pkts = 1;
- } else {
- odp_packet_t frags[MAX_FRAGS];
- int j;
-
+ break;
+ case ODP_PACKET_REASS_INCOMPLETE:
CU_ASSERT(0 ==
odp_packet_reass_partial_state(pkt, frags, &reass_state));
num_pkts = reass_state.num_frags;
@@ -573,6 +643,10 @@ static int recv_pkts_inline(const ipsec_test_part *part,
CU_ASSERT_FATAL(i + num_pkts <= part->num_pkt);
for (j = 0; j < num_pkts; j++)
pkto[i + j] = frags[j];
+ break;
+ default:
+ CU_FAIL("Unknown reassembly status");
+ break;
}
for (; num_pkts > 0; num_pkts--)
@@ -625,9 +699,7 @@ static int ipsec_process_in(const ipsec_test_part *part,
odp_event_t event;
odp_event_subtype_t subtype;
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_pkt_async_inbound(part->out[i].status);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -680,9 +752,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
odp_event_t event;
odp_event_subtype_t subtype;
- do {
- event = odp_queue_deq(suite_context.queue);
- } while (event == ODP_EVENT_INVALID);
+ event = recv_event(suite_context.queue, EVENT_WAIT_TIME);
CU_ASSERT(odp_event_is_valid(event) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -764,7 +834,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
odp_event_t ev;
odp_event_subtype_t subtype;
- ev = odp_queue_deq(queue);
+ ev = recv_event(queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -779,7 +849,7 @@ static int ipsec_send_out_one(const ipsec_test_part *part,
continue;
}
- ev = odp_queue_deq(suite_context.queue);
+ ev = recv_event(suite_context.queue, 0);
if (ODP_EVENT_INVALID != ev) {
CU_ASSERT(odp_event_is_valid(ev) == 1);
CU_ASSERT_EQUAL(ODP_EVENT_PACKET,
@@ -878,6 +948,11 @@ static void verify_in(const ipsec_test_part *part,
if (ODP_IPSEC_SA_INVALID != sa)
CU_ASSERT_EQUAL(IPSEC_SA_CTX,
odp_ipsec_sa_context(sa));
+ if (suite_context.inbound_op_mode != ODP_IPSEC_OP_MODE_SYNC) {
+ uint32_t len = part->pkt_in->len - part->pkt_in->l3_offset;
+
+ CU_ASSERT(result.orig_ip_len == len);
+ }
}
ipsec_check_packet(part->out[i].pkt_res,
pkto[i],
@@ -1005,7 +1080,7 @@ void ipsec_check_out_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
odp_packet_free(pkto[i]);
}
-int ipsec_suite_init(void)
+static int ipsec_suite_init(void)
{
int rc = 0;
@@ -1033,11 +1108,16 @@ void ipsec_test_packet_from_pkt(ipsec_test_packet *test_pkt, odp_packet_t *pkt)
odp_packet_free(*pkt);
}
-static int ipsec_suite_term(void)
+int ipsec_suite_term(void)
{
if (suite_context.pktio != ODP_PKTIO_INVALID)
pktio_stop(suite_context.pktio);
+ if (ODP_QUEUE_INVALID != suite_context.queue) {
+ if (odp_queue_destroy(suite_context.queue))
+ fprintf(stderr, "IPsec destq destroy failed.\n");
+ }
+
if (odp_cunit_print_inactive())
return -1;
@@ -1054,19 +1134,80 @@ int ipsec_out_term(void)
return ipsec_suite_term();
}
+static odp_queue_t sched_queue_create(const char *name)
+{
+ odp_queue_param_t qparam;
+
+ odp_queue_param_init(&qparam);
+ qparam.type = ODP_QUEUE_TYPE_SCHED;
+ qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT;
+ qparam.sched.sync = ODP_SCHED_SYNC_PARALLEL;
+ qparam.sched.group = ODP_SCHED_GROUP_ALL;
+
+ return odp_queue_create(name, &qparam);
+}
+
+static odp_queue_t plain_queue_create(const char *name)
+{
+ return odp_queue_create(name, NULL);
+}
+
+int ipsec_suite_sync_init(void)
+{
+ suite_context.queue = ODP_QUEUE_INVALID;
+
+ /* q_type doesn't matter when queue handle is invalid. */
+ suite_context.q_type = ODP_QUEUE_TYPE_PLAIN;
+
+ return ipsec_suite_init();
+}
+
+int ipsec_suite_plain_init(void)
+{
+ odp_queue_t dest_queue;
+
+ dest_queue = plain_queue_create("ipsec-out");
+ if (ODP_QUEUE_INVALID == dest_queue) {
+ fprintf(stderr, "IPsec destq creation failed.\n");
+ return -1;
+ }
+
+ suite_context.queue = dest_queue;
+ suite_context.q_type = ODP_QUEUE_TYPE_PLAIN;
+
+ return ipsec_suite_init();
+}
+
+int ipsec_suite_sched_init(void)
+{
+ odp_queue_t dest_queue;
+
+ dest_queue = sched_queue_create("ipsec-out");
+ if (ODP_QUEUE_INVALID == dest_queue) {
+ fprintf(stderr, "IPsec destq creation failed.\n");
+ return -1;
+ }
+
+ suite_context.queue = dest_queue;
+ suite_context.q_type = ODP_QUEUE_TYPE_SCHED;
+
+ return ipsec_suite_init();
+}
+
int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
{
odp_pool_param_t params;
odp_pool_t pool;
- 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;
+ suite_context.reass_ipv4 = false;
+ suite_context.reass_ipv6 = false;
suite_context.pool = ODP_POOL_INVALID;
- suite_context.queue = ODP_QUEUE_INVALID;
suite_context.pktio = ODP_PKTIO_INVALID;
+ suite_context.default_queue = ODP_QUEUE_INVALID;
if (odph_options(&helper_options)) {
fprintf(stderr, "error: odph_options() failed.\n");
@@ -1086,6 +1227,11 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
return -1;
}
+ if (odp_schedule_config(NULL)) {
+ fprintf(stderr, "odp_schedule_config() failed.\n");
+ return -1;
+ }
+
if (odp_pool_capability(&pool_capa) < 0) {
fprintf(stderr, "error: odp_pool_capability() failed.\n");
return -1;
@@ -1115,14 +1261,6 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode)
fprintf(stderr, "Packet pool creation failed.\n");
return -1;
}
- if (mode == ODP_IPSEC_OP_MODE_ASYNC ||
- mode == ODP_IPSEC_OP_MODE_INLINE) {
- out_queue = odp_queue_create("ipsec-out", NULL);
- if (ODP_QUEUE_INVALID == out_queue) {
- fprintf(stderr, "IPsec outq creation failed.\n");
- return -1;
- }
- }
if (mode == ODP_IPSEC_OP_MODE_INLINE) {
pktio = pktio_create(pool);
@@ -1159,6 +1297,19 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
ODP_SUPPORT_NO == capa.op_mode_inline_out))
return 0;
+ if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_ASYNC ||
+ suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) {
+ if (capa.queue_type_plain)
+ suite_context.default_queue = plain_queue_create("ipsec-default");
+ else if (capa.queue_type_sched)
+ suite_context.default_queue = sched_queue_create("ipsec-default");
+
+ if (ODP_QUEUE_INVALID == suite_context.default_queue) {
+ fprintf(stderr, "IPsec defaultq creation failed.\n");
+ return -1;
+ }
+ }
+
reass_test_vectors_init();
odp_ipsec_config_init(&ipsec_config);
@@ -1166,7 +1317,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
ipsec_config.inbound_mode = suite_context.inbound_op_mode;
ipsec_config.outbound_mode = suite_context.outbound_op_mode;
ipsec_config.outbound.all_chksum = ~0;
- ipsec_config.inbound.default_queue = suite_context.queue;
+ ipsec_config.inbound.default_queue = suite_context.default_queue;
ipsec_config.inbound.parse_level = ODP_PROTO_LAYER_ALL;
ipsec_config.inbound.chksums.all_chksum = ~0;
ipsec_config.stats_en = true;
@@ -1242,7 +1393,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst)
int ipsec_term(odp_instance_t inst)
{
odp_pool_t pool = suite_context.pool;
- odp_queue_t out_queue = suite_context.queue;
+ odp_queue_t default_queue = suite_context.default_queue;
/* suite_context.pktio is set to ODP_PKTIO_INVALID by ipsec_suite_init()
if inline processing is not supported. */
odp_pktio_t pktio = odp_pktio_lookup("loop");
@@ -1252,9 +1403,9 @@ int ipsec_term(odp_instance_t inst)
fprintf(stderr, "IPsec pktio close failed.\n");
}
- if (ODP_QUEUE_INVALID != out_queue) {
- if (odp_queue_destroy(out_queue))
- fprintf(stderr, "IPsec outq destroy failed.\n");
+ if (ODP_QUEUE_INVALID != default_queue) {
+ if (odp_queue_destroy(default_queue))
+ fprintf(stderr, "IPsec defaultq destroy failed.\n");
}
if (ODP_POOL_INVALID != pool) {
diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h
index b899fce48..6edce03d0 100644
--- a/test/validation/api/ipsec/ipsec.h
+++ b/test/validation/api/ipsec/ipsec.h
@@ -29,7 +29,10 @@ int ipsec_config(odp_instance_t inst);
int ipsec_in_inline_init(void);
int ipsec_out_inline_init(void);
-int ipsec_suite_init(void);
+int ipsec_suite_sync_init(void);
+int ipsec_suite_plain_init(void);
+int ipsec_suite_sched_init(void);
+int ipsec_suite_term(void);
int ipsec_in_term(void);
int ipsec_out_term(void);
@@ -39,8 +42,10 @@ struct suite_context_s {
odp_ipsec_op_mode_t inbound_op_mode;
odp_ipsec_op_mode_t outbound_op_mode;
odp_pool_t pool;
+ odp_queue_t default_queue;
odp_queue_t queue;
odp_pktio_t pktio;
+ odp_queue_type_t q_type;
};
extern struct suite_context_s suite_context;
@@ -85,6 +90,8 @@ typedef struct {
int num_pkt;
struct {
odp_ipsec_op_status_t status;
+ odp_packet_reass_status_t reass_status;
+ uint16_t num_frags;
const ipsec_test_packet *pkt_res;
odp_proto_l3_type_t l3_type;
odp_proto_l4_type_t l4_type;
diff --git a/test/validation/api/ipsec/ipsec_async.c b/test/validation/api/ipsec/ipsec_async.c
index 8f818a94e..44c968a4d 100644
--- a/test/validation/api/ipsec/ipsec_async.c
+++ b/test/validation/api/ipsec/ipsec_async.c
@@ -10,6 +10,9 @@ static int ipsec_async_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_ASYNC);
if (rc != 0)
return rc;
@@ -17,19 +20,19 @@ static int ipsec_async_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
-
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-plain-in", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-sched-in", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-plain-out", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_out_suite},
+ {"IPsec-sched-out", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_inline_in.c b/test/validation/api/ipsec/ipsec_inline_in.c
index bd34f6cc4..cbb3a178a 100644
--- a/test/validation/api/ipsec/ipsec_inline_in.c
+++ b/test/validation/api/ipsec/ipsec_inline_in.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_INLINE);
if (rc != 0)
return rc;
@@ -17,21 +20,18 @@ static int ipsec_sync_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
suite_context.pktio = odp_pktio_lookup("loop");
if (suite_context.pktio == ODP_PKTIO_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
+ {"IPsec-plain-in", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_in_suite},
+ {"IPsec-sched-in", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_in_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_inline_out.c b/test/validation/api/ipsec/ipsec_inline_out.c
index 5cda43b74..3da19892b 100644
--- a/test/validation/api/ipsec/ipsec_inline_out.c
+++ b/test/validation/api/ipsec/ipsec_inline_out.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_INLINE);
if (rc != 0)
return rc;
@@ -17,21 +20,18 @@ static int ipsec_sync_init(odp_instance_t *inst)
suite_context.pool = odp_pool_lookup("packet_pool");
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.queue = odp_queue_lookup("ipsec-out");
- if (suite_context.queue == ODP_QUEUE_INVALID)
- return -1;
suite_context.pktio = odp_pktio_lookup("loop");
if (suite_context.pktio == ODP_PKTIO_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_ASYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_INLINE;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-plain-out", ipsec_suite_plain_init, ipsec_suite_term,
+ ipsec_out_suite},
+ {"IPsec-sched-out", ipsec_suite_sched_init, ipsec_suite_term,
+ ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_sync.c b/test/validation/api/ipsec/ipsec_sync.c
index f77bb1c51..74ae1fe19 100644
--- a/test/validation/api/ipsec/ipsec_sync.c
+++ b/test/validation/api/ipsec/ipsec_sync.c
@@ -10,6 +10,9 @@ static int ipsec_sync_init(odp_instance_t *inst)
{
int rc;
+ suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
+ suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
+
rc = ipsec_init(inst, ODP_IPSEC_OP_MODE_SYNC);
if (rc != 0)
return rc;
@@ -18,15 +21,12 @@ static int ipsec_sync_init(odp_instance_t *inst)
if (suite_context.pool == ODP_POOL_INVALID)
return -1;
- suite_context.inbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
- suite_context.outbound_op_mode = ODP_IPSEC_OP_MODE_SYNC;
-
return ipsec_config(*inst);
}
odp_suiteinfo_t ipsec_suites[] = {
- {"IPsec-in", ipsec_suite_init, ipsec_in_term, ipsec_in_suite},
- {"IPsec-out", ipsec_suite_init, ipsec_out_term, ipsec_out_suite},
+ {"IPsec-in", ipsec_suite_sync_init, ipsec_in_term, ipsec_in_suite},
+ {"IPsec-out", ipsec_suite_sync_init, ipsec_out_term, ipsec_out_suite},
ODP_SUITE_INFO_NULL,
};
diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c
index ef6996f1d..bcdcd4e83 100644
--- a/test/validation/api/ipsec/ipsec_test_in.c
+++ b/test/validation/api/ipsec/ipsec_test_in.c
@@ -1772,7 +1772,8 @@ static void test_multi_out_in(odp_ipsec_sa_t out_sa,
uint8_t tunnel_ip_ver,
int num_input_packets,
ipsec_test_packet *input_packets[],
- ipsec_test_packet *result_packet)
+ ipsec_test_packet *result_packet,
+ odp_packet_reass_status_t reass_status)
{
uint8_t ver_ihl = result_packet->data[result_packet->l3_offset];
odp_bool_t is_result_ipv6 = (ODPH_IPV4HDR_VER(ver_ihl) == ODPH_IPV6);
@@ -1800,6 +1801,8 @@ static void test_multi_out_in(odp_ipsec_sa_t out_sa,
if (i == num_input_packets - 1) {
part_prep_plain(&test_in, 1, is_result_ipv6, true);
test_in.out[0].pkt_res = result_packet;
+ test_in.out[0].reass_status = reass_status;
+ test_in.out[0].num_frags = num_input_packets;
}
ipsec_test_packet_from_pkt(&test_pkt, &pkt);
test_in.pkt_in = &test_pkt;
@@ -1820,7 +1823,8 @@ static void test_in_ipv4_esp_reass_success_two_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
@@ -1837,7 +1841,8 @@ static void test_in_ipv4_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -1852,7 +1857,8 @@ static void test_in_ipv4_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -1869,7 +1875,8 @@ static void test_in_ipv4_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv4_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
@@ -1883,7 +1890,8 @@ static void test_in_ipv4_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV4,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_INCOMPLETE);
}
static void test_in_ipv4_esp_reass_success(void)
@@ -2001,7 +2009,8 @@ static void test_in_ipv6_esp_reass_success_two_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
@@ -2018,7 +2027,8 @@ static void test_in_ipv6_esp_reass_success_four_frags(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -2033,7 +2043,8 @@ static void test_in_ipv6_esp_reass_success_two_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
@@ -2050,7 +2061,8 @@ static void test_in_ipv6_esp_reass_success_four_frags_ooo(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_COMPLETE);
}
static void test_in_ipv6_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
@@ -2064,7 +2076,8 @@ static void test_in_ipv6_esp_reass_incomp_missing(odp_ipsec_sa_t out_sa,
test_multi_out_in(out_sa, in_sa, ODPH_IPV6,
ARRAY_SIZE(input_packets),
input_packets,
- result_packet);
+ result_packet,
+ ODP_PACKET_REASS_INCOMPLETE);
}
static void test_in_ipv6_esp_reass_success(void)
diff --git a/test/validation/api/ipsec/reass_test_vectors.c b/test/validation/api/ipsec/reass_test_vectors.c
new file mode 100644
index 000000000..c3bb2bfd4
--- /dev/null
+++ b/test/validation/api/ipsec/reass_test_vectors.c
@@ -0,0 +1,353 @@
+/* Copyright (c) 2021, Marvell
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "ipsec.h"
+
+/* The source file includes below test vectors */
+
+/* IPv6:
+ *
+ * 1) pkt_ipv6_udp_p1
+ * pkt_ipv6_udp_p1_f1
+ * pkt_ipv6_udp_p1_f2
+ *
+ * 2) pkt_ipv6_udp_p2
+ * pkt_ipv6_udp_p2_f1
+ * pkt_ipv6_udp_p2_f2
+ * pkt_ipv6_udp_p2_f3
+ * pkt_ipv6_udp_p2_f4
+ */
+
+/* IPv4:
+ *
+ * 1) pkt_ipv4_udp_p1
+ * pkt_ipv4_udp_p1_f1
+ * pkt_ipv4_udp_p1_f2
+ *
+ * 2) pkt_ipv4_udp_p2
+ * pkt_ipv4_udp_p2_f1
+ * pkt_ipv4_udp_p2_f2
+ * pkt_ipv4_udp_p2_f3
+ * pkt_ipv4_udp_p2_f4
+ */
+
+ipsec_test_packet pkt_ipv6_udp_p1 = {
+ .len = 1514,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 54,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x11, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p1_f1 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x00, 0x01, 0x5c, 0x92, 0xac, 0xf1,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p1_f2 = {
+ .len = 186,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x05, 0x38, 0x5c, 0x92, 0xac, 0xf1,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2 = {
+ .len = 4496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 54,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x11, 0x5a, 0x11, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f1 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x00, 0x01, 0x64, 0x6c, 0x68, 0x9f,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f2 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x05, 0x39, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f3 = {
+ .len = 1398,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x0a, 0x71, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv6_udp_p2_f4 = {
+ .len = 496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 62,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
+
+ /* IP */
+ 0x60, 0x00, 0x00, 0x00, 0x01, 0xba, 0x2c, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
+ 0x11, 0x00, 0x0f, 0xa8, 0x64, 0x6c, 0x68, 0x9f,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1 = {
+ .len = 1514,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0xdc, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x11, 0x66, 0x0d, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1_f1 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x01, 0x20, 0x00,
+ 0x40, 0x11, 0x46, 0x5d, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p1_f2 = {
+ .len = 114,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0xaf,
+ 0x40, 0x11, 0x6a, 0xd6, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2 = {
+ .len = 4496,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x11, 0x82, 0x00, 0x02, 0x00, 0x00,
+ 0x40, 0x11, 0x5a, 0x66, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f1 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0x00,
+ 0x40, 0x11, 0x46, 0x5c, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* UDP */
+ 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f2 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0xaf,
+ 0x40, 0x11, 0x45, 0xad, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f3 = {
+ .len = 1434,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x21, 0x5e,
+ 0x40, 0x11, 0x44, 0xfe, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
+
+ipsec_test_packet pkt_ipv4_udp_p2_f4 = {
+ .len = 296,
+ .l2_offset = 0,
+ .l3_offset = 14,
+ .l4_offset = 34,
+ .data = {
+ /* ETH */
+ 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+ 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+ /* IP */
+ 0x45, 0x00, 0x01, 0x1a, 0x00, 0x02, 0x02, 0x0d,
+ 0x40, 0x11, 0x68, 0xc1, 0x0d, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x02,
+ },
+};
diff --git a/test/validation/api/ipsec/reass_test_vectors.h b/test/validation/api/ipsec/reass_test_vectors.h
index 4fbb1ebaf..02b41c573 100644
--- a/test/validation/api/ipsec/reass_test_vectors.h
+++ b/test/validation/api/ipsec/reass_test_vectors.h
@@ -7,351 +7,23 @@
#ifndef _ODP_REASS_TEST_VECTORS_H_
#define _ODP_REASS_TEST_VECTORS_H_
-/* The header file includes below test vectors */
-
-/* IPv6:
- *
- * 1) pkt_ipv6_udp_p1
- * pkt_ipv6_udp_p1_f1
- * pkt_ipv6_udp_p1_f2
- *
- * 2) pkt_ipv6_udp_p2
- * pkt_ipv6_udp_p2_f1
- * pkt_ipv6_udp_p2_f2
- * pkt_ipv6_udp_p2_f3
- * pkt_ipv6_udp_p2_f4
- */
-
-/* IPv4:
- *
- * 1) pkt_ipv4_udp_p1
- * pkt_ipv4_udp_p1_f1
- * pkt_ipv4_udp_p1_f2
- *
- * 2) pkt_ipv4_udp_p2
- * pkt_ipv4_udp_p2_f1
- * pkt_ipv4_udp_p2_f2
- * pkt_ipv4_udp_p2_f3
- * pkt_ipv4_udp_p2_f4
- */
-
-static ipsec_test_packet pkt_ipv6_udp_p1 = {
- .len = 1514,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 54,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x11, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p1_f1 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x00, 0x01, 0x5c, 0x92, 0xac, 0xf1,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xb4, 0x2b, 0xe8,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p1_f2 = {
- .len = 186,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x84, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x05, 0x38, 0x5c, 0x92, 0xac, 0xf1,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2 = {
- .len = 4496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 54,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x11, 0x5a, 0x11, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f1 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x00, 0x01, 0x64, 0x6c, 0x68, 0x9f,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x5a, 0x8a, 0x11,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f2 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x05, 0x39, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f3 = {
- .len = 1398,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x05, 0x40, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x0a, 0x71, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv6_udp_p2_f4 = {
- .len = 496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 62,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x86, 0xdd,
-
- /* IP */
- 0x60, 0x00, 0x00, 0x00, 0x01, 0xba, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x0d, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02,
- 0x11, 0x00, 0x0f, 0xa8, 0x64, 0x6c, 0x68, 0x9f,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1 = {
- .len = 1514,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0xdc, 0x00, 0x01, 0x00, 0x00,
- 0x40, 0x11, 0x66, 0x0d, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1_f1 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x01, 0x20, 0x00,
- 0x40, 0x11, 0x46, 0x5d, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x05, 0xc8, 0xb8, 0x4c,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p1_f2 = {
- .len = 114,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0xaf,
- 0x40, 0x11, 0x6a, 0xd6, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2 = {
- .len = 4496,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x11, 0x82, 0x00, 0x02, 0x00, 0x00,
- 0x40, 0x11, 0x5a, 0x66, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f1 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0x00,
- 0x40, 0x11, 0x46, 0x5c, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
-
- /* UDP */
- 0x08, 0x00, 0x27, 0x10, 0x11, 0x6e, 0x16, 0x76,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f2 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x20, 0xaf,
- 0x40, 0x11, 0x45, 0xad, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f3 = {
- .len = 1434,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x05, 0x8c, 0x00, 0x02, 0x21, 0x5e,
- 0x40, 0x11, 0x44, 0xfe, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
-
-static ipsec_test_packet pkt_ipv4_udp_p2_f4 = {
- .len = 296,
- .l2_offset = 0,
- .l3_offset = 14,
- .l4_offset = 34,
- .data = {
- /* ETH */
- 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
- 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
-
- /* IP */
- 0x45, 0x00, 0x01, 0x1a, 0x00, 0x02, 0x02, 0x0d,
- 0x40, 0x11, 0x68, 0xc1, 0x0d, 0x00, 0x00, 0x02,
- 0x02, 0x00, 0x00, 0x02,
- },
-};
+extern ipsec_test_packet pkt_ipv6_udp_p1;
+extern ipsec_test_packet pkt_ipv6_udp_p1_f1;
+extern ipsec_test_packet pkt_ipv6_udp_p1_f2;
+extern ipsec_test_packet pkt_ipv6_udp_p2;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f1;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f2;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f3;
+extern ipsec_test_packet pkt_ipv6_udp_p2_f4;
+
+extern ipsec_test_packet pkt_ipv4_udp_p1;
+extern ipsec_test_packet pkt_ipv4_udp_p1_f1;
+extern ipsec_test_packet pkt_ipv4_udp_p1_f2;
+extern ipsec_test_packet pkt_ipv4_udp_p2;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f1;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f2;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f3;
+extern ipsec_test_packet pkt_ipv4_udp_p2_f4;
static inline void
test_vector_payload_populate(ipsec_test_packet *pkt, odp_bool_t first_frag)
diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index d791063e2..861ac18ae 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -893,6 +893,63 @@ static void pool_test_pool_index(void)
}
}
+static void pool_test_create_max_pkt_pools(void)
+{
+ uint32_t max_pools = global_pool_capa.pkt.max_pools;
+ uint32_t i, num_pools, num_shm;
+ odp_pool_t pool[max_pools];
+ odp_pool_param_t param;
+ odp_shm_capability_t shm_capa;
+ uint32_t shm_size = 32;
+ uint32_t uarea_size = 32;
+
+ CU_ASSERT_FATAL(max_pools > 0);
+
+ /* Reserve maximum number of SHM blocks */
+ CU_ASSERT_FATAL(odp_shm_capability(&shm_capa) == 0);
+ CU_ASSERT_FATAL(shm_capa.max_blocks > 0);
+
+ odp_shm_t shm[shm_capa.max_blocks];
+
+ if (shm_capa.max_size && shm_capa.max_size < shm_size)
+ shm_size = shm_capa.max_size;
+
+ for (i = 0; i < shm_capa.max_blocks; i++) {
+ shm[i] = odp_shm_reserve(NULL, shm_size, 0, 0);
+
+ if (shm[i] == ODP_SHM_INVALID)
+ break;
+ }
+ num_shm = i;
+ CU_ASSERT(num_shm == shm_capa.max_blocks);
+
+ /* Create maximum number of packet pools */
+ if (global_pool_capa.pkt.max_uarea_size && global_pool_capa.pkt.max_uarea_size < uarea_size)
+ uarea_size = global_pool_capa.pkt.max_uarea_size;
+
+ odp_pool_param_init(&param);
+ param.type = ODP_POOL_PACKET;
+ param.pkt.len = PKT_LEN;
+ param.pkt.num = 1;
+ param.pkt.max_num = 1;
+ param.pkt.uarea_size = uarea_size;
+
+ for (i = 0; i < max_pools; i++) {
+ pool[i] = odp_pool_create(NULL, &param);
+
+ if (pool[i] == ODP_POOL_INVALID)
+ break;
+ }
+ num_pools = i;
+ CU_ASSERT(num_pools == max_pools);
+
+ for (i = 0; i < num_pools; i++)
+ CU_ASSERT(odp_pool_destroy(pool[i]) == 0);
+
+ for (i = 0; i < num_shm; i++)
+ CU_ASSERT(odp_shm_free(shm[i]) == 0);
+}
+
static int pool_check_buffer_pool_statistics(void)
{
if (global_pool_capa.buf.stats.all == 0)
@@ -1706,6 +1763,7 @@ odp_testinfo_t pool_suite[] = {
ODP_TEST_INFO(pool_test_tmo_max_num),
ODP_TEST_INFO(pool_test_create_after_fork),
ODP_TEST_INFO(pool_test_pool_index),
+ ODP_TEST_INFO(pool_test_create_max_pkt_pools),
ODP_TEST_INFO_CONDITIONAL(pool_test_buffer_pool_statistics,
pool_check_buffer_pool_statistics),
ODP_TEST_INFO_CONDITIONAL(pool_test_packet_pool_statistics,