qat: add out-of-place symmetric operations
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Tue, 29 Mar 2016 14:14:41 +0000 (15:14 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 31 Mar 2016 19:49:26 +0000 (21:49 +0200)
This patch adds out-of-place operations to qat symmetric crypto PMD,
i.e. the result of the operation can be written to the destination buffer
instead of overwriting the source buffer as done in "in-place" operation.
Both buffers can be of different sizes.
Previously the qat PMD assumed that m_src and m_dst in rte_crypto_sym_op
were identical.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: John Griffin <john.griffin@intel.com>
doc/guides/cryptodevs/qat.rst
drivers/crypto/qat/qat_crypto.c

index af90b46..4b8f782 100644 (file)
@@ -62,7 +62,6 @@ Limitations
 * Chained mbufs are not supported.
 * Hash only is not supported except Snow3G UIA2.
 * Cipher only is not supported except Snow3G UEA2.
-* Only in-place is currently supported (destination address is the same as source address).
 * Only supports the session-oriented API implementation (session-less APIs are not supported).
 * Not performance tuned.
 * Snow3g(UEA2) supported only if cipher length, cipher offset fields are byte-aligned.
index 9001558..45bb8b3 100644 (file)
@@ -692,17 +692,21 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg)
        *qat_req = ctx->fw_req;
        qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op;
 
-       /*
-        * The following code assumes:
-        * - single entry buffer.
-        * - always in place.
-        */
        qat_req->comn_mid.dst_length =
-                       qat_req->comn_mid.src_length =
-                                       rte_pktmbuf_data_len(op->sym->m_src);
+               qat_req->comn_mid.src_length =
+                               rte_pktmbuf_data_len(op->sym->m_src);
+
        qat_req->comn_mid.dest_data_addr =
-                       qat_req->comn_mid.src_data_addr =
-                                       rte_pktmbuf_mtophys(op->sym->m_src);
+               qat_req->comn_mid.src_data_addr =
+                           rte_pktmbuf_mtophys(op->sym->m_src);
+
+       if (unlikely(op->sym->m_dst != NULL)) {
+               qat_req->comn_mid.dest_data_addr =
+                               rte_pktmbuf_mtophys(op->sym->m_dst);
+               qat_req->comn_mid.dst_length =
+                               rte_pktmbuf_data_len(op->sym->m_dst);
+       }
+
        cipher_param = (void *)&qat_req->serv_specif_rqpars;
        auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param));