DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aakash Sasidharan <asasidharan@marvell.com>
To: Anoob Joseph <anoobj@marvell.com>,
	Volodymyr Fialko <vfialko@marvell.com>
Cc: <gakhil@marvell.com>, <dev@dpdk.org>, <asasidharan@marvell.com>
Subject: [PATCH] test/pdcp: add data walkthrough test
Date: Tue, 26 Sep 2023 22:06:17 +0530	[thread overview]
Message-ID: <20230926163617.2166471-1-asasidharan@marvell.com> (raw)

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


             reply	other threads:[~2023-09-26 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 16:36 Aakash Sasidharan [this message]
2023-09-27 16:24 ` Anoob Joseph
2023-10-23 13:14   ` 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=20230926163617.2166471-1-asasidharan@marvell.com \
    --to=asasidharan@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=vfialko@marvell.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).