[v2,4/8] crypto/dpaa2_sec: enable PDCP-SDAP sessions

Message ID 20201011213403.21169-5-akhil.goyal@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series support PDCP-SDAP for dpaa2_sec |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Oct. 11, 2020, 9:33 p.m. UTC
  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 --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index c11d02420..f8e8750e4 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
@@ -3264,8 +3265,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,
@@ -3273,8 +3275,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,
@@ -3282,6 +3294,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) {