mempool: rename address mapping function to IOVA
[dpdk.git] / app / test-crypto-perf / cperf_test_common.c
index 7ba2087..08b313f 100644 (file)
@@ -50,7 +50,7 @@ fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
        /* start of buffer is after mbuf structure and priv data */
        m->priv_size = 0;
        m->buf_addr = (char *)m + mbuf_hdr_size;
-       m->buf_physaddr = rte_mempool_virt2phy(mp, obj) +
+       m->buf_physaddr = rte_mempool_virt2iova(obj) +
                mbuf_offset + mbuf_hdr_size;
        m->buf_len = segment_sz;
        m->data_len = segment_sz;
@@ -74,7 +74,7 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
        uint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);
        uint16_t remaining_segments = segments_nb;
        struct rte_mbuf *next_mbuf;
-       phys_addr_t next_seg_phys_addr = rte_mempool_virt2phy(mp, obj) +
+       phys_addr_t next_seg_phys_addr = rte_mempool_virt2iova(obj) +
                         mbuf_offset + mbuf_hdr_size;
 
        do {
@@ -156,11 +156,27 @@ cperf_alloc_common_memory(const struct cperf_options *options,
        /* Calculate the object size */
        uint16_t crypto_op_size = sizeof(struct rte_crypto_op) +
                sizeof(struct rte_crypto_sym_op);
-       uint16_t crypto_op_private_size = extra_op_priv_size +
-                               test_vector->cipher_iv.length +
-                               test_vector->auth_iv.length +
-                               test_vector->aead_iv.length +
-                               options->aead_aad_sz;
+       uint16_t crypto_op_private_size;
+       /*
+        * If doing AES-CCM, IV field needs to be 16 bytes long,
+        * and AAD field needs to be long enough to have 18 bytes,
+        * plus the length of the AAD, and all rounded to a
+        * multiple of 16 bytes.
+        */
+       if (options->aead_algo == RTE_CRYPTO_AEAD_AES_CCM) {
+               crypto_op_private_size = extra_op_priv_size +
+                       test_vector->cipher_iv.length +
+                       test_vector->auth_iv.length +
+                       RTE_ALIGN_CEIL(test_vector->aead_iv.length, 16) +
+                       RTE_ALIGN_CEIL(options->aead_aad_sz + 18, 16);
+       } else {
+               crypto_op_private_size = extra_op_priv_size +
+                       test_vector->cipher_iv.length +
+                       test_vector->auth_iv.length +
+                       test_vector->aead_iv.length +
+                       options->aead_aad_sz;
+       }
+
        uint16_t crypto_op_total_size = crypto_op_size +
                                crypto_op_private_size;
        uint16_t crypto_op_total_size_padded =