DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] test/pdcp: add data walkthrough test
@ 2023-09-26 16:36 Aakash Sasidharan
  2023-09-27 16:24 ` Anoob Joseph
  0 siblings, 1 reply; 3+ messages in thread
From: Aakash Sasidharan @ 2023-09-26 16:36 UTC (permalink / raw)
  To: Anoob Joseph, Volodymyr Fialko; +Cc: gakhil, dev, asasidharan

Enable data walkthrough test in combined mode.
The test covers data size ranging from 0B to 9000B
both inclusive.

Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
---
 app/test/test_pdcp.c | 55 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 3 deletions(-)

diff --git a/app/test/test_pdcp.c b/app/test/test_pdcp.c
index 49bc8641a0..0a2827f2ef 100644
--- a/app/test/test_pdcp.c
+++ b/app/test/test_pdcp.c
@@ -27,6 +27,8 @@
 #define NB_BASIC_TESTS RTE_DIM(pdcp_test_params)
 #define NB_SDAP_TESTS RTE_DIM(list_pdcp_sdap_tests)
 #define PDCP_IV_LEN 16
+#define PDCP_MBUF_SIZE	(sizeof(struct rte_mbuf) + \
+			 RTE_PKTMBUF_HEADROOM + RTE_PDCP_CTRL_PDU_SIZE_MAX)
 
 /* Assert that condition is true, or goto the mark */
 #define ASSERT_TRUE_OR_GOTO(cond, mark, ...) do {\
@@ -79,8 +81,11 @@ enum pdcp_test_suite_type {
 	PDCP_TEST_SUITE_TY_SDAP,
 };
 
+static bool silent;
+
 static int create_test_conf_from_index(const int index, struct pdcp_test_conf *conf,
 				       enum pdcp_test_suite_type suite_type);
+static void test_conf_input_data_modify(struct pdcp_test_conf *conf, int inp_len);
 
 typedef int (*test_with_conf_t)(struct pdcp_test_conf *conf);
 
@@ -364,7 +369,7 @@ testsuite_setup(void)
 	memset(ts_params, 0, sizeof(*ts_params));
 
 	ts_params->mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NUM_MBUFS, MBUF_CACHE_SIZE, 0,
-						       MBUF_SIZE, SOCKET_ID_ANY);
+						       PDCP_MBUF_SIZE, SOCKET_ID_ANY);
 	if (ts_params->mbuf_pool == NULL) {
 		RTE_LOG(ERR, USER1, "Could not create mbuf pool\n");
 		return TEST_FAILED;
@@ -522,8 +527,10 @@ pdcp_known_vec_verify(struct rte_mbuf *m, const uint8_t *expected, uint32_t expe
 	uint8_t *actual = rte_pktmbuf_mtod(m, uint8_t *);
 	uint32_t actual_pkt_len = rte_pktmbuf_pkt_len(m);
 
-	debug_hexdump(stdout, "Received:", actual, actual_pkt_len);
-	debug_hexdump(stdout, "Expected:", expected, expected_pkt_len);
+	if (!silent) {
+		debug_hexdump(stdout, "Received:", actual, actual_pkt_len);
+		debug_hexdump(stdout, "Expected:", expected, expected_pkt_len);
+	}
 
 	TEST_ASSERT_EQUAL(actual_pkt_len, expected_pkt_len,
 			  "Mismatch in packet lengths [expected: %d, received: %d]",
@@ -1038,6 +1045,13 @@ create_test_conf_from_index(const int index, struct pdcp_test_conf *conf,
 	return 0;
 }
 
+static void
+test_conf_input_data_modify(struct pdcp_test_conf *conf, int inp_len)
+{
+	conf->input_len = inp_len;
+	memset(conf->input, 0xab, inp_len);
+}
+
 static struct rte_pdcp_entity*
 test_entity_create(const struct pdcp_test_conf *t_conf, int *rc)
 {
@@ -2055,6 +2069,38 @@ test_combined(struct pdcp_test_conf *ul_conf)
 	return ret;
 }
 
+#define MIN_DATA_LEN 0
+#define MAX_DATA_LEN 9000
+
+static int
+test_combined_data_walkthrough(struct pdcp_test_conf *test_conf)
+{
+	uint32_t data_len;
+	int ret;
+
+	ret = test_combined(test_conf);
+	if (ret != TEST_SUCCESS)
+		return ret;
+
+	if (!silent)
+		silent = true;
+
+	/* With the passing config, perform a data walkthrough test. */
+	for (data_len = MIN_DATA_LEN; data_len <= MAX_DATA_LEN; data_len++) {
+		test_conf_input_data_modify(test_conf, data_len);
+		ret = test_combined(test_conf);
+
+		if (ret == TEST_FAILED) {
+			printf("Data walkthrough failed for input len: %d\n", data_len);
+			return TEST_FAILED;
+		}
+	}
+
+	silent = false;
+
+	return TEST_SUCCESS;
+}
+
 #ifdef RTE_LIB_EVENTDEV
 static inline void
 eventdev_conf_default_set(struct rte_event_dev_config *dev_conf, struct rte_event_dev_info *info)
@@ -2190,6 +2236,9 @@ static struct unit_test_suite combined_mode_cases  = {
 	.unit_test_cases = {
 		TEST_CASE_NAMED_WITH_DATA("combined mode", ut_setup_pdcp, ut_teardown_pdcp,
 			run_test_with_all_known_vec, test_combined),
+		TEST_CASE_NAMED_WITH_DATA("combined mode data walkthrough",
+			ut_setup_pdcp, ut_teardown_pdcp,
+			run_test_with_all_known_vec, test_combined_data_walkthrough),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] test/pdcp: add data walkthrough test
  2023-09-26 16:36 [PATCH] test/pdcp: add data walkthrough test Aakash Sasidharan
@ 2023-09-27 16:24 ` Anoob Joseph
  2023-10-23 13:14   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Anoob Joseph @ 2023-09-27 16:24 UTC (permalink / raw)
  To: Aakash Sasidharan; +Cc: Akhil Goyal, dev, Aakash Sasidharan, Volodymyr Fialko

> 
> Enable data walkthrough test in combined mode.
> The test covers data size ranging from 0B to 9000B both inclusive.
> 
> Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] test/pdcp: add data walkthrough test
  2023-09-27 16:24 ` Anoob Joseph
@ 2023-10-23 13:14   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2023-10-23 13:14 UTC (permalink / raw)
  To: Anoob Joseph, Aakash Sasidharan; +Cc: dev, Aakash Sasidharan, Volodymyr Fialko

> Subject: RE: [PATCH] test/pdcp: add data walkthrough test
> 
> >
> > Enable data walkthrough test in combined mode.
> > The test covers data size ranging from 0B to 9000B both inclusive.
> >
> > Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>

Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-23 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 16:36 [PATCH] test/pdcp: add data walkthrough test Aakash Sasidharan
2023-09-27 16:24 ` Anoob Joseph
2023-10-23 13:14   ` Akhil Goyal

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).