app/crypto-perf: support lookaside IPsec
[dpdk.git] / lib / cryptodev / rte_crypto_sym.h
index 1106ad6..daa090b 100644 (file)
@@ -37,6 +37,8 @@ struct rte_crypto_vec {
        rte_iova_t iova;
        /** length of the data buffer */
        uint32_t len;
+       /** total buffer length */
+       uint32_t tot_len;
 };
 
 /**
@@ -69,7 +71,9 @@ struct rte_crypto_sym_vec {
        /** number of operations to perform */
        uint32_t num;
        /** array of SGL vectors */
-       struct rte_crypto_sgl *sgl;
+       struct rte_crypto_sgl *src_sgl;
+       /** array of SGL vectors for OOP, keep it NULL for inplace*/
+       struct rte_crypto_sgl *dest_sgl;
        /** array of pointers to cipher IV */
        struct rte_crypto_va_iova_ptr *iv;
        /** array of pointers to digest */
@@ -963,6 +967,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
 
        vec[0].base = rte_pktmbuf_mtod_offset(mb, void *, ofs);
        vec[0].iova = rte_pktmbuf_iova_offset(mb, ofs);
+       vec[0].tot_len = mb->buf_len - rte_pktmbuf_headroom(mb) - ofs;
 
        /* whole data lies in the first segment */
        seglen = mb->data_len - ofs;
@@ -978,12 +983,14 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
 
                vec[i].base = rte_pktmbuf_mtod(nseg, void *);
                vec[i].iova = rte_pktmbuf_iova(nseg);
+               vec[i].tot_len = mb->buf_len - rte_pktmbuf_headroom(mb) - ofs;
 
                seglen = nseg->data_len;
                if (left <= seglen) {
                        /* whole requested data is completed */
                        vec[i].len = left;
                        left = 0;
+                       i++;
                        break;
                }
 
@@ -993,7 +1000,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
        }
 
        RTE_ASSERT(left == 0);
-       return i + 1;
+       return i;
 }