test/crypto: fix dpaa2 sec macros and definitions
[dpdk.git] / test / test / test_cryptodev_perf.c
index 9caba87..5df2e6e 100644 (file)
@@ -108,6 +108,8 @@ struct symmetric_session_attrs {
        uint32_t digest_len;
 };
 
+static struct rte_cryptodev_sym_session *test_crypto_session;
+
 #define ALIGN_POW2_ROUNDUP(num, align) \
        (((num) + (align) - 1) & ~((align) - 1))
 
@@ -156,18 +158,18 @@ struct crypto_unittest_params {
        uint8_t *digest;
 };
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned int cipher_key_len,
                enum rte_crypto_auth_algorithm auth_algo);
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned int cipher_key_len,
                enum rte_crypto_auth_algorithm auth_algo,
                enum rte_crypto_aead_algorithm aead_algo);
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned int cipher_key_len,
@@ -209,7 +211,7 @@ static const char *pmd_name(uint8_t driver_id)
 {
        uint8_t null_pmd = rte_cryptodev_driver_id_get(
                        RTE_STR(CRYPTODEV_NAME_NULL_PMD));
-       uint8_t dpaa2_pmd = rte_cryptodev_driver_id_get(
+       uint8_t dpaa2_sec_pmd = rte_cryptodev_driver_id_get(
                        RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
        uint8_t snow3g_pmd = rte_cryptodev_driver_id_get(
                        RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD));
@@ -230,7 +232,7 @@ static const char *pmd_name(uint8_t driver_id)
                return RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
        else if (driver_id == snow3g_pmd)
                return RTE_STR(CRYPTODEV_NAME_SNOW3G_PMD);
-       else if (driver_id == dpaa2_pmd)
+       else if (driver_id == dpaa2_sec_pmd)
                return RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD);
        else
                return "";
@@ -421,7 +423,7 @@ testsuite_setup(void)
                        "session mempool allocation failed");
 
        TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->dev_id,
-                       &ts_params->conf, ts_params->sess_mp),
+                       &ts_params->conf),
                        "Failed to configure cryptodev %u",
                        ts_params->dev_id);
 
@@ -431,7 +433,8 @@ testsuite_setup(void)
                TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
                        ts_params->dev_id, qp_id,
                                &ts_params->qp_conf,
-                               rte_cryptodev_socket_id(ts_params->dev_id)),
+                               rte_cryptodev_socket_id(ts_params->dev_id),
+                               ts_params->sess_mp),
                                "Failed to setup queue pair %u on cryptodev %u",
                                qp_id, ts_params->dev_id);
        }
@@ -487,9 +490,11 @@ ut_teardown(void)
        unsigned i;
 
        /* free crypto session structure */
-       if (ut_params->sess)
-               rte_cryptodev_sym_session_free(ts_params->dev_id,
+       if (ut_params->sess) {
+               rte_cryptodev_sym_session_clear(ts_params->dev_id,
                                ut_params->sess);
+               rte_cryptodev_sym_session_free(ut_params->sess);
+       }
 
        /* free crypto operation structure */
        if (ut_params->op)
@@ -1969,10 +1974,13 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
        ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA256;
 
        /* Create Crypto session*/
-       ut_params->sess = rte_cryptodev_sym_session_create(ts_params->dev_id,
-               &ut_params->cipher_xform);
 
-       TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
+       rte_cryptodev_sym_session_init(ts_params->dev_id, test_crypto_session,
+                       &ut_params->cipher_xform, ts_params->sess_mp);
+
+       TEST_ASSERT_NOT_NULL(test_crypto_session, "Session creation failed");
 
        /* Generate Crypto op data structure(s) */
        for (i = 0; i < num_to_submit ; i++) {
@@ -1994,7 +2002,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
                                rte_crypto_op_alloc(ts_params->op_mpool,
                                                RTE_CRYPTO_OP_TYPE_SYMMETRIC);
 
-               rte_crypto_op_attach_sym_session(op, ut_params->sess);
+               rte_crypto_op_attach_sym_session(op, test_crypto_session);
 
                op->sym->auth.digest.data = ut_params->digest;
                op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
@@ -2105,9 +2113,12 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_snow3g_session(ts_params->dev_id,
+       if (test_perf_create_snow3g_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
-                       pparams->key_length, pparams->auth_algo);
+                       pparams->key_length, pparams->auth_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate Crypto op data structure(s)*/
@@ -2211,7 +2222,10 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
                rte_pktmbuf_free(c_ops[i]->sym->m_src);
                rte_crypto_op_free(c_ops[i]);
        }
-       rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id,
+                               sess);
+       rte_cryptodev_sym_session_free(sess);
 
        return TEST_SUCCESS;
 }
