ethdev: remove legacy HASH filter type support
[dpdk.git] / drivers / crypto / dpaa2_sec / dpaa2_sec_dpseci.c
index c11d024..6ff0d83 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
@@ -58,7 +59,7 @@
 
 static uint8_t cryptodev_driver_id;
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
 static inline int
 build_proto_compound_sg_fd(dpaa2_sec_session *sess,
                           struct rte_crypto_op *op,
@@ -1355,7 +1356,7 @@ build_sec_fd(struct rte_crypto_op *op,
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
                sess = (dpaa2_sec_session *)get_sym_session_private_data(
                                op->sym->session, cryptodev_driver_id);
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
                sess = (dpaa2_sec_session *)get_sec_session_private_data(
                                op->sym->sec_session);
@@ -1383,7 +1384,7 @@ build_sec_fd(struct rte_crypto_op *op,
                case DPAA2_SEC_CIPHER_HASH:
                        ret = build_authenc_sg_fd(sess, op, fd, bpid);
                        break;
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
                case DPAA2_SEC_IPSEC:
                case DPAA2_SEC_PDCP:
                        ret = build_proto_compound_sg_fd(sess, op, fd, bpid);
@@ -1407,7 +1408,7 @@ build_sec_fd(struct rte_crypto_op *op,
                case DPAA2_SEC_CIPHER_HASH:
                        ret = build_authenc_fd(sess, op, fd, bpid);
                        break;
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
                case DPAA2_SEC_IPSEC:
                        ret = build_proto_fd(sess, op, fd, bpid);
                        break;
@@ -1471,13 +1472,15 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
                        dpaa2_eqcr_size : nb_ops;
 
                for (loop = 0; loop < frames_to_send; loop++) {
-                       if ((*ops)->sym->m_src->seqn) {
-                        uint8_t dqrr_index = (*ops)->sym->m_src->seqn - 1;
-
-                        flags[loop] = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index;
-                        DPAA2_PER_LCORE_DQRR_SIZE--;
-                        DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dqrr_index);
-                        (*ops)->sym->m_src->seqn = DPAA2_INVALID_MBUF_SEQN;
+                       if (*dpaa2_seqn((*ops)->sym->m_src)) {
+                               uint8_t dqrr_index =
+                                       *dpaa2_seqn((*ops)->sym->m_src) - 1;
+
+                               flags[loop] = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index;
+                               DPAA2_PER_LCORE_DQRR_SIZE--;
+                               DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dqrr_index);
+                               *dpaa2_seqn((*ops)->sym->m_src) =
+                                       DPAA2_INVALID_MBUF_SEQN;
                        }
 
                        /*Clear the unused FD fields before sending*/
@@ -1522,7 +1525,7 @@ skip_tx:
        return num_tx;
 }
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
 static inline struct rte_crypto_op *
 sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
 {
@@ -1561,7 +1564,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd)
        struct ctxt_priv *priv;
        struct rte_mbuf *dst, *src;
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
                return sec_simple_fd_to_mbuf(fd);
 #endif
@@ -1594,7 +1597,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd)
        } else
                dst = src;
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
                uint16_t len = DPAA2_GET_FD_LEN(fd);
                dst->pkt_len = len;
@@ -2596,7 +2599,7 @@ dpaa2_sec_set_session_parameters(struct rte_cryptodev *dev,
        return ret;
 }
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
 static int
 dpaa2_sec_ipsec_aead_init(struct rte_crypto_aead_xform *aead_xform,
                        dpaa2_sec_session *session,
@@ -2817,12 +2820,6 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform,
        return 0;
 }
 
-#ifdef RTE_LIBRTE_SECURITY_TEST
-static uint8_t aes_cbc_iv[] = {
-       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
-#endif
-
 static int
 dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev,
                            struct rte_security_session_conf *conf,
@@ -3264,8 +3261,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 +3271,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 +3290,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) {
@@ -3692,7 +3710,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused,
 
        ev->event_ptr = sec_fd_to_mbuf(fd);
        dqrr_index = qbman_get_dqrr_idx(dq);
-       crypto_op->sym->m_src->seqn = dqrr_index + 1;
+       *dpaa2_seqn(crypto_op->sym->m_src) = dqrr_index + 1;
        DPAA2_PER_LCORE_DQRR_SIZE++;
        DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index;
        DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = crypto_op->sym->m_src;
@@ -3781,7 +3799,7 @@ static struct rte_cryptodev_ops crypto_ops = {
        .sym_session_clear        = dpaa2_sec_sym_session_clear,
 };
 
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
 static const struct rte_security_capability *
 dpaa2_sec_capabilities_get(void *device __rte_unused)
 {
@@ -3819,7 +3837,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
        struct dpaa2_sec_dev_private *internals;
        struct rte_device *dev = cryptodev->device;
        struct rte_dpaa2_device *dpaa2_dev;
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        struct rte_security_ctx *security_instance;
 #endif
        struct fsl_mc_io *dpseci;
@@ -3858,7 +3876,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
                DPAA2_SEC_DEBUG("Device already init by primary process");
                return 0;
        }
-#ifdef RTE_LIBRTE_SECURITY
+#ifdef RTE_LIB_SECURITY
        /* Initialize security_ctx only for primary process*/
        security_instance = rte_malloc("rte_security_instances_ops",
                                sizeof(struct rte_security_ctx), 0);