[dpdk-stable] patch 'common/cpt: remove redundant code in datapath' has been queued to LTS release 18.11.7

Kevin Traynor ktraynor at redhat.com
Fri Feb 14 18:03:32 CET 2020


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 rebasing
(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/c1a928606a5874be10af5fa0bfa98f4ec57b34d8

Thanks.

Kevin.

---
>From c1a928606a5874be10af5fa0bfa98f4ec57b34d8 Mon Sep 17 00:00:00 2001
From: Anoob Joseph <anoobj at marvell.com>
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 <anoobj at marvell.com>
---
 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)
 
 static __rte_always_inline int
-cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt_ctx *cpt_ctx,
-		uint16_t key_len)
+cpt_fc_ciph_set_type(cipher_type_t type, struct cpt_ctx *ctx, uint16_t key_len)
 {
 	int fc_type = 0;
@@ -126,5 +125,5 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt_ctx *cpt_ctx,
 			return -1;
 		/* No support for AEAD yet */
-		if (unlikely(cpt_ctx->hash_type))
+		if (unlikely(ctx->hash_type))
 			return -1;
 		fc_type = ZUC_SNOW3G;
@@ -135,5 +134,5 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt_ctx *cpt_ctx,
 			return -1;
 		/* No support for AEAD yet */
-		if (unlikely(cpt_ctx->hash_type))
+		if (unlikely(ctx->hash_type))
 			return -1;
 		fc_type = KASUMI;
@@ -142,5 +141,7 @@ cpt_fc_ciph_validate_key(cipher_type_t type, struct cpt_ctx *cpt_ctx,
 		return -1;
 	}
-	return fc_type;
+
+	ctx->fc_type = fc_type;
+	return 0;
 }
 
@@ -182,5 +183,4 @@ cpt_fc_ciph_set_key_snow3g_uea2(struct cpt_ctx *cpt_ctx, uint8_t *key,
 	gen_key_snow3g(key, keyx);
 	memcpy(cpt_ctx->zs_ctx.ci_key, keyx, key_len);
-	cpt_ctx->fc_type = ZUC_SNOW3G;
 	cpt_ctx->zsk_flags = 0;
 }
@@ -193,5 +193,4 @@ cpt_fc_ciph_set_key_zuc_eea3(struct cpt_ctx *cpt_ctx, uint8_t *key,
 	memcpy(cpt_ctx->zs_ctx.ci_key, key, key_len);
 	memcpy(cpt_ctx->zs_ctx.zuc_const, zuc_d, 32);
-	cpt_ctx->fc_type = ZUC_SNOW3G;
 	cpt_ctx->zsk_flags = 0;
 }
@@ -204,5 +203,4 @@ cpt_fc_ciph_set_key_kasumi_f8_ecb(struct cpt_ctx *cpt_ctx, uint8_t *key,
 	memcpy(cpt_ctx->k_ctx.ci_key, key, key_len);
 	cpt_ctx->zsk_flags = 0;
-	cpt_ctx->fc_type = KASUMI;
 }
 
@@ -213,5 +211,4 @@ cpt_fc_ciph_set_key_kasumi_f8_cbc(struct cpt_ctx *cpt_ctx, uint8_t *key,
 	memcpy(cpt_ctx->k_ctx.ci_key, key, key_len);
 	cpt_ctx->zsk_flags = 0;
-	cpt_ctx->fc_type = KASUMI;
 }
 
