cryptodev: remove digest length from crypto op
[dpdk.git] / test / test / test_cryptodev_perf.c
index a959a6c..9dd1fb7 100644 (file)
@@ -43,6 +43,9 @@
 #include "test_cryptodev.h"
 #include "test_cryptodev_gcm_test_vectors.h"
 
+#define AES_CIPHER_IV_LENGTH 16
+#define TRIPLE_DES_CIPHER_IV_LENGTH 8
+#define AES_GCM_AAD_LENGTH 16
 
 #define PERF_NUM_OPS_INFLIGHT          (128)
 #define DEFAULT_NUM_REQS_TO_SUBMIT     (10000000)
@@ -67,11 +70,7 @@ enum chain_mode {
 
 
 struct symmetric_op {
-       const uint8_t *iv_data;
-       uint32_t iv_len;
-
        const uint8_t *aad_data;
-       uint32_t aad_len;
 
        const uint8_t *p_data;
        uint32_t p_len;
@@ -96,6 +95,9 @@ struct symmetric_session_attrs {
        const uint8_t *key_auth_data;
        uint32_t key_auth_len;
 
+       const uint8_t *iv_data;
+       uint16_t iv_len;
+       uint16_t aad_len;
        uint32_t digest_len;
 };
 
@@ -166,20 +168,19 @@ static struct rte_mbuf *
 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz);
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
-               struct rte_cryptodev_sym_session *sess, unsigned data_len,
-               unsigned digest_len);
+               struct rte_cryptodev_sym_session *sess, unsigned int data_len);
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain);
+               enum chain_mode chain);
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain __rte_unused);
+               enum chain_mode chain __rte_unused);
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain __rte_unused);
+               enum chain_mode chain __rte_unused);
 static uint32_t get_auth_digest_length(enum rte_crypto_auth_algorithm algo);
 
 
@@ -1933,7 +1934,8 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
        ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
        ut_params->cipher_xform.cipher.key.data = aes_cbc_128_key;
        ut_params->cipher_xform.cipher.key.length = CIPHER_IV_LENGTH_AES_CBC;
-
+       ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
+       ut_params->cipher_xform.cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
 
        /* Setup HMAC Parameters */
        ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -1976,20 +1978,12 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num)
                op->sym->auth.digest.data = ut_params->digest;
                op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
                                data_params[0].length);
-               op->sym->auth.digest.length = DIGEST_BYTE_LENGTH_SHA256;
 
                op->sym->auth.data.offset = 0;
                op->sym->auth.data.length = data_params[0].length;
 
-
-               op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                               uint8_t *, IV_OFFSET);
-               op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                               IV_OFFSET);
-               op->sym->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC;
-
-               rte_memcpy(op->sym->cipher.iv.data, aes_cbc_128_iv,
-                               CIPHER_IV_LENGTH_AES_CBC);
+               rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                               aes_cbc_128_iv, CIPHER_IV_LENGTH_AES_CBC);
 
                op->sym->cipher.data.offset = 0;
                op->sym->cipher.data.length = data_params[0].length;
@@ -2106,8 +2100,7 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
                                                RTE_CRYPTO_OP_TYPE_SYMMETRIC);
                TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
 
-               op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size,
-                                       get_auth_digest_length(pparams->auth_algo));
+               op = test_perf_set_crypto_op_snow3g(op, m, sess, pparams->buf_size);
                TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
 
                c_ops[i] = op;
@@ -2256,11 +2249,9 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
        static struct rte_crypto_op *(*test_perf_set_crypto_op)
                        (struct rte_crypto_op *, struct rte_mbuf *,
                                        struct rte_cryptodev_sym_session *,
-                                       unsigned int, unsigned int,
+                                       unsigned int,
                                        enum chain_mode);
 
-       unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
        if (rte_cryptodev_count() == 0) {
                printf("\nNo crypto devices found. Is PMD build configured?\n");
                return TEST_FAILED;
@@ -2302,7 +2293,7 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
                }
 
                op = test_perf_set_crypto_op(op, m, sess, pparams->buf_size,
-                               digest_length, pparams->chain);
+                               pparams->chain);
                TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
 
                c_ops[i] = op;
@@ -2411,8 +2402,6 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 
        static struct rte_cryptodev_sym_session *sess;
 
