crypto/dpaa2_sec: enable PDCP-SDAP sessions
authorAkhil Goyal <akhil.goyal@nxp.com>
Mon, 12 Oct 2020 14:10:02 +0000 (19:40 +0530)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 14 Oct 2020 20:24:41 +0000 (22:24 +0200)
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

index c11d024..f8e8750 100644 (file)
@@ -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) {