@@ -2290,10 +2304,13 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_openssl_session(ts_params->dev_id,
+       if (test_perf_create_openssl_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
                        pparams->key_length, pparams->auth_algo,
-                       pparams->aead_algo);
+                       pparams->aead_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate Crypto op data structure(s)*/
@@ -2425,7 +2442,9 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
                rte_pktmbuf_free(c_ops[i]->sym->m_src);
                rte_crypto_op_free(c_ops[i]);
        }
-       rte_cryptodev_sym_session_free(ts_params->dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+       rte_cryptodev_sym_session_free(sess);
 
        return TEST_SUCCESS;
 }
@@ -2452,10 +2471,12 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_armv8_session(ts_params->dev_id,
+       if (test_perf_create_armv8_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
-                       pparams->key_length, pparams->auth_algo);
-       TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
+                       pparams->key_length, pparams->auth_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
 
        /* Generate Crypto op data structure(s)*/
        for (i = 0; i < num_to_submit ; i++) {
@@ -2672,12 +2693,13 @@ static uint8_t snow3g_hash_key[] = {
                0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
 };
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned cipher_key_len,
                enum rte_crypto_auth_algorithm auth_algo)
 {
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_crypto_sym_xform cipher_xform = { 0 };
        struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -2701,33 +2723,42 @@ test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
                auth_xform.auth.digest_length =
                                        get_auth_digest_length(auth_algo);
        }
+
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
        switch (chain) {
        case CIPHER_HASH:
                cipher_xform.next = &auth_xform;
                auth_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        case HASH_CIPHER:
                auth_xform.next = &cipher_xform;
                cipher_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &auth_xform,
+                               ts_params->sess_mp);
        case CIPHER_ONLY:
                cipher_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        default:
-               return NULL;
+               return -1;
        }
 }
 
 #define SNOW3G_CIPHER_IV_LENGTH 16
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
                enum rte_crypto_auth_algorithm auth_algo)
 {
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_crypto_sym_xform cipher_xform = {0};
        struct rte_crypto_sym_xform auth_xform = {0};
 
@@ -2755,37 +2786,47 @@ test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
        auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH;
        auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH;
 
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
        switch (chain) {
        case CIPHER_HASH:
                cipher_xform.next = &auth_xform;
                auth_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        case HASH_CIPHER:
                auth_xform.next = &cipher_xform;
                cipher_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &auth_xform,
+                               ts_params->sess_mp);
        case CIPHER_ONLY:
                cipher_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        case HASH_ONLY:
                auth_xform.next = NULL;
                /* Create Crypto session */
-               return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &auth_xform,
+                               ts_params->sess_mp);
        default:
-               return NULL;
+               return -1;
        }
 }
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned int key_len,
                enum rte_crypto_auth_algorithm auth_algo,
                enum rte_crypto_aead_algorithm aead_algo)
 {
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_crypto_sym_xform cipher_xform = { 0 };
        struct rte_crypto_sym_xform auth_xform = { 0 };
        struct rte_crypto_sym_xform aead_xform = { 0 };
@@ -2809,7 +2850,7 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                        cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
                        break;
                default:
-                       return NULL;
+                       return -1;
                }
 
                cipher_xform.cipher.key.length = key_len;
@@ -2824,7 +2865,7 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                        auth_xform.auth.key.data = hmac_sha_key;
                        break;
                default:
-                       return NULL;
+                       return -1;
                }
 
                auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
@@ -2840,41 +2881,49 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                case RTE_CRYPTO_AEAD_AES_GCM:
                        aead_xform.aead.key.data = aes_key;
                        aead_xform.aead.iv.length = AES_CIPHER_IV_LENGTH;
-                       aead_xform.aead.add_auth_data_length = AES_GCM_AAD_LENGTH;
+                       aead_xform.aead.aad_length = AES_GCM_AAD_LENGTH;
                        aead_xform.aead.digest_length = get_aead_digest_length(aead_algo);
                        break;
                default:
-                       return NULL;
+                       return -1;
                }
 
                aead_xform.aead.key.length = key_len;
        }
 
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
        switch (chain) {
        case CIPHER_HASH:
                cipher_xform.next = &auth_xform;
                auth_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        case HASH_CIPHER:
                auth_xform.next = &cipher_xform;
                cipher_xform.next = NULL;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &auth_xform,
+                               ts_params->sess_mp);
        case AEAD:
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &aead_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &aead_xform,
+                               ts_params->sess_mp);
        default:
-               return NULL;
+               return -1;
        }
 }
 
-static struct rte_cryptodev_sym_session *
+static int
 test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
                enum rte_crypto_cipher_algorithm cipher_algo,
                unsigned int cipher_key_len,
                enum rte_crypto_auth_algorithm auth_algo)
 {
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_crypto_sym_xform cipher_xform = { 0 };
        struct rte_crypto_sym_xform auth_xform = { 0 };
 
@@ -2887,7 +2936,7 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
                cipher_xform.cipher.key.data = aes_cbc_128_key;
                break;
        default:
-               return NULL;
+               return -1;
        }
 
        cipher_xform.cipher.key.length = cipher_key_len;