-       unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
        if (rte_cryptodev_count() == 0) {
                printf("\nNo crypto devices found. Is PMD build configured?\n");
                return TEST_FAILED;
@@ -2437,7 +2426,7 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
                TEST_ASSERT_NOT_NULL(op, "Failed to allocate op");
 
                op = test_perf_set_crypto_op_aes(op, m, sess, pparams->buf_size,
-                               digest_length, pparams->chain);
+                               pparams->chain);
                TEST_ASSERT_NOT_NULL(op, "Failed to attach op to session");
 
                c_ops[i] = op;
@@ -2650,6 +2639,8 @@ test_perf_create_aes_sha_session(uint8_t dev_id, enum chain_mode chain,
 
        cipher_xform.cipher.key.data = aes_key;
        cipher_xform.cipher.key.length = cipher_key_len;
+       cipher_xform.cipher.iv.offset = IV_OFFSET;
+       cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
        if (chain != CIPHER_ONLY) {
                /* Setup HMAC Parameters */
                auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2698,16 +2689,21 @@ test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
 
        cipher_xform.cipher.key.data = snow3g_cipher_key;
        cipher_xform.cipher.key.length = cipher_key_len;
+       cipher_xform.cipher.iv.offset = IV_OFFSET;
+       cipher_xform.cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
+
 
        /* Setup HMAC Parameters */
        auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
        auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
        auth_xform.auth.algo = auth_algo;
 
-       auth_xform.auth.add_auth_data_length = SNOW3G_CIPHER_IV_LENGTH;
        auth_xform.auth.key.data = snow3g_hash_key;
        auth_xform.auth.key.length =  get_auth_key_max_length(auth_algo);
        auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
+       /* Auth IV will be after cipher IV */
+       auth_xform.auth.iv.offset = IV_OFFSET + SNOW3G_CIPHER_IV_LENGTH;
+       auth_xform.auth.iv.length = SNOW3G_CIPHER_IV_LENGTH;
 
        switch (chain) {
        case CIPHER_HASH:
@@ -2745,17 +2741,20 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
        /* Setup Cipher Parameters */
        cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
        cipher_xform.cipher.algo = cipher_algo;
+       cipher_xform.cipher.iv.offset = IV_OFFSET;
        cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 
        switch (cipher_algo) {
        case RTE_CRYPTO_CIPHER_3DES_CBC:
        case RTE_CRYPTO_CIPHER_3DES_CTR:
                cipher_xform.cipher.key.data = triple_des_key;
+               cipher_xform.cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
                break;
        case RTE_CRYPTO_CIPHER_AES_CBC:
        case RTE_CRYPTO_CIPHER_AES_CTR:
        case RTE_CRYPTO_CIPHER_AES_GCM:
                cipher_xform.cipher.key.data = aes_key;
+               cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
                break;
        default:
                return NULL;
@@ -2774,6 +2773,7 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
                break;
        case RTE_CRYPTO_AUTH_AES_GCM:
                auth_xform.auth.key.data = NULL;
+               auth_xform.auth.add_auth_data_length = AES_GCM_AAD_LENGTH;
                break;
        default:
                return NULL;
@@ -2820,6 +2820,8 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
        }
 
        cipher_xform.cipher.key.length = cipher_key_len;
+       cipher_xform.cipher.iv.offset = IV_OFFSET;
+       cipher_xform.cipher.iv.length = AES_CIPHER_IV_LENGTH;
 
        /* Setup Auth Parameters */
        auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
@@ -2848,10 +2850,6 @@ test_perf_create_armv8_session(uint8_t dev_id, enum chain_mode chain,
        }
 }
 
-#define AES_CIPHER_IV_LENGTH 16
-#define AES_GCM_AAD_LENGTH 16
-#define TRIPLE_DES_CIPHER_IV_LENGTH 8
-
 static struct rte_mbuf *
 test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
 {
@@ -2870,7 +2868,7 @@ test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain)
+               enum chain_mode chain)
 {
        if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
                rte_crypto_op_free(op);
@@ -2881,9 +2879,7 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
        if (chain == CIPHER_ONLY) {
                op->sym->auth.digest.data = NULL;
                op->sym->auth.digest.phys_addr = 0;
-               op->sym->auth.digest.length = 0;
                op->sym->auth.aad.data = NULL;
-               op->sym->auth.aad.length = 0;
                op->sym->auth.data.offset = 0;
                op->sym->auth.data.length = 0;
        } else {
@@ -2891,21 +2887,16 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
                                 uint8_t *, data_len);
                op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
                                data_len);
-               op->sym->auth.digest.length = digest_len;
                op->sym->auth.data.offset = 0;
                op->sym->auth.data.length = data_len;
        }
 
 
