From patchwork Mon Sep 2 12:27:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 58403 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06B641E951; Mon, 2 Sep 2019 14:42:03 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id A9A2C1DFE7 for ; Mon, 2 Sep 2019 14:42:01 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 8B4062006DD; Mon, 2 Sep 2019 14:42:01 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E59532006CA; Mon, 2 Sep 2019 14:41:59 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id AE923402CB; Mon, 2 Sep 2019 20:41:57 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: hemant.agrawal@nxp.com Date: Mon, 2 Sep 2019 17:57:46 +0530 Message-Id: <20190902122747.1393-1-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 1/2] crypto/caam_jr: reduce the function trace from critical path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal Reducing the functional traces from data path and critical session path Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/caam_jr.c | 37 ++++---------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index 77c030347..e87c9895a 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -28,8 +28,11 @@ #include #include #include - +#ifdef RTE_LIBRTE_PMD_CAAM_JR_DEBUG +#define CAAM_JR_DBG 1 +#else #define CAAM_JR_DBG 0 +#endif #define CRYPTODEV_NAME_CAAM_JR_PMD crypto_caam_jr static uint8_t cryptodev_driver_id; int caam_jr_logtype; @@ -62,14 +65,12 @@ struct sec_outring_entry { static inline phys_addr_t caam_jr_vtop_ctx(struct caam_jr_op_ctx *ctx, void *vaddr) { - PMD_INIT_FUNC_TRACE(); return (size_t)vaddr - ctx->vtop_offset; } static inline void caam_jr_op_ending(struct caam_jr_op_ctx *ctx) { - PMD_INIT_FUNC_TRACE(); /* report op status to sym->op and then free the ctx memory */ rte_mempool_put(ctx->ctx_pool, (void *)ctx); } @@ -80,7 +81,6 @@ caam_jr_alloc_ctx(struct caam_jr_session *ses) struct caam_jr_op_ctx *ctx; int ret; - PMD_INIT_FUNC_TRACE(); ret = rte_mempool_get(ses->ctx_pool, (void **)(&ctx)); if (!ctx || ret) { CAAM_JR_DP_WARN("Alloc sec descriptor failed!"); @@ -158,7 +158,6 @@ void caam_jr_stats_reset(struct rte_cryptodev *dev) static inline int is_cipher_only(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ((ses->cipher_alg != RTE_CRYPTO_CIPHER_NULL) && (ses->auth_alg == RTE_CRYPTO_AUTH_NULL)); } @@ -166,7 +165,6 @@ is_cipher_only(struct caam_jr_session *ses) static inline int is_auth_only(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ((ses->cipher_alg == RTE_CRYPTO_CIPHER_NULL) && (ses->auth_alg != RTE_CRYPTO_AUTH_NULL)); } @@ -174,7 +172,6 @@ is_auth_only(struct caam_jr_session *ses) static inline int is_aead(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ((ses->cipher_alg == 0) && (ses->auth_alg == 0) && (ses->aead_alg != 0)); @@ -183,7 +180,6 @@ is_aead(struct caam_jr_session *ses) static inline int is_auth_cipher(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ((ses->cipher_alg != RTE_CRYPTO_CIPHER_NULL) && (ses->auth_alg != RTE_CRYPTO_AUTH_NULL) && (ses->proto_alg != RTE_SECURITY_PROTOCOL_IPSEC)); @@ -192,28 +188,24 @@ is_auth_cipher(struct caam_jr_session *ses) static inline int is_proto_ipsec(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return (ses->proto_alg == RTE_SECURITY_PROTOCOL_IPSEC); } static inline int is_encode(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ses->dir == DIR_ENC; } static inline int is_decode(struct caam_jr_session *ses) { - PMD_INIT_FUNC_TRACE(); return ses->dir == DIR_DEC; } static inline void caam_auth_alg(struct caam_jr_session *ses, struct alginfo *alginfo_a) { - PMD_INIT_FUNC_TRACE(); switch (ses->auth_alg) { case RTE_CRYPTO_AUTH_NULL: ses->digest_length = 0; @@ -262,7 +254,6 @@ caam_auth_alg(struct caam_jr_session *ses, struct alginfo *alginfo_a) static inline void caam_cipher_alg(struct caam_jr_session *ses, struct alginfo *alginfo_c) { - PMD_INIT_FUNC_TRACE(); switch (ses->cipher_alg) { case RTE_CRYPTO_CIPHER_NULL: break; @@ -292,7 +283,6 @@ caam_cipher_alg(struct caam_jr_session *ses, struct alginfo *alginfo_c) static inline void caam_aead_alg(struct caam_jr_session *ses, struct alginfo *alginfo) { - PMD_INIT_FUNC_TRACE(); switch (ses->aead_alg) { case RTE_CRYPTO_AEAD_AES_GCM: alginfo->algtype = OP_ALG_ALGSEL_AES; @@ -317,7 +307,6 @@ caam_jr_prep_cdb(struct caam_jr_session *ses) int swap = true; #endif - PMD_INIT_FUNC_TRACE(); if (ses->cdb) caam_jr_dma_free(ses->cdb); @@ -505,7 +494,6 @@ hw_flush_job_ring(struct sec_job_ring_t *job_ring, int32_t jobs_no_to_discard = 0; int32_t discarded_descs_no = 0; - PMD_INIT_FUNC_TRACE(); CAAM_JR_DEBUG("Jr[%p] pi[%d] ci[%d].Flushing jr notify desc=[%d]", job_ring, job_ring->pidx, job_ring->cidx, do_notify); @@ -559,7 +547,6 @@ hw_poll_job_ring(struct sec_job_ring_t *job_ring, phys_addr_t *temp_addr; struct caam_jr_op_ctx *ctx; - PMD_INIT_FUNC_TRACE(); /* TODO check for ops have memory*/ /* check here if any JR error that cannot be written * in the output status word has occurred @@ -682,7 +669,6 @@ caam_jr_dequeue_burst(void *qp, struct rte_crypto_op **ops, int num_rx; int ret; - PMD_INIT_FUNC_TRACE(); CAAM_JR_DP_DEBUG("Jr[%p]Polling. limit[%d]", ring, nb_ops); /* Poll job ring @@ -739,7 +725,6 @@ build_auth_only_sg(struct rte_crypto_op *op, struct caam_jr_session *ses) struct sec_job_descriptor_t *jobdescr; uint8_t extra_segs; - PMD_INIT_FUNC_TRACE(); if (is_decode(ses)) extra_segs = 2; else @@ -824,7 +809,6 @@ build_auth_only(struct rte_crypto_op *op, struct caam_jr_session *ses) uint64_t sdesc_offset; struct sec_job_descriptor_t *jobdescr; - PMD_INIT_FUNC_TRACE(); ctx = caam_jr_alloc_ctx(ses); if (!ctx) return NULL; @@ -893,7 +877,6 @@ build_cipher_only_sg(struct rte_crypto_op *op, struct caam_jr_session *ses) struct sec_job_descriptor_t *jobdescr; uint8_t reg_segs; - PMD_INIT_FUNC_TRACE(); if (sym->m_dst) { mbuf = sym->m_dst; reg_segs = mbuf->nb_segs + sym->m_src->nb_segs + 2; @@ -1008,7 +991,6 @@ build_cipher_only(struct rte_crypto_op *op, struct caam_jr_session *ses) ses->iv.offset); struct sec_job_descriptor_t *jobdescr; - PMD_INIT_FUNC_TRACE(); ctx = caam_jr_alloc_ctx(ses); if (!ctx) return NULL; @@ -1086,7 +1068,6 @@ build_cipher_auth_sg(struct rte_crypto_op *op, struct caam_jr_session *ses) struct sec_job_descriptor_t *jobdescr; uint32_t auth_only_len; - PMD_INIT_FUNC_TRACE(); auth_only_len = op->sym->auth.data.length - op->sym->cipher.data.length; @@ -1229,7 +1210,6 @@ build_cipher_auth(struct rte_crypto_op *op, struct caam_jr_session *ses) struct sec_job_descriptor_t *jobdescr; uint32_t auth_only_len; - PMD_INIT_FUNC_TRACE(); auth_only_len = op->sym->auth.data.length - op->sym->cipher.data.length; @@ -1335,7 +1315,6 @@ build_proto(struct rte_crypto_op *op, struct caam_jr_session *ses) uint64_t sdesc_offset; struct sec_job_descriptor_t *jobdescr; - PMD_INIT_FUNC_TRACE(); ctx = caam_jr_alloc_ctx(ses); if (!ctx) return NULL; @@ -1376,7 +1355,6 @@ caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp) struct caam_jr_op_ctx *ctx = NULL; struct sec_job_descriptor_t *jobdescr __rte_unused; - PMD_INIT_FUNC_TRACE(); switch (op->sess_type) { case RTE_CRYPTO_OP_WITH_SESSION: ses = (struct caam_jr_session *) @@ -1497,8 +1475,6 @@ caam_jr_enqueue_burst(void *qp, struct rte_crypto_op **ops, int32_t ret; struct caam_jr_qp *jr_qp = (struct caam_jr_qp *)qp; uint16_t num_tx = 0; - - PMD_INIT_FUNC_TRACE(); /*Prepare each packet which is to be sent*/ for (loop = 0; loop < nb_ops; loop++) { ret = caam_jr_enqueue_op(ops[loop], jr_qp); @@ -1586,7 +1562,6 @@ caam_jr_cipher_init(struct rte_cryptodev *dev __rte_unused, struct rte_crypto_sym_xform *xform, struct caam_jr_session *session) { - PMD_INIT_FUNC_TRACE(); session->cipher_alg = xform->cipher.algo; session->iv.length = xform->cipher.iv.length; session->iv.offset = xform->cipher.iv.offset; @@ -1611,7 +1586,6 @@ caam_jr_auth_init(struct rte_cryptodev *dev __rte_unused, struct rte_crypto_sym_xform *xform, struct caam_jr_session *session) { - PMD_INIT_FUNC_TRACE(); session->auth_alg = xform->auth.algo; session->auth_key.data = rte_zmalloc(NULL, xform->auth.key.length, RTE_CACHE_LINE_SIZE); @@ -1635,7 +1609,6 @@ caam_jr_aead_init(struct rte_cryptodev *dev __rte_unused, struct rte_crypto_sym_xform *xform, struct caam_jr_session *session) { - PMD_INIT_FUNC_TRACE(); session->aead_alg = xform->aead.algo; session->iv.length = xform->aead.iv.length; session->iv.offset = xform->aead.iv.offset; @@ -1951,7 +1924,6 @@ caam_jr_security_session_create(void *dev, struct rte_cryptodev *cdev = (struct rte_cryptodev *)dev; int ret; - PMD_INIT_FUNC_TRACE(); if (rte_mempool_get(mempool, &sess_private_data)) { CAAM_JR_ERR("Couldn't get object from session mempool"); return -ENOMEM; @@ -2109,7 +2081,6 @@ static struct rte_security_ops caam_jr_security_ops = { static void close_job_ring(struct sec_job_ring_t *job_ring) { - PMD_INIT_FUNC_TRACE(); if (job_ring->irq_fd) { /* Producer index is frozen. If consumer index is not equal * with producer index, then we have descs to flush. From patchwork Mon Sep 2 12:27:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 58404 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA4321E980; Mon, 2 Sep 2019 14:42:05 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id DB3BD1D446 for ; Mon, 2 Sep 2019 14:42:02 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id BA7971A02F6; Mon, 2 Sep 2019 14:42:02 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E61EC1A0649; Mon, 2 Sep 2019 14:42:00 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 3A5E0402F0; Mon, 2 Sep 2019 20:41:58 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: hemant.agrawal@nxp.com, Gagandeep Singh Date: Mon, 2 Sep 2019 17:57:47 +0530 Message-Id: <20190902122747.1393-2-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190902122747.1393-1-akhil.goyal@nxp.com> References: <20190902122747.1393-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/2] crypto/caam_jr: integrate DPAAX table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Gagandeep Singh Virtual to physical conversions are optimized using the DPAAX tables. This patch integrates DPAAX with caam_jr PMD. Signed-off-by: Gagandeep Singh Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/Makefile | 1 + drivers/crypto/caam_jr/caam_jr_pvt.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/crypto/caam_jr/Makefile b/drivers/crypto/caam_jr/Makefile index cecfbbdc8..0a8a2150b 100644 --- a/drivers/crypto/caam_jr/Makefile +++ b/drivers/crypto/caam_jr/Makefile @@ -39,5 +39,6 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_cryptodev LDLIBS += -lrte_bus_dpaa LDLIBS += -lrte_bus_vdev +LDLIBS += -lrte_common_dpaax include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/crypto/caam_jr/caam_jr_pvt.h b/drivers/crypto/caam_jr/caam_jr_pvt.h index 9f1adabc7..d32291b60 100644 --- a/drivers/crypto/caam_jr/caam_jr_pvt.h +++ b/drivers/crypto/caam_jr/caam_jr_pvt.h @@ -6,6 +6,7 @@ #define CAAM_JR_PVT_H #include +#include /* NXP CAAM JR PMD device name */ @@ -254,6 +255,11 @@ caam_jr_mem_vtop(void *vaddr) static inline void * caam_jr_dma_ptov(rte_iova_t paddr) { + void *va; + va = dpaax_iova_table_get_va(paddr); + if (likely(va != NULL)) + return va; + return rte_mem_iova2virt(paddr); }