static struct rte_security_session_conf conf;
ut->ss[j].security.ses = rte_security_session_create(&dummy_sec_ctx,
- &conf, qp->mp_session_private);
+ &conf, qp->mp_session,
+ qp->mp_session_private);
if (ut->ss[j].security.ses == NULL)
return -ENOMEM;
ut->ss[j].type = action_type;
rc = create_session(ut, &ts->qp_conf, ts->valid_dev, j);
if (rc != 0)
- return TEST_FAILED;
+ return rc;
rc = rte_ipsec_sa_init(ut->ss[j].sa, &ut->sa_prm, sz);
rc = (rc > 0 && (uint32_t)rc <= sz) ? 0 : -EINVAL;
}
}
+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)
{
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
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate input mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate inbound mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate inbound mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate inbound mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* Generate inbound mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa 0 failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* create second rte_ipsec_sa */
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa 1 failed, cfg %d\n", i);
destroy_sa(0);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */
test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa 0 failed, cfg %d\n", i);
- return TEST_FAILED;
+ return rc;
}
/* create second rte_ipsec_sa */
if (rc != 0) {
RTE_LOG(ERR, USER1, "create_sa 1 failed, cfg %d\n", i);
destroy_sa(0);
- return TEST_FAILED;
+ return rc;
}
/* Generate test mbuf data */