-       /* Cipher Parameters */
-       op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
-
-       rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
+       /* Copy the IV at the end of the crypto operation */
+       rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                       aes_iv, AES_CIPHER_IV_LENGTH);
 
+       /* Cipher Parameters */
        op->sym->cipher.data.offset = 0;
        op->sym->cipher.data.length = data_len;
 
@@ -2917,7 +2908,7 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain __rte_unused)
+               enum chain_mode chain __rte_unused)
 {
        if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
                rte_crypto_op_free(op);
@@ -2929,17 +2920,11 @@ test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
                                        (m->data_off + data_len);
        op->sym->auth.digest.phys_addr =
                                rte_pktmbuf_mtophys_offset(m, data_len);
-       op->sym->auth.digest.length = digest_len;
        op->sym->auth.aad.data = aes_gcm_aad;
-       op->sym->auth.aad.length = AES_GCM_AAD_LENGTH;
 
-       /* Cipher Parameters */
-       op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
-       rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
+       /* Copy IV at the end of the crypto operation */
+       rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                       aes_iv, AES_CIPHER_IV_LENGTH);
 
        /* Data lengths/offsets Parameters */
        op->sym->auth.data.offset = 0;
@@ -2955,8 +2940,7 @@ test_perf_set_crypto_op_aes_gcm(struct rte_crypto_op *op, struct rte_mbuf *m,
 
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
-               struct rte_cryptodev_sym_session *sess, unsigned data_len,
-               unsigned digest_len)
+               struct rte_cryptodev_sym_session *sess, unsigned int data_len)
 {
        uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
                        uint8_t *, IV_OFFSET);
@@ -2973,17 +2957,6 @@ test_perf_set_crypto_op_snow3g(struct rte_crypto_op *op, struct rte_mbuf *m,
                                                (m->data_off + data_len);
        op->sym->auth.digest.phys_addr =
                                rte_pktmbuf_mtophys_offset(m, data_len);
-       op->sym->auth.digest.length = digest_len;
-       op->sym->auth.aad.data = iv_ptr;
-       op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
-
-       /* Cipher Parameters */
-       op->sym->cipher.iv.data = iv_ptr;
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
 
        /* Data lengths/offsets Parameters */
        op->sym->auth.data.offset = 0;
@@ -3008,17 +2981,18 @@ test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op,
                return NULL;
        }
 
-       /* Cipher Parameters */
-       op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
-       rte_memcpy(op->sym->cipher.iv.data, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+       /* Copy IV at the end of the crypto operation */
+       rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                       snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
 
+       /* Cipher Parameters */
        op->sym->cipher.data.offset = 0;
        op->sym->cipher.data.length = data_len << 3;
 
+       rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                       snow3g_iv,
+                       SNOW3G_CIPHER_IV_LENGTH);
+
        op->sym->m_src = m;
 
        return op;
@@ -3029,14 +3003,18 @@ static inline struct rte_crypto_op *
 test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
                struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess,
-               unsigned data_len,
-               unsigned digest_len)
+               unsigned int data_len)
 {
+       uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+                       uint8_t *, IV_OFFSET);
+
        if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
                rte_crypto_op_free(op);
                return NULL;
        }
 
