From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD453A054C for ; Fri, 14 Feb 2020 18:06:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BC975262E; Fri, 14 Feb 2020 18:06:27 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 4B2421B53 for ; Fri, 14 Feb 2020 18:06:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581699985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=duqvz7czuG5/KzU2wwJOXkoecc6G0IILjfbWSuNNmlE=; b=e0+rAZLr6vZasXZ+QeOHsUwugDsbNaoyH05C6PT5JJGGuDVe9682FNFWBtEPkjC7EBhl7i wa0pFUOxG4xLvVlvoFCmA8dV11PiN3a5/yiB8VPlcoiZYetI/iTCqpUSlDpDLt6LB3gTh8 WVNCks6yQ2oPLidqspgRQ2rsY7TbmKk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-mCnMoXWVNeOO6nQha9TH8g-1; Fri, 14 Feb 2020 12:06:18 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 143E918C35A1; Fri, 14 Feb 2020 17:06:17 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1323589F3C; Fri, 14 Feb 2020 17:06:12 +0000 (UTC) From: Kevin Traynor To: Anoob Joseph Cc: dpdk stable Date: Fri, 14 Feb 2020 17:03:32 +0000 Message-Id: <20200214170337.25093-38-ktraynor@redhat.com> In-Reply-To: <20200214170337.25093-1-ktraynor@redhat.com> References: <20200214170337.25093-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: mCnMoXWVNeOO6nQha9TH8g-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'common/cpt: remove redundant code in datapath' has been queued to LTS release 18.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/c1a928606a5874be10= af5fa0bfa98f4ec57b34d8 Thanks. Kevin. --- >From c1a928606a5874be10af5fa0bfa98f4ec57b34d8 Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Sat, 6 Jul 2019 18:53:40 +0530 Subject: [PATCH] common/cpt: remove redundant code in datapath [ upstream commit 8de5ede7b61d9b1af40485755cfcd2d525a6c816 ] Removing redundant checks and unused local variables from datapath. Signed-off-by: Anoob Joseph --- drivers/common/cpt/cpt_ucode.h | 133 ++++++++------------------------- 1 file changed, 33 insertions(+), 100 deletions(-) diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.= h index f0632caf6a..3982239004 100644 --- a/drivers/common/cpt/cpt_ucode.h +++ b/drivers/common/cpt/cpt_ucode.h @@ -90,6 +90,5 @@ cpt_fc_ciph_validate_key_aes(uint16_t key_len) =20 static __rte_always_inline int -cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt_ctx *cpt_ctx, -=09=09uint16_t key_len) +cpt_fc_ciph_set_type(cipher_type_t type, struct cpt_ctx *ctx, uint16_t key= _len) { =09int fc_type =3D 0; @@ -126,5 +125,5 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt= _ctx *cpt_ctx, =09=09=09return -1; =09=09/* No support for AEAD yet */ -=09=09if (unlikely(cpt_ctx->hash_type)) +=09=09if (unlikely(ctx->hash_type)) =09=09=09return -1; =09=09fc_type =3D ZUC_SNOW3G; @@ -135,5 +134,5 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt= _ctx *cpt_ctx, =09=09=09return -1; =09=09/* No support for AEAD yet */ -=09=09if (unlikely(cpt_ctx->hash_type)) +=09=09if (unlikely(ctx->hash_type)) =09=09=09return -1; =09=09fc_type =3D KASUMI; @@ -142,5 +141,7 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt= _ctx *cpt_ctx, =09=09return -1; =09} -=09return fc_type; + +=09ctx->fc_type =3D fc_type; +=09return 0; } =20 @@ -182,5 +183,4 @@ cpt_fc_ciph_set_key_snow3g_uea2(struct cpt_ctx *cpt_ctx= , uint8_t *key, =09gen_key_snow3g(key, keyx); =09memcpy(cpt_ctx->zs_ctx.ci_key, keyx, key_len); -=09cpt_ctx->fc_type =3D ZUC_SNOW3G; =09cpt_ctx->zsk_flags =3D 0; } @@ -193,5 +193,4 @@ cpt_fc_ciph_set_key_zuc_eea3(struct cpt_ctx *cpt_ctx, u= int8_t *key, =09memcpy(cpt_ctx->zs_ctx.ci_key, key, key_len); =09memcpy(cpt_ctx->zs_ctx.zuc_const, zuc_d, 32); -=09cpt_ctx->fc_type =3D ZUC_SNOW3G; =09cpt_ctx->zsk_flags =3D 0; } @@ -204,5 +203,4 @@ cpt_fc_ciph_set_key_kasumi_f8_ecb(struct cpt_ctx *cpt_c= tx, uint8_t *key, =09memcpy(cpt_ctx->k_ctx.ci_key, key, key_len); =09cpt_ctx->zsk_flags =3D 0; -=09cpt_ctx->fc_type =3D KASUMI; } =20 @@ -213,5 +211,4 @@ cpt_fc_ciph_set_key_kasumi_f8_cbc(struct cpt_ctx *cpt_c= tx, uint8_t *key, =09memcpy(cpt_ctx->k_ctx.ci_key, key, key_len); =09cpt_ctx->zsk_flags =3D 0; -=09cpt_ctx->fc_type =3D KASUMI; } =20 @@ -223,13 +220,11 @@ cpt_fc_ciph_set_key(void *ctx, cipher_type_t type, ui= nt8_t *key, =09mc_fc_context_t *fctx =3D &cpt_ctx->fctx; =09uint64_t *ctrl_flags =3D NULL; -=09int fc_type; +=09int ret; =20 -=09/* Validate key before proceeding */ -=09fc_type =3D cpt_fc_ciph_validate_key(type, cpt_ctx, key_len); -=09if (unlikely(fc_type =3D=3D -1)) +=09ret =3D cpt_fc_ciph_set_type(type, cpt_ctx, key_len); +=09if (unlikely(ret)) =09=09return -1; =20 -=09if (fc_type =3D=3D FC_GEN) { -=09=09cpt_ctx->fc_type =3D FC_GEN; +=09if (cpt_ctx->fc_type =3D=3D FC_GEN) { =09=09ctrl_flags =3D (uint64_t *)&(fctx->enc.enc_ctrl.flags); =09=09*ctrl_flags =3D rte_be_to_cpu_64(*ctrl_flags); @@ -469,5 +464,4 @@ cpt_digest_gen_prep(uint32_t flags, =09struct cpt_request_info *req; =09uint32_t size, i; -=09int32_t m_size; =09uint16_t data_len, mac_len, key_len; =09auth_type_t hash_type; @@ -499,5 +493,4 @@ cpt_digest_gen_prep(uint32_t flags, =09m_vaddr =3D meta_p->vaddr; =09m_dma =3D meta_p->dma_addr; -=09m_size =3D meta_p->size; =20 =09/* @@ -515,5 +508,4 @@ cpt_digest_gen_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09req =3D m_vaddr; @@ -522,5 +514,4 @@ cpt_digest_gen_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09hash_type =3D ctx->hash_type; @@ -635,5 +626,4 @@ cpt_digest_gen_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* cpt alternate completion address saved earlier */ @@ -693,5 +683,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09void *c_vaddr; =09uint64_t c_dma; -=09int32_t m_size; =09opcode_info_t opcode; =20 @@ -699,5 +688,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09m_vaddr =3D meta_p->vaddr; =09m_dma =3D meta_p->dma_addr; -=09m_size =3D meta_p->size; =20 =09encr_offset =3D ENCR_OFFSET(d_offs); @@ -735,5 +723,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* start cpt request info struct at 8 byte boundary */ @@ -746,5 +733,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09if (hash_type =3D=3D GMAC_TYPE) @@ -866,5 +852,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09opcode.s.major |=3D CPT_DMA_MODE; @@ -1014,5 +999,4 @@ cpt_enc_hmac_prep(uint32_t flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09/* cpt alternate completion address saved earlier */ @@ -1064,5 +1048,5 @@ cpt_dec_hmac_prep(uint32_t flags, =09int32_t inputlen, outputlen, enc_dlen, auth_dlen; =09struct cpt_ctx *cpt_ctx; -=09int32_t hash_type, mac_len, m_size; +=09int32_t hash_type, mac_len; =09uint8_t iv_len =3D 16; =09struct cpt_request_info *req; @@ -1082,5 +1066,4 @@ cpt_dec_hmac_prep(uint32_t flags, =09m_vaddr =3D meta_p->vaddr; =09m_dma =3D meta_p->dma_addr; -=09m_size =3D meta_p->size; =20 =09encr_offset =3D ENCR_OFFSET(d_offs); @@ -1148,5 +1131,4 @@ cpt_dec_hmac_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* start cpt request info structure at 8 byte alignment */ @@ -1159,5 +1141,4 @@ cpt_dec_hmac_prep(uint32_t flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* Decryption */ @@ -1246,5 +1227,4 @@ cpt_dec_hmac_prep(uint32_t flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09opcode.s.major |=3D CPT_DMA_MODE; @@ -1395,5 +1375,4 @@ cpt_dec_hmac_prep(uint32_t flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09/* cpt alternate completion address saved earlier */ @@ -1452,5 +1431,5 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09uint32_t encr_offset =3D 0, auth_offset =3D 0; =09uint32_t encr_data_len =3D 0, auth_data_len =3D 0; -=09int flags, iv_len =3D 16, m_size; +=09int flags, iv_len =3D 16; =09void *m_vaddr, *c_vaddr; =09uint64_t m_dma, c_dma, offset_ctrl; @@ -1464,5 +1443,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09m_vaddr =3D buf_p->vaddr; =09m_dma =3D buf_p->dma_addr; -=09m_size =3D buf_p->size; =20 =09cpt_ctx =3D params->ctx_buf.vaddr; @@ -1486,5 +1464,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* Reserve memory for cpt request info */ @@ -1494,5 +1471,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09opcode.s.major =3D CPT_MAJOR_OP_ZUC_SNOW3G; @@ -1618,5 +1594,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len; =09=09m_dma +=3D OFF_CTRL_LEN + iv_len; -=09=09m_size -=3D OFF_CTRL_LEN + iv_len; =20 =09=09opcode.s.major |=3D CPT_DMA_MODE; @@ -1719,5 +1694,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09/* cpt alternate completion address saved earlier */ @@ -1773,5 +1747,5 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09uint32_t encr_offset; =09uint32_t encr_data_len; -=09int flags, m_size; +=09int flags; =09void *m_vaddr, *c_vaddr; =09uint64_t m_dma, c_dma; @@ -1785,5 +1759,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09m_vaddr =3D buf_p->vaddr; =09m_dma =3D buf_p->dma_addr; -=09m_size =3D buf_p->size; =20 =09/* @@ -1812,5 +1785,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* Reserve memory for cpt request info */ @@ -1820,5 +1792,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09opcode.s.major =3D CPT_MAJOR_OP_ZUC_SNOW3G; @@ -1910,5 +1881,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len; =09=09m_dma +=3D OFF_CTRL_LEN + iv_len; -=09=09m_size -=3D OFF_CTRL_LEN + iv_len; =20 =09=09opcode.s.major |=3D CPT_DMA_MODE; @@ -1987,5 +1957,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, =09=09m_vaddr =3D (uint8_t *)m_vaddr + size; =09=09m_dma +=3D size; -=09=09m_size -=3D size; =20 =09=09/* cpt alternate completion address saved earlier */ @@ -2042,5 +2011,5 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09uint32_t encr_offset, auth_offset; =09uint32_t encr_data_len, auth_data_len; -=09int flags, m_size; +=09int flags; =09uint8_t *iv_s, *iv_d, iv_len =3D 8; =09uint8_t dir =3D 0; @@ -2060,5 +2029,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09m_vaddr =3D buf_p->vaddr; =09m_dma =3D buf_p->dma_addr; -=09m_size =3D buf_p->size; =20 =09encr_offset =3D ENCR_OFFSET(d_offs) / 8; @@ -2093,5 +2061,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* Reserve memory for cpt request info */ @@ -2101,5 +2068,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09opcode.s.major =3D CPT_MAJOR_OP_KASUMI | CPT_DMA_MODE; @@ -2129,5 +2095,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len; =09m_dma +=3D OFF_CTRL_LEN + iv_len; -=09m_size -=3D OFF_CTRL_LEN + iv_len; =20 =09/* DPTR has SG list */ @@ -2237,5 +2202,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* cpt alternate completion address saved earlier */ @@ -2289,5 +2253,5 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09uint32_t encr_offset; =09uint32_t encr_data_len; -=09int flags, m_size; +=09int flags; =09uint8_t dir =3D 0; =09void *m_vaddr, *c_vaddr; @@ -2306,5 +2270,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09m_vaddr =3D buf_p->vaddr; =09m_dma =3D buf_p->dma_addr; -=09m_size =3D buf_p->size; =20 =09encr_offset =3D ENCR_OFFSET(d_offs) / 8; @@ -2328,5 +2291,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* Reserve memory for cpt request info */ @@ -2336,5 +2298,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09opcode.s.major =3D CPT_MAJOR_OP_KASUMI | CPT_DMA_MODE; @@ -2363,5 +2324,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09m_vaddr =3D (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len; =09m_dma +=3D OFF_CTRL_LEN + iv_len; -=09m_size -=3D OFF_CTRL_LEN + iv_len; =20 =09/* DPTR has SG list */ @@ -2432,5 +2392,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, =09m_vaddr =3D (uint8_t *)m_vaddr + size; =09m_dma +=3D size; -=09m_size -=3D size; =20 =09/* cpt alternate completion address saved earlier */ @@ -2629,7 +2588,7 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, =09auth_type_t auth_type =3D 0; /* NULL Auth type */ =09uint32_t cipher_key_len =3D 0; -=09uint8_t zsk_flag =3D 0, aes_gcm =3D 0; +=09uint8_t aes_gcm =3D 0; =09aead_form =3D &xform->aead; -=09void *ctx; +=09void *ctx =3D SESS_PRIV(sess); =20 =09if (aead_form->op =3D=3D RTE_CRYPTO_AEAD_OP_ENCRYPT && @@ -2665,5 +2624,5 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, =09=09return -1; =09} -=09sess->zsk_flag =3D zsk_flag; +=09sess->zsk_flag =3D 0; =09sess->aes_gcm =3D aes_gcm; =09sess->mac_len =3D aead_form->digest_length; @@ -2671,5 +2630,4 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, =09sess->iv_length =3D aead_form->iv.length; =09sess->aad_length =3D aead_form->aad_length; -=09ctx =3D (void *)((uint8_t *)sess + sizeof(struct cpt_sess_misc)), =20 =09cpt_fc_ciph_set_key(ctx, enc_type, aead_form->key.data, @@ -2688,8 +2646,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, =09cipher_type_t enc_type =3D 0; /* NULL Cipher type */ =09uint32_t cipher_key_len =3D 0; -=09uint8_t zsk_flag =3D 0, aes_gcm =3D 0, aes_ctr =3D 0, is_null =3D 0; - -=09if (xform->type !=3D RTE_CRYPTO_SYM_XFORM_CIPHER) -=09=09return -1; +=09uint8_t zsk_flag =3D 0, aes_ctr =3D 0, is_null =3D 0; =20 =09c_form =3D &xform->cipher; @@ -2773,5 +2728,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, =20 =09sess->zsk_flag =3D zsk_flag; -=09sess->aes_gcm =3D aes_gcm; +=09sess->aes_gcm =3D 0; =09sess->aes_ctr =3D aes_ctr; =09sess->iv_offset =3D c_form->iv.offset; @@ -2793,7 +2748,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, =09uint8_t zsk_flag =3D 0, aes_gcm =3D 0, is_null =3D 0; =20 -=09if (xform->type !=3D RTE_CRYPTO_SYM_XFORM_AUTH) -=09=09goto error_out; - =09a_form =3D &xform->auth; =20 @@ -2867,9 +2819,9 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, =09=09CPT_LOG_DP_ERR("Crypto: Unsupported hash algo %u", =09=09=09 a_form->algo); -=09=09goto error_out; +=09=09return -1; =09default: =09=09CPT_LOG_DP_ERR("Crypto: Undefined Hash algo %u specified", =09=09=09 a_form->algo); -=09=09goto error_out; +=09=09return -1; =09} =20 @@ -2886,7 +2838,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, =20 =09return 0; - -error_out: -=09return -1; } =20 @@ -2898,9 +2847,5 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, =09cipher_type_t enc_type =3D 0; /* NULL Cipher type */ =09auth_type_t auth_type =3D 0; /* NULL Auth type */ -=09uint8_t zsk_flag =3D 0, aes_gcm =3D 0; -=09void *ctx; - -=09if (xform->type !=3D RTE_CRYPTO_SYM_XFORM_AUTH) -=09=09return -1; +=09void *ctx =3D SESS_PRIV(sess); =20 =09a_form =3D &xform->auth; @@ -2926,11 +2871,10 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, =09} =20 -=09sess->zsk_flag =3D zsk_flag; -=09sess->aes_gcm =3D aes_gcm; +=09sess->zsk_flag =3D 0; +=09sess->aes_gcm =3D 0; =09sess->is_gmac =3D 1; =09sess->iv_offset =3D a_form->iv.offset; =09sess->iv_length =3D a_form->iv.length; =09sess->mac_len =3D a_form->digest_length; -=09ctx =3D (void *)((uint8_t *)sess + sizeof(struct cpt_sess_misc)), =20 =09cpt_fc_ciph_set_key(ctx, enc_type, a_form->key.data, @@ -3132,7 +3076,4 @@ fill_fc_params(struct rte_crypto_op *cop, =09struct rte_mbuf *m_src, *m_dst; =09uint8_t cpt_op =3D sess_misc->cpt_op; -=09uint8_t zsk_flag =3D sess_misc->zsk_flag; -=09uint8_t aes_gcm =3D sess_misc->aes_gcm; -=09uint16_t mac_len =3D sess_misc->mac_len; #ifdef CPT_ALWAYS_USE_SG_MODE =09uint8_t inplace =3D 0; @@ -3161,13 +3102,9 @@ fill_fc_params(struct rte_crypto_op *cop, =09} =20 -=09if (zsk_flag) { +=09if (sess_misc->zsk_flag) { =09=09fc_params.auth_iv_buf =3D rte_crypto_op_ctod_offset(cop, =09=09=09=09=09uint8_t *, =09=09=09=09=09sess_misc->auth_iv_offset); -=09=09if (zsk_flag =3D=3D K_F9) { -=09=09=09CPT_LOG_DP_ERR("Should not reach here for " -=09=09=09"kasumi F9\n"); -=09=09} -=09=09if (zsk_flag !=3D ZS_EA) +=09=09if (sess_misc->zsk_flag !=3D ZS_EA) =09=09=09inplace =3D 0; =09} @@ -3175,5 +3112,5 @@ fill_fc_params(struct rte_crypto_op *cop, =09m_dst =3D sym_op->m_dst; =20 -=09if (aes_gcm) { +=09if (sess_misc->aes_gcm) { =09=09uint8_t *salt; =09=09uint8_t *aad_data; @@ -3209,5 +3146,5 @@ fill_fc_params(struct rte_crypto_op *cop, =09=09} =09=09fc_params.iv_buf =3D salt + 4; -=09=09if (likely(mac_len)) { +=09=09if (likely(sess_misc->mac_len)) { =09=09=09struct rte_mbuf *m =3D (cpt_op & CPT_OP_ENCODE) ? m_dst : =09=09=09=09=09 m_src; @@ -3252,5 +3189,5 @@ fill_fc_params(struct rte_crypto_op *cop, =09=09=09fc_params.iv_buf =3D salt + 4; =09=09} -=09=09if (likely(mac_len)) { +=09=09if (likely(sess_misc->mac_len)) { =09=09=09struct rte_mbuf *m; =20 @@ -3311,5 +3248,4 @@ fill_fc_params(struct rte_crypto_op *cop, =20 =09=09=09/* Try to make room as much as src has */ -=09=09=09m_dst =3D sym_op->m_dst; =09=09=09pkt_len =3D rte_pktmbuf_pkt_len(m_dst); =20 @@ -3495,5 +3431,4 @@ fill_digest_params(struct rte_crypto_op *cop, =09struct rte_mbuf *m_src, *m_dst; =09uint16_t auth_op =3D sess->cpt_op & CPT_OP_AUTH_MASK; -=09uint8_t zsk_flag =3D sess->zsk_flag; =09uint16_t mac_len =3D sess->mac_len; =09fc_params_t params; @@ -3527,5 +3462,5 @@ fill_digest_params(struct rte_crypto_op *cop, =09flags =3D VALID_MAC_BUF; =09params.src_iov =3D (void *)src; -=09if (unlikely(zsk_flag)) { +=09if (unlikely(sess->zsk_flag)) { =09=09/* =09=09 * Since for Zuc, Kasumi, Snow3g offsets are in bits @@ -3537,8 +3472,7 @@ fill_digest_params(struct rte_crypto_op *cop, =09=09params.auth_iv_buf =3D rte_crypto_op_ctod_offset(cop, =09=09=09=09=09uint8_t *, sess->auth_iv_offset); -=09=09if (zsk_flag =3D=3D K_F9) { +=09=09if (sess->zsk_flag =3D=3D K_F9) { =09=09=09uint32_t length_in_bits, num_bytes; =09=09=09uint8_t *src, direction =3D 0; -=09=09=09uint32_t counter_num_bytes; =20 =09=09=09memcpy(iv_buf, rte_pktmbuf_mtod(cop->sym->m_src, @@ -3550,8 +3484,7 @@ fill_digest_params(struct rte_crypto_op *cop, =09=09=09length_in_bits =3D cop->sym->auth.data.length; =09=09=09num_bytes =3D (length_in_bits >> 3); -=09=09=09counter_num_bytes =3D num_bytes; =09=09=09src =3D rte_pktmbuf_mtod(cop->sym->m_src, uint8_t *); =09=09=09find_kasumif9_direction_and_length(src, -=09=09=09=09=09=09counter_num_bytes, +=09=09=09=09=09=09num_bytes, =09=09=09=09=09=09&length_in_bits, =09=09=09=09=09=09&direction); --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-14 17:02:39.169176522 +0000 +++ 0038-common-cpt-remove-redundant-code-in-datapath.patch=092020-02-14 17= :02:37.054405789 +0000 @@ -1 +1 @@ -From 8de5ede7b61d9b1af40485755cfcd2d525a6c816 Mon Sep 17 00:00:00 2001 +From c1a928606a5874be10af5fa0bfa98f4ec57b34d8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8de5ede7b61d9b1af40485755cfcd2d525a6c816 ] + @@ -14 +16 @@ -index 30610d5f9a..0992576639 100644 +index f0632caf6a..3982239004 100644 @@ -90 +92 @@ -@@ -468,5 +463,4 @@ cpt_digest_gen_prep(uint32_t flags, +@@ -469,5 +464,4 @@ cpt_digest_gen_prep(uint32_t flags, @@ -96 +98 @@ -@@ -489,5 +483,4 @@ cpt_digest_gen_prep(uint32_t flags, +@@ -499,5 +493,4 @@ cpt_digest_gen_prep(uint32_t flags, @@ -102 +104 @@ -@@ -505,5 +498,4 @@ cpt_digest_gen_prep(uint32_t flags, +@@ -515,5 +508,4 @@ cpt_digest_gen_prep(uint32_t flags, @@ -108 +110 @@ -@@ -512,5 +504,4 @@ cpt_digest_gen_prep(uint32_t flags, +@@ -522,5 +514,4 @@ cpt_digest_gen_prep(uint32_t flags, @@ -114 +116 @@ -@@ -626,5 +617,4 @@ cpt_digest_gen_prep(uint32_t flags, +@@ -635,5 +626,4 @@ cpt_digest_gen_prep(uint32_t flags, @@ -120 +122 @@ -@@ -679,5 +669,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -693,5 +683,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -126 +128 @@ -@@ -685,5 +674,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -699,5 +688,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -132 +134 @@ -@@ -721,5 +709,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -735,5 +723,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -138 +140 @@ -@@ -732,5 +719,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -746,5 +733,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -144 +146 @@ -@@ -852,5 +838,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -866,5 +852,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -150 +152 @@ -@@ -1004,5 +989,4 @@ cpt_enc_hmac_prep(uint32_t flags, +@@ -1014,5 +999,4 @@ cpt_enc_hmac_prep(uint32_t flags, @@ -156 +158 @@ -@@ -1048,5 +1032,5 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1064,5 +1048,5 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -163 +165 @@ -@@ -1066,5 +1050,4 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1082,5 +1066,4 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -169 +171 @@ -@@ -1132,5 +1115,4 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1148,5 +1131,4 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -175 +177 @@ -@@ -1143,5 +1125,4 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1159,5 +1141,4 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -181 +183 @@ -@@ -1230,5 +1211,4 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1246,5 +1227,4 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -187 +189 @@ -@@ -1394,5 +1374,4 @@ cpt_dec_hmac_prep(uint32_t flags, +@@ -1395,5 +1375,4 @@ cpt_dec_hmac_prep(uint32_t flags, @@ -193 +195 @@ -@@ -1445,5 +1424,5 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1452,5 +1431,5 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -200 +202 @@ -@@ -1457,5 +1436,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1464,5 +1443,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -206 +208 @@ -@@ -1479,5 +1457,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1486,5 +1464,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -212 +214 @@ -@@ -1487,5 +1464,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1494,5 +1471,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -218 +220 @@ -@@ -1611,5 +1587,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1618,5 +1594,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -224 +226 @@ -@@ -1721,5 +1696,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, +@@ -1719,5 +1694,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags, @@ -230 +232 @@ -@@ -1769,5 +1743,5 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1773,5 +1747,5 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -237 +239 @@ -@@ -1781,5 +1755,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1785,5 +1759,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -243 +245 @@ -@@ -1808,5 +1781,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1812,5 +1785,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -249 +251 @@ -@@ -1816,5 +1788,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1820,5 +1792,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -255 +257 @@ -@@ -1906,5 +1877,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1910,5 +1881,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -261 +263 @@ -@@ -1989,5 +1959,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, +@@ -1987,5 +1957,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags, @@ -267 +269 @@ -@@ -2038,5 +2007,5 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2042,5 +2011,5 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -274 +276 @@ -@@ -2056,5 +2025,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2060,5 +2029,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -280 +282 @@ -@@ -2089,5 +2057,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2093,5 +2061,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -286 +288 @@ -@@ -2097,5 +2064,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2101,5 +2068,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -292 +294 @@ -@@ -2125,5 +2091,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2129,5 +2095,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -298 +300 @@ -@@ -2242,5 +2207,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, +@@ -2237,5 +2202,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags, @@ -304 +306 @@ -@@ -2288,5 +2252,5 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2289,5 +2253,5 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -311 +313 @@ -@@ -2305,5 +2269,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2306,5 +2270,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -317 +319 @@ -@@ -2327,5 +2290,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2328,5 +2291,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -323 +325 @@ -@@ -2335,5 +2297,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2336,5 +2298,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -329 +331 @@ -@@ -2362,5 +2323,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2363,5 +2324,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -335 +337 @@ -@@ -2437,5 +2397,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, +@@ -2432,5 +2392,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs, @@ -341 +343 @@ -@@ -2616,7 +2575,7 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, +@@ -2629,7 +2588,7 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, @@ -351 +353 @@ -@@ -2652,5 +2611,5 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, +@@ -2665,5 +2624,5 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, @@ -358 +360 @@ -@@ -2658,5 +2617,4 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, +@@ -2671,5 +2630,4 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, @@ -364 +366 @@ -@@ -2675,8 +2633,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, +@@ -2688,8 +2646,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, @@ -374 +376 @@ -@@ -2760,5 +2715,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, +@@ -2773,5 +2728,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, @@ -381 +383 @@ -@@ -2780,7 +2735,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, +@@ -2793,7 +2748,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, @@ -389 +391 @@ -@@ -2854,9 +2806,9 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, +@@ -2867,9 +2819,9 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, @@ -401 +403 @@ -@@ -2873,7 +2825,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, +@@ -2886,7 +2838,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, @@ -409 +411 @@ -@@ -2885,9 +2834,5 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, +@@ -2898,9 +2847,5 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, @@ -420 +422 @@ -@@ -2913,11 +2858,10 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, +@@ -2926,11 +2871,10 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, @@ -434 +436 @@ -@@ -3119,7 +3063,4 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3132,7 +3076,4 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -442 +444 @@ -@@ -3147,13 +3088,9 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3161,13 +3102,9 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -458 +460 @@ -@@ -3161,5 +3098,5 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3175,5 +3112,5 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -465 +467 @@ -@@ -3195,5 +3132,5 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3209,5 +3146,5 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -472 +474 @@ -@@ -3238,5 +3175,5 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3252,5 +3189,5 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -479 +481 @@ -@@ -3297,5 +3234,4 @@ fill_fc_params(struct rte_crypto_op *cop, +@@ -3311,5 +3248,4 @@ fill_fc_params(struct rte_crypto_op *cop, @@ -485 +487 @@ -@@ -3490,5 +3426,4 @@ fill_digest_params(struct rte_crypto_op *cop, +@@ -3495,5 +3431,4 @@ fill_digest_params(struct rte_crypto_op *cop, @@ -491 +493 @@ -@@ -3521,5 +3456,5 @@ fill_digest_params(struct rte_crypto_op *cop, +@@ -3527,5 +3462,5 @@ fill_digest_params(struct rte_crypto_op *cop, @@ -498 +500 @@ -@@ -3531,8 +3466,7 @@ fill_digest_params(struct rte_crypto_op *cop, +@@ -3537,8 +3472,7 @@ fill_digest_params(struct rte_crypto_op *cop, @@ -508 +510 @@ -@@ -3544,8 +3478,7 @@ fill_digest_params(struct rte_crypto_op *cop, +@@ -3550,8 +3484,7 @@ fill_digest_params(struct rte_crypto_op *cop,