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 93CA3454AB; Thu, 20 Jun 2024 17:00:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B83542E97; Thu, 20 Jun 2024 16:59:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 9101E42EB6 for ; Thu, 20 Jun 2024 16:59:30 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KASrGx027629 for ; Thu, 20 Jun 2024 07:59:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=j cif+WxeU4jjzNUCkGATxOk+hLTsckyNLKZBmXGs9xw=; b=ak4Hj2dSyyDdSY5pG 3OPjY6V06Vc4ENIhhzmW5+u6Ac502gRkxJRf/lqzfGatau6y0FCuyEU+8paVKihC zqrhB08KRi/nxeLI2JF6k4RK3kmaNClV94+u6LxqmlZ3OoQqBUxmeWoD16zpt7Dy K1QFjE0SbL8j8E1gbbDFkuqbAbAU1aQn/UGVvsthHA1kx4z7CSdZgdWAZqADlXYz ChZceTVolKw+h0AebtxD55Jp7mPbnhf4EfwDYEupR5689untGufJwnQSHK2A8sn2 9m767ZL8djvpoIfZSln9hqop0fkP1WG7Sl2ebtlVCD7PflxnHMkJVHA0jpzjLqcd RL1fw== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yvjq0h337-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 20 Jun 2024 07:59:29 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:59:28 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:59:28 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 0CDF03F7043; Thu, 20 Jun 2024 07:59:25 -0700 (PDT) From: Aakash Sasidharan To: Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj CC: , , , , Subject: [PATCH 11/12] crypto/cnxk: make pack IV variable as const Date: Thu, 20 Jun 2024 20:28:47 +0530 Message-ID: <20240620145848.3461844-12-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145848.3461844-1-asasidharan@marvell.com> References: <20240620145848.3461844-1-asasidharan@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 9_8REIu4BOPuBwZrp9Cwg0-oTvh_Qeda X-Proofpoint-GUID: 9_8REIu4BOPuBwZrp9Cwg0-oTvh_Qeda X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_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 From: Anoob Joseph Make 'pack_iv' variable as const to avoid multiple checks. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cnxk_se.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 63dbef4411..dbd36a8a54 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -105,7 +105,7 @@ cpt_pack_iv(uint8_t *iv_src, uint8_t *iv_dst) } static inline void -pdcp_iv_copy(uint8_t *iv_d, const uint8_t *iv_s, const uint8_t pdcp_alg_type, uint8_t pack_iv) +pdcp_iv_copy(uint8_t *iv_d, const uint8_t *iv_s, const uint8_t pdcp_alg_type, const bool pack_iv) { const uint32_t *iv_s_temp; uint32_t iv_temp[4]; @@ -261,7 +261,7 @@ cpt_mac_len_verify(struct rte_crypto_auth_xform *auth) static __rte_always_inline int sg_inst_prep(struct roc_se_fc_params *params, struct cpt_inst_s *inst, uint64_t offset_ctrl, - const uint8_t *iv_s, int iv_len, uint8_t pack_iv, uint8_t pdcp_alg_type, + const uint8_t *iv_s, int iv_len, const bool pack_iv, uint8_t pdcp_alg_type, int32_t inputlen, int32_t outputlen, uint32_t passthrough_len, uint32_t req_flags, int pdcp_flag, int decrypt) { @@ -457,7 +457,7 @@ sg_inst_prep(struct roc_se_fc_params *params, struct cpt_inst_s *inst, uint64_t static __rte_always_inline int sg2_inst_prep(struct roc_se_fc_params *params, struct cpt_inst_s *inst, uint64_t offset_ctrl, - const uint8_t *iv_s, int iv_len, uint8_t pack_iv, uint8_t pdcp_alg_type, + const uint8_t *iv_s, int iv_len, const bool pack_iv, uint8_t pdcp_alg_type, int32_t inputlen, int32_t outputlen, uint32_t passthrough_len, uint32_t req_flags, int pdcp_flag, int decrypt) { @@ -882,7 +882,7 @@ static inline int pdcp_chain_sg1_prep(struct roc_se_fc_params *params, struct roc_se_ctx *cpt_ctx, struct cpt_inst_s *inst, union cpt_inst_w4 w4, int32_t inputlen, uint8_t hdr_len, uint64_t offset_ctrl, uint32_t req_flags, - const uint8_t *cipher_iv, const uint8_t *auth_iv, const int pack_iv, + const uint8_t *cipher_iv, const uint8_t *auth_iv, const bool pack_iv, const uint8_t pdcp_ci_alg, const uint8_t pdcp_auth_alg) { struct roc_sglist_comp *scatter_comp, *gather_comp; @@ -991,7 +991,7 @@ static inline int pdcp_chain_sg2_prep(struct roc_se_fc_params *params, struct roc_se_ctx *cpt_ctx, struct cpt_inst_s *inst, union cpt_inst_w4 w4, int32_t inputlen, uint8_t hdr_len, uint64_t offset_ctrl, uint32_t req_flags, - const uint8_t *cipher_iv, const uint8_t *auth_iv, const int pack_iv, + const uint8_t *cipher_iv, const uint8_t *auth_iv, const bool pack_iv, const uint8_t pdcp_ci_alg, const uint8_t pdcp_auth_alg) { struct roc_sg2list_comp *gather_comp, *scatter_comp; @@ -1528,7 +1528,6 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_ctx *se_ctx; uint64_t *offset_vaddr; uint64_t offset_ctrl; - uint8_t pack_iv = 0; int32_t inputlen; void *dm_vaddr; uint8_t *iv_d; @@ -1606,10 +1605,10 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, cpt_inst_w4.s.dlen = inputlen + ROC_SE_OFF_CTRL_LEN; iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN); - pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, pack_iv); + pdcp_iv_copy(iv_d, cipher_iv, pdcp_ci_alg, false); iv_d = ((uint8_t *)offset_vaddr + ROC_SE_OFF_CTRL_LEN + pdcp_iv_off); - pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, pack_iv); + pdcp_iv_copy(iv_d, auth_iv, pdcp_auth_alg, false); inst->w4.u64 = cpt_inst_w4.u64; return 0; @@ -1618,11 +1617,11 @@ cpt_pdcp_chain_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, if (is_sg_ver2) return pdcp_chain_sg2_prep(params, se_ctx, inst, cpt_inst_w4, inputlen, hdr_len, offset_ctrl, req_flags, cipher_iv, - auth_iv, pack_iv, pdcp_ci_alg, pdcp_auth_alg); + auth_iv, false, pdcp_ci_alg, pdcp_auth_alg); else return pdcp_chain_sg1_prep(params, se_ctx, inst, cpt_inst_w4, inputlen, hdr_len, offset_ctrl, req_flags, cipher_iv, - auth_iv, pack_iv, pdcp_ci_alg, pdcp_auth_alg); + auth_iv, false, pdcp_ci_alg, pdcp_auth_alg); } } @@ -1647,9 +1646,9 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, uint64_t *offset_vaddr; uint8_t pdcp_alg_type; uint32_t mac_len = 0; - const uint8_t *iv_s; - uint8_t pack_iv = 0; uint64_t offset_ctrl; + bool pack_iv = false; + const uint8_t *iv_s; int ret; mac_len = se_ctx->mac_len; @@ -1671,7 +1670,7 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, if (pdcp_alg_type != ROC_SE_PDCP_ALG_TYPE_AES_CMAC) { if (params->auth_iv_len == 25) - pack_iv = 1; + pack_iv = true; auth_offset = auth_offset / 8; auth_data_len = RTE_ALIGN(auth_data_len, 8) / 8; @@ -1694,7 +1693,7 @@ cpt_pdcp_alg_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, pdcp_alg_type = se_ctx->pdcp_ci_alg; if (params->cipher_iv_len == 25) - pack_iv = 1; + pack_iv = true; /* * Microcode expects offsets in bytes -- 2.25.1