mbuf: rename data address helpers to IOVA
[dpdk.git] / app / test-crypto-perf / cperf_ops.c
index f76dbdd..23d30ca 100644 (file)
@@ -221,7 +221,7 @@ cperf_set_ops_auth(struct rte_crypto_op **ops,
                        sym_op->auth.digest.data = rte_pktmbuf_mtod_offset(buf,
                                        uint8_t *, offset);
                        sym_op->auth.digest.phys_addr =
-                                       rte_pktmbuf_mtophys_offset(buf, offset);
+                                       rte_pktmbuf_iova_offset(buf, offset);
 
                }
 
@@ -318,7 +318,7 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,
                        sym_op->auth.digest.data = rte_pktmbuf_mtod_offset(buf,
                                        uint8_t *, offset);
                        sym_op->auth.digest.phys_addr =
-                                       rte_pktmbuf_mtophys_offset(buf, offset);
+                                       rte_pktmbuf_iova_offset(buf, offset);
                }
 
                if (options->auth_algo == RTE_CRYPTO_AUTH_SNOW3G_UIA2 ||
@@ -363,6 +363,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
                uint16_t iv_offset)
 {
        uint16_t i;
+       /* AAD is placed after the IV */
        uint16_t aad_offset = iv_offset +
                        RTE_ALIGN_CEIL(test_vector->aead_iv.length, 16);
 
@@ -424,7 +425,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
                        sym_op->aead.digest.data = rte_pktmbuf_mtod_offset(buf,
                                        uint8_t *, offset);
                        sym_op->aead.digest.phys_addr =
-                                       rte_pktmbuf_mtophys_offset(buf, offset);
+                                       rte_pktmbuf_iova_offset(buf, offset);
                }
        }
 
@@ -433,13 +434,26 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
                        uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i],
                                        uint8_t *, iv_offset);
 
-                       memcpy(iv_ptr, test_vector->aead_iv.data,
+                       /*
+                        * If doing AES-CCM, nonce is copied one byte
+                        * after the start of IV field, and AAD is copied
+                        * 18 bytes after the start of the AAD field.
+                        */
+                       if (options->aead_algo == RTE_CRYPTO_AEAD_AES_CCM) {
+                               memcpy(iv_ptr + 1, test_vector->aead_iv.data,
                                        test_vector->aead_iv.length);
 
-                       /* Copy AAD after the IV */
-                       memcpy(ops[i]->sym->aead.aad.data,
-                               test_vector->aad.data,
-                               test_vector->aad.length);
+                               memcpy(ops[i]->sym->aead.aad.data + 18,
+                                       test_vector->aad.data,
+                                       test_vector->aad.length);
+                       } else {
+                               memcpy(iv_ptr, test_vector->aead_iv.data,
+                                       test_vector->aead_iv.length);
+
+                               memcpy(ops[i]->sym->aead.aad.data,
+                                       test_vector->aad.data,
+                                       test_vector->aad.length);
+                       }
                }
        }