All of lore.kernel.org
 help / color / mirror / Atom feed
From: akhil.goyal@nxp.com
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, anoobj@marvell.com,
	declan.doherty@intel.com, david.coyle@intel.com,
	Franck LENORMAND <franck.lenormand@nxp.com>,
	Akhil Goyal <akhil.goyal@nxp.com>
Subject: [dpdk-dev] [PATCH 7/7] test/crypto: Add PDCP-SDAP cases
Date: Thu,  3 Sep 2020 21:36:52 +0530	[thread overview]
Message-ID: <20200903160652.31654-8-akhil.goyal@nxp.com> (raw)
In-Reply-To: <20200903160652.31654-1-akhil.goyal@nxp.com>

From: Franck LENORMAND <franck.lenormand@nxp.com>

A new functions which uses the structure of the test vectors for SDAP
is added and call a functions responsible to call the test_pdcp_proto
with the test vector both for encapsulation and decapsulation.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 app/test/test_cryptodev.c | 95 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index d6bc07696..5a0b0b1aa 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2015-2020 Intel Corporation
+ * Copyright 2020 NXP
  */
 
 #include <time.h>
@@ -42,8 +43,12 @@
 #include "test_cryptodev_mixed_test_vectors.h"
 #ifdef RTE_LIBRTE_SECURITY
 #include "test_cryptodev_security_pdcp_test_vectors.h"
+#include "test_cryptodev_security_pdcp_sdap_test_vectors.h"
 #include "test_cryptodev_security_pdcp_test_func.h"
 #include "test_cryptodev_security_docsis_test_vectors.h"
+
+#define SDAP_DISABLED	0
+#define SDAP_ENABLED	1
 #endif
 
 #define VDEV_ARGS_SIZE 100
@@ -52,6 +57,10 @@
 #define IN_PLACE 0
 #define OUT_OF_PLACE 1
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
 static int gbl_driver_id;
 
 static enum rte_security_session_action_type gbl_action_type =
@@ -7743,6 +7752,90 @@ test_PDCP_PROTO_SGL_oop_128B_32B(void)
 			128, 32);
 }
 
+static int
+test_PDCP_SDAP_PROTO_encap_all(void)
+{
+	int i = 0, size = 0;
+	int err, all_err = TEST_SUCCESS;
+	const struct pdcp_sdap_test *cur_test;
+
+	size = ARRAY_SIZE(list_pdcp_sdap_tests);
+
+	for (i = 0; i < size; i++) {
+		cur_test = &list_pdcp_sdap_tests[i];
+		err = test_pdcp_proto(
+			i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+			RTE_CRYPTO_AUTH_OP_GENERATE, cur_test->data_in,
+			cur_test->in_len, cur_test->data_out,
+			cur_test->in_len + ((cur_test->auth_key) ? 4 : 0),
+			cur_test->param.cipher_alg, cur_test->cipher_key,
+			cur_test->param.cipher_key_len,
+			cur_test->param.auth_alg,
+			cur_test->auth_key, cur_test->param.auth_key_len,
+			cur_test->bearer, cur_test->param.domain,
+			cur_test->packet_direction, cur_test->sn_size,
+			cur_test->hfn,
+			cur_test->hfn_threshold, SDAP_ENABLED);
+		if (err) {
+			printf("\t%d) %s: Encapsulation failed\n",
+					cur_test->test_idx,
+					cur_test->param.name);
+			err = TEST_FAILED;
+		} else {
+			printf("\t%d) %s: Encap PASS\n", cur_test->test_idx,
+					cur_test->param.name);
+			err = TEST_SUCCESS;
+		}
+		all_err += err;
+	}
+
+	printf("Success: %d, Failure: %d\n", size + all_err, -all_err);
+
+	return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED;
+}
+
+static int
+test_PDCP_SDAP_PROTO_decap_all(void)
+{
+	int i = 0, size = 0;
+	int err, all_err = TEST_SUCCESS;
+	const struct pdcp_sdap_test *cur_test;
+
+	size = ARRAY_SIZE(list_pdcp_sdap_tests);
+
+	for (i = 0; i < size; i++) {
+		cur_test = &list_pdcp_sdap_tests[i];
+		err = test_pdcp_proto(
+			i, 0, RTE_CRYPTO_CIPHER_OP_DECRYPT,
+			RTE_CRYPTO_AUTH_OP_VERIFY,
+			cur_test->data_out,
+			cur_test->in_len + ((cur_test->auth_key) ? 4 : 0),
+			cur_test->data_in, cur_test->in_len,
+			cur_test->param.cipher_alg,
+			cur_test->cipher_key, cur_test->param.cipher_key_len,
+			cur_test->param.auth_alg, cur_test->auth_key,
+			cur_test->param.auth_key_len, cur_test->bearer,
+			cur_test->param.domain, cur_test->packet_direction,
+			cur_test->sn_size, cur_test->hfn,
+			cur_test->hfn_threshold, SDAP_ENABLED);
+		if (err) {
+			printf("\t%d) %s: Decapsulation failed\n",
+					cur_test->test_idx,
+					cur_test->param.name);
+			err = TEST_FAILED;
+		} else {
+			printf("\t%d) %s: Decap PASS\n", cur_test->test_idx,
+					cur_test->param.name);
+			err = TEST_SUCCESS;
+		}
+		all_err += err;
+	}
+
+	printf("Success: %d, Failure: %d\n", size + all_err, -all_err);
+
+	return (all_err == TEST_SUCCESS) ? TEST_SUCCESS : TEST_FAILED;
+}
+
 static int
 test_PDCP_PROTO_all(void)
 {
@@ -7774,6 +7867,8 @@ test_PDCP_PROTO_all(void)
 	status += test_PDCP_PROTO_SGL_oop_32B_128B();
 	status += test_PDCP_PROTO_SGL_oop_32B_40B();
 	status += test_PDCP_PROTO_SGL_oop_128B_32B();
+	status += test_PDCP_SDAP_PROTO_encap_all();
+	status += test_PDCP_SDAP_PROTO_decap_all();
 
 	if (status)
 		return TEST_FAILED;
-- 
2.17.1


  parent reply	other threads:[~2020-09-03 16:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 16:06 [dpdk-dev] [PATCH 0/7] support PDCP-SDAP for dpaa2_sec akhil.goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 1/7] common/dpaax/caamflib: Support PDCP-SDAP akhil.goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 2/7] security: modify PDCP xform to support SDAP akhil.goyal
