From patchwork Fri Apr 28 14:46:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 126632 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7D7142A12; Fri, 28 Apr 2023 16:47:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B26DE42FA6; Fri, 28 Apr 2023 16:47:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 40B5042FA0 for ; Fri, 28 Apr 2023 16:47:14 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33SEOJaV007109 for ; Fri, 28 Apr 2023 07:47:13 -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=bJ1XhQIYmOZ+vVE4afW/N7JBYfDVj2zj3KGgUeAT+IE=; b=ZJaU0Nj1w4dsPLLlIGwKv69bZglQdKxEarnX7Q8YvzO/8q7T+/lw0RQ37bUsWL0Ka6O8 0eMYT7oVn7FWK+MzLPfD8W05A9M8c+aS7mTv2gXkdlEoE3JIFZRat6nS9/tH1Qgg32ZP QqzPTQbW9iJxvhN3FiWTPMtDPkiZyGMh9kPhaXZvUqIiZ6Q2VteX0wxyRFqtzPOhIrI+ ia7dv63WZXu37m4FSJFo8L0eMiwD6BF+5KnQiUSYUWFleO1p3QqY+J84ShCiCew4QeuV 7cf4V4YVJgR7wSA2+DghjmPmOTWXUoQ8No8ECDcUYRj6KykOmWgXD7bxVDu71+WdppRf Sg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q781hydy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 28 Apr 2023 07:47:13 -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.48; Fri, 28 Apr 2023 07:47:11 -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.48 via Frontend Transport; Fri, 28 Apr 2023 07:47:11 -0700 Received: from HY-LT1085.marvell.com (unknown [10.193.84.114]) by maili.marvell.com (Postfix) with ESMTP id 660575B692C; Fri, 28 Apr 2023 07:47:08 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Jerin Jacob , Aakash Sasidharan , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Subject: [PATCH 5/7] crypto/cnxk: set local variables to template value Date: Fri, 28 Apr 2023 20:16:45 +0530 Message-ID: <20230428144647.1072-6-ktejasree@marvell.com> X-Mailer: git-send-email 2.40.1.windows.1 In-Reply-To: <20230428144647.1072-1-ktejasree@marvell.com> References: <20230428144647.1072-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: AnS_0JWt7pJ2MbIxmHkQEeaFw98EMLEs X-Proofpoint-ORIG-GUID: AnS_0JWt7pJ2MbIxmHkQEeaFw98EMLEs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-28_04,2023-04-27_01,2023-02-09_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 Initializing local variable from the template populated in control path. Signed-off-by: Tejasree Kondoj --- drivers/crypto/cnxk/cnxk_se.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 2c465a5ab9..8715493cae 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -607,8 +607,7 @@ cpt_digest_gen_sg_ver1_prep(uint32_t flags, uint64_t d_lens, struct roc_se_fc_pa key_len = ctx->auth_key_len; data_len = ROC_SE_AUTH_DLEN(d_lens); - /*GP op header */ - cpt_inst_w4.s.opcode_minor = 0; + cpt_inst_w4.u64 = ctx->template_w4.u64; cpt_inst_w4.s.param2 = ((uint16_t)hash_type << 8) | mac_len; if (ctx->hmac) { cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_HMAC | ROC_DMA_MODE_SG; @@ -724,8 +723,7 @@ cpt_digest_gen_sg_ver2_prep(uint32_t flags, uint64_t d_lens, struct roc_se_fc_pa key_len = ctx->auth_key_len; data_len = ROC_SE_AUTH_DLEN(d_lens); - /*GP op header */ - cpt_inst_w4.s.opcode_minor = 0; + cpt_inst_w4.u64 = ctx->template_w4.u64; cpt_inst_w4.s.param2 = ((uint16_t)hash_type << 8) | mac_len; if (ctx->hmac) { cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_HMAC; @@ -1049,7 +1047,8 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, cipher_type = se_ctx->enc_cipher; hash_type = se_ctx->hash_type; mac_len = se_ctx->mac_len; - op_minor = se_ctx->template_w4.s.opcode_minor; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; + op_minor = cpt_inst_w4.s.opcode_minor; if (unlikely(!(flags & ROC_SE_VALID_IV_BUF))) { iv_len = 0; @@ -1080,8 +1079,7 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, /* Encryption */ cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_FC; - cpt_inst_w4.s.opcode_minor = ROC_SE_FC_MINOR_OP_ENCRYPT; - cpt_inst_w4.s.opcode_minor |= (uint64_t)op_minor; + cpt_inst_w4.s.opcode_minor |= ROC_SE_FC_MINOR_OP_ENCRYPT; if (hash_type == ROC_SE_GMAC_TYPE) { encr_offset = 0; @@ -1112,7 +1110,6 @@ cpt_enc_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, if (op_minor & ROC_SE_FC_MINOR_OP_HMAC_FIRST) outputlen = enc_dlen; - /* GP op header */ cpt_inst_w4.s.param1 = encr_data_len; cpt_inst_w4.s.param2 = auth_data_len; @@ -1219,7 +1216,8 @@ cpt_dec_hmac_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, se_ctx = fc_params->ctx; hash_type = se_ctx->hash_type; mac_len = se_ctx->mac_len; - op_minor = se_ctx->template_w4.s.opcode_minor; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; + op_minor = cpt_inst_w4.s.opcode_minor; if (unlikely(!(flags & ROC_SE_VALID_IV_BUF))) { iv_len = 0; @@ -1390,8 +1388,8 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, return -1; } + cpt_inst_w4.u64 = se_ctx->template_w4.u64; cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_PDCP_CHAIN; - cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; cpt_inst_w4.s.param1 = auth_data_len; cpt_inst_w4.s.param2 = 0; @@ -1475,8 +1473,8 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, flags = se_ctx->zsk_flags; mac_len = se_ctx->mac_len; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; cpt_inst_w4.s.opcode_major = ROC_SE_MAJOR_OP_PDCP; - cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; if (flags == 0x1) { iv_s = params->auth_iv_buf; @@ -1563,7 +1561,7 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, } /* - * GP op header, lengths are expected in bits. + * Lengths are expected in bits. */ cpt_inst_w4.s.param1 = encr_data_len; cpt_inst_w4.s.param2 = auth_data_len; @@ -1637,6 +1635,7 @@ cpt_kasumi_enc_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, mac_len = se_ctx->mac_len; dir = iv_s[8] & 0x1; + cpt_inst_w4.u64 = se_ctx->template_w4.u64; if (flags == 0x0) { /* Consider IV len */ @@ -1712,7 +1711,7 @@ cpt_kasumi_dec_prep(uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_params *p ((1 << 6) | (se_ctx->k_ecb << 5) | (dir << 4) | (0 << 3) | (flags & 0x7)); /* - * GP op header, lengths are expected in bits. + * Lengths are expected in bits. */ cpt_inst_w4.s.param1 = encr_data_len;