test suite reviews and discussions
 help / color / mirror / Atom feed
* Re: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
  2019-05-31 10:12 [dts] [PATCH V1] tests/tso:Optimize-the-verification-result zhu,shuai
@ 2019-05-31 10:09 ` Zhu, WenhuiX
  2019-06-04  7:25 ` Lin, Xueqin
  2019-06-05  2:42 ` Tu, Lijuan
  2 siblings, 0 replies; 4+ messages in thread
From: Zhu, WenhuiX @ 2019-05-31 10:09 UTC (permalink / raw)
  To: Zhu, ShuaiX, dts; +Cc: Zhu, ShuaiX


Tested-by: Zhu, WenhuiX <wenhuix.zhu@intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhu,shuai
Sent: Friday, May 31, 2019 6:12 PM
To: dts@dpdk.org
Cc: Zhu, ShuaiX <shuaix.zhu@intel.com>
Subject: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.

Modify the verification result of the case.

Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
---
 tests/TestSuite_tso.py | 126 +++++++++++++++++++++--------------------
 1 file changed, 64 insertions(+), 62 deletions(-)

diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 5e0dbd5..e560386 100644
--- a/tests/TestSuite_tso.py
+++ b/tests/TestSuite_tso.py
@@ -36,7 +36,7 @@ DPDK Test suite.
 Tests for TSO.
 
 """
-
+import os
 import utils
 import time
 import re
@@ -62,7 +62,7 @@ class TestTSO(TestCase):
         self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
 
-        self.frame_sizes = [128, 1458]
+        self.loading_sizes = [800, 801]
         self.rxfreet_values = [0, 8, 16, 32, 64, 128]
 
         self.test_cycles = [{'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}] @@ -83,6 +83,16 @@ class TestTSO(TestCase):
         """
         pass
 
+    def load_module(self):
+        """
+        Load vxlan or nvgre module to scapy.
+        """
+        cwd = os.getcwd()
+        dir_module = cwd + r'/' + 'dep'
+        self.tester.scapy_append('sys.path.append("%s")' % dir_module)
+        self.tester.scapy_append("from vxlan import Vxlan")
+        self.tester.scapy_append('from nvgre import NVGRE')
+
     def tcpdump_start_sniffing(self, ifaces=[]):
         """
         Starts tcpdump in the background to sniff the tester interface where @@ -93,7 +103,8 @@ class TestTSO(TestCase):
 
         for iface in ifaces:
             command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
-            self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface)
+            del_cmd = ('rm -f tcpdump_{0}.pcap').format(iface)
+            self.tester.send_expect(del_cmd, '#')
             self.tester.send_expect(command, '#')
 
     def tcpdump_stop_sniff(self):
@@ -137,7 +148,6 @@ class TestTSO(TestCase):
         self.verify(cores is not None, "Insufficient cores for speed testing")
         self.coreMask = utils.create_mask(cores)
 
-        padding = self.frame_sizes[0] - self.headers_size
 
         self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
         self.tester.send_expect("ip l set %s up" % tx_interface, "# ") @@ -163,34 +173,28 @@ class TestTSO(TestCase):
         self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("set fwd csum", "testpmd> ", 120)
         self.dut.send_expect("port start all", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
 
         self.tester.scapy_foreground()
         time.sleep(5)
 
-        # IPv4 tcp test
-
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
-
-        # IPv6 tcp test
-
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
+        for loading_size in self.loading_sizes:
+            # IPv4 tcp test
+            self.tcpdump_start_sniffing([tx_interface, rx_interface])
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
+            # IPv6 tcp test
+            self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
+            out = self.tester.scapy_execute()
+            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
+            print out
+            self.tcpdump_stop_sniff()
+            rx_stats = self.number_of_packets(rx_interface)
+            tx_stats = self.number_of_packets(tx_interface)
+            if (loading_size <= 800):
+                self.verify(rx_stats == tx_stats, "RX or TX packet number not correct")
+            else:
+                self.verify(rx_stats == tx_stats * 2, "RX or TX packet 
+ number not correct")
 
     def test_tso_tunneling(self):
         """
@@ -205,8 +209,6 @@ class TestTSO(TestCase):
         self.verify(cores is not None, "Insufficient cores for speed testing")
         self.coreMask = utils.create_mask(cores)
 
-        padding = self.frame_sizes[0] - self.headers_size
-
         self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
         self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
 
@@ -228,35 +230,34 @@ class TestTSO(TestCase):
         self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120)
 
-        self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
+        self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
+        self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", 
+ 120)
         self.dut.send_expect("set fwd csum", "testpmd> ", 120)
         self.dut.send_expect("port start all", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
 
         self.tester.scapy_foreground()
         time.sleep(5)
 
-        # Vxlan test
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport="1021",dport="4789")/VXLAN()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
-
-        # Nvgre test
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
+        for loading_size in self.loading_sizes:
+            # Vxlan test
+            self.tcpdump_start_sniffing([tx_interface, rx_interface])
+            self.load_module()
+            
+ self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00
+ ")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/
+ Vxlan()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",d
+ st="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % 
+ (mac, mac, loading_size, tx_interface))
+
+            # Nvgre test
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
+            out = self.tester.scapy_execute()
+            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
+            print out
+            self.tcpdump_stop_sniff()
+            rx_stats = self.number_of_packets(rx_interface)
+            tx_stats = self.number_of_packets(tx_interface)
+            if (loading_size <= 800):
+                self.verify(rx_stats == tx_stats, "RX or TX packet number not correct")
+            else:
+                self.verify(rx_stats == tx_stats * 2, "RX or TX packet 
+ number not correct")
 
     def test_perf_TSO_2ports(self):
         """
@@ -301,15 +302,15 @@ class TestTSO(TestCase):
             self.dut.send_expect("set fwd csum", "testpmd> ", 120)
             self.dut.send_expect("port start all", "testpmd> ", 120)
             self.dut.send_expect("start", "testpmd> ")
-            for frame_size in self.frame_sizes:
+            for loading_size in self.loading_sizes:
+                frame_size = loading_size + self.headers_size
                 wirespeed = self.wirespeed(self.nic, frame_size, 2)
 
                 # create pcap file
                 self.logger.info("Running with frame size %d " % frame_size)
-                payload_size = frame_size - self.headers_size
 		for _port in range(2):
 			mac = self.dut.get_mac_address(self.dut_ports[_port])
-                	self.tester.scapy_append('wrpcap("dst%d.pcap", [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size))
+                        self.tester.scapy_append('wrpcap("dst%d.pcap", 
+ [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192
+ .168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, 
+ loading_size))
         		tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]),
                            self.tester.get_local_port(self.dut_ports[1-_port]), "dst%d.pcap") % _port)
                 self.tester.scapy_execute() @@ -318,29 +319,30 @@ class TestTSO(TestCase):
                 _, pps = self.tester.traffic_generator_throughput(tgen_input)
 
                 pps /= 1000000.0
-                test_cycle['Mpps'][frame_size] = pps
-                test_cycle['pct'][frame_size] = pps * 100 / wirespeed
+                test_cycle['Mpps'][loading_size] = pps
+                test_cycle['pct'][loading_size] = pps * 100 / wirespeed
 
             self.dut.send_expect("stop", "testpmd> ")
             self.dut.send_expect("quit", "# ", 30)
             time.sleep(5)
 
         for n in range(len(self.test_cycles)):
-            for frame_size in self.frame_sizes:
+            for loading_size in self.loading_sizes:
                 self.verify(self.test_cycles[n]['Mpps'][
-                            frame_size] > 0, "No traffic detected")
+                            loading_size] > 0, "No traffic detected")
 
         # Print results
         self.result_table_create(self.table_header)
-        for frame_size in self.frame_sizes:
-            table_row = [frame_size]
+        for loading_size in self.loading_sizes:
+            table_row = [loading_size]
             for test_cycle in self.test_cycles:
-                table_row.append(test_cycle['Mpps'][frame_size])
-                table_row.append(test_cycle['pct'][frame_size])
+                table_row.append(test_cycle['Mpps'][loading_size])
+                table_row.append(test_cycle['pct'][loading_size])
 
             self.result_table_add(table_row)
 
         self.result_table_print()
+
     def tear_down(self):
         """
         Run after each test case.
--
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
@ 2019-05-31 10:12 zhu,shuai
  2019-05-31 10:09 ` Zhu, WenhuiX
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zhu,shuai @ 2019-05-31 10:12 UTC (permalink / raw)
  To: dts; +Cc: zhu,shuai

