From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B5A6427DB; Mon, 20 Mar 2023 09:16:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B9C842B7E; Mon, 20 Mar 2023 09:16:58 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 31D36427F5 for ; Mon, 20 Mar 2023 09:16:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679300217; x=1710836217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fE6uPzDCAUJkJjXjFNVx55npcIKq3pQ415TzEla0/0Q=; b=CN/VvzF05nKwluG7rAB/lhwr5PGXVU7g0J/md9jJ4NOrPi01y9obYoO1 MiACTYu/D6Y84wcVC6NO58rh7BGayZQdh6F9q9St3nx0DEO/z3tuM7Q9N Halzb42fvc/7zYxKVUfiDtXEQRWisagf0kiuAYMCW/NJGY+eYu+niBx3Q 0fV4iWAP2zYpIl+47lwSMImYY/K3IvL4xmjJphRlq9lyoy07DC5HB7O6Z wKdKLqj3PoQcoiQAZ5wanAhh8fZiQ3KQnFuCI7rJdaaiSF1N+5uQoQiAr 71qfhdV7/Ucf1XBkgDCc2M2pW10q6fMhvzSCFw6PZqyQuP56tk3bSfSNo g==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="337318664" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="337318664" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 01:16:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="711250349" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="711250349" Received: from unknown (HELO localhost.localdomain) ([10.239.252.20]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 01:16:55 -0700 From: Song Jiale To: dts@dpdk.org Cc: Song Jiale Subject: [dts] [PATCH V1 2/2] tests/ipv4_reassembly: modify script to adapt changes in dpdk Date: Mon, 20 Mar 2023 16:13:34 +0000 Message-Id: <20230320161334.3300860-3-songx.jiale@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320161334.3300860-1-songx.jiale@intel.com> References: <20230320161334.3300860-1-songx.jiale@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org DPDK increase default value for config parameter RTE_LIBRTE_IP_FRAG_MAX_FRAG from 4 to 8. Modify the script to adapt to this change. According to dpdk commit f8e0f8ce90303b("ip_frag: increase default maximum of fragments"). Signed-off-by: Song Jiale --- tests/TestSuite_ipv4_reassembly.py | 40 ++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_ipv4_reassembly.py b/tests/TestSuite_ipv4_reassembly.py index 58b3fe3e..0950b259 100644 --- a/tests/TestSuite_ipv4_reassembly.py +++ b/tests/TestSuite_ipv4_reassembly.py @@ -10,6 +10,7 @@ Test the IP reassembly feature """ import os +import re import time from scapy.layers.inet import IP, TCP, Ether, fragment @@ -92,7 +93,7 @@ class TestIpReassembly(TestCase): # Test cases. # - def set_max_num_of_fragments(self, num_of_fragments=4): + def set_max_num_of_fragments(self, num_of_fragments): """ Changes the maximum number of frames by modifying the example app code. """ @@ -104,6 +105,22 @@ class TestIpReassembly(TestCase): self.dut.send_expect("rm -rf %s" % self.target, "# ", 5) self.dut.build_install_dpdk(self.target) + def get_dpdk_default_config(self, config_parms, config_file=""): + if config_file == "": + config_file = "config/rte_config.h" + out = self.dut.send_expect( + "cat %s | grep %s" % (config_file, config_parms), "[~|~\]]# " + ) + if len(out) == 0: + self.verify("Not Found parameter %s !!!" % config_parms) + regex = r"#define\s+%s\s+(\d+)" % config_parms + m = re.match(regex, out) + if m: + default_value = m.group(1) + return int(default_value) + else: + self.verify("Not Get parameter %s Vaule!!!" % config_parms) + def set_tester_iface_mtu(self, iface, mtu=1500): """ Set the interface MTU value. @@ -393,6 +410,9 @@ class TestIpReassembly(TestCase): dut_ports = self.dut.get_ports(self.nic) dut_port = dut_ports[0] self.destination_mac = self.dut.get_mac_address(dut_port) + self.default_max_fragments = self.get_dpdk_default_config( + "RTE_LIBRTE_IP_FRAG_MAX_FRAG" + ) def test_send_1K_frames_split_in_4_and_1K_maxflows(self): """ @@ -442,14 +462,10 @@ class TestIpReassembly(TestCase): self.verify_all() self.dut.send_expect("^C", "# ") time.sleep(5) - self.set_max_num_of_fragments(4) - time.sleep(5) except Exception as e: self.dut.send_expect("^C", "# ") time.sleep(2) - self.set_max_num_of_fragments() - self.compile_example_app() raise e def test_packets_are_forwarded_after_ttl_timeout(self): @@ -500,12 +516,14 @@ class TestIpReassembly(TestCase): def test_send_more_fragments_than_supported(self): """ - Sends 1 frame split in 5 fragments. Since the max number of - fragments is set to 4 by default, the packet can't be forwarded back. + Sends 1 frame split in into maximum fragments + 1 fragment, the packet can't be forwarded back. """ self.test_config = IpReassemblyTestConfig( - self, number_of_frames=1, frags_per_frame=5, payload_size=180 + self, + number_of_frames=1, + frags_per_frame=self.default_max_fragments + 1, + payload_size=(self.default_max_fragments + 1) * 40 - 20, ) self.execute_example_app() @@ -527,7 +545,6 @@ class TestIpReassembly(TestCase): self.test_config = IpReassemblyTestConfig( self, number_of_frames=1, flowttl="3s" ) - self.compile_example_app() self.execute_example_app() self.tcpdump_start_sniffing() @@ -563,7 +580,6 @@ class TestIpReassembly(TestCase): ) try: self.set_tester_iface_mtu(self.test_config.tester_iface, mtu) - self.compile_example_app() self.execute_example_app() self.send_n_siff_packets() self.verify_all() @@ -602,6 +618,10 @@ class TestIpReassembly(TestCase): """ self.dut.send_expect("^C", "# ") + self.max_fragments = self.get_dpdk_default_config("RTE_LIBRTE_IP_FRAG_MAX_FRAG") + if self.max_fragments != self.default_max_fragments: + self.set_max_num_of_fragments(self.default_max_fragments) + self.compile_example_app() def tear_down_all(self): """ -- 2.25.1