From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA122A034C; Mon, 8 Aug 2022 10:07:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1256442C58; Mon, 8 Aug 2022 10:06:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3BB0742C5B for ; Mon, 8 Aug 2022 10:06:32 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 277N0ebY006022 for ; Mon, 8 Aug 2022 01:06:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=lwPeCLk5Pfx4jiQXglED89eXS2hVer4wgrcZTsVh7ak=; b=YS+a9kOHMnj/TMNZO3pLw6Fmf0pjMepGJ2PP8hYYVH6KKP6FYM08QIjt79TA9MHmXjbI T2c+HVv9n4OBWUDVkJ6T0iYm7fZk3lzT7D2XJI/eyh9HOUM2hJtpyW+Dchg4IqScAdQC 9JAfPiUopg1MHZNMhc9t5zXbfw2fnVImTp6G8LOJ7W5/4P6Xxgv+MRhywXV+APIx+5g5 1ODmjgF6IHFjo+C/af1bKGJwDV7R7a8go14OQnw53kv1w+rvFLvYNSJZ7oDvA+qJV3kc xbV3tFAl9lCxIRI/E/CuqSNwGQbZ7DYTXMwbWXLySAF3ms3rPdrr7h4pC2X58TKzn3pa JA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hsqtmmxeh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 08 Aug 2022 01:06:31 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Aug 2022 01:06:29 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 8 Aug 2022 01:06:29 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.160.62]) by maili.marvell.com (Postfix) with ESMTP id BDE433F708F; Mon, 8 Aug 2022 01:06:27 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Archana Muniganti , Tejasree Kondoj , Subject: [PATCH 09/18] crypto/cnxk: remove extra indirection for FC and Kasumi Date: Mon, 8 Aug 2022 13:35:57 +0530 Message-ID: <20220808080606.220-10-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220808080606.220-1-anoobj@marvell.com> References: <20220808080606.220-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 00Hlf-LnPIWXoDxq6gwr9C0hYaidW8et X-Proofpoint-ORIG-GUID: 00Hlf-LnPIWXoDxq6gwr9C0hYaidW8et X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-08_05,2022-08-05_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Fill FC params routine now caters to only KASUMI & FC_GEN. Call appropriate functions directly. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cnxk_se.h | 51 +++++++++++------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 2c44dba9a0..c176cda0b1 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -1852,36 +1852,9 @@ cpt_kasumi_dec_prep(uint64_t d_offs, uint64_t d_lens, return 0; } -static __rte_always_inline int -cpt_fc_dec_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, - struct roc_se_fc_params *fc_params, - struct cpt_inst_s *inst) -{ - struct roc_se_ctx *ctx = fc_params->ctx_buf.vaddr; - uint8_t fc_type; - int ret = -1; - - fc_type = ctx->fc_type; - - if (likely(fc_type == ROC_SE_FC_GEN)) { - ret = cpt_dec_hmac_prep(flags, d_offs, d_lens, fc_params, inst); - } else if (fc_type == ROC_SE_KASUMI) { - ret = cpt_kasumi_dec_prep(d_offs, d_lens, fc_params, inst); - } - - /* - * For AUTH_ONLY case, - * MC only supports digest generation and verification - * should be done in software by memcmp() - */ - - return ret; -} - static __rte_always_inline int cpt_fc_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, - struct roc_se_fc_params *fc_params, - struct cpt_inst_s *inst) + struct roc_se_fc_params *fc_params, struct cpt_inst_s *inst) { struct roc_se_ctx *ctx = fc_params->ctx_buf.vaddr; uint8_t fc_type; @@ -2600,8 +2573,8 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } } - if (unlikely(!((flags & ROC_SE_SINGLE_BUF_INPLACE) && - (flags & ROC_SE_SINGLE_BUF_HEADROOM) && !is_kasumi))) { + if (unlikely(is_kasumi || !((flags & ROC_SE_SINGLE_BUF_INPLACE) && + (flags & ROC_SE_SINGLE_BUF_HEADROOM)))) { mdata = alloc_op_meta(&fc_params.meta_buf, m_info->mlen, m_info->pool, infl_req); if (mdata == NULL) { plt_dp_err("Error allocating meta buffer for request"); @@ -2610,12 +2583,18 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } /* Finally prepare the instruction */ - if (cpt_op & ROC_SE_OP_ENCODE) - ret = cpt_fc_enc_hmac_prep(flags, d_offs, d_lens, &fc_params, - inst); - else - ret = cpt_fc_dec_hmac_prep(flags, d_offs, d_lens, &fc_params, - inst); + + if (is_kasumi) { + if (cpt_op & ROC_SE_OP_ENCODE) + ret = cpt_kasumi_enc_prep(flags, d_offs, d_lens, &fc_params, inst); + else + ret = cpt_kasumi_dec_prep(d_offs, d_lens, &fc_params, inst); + } else { + if (cpt_op & ROC_SE_OP_ENCODE) + ret = cpt_enc_hmac_prep(flags, d_offs, d_lens, &fc_params, inst); + else + ret = cpt_dec_hmac_prep(flags, d_offs, d_lens, &fc_params, inst); + } if (unlikely(ret)) { plt_dp_err("Preparing request failed due to bad input arg"); -- 2.25.1