Modify the verification result of the case.

Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
---
 tests/TestSuite_tso.py | 126 +++++++++++++++++++++--------------------
 1 file changed, 64 insertions(+), 62 deletions(-)

diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py
index 5e0dbd5..e560386 100644
--- a/tests/TestSuite_tso.py
+++ b/tests/TestSuite_tso.py
@@ -36,7 +36,7 @@ DPDK Test suite.
 Tests for TSO.
 
 """
-
+import os
 import utils
 import time
 import re
@@ -62,7 +62,7 @@ class TestTSO(TestCase):
         self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
 
-        self.frame_sizes = [128, 1458]
+        self.loading_sizes = [800, 801]
         self.rxfreet_values = [0, 8, 16, 32, 64, 128]
 
         self.test_cycles = [{'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}]
@@ -83,6 +83,16 @@ class TestTSO(TestCase):
         """
         pass
 
+    def load_module(self):
+        """
+        Load vxlan or nvgre module to scapy.
+        """
+        cwd = os.getcwd()
+        dir_module = cwd + r'/' + 'dep'
+        self.tester.scapy_append('sys.path.append("%s")' % dir_module)
+        self.tester.scapy_append("from vxlan import Vxlan")
+        self.tester.scapy_append('from nvgre import NVGRE')
+
     def tcpdump_start_sniffing(self, ifaces=[]):
         """
         Starts tcpdump in the background to sniff the tester interface where
@@ -93,7 +103,8 @@ class TestTSO(TestCase):
 
         for iface in ifaces:
             command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface)
-            self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface)
+            del_cmd = ('rm -f tcpdump_{0}.pcap').format(iface)
+            self.tester.send_expect(del_cmd, '#')
             self.tester.send_expect(command, '#')
 
     def tcpdump_stop_sniff(self):
@@ -137,7 +148,6 @@ class TestTSO(TestCase):
         self.verify(cores is not None, "Insufficient cores for speed testing")
         self.coreMask = utils.create_mask(cores)
 
-        padding = self.frame_sizes[0] - self.headers_size
 
         self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
         self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
@@ -163,34 +173,28 @@ class TestTSO(TestCase):
         self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("set fwd csum", "testpmd> ", 120)
         self.dut.send_expect("port start all", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
 
         self.tester.scapy_foreground()
         time.sleep(5)
 
-        # IPv4 tcp test
-
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
-
-        # IPv6 tcp test
-
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
+        for loading_size in self.loading_sizes:
+            # IPv4 tcp test
+            self.tcpdump_start_sniffing([tx_interface, rx_interface])
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
+            # IPv6 tcp test
+            self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
+            out = self.tester.scapy_execute()
+            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
+            print out
+            self.tcpdump_stop_sniff()
+            rx_stats = self.number_of_packets(rx_interface)
+            tx_stats = self.number_of_packets(tx_interface)
+            if (loading_size <= 800):
+                self.verify(rx_stats == tx_stats, "RX or TX packet number not correct")
+            else:
+                self.verify(rx_stats == tx_stats * 2, "RX or TX packet number not correct")
 
     def test_tso_tunneling(self):
         """
