[V1,2/2] tests/dpdk_gro_lib: add udp traffice testcase

Message ID 20220907130011.1728407-1-weix.ling@intel.com (mailing list archive)
State Superseded
Headers
Series add new udp traffic testcases |

Checks

Context Check Description
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-doc-test success Testing OK
ci/Intel-dts-suite-test warning SKIPPED

Commit Message

Ling, WeiX Sept. 7, 2022, 1 p.m. UTC
  1.Supplement testcase 5 in dpdk_gro_lib testsuite.
2.Add new udp traffic testcase 6-10 in dpdk_gro_lib testsuite.

Signed-off-by: Wei Ling <weix.ling@intel.com>
---
 tests/TestSuite_dpdk_gro_lib.py | 327 ++++++++++++++++++++++++++++----
 1 file changed, 294 insertions(+), 33 deletions(-)
  

Patch

diff --git a/tests/TestSuite_dpdk_gro_lib.py b/tests/TestSuite_dpdk_gro_lib.py
index 0f44d666..c8a46bde 100644
--- a/tests/TestSuite_dpdk_gro_lib.py
+++ b/tests/TestSuite_dpdk_gro_lib.py
@@ -106,7 +106,7 @@  class TestDPDKGROLib(TestCase):
         )
         self.vhost_user = self.dut.new_session(suite="user")
         self.vhost_user.send_expect(self.testcmd_start, "testpmd> ", 120)
-        self.set_testpmd_params()
+        self.set_testpmd_params(mode=mode)
 
     def set_testpmd_params(self, mode=1):
         # set testpmd params
@@ -129,7 +129,7 @@  class TestDPDKGROLib(TestCase):
             self.vhost_user.send_expect("csum parse-tunnel on 0", "testpmd> ", 120)
             self.vhost_user.send_expect("csum set outer-ip hw 0", "testpmd> ", 120)
             self.vhost_user.send_expect("set port 0 gro on", "testpmd> ", 120)
-            self.vhost_user.send_expect("set gro flush 2", "testpmd> ", 120)
+            self.vhost_user.send_expect("set gro flush 4", "testpmd> ", 120)
         else:
             self.vhost_user.send_expect("set port 0 gro on", "testpmd> ", 120)
             self.vhost_user.send_expect("set gro flush 4", "testpmd> ", 120)
@@ -150,7 +150,7 @@  class TestDPDKGROLib(TestCase):
         self.vhost_user.send_expect("quit", "#", 120)
         self.dut.close_session(self.vhost_user)
 
-    def config_kernel_nic_host(self, mode=1):
+    def config_kernel_nic_host(self, mode=0):
         if mode == 0:
             self.dut.send_expect("ip netns del ns1", "#")
             self.dut.send_expect("ip netns add ns1", "#")
@@ -191,22 +191,26 @@  class TestDPDKGROLib(TestCase):
                 vm_config.params[i]["cpu"][0]["number"] = 1
                 vm_config.params[i]["cpu"][0]["cpupin"] = self.qemu_cpupin
 
-    def start_vm(self, mode=1, queue=1):
+    def start_vm(self, queue=1, tcp=True):
         self.vm1 = VM(self.dut, "vm0", "vhost_sample")
         self.vm1.load_config()
         vm_params_1 = {}
         vm_params_1["driver"] = "vhost-user"
         vm_params_1["opt_path"] = self.base_dir + "/vhost-net"
         vm_params_1["opt_mac"] = self.virtio_mac1
-        vm_params_1["opt_queue"] = queue
-        if mode == 5:
-            vm_params_1[
-                "opt_settings"
-            ] = "mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on,mq=on,vectors=15"
-        else:
-            vm_params_1[
-                "opt_settings"
-            ] = "mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on"
+        if queue > 1:
+            vm_params_1["opt_queue"] = queue
+        param = "" if tcp else ",guest_ufo=on,host_ufo=on"
+        if queue > 1:
+            vm_params_1["opt_settings"] = (
+                "mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on,mq=on,vectors=15%s"
+                % param
+            )
+        elif queue == 1:
+            vm_params_1["opt_settings"] = (
+                "mrg_rxbuf=on,csum=on,gso=on,host_tso4=on,guest_tso4=on,vectors=15%s"
+                % param
+            )
         self.vm1.set_vm_device(**vm_params_1)
         self.set_vm_cpu_number(self.vm1)
         try:
@@ -243,9 +247,12 @@  class TestDPDKGROLib(TestCase):
         return iperfdata_kb
 
     def test_vhost_gro_tcp_lightmode(self):
