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 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 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 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 --- 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] -- 2.25.1