@@ -205,8 +209,6 @@ class TestTSO(TestCase):
         self.verify(cores is not None, "Insufficient cores for speed testing")
         self.coreMask = utils.create_mask(cores)
 
-        padding = self.frame_sizes[0] - self.headers_size
-
         self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
         self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
 
@@ -228,35 +230,34 @@ class TestTSO(TestCase):
         self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120)
 
-        self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
+        self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
+        self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", 120)
         self.dut.send_expect("set fwd csum", "testpmd> ", 120)
         self.dut.send_expect("port start all", "testpmd> ", 120)
+        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
         self.dut.send_expect("start", "testpmd> ")
 
         self.tester.scapy_foreground()
         time.sleep(5)
 
-        # Vxlan test
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport="1021",dport="4789")/VXLAN()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
-
-        # Nvgre test
-        self.tcpdump_start_sniffing([tx_interface, rx_interface])
-        self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
-        out = self.tester.scapy_execute()
-        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
-        print out
-        self.tcpdump_stop_sniff()
-        rx_stats = self.number_of_packets(rx_interface)
-        if (rx_stats == 2):
-            self.verify(1, "Pass")
+        for loading_size in self.loading_sizes:
+            # Vxlan test
+            self.tcpdump_start_sniffing([tx_interface, rx_interface])
+            self.load_module()
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/Vxlan()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
+
+            # Nvgre test
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
+            out = self.tester.scapy_execute()
+            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
+            print out
+            self.tcpdump_stop_sniff()
+            rx_stats = self.number_of_packets(rx_interface)
+            tx_stats = self.number_of_packets(tx_interface)
+            if (loading_size <= 800):
+                self.verify(rx_stats == tx_stats, "RX or TX packet number not correct")
+            else:
+                self.verify(rx_stats == tx_stats * 2, "RX or TX packet number not correct")
 
     def test_perf_TSO_2ports(self):
         """
@@ -301,15 +302,15 @@ class TestTSO(TestCase):
             self.dut.send_expect("set fwd csum", "testpmd> ", 120)
             self.dut.send_expect("port start all", "testpmd> ", 120)
             self.dut.send_expect("start", "testpmd> ")
-            for frame_size in self.frame_sizes:
+            for loading_size in self.loading_sizes:
+                frame_size = loading_size + self.headers_size
                 wirespeed = self.wirespeed(self.nic, frame_size, 2)
 
                 # create pcap file
                 self.logger.info("Running with frame size %d " % frame_size)
-                payload_size = frame_size - self.headers_size
 		for _port in range(2):
 			mac = self.dut.get_mac_address(self.dut_ports[_port])
-                	self.tester.scapy_append('wrpcap("dst%d.pcap", [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size))
+                        self.tester.scapy_append('wrpcap("dst%d.pcap", [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, loading_size))
         		tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]),
                            self.tester.get_local_port(self.dut_ports[1-_port]), "dst%d.pcap") % _port)
                 self.tester.scapy_execute()
@@ -318,29 +319,30 @@ class TestTSO(TestCase):
                 _, pps = self.tester.traffic_generator_throughput(tgen_input)
 
                 pps /= 1000000.0
-                test_cycle['Mpps'][frame_size] = pps
-                test_cycle['pct'][frame_size] = pps * 100 / wirespeed
+                test_cycle['Mpps'][loading_size] = pps
+                test_cycle['pct'][loading_size] = pps * 100 / wirespeed
 
             self.dut.send_expect("stop", "testpmd> ")
             self.dut.send_expect("quit", "# ", 30)
             time.sleep(5)
 
         for n in range(len(self.test_cycles)):
-            for frame_size in self.frame_sizes:
+            for loading_size in self.loading_sizes:
                 self.verify(self.test_cycles[n]['Mpps'][
-                            frame_size] > 0, "No traffic detected")
+                            loading_size] > 0, "No traffic detected")
 
         # Print results
         self.result_table_create(self.table_header)
-        for frame_size in self.frame_sizes:
-            table_row = [frame_size]
+        for loading_size in self.loading_sizes:
+            table_row = [loading_size]
             for test_cycle in self.test_cycles:
-                table_row.append(test_cycle['Mpps'][frame_size])
-                table_row.append(test_cycle['pct'][frame_size])
+                table_row.append(test_cycle['Mpps'][loading_size])
+                table_row.append(test_cycle['pct'][loading_size])
 
             self.result_table_add(table_row)
 
         self.result_table_print()
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
  2019-05-31 10:12 [dts] [PATCH V1] tests/tso:Optimize-the-verification-result zhu,shuai
  2019-05-31 10:09 ` Zhu, WenhuiX
@ 2019-06-04  7:25 ` Lin, Xueqin
  2019-06-05  2:42 ` Tu, Lijuan
  2 siblings, 0 replies; 4+ messages in thread
From: Lin, Xueqin @ 2019-06-04  7:25 UTC (permalink / raw)
  To: Zhu, ShuaiX, dts; +Cc: Zhu, ShuaiX

Add my comment as below. 

Best regards,
Xueqin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhu,shuai
> Sent: Friday, May 31, 2019 6:12 PM
> To: dts@dpdk.org
> Cc: Zhu, ShuaiX <shuaix.zhu@intel.com>
> Subject: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
> 
> Modify the verification result of the case.
> 
> Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
> ---
>  tests/TestSuite_tso.py | 126 +++++++++++++++++++++--------------------
>  1 file changed, 64 insertions(+), 62 deletions(-)
> 
> diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index
> 5e0dbd5..e560386 100644
> --- a/tests/TestSuite_tso.py
> +++ b/tests/TestSuite_tso.py
> @@ -36,7 +36,7 @@ DPDK Test suite.
>  Tests for TSO.
> 
>  """
> -
> +import os
>  import utils
>  import time
>  import re
> @@ -62,7 +62,7 @@ class TestTSO(TestCase):
>          self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
>          self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
> 
> -        self.frame_sizes = [128, 1458]
> +        self.loading_sizes = [800, 801]

