cryptodev: reorganize asymmetric structs
[dpdk.git] / app / test / test_cryptodev.c
index ec4a61b..a63c199 100644 (file)
@@ -3,6 +3,8 @@
  * Copyright 2020 NXP
  */
 
+#ifndef RTE_EXEC_ENV_WINDOWS
+
 #include <time.h>
 
 #include <rte_common.h>
@@ -209,6 +211,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
        int enqueue_status, dequeue_status;
        struct crypto_unittest_params *ut_params = &unittest_params;
        int is_sgl = sop->m_src->nb_segs > 1;
+       int is_oop = 0;
 
        ctx_service_size = rte_cryptodev_get_raw_dp_ctx_size(dev_id);
        if (ctx_service_size < 0) {
@@ -247,6 +250,9 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 
        ofs.raw = 0;
 
+       if ((sop->m_dst != NULL) && (sop->m_dst != sop->m_src))
+               is_oop = 1;
+
        if (is_cipher && is_auth) {
                cipher_offset = sop->cipher.data.offset;
                cipher_len = sop->cipher.data.length;
@@ -277,6 +283,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
                if (is_sgl) {
                        uint32_t remaining_off = auth_offset + auth_len;
                        struct rte_mbuf *sgl_buf = sop->m_src;
+                       if (is_oop)
+                               sgl_buf = sop->m_dst;
 
                        while (remaining_off >= rte_pktmbuf_data_len(sgl_buf)
                                        && sgl_buf->next != NULL) {
@@ -293,7 +301,8 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
                /* Then check if digest-encrypted conditions are met */
                if ((auth_offset + auth_len < cipher_offset + cipher_len) &&
                                (digest.iova == auth_end_iova) && is_sgl)
-                       max_len = RTE_MAX(max_len, auth_offset + auth_len +
+                       max_len = RTE_MAX(max_len,
+                               auth_offset + auth_len +
                                ut_params->auth_xform.auth.digest_length);
 
        } else if (is_cipher) {
@@ -356,7 +365,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
 
        sgl.num = n;
        /* Out of place */
-       if (sop->m_dst != NULL) {
+       if (is_oop) {
                dest_sgl.vec = dest_data_vec;
                vec.dest_sgl = &dest_sgl;
                n = rte_crypto_mbuf_to_vec(sop->m_dst, 0, max_len,
@@ -16093,3 +16102,5 @@ REGISTER_TEST_COMMAND(cryptodev_nitrox_autotest, test_cryptodev_nitrox);
 REGISTER_TEST_COMMAND(cryptodev_bcmfs_autotest, test_cryptodev_bcmfs);
 REGISTER_TEST_COMMAND(cryptodev_cn9k_autotest, test_cryptodev_cn9k);
 REGISTER_TEST_COMMAND(cryptodev_cn10k_autotest, test_cryptodev_cn10k);
+
+#endif /* !RTE_EXEC_ENV_WINDOWS */