+       rte_memcpy(iv_ptr, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+
        /* Authentication Parameters */
 
        op->sym->auth.digest.data =
@@ -3045,14 +3023,6 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
        op->sym->auth.digest.phys_addr =
                                rte_pktmbuf_mtophys_offset(m, data_len +
                                        SNOW3G_CIPHER_IV_LENGTH);
-       op->sym->auth.digest.length = digest_len;
-       op->sym->auth.aad.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->auth.aad.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
-       rte_memcpy(op->sym->auth.aad.data, snow3g_iv,
-                       SNOW3G_CIPHER_IV_LENGTH);
 
        /* Data lengths/offsets Parameters */
        op->sym->auth.data.offset = 0;
@@ -3067,7 +3037,7 @@ test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
 static inline struct rte_crypto_op *
 test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct rte_cryptodev_sym_session *sess, unsigned int data_len,
-               unsigned int digest_len, enum chain_mode chain __rte_unused)
+               enum chain_mode chain __rte_unused)
 {
        if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
                rte_crypto_op_free(op);
@@ -3079,16 +3049,10 @@ test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
                                        (m->data_off + data_len);
        op->sym->auth.digest.phys_addr =
                                rte_pktmbuf_mtophys_offset(m, data_len);
-       op->sym->auth.digest.length = digest_len;
 
-       /* Cipher Parameters */
-       op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       op->sym->cipher.iv.length = TRIPLE_DES_CIPHER_IV_LENGTH;
-       rte_memcpy(op->sym->cipher.iv.data, triple_des_iv,
-                       TRIPLE_DES_CIPHER_IV_LENGTH);
+       /* Copy IV at the end of the crypto operation */
+       rte_memcpy(rte_crypto_op_ctod_offset(op, uint8_t *, IV_OFFSET),
+                       triple_des_iv, TRIPLE_DES_CIPHER_IV_LENGTH);
 
        /* Data lengths/offsets Parameters */
        op->sym->auth.data.offset = 0;
@@ -3177,7 +3141,7 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
                                ops[i] = test_perf_set_crypto_op_aes(ops[i],
                                        mbufs[i + (pparams->burst_size *
                                                (j % NUM_MBUF_SETS))],
-                                       sess, pparams->buf_size, digest_length,
+                                       sess, pparams->buf_size,
                                        pparams->chain);
 
                        /* enqueue burst */
@@ -3319,7 +3283,7 @@ test_perf_snow3g(uint8_t dev_id, uint16_t queue_id,
                                        mbufs[i +
                                          (pparams->burst_size * (j % NUM_MBUF_SETS))],
                                        sess,
-                                       pparams->buf_size, digest_length);
+                                       pparams->buf_size);
                                else if (pparams->chain == CIPHER_ONLY)
                                        ops[i+op_offset] =
                                        test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset],
@@ -3415,8 +3379,6 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
        uint64_t processed = 0, failed_polls = 0, retries = 0;
        uint64_t tsc_start = 0, tsc_end = 0;
 
-       unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
        struct rte_crypto_op *ops[pparams->burst_size];
        struct rte_crypto_op *proc_ops[pparams->burst_size];
 
@@ -3429,7 +3391,7 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
        static struct rte_crypto_op *(*test_perf_set_crypto_op)
                        (struct rte_crypto_op *, struct rte_mbuf *,
                                        struct rte_cryptodev_sym_session *,
-                                       unsigned int, unsigned int,
+                                       unsigned int,
                                        enum chain_mode);
 
        switch (pparams->cipher_algo) {
@@ -3491,7 +3453,7 @@ test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
                                ops[i] = test_perf_set_crypto_op(ops[i],
                                        mbufs[i + (pparams->burst_size *
                                                (j % NUM_MBUF_SETS))],
-                                       sess, pparams->buf_size, digest_length,
+                                       sess, pparams->buf_size,
                                        pparams->chain);
 
                        /* enqueue burst */
@@ -3569,8 +3531,6 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
        uint64_t processed = 0, failed_polls = 0, retries = 0;
        uint64_t tsc_start = 0, tsc_end = 0;
 
-       unsigned int digest_length = get_auth_digest_length(pparams->auth_algo);
-
        struct rte_crypto_op *ops[pparams->burst_size];
        struct rte_crypto_op *proc_ops[pparams->burst_size];
 
@@ -3625,7 +3585,7 @@ test_perf_armv8(uint8_t dev_id, uint16_t queue_id,
                                ops[i] = test_perf_set_crypto_op_aes(ops[i],
                                        mbufs[i + (pparams->burst_size *
                                                (j % NUM_MBUF_SETS))], sess,
-                                       pparams->buf_size, digest_length,
+                                       pparams->buf_size,
                                        pparams->chain);
 
                        /* enqueue burst */
@@ -4152,6 +4112,8 @@ test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
        cipher_xform.cipher.op = pparams->session_attrs->cipher;
        cipher_xform.cipher.key.data = cipher_key;
        cipher_xform.cipher.key.length = pparams->session_attrs->key_cipher_len;
+       cipher_xform.cipher.iv.length = pparams->session_attrs->iv_len;
+       cipher_xform.cipher.iv.offset = IV_OFFSET;
 
        auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
        auth_xform.next = NULL;
@@ -4159,6 +4121,7 @@ test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams)
        auth_xform.auth.op = pparams->session_attrs->auth;
        auth_xform.auth.algo = pparams->session_attrs->auth_algorithm;
 
+       auth_xform.auth.add_auth_data_length = pparams->session_attrs->aad_len;
        auth_xform.auth.digest_length = pparams->session_attrs->digest_len;
        auth_xform.auth.key.length = pparams->session_attrs->key_auth_len;
 
@@ -4183,6 +4146,9 @@ perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
                struct crypto_params *m_hlp,
                struct perf_test_params *params)
 {
+       uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op,
+                       uint8_t *, IV_OFFSET);
+
        if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
                rte_crypto_op_free(op);
                return NULL;