2020-10-05 18:04   ` Coyle, David
2020-10-08  9:01     ` Akhil Goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 3/7] crypto/dpaa2_sec: enable PDCP-SDAP sessions akhil.goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 4/7] crypto/dpaa_sec: " akhil.goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 5/7] test/crypto: Add test vectors for PDCP-SDAP akhil.goyal
2020-09-03 16:06 ` [dpdk-dev] [PATCH 6/7] test/crypto: Modify test_pdcp_proto to take parameters akhil.goyal
2020-09-03 16:06 ` akhil.goyal [this message]
2020-10-11 21:33 ` [dpdk-dev] [PATCH v2 0/8] support PDCP-SDAP for dpaa2_sec Akhil Goyal
2020-10-11 21:33   ` [dpdk-dev] [PATCH v2 1/8] common/dpaax/caamflib: Support PDCP-SDAP Akhil Goyal
2020-10-11 21:33   ` [dpdk-dev] [PATCH v2 2/8] security: modify PDCP xform to support SDAP Akhil Goyal
2020-10-11 21:33   ` [dpdk-dev] [PATCH v2 3/8] doc: remove unnecessary API code from security guide Akhil Goyal
2020-10-11 21:33   ` [dpdk-dev] [PATCH v2 4/8] crypto/dpaa2_sec: enable PDCP-SDAP sessions Akhil Goyal
2020-10-11 21:34   ` [dpdk-dev] [PATCH v2 5/8] crypto/dpaa_sec: " Akhil Goyal
2020-10-11 21:34   ` [dpdk-dev] [PATCH v2 6/8] test/crypto: Add test vectors for PDCP-SDAP Akhil Goyal
2020-10-11 21:49     ` Thomas Monjalon
2020-10-12 14:01       ` Akhil Goyal
2020-10-11 21:34   ` [dpdk-dev] [PATCH v2 7/8] test/crypto: Modify test_pdcp_proto to take parameters Akhil Goyal
2020-10-11 21:34   ` [dpdk-dev] [PATCH v2 8/8] test/crypto: Add PDCP-SDAP cases Akhil Goyal
2020-10-12 14:09   ` [dpdk-dev] [PATCH v3 0/8] support PDCP-SDAP for dpaa2_sec Akhil Goyal
2020-10-12 14:09     ` [dpdk-dev] [PATCH v3 1/8] common/dpaax/caamflib: Support PDCP-SDAP Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 2/8] security: modify PDCP xform to support SDAP Akhil Goyal
2020-10-14  7:46       ` Thomas Monjalon
2020-10-14 20:26         ` Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 3/8] doc: remove unnecessary API code from security guide Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 4/8] crypto/dpaa2_sec: enable PDCP-SDAP sessions Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 5/8] crypto/dpaa_sec: " Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 6/8] test/crypto: Add test vectors for PDCP-SDAP Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 7/8] test/crypto: Modify test_pdcp_proto to take parameters Akhil Goyal
2020-10-12 14:10     ` [dpdk-dev] [PATCH v3 8/8] test/crypto: Add PDCP-SDAP cases Akhil Goyal

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=20200903160652.31654-8-akhil.goyal@nxp.com \
    --to=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=david.coyle@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=franck.lenormand@nxp.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.