test suite reviews and discussions
 help / color / mirror / Atom feed
From: Ke Xu <ke1.xu@intel.com>
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	[thread overview]
Message-ID: <20220823055939.4186198-3-ke1.xu@intel.com> (raw)
In-Reply-To: <20220823055939.4186198-1-ke1.xu@intel.com>

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 <ke1.xu@intel.com>
---
 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


  parent reply	other threads:[~2022-08-23  6:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  5:59 [dts][PATCH V1 0/2] tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify error and " Ke Xu
2022-08-23  5:59 ` [dts][PATCH V1 1/2] tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify error Ke Xu
2022-08-23  5:59 ` Ke Xu [this message]
2022-09-02  1:57   ` [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance lijuan.tu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220823055939.4186198-3-ke1.xu@intel.com \
    --to=ke1.xu@intel.com \
    --cc=dts@dpdk.org \
    --cc=qi.fu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).