@@ -4191,35 +4157,27 @@ perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
        op->sym->auth.digest.data = m_hlp->digest;
        op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
                                          m,
-                                         params->symmetric_op->aad_len +
+                                         params->session_attrs->aad_len +
                                          params->symmetric_op->p_len);
 
-       op->sym->auth.digest.length = params->symmetric_op->t_len;
 
        op->sym->auth.aad.data = m_hlp->aad;
-       op->sym->auth.aad.length = params->symmetric_op->aad_len;
        op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys(m);
 
        rte_memcpy(op->sym->auth.aad.data, params->symmetric_op->aad_data,
-                      params->symmetric_op->aad_len);
-
-       op->sym->cipher.iv.data = rte_crypto_op_ctod_offset(op,
-                       uint8_t *, IV_OFFSET);
-       op->sym->cipher.iv.phys_addr = rte_crypto_op_ctophys_offset(op,
-                       IV_OFFSET);
-       rte_memcpy(op->sym->cipher.iv.data, params->symmetric_op->iv_data,
-                      params->symmetric_op->iv_len);
-       if (params->symmetric_op->iv_len == 12)
-               op->sym->cipher.iv.data[15] = 1;
+                      params->session_attrs->aad_len);
 
-       op->sym->cipher.iv.length = params->symmetric_op->iv_len;
+       rte_memcpy(iv_ptr, params->session_attrs->iv_data,
+                      params->session_attrs->iv_len);
+       if (params->session_attrs->iv_len == 12)
+               iv_ptr[15] = 1;
 
        op->sym->auth.data.offset =
-                       params->symmetric_op->aad_len;
+                       params->session_attrs->aad_len;
        op->sym->auth.data.length = params->symmetric_op->p_len;
 
        op->sym->cipher.data.offset =
-                       params->symmetric_op->aad_len;
+                       params->session_attrs->aad_len;
        op->sym->cipher.data.length = params->symmetric_op->p_len;
 
        op->sym->m_src = m;
@@ -4233,7 +4191,7 @@ test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
                unsigned buf_sz, struct crypto_params *m_hlp)
 {
        struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
-       uint16_t aad_len = params->symmetric_op->aad_len;
+       uint16_t aad_len = params->session_attrs->aad_len;
        uint16_t digest_size = params->symmetric_op->t_len;
        char *p;
 
@@ -4369,14 +4327,14 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
                                TEST_ASSERT_BUFFERS_ARE_EQUAL(
                                        pparams->symmetric_op->c_data,
                                        pkt +
-                                       pparams->symmetric_op->aad_len,
+                                       pparams->session_attrs->aad_len,
                                        pparams->symmetric_op->c_len,
                                        "GCM Ciphertext data not as expected");
 
                                TEST_ASSERT_BUFFERS_ARE_EQUAL(
                                        pparams->symmetric_op->t_data,
                                        pkt +
-                                       pparams->symmetric_op->aad_len +
+                                       pparams->session_attrs->aad_len +
                                        pparams->symmetric_op->c_len,
                                        pparams->symmetric_op->t_len,
                                        "GCM MAC data not as expected");
@@ -4448,13 +4406,13 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
                        RTE_CRYPTO_AUTH_OP_GENERATE;
                session_attrs[i].key_auth_data = NULL;
                session_attrs[i].key_auth_len = 0;
+               session_attrs[i].aad_len = gcm_test->aad.len;
                session_attrs[i].digest_len =
                                gcm_test->auth_tag.len;
+               session_attrs[i].iv_len = gcm_test->iv.len;
+               session_attrs[i].iv_data = gcm_test->iv.data;
 
                ops_set[i].aad_data = gcm_test->aad.data;
-               ops_set[i].aad_len = gcm_test->aad.len;
-               ops_set[i].iv_data = gcm_test->iv.data;
-               ops_set[i].iv_len = gcm_test->iv.len;
                ops_set[i].p_data = gcm_test->plaintext.data;
                ops_set[i].p_len = buf_lengths[i];
                ops_set[i].c_data = gcm_test->ciphertext.data;