From: Ankur Dwivedi <adwivedi@marvell.com> To: <dev@dpdk.org> Cc: <jerinj@marvell.com>, <pbhagavatula@marvell.com>, <akhil.goyal@nxp.com>, <anoobj@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com> Subject: [dpdk-dev] [PATCH 1/3] crypto/octeontx2: move functions to helper file Date: Tue, 8 Sep 2020 15:39:54 +0530 Message-ID: <20200908100956.25868-2-adwivedi@marvell.com> (raw) In-Reply-To: <20200908100956.25868-1-adwivedi@marvell.com> Some functions are common across cryptodev pmd and the event crypto adapter. This patch moves them into a helper file. Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 65 +--------------- .../octeontx2/otx2_cryptodev_ops_helper.h | 74 +++++++++++++++++++ 2 files changed, 75 insertions(+), 64 deletions(-) create mode 100644 drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index ccf566d5f..77842b4ad 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -13,6 +13,7 @@ #include "otx2_cryptodev_hw_access.h" #include "otx2_cryptodev_mbox.h" #include "otx2_cryptodev_ops.h" +#include "otx2_cryptodev_ops_helper.h" #include "otx2_ipsec_po_ops.h" #include "otx2_mbox.h" #include "otx2_sec_idev.h" @@ -416,24 +417,6 @@ sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform, return -ENOTSUP; } -static void -sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess) -{ - void *priv = get_sym_session_private_data(sess, driver_id); - struct rte_mempool *pool; - - if (priv == NULL) - return; - - memset(priv, 0, cpt_get_session_size()); - - pool = rte_mempool_from_obj(priv); - - set_sym_session_private_data(sess, driver_id, NULL); - - rte_mempool_put(pool, priv); -} - static __rte_always_inline int32_t __rte_hot otx2_cpt_enqueue_req(const struct otx2_cpt_qp *qp, struct pending_queue *pend_q, @@ -917,52 +900,6 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop, } } -static __rte_always_inline uint8_t -otx2_cpt_compcode_get(struct cpt_request_info *req) -{ - volatile struct cpt_res_s_9s *res; - uint8_t ret; - - res = (volatile struct cpt_res_s_9s *)req->completion_addr; - - if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) { - if (rte_get_timer_cycles() < req->time_out) - return ERR_REQ_PENDING; - - CPT_LOG_DP_ERR("Request timed out"); - return ERR_REQ_TIMEOUT; - } - - if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) { - ret = NO_ERR; - if (unlikely(res->uc_compcode)) { - ret = res->uc_compcode; - CPT_LOG_DP_DEBUG("Request failed with microcode error"); - CPT_LOG_DP_DEBUG("MC completion code 0x%x", - res->uc_compcode); - } - } else { - CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode); - - ret = res->compcode; - switch (res->compcode) { - case CPT_9X_COMP_E_INSTERR: - CPT_LOG_DP_ERR("Request failed with instruction error"); - break; - case CPT_9X_COMP_E_FAULT: - CPT_LOG_DP_ERR("Request failed with DMA fault"); - break; - case CPT_9X_COMP_E_HWERR: - CPT_LOG_DP_ERR("Request failed with hardware error"); - break; - default: - CPT_LOG_DP_ERR("Request failed with unknown completion code"); - } - } - - return ret; -} - static uint16_t otx2_cpt_dequeue_burst(void *qptr, struct rte_crypto_op **ops, uint16_t nb_ops) { diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h b/drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h new file mode 100644 index 000000000..764daadea --- /dev/null +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops_helper.h @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (C) 2020 Marvell International Ltd. + */ + +#ifndef _OTX2_CRYPTODEV_OPS_HELPER_H_ +#define _OTX2_CRYPTODEV_OPS_HELPER_H_ + +#include "cpt_pmd_logs.h" + +static void +sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess) +{ + void *priv = get_sym_session_private_data(sess, driver_id); + struct rte_mempool *pool; + + if (priv == NULL) + return; + + memset(priv, 0, cpt_get_session_size()); + + pool = rte_mempool_from_obj(priv); + + set_sym_session_private_data(sess, driver_id, NULL); + + rte_mempool_put(pool, priv); +} + +static __rte_always_inline uint8_t +otx2_cpt_compcode_get(struct cpt_request_info *req) +{ + volatile struct cpt_res_s_9s *res; + uint8_t ret; + + res = (volatile struct cpt_res_s_9s *)req->completion_addr; + + if (unlikely(res->compcode == CPT_9X_COMP_E_NOTDONE)) { + if (rte_get_timer_cycles() < req->time_out) + return ERR_REQ_PENDING; + + CPT_LOG_DP_ERR("Request timed out"); + return ERR_REQ_TIMEOUT; + } + + if (likely(res->compcode == CPT_9X_COMP_E_GOOD)) { + ret = NO_ERR; + if (unlikely(res->uc_compcode)) { + ret = res->uc_compcode; + CPT_LOG_DP_DEBUG("Request failed with microcode error"); + CPT_LOG_DP_DEBUG("MC completion code 0x%x", + res->uc_compcode); + } + } else { + CPT_LOG_DP_DEBUG("HW completion code 0x%x", res->compcode); + + ret = res->compcode; + switch (res->compcode) { + case CPT_9X_COMP_E_INSTERR: + CPT_LOG_DP_ERR("Request failed with instruction error"); + break; + case CPT_9X_COMP_E_FAULT: + CPT_LOG_DP_ERR("Request failed with DMA fault"); + break; + case CPT_9X_COMP_E_HWERR: + CPT_LOG_DP_ERR("Request failed with hardware error"); + break; + default: + CPT_LOG_DP_ERR("Request failed with unknown completion code"); + } + } + + return ret; +} + +#endif /* _OTX2_CRYPTODEV_OPS_HELPER_H_ */ -- 2.28.0
next prev parent reply other threads:[~2020-09-08 10:10 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-08 10:09 [dpdk-dev] [PATCH 0/3] event/octeontx2: add support for event crypto adapter Ankur Dwivedi 2020-09-08 10:09 ` Ankur Dwivedi [this message] 2020-09-08 10:09 ` [dpdk-dev] [PATCH 2/3] event/octeontx2: add crypto adapter framework Ankur Dwivedi 2020-09-08 10:09 ` [dpdk-dev] [PATCH 3/3] event/octeontx2: add crypto adapter datapath Ankur Dwivedi 2020-09-17 5:16 ` [dpdk-dev] [PATCH v2 0/3] event/octeontx2: add support for event crypto adapter Ankur Dwivedi 2020-09-17 5:16 ` [dpdk-dev] [PATCH v2 1/3] crypto/octeontx2: move functions to helper file Ankur Dwivedi 2020-09-17 5:16 ` [dpdk-dev] [PATCH v2 2/3] event/octeontx2: add crypto adapter framework Ankur Dwivedi 2020-09-17 5:16 ` [dpdk-dev] [PATCH v2 3/3] event/octeontx2: add crypto adapter datapath Ankur Dwivedi 2020-09-27 12:27 ` Jerin Jacob 2020-10-08 5:54 ` [dpdk-dev] [PATCH v3 0/3] event/octeontx2: add support for event crypto adapter Ankur Dwivedi 2020-10-08 5:54 ` [dpdk-dev] [PATCH v3 1/3] crypto/octeontx2: move functions to helper file Ankur Dwivedi 2020-10-08 5:54 ` [dpdk-dev] [PATCH v3 2/3] event/octeontx2: add crypto adapter framework Ankur Dwivedi 2020-10-08 5:54 ` [dpdk-dev] [PATCH v3 3/3] event/octeontx2: add crypto adapter datapath Ankur Dwivedi 2020-10-08 10:34 ` [dpdk-dev] [PATCH v4 0/3] event/octeontx2: add support for event crypto adapter Ankur Dwivedi 2020-10-08 10:34 ` [dpdk-dev] [PATCH v4 1/3] crypto/octeontx2: move functions to helper file Ankur Dwivedi 2020-10-08 10:34 ` [dpdk-dev] [PATCH v4 2/3] event/octeontx2: add crypto adapter framework Ankur Dwivedi 2020-10-08 10:34 ` [dpdk-dev] [PATCH v4 3/3] event/octeontx2: add crypto adapter datapath Ankur Dwivedi 2020-10-08 15:05 ` [dpdk-dev] [PATCH v4 0/3] event/octeontx2: add support for event crypto adapter Pavan Nikhilesh Bhagavatula 2020-10-08 16:21 ` Jerin Jacob
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200908100956.25868-2-adwivedi@marvell.com \ --to=adwivedi@marvell.com \ --cc=akhil.goyal@nxp.com \ --cc=anoobj@marvell.com \ --cc=dev@dpdk.org \ --cc=jerinj@marvell.com \ --cc=pbhagavatula@marvell.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git