-        self.config_kernel_nic_host(0)
-        self.launch_testpmd_gro_on()
-        self.start_vm()
+        """
+        Test Case1: DPDK GRO lightmode test with tcp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=1, queue=1)
+        self.start_vm(queue=1, tcp=True)
         time.sleep(5)
         self.dut.get_session_output(timeout=2)
         # Get the virtio-net device name
@@ -261,7 +268,7 @@  class TestDPDKGROLib(TestCase):
         self.vm1_dut.send_expect("iperf -s", "", 10)
         self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,
@@ -273,7 +280,7 @@  class TestDPDKGROLib(TestCase):
         # Turn off DPDK GRO lib and Kernel GRO off
         self.set_testpmd_gro_off()
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 1 -t 10  -P 1 > /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,
@@ -289,10 +296,12 @@  class TestDPDKGROLib(TestCase):
         )
 
     def test_vhost_gro_tcp_heavymode(self):
-        self.config_kernel_nic_host(0)
-        self.heavymode = 2
-        self.launch_testpmd_gro_on(self.heavymode)
-        self.start_vm()
+        """
+        Test Case2: DPDK GRO heavymode test with tcp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=2, queue=1)
+        self.start_vm(queue=1, tcp=True)
         time.sleep(5)
         self.dut.get_session_output(timeout=2)
         # Get the virtio-net device name
@@ -308,7 +317,7 @@  class TestDPDKGROLib(TestCase):
         self.vm1_dut.send_expect("iperf -s", "", 10)
         self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,
@@ -321,10 +330,12 @@  class TestDPDKGROLib(TestCase):
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
 
     def test_vhost_gro_tcp_heavymode_flush4(self):
-        self.config_kernel_nic_host(0)
-        self.heavymode = 4
-        self.launch_testpmd_gro_on(self.heavymode)
-        self.start_vm()
+        """
+        Test Case3: DPDK GRO heavymode_flush4 test with tcp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=4, queue=1)
+        self.start_vm(queue=1, tcp=True)
         time.sleep(5)
         self.dut.get_session_output(timeout=2)
         # Get the virtio-net device name
@@ -340,7 +351,7 @@  class TestDPDKGROLib(TestCase):
         self.vm1_dut.send_expect("iperf -s", "", 10)
         self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 1 -t 10 -P 1> /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,
@@ -352,13 +363,104 @@  class TestDPDKGROLib(TestCase):
         self.quit_testpmd()
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
 
-    def test_vhost_gro_with_2queues_tcp_lightmode(self):
+    def test_vhost_gro_tcp_vxlan_heavymode_flush4(self):
+        """
+        Test Case4: DPDK GRO test with vxlan traffic
+        """
+        self.config_kernel_nic_host(mode=1)
+        self.launch_testpmd_gro_on(mode=3, queue=1)
+        self.start_vm(queue=1, tcp=True)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect(
+            "ip link add vxlan0 type vxlan id 42 dev %s dstport 4789" % self.vm1_intf,
+            "#",
+            30,
+        )
+        self.vm1_dut.send_expect(
+            "bridge fdb add to 00:00:00:00:00:00 dst 1.1.2.4 dev vxlan0", "#", 30
+        )
+        self.vm1_dut.send_expect("ip addr add 50.1.1.2/24 dev vxlan0", "#", 30)
+        self.vm1_dut.send_expect("ip link set up dev vxlan0", "#", 30)
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect("ifconfig %s 1.1.2.3" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c 50.1.1.2 -i 1 -t 60 -P 1 > /root/iperf_client.log &",
+            "",
+            180,
+        )
+        time.sleep(30)
+        self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+
+    def test_vhost_gro_tcp_lightmode_with_2queues(self):
         """
         Test Case5: DPDK GRO test with 2 queues using tcp/ipv4 traffic
         """
-        self.config_kernel_nic_host(0)
+        self.config_kernel_nic_host(mode=0)
         self.launch_testpmd_gro_on(mode=1, queue=2)
-        self.start_vm(mode=1, queue=2)
+        self.start_vm(queue=2, tcp=True)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect(
+            "ifconfig %s %s" % (self.vm1_intf, self.virtio_ip1), "#", 10
+        )
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -L %s combined 2" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(60)
+        perfdata = self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        # Turn off DPDK GRO lib and Kernel GRO off
+        self.set_testpmd_gro_off()
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 1 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(60)
+        self.iperf_result_verify("Kernel GRO")
+        print(("the Kernel GRO %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+        self.dut.send_expect(
+            "echo %s > /root/dpdk_gro_lib_on_iperf_tc5.log" % perfdata, "#", 10
+        )
+
+    def test_vhost_gro_udp_lightmode(self):
+        """
+        Test Case6: DPDK GRO lightmode test with udp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=1, queue=1)
+        self.start_vm(queue=1, tcp=False)
         time.sleep(5)
         self.dut.get_session_output(timeout=2)
         # Get the virtio-net device name