@@ -223,13 +220,11 @@ cpt_fc_ciph_set_key(void *ctx, cipher_type_t type, uint8_t *key,
 	mc_fc_context_t *fctx = &cpt_ctx->fctx;
 	uint64_t *ctrl_flags = NULL;
-	int fc_type;
+	int ret;
 
-	/* Validate key before proceeding */
-	fc_type = cpt_fc_ciph_validate_key(type, cpt_ctx, key_len);
-	if (unlikely(fc_type == -1))
+	ret = cpt_fc_ciph_set_type(type, cpt_ctx, key_len);
+	if (unlikely(ret))
 		return -1;
 
-	if (fc_type == FC_GEN) {
-		cpt_ctx->fc_type = FC_GEN;
+	if (cpt_ctx->fc_type == FC_GEN) {
 		ctrl_flags = (uint64_t *)&(fctx->enc.enc_ctrl.flags);
 		*ctrl_flags = rte_be_to_cpu_64(*ctrl_flags);
@@ -469,5 +464,4 @@ cpt_digest_gen_prep(uint32_t flags,
 	struct cpt_request_info *req;
 	uint32_t size, i;
-	int32_t m_size;
 	uint16_t data_len, mac_len, key_len;
 	auth_type_t hash_type;
@@ -499,5 +493,4 @@ cpt_digest_gen_prep(uint32_t flags,
 	m_vaddr = meta_p->vaddr;
 	m_dma = meta_p->dma_addr;
-	m_size = meta_p->size;
 
 	/*
@@ -515,5 +508,4 @@ cpt_digest_gen_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	req = m_vaddr;
@@ -522,5 +514,4 @@ cpt_digest_gen_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	hash_type = ctx->hash_type;
@@ -635,5 +626,4 @@ cpt_digest_gen_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* cpt alternate completion address saved earlier */
@@ -693,5 +683,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 	void *c_vaddr;
 	uint64_t c_dma;
-	int32_t m_size;
 	opcode_info_t opcode;
 
@@ -699,5 +688,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 	m_vaddr = meta_p->vaddr;
 	m_dma = meta_p->dma_addr;
-	m_size = meta_p->size;
 
 	encr_offset = ENCR_OFFSET(d_offs);
@@ -735,5 +723,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* start cpt request info struct at 8 byte boundary */
@@ -746,5 +733,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	if (hash_type == GMAC_TYPE)
@@ -866,5 +852,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		opcode.s.major |= CPT_DMA_MODE;
@@ -1014,5 +999,4 @@ cpt_enc_hmac_prep(uint32_t flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		/* cpt alternate completion address saved earlier */
@@ -1064,5 +1048,5 @@ cpt_dec_hmac_prep(uint32_t flags,
 	int32_t inputlen, outputlen, enc_dlen, auth_dlen;
 	struct cpt_ctx *cpt_ctx;
-	int32_t hash_type, mac_len, m_size;
+	int32_t hash_type, mac_len;
 	uint8_t iv_len = 16;
 	struct cpt_request_info *req;
@@ -1082,5 +1066,4 @@ cpt_dec_hmac_prep(uint32_t flags,
 	m_vaddr = meta_p->vaddr;
 	m_dma = meta_p->dma_addr;
-	m_size = meta_p->size;
 
 	encr_offset = ENCR_OFFSET(d_offs);
@@ -1148,5 +1131,4 @@ cpt_dec_hmac_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* start cpt request info structure at 8 byte alignment */
@@ -1159,5 +1141,4 @@ cpt_dec_hmac_prep(uint32_t flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* Decryption */
@@ -1246,5 +1227,4 @@ cpt_dec_hmac_prep(uint32_t flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		opcode.s.major |= CPT_DMA_MODE;
@@ -1395,5 +1375,4 @@ cpt_dec_hmac_prep(uint32_t flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		/* cpt alternate completion address saved earlier */
@@ -1452,5 +1431,5 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 	uint32_t encr_offset = 0, auth_offset = 0;
 	uint32_t encr_data_len = 0, auth_data_len = 0;
-	int flags, iv_len = 16, m_size;
+	int flags, iv_len = 16;
 	void *m_vaddr, *c_vaddr;
 	uint64_t m_dma, c_dma, offset_ctrl;
@@ -1464,5 +1443,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 	m_vaddr = buf_p->vaddr;
 	m_dma = buf_p->dma_addr;
-	m_size = buf_p->size;
 
 	cpt_ctx = params->ctx_buf.vaddr;
@@ -1486,5 +1464,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* Reserve memory for cpt request info */
@@ -1494,5 +1471,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	opcode.s.major = CPT_MAJOR_OP_ZUC_SNOW3G;
@@ -1618,5 +1594,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 		m_vaddr = (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len;
 		m_dma += OFF_CTRL_LEN + iv_len;
-		m_size -= OFF_CTRL_LEN + iv_len;
 
 		opcode.s.major |= CPT_DMA_MODE;
@@ -1719,5 +1694,4 @@ cpt_zuc_snow3g_enc_prep(uint32_t req_flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		/* cpt alternate completion address saved earlier */
@@ -1773,5 +1747,5 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 	uint32_t encr_offset;
 	uint32_t encr_data_len;
-	int flags, m_size;
+	int flags;
 	void *m_vaddr, *c_vaddr;
 	uint64_t m_dma, c_dma;
@@ -1785,5 +1759,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 	m_vaddr = buf_p->vaddr;
 	m_dma = buf_p->dma_addr;
-	m_size = buf_p->size;
 
 	/*
@@ -1812,5 +1785,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* Reserve memory for cpt request info */
@@ -1820,5 +1792,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	opcode.s.major = CPT_MAJOR_OP_ZUC_SNOW3G;
@@ -1910,5 +1881,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 		m_vaddr = (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len;
 		m_dma += OFF_CTRL_LEN + iv_len;
-		m_size -= OFF_CTRL_LEN + iv_len;
 
 		opcode.s.major |= CPT_DMA_MODE;
@@ -1987,5 +1957,4 @@ cpt_zuc_snow3g_dec_prep(uint32_t req_flags,
 		m_vaddr = (uint8_t *)m_vaddr + size;
 		m_dma += size;
-		m_size -= size;
 
 		/* cpt alternate completion address saved earlier */
@@ -2042,5 +2011,5 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	uint32_t encr_offset, auth_offset;
 	uint32_t encr_data_len, auth_data_len;
-	int flags, m_size;
+	int flags;
 	uint8_t *iv_s, *iv_d, iv_len = 8;
 	uint8_t dir = 0;
@@ -2060,5 +2029,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	m_vaddr = buf_p->vaddr;
 	m_dma = buf_p->dma_addr;
-	m_size = buf_p->size;
 
 	encr_offset = ENCR_OFFSET(d_offs) / 8;
@@ -2093,5 +2061,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* Reserve memory for cpt request info */
@@ -2101,5 +2068,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	opcode.s.major = CPT_MAJOR_OP_KASUMI | CPT_DMA_MODE;
@@ -2129,5 +2095,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len;
 	m_dma += OFF_CTRL_LEN + iv_len;
-	m_size -= OFF_CTRL_LEN + iv_len;
 
 	/* DPTR has SG list */
@@ -2237,5 +2202,4 @@ cpt_kasumi_enc_prep(uint32_t req_flags,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* cpt alternate completion address saved earlier */
@@ -2289,5 +2253,5 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	uint32_t encr_offset;
 	uint32_t encr_data_len;
-	int flags, m_size;
+	int flags;
 	uint8_t dir = 0;
 	void *m_vaddr, *c_vaddr;
@@ -2306,5 +2270,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	m_vaddr = buf_p->vaddr;
 	m_dma = buf_p->dma_addr;
-	m_size = buf_p->size;
 
 	encr_offset = ENCR_OFFSET(d_offs) / 8;
@@ -2328,5 +2291,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* Reserve memory for cpt request info */
@@ -2336,5 +2298,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	opcode.s.major = CPT_MAJOR_OP_KASUMI | CPT_DMA_MODE;
@@ -2363,5 +2324,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	m_vaddr = (uint8_t *)m_vaddr + OFF_CTRL_LEN + iv_len;
 	m_dma += OFF_CTRL_LEN + iv_len;
-	m_size -= OFF_CTRL_LEN + iv_len;
 
 	/* DPTR has SG list */
@@ -2432,5 +2392,4 @@ cpt_kasumi_dec_prep(uint64_t d_offs,
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
-	m_size -= size;
 
 	/* cpt alternate completion address saved earlier */
@@ -2629,7 +2588,7 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform,
 	auth_type_t auth_type = 0; /* NULL Auth type */
 	uint32_t cipher_key_len = 0;
-	uint8_t zsk_flag = 0, aes_gcm = 0;
+	uint8_t aes_gcm = 0;
 	aead_form = &xform->aead;
-	void *ctx;
+	void *ctx = SESS_PRIV(sess);
 
 	if (aead_form->op == RTE_CRYPTO_AEAD_OP_ENCRYPT &&
@@ -2665,5 +2624,5 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform,
 		return -1;
 	}
-	sess->zsk_flag = zsk_flag;
+	sess->zsk_flag = 0;
 	sess->aes_gcm = aes_gcm;
 	sess->mac_len = aead_form->digest_length;
@@ -2671,5 +2630,4 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform,
 	sess->iv_length = aead_form->iv.length;
 	sess->aad_length = aead_form->aad_length;
-	ctx = (void *)((uint8_t *)sess + sizeof(struct cpt_sess_misc)),
 
 	cpt_fc_ciph_set_key(ctx, enc_type, aead_form->key.data,
@@ -2688,8 +2646,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform,
 	cipher_type_t enc_type = 0; /* NULL Cipher type */
 	uint32_t cipher_key_len = 0;
-	uint8_t zsk_flag = 0, aes_gcm = 0, aes_ctr = 0, is_null = 0;
-
-	if (xform->type != RTE_CRYPTO_SYM_XFORM_CIPHER)
-		return -1;
+	uint8_t zsk_flag = 0, aes_ctr = 0, is_null = 0;
 
 	c_form = &xform->cipher;
@@ -2773,5 +2728,5 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform,
 
 	sess->zsk_flag = zsk_flag;
-	sess->aes_gcm = aes_gcm;
+	sess->aes_gcm = 0;
 	sess->aes_ctr = aes_ctr;
 	sess->iv_offset = c_form->iv.offset;
@@ -2793,7 +2748,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform,
 	uint8_t zsk_flag = 0, aes_gcm = 0, is_null = 0;
 
-	if (xform->type != RTE_CRYPTO_SYM_XFORM_AUTH)
-		goto error_out;
-
 	a_form = &xform->auth;
 
@@ -2867,9 +2819,9 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform,
 		CPT_LOG_DP_ERR("Crypto: Unsupported hash algo %u",
 			       a_form->algo);
-		goto error_out;
+		return -1;
 	default:
 		CPT_LOG_DP_ERR("Crypto: Undefined Hash algo %u specified",
 			       a_form->algo);
-		goto error_out;
+		return -1;
 	}
 
@@ -2886,7 +2838,4 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform,
 
 	return 0;
-
-error_out:
-	return -1;
 }
 
@@ -2898,9 +2847,5 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform,
 	cipher_type_t enc_type = 0; /* NULL Cipher type */
 	auth_type_t auth_type = 0; /* NULL Auth type */
-	uint8_t zsk_flag = 0, aes_gcm = 0;
-	void *ctx;
-
-	if (xform->type != RTE_CRYPTO_SYM_XFORM_AUTH)
-		return -1;
+	void *ctx = SESS_PRIV(sess);
 
 	a_form = &xform->auth;
@@ -2926,11 +2871,10 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform,
 	}
 
-	sess->zsk_flag = zsk_flag;
-	sess->aes_gcm = aes_gcm;
+	sess->zsk_flag = 0;
+	sess->aes_gcm = 0;
 	sess->is_gmac = 1;
 	sess->iv_offset = a_form->iv.offset;
 	sess->iv_length = a_form->iv.length;
 	sess->mac_len = a_form->digest_length;
-	ctx = (void *)((uint8_t *)sess + sizeof(struct cpt_sess_misc)),
 
 	cpt_fc_ciph_set_key(ctx, enc_type, a_form->key.data,
@@ -3132,7 +3076,4 @@ fill_fc_params(struct rte_crypto_op *cop,
 	struct rte_mbuf *m_src, *m_dst;
 	uint8_t cpt_op = sess_misc->cpt_op;
-	uint8_t zsk_flag = sess_misc->zsk_flag;
-	uint8_t aes_gcm = sess_misc->aes_gcm;
-	uint16_t mac_len = sess_misc->mac_len;
 #ifdef CPT_ALWAYS_USE_SG_MODE
 	uint8_t inplace = 0;
@@ -3161,13 +3102,9 @@ fill_fc_params(struct rte_crypto_op *cop,
 	}
 
-	if (zsk_flag) {
+	if (sess_misc->zsk_flag) {
 		fc_params.auth_iv_buf = rte_crypto_op_ctod_offset(cop,
 					uint8_t *,
 					sess_misc->auth_iv_offset);
-		if (zsk_flag == K_F9) {
-			CPT_LOG_DP_ERR("Should not reach here for "
-			"kasumi F9\n");
-		}
-		if (zsk_flag != ZS_EA)
+		if (sess_misc->zsk_flag != ZS_EA)
 			inplace = 0;
 	}
@@ -3175,5 +3112,5 @@ fill_fc_params(struct rte_crypto_op *cop,
 	m_dst = sym_op->m_dst;
 
-	if (aes_gcm) {
+	if (sess_misc->aes_gcm) {
 		uint8_t *salt;
 		uint8_t *aad_data;
@@ -3209,5 +3146,5 @@ fill_fc_params(struct rte_crypto_op *cop,
 		}
 		fc_params.iv_buf = salt + 4;
-		if (likely(mac_len)) {
+		if (likely(sess_misc->mac_len)) {
 			struct rte_mbuf *m = (cpt_op & CPT_OP_ENCODE) ? m_dst :
 					     m_src;
@@ -3252,5 +3189,5 @@ fill_fc_params(struct rte_crypto_op *cop,
 			fc_params.iv_buf = salt + 4;
 		}
-		if (likely(mac_len)) {
+		if (likely(sess_misc->mac_len)) {
 			struct rte_mbuf *m;
 
@@ -3311,5 +3248,4 @@ fill_fc_params(struct rte_crypto_op *cop,
 
 			/* Try to make room as much as src has */
-			m_dst = sym_op->m_dst;
 			pkt_len = rte_pktmbuf_pkt_len(m_dst);
 
@@ -3495,5 +3431,4 @@ fill_digest_params(struct rte_crypto_op *cop,
 	struct rte_mbuf *m_src, *m_dst;
 	uint16_t auth_op = sess->cpt_op & CPT_OP_AUTH_MASK;
-	uint8_t zsk_flag = sess->zsk_flag;
 	uint16_t mac_len = sess->mac_len;
 	fc_params_t params;
@@ -3527,5 +3462,5 @@ fill_digest_params(struct rte_crypto_op *cop,
 	flags = VALID_MAC_BUF;
 	params.src_iov = (void *)src;
-	if (unlikely(zsk_flag)) {
+	if (unlikely(sess->zsk_flag)) {
 		/*
 		 * Since for Zuc, Kasumi, Snow3g offsets are in bits
@@ -3537,8 +3472,7 @@ fill_digest_params(struct rte_crypto_op *cop,
 		params.auth_iv_buf = rte_crypto_op_ctod_offset(cop,
 					uint8_t *, sess->auth_iv_offset);
-		if (zsk_flag == K_F9) {
+		if (sess->zsk_flag == K_F9) {
 			uint32_t length_in_bits, num_bytes;
 			uint8_t *src, direction = 0;
-			uint32_t counter_num_bytes;
 
 			memcpy(iv_buf, rte_pktmbuf_mtod(cop->sym->m_src,
@@ -3550,8 +3484,7 @@ fill_digest_params(struct rte_crypto_op *cop,
 			length_in_bits = cop->sym->auth.data.length;
 			num_bytes = (length_in_bits >> 3);
-			counter_num_bytes = num_bytes;
 			src = rte_pktmbuf_mtod(cop->sym->m_src, uint8_t *);
 			find_kasumif9_direction_and_length(src,
-						counter_num_bytes,
+						num_bytes,
 						&length_in_bits,
 						&direction);
-- 
2.21.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-14 17:02:39.169176522 +0000
+++ 0038-common-cpt-remove-redundant-code-in-datapath.patch	2020-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,



More information about the stable mailing list