diff options
Diffstat (limited to 'test/validation/api/ipsec/ipsec.c')
-rw-r--r-- | test/validation/api/ipsec/ipsec.c | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 11860bf9b..ea2685666 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -57,12 +57,12 @@ static odp_pktio_t pktio_create(odp_pool_t pool) if (pktio == ODP_PKTIO_INVALID) { ret = odp_pool_destroy(pool); if (ret) - fprintf(stderr, "unable to destroy pool.\n"); + ODPH_ERR("Unable to destroy pool\n"); return ODP_PKTIO_INVALID; } if (odp_pktio_capability(pktio, &capa)) { - fprintf(stderr, "pktio capabilities failed.\n"); + ODPH_ERR("Pktio capabilities failed\n"); return ODP_PKTIO_INVALID; } @@ -70,12 +70,12 @@ static odp_pktio_t pktio_create(odp_pool_t pool) pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; if (odp_pktin_queue_config(pktio, &pktin_param)) { - fprintf(stderr, "pktin queue config failed.\n"); + ODPH_ERR("Pktin queue config failed\n"); return ODP_PKTIO_INVALID; } if (odp_pktout_queue_config(pktio, NULL)) { - fprintf(stderr, "pktout queue config failed.\n"); + ODPH_ERR("Pktout queue config failed\n"); return ODP_PKTIO_INVALID; } @@ -213,7 +213,7 @@ static void pktio_stop(odp_pktio_t pktio) odp_pktin_event_queue(pktio, &queue, 1); if (odp_pktio_stop(pktio)) - fprintf(stderr, "IPsec pktio stop failed.\n"); + ODPH_ERR("IPsec pktio stop failed\n"); while (1) { odp_event_t ev = recv_event(queue, 0); @@ -266,7 +266,7 @@ int ipsec_check(odp_bool_t ah, if (ah && (ODP_SUPPORT_NO == capa.proto_ah)) return ODP_TEST_INACTIVE; - if (odph_ipsec_alg_check(capa, cipher, cipher_bits / 8, auth, + if (odph_ipsec_alg_check(&capa, cipher, cipher_bits / 8, auth, auth_bits / 8) < 0) return ODP_TEST_INACTIVE; @@ -395,7 +395,10 @@ void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param, param->dir = dir; if (dir == ODP_IPSEC_DIR_INBOUND) { param->inbound.lookup_mode = ODP_IPSEC_LOOKUP_SPI; - param->inbound.antireplay_ws = capa.max_antireplay_ws; + if (auth_alg == ODP_AUTH_ALG_NULL) + param->inbound.antireplay_ws = 0; + else + param->inbound.antireplay_ws = capa.max_antireplay_ws; } param->proto = proto; @@ -455,6 +458,9 @@ static void ipsec_status_event_handle(odp_event_t ev_status, CU_ASSERT_EQUAL(1, odp_event_is_valid(ev_status)); CU_ASSERT_EQUAL_FATAL(ODP_EVENT_IPSEC_STATUS, odp_event_type(ev_status)); + /* No user area for IPsec status events */ + CU_ASSERT(odp_event_user_area(ev_status) == NULL); + CU_ASSERT_EQUAL(0, odp_ipsec_status(&status, ev_status)); CU_ASSERT_EQUAL(ODP_IPSEC_STATUS_WARN, status.id); CU_ASSERT_EQUAL(sa, status.sa); @@ -1276,7 +1282,7 @@ int ipsec_suite_term(void) if (ODP_QUEUE_INVALID != suite_context.queue) { if (odp_queue_destroy(suite_context.queue)) - fprintf(stderr, "IPsec destq destroy failed.\n"); + ODPH_ERR("IPsec destq destroy failed\n"); } if (odp_cunit_print_inactive()) @@ -1329,7 +1335,7 @@ int ipsec_suite_plain_init(void) dest_queue = plain_queue_create("ipsec-out"); if (ODP_QUEUE_INVALID == dest_queue) { - fprintf(stderr, "IPsec destq creation failed.\n"); + ODPH_ERR("IPsec destq creation failed\n"); return -1; } @@ -1345,7 +1351,7 @@ int ipsec_suite_sched_init(void) dest_queue = sched_queue_create("ipsec-out"); if (ODP_QUEUE_INVALID == dest_queue) { - fprintf(stderr, "IPsec destq creation failed.\n"); + ODPH_ERR("IPsec destq creation failed\n"); return -1; } @@ -1371,7 +1377,7 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode) suite_context.default_queue = ODP_QUEUE_INVALID; if (odph_options(&helper_options)) { - fprintf(stderr, "error: odph_options() failed.\n"); + ODPH_ERR("odph_options() failed\n"); return -1; } @@ -1379,22 +1385,22 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode) init_param.mem_model = helper_options.mem_model; if (0 != odp_init_global(inst, &init_param, NULL)) { - fprintf(stderr, "error: odp_init_global() failed.\n"); + ODPH_ERR("odp_init_global() failed\n"); return -1; } if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) { - fprintf(stderr, "error: odp_init_local() failed.\n"); + ODPH_ERR("odp_init_local() failed\n"); return -1; } if (odp_schedule_config(NULL)) { - fprintf(stderr, "odp_schedule_config() failed.\n"); + ODPH_ERR("odp_schedule_config() failed\n"); return -1; } if (odp_pool_capability(&pool_capa) < 0) { - fprintf(stderr, "error: odp_pool_capability() failed.\n"); + ODPH_ERR("odp_pool_capability() failed\n"); return -1; } @@ -1406,27 +1412,27 @@ int ipsec_init(odp_instance_t *inst, odp_ipsec_op_mode_t mode) if (pool_capa.pkt.max_seg_len && MAX_PKT_LEN > pool_capa.pkt.max_seg_len) { - fprintf(stderr, "Warning: small packet segment length\n"); + ODPH_ERR("Warning: small packet segment length\n"); params.pkt.seg_len = pool_capa.pkt.max_seg_len; } if (pool_capa.pkt.max_len && MAX_PKT_LEN > pool_capa.pkt.max_len) { - fprintf(stderr, "Pool max packet length too small\n"); + ODPH_ERR("Pool max packet length too small\n"); return -1; } pool = odp_pool_create("packet_pool", ¶ms); if (ODP_POOL_INVALID == pool) { - fprintf(stderr, "Packet pool creation failed.\n"); + ODPH_ERR("Packet pool creation failed\n"); return -1; } if (mode == ODP_IPSEC_OP_MODE_INLINE) { pktio = pktio_create(pool); if (ODP_PKTIO_INVALID == pktio) { - fprintf(stderr, "IPsec pktio creation failed.\n"); + ODPH_ERR("IPsec pktio creation failed\n"); return -1; } } @@ -1466,7 +1472,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst) suite_context.default_queue = sched_queue_create("ipsec-default"); if (ODP_QUEUE_INVALID == suite_context.default_queue) { - fprintf(stderr, "IPsec defaultq creation failed.\n"); + ODPH_ERR("IPsec defaultq creation failed\n"); return -1; } } @@ -1561,26 +1567,26 @@ int ipsec_term(odp_instance_t inst) if (ODP_PKTIO_INVALID != pktio) { if (odp_pktio_close(pktio)) - fprintf(stderr, "IPsec pktio close failed.\n"); + ODPH_ERR("IPsec pktio close failed\n"); } if (ODP_QUEUE_INVALID != default_queue) { if (odp_queue_destroy(default_queue)) - fprintf(stderr, "IPsec defaultq destroy failed.\n"); + ODPH_ERR("IPsec defaultq destroy failed\n"); } if (ODP_POOL_INVALID != pool) { if (odp_pool_destroy(pool)) - fprintf(stderr, "Packet pool destroy failed.\n"); + ODPH_ERR("Packet pool destroy failed\n"); } if (0 != odp_term_local()) { - fprintf(stderr, "error: odp_term_local() failed.\n"); + ODPH_ERR("odp_term_local() failed\n"); return -1; } if (0 != odp_term_global(inst)) { - fprintf(stderr, "error: odp_term_global() failed.\n"); + ODPH_ERR("odp_term_global() failed\n"); return -1; } |