* [dts][PATCH V1 0/2] tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify error and improve the performance
@ 2022-08-23 5:59 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 ` [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance Ke Xu
0 siblings, 2 replies; 4+ messages in thread
From: Ke Xu @ 2022-08-23 5:59 UTC (permalink / raw)
To: dts; +Cc: qi.fu, ke1.xu
Function get_chksum_value_and_verify in test suite TSO case test_tso_tunneling
cannot verify checksum error. Duplicated call to packet.read_pcapfile will
change the packet sequence stored in packet.pktgen.pkts, leading to a wrongly
organized packet sequence writen to file, and fails the following checksum
verifying.
The wrongly used methods also lead to a low effeciency. Duplicated call to
packet.read_pcapfile will lengthen the packet sequence stored in
packet.pktgen.pkts. Duplicated call to packet.save_pcapfile is also time
consuming.
There is also a misuse of show method that *.show() will print a packet info,
but will not return a string. The *.show will return a method object, and the
following str(out) will turn the method object into a string, so here when use
out = x.show, checksum looking up in str(out) it is equivalent to that in
repr(x).
In the first commit, the checksum verifying problem is fixed.
In the second commit, this function is improved that the case running time is
decresed by 2 minutes.
Ke Xu (2):
tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify
error
tests/tso: modify get_chksum_value_and_verify to improve the
performance
tests/TestSuite_tso.py | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts][PATCH V1 1/2] tests/tso: modify get_chksum_value_and_verify to fix a checksum-verify error
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 improve the performance Ke Xu
@ 2022-08-23 5:59 ` Ke Xu
2022-08-23 5:59 ` [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance Ke Xu
1 sibling, 0 replies; 4+ messages in thread
From: Ke Xu @ 2022-08-23 5:59 UTC (permalink / raw)
To: dts; +Cc: qi.fu, ke1.xu
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 <ke1.xu@intel.com>
---
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, "#")
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance
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 improve the performance 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
2022-09-02 1:57 ` lijuan.tu
1 sibling, 1 reply; 4+ messages in thread
From: Ke Xu @ 2022-08-23 5:59 UTC (permalink / raw)
To: dts; +Cc: qi.fu, ke1.xu
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance
2022-08-23 5:59 ` [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance Ke Xu
@ 2022-09-02 1:57 ` lijuan.tu
0 siblings, 0 replies; 4+ messages in thread
From: lijuan.tu @ 2022-09-02 1:57 UTC (permalink / raw)
To: dts, Ke Xu; +Cc: qi.fu, ke1.xu
On Tue, 23 Aug 2022 05:59:39 +0000, Ke Xu <ke1.xu@intel.com> wrote:
> 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>
Acked-by: Lijuan Tu <lijuan.tu@intel.com>
Series applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-02 1:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 improve the performance 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 ` [dts][PATCH V1 2/2] tests/tso: modify get_chksum_value_and_verify to improve the performance Ke Xu
2022-09-02 1:57 ` lijuan.tu
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).