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 8BC64A00C2; Tue, 9 Aug 2022 12:55:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4AEA942C2F; Tue, 9 Aug 2022 12:54:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E9B0742BBA for ; Tue, 9 Aug 2022 12:54:26 +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 2791T66F017193 for ; Tue, 9 Aug 2022 03:54:26 -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=iov3QG+i9R6z+G6aagRW5EAdN3cD+ASTPQV4VrwtfVU=; b=QsawMnmM1RT6oVT9+xf2mSZnJuTWu7kGsUqteYGSeVwUL4BUImqYiB2ewMYb0OrL5dcr hGGJ7FraWWIV42+koW8RvoMJuDD58yLtwEEGkC3+u1M6lJdNO/nvJCcXcH5OEz5IqlYm k8BrSqr9D11x40+w9FVvOBedaRgG+XKFP+oisN3Gde3hul6Pb5y5jyAg+vPyjHMAIbZl EsKoSnGYDtVKT1UqH3UIfS/fR2XMGSePHNEPkoWKNStFpCZvg8q9zpj9JqlgdqV9n5AA 8gTTlDUjczX1jZwB60tUMlfG+BFXUUyg5bSOxElpNr1OjSDWihoUb3nkPoVDEFeAEXBy qA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hudy6sphy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 09 Aug 2022 03:54:26 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 9 Aug 2022 03:54:22 -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; Tue, 9 Aug 2022 03:54:23 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.69.70]) by maili.marvell.com (Postfix) with ESMTP id F1FD93F7048; Tue, 9 Aug 2022 03:54:20 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Archana Muniganti , Tejasree Kondoj , Subject: [PATCH v2 09/18] crypto/cnxk: remove extra indirection for FC and Kasumi Date: Tue, 9 Aug 2022 16:23:47 +0530 Message-ID: <20220809105356.561-10-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220809105356.561-1-anoobj@marvell.com> References: <20220808080606.220-1-anoobj@marvell.com> <20220809105356.561-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: by8M1Koaiukbm8nKwcs3aT-ala4XC5HE X-Proofpoint-ORIG-GUID: by8M1Koaiukbm8nKwcs3aT-ala4XC5HE 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-09_03,2022-08-09_02,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 | 55 +++++++++++------------------------ 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 2c44dba9a0..64100e8376 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; @@ -2425,6 +2398,8 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.auth_iv_len = 0; fc_params.auth_iv_buf = NULL; fc_params.iv_buf = NULL; + fc_params.mac_buf.size = 0; + fc_params.mac_buf.vaddr = 0; if (likely(sess->iv_length)) { flags |= ROC_SE_VALID_IV_BUF; @@ -2486,8 +2461,6 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } fc_params.iv_buf = PLT_PTR_ADD(salt, 4); - fc_params.mac_buf.size = 0; - fc_params.mac_buf.vaddr = NULL; m = cpt_m_dst_get(cpt_op, m_src, m_dst); /* Digest immediately following data is best case */ @@ -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