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, "#")