[3/7] crypto/dpaa2_sec: enable PDCP-SDAP sessions
diff mbox series

Message ID 20200903160652.31654-4-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/dpaa2_sec/dpaa2_sec_dpseci.c | 30 ++++++++++++++++++---
 1 file changed, 26 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 109e61ae1..6aa2a36f3 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -36,6 +36,7 @@ 
 /* RTA header files */
 #include <desc/ipsec.h>
 #include <desc/pdcp.h>
+#include <desc/sdap.h>
 #include <desc/algo.h>
 
 /* Minimum job descriptor consists of a oneword job descriptor HEADER and
@@ -3186,8 +3187,9 @@  dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,
 					&cipherdata, &authdata,
 					0);
 	} else {
-		if (session->dir == DIR_ENC)
-			bufsize = cnstr_shdsc_pdcp_u_plane_encap(
+		if (session->dir == DIR_ENC) {
+			if (pdcp_xform->sdap_enabled)
+				bufsize = cnstr_shdsc_pdcp_sdap_u_plane_encap(
 					priv->flc_desc[0].desc, 1, swap,
 					session->pdcp.sn_size,
 					pdcp_xform->hfn,
@@ -3195,8 +3197,18 @@  dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,
 					pdcp_xform->pkt_dir,
 					pdcp_xform->hfn_threshold,
 					&cipherdata, p_authdata, 0);
-		else if (session->dir == DIR_DEC)
-			bufsize = cnstr_shdsc_pdcp_u_plane_decap(
+			else
+				bufsize = cnstr_shdsc_pdcp_u_plane_encap(
+					priv->flc_desc[0].desc, 1, swap,
+					session->pdcp.sn_size,
+					pdcp_xform->hfn,
+					pdcp_xform->bearer,
+					pdcp_xform->pkt_dir,
+					pdcp_xform->hfn_threshold,
+					&cipherdata, p_authdata, 0);
+		} else if (session->dir == DIR_DEC) {
+			if (pdcp_xform->sdap_enabled)
+				bufsize = cnstr_shdsc_pdcp_sdap_u_plane_decap(
 					priv->flc_desc[0].desc, 1, swap,
 					session->pdcp.sn_size,
 					pdcp_xform->hfn,
@@ -3204,6 +3216,16 @@  dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev,
 					pdcp_xform->pkt_dir,
 					pdcp_xform->hfn_threshold,
 					&cipherdata, p_authdata, 0);
+			else
+				bufsize = cnstr_shdsc_pdcp_u_plane_decap(
+					priv->flc_desc[0].desc, 1, swap,
+					session->pdcp.sn_size,
+					pdcp_xform->hfn,
+					pdcp_xform->bearer,
+					pdcp_xform->pkt_dir,
+					pdcp_xform->hfn_threshold,
+					&cipherdata, p_authdata, 0);
+		}
 	}
 
 	if (bufsize < 0) {