[xueqin]Suggest adding more loading sizes, not only normal size packet, combine jumboframe for the tests, such as loading size are 2500, 5000...


>          self.rxfreet_values = [0, 8, 16, 32, 64, 128]
> 
>          self.test_cycles = [{'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}] @@ -83,6
> +83,16 @@ class TestTSO(TestCase):
>          """
>          pass
> 
> +    def load_module(self):
> +        """
> +        Load vxlan or nvgre module to scapy.
> +        """
> +        cwd = os.getcwd()
> +        dir_module = cwd + r'/' + 'dep'
> +        self.tester.scapy_append('sys.path.append("%s")' % dir_module)
> +        self.tester.scapy_append("from vxlan import Vxlan")
> +        self.tester.scapy_append('from nvgre import NVGRE')
> +
>      def tcpdump_start_sniffing(self, ifaces=[]):
>          """
>          Starts tcpdump in the background to sniff the tester interface where
> @@ -93,7 +103,8 @@ class TestTSO(TestCase):
> 
>          for iface in ifaces:
>              command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> &').format(iface)
> -            self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface)
> +            del_cmd = ('rm -f tcpdump_{0}.pcap').format(iface)
> +            self.tester.send_expect(del_cmd, '#')
>              self.tester.send_expect(command, '#')
> 
>      def tcpdump_stop_sniff(self):
> @@ -137,7 +148,6 @@ class TestTSO(TestCase):
>          self.verify(cores is not None, "Insufficient cores for speed testing")
>          self.coreMask = utils.create_mask(cores)
> 
> -        padding = self.frame_sizes[0] - self.headers_size
> 
>          self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off
> lro off" % tx_interface, "# ")
>          self.tester.send_expect("ip l set %s up" % tx_interface, "# ") @@ -163,34
> +173,28 @@ class TestTSO(TestCase):
>          self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ",
> 120)
>          self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>          self.dut.send_expect("port start all", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
>          self.dut.send_expect("start", "testpmd> ")
> 
>          self.tester.scapy_foreground()
>          time.sleep(5)
> 
> -        # IPv4 tcp test
> -
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP
> (src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)
> ], iface="%s")' % (mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> -
> -        # IPv6 tcp test
> -
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -        self.tester.scapy_append('sendp([Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200",
> dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1
> 021)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> +        for loading_size in self.loading_sizes:
> +            # IPv4 tcp test
> +            self.tcpdump_start_sniffing([tx_interface, rx_interface])
> +
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP
> (src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)
> ], iface="%s")' % (mac, loading_size, tx_interface))
> +            # IPv6 tcp test
> +            self.tester.scapy_append('sendp([Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200",
> dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1
> 021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
> +            out = self.tester.scapy_execute()
> +            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> +            print out
> +            self.tcpdump_stop_sniff()
> +            rx_stats = self.number_of_packets(rx_interface)
> +            tx_stats = self.number_of_packets(tx_interface)
> +            if (loading_size <= 800):
> +                self.verify(rx_stats == tx_stats, "RX or TX packet number not
> correct")
> +            else:
> +                self.verify(rx_stats == tx_stats * 2, "RX or TX packet
> + number not correct")

[Xueqin] Suggest adding more verify conditions to avoid contingency, not only check packet numbers, also check transmitted packets payload size. 
If payload is 801, transmitted payload size should be [800,1], transmitted packet number is 2. 
If sending 2500  payload, seg to 4 packets, transmitted payload size should be [800, 800, 800, 100] 

2500 length = 800 length *3 + 100

09:48:22.368802 52:00:00:00:00:00 > 3c:fd:fe:a7:7b:1c, ethertype IPv4 (0x0800), length 2554: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto TCP (6), length 2540)
    192.168.1.1.exp1 > 192.168.1.2.exp1: Flags [S], cksum 0x9b71 (correct), seq 0:2500, win 8192, length 2500

09:48:22.368919 3c:fd:fe:a7:7b:1c > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 854: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto TCP (6), length 840)
    192.168.1.1.exp1 > 192.168.1.2.exp1: Flags [S], cksum 0xf76a (correct), seq 0:800, win 8192, length 800
09:48:22.368926 3c:fd:fe:a7:7b:1c > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 854: (tos 0x0, ttl 64, id 2, offset 0, flags [none], proto TCP (6), length 840)
    192.168.1.1.exp1 > 192.168.1.2.exp1: Flags [S], cksum 0xf44a (correct), seq 800:1600, win 8192, length 800
09:48:22.368929 3c:fd:fe:a7:7b:1c > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 854: (tos 0x0, ttl 64, id 3, offset 0, flags [none], proto TCP (6), length 840)
    192.168.1.1.exp1 > 192.168.1.2.exp1: Flags [S], cksum 0xf12a (correct), seq 1600:2400, win 8192, length 800
09:48:22.368932 3c:fd:fe:a7:7b:1c > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 154: (tos 0x0, ttl 64, id 4, offset 0, flags [none], proto TCP (6), length 140)
    192.168.1.1.exp1 > 192.168.1.2.exp1: Flags [S], cksum 0xb98f (correct), seq 2400:2500, win 8192, length 100 


> 
>      def test_tso_tunneling(self):
>          """
> @@ -205,8 +209,6 @@ class TestTSO(TestCase):
>          self.verify(cores is not None, "Insufficient cores for speed testing")
>          self.coreMask = utils.create_mask(cores)
> 
> -        padding = self.frame_sizes[0] - self.headers_size
> -
>          self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off
> lro off" % tx_interface, "# ")
>          self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
> 
> @@ -228,35 +230,34 @@ class TestTSO(TestCase):
>          self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1],
> "testpmd> ", 120)
>          self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1],
> "testpmd> ", 120)
> 
> -        self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ",
> 120)
> +        self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1],
> "testpmd> ", 120)
> +        self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ",
> + 120)
>          self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>          self.dut.send_expect("port start all", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
>          self.dut.send_expect("start", "testpmd> ")
> 
>          self.tester.scapy_foreground()
>          time.sleep(5)
> 
> -        # Vxlan test
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP
> (src="192.168.1.1",dst="192.168.1.2")/UDP(sport="1021",dport="4789")/VXL
> AN()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.1
> 68.1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac,
> mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> -
> -        # Nvgre test
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP
> (src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst=%s,src="
> 52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="102
> 1",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> +        for loading_size in self.loading_sizes:
> +            # Vxlan test
> +            self.tcpdump_start_sniffing([tx_interface, rx_interface])
> +            self.load_module()
> +
> + self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00
> + ")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/
> + Vxlan()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",d
> + st="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' %
> + (mac, mac, loading_size, tx_interface))
> +
> +            # Nvgre test
> +
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP
> (src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src
> ="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=10
> 21,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size,
> tx_interface))
> +            out = self.tester.scapy_execute()
> +            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> +            print out
> +            self.tcpdump_stop_sniff()
> +            rx_stats = self.number_of_packets(rx_interface)
> +            tx_stats = self.number_of_packets(tx_interface)
> +            if (loading_size <= 800):
> +                self.verify(rx_stats == tx_stats, "RX or TX packet number not
> correct")
> +            else:
> +                self.verify(rx_stats == tx_stats * 2, "RX or TX packet
> + number not correct")
> 
>      def test_perf_TSO_2ports(self):
>          """
> @@ -301,15 +302,15 @@ class TestTSO(TestCase):
>              self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>              self.dut.send_expect("port start all", "testpmd> ", 120)
>              self.dut.send_expect("start", "testpmd> ")
> -            for frame_size in self.frame_sizes:
> +            for loading_size in self.loading_sizes:
> +                frame_size = loading_size + self.headers_size
>                  wirespeed = self.wirespeed(self.nic, frame_size, 2)
> 
>                  # create pcap file
>                  self.logger.info("Running with frame size %d " % frame_size)
> -                payload_size = frame_size - self.headers_size
>  		for _port in range(2):
>  			mac =
> self.dut.get_mac_address(self.dut_ports[_port])
> -                	self.tester.scapy_append('wrpcap("dst%d.pcap",
> [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.
> 1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size))
> +                        self.tester.scapy_append('wrpcap("dst%d.pcap",
> + [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192
> + .168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac,
> + loading_size))
> 
> 	tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]),
>                             self.tester.get_local_port(self.dut_ports[1-_port]),
> "dst%d.pcap") % _port)
>                  self.tester.scapy_execute() @@ -318,29 +319,30 @@ class
> TestTSO(TestCase):
>                  _, pps = self.tester.traffic_generator_throughput(tgen_input)
> 
>                  pps /= 1000000.0
> -                test_cycle['Mpps'][frame_size] = pps
> -                test_cycle['pct'][frame_size] = pps * 100 / wirespeed
> +                test_cycle['Mpps'][loading_size] = pps
> +                test_cycle['pct'][loading_size] = pps * 100 / wirespeed
> 
>              self.dut.send_expect("stop", "testpmd> ")
>              self.dut.send_expect("quit", "# ", 30)
>              time.sleep(5)
> 
>          for n in range(len(self.test_cycles)):
> -            for frame_size in self.frame_sizes:
> +            for loading_size in self.loading_sizes:
>                  self.verify(self.test_cycles[n]['Mpps'][
> -                            frame_size] > 0, "No traffic detected")
> +                            loading_size] > 0, "No traffic detected")
> 
>          # Print results
>          self.result_table_create(self.table_header)
> -        for frame_size in self.frame_sizes:
> -            table_row = [frame_size]
> +        for loading_size in self.loading_sizes:
> +            table_row = [loading_size]
>              for test_cycle in self.test_cycles:
> -                table_row.append(test_cycle['Mpps'][frame_size])
> -                table_row.append(test_cycle['pct'][frame_size])
> +                table_row.append(test_cycle['Mpps'][loading_size])
> +                table_row.append(test_cycle['pct'][loading_size])
> 
>              self.result_table_add(table_row)
> 
>          self.result_table_print()
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
  2019-05-31 10:12 [dts] [PATCH V1] tests/tso:Optimize-the-verification-result zhu,shuai
  2019-05-31 10:09 ` Zhu, WenhuiX
  2019-06-04  7:25 ` Lin, Xueqin
