[v5,02/15] crypto: add total raw buffer length

Message ID 20211017161651.9220-3-hemant.agrawal@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto: add raw vector support in DPAAx |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hemant Agrawal Oct. 17, 2021, 4:16 p.m. UTC
  From: Gagandeep Singh <g.singh@nxp.com>

The current crypto raw data vectors is extended to support
rte_security usecases, where we need total data length to know
how much additional memory space is available in buffer other
than data length so that driver/HW can write expanded size
data after encryption.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 doc/guides/rel_notes/deprecation.rst   | 7 -------
 doc/guides/rel_notes/release_21_11.rst | 6 ++++++
 lib/cryptodev/rte_crypto_sym.h         | 4 ++++
 3 files changed, 10 insertions(+), 7 deletions(-)
  

Patch

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 09b54fdef3..0e04ecf743 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -179,13 +179,6 @@  Deprecation Notices
   This field will be null for inplace processing.
   This change is targeted for DPDK 21.11.
 
-* cryptodev: The structure ``rte_crypto_vec`` would be updated to add
-  ``tot_len`` to support total buffer length.
-  This is required for security cases like IPsec and PDCP encryption offload
-  to know how much additional memory space is available in buffer other than
-  data length so that driver/HW can write expanded size data after encryption.
-  This change is targeted for DPDK 21.11.
-
 * cryptodev: Hide structures ``rte_cryptodev_sym_session`` and
   ``rte_cryptodev_asym_session`` to remove unnecessary indirection between
   session and the private data of session. An opaque pointer can be exposed
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index 256037b639..ba036c5b3f 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -232,6 +232,12 @@  API Changes
 * cryptodev: The field ``dataunit_len`` of the ``struct rte_crypto_cipher_xform``
   moved to the end of the structure and extended to ``uint32_t``.
 
+* cryptodev: The structure ``rte_crypto_vec`` updated to add ``tot_len`` to
+  support total buffer length. This is required for security cases like IPsec
+  and PDCP encryption offload to know how much additional memory space is
+  available in buffer other than data length so that driver/HW can write
+  expanded size data after encryption.
+
 
 ABI Changes
 -----------
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index f8cb2ccca0..1f2f0a572c 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -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;
 };
 
 /**
@@ -963,6 +965,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,6 +981,7 @@  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) {