@@ -2901,6 +2950,8 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
 
        auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
 
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
        switch (chain) {
        case CIPHER_HASH:
                cipher_xform.next = &auth_xform;
@@ -2908,16 +2959,20 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
                /* Encrypt and hash the result */
                cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &cipher_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &cipher_xform,
+                               ts_params->sess_mp);
        case HASH_CIPHER:
                auth_xform.next = &cipher_xform;
                cipher_xform.next = NULL;
                /* Hash encrypted message and decrypt */
                cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
                /* Create Crypto session*/
-               return rte_cryptodev_sym_session_create(dev_id, &auth_xform);
+               return rte_cryptodev_sym_session_init(dev_id,
+                               test_crypto_session, &auth_xform,
+                               ts_params->sess_mp);
        default:
-               return NULL;
+               return -1;
        }
 }
 
@@ -3167,9 +3222,12 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_aes_sha_session(ts_params->dev_id,
+       if (test_perf_create_aes_sha_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
-                       pparams->key_length, pparams->auth_algo);
+                       pparams->key_length, pparams->auth_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate a burst of crypto operations */
@@ -3264,7 +3322,9 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
 
        for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
                rte_pktmbuf_free(mbufs[i]);
-       rte_cryptodev_sym_session_free(dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+       rte_cryptodev_sym_session_free(sess);
 
        printf("\n");
        return TEST_SUCCESS;
@@ -3300,9 +3360,12 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_snow3g_session(ts_params->dev_id,
+       if (test_perf_create_snow3g_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
-                       pparams->key_length, pparams->auth_algo);
+                       pparams->key_length, pparams->auth_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate a burst of crypto operations */
@@ -3429,7 +3492,9 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
 
        for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
                rte_pktmbuf_free(mbufs[i]);
-       rte_cryptodev_sym_session_free(dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+       rte_cryptodev_sym_session_free(sess);
 
        printf("\n");
        return TEST_SUCCESS;
@@ -3486,10 +3551,13 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_openssl_session(ts_params->dev_id,
+       if (test_perf_create_openssl_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
                        pparams->key_length, pparams->auth_algo,
-                       pparams->aead_algo);
+                       pparams->aead_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate a burst of crypto operations */
@@ -3582,7 +3650,9 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
 
        for (i = 0; i < pparams->burst_size * NUM_MBUF_SETS; i++)
                rte_pktmbuf_free(mbufs[i]);
-       rte_cryptodev_sym_session_free(dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+       rte_cryptodev_sym_session_free(sess);
 
        printf("\n");
        return TEST_SUCCESS;
@@ -3617,9 +3687,12 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
        }
 
        /* Create Crypto session*/
-       sess = test_perf_create_armv8_session(ts_params->dev_id,
+       if (test_perf_create_armv8_session(ts_params->dev_id,
                        pparams->chain, pparams->cipher_algo,
-                       pparams->key_length, pparams->auth_algo);
+                       pparams->key_length, pparams->auth_algo) == 0)
+               sess = test_crypto_session;
+       else
+               sess = NULL;
        TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
 
        /* Generate a burst of crypto operations */
@@ -4177,7 +4250,7 @@ test_perf_aes_cbc_vary_burst_size(void)
 static struct rte_cryptodev_sym_session *
 test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
 {
-       static struct rte_cryptodev_sym_session *sess;
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
        struct rte_crypto_sym_xform aead_xform = { 0 };
 
        uint8_t aead_key[pparams->session_attrs->key_aead_len];
@@ -4194,12 +4267,15 @@ test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
        aead_xform.aead.key.length = pparams->session_attrs->key_aead_len;
        aead_xform.aead.iv.length = pparams->session_attrs->iv_len;
        aead_xform.aead.iv.offset = IV_OFFSET;
-       aead_xform.aead.add_auth_data_length = pparams->session_attrs->aad_len;
+       aead_xform.aead.aad_length = pparams->session_attrs->aad_len;
        aead_xform.aead.digest_length = pparams->session_attrs->digest_len;
 
-       sess = rte_cryptodev_sym_session_create(dev_id, &aead_xform);
+       test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp);
+
+       rte_cryptodev_sym_session_init(dev_id, test_crypto_session,
+                               &aead_xform, ts_params->sess_mp);
 
-       return sess;
+       return test_crypto_session;
 }
 
 static inline struct rte_crypto_op *
@@ -4418,7 +4494,9 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
 
        for (i = 0; i < burst; i++)
                rte_pktmbuf_free(mbufs[i]);
-       rte_cryptodev_sym_session_free(dev_id, sess);
+
+       rte_cryptodev_sym_session_clear(ts_params->dev_id, sess);
+       rte_cryptodev_sym_session_free(sess);
 
        return 0;
 }