@ 2019-06-05  2:42 ` Tu, Lijuan
  2 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2019-06-05  2:42 UTC (permalink / raw)
  To: Zhu, ShuaiX, dts; +Cc: Zhu, ShuaiX



> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhu,shuai
> Sent: Friday, May 31, 2019 6:12 PM
> To: dts@dpdk.org
> Cc: Zhu, ShuaiX <shuaix.zhu@intel.com>
> Subject: [dts] [PATCH V1] tests/tso:Optimize-the-verification-result.
> 
> Modify the verification result of the case.
> 
> Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
> ---
>  tests/TestSuite_tso.py | 126 +++++++++++++++++++++--------------------
>  1 file changed, 64 insertions(+), 62 deletions(-)
> 
> diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index
> 5e0dbd5..e560386 100644
> --- a/tests/TestSuite_tso.py
> +++ b/tests/TestSuite_tso.py
> @@ -36,7 +36,7 @@ DPDK Test suite.
>  Tests for TSO.
> 
>  """
> -
> +import os
>  import utils
>  import time
>  import re
> @@ -62,7 +62,7 @@ class TestTSO(TestCase):
>          self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
>          self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
> 
> -        self.frame_sizes = [128, 1458]
> +        self.loading_sizes = [800, 801]
[Lijuan] it's better to test more different packets, the frame size could be range from 64 to 9000, and use a random function to get the typical frame size, such as :
1, random from 64 to 799, random from 802 to 9000
>          self.rxfreet_values = [0, 8, 16, 32, 64, 128]
> 
>          self.test_cycles = [{'cores': '1S/1C/2T', 'Mpps': {}, 'pct': {}}] @@ -83,6
> +83,16 @@ class TestTSO(TestCase):
>          """
>          pass
> 
> +    def load_module(self):
> +        """
> +        Load vxlan or nvgre module to scapy.
> +        """
> +        cwd = os.getcwd()
> +        dir_module = cwd + r'/' + 'dep'
> +        self.tester.scapy_append('sys.path.append("%s")' % dir_module)
> +        self.tester.scapy_append("from vxlan import Vxlan")
> +        self.tester.scapy_append('from nvgre import NVGRE')
> +
>      def tcpdump_start_sniffing(self, ifaces=[]):
>          """
>          Starts tcpdump in the background to sniff the tester interface where
> @@ -93,7 +103,8 @@ class TestTSO(TestCase):
> 
>          for iface in ifaces:
>              command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out
> &').format(iface)
> -            self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface)
> +            del_cmd = ('rm -f tcpdump_{0}.pcap').format(iface)
> +            self.tester.send_expect(del_cmd, '#')
>              self.tester.send_expect(command, '#')
> 
>      def tcpdump_stop_sniff(self):
> @@ -137,7 +148,6 @@ class TestTSO(TestCase):
>          self.verify(cores is not None, "Insufficient cores for speed testing")
>          self.coreMask = utils.create_mask(cores)
> 
> -        padding = self.frame_sizes[0] - self.headers_size
> 
>          self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off
> lro off" % tx_interface, "# ")
>          self.tester.send_expect("ip l set %s up" % tx_interface, "# ") @@ -
> 163,34 +173,28 @@ class TestTSO(TestCase):
>          self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ",
> 120)
>          self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>          self.dut.send_expect("port start all", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
>          self.dut.send_expect("start", "testpmd> ")
> 
>          self.tester.scapy_foreground()
>          time.sleep(5)
> 
> -        # IPv4 tcp test
> -
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(
> src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)],
> iface="%s")' % (mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> -
> -        # IPv6 tcp test
> -
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -        self.tester.scapy_append('sendp([Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200",
> dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=102
> 1)/("X"*%s)], iface="%s")' % (mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> +        for loading_size in self.loading_sizes:
> +            # IPv4 tcp test
> +            self.tcpdump_start_sniffing([tx_interface, rx_interface])
> +
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(
> src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)],
> iface="%s")' % (mac, loading_size, tx_interface))
> +            # IPv6 tcp test
> +            self.tester.scapy_append('sendp([Ether(dst="%s",
> src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200",
> dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=102
> 1)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface))
> +            out = self.tester.scapy_execute()
> +            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> +            print out
> +            self.tcpdump_stop_sniff()
> +            rx_stats = self.number_of_packets(rx_interface)
> +            tx_stats = self.number_of_packets(tx_interface)
> +            if (loading_size <= 800):
> +                self.verify(rx_stats == tx_stats, "RX or TX packet number not
> correct")
> +            else:
> +                self.verify(rx_stats == tx_stats * 2, "RX or TX packet
> + number not correct")
> 
>      def test_tso_tunneling(self):
>          """
> @@ -205,8 +209,6 @@ class TestTSO(TestCase):
>          self.verify(cores is not None, "Insufficient cores for speed testing")
>          self.coreMask = utils.create_mask(cores)
> 
> -        padding = self.frame_sizes[0] - self.headers_size
> -
>          self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off
> lro off" % tx_interface, "# ")
>          self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
> 
> @@ -228,35 +230,34 @@ class TestTSO(TestCase):
>          self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1],
> "testpmd> ", 120)
>          self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1],
> "testpmd> ", 120)
> 
> -        self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ",
> 120)
> +        self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1],
> "testpmd> ", 120)
> +        self.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ",
> + 120)
>          self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>          self.dut.send_expect("port start all", "testpmd> ", 120)
> +        self.dut.send_expect("set promisc all off", "testpmd> ", 120)
>          self.dut.send_expect("start", "testpmd> ")
> 
>          self.tester.scapy_foreground()
>          time.sleep(5)
> 
> -        # Vxlan test
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(
> src="192.168.1.1",dst="192.168.1.2")/UDP(sport="1021",dport="4789")/VXLA
> N()/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.
> 1.2")/TCP(sport="1021",dport="1021")/("X"*%s)], iface="%s")' % (mac, mac,
> padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> -
> -        # Nvgre test
> -        self.tcpdump_start_sniffing([tx_interface, rx_interface])
> -
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(
> src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst=%s,src="52
> :00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport="1021",d
> port="1021")/("X"*%s)], iface="%s")' % (mac, mac, padding, tx_interface))
> -        out = self.tester.scapy_execute()
> -        out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> -        print out
> -        self.tcpdump_stop_sniff()
> -        rx_stats = self.number_of_packets(rx_interface)
> -        if (rx_stats == 2):
> -            self.verify(1, "Pass")
> +        for loading_size in self.loading_sizes:
> +            # Vxlan test
> +            self.tcpdump_start_sniffing([tx_interface, rx_interface])
> +            self.load_module()
> +
> + self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00
> + ")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/
> + Vxlan()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",d
> + st="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' %
> + (mac, mac, loading_size, tx_interface))
> +
> +            # Nvgre test
> +
> self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(
> src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="
> 52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,d
> port=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
> +            out = self.tester.scapy_execute()
> +            out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
> +            print out
> +            self.tcpdump_stop_sniff()
> +            rx_stats = self.number_of_packets(rx_interface)
> +            tx_stats = self.number_of_packets(tx_interface)
> +            if (loading_size <= 800):
> +                self.verify(rx_stats == tx_stats, "RX or TX packet number not
> correct")
> +            else:
> +                self.verify(rx_stats == tx_stats * 2, "RX or TX packet
> + number not correct")
> 
>      def test_perf_TSO_2ports(self):
>          """
> @@ -301,15 +302,15 @@ class TestTSO(TestCase):
>              self.dut.send_expect("set fwd csum", "testpmd> ", 120)
>              self.dut.send_expect("port start all", "testpmd> ", 120)
>              self.dut.send_expect("start", "testpmd> ")
> -            for frame_size in self.frame_sizes:
> +            for loading_size in self.loading_sizes:
> +                frame_size = loading_size + self.headers_size
>                  wirespeed = self.wirespeed(self.nic, frame_size, 2)
> 
>                  # create pcap file
>                  self.logger.info("Running with frame size %d " % frame_size)
> -                payload_size = frame_size - self.headers_size
>  		for _port in range(2):
>  			mac = self.dut.get_mac_address(self.dut_ports[_port])
> -                	self.tester.scapy_append('wrpcap("dst%d.pcap",
> [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.
> 2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size))
> +                        self.tester.scapy_append('wrpcap("dst%d.pcap",
> + [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192
> + .168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac,
> + loading_size))
> 
> 	tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]),
>                             self.tester.get_local_port(self.dut_ports[1-_port]),
> "dst%d.pcap") % _port)
>                  self.tester.scapy_execute() @@ -318,29 +319,30 @@ class
> TestTSO(TestCase):
>                  _, pps = self.tester.traffic_generator_throughput(tgen_input)
> 
>                  pps /= 1000000.0
> -                test_cycle['Mpps'][frame_size] = pps
> -                test_cycle['pct'][frame_size] = pps * 100 / wirespeed
> +                test_cycle['Mpps'][loading_size] = pps
> +                test_cycle['pct'][loading_size] = pps * 100 / wirespeed
> 
>              self.dut.send_expect("stop", "testpmd> ")
>              self.dut.send_expect("quit", "# ", 30)
>              time.sleep(5)
> 
>          for n in range(len(self.test_cycles)):
> -            for frame_size in self.frame_sizes:
> +            for loading_size in self.loading_sizes:
>                  self.verify(self.test_cycles[n]['Mpps'][
> -                            frame_size] > 0, "No traffic detected")
> +                            loading_size] > 0, "No traffic detected")
> 
>          # Print results
>          self.result_table_create(self.table_header)
> -        for frame_size in self.frame_sizes:
> -            table_row = [frame_size]
> +        for loading_size in self.loading_sizes:
> +            table_row = [loading_size]
>              for test_cycle in self.test_cycles:
> -                table_row.append(test_cycle['Mpps'][frame_size])
> -                table_row.append(test_cycle['pct'][frame_size])
> +                table_row.append(test_cycle['Mpps'][loading_size])
> +                table_row.append(test_cycle['pct'][loading_size])
> 
>              self.result_table_add(table_row)
> 
>          self.result_table_print()
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-05  2:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 10:12 [dts] [PATCH V1] tests/tso:Optimize-the-verification-result zhu,shuai
2019-05-31 10:09 ` Zhu, WenhuiX
2019-06-04  7:25 ` Lin, Xueqin
2019-06-05  2:42 ` Tu, Lijuan

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).