diff options
Diffstat (limited to 'example/ipsec_api/odp_ipsec.c')
-rw-r--r-- | example/ipsec_api/odp_ipsec.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 5cdb59da3..cebc733ae 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -742,7 +742,7 @@ pkt_disposition_e do_ipsec_out_classify(odp_packet_t *ppkt, pkt_ctx_t *ctx) * - Sequence number assignment queue * - Per packet crypto API completion queue * - * @param arg Required by "odph_odpthreads_create", unused + * @param arg Required by "odph_thread_create", unused * * @return NULL (should never return) */ @@ -914,17 +914,19 @@ int main(int argc, char *argv[]) { 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; int num_workers; int i; int stream_count; odp_shm_t shm; odp_cpumask_t cpumask; char cpumaskstr[ODP_CPUMASK_STR_SIZE]; + odp_ipsec_capability_t ipsec_capa; odp_pool_param_t params; odp_instance_t instance; odp_init_t init_param; - odph_odpthread_params_t thr_params; odp_event_t ev; /* create by default scheduled queues */ @@ -963,6 +965,23 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } + if (odp_ipsec_capability(&ipsec_capa)) { + ODPH_ERR("Error: IPsec capability request failed.\n"); + exit(EXIT_FAILURE); + } + + if (queue_create == polled_odp_queue_create) { + if (!ipsec_capa.queue_type_plain) { + ODPH_ERR("Error: Plain type dest queue not supported.\n"); + exit(EXIT_FAILURE); + } + } else { + if (!ipsec_capa.queue_type_sched) { + ODPH_ERR("Error: scheduled type dest queue not supported.\n"); + exit(EXIT_FAILURE); + } + } + /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("shm_args", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0); @@ -1060,13 +1079,18 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ + 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 = pktio_thread; + thr_param.arg = NULL; + thr_param.thr_type = ODP_THREAD_WORKER; + memset(thread_tbl, 0, sizeof(thread_tbl)); - memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = pktio_thread; - thr_params.arg = NULL; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; - odph_odpthreads_create(thread_tbl, &cpumask, &thr_params); + odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers); /* If there are streams attempt to verify them. Otherwise, run until * SIGINT is received. */ @@ -1080,7 +1104,7 @@ main(int argc, char *argv[]) printf("All received\n"); odp_atomic_store_u32(&global->exit_threads, 1); } - odph_odpthreads_join(thread_tbl); + odph_thread_join(thread_tbl, num_workers); /* Stop and close used pktio devices */ for (i = 0; i < global->appl.if_count; i++) { |