X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_ipsec.c;h=79d00d7e02d14961879cdff0c79a5293e9edbe17;hb=e6cf7bee1c77a0f321cea3494a106bfa5de6f53c;hp=7dc83fee7e260026b39936965c8b083e702e66bd;hpb=0f56ca1aaeebfb94d68bad085f7b298f9c2c0b07;p=dpdk.git diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 7dc83fee7e..79d00d7e02 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -237,7 +237,7 @@ fill_crypto_xform(struct ipsec_unitest_params *ut_params, } static int -check_cryptodev_capablity(const struct ipsec_unitest_params *ut, +check_cryptodev_capability(const struct ipsec_unitest_params *ut, uint8_t dev_id) { struct rte_cryptodev_sym_capability_idx cap_idx; @@ -302,7 +302,7 @@ testsuite_setup(void) /* Find first valid crypto device */ for (i = 0; i < nb_devs; i++) { - rc = check_cryptodev_capablity(ut_params, i); + rc = check_cryptodev_capability(ut_params, i); if (rc == 0) { ts_params->valid_dev = i; ts_params->valid_dev_found = 1; @@ -1167,6 +1167,34 @@ test_ipsec_dump_buffers(struct ipsec_unitest_params *ut_params, int i) } } +static void +destroy_dummy_sec_session(struct ipsec_unitest_params *ut, + uint32_t j) +{ + rte_security_session_destroy(&dummy_sec_ctx, + ut->ss[j].security.ses); + ut->ss[j].security.ctx = NULL; +} + +static void +destroy_crypto_session(struct ipsec_unitest_params *ut, + uint8_t crypto_dev, uint32_t j) +{ + rte_cryptodev_sym_session_clear(crypto_dev, ut->ss[j].crypto.ses); + rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses); + memset(&ut->ss[j], 0, sizeof(ut->ss[j])); +} + +static void +destroy_session(struct ipsec_unitest_params *ut, + uint8_t crypto_dev, uint32_t j) +{ + if (ut->ss[j].type == RTE_SECURITY_ACTION_TYPE_NONE) + return destroy_crypto_session(ut, crypto_dev, j); + else + return destroy_dummy_sec_session(ut, j); +} + static void destroy_sa(uint32_t j) { @@ -1175,9 +1203,8 @@ destroy_sa(uint32_t j) rte_ipsec_sa_fini(ut->ss[j].sa); rte_free(ut->ss[j].sa); - rte_cryptodev_sym_session_clear(ts->valid_dev, ut->ss[j].crypto.ses); - rte_cryptodev_sym_session_free(ut->ss[j].crypto.ses); - memset(&ut->ss[j], 0, sizeof(ut->ss[j])); + + destroy_session(ut, ts->valid_dev, j); } static int