[4/7] crypto/dpaa_sec: enable PDCP-SDAP sessions
diff mbox series

Message ID 20200903160652.31654-5-akhil.goyal@nxp.com
State Superseded
Delegated to: akhil goyal
Headers show
Series
  • support PDCP-SDAP for dpaa2_sec
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Sept. 3, 2020, 4:06 p.m. UTC
From: Akhil Goyal <akhil.goyal@nxp.com>

Based on the new field in PDCP xform, a decision is made
to create a PDCP session with or without SDAP enabled.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 63 +++++++++++++++++++++---------
 drivers/crypto/dpaa_sec/dpaa_sec.h |  3 +-
 2 files changed, 47 insertions(+), 19 deletions(-)

Patch
diff mbox series

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c4339336d..192dba064 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -36,6 +36,7 @@ 
 #include <desc/algo.h>
 #include <desc/ipsec.h>
 #include <desc/pdcp.h>
+#include <desc/sdap.h>
 
 #include <rte_dpaa_bus.h>
 #include <dpaa_sec.h>
@@ -293,24 +294,49 @@  dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses)
 					&cipherdata, &authdata,
 					0);
 	} else {
-		if (ses->dir == DIR_ENC)
-			shared_desc_len = cnstr_shdsc_pdcp_u_plane_encap(
-					cdb->sh_desc, 1, swap,
-					ses->pdcp.sn_size,
-					ses->pdcp.hfn,
-					ses->pdcp.bearer,
-					ses->pdcp.pkt_dir,
-					ses->pdcp.hfn_threshold,
-					&cipherdata, p_authdata, 0);
-		else if (ses->dir == DIR_DEC)
-			shared_desc_len = cnstr_shdsc_pdcp_u_plane_decap(
-					cdb->sh_desc, 1, swap,
-					ses->pdcp.sn_size,
-					ses->pdcp.hfn,
-					ses->pdcp.bearer,
-					ses->pdcp.pkt_dir,
-					ses->pdcp.hfn_threshold,
-					&cipherdata, p_authdata, 0);
+		if (ses->dir == DIR_ENC) {
+			if (ses->pdcp.sdap_enabled)
+				shared_desc_len =
+					cnstr_shdsc_pdcp_sdap_u_plane_encap(
+						cdb->sh_desc, 1, swap,
+						ses->pdcp.sn_size,
+						ses->pdcp.hfn,
+						ses->pdcp.bearer,
+						ses->pdcp.pkt_dir,
+						ses->pdcp.hfn_threshold,
+						&cipherdata, p_authdata, 0);
+			else
+				shared_desc_len =
+					cnstr_shdsc_pdcp_u_plane_encap(
+						cdb->sh_desc, 1, swap,
+						ses->pdcp.sn_size,
+						ses->pdcp.hfn,
+						ses->pdcp.bearer,
+						ses->pdcp.pkt_dir,
+						ses->pdcp.hfn_threshold,
+						&cipherdata, p_authdata, 0);
+		} else if (ses->dir == DIR_DEC) {
+			if (ses->pdcp.sdap_enabled)
+				shared_desc_len =
+					cnstr_shdsc_pdcp_sdap_u_plane_decap(
+						cdb->sh_desc, 1, swap,
+						ses->pdcp.sn_size,
+						ses->pdcp.hfn,
+						ses->pdcp.bearer,
+						ses->pdcp.pkt_dir,
+						ses->pdcp.hfn_threshold,
+						&cipherdata, p_authdata, 0);
+			else
+				shared_desc_len =
+					cnstr_shdsc_pdcp_u_plane_decap(
+						cdb->sh_desc, 1, swap,
+						ses->pdcp.sn_size,
+						ses->pdcp.hfn,
+						ses->pdcp.bearer,
+						ses->pdcp.pkt_dir,
+						ses->pdcp.hfn_threshold,
+						&cipherdata, p_authdata, 0);
+		}
 	}
 	return shared_desc_len;
 }
@@ -2950,6 +2976,7 @@  dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev,
 	session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold;
 	session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;
 	session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
+	session->pdcp.sdap_enabled = pdcp_xform->sdap_enabled;
 
 	rte_spinlock_lock(&dev_priv->lock);
 	for (i = 0; i < MAX_DPAA_CORES; i++) {
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h
index 2cd50cc8d..ddba52982 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -109,7 +109,8 @@  struct sec_pdcp_ctxt {
 	int8_t pkt_dir;/*!< PDCP Frame Direction 0:UL 1:DL*/
 	int8_t hfn_ovd;/*!< Overwrite HFN per packet*/
 	uint8_t sn_size;	/*!< Sequence number size, 5/7/12/15/18 */
-	uint32_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which
+	uint8_t sdap_enabled;	/*!< SDAP header is enabled */
+	uint16_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which
 				 * per packet hfn is stored
 				 */
 	uint32_t hfn;	/*!< Hyper Frame Number */