From patchwork Mon Mar 20 18:05:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 125311 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 E3185427E0; Mon, 20 Mar 2023 11:08:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD8A9410EF; Mon, 20 Mar 2023 11:08:26 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 509BA406BC for ; Mon, 20 Mar 2023 11:08:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679306905; x=1710842905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bUeeXQAtdi+z+KRULdEPL6FCHoFRKhG/X9MEsypu7p8=; b=In+MyUk9ba+PWwvw5sghaZDEJhR2Irm4zWwVnxn8kf48oqZxy3hAI9/p hwlCN9V9RP3hcM66myd3d1FHIK1FOI+y73ylAj23/DtwAWTLJkyrRMDdk KnkNGHSk8dukBGI2Zs4fLxs2Chnw6lTvoxW8LjD1W7JCN+AXMiTNa9cvP iI5HjPRsmD5hq+sfCigAIBTpG6eaQkllq22JxOo+pzLtPw08S102b9r9o 4tKfIxUnm7Y2lvAZ06wDfDeGjwl7P7Y0UH+R7d32TJd8GNa2187Mckxfm CFPL5apGfmxMN8cgylbY2XMGvT3xXDPb3ShZDH1m0MwzNBAfk9+Xw4O0S A==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="366339390" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="366339390" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 03:08:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="926914607" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="926914607" Received: from unknown (HELO localhost.localdomain) ([10.239.252.20]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 03:08:23 -0700 From: Song Jiale To: dts@dpdk.org Cc: Song Jiale Subject: [dts] [PATCH V2 2/2] tests/ipv4_reassembly: modify script to adapt changes in dpdk Date: Mon, 20 Mar 2023 18:05:03 +0000 Message-Id: <20230320180503.3307034-3-songx.jiale@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320180503.3307034-1-songx.jiale@intel.com> References: <20230320180503.3307034-1-songx.jiale@intel.com> MIME-Version: 1.0 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 Acked-by: Yuan Peng Reviewed-by: Lijuan Tu --- tests/TestSuite_ipv4_reassembly.py | 40 ++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) V2: -modify incorrect parameters. diff --git a/tests/TestSuite_ipv4_reassembly.py b/tests/TestSuite_ipv4_reassembly.py index 58b3fe3e..1e9f7f4e 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_params, config_file=""): + if config_file == "": + config_file = "config/rte_config.h" + out = self.dut.send_expect( + "cat %s | grep %s" % (config_file, config_params), "[~|~\]]# " + ) + if len(out) == 0: + self.verify(False, "Not Found Parameter %s !!!" % config_params) + regex = r"#define\s+%s\s+(\d+)" % config_params + m = re.match(regex, out) + if m: + default_value = m.group(1) + return int(default_value) + else: + self.verify(False, "Not Get Parameter %s Value!!!" % config_params) + 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): """