X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fdpaa_sec%2Fdpaa_sec.c;h=44c742738f5d10e8571d383f060e40381c356591;hb=f935ed4b645a;hp=0495422a4c5f69f142ab1778dc259de004d25244;hpb=8839c8a1f79e722be6397590bd7d255972a398b4;p=dpdk.git diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 0495422a4c..44c742738f 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -15,7 +15,7 @@ #include #include #include -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY #include #endif #include @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -229,7 +230,7 @@ static inline int is_decode(dpaa_sec_session *ses) return ses->dir == DIR_DEC; } -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY static int dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) { @@ -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; } @@ -408,7 +434,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) memset(cdb, 0, sizeof(struct sec_cdb)); switch (ses->ctxt) { -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY case DPAA_SEC_IPSEC: shared_desc_len = dpaa_sec_prep_ipsec_cdb(ses); break; @@ -1539,7 +1565,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses) return cf; } -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY static inline struct dpaa_sec_job * build_proto(struct rte_crypto_op *op, dpaa_sec_session *ses) { @@ -1695,8 +1721,8 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, DPAA_SEC_BURST : nb_ops; for (loop = 0; loop < frames_to_send; loop++) { op = *(ops++); - if (op->sym->m_src->seqn != 0) { - index = op->sym->m_src->seqn - 1; + if (*dpaa_seqn(op->sym->m_src) != 0) { + index = *dpaa_seqn(op->sym->m_src) - 1; if (DPAA_PER_LCORE_DQRR_HELD & (1 << index)) { /* QM_EQCR_DCA_IDXMASK = 0x0f */ flags[loop] = ((index & 0x0f) << 8); @@ -1714,7 +1740,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, op->sym->session, cryptodev_driver_id); break; -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY case RTE_CRYPTO_OP_SECURITY_SESSION: ses = (dpaa_sec_session *) get_sec_session_private_data( @@ -1761,7 +1787,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, ((op->sym->m_dst == NULL) || rte_pktmbuf_is_contiguous(op->sym->m_dst))) { switch (ses->ctxt) { -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY case DPAA_SEC_PDCP: case DPAA_SEC_IPSEC: cf = build_proto(op, ses); @@ -1795,7 +1821,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, } } else { switch (ses->ctxt) { -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY case DPAA_SEC_PDCP: case DPAA_SEC_IPSEC: cf = build_proto_sg(op, ses); @@ -1852,7 +1878,7 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, ((auth_tail_len << 16) | auth_hdr_len); } -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY /* In case of PDCP, per packet HFN is stored in * mbuf priv after sym_op. */ @@ -2467,7 +2493,7 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev, } } -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY static int dpaa_sec_ipsec_aead_init(struct rte_crypto_aead_xform *aead_xform, struct rte_security_ipsec_xform *ipsec_xform, @@ -2949,6 +2975,7 @@ dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn = pdcp_xform->hfn; session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd; + session->pdcp.sdap_enabled = pdcp_xform->sdap_enabled; if (cipher_xform) session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; @@ -3185,7 +3212,7 @@ dpaa_sec_process_atomic_event(void *event, DPAA_PER_LCORE_DQRR_HELD |= 1 << index; DPAA_PER_LCORE_DQRR_MBUF(index) = ctx->op->sym->m_src; ev->impl_opaque = index + 1; - ctx->op->sym->m_src->seqn = (uint32_t)index + 1; + *dpaa_seqn(ctx->op->sym->m_src) = (uint32_t)index + 1; *bufs = (void *)ctx->op; rte_mempool_put(ctx->ctx_pool, (void *)ctx); @@ -3272,7 +3299,7 @@ static struct rte_cryptodev_ops crypto_ops = { .sym_session_clear = dpaa_sec_sym_session_clear }; -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY static const struct rte_security_capability * dpaa_sec_capabilities_get(void *device __rte_unused) { @@ -3311,7 +3338,7 @@ static int dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) { struct dpaa_sec_dev_private *internals; -#ifdef RTE_LIBRTE_SECURITY +#ifdef RTE_LIB_SECURITY struct rte_security_ctx *security_instance; #endif struct dpaa_sec_qp *qp; @@ -3348,7 +3375,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) DPAA_SEC_WARN("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);