X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fdpaa2_sec%2Fdpaa2_sec_dpseci.c;h=109e61ae1690cec29722e5d6f14c2fe644f2f9c6;hb=0136dd3727165dcf08bb8a654548707577956a47;hp=f2a1c302ccb9ee003521c118020ea4d24e6ff711;hpb=94ae7667f723d743b42c1dddb7b9673c8986e285;p=dpdk.git diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index f2a1c302cc..109e61ae16 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2019 NXP + * Copyright 2016-2020 NXP * */ @@ -56,12 +56,8 @@ #define SEC_FLC_DHR_OUTBOUND -114 #define SEC_FLC_DHR_INBOUND 0 -enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8; - static uint8_t cryptodev_driver_id; -int dpaa2_logtype_sec; - #ifdef RTE_LIBRTE_SECURITY static inline int build_proto_compound_sg_fd(dpaa2_sec_session *sess, @@ -168,7 +164,8 @@ build_proto_compound_sg_fd(dpaa2_sec_session *sess, * mbuf priv after sym_op. */ if (sess->ctxt_type == DPAA2_SEC_PDCP && sess->pdcp.hfn_ovd) { - uint32_t hfn_ovd = *((uint8_t *)op + sess->pdcp.hfn_ovd_offset); + uint32_t hfn_ovd = *(uint32_t *)((uint8_t *)op + + sess->pdcp.hfn_ovd_offset); /*enable HFN override override */ DPAA2_SET_FLE_INTERNAL_JD(ip_fle, hfn_ovd); DPAA2_SET_FLE_INTERNAL_JD(op_fle, hfn_ovd); @@ -243,7 +240,8 @@ build_proto_compound_fd(dpaa2_sec_session *sess, * mbuf priv after sym_op. */ if (sess->ctxt_type == DPAA2_SEC_PDCP && sess->pdcp.hfn_ovd) { - uint32_t hfn_ovd = *((uint8_t *)op + sess->pdcp.hfn_ovd_offset); + uint32_t hfn_ovd = *(uint32_t *)((uint8_t *)op + + sess->pdcp.hfn_ovd_offset); /*enable HFN override override */ DPAA2_SET_FLE_INTERNAL_JD(ip_fle, hfn_ovd); DPAA2_SET_FLE_INTERNAL_JD(op_fle, hfn_ovd); @@ -1460,7 +1458,9 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, if (!DPAA2_PER_LCORE_DPIO) { ret = dpaa2_affine_qbman_swp(); if (ret) { - DPAA2_SEC_ERR("Failure in affining portal"); + DPAA2_SEC_ERR( + "Failed to allocate IO portal, tid: %d\n", + rte_gettid()); return 0; } } @@ -1642,7 +1642,9 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, if (!DPAA2_PER_LCORE_DPIO) { ret = dpaa2_affine_qbman_swp(); if (ret) { - DPAA2_SEC_ERR("Failure in affining portal"); + DPAA2_SEC_ERR( + "Failed to allocate IO portal, tid: %d\n", + rte_gettid()); return 0; } } @@ -2192,7 +2194,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev, priv->flc_desc[0].desc[0] = aeaddata.keylen; err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN, - MIN_JOB_DESC_SIZE, + DESC_JOB_IO_LEN, (unsigned int *)priv->flc_desc[0].desc, &priv->flc_desc[0].desc[1], 1); @@ -2416,7 +2418,7 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev, priv->flc_desc[0].desc[0] = cipherdata.keylen; priv->flc_desc[0].desc[1] = authdata.keylen; err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN, - MIN_JOB_DESC_SIZE, + DESC_JOB_IO_LEN, (unsigned int *)priv->flc_desc[0].desc, &priv->flc_desc[0].desc[2], 2); @@ -3154,6 +3156,14 @@ dpaa2_sec_set_pdcp_session(struct rte_cryptodev *dev, goto out; } + if (rta_inline_pdcp_query(authdata.algtype, + cipherdata.algtype, + session->pdcp.sn_size, + session->pdcp.hfn_ovd)) { + cipherdata.key = DPAA2_VADDR_TO_IOVA(cipherdata.key); + cipherdata.key_type = RTA_DATA_PTR; + } + if (pdcp_xform->domain == RTE_SECURITY_PDCP_MODE_CONTROL) { if (session->dir == DIR_ENC) bufsize = cnstr_shdsc_pdcp_c_plane_encap( @@ -3784,7 +3794,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) "Error in allocating the memory for dpsec object"); return -ENOMEM; } - dpseci->regs = rte_mcp_ptr_list[0]; + dpseci->regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX); retcode = dpseci_open(dpseci, CMD_PRI_LOW, hw_id, &token); if (retcode != 0) { @@ -3866,6 +3876,8 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused, if (dpaa2_svr_family == SVR_LX2160A) rta_set_sec_era(RTA_SEC_ERA_10); + else + rta_set_sec_era(RTA_SEC_ERA_8); DPAA2_SEC_INFO("2-SEC ERA is %d", rta_get_sec_era()); @@ -3914,11 +3926,4 @@ static struct cryptodev_driver dpaa2_sec_crypto_drv; RTE_PMD_REGISTER_DPAA2(CRYPTODEV_NAME_DPAA2_SEC_PMD, rte_dpaa2_sec_driver); RTE_PMD_REGISTER_CRYPTO_DRIVER(dpaa2_sec_crypto_drv, rte_dpaa2_sec_driver.driver, cryptodev_driver_id); - -RTE_INIT(dpaa2_sec_init_log) -{ - /* Bus level logs */ - dpaa2_logtype_sec = rte_log_register("pmd.crypto.dpaa2"); - if (dpaa2_logtype_sec >= 0) - rte_log_set_level(dpaa2_logtype_sec, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(dpaa2_logtype_sec, pmd.crypto.dpaa2, NOTICE);