From patchwork Sat May 27 08:59:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 127636 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 22B8642BB5; Sat, 27 May 2023 14:10:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1511342D38; Sat, 27 May 2023 14:10:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 134F742D38 for ; Sat, 27 May 2023 14:10:11 +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 34RBHB0l024640; Sat, 27 May 2023 05:10:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=kWCxAvGI7voTCo4rNBaMnvpYF2CZ79dM/YL6mj9M5m0=; b=DJxwg2QykffkL5eDMplKzn2SA6XslsyPmzbPrk7OmIv4GBMyuNm51CrBroTCXviFLyI8 Msyg14Ri7FRa0BEZjk/zFmLYnX8pwQKB5o56zckFlu6beATGdN9LCFT3dHbk5u7o4xx8 Dym23RhM5ZNNVsah5hzKMMSo075rAEHPM1B18lXdDvsTIBNn5O8OjoaF3LC1Nb4h1Txt 2d46poiEYTGOuJwCzzHbOsr+sTjl00NEA9BKPxZyAjfAXOy7eyhFLMLWVY3b4h/1Ul4f RawCeuPl5G88sjOkxamxzZZubo8Axhyx+fBZha/8Yn50mlbi6r0WYCmceZOrhFzxEeF4 bA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3quf7p8axa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 27 May 2023 05:10:10 -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; Sat, 27 May 2023 05:10:08 -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; Sat, 27 May 2023 05:10:08 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.65.175]) by maili.marvell.com (Postfix) with ESMTP id 50A6A5E6A16; Sat, 27 May 2023 02:00:35 -0700 (PDT) From: Anoob Joseph To: Thomas Monjalon , Akhil Goyal , Jerin Jacob , Konstantin Ananyev CC: Volodymyr Fialko , Hemant Agrawal , =?utf-8?q?Mattias_R=C3=B6nnblom?= , Kiran Kumar K , , Olivier Matz , Stephen Hemminger Subject: [PATCH v5 18/21] test/pdcp: add timer restart case Date: Sat, 27 May 2023 14:29:07 +0530 Message-ID: <20230527085910.972-19-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230527085910.972-1-anoobj@marvell.com> References: <20230526210214.617-1-anoobj@marvell.com> <20230527085910.972-1-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: FPmGcA-Q-7fjZKlKIw9J2UiZoQgbFCnl X-Proofpoint-ORIG-GUID: FPmGcA-Q-7fjZKlKIw9J2UiZoQgbFCnl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-27_08,2023-05-25_03,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 From: Volodymyr Fialko Add test to cover the case when t-reordering timer should be restarted on the same packet. Signed-off-by: Anoob Joseph Signed-off-by: Volodymyr Fialko --- app/test/test_pdcp.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/app/test/test_pdcp.c b/app/test/test_pdcp.c index 25729b2bdd..82cc25ec7a 100644 --- a/app/test/test_pdcp.c +++ b/app/test/test_pdcp.c @@ -1106,6 +1106,71 @@ test_reorder_gap_fill(struct pdcp_test_conf *ul_conf) return ret; } +static int +test_reorder_gap_in_reorder_buffer(const struct pdcp_test_conf *ul_conf) +{ + const enum rte_security_pdcp_sn_size sn_size = ul_conf->entity.pdcp_xfrm.sn_size; + struct rte_mbuf *m = NULL, *out_mb[2] = {0}; + uint16_t nb_success = 0, nb_err = 0; + struct rte_pdcp_entity *pdcp_entity; + int ret = TEST_FAILED, nb_out, i; + struct pdcp_test_conf dl_conf; + uint8_t cdev_id; + + const int start_count = 0; + + if (ul_conf->entity.pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) + return TEST_SKIPPED; + + /* Create configuration for actual testing */ + uplink_to_downlink_convert(ul_conf, &dl_conf); + dl_conf.entity.pdcp_xfrm.hfn = pdcp_hfn_from_count_get(start_count, sn_size); + dl_conf.entity.sn = pdcp_sn_from_count_get(start_count, sn_size); + pdcp_entity = test_entity_create(&dl_conf, &ret); + if (pdcp_entity == NULL) + return ret; + + cdev_id = dl_conf.entity.dev_id; + + /* Create two gaps [NULL, m1, NULL, m3]*/ + for (i = 0; i < 2; i++) { + m = generate_packet_for_dl_with_sn(*ul_conf, start_count + 2 * i + 1); + ASSERT_TRUE_OR_GOTO(m != NULL, exit, "Could not allocate buffer for packet\n"); + nb_success = test_process_packets(pdcp_entity, cdev_id, &m, 1, out_mb, &nb_err); + ASSERT_TRUE_OR_GOTO(nb_err == 0, exit, "Error occurred during packet process\n"); + ASSERT_TRUE_OR_GOTO(nb_success == 0, exit, "Packet was not buffered as expected\n"); + m = NULL; /* Packet was moved to PDCP lib */ + } + + /* Generate packet to fill the first gap */ + m = generate_packet_for_dl_with_sn(*ul_conf, start_count); + ASSERT_TRUE_OR_GOTO(m != NULL, exit, "Could not allocate buffer for packet\n"); + + /* + * Buffered packets after insert [m0, m1, NULL, m3] + * Only first gap should be filled, timer should be restarted for second gap + */ + nb_success = test_process_packets(pdcp_entity, cdev_id, &m, 1, out_mb, &nb_err); + ASSERT_TRUE_OR_GOTO(nb_err == 0, exit, "Error occurred during packet process\n"); + ASSERT_TRUE_OR_GOTO(nb_success == 2, exit, + "Packet count mismatch (received: %i, expected: 2)\n", nb_success); + m = NULL; + /* Check that packets in correct order */ + ASSERT_TRUE_OR_GOTO(array_asc_sorted_check(out_mb, nb_success, sn_size), + exit, "Error occurred during packet drain\n"); + ASSERT_TRUE_OR_GOTO(testsuite_params.timer_is_running == true, exit, + "Timer should be restarted after partial drain"); + + + ret = TEST_SUCCESS; +exit: + rte_pktmbuf_free(m); + rte_pktmbuf_free_bulk(out_mb, nb_success); + nb_out = rte_pdcp_entity_release(pdcp_entity, out_mb); + rte_pktmbuf_free_bulk(out_mb, nb_out); + return ret; +} + static int test_reorder_buffer_full_window_size_sn_12(const struct pdcp_test_conf *ul_conf) { @@ -1527,6 +1592,9 @@ static struct unit_test_suite reorder_test_cases = { TEST_CASE_NAMED_WITH_DATA("test_reorder_gap_fill", ut_setup_pdcp, ut_teardown_pdcp, run_test_with_all_known_vec, test_reorder_gap_fill), + TEST_CASE_NAMED_WITH_DATA("test_reorder_gap_in_reorder_buffer", + ut_setup_pdcp, ut_teardown_pdcp, + run_test_with_all_known_vec, test_reorder_gap_in_reorder_buffer), TEST_CASE_NAMED_WITH_DATA("test_reorder_buffer_full_window_size_sn_12", ut_setup_pdcp, ut_teardown_pdcp, run_test_with_all_known_vec_until_first_pass,