DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <akhil.goyal@nxp.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, Akhil Goyal <akhil.goyal@nxp.com>
Subject: [dpdk-dev] [PATCH 2/2] test/crypto: enable hfn override in PDCP cases
Date: Mon,  1 Jun 2020 23:32:29 +0530	[thread overview]
Message-ID: <20200601180229.26566-2-akhil.goyal@nxp.com> (raw)
In-Reply-To: <20200601180229.26566-1-akhil.goyal@nxp.com>

As most of the real woeld use cases need HFN value to
be updated on per packet basis, changing the default
testing with HFN override enabled for all PDCP cases.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 app/test-crypto-perf/cperf_ops.c | 10 +++++++---
 app/test/test_cryptodev.c        | 13 +++++++++++--
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 97584ceed..847982219 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -25,6 +25,10 @@ cperf_set_ops_security(struct rte_crypto_op **ops,
 		struct rte_security_session *sec_sess =
 			(struct rte_security_session *)sess;
 
+		uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ops[i],
+					uint32_t *, iv_offset);
+		*per_pkt_hfn = 0x1;
+
 		ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
 		rte_security_attach_session(ops[i], sec_sess);
 		sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +
@@ -529,16 +533,15 @@ cperf_create_session(struct rte_mempool *sess_mp,
 		cipher_xform.cipher.algo = options->cipher_algo;
 		cipher_xform.cipher.op = options->cipher_op;
 		cipher_xform.cipher.iv.offset = iv_offset;
+		cipher_xform.cipher.iv.length = 4;
 
 		/* cipher different than null */
 		if (options->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
 			cipher_xform.cipher.key.data = test_vector->cipher_key.data;
 			cipher_xform.cipher.key.length = test_vector->cipher_key.length;
-			cipher_xform.cipher.iv.length = test_vector->cipher_iv.length;
 		} else {
 			cipher_xform.cipher.key.data = NULL;
 			cipher_xform.cipher.key.length = 0;
-			cipher_xform.cipher.iv.length = 0;
 		}
 
 		/* Setup Auth Parameters */
@@ -576,8 +579,9 @@ cperf_create_session(struct rte_mempool *sess_mp,
 				.domain = options->pdcp_domain,
 				.pkt_dir = 0,
 				.sn_size = options->pdcp_sn_sz,
-				.hfn = 0x1,
+				.hfn = 0x0,
 				.hfn_threshold = 0x70C0A,
+				.hfn_ovrd = 1,
 			} },
 			.crypto_xform = &cipher_xform
 		};
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 8f631468b..f4ed89c1c 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -7385,7 +7385,8 @@ test_pdcp_proto_SGL(int i, int oop,
 	ut_params->cipher_xform.cipher.key.data = pdcp_test_crypto_key[i];
 	ut_params->cipher_xform.cipher.key.length =
 					pdcp_test_params[i].cipher_key_len;
-	ut_params->cipher_xform.cipher.iv.length = 0;
+	ut_params->cipher_xform.cipher.iv.length = 4;
+	ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
 
 	/* Setup HMAC Parameters if ICV header is required */
 	if (pdcp_test_params[i].auth_alg != 0) {
@@ -7410,8 +7411,12 @@ test_pdcp_proto_SGL(int i, int oop,
 			.domain = pdcp_test_params[i].domain,
 			.pkt_dir = pdcp_test_packet_direction[i],
 			.sn_size = pdcp_test_data_sn_size[i],
-			.hfn = pdcp_test_hfn[i],
+			.hfn = 0, /**
+				   * hfn can be set as pdcp_test_hfn[i]
+				   * if hfn_ovrd is not set
+				   */
 			.hfn_threshold = pdcp_test_hfn_threshold[i],
+			.hfn_ovrd = 1,
 		} },
 		.crypto_xform = &ut_params->cipher_xform
 	};
@@ -7438,6 +7443,10 @@ test_pdcp_proto_SGL(int i, int oop,
 		goto on_err;
 	}
 
+	uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ut_params->op,
+					uint32_t *, IV_OFFSET);
+	*per_pkt_hfn = pdcp_test_hfn[i];
+
 	rte_security_attach_session(ut_params->op, ut_params->sec_session);
 
 	/* set crypto operation source mbuf */
-- 
2.17.1


  reply	other threads:[~2020-06-01 18:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 18:02 [dpdk-dev] [PATCH 1/2] drivers/crypto: fix 18bit PDCP cases with HFN override Akhil Goyal
2020-06-01 18:02 ` Akhil Goyal [this message]
2020-07-06  5:21 ` [dpdk-dev] [PATCH v2 0/3] Updates for HFN in PDCP Akhil Goyal
2020-07-06  5:21   ` [dpdk-dev] [PATCH v2 1/3] drivers/crypto: fix 18bit PDCP cases with HFN override Akhil Goyal
2020-07-06  5:36     ` [dpdk-dev] [PATCH v3 0/3] Updates for HFN in PDCP Akhil Goyal
2020-07-06  5:36       ` [dpdk-dev] [PATCH v3 1/3] drivers/crypto: fix 18bit PDCP cases with HFN override Akhil Goyal
2020-07-06  5:36       ` [dpdk-dev] [PATCH v3 2/3] test/crypto: update PDCP HFN scenarios Akhil Goyal
2020-07-06  5:36       ` [dpdk-dev] [PATCH v3 3/3] test/crypto-perf: add option to enable session HFN Akhil Goyal
2020-07-06  5:57       ` [dpdk-dev] [PATCH v3 0/3] Updates for HFN in PDCP Akhil Goyal
2020-07-06  5:21   ` [dpdk-dev] [PATCH v2 2/3] test/crypto: update PDCP HFN scenarios Akhil Goyal
2020-07-06  5:21   ` [dpdk-dev] [PATCH v2 3/3] test/crypto-perf: add option to enable session HFN Akhil Goyal
2020-07-06  5:45   ` [dpdk-dev] [PATCH v2 0/3] Updates for HFN in PDCP Hemant Agrawal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200601180229.26566-2-akhil.goyal@nxp.com \
    --to=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).