From patchwork Tue Sep 26 16:36:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 131973 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87BE342645; Tue, 26 Sep 2023 18:36:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76AAF4028C; Tue, 26 Sep 2023 18:36:24 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 16FFE40277 for ; Tue, 26 Sep 2023 18:36:22 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QA02Z4013266 for ; Tue, 26 Sep 2023 09:36:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=kpnHJMGnJqkG0v752dyawdpcrYGGmYDCR0uMp/Uxx3Q=; b=fkPaovi+nWkCG7HpJ2V9nYqI5DbW6mhUALrl1w/pnUY6O+jCTvaJrObRimHbVOB3cO7R kYMQu1WH7bGxcEvew9abrBx9cJvJYXxnF4mjT8PdZSR1XT89ybKeBcHzWaqhB1nzqFLD 7tGJYfgTTYPyBeCQI10wR+BntSmWy+6FrONzfIWBaphkxtxEP1E+8vFtVleKuVqvgXAB B4oFAGReRERT5uepfp+QF9V9mriBIZlrn3km+eg4wy/jSgIqNyR9PvN58lnTUyk75d5w B3/0pPXsm7X52vq8A89GtDRKjNT+rw1jlpGn2hCL0zkIdocy757kNZkwQ/rw2maTufpz Sg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3tbw5ghgwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 26 Sep 2023 09:36:22 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 26 Sep 2023 09:36:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 26 Sep 2023 09:36:20 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 93ABD5B692C; Tue, 26 Sep 2023 09:36:18 -0700 (PDT) From: Aakash Sasidharan To: Anoob Joseph , Volodymyr Fialko CC: , , Subject: [PATCH] test/pdcp: add data walkthrough test Date: Tue, 26 Sep 2023 22:06:17 +0530 Message-ID: <20230926163617.2166471-1-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: WqVB1db3jzLq6W-EPxc-CdYm72ZlFDT5 X-Proofpoint-ORIG-GUID: WqVB1db3jzLq6W-EPxc-CdYm72ZlFDT5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Enable data walkthrough test in combined mode. The test covers data size ranging from 0B to 9000B both inclusive. Signed-off-by: Aakash Sasidharan Acked-by: Anoob Joseph --- 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 */ } };