@@ -374,7 +476,166 @@  class TestDPDKGROLib(TestCase):
         self.vm1_dut.send_expect("iperf -s", "", 10)
         self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 2 -t 60 -f g -m > /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(30)
+        tc1_perfdata = self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        # Turn off DPDK GRO lib and Kernel GRO off
+        self.set_testpmd_gro_off()
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(30)
+        self.iperf_result_verify("Kernel GRO")
+        print(("the Kernel GRO %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+        self.dut.send_expect(
+            "echo %s > /root/dpdk_gro_lib_on_iperf_tc6.log" % tc1_perfdata, "#", 10
+        )
+
+    def test_vhost_gro_udp_heavymode(self):
+        """
+        Test Case7: DPDK GRO heavymode test with udp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=2, queue=1)
+        self.start_vm(queue=1, tcp=False)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect(
+            "ifconfig %s %s" % (self.vm1_intf, self.virtio_ip1), "#", 10
+        )
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(30)
+        self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+
+    def test_vhost_gro_udp_heavymode_flush4(self):
+        """
+        Test Case8: DPDK GRO heavymode_flush4 test with udp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=4, queue=1)
+        self.start_vm(queue=1, tcp=False)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect(
+            "ifconfig %s %s" % (self.vm1_intf, self.virtio_ip1), "#", 10
+        )
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
+            % (self.virtio_ip1),
+            "",
+            180,
+        )
+        time.sleep(30)
+        self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+
+    def test_vhost_gro_udp_vxlan_heavymode_flush4(self):
+        """
+        Test Case9: DPDK GRO test with udp/vxlan traffic
+        """
+        self.config_kernel_nic_host(mode=1)
+        self.launch_testpmd_gro_on(mode=3, queue=1)
+        self.start_vm(queue=1, tcp=False)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect(
+            "ip link add vxlan0 type vxlan id 42 dev %s dstport 4789" % self.vm1_intf,
+            "#",
+            30,
+        )
+        self.vm1_dut.send_expect(
+            "bridge fdb add to 00:00:00:00:00:00 dst 1.1.2.4 dev vxlan0", "#", 30
+        )
+        self.vm1_dut.send_expect("ip addr add 50.1.1.2/24 dev vxlan0", "#", 30)
+        self.vm1_dut.send_expect("ip link set up dev vxlan0", "#", 30)
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect("ifconfig %s 1.1.2.3" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % (self.vm1_intf), "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c 50.1.1.2 -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &",
+            "",
+            180,
+        )
+        time.sleep(30)
+        self.iperf_result_verify("GRO lib")
+        print(("the GRO lib %s " % (self.output_result)))
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.quit_testpmd()
+        self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+
+    def test_vhost_gro_udp_lightmode_with_2queues(self):
+        """
+        Test Case10: DPDK GRO test with 2 queues using udp/ipv4 traffic
+        """
+        self.config_kernel_nic_host(mode=0)
+        self.launch_testpmd_gro_on(mode=1, queue=2)
+        self.start_vm(queue=2, tcp=False)
+        time.sleep(5)
+        self.dut.get_session_output(timeout=2)
+        # Get the virtio-net device name
+        for port in self.vm1_dut.ports_info:
+            self.vm1_intf = port["intf"]
+        # Start the Iperf test
+        self.vm1_dut.send_expect("ifconfig -a", "#", 30)
+        self.vm1_dut.send_expect(
+            "ifconfig %s %s" % (self.vm1_intf, self.virtio_ip1), "#", 10
+        )
+        self.vm1_dut.send_expect("ifconfig %s up" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -L %s combined 2" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("ethtool -K %s gro off" % self.vm1_intf, "#", 10)
+        self.vm1_dut.send_expect("iperf -s", "", 10)
+        self.dut.send_expect("rm /root/iperf_client.log", "#", 10)
+        self.dut.send_expect(
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,
@@ -386,7 +647,7 @@  class TestDPDKGROLib(TestCase):
         # Turn off DPDK GRO lib and Kernel GRO off
         self.set_testpmd_gro_off()
         self.dut.send_expect(
-            "ip netns exec ns1 iperf -c %s -i 2 -t 60 -f g -m > /root/iperf_client.log &"
+            "ip netns exec ns1 iperf -c %s -i 1 -t 60 -P 4 -u -b 10G -l 9000 > /root/iperf_client.log &"
             % (self.virtio_ip1),
             "",
             180,