From patchwork Tue Aug 23 05:59:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 115350 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 845A0A0093; Tue, 23 Aug 2022 08:01:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8063A40DFD; Tue, 23 Aug 2022 08:01:24 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 4068E400D6 for ; Tue, 23 Aug 2022 08:01:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661234483; x=1692770483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+cp0Y3JKE1jzz2mVlBql+fp/dgkP1Oar/Ne7fmWxyOQ=; b=g2ilEQv2MgS/m9cA5wY3cLLGnhvHoL2K5CrwHlaaQ175uIh3tNJvPvmd tJLpCELEwlSYSd/miME8w4ts3pmg8ZXcAjVDIXmXHjZRXukaBxB9X3Nzl kwHCWOTu5PaGvDWbQvMrFV1TcrQuy1tv7PFD1dU1eBBu9COJtsVVu8eDR +4Kvkl/MP7h9t1/0QhJL1qHppeH4Jpsnvi0Opfu8sc9ExuCYT8WILt9iW NEzDbJ7ZPHxDVVpDcO+N/UxxUQs7XttgV6ynWZiHBx9Ug2YUuehV416gJ ClC4Ze3zcCa6HyJUIvfOnf7sUE+nHBhUCj+dV5/5bzlLc/LXCrrO2BrG0 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="319640151" X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="319640151" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2022 23:01:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="560034955" Received: from unknown (HELO DPDK-XUKE-LAB.sh.intel.com) ([10.67.116.226]) by orsmga003.jf.intel.com with ESMTP; 22 Aug 2022 23:01:19 -0700 From: Ke Xu To: dts@dpdk.org Cc: qi.fu@intel.com, ke1.xu@intel.com Subject: [dts][PATCH V1 1/2] tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify error Date: Tue, 23 Aug 2022 05:59:38 +0000 Message-Id: <20220823055939.4186198-2-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220823055939.4186198-1-ke1.xu@intel.com> References: <20220823055939.4186198-1-ke1.xu@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 Function "get_chksum_value_and_verify" in test suite TSO case test_tso_tunneling cannot verify checksum error. This function uses the auto checksum calculation of scapy by reading the pcap file, erasing the checksum and writing back to a new pcap file. Duplicated call to method "packet.read_pcapfile" at line 149 and line 162 will append extra packets to the packet sequence stored in "packet.pktgen.pkts". And erasing the checksum at line 153 to line 160 will modify the appended packets. This leads to a wrongly organized packet sequence writen to file at line 161, causing the checksum verifying wrongly use the raw checksum as the corrected checksum. This fails the following checksum verifying. By removing duplicated method call at line 149 and creating new object for temporary use at line 162. This bug is fixed. Signed-off-by: Ke Xu --- tests/TestSuite_tso.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 778ba3cc..ef63b7cf 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -146,7 +146,6 @@ class TestTSO(TestCase): packet = Packet() self.pks = packet.read_pcapfile(dump_pcap, self.tester) for i in range(len(self.pks)): - self.pks = packet.read_pcapfile(dump_pcap, self.tester) pks = self.pks[i] out = pks.show chksum_list = re.findall(r"chksum=(0x\w+)", str(out)) @@ -159,7 +158,7 @@ class TestTSO(TestCase): pks["GRE"]["IP"].chksum = None pks["GRE"]["TCP"].chksum = None packet.save_pcapfile(self.tester, filename=save_file) - self.pks1 = packet.read_pcapfile(save_file, self.tester) + self.pks1 = Packet().read_pcapfile(save_file, self.tester) out1 = self.pks1[i].show chksum_list1 = re.findall(r"chksum=(0x\w+)", str(out1)) self.tester.send_expect("rm -rf %s" % save_file, "#") From patchwork Tue Aug 23 05:59:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 115351 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 AB662A0093; Tue, 23 Aug 2022 08:01:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A33C3410F2; Tue, 23 Aug 2022 08:01:32 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id D8E42400D6 for ; Tue, 23 Aug 2022 08:01:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661234491; x=1692770491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OPOXyTV8FMFACTJgS1aR6J1hCtEm8/ire+KhySTGYVI=; b=gFhUJXJhi4oHT8ifhEBdyNmdUFFUL26+J8uTYCzjeVF4KgQs1k36TdtV HMZKkPzKqmZBktXK3p/2BZe1OYQOYoGV9Xd49jqWNQ3cbdGXwGJQ5KPlN LL0nPZLPQUhqJ2HS4wmsDDx2edF6ueq51LfhTkiSdWAT/0Q+t43Do70yW 5Vkqv3vWzfID9EhYx0NQVF4dkH0OF93uY/bumVa4KKbPLGiMukMTJs3jp r5F2bIEzRkP1VimMB/JXKeU5jgv4iyR5Cz8N1hxvKmPlM7EqXDyhBVg0k PbbUnXK4hOdrnriAKVG/+8NuwoIGX53LCxFugHbavUrKaH7AMgFGSWki8 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="273353171" X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="273353171" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2022 23:01:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,256,1654585200"; d="scan'208";a="560034984" Received: from unknown (HELO DPDK-XUKE-LAB.sh.intel.com) ([10.67.116.226]) by orsmga003.jf.intel.com with ESMTP; 22 Aug 2022 23:01:28 -0700 From: Ke Xu To: dts@dpdk.org Cc: qi.fu@intel.com, ke1.xu@intel.com Subject: [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance Date: Tue, 23 Aug 2022 05:59:39 +0000 Message-Id: <20220823055939.4186198-3-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220823055939.4186198-1-ke1.xu@intel.com> References: <20220823055939.4186198-1-ke1.xu@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 Function "get_chksum_value_and_verify" in test suite TSO case test_tso_tunneling is of low efficiency. Methods are wrongly used. Duplicated call to method "packet.read_pcapfile" in this function will lengthen the packet sequence stored in "packet.pktgen.pkts", consuming more time when save pcap file. Duplicated call to method "packet.save_pcapfile" is also time consuming. Method "pks.show" and "self.pks1[i].show" is not used as expected. "*.show" is used to print the packet object, not intended to return a string. Current code is actually getting a method object and using "str(*)" method to turn a method object to a string, this may fail when "*.show" method is updated. The packet information printing here is equivilant to "repr(pks)". Signed-off-by: Ke Xu Acked-by: Lijuan Tu --- tests/TestSuite_tso.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index ef63b7cf..a7d74ca3 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -147,22 +147,27 @@ class TestTSO(TestCase): self.pks = packet.read_pcapfile(dump_pcap, self.tester) for i in range(len(self.pks)): pks = self.pks[i] - out = pks.show - chksum_list = re.findall(r"chksum=(0x\w+)", str(out)) + out = repr(pks) + chksum_list = re.findall(r"chksum=(0x\w+)", out) pks["IP"].chksum = None - if "VXLAN" in str(out): + if "VXLAN" in out: pks["UDP"].chksum = None pks["VXLAN"]["IP"].chksum = None pks["VXLAN"]["TCP"].chksum = None - elif "GRE" in str(out): + elif "GRE" in out: pks["GRE"]["IP"].chksum = None pks["GRE"]["TCP"].chksum = None - packet.save_pcapfile(self.tester, filename=save_file) - self.pks1 = Packet().read_pcapfile(save_file, self.tester) - out1 = self.pks1[i].show - chksum_list1 = re.findall(r"chksum=(0x\w+)", str(out1)) - self.tester.send_expect("rm -rf %s" % save_file, "#") - if self.nic in Nic_list and "VXLAN" in str(out): + packet.save_pcapfile(self.tester, filename=save_file) + self.pks = Packet().read_pcapfile(dump_pcap, self.tester) + self.pks1 = Packet().read_pcapfile(save_file, self.tester) + self.tester.send_expect("rm -rf %s" % save_file, "#") + for i in range(len(self.pks1)): + pks = self.pks[i] + out = repr(pks) + chksum_list = re.findall(r"chksum=(0x\w+)", out) + out1 = repr(self.pks1[i]) + chksum_list1 = re.findall(r"chksum=(0x\w+)", out1) + if self.nic in Nic_list and "VXLAN" in out: self.verify( chksum_list[0] == chksum_list1[0] and chksum_list[2] == chksum_list1[2]