test suite reviews and discussions
 help / color / mirror / Atom feed
* [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation.
@ 2023-02-14  6:28 Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 1/5] tests/vf_offload: add VLAN packets to test scope Ke Xu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

Add VLAN Packets to ensure checksum offload works well on packets with Dot1Q part.

For daily regression, we introduce wrapped cases for each path.

Updated TSO validation methods.

Ke Xu (5):
  tests/vf_offload: add VLAN packets to test scope.
  tests/vf_offload: improve TSO validating.
  tests/vf_offload: improve vector path validating.
  tests/vf_offload: fix error when no packet captured.
  test_plans/vf_offload: add VLAN packets to test scope and improve
    vector path validating.

 test_plans/vf_offload_test_plan.rst | 158 +++++
 tests/TestSuite_vf_offload.py       | 913 ++++++++++++++++++----------
 2 files changed, 762 insertions(+), 309 deletions(-)

-- 
2.25.1


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

* [DTS][PATCH V4 1/5] tests/vf_offload: add VLAN packets to test scope.
  2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
@ 2023-02-14  6:28 ` Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 2/5] tests/vf_offload: improve TSO validating Ke Xu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

Add VLAN Packets to ensure checksum offload
 works well on complex packets.

Add VLAN to filter.

Update checksum counting.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 tests/TestSuite_vf_offload.py | 252 +++++++++++++++++++++++++++++++---
 1 file changed, 233 insertions(+), 19 deletions(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 5def34c1..4a4ee5e1 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -258,8 +258,8 @@ class TestVfOffload(TestCase):
             p
             for p in packets
             if len(p.layers()) >= 3
-            and p.layers()[1] in {IP, IPv6}
-            and p.layers()[2] in {IP, IPv6, UDP, TCP, SCTP, GRE, MPLS}
+            and p.layers()[1] in {IP, IPv6, Dot1Q}
+            and p.layers()[2] in {IP, IPv6, Dot1Q, UDP, TCP, SCTP, GRE, MPLS}
             and Raw in p
         ]
 
@@ -400,6 +400,70 @@ class TestVfOffload(TestCase):
 
         self.verify(len(result) == 0, ",".join(list(result.values())))
 
+    def test_checksum_offload_vlan_enable(self):
+        """
+        Enable HW checksum offload.
+        Send packet with incorrect checksum,
+        can rx it and report the checksum error,
+        verify forwarded packets have correct checksum.
+        """
+        self.launch_testpmd(
+            dcf_flag=self.dcf_mode,
+            param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+        )
+        self.vm0_testpmd.execute_cmd("set fwd csum")
+        self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>")
+        self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>")
+        self.vm0_testpmd.execute_cmd("set promisc 1 on")
+        self.vm0_testpmd.execute_cmd("set promisc 0 on")
+
+        time.sleep(2)
+        mac = self.vm0_testpmd.get_port_mac(0)
+        sndIP = "10.0.0.1"
+        sndIPv6 = "::1"
+        pkts = {
+            "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/UDP(chksum=0xf)/("X"*46)'
+            % (mac, sndIP),
+            "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/TCP(chksum=0xf)/("X"*46)'
+            % (mac, sndIP),
+            "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/SCTP(chksum=0x0)/("X"*48)'
+            % (mac, sndIP),
+            "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)'
+            % (mac, sndIPv6),
+            "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)'
+            % (mac, sndIPv6),
+        }
+
+        expIP = sndIP
+        expIPv6 = sndIPv6
+        pkts_ref = {
+            "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/UDP()/("X"*46)'
+            % (mac, expIP),
+            "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/TCP()/("X"*46)'
+            % (mac, expIP),
+            "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/SCTP()/("X"*48)'
+            % (mac, expIP),
+            "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/UDP()/("X"*46)'
+            % (mac, expIPv6),
+            "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/TCP()/("X"*46)'
+            % (mac, expIPv6),
+        }
+
+        self.checksum_enablehw(0, self.vm_dut_0)
+        self.checksum_enablehw(1, self.vm_dut_0)
+
+        self.vm0_testpmd.execute_cmd("start")
+        result = self.checksum_validate(pkts, pkts_ref)
+
+        # Validate checksum on the receive packet
+        out = self.vm0_testpmd.execute_cmd("stop")
+        bad_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out)
+        bad_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out)
+        self.verify(bad_ipcsum == 3, "Bad-ipcsum check error")
+        self.verify(bad_l4csum == 5, "Bad-l4csum check error")
+
+        self.verify(len(result) == 0, ",".join(list(result.values())))
+
     @check_supported_nic(
         ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
     )
@@ -429,8 +493,8 @@ class TestVfOffload(TestCase):
         expIPv6 = sndIPv6
 
         pkts_outer = {
-            "IP/UDP/VXLAN-GPE": f'IP(src = "{sndIP}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()',
-            "IP/UDP/VXLAN-GPE/ETH": f'IP(src = "{sndIP}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()',
+            "IP/UDP/VXLAN-GPE": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()',
+            "IP/UDP/VXLAN-GPE/ETH": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()',
             "IPv6/UDP/VXLAN-GPE": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()',
             "IPv6/UDP/VXLAN-GPE/ETH": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()',
             "IP/GRE": f'IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE()',
@@ -452,13 +516,12 @@ class TestVfOffload(TestCase):
         }
 
         if self.dcf_mode == "enable":
-            pkts_outer[
-                "IP/UDP/VXLAN/ETH"
-            ] = f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()'
-            pkts_outer[
-                "IPv6/UDP/VXLAN/ETH"
-            ] = f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()'
-
+            pkts_outer.update(
+                {
+                    "IP/UDP/VXLAN/ETH": f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()',
+                    "IPv6/UDP/VXLAN/ETH": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()',
+                }
+            )
         pkts = {
             key_outer
             + "/"
@@ -494,13 +557,156 @@ class TestVfOffload(TestCase):
         }
 
         if self.dcf_mode == "enable":
-            pkts_outer_ref[
-                "IP/UDP/VXLAN/ETH"
-            ] = f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()'
-            pkts_outer_ref[
-                "IPv6/UDP/VXLAN/ETH"
-            ] = f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()'
+            pkts_outer.update(
+                {
+                    "IP/UDP/VXLAN/ETH": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()',
+                    "IPv6/UDP/VXLAN/ETH": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()',
+                }
+            )
+        pkts_ref = {
+            key_outer
+            + "/"
+            + key_inner: f'Ether(dst="{mac}", src="52:00:00:00:00:00") / '
+            + p_outer
+            + " / "
+            + p_inner
+            for key_outer, p_outer in pkts_outer_ref.items()
+            for key_inner, p_inner in pkts_inner_ref.items()
+        }
+
+        self.checksum_enablehw_tunnel(0, self.vm_dut_0)
+        self.checksum_enablehw_tunnel(1, self.vm_dut_0)
+
+        self.vm0_testpmd.execute_cmd("start")
+        self.vm0_testpmd.wait_link_status_up(0)
+        self.vm0_testpmd.wait_link_status_up(1)
+        result = self.checksum_validate(pkts, pkts_ref)
+        # Validate checksum on the receive packet
+        out = self.vm0_testpmd.execute_cmd("stop")
+        bad_outer_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-outer-ipcsum:", out)
+        bad_outer_l4csum = self.vm0_testpmd.get_pmd_value("Bad-outer-l4csum:", out)
+        bad_inner_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out)
+        bad_inner_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out)
+        if self.dcf_mode == "enable":
+            # Outer IP checksum error = 7 (outer-ip) * 6 (inner packet)
+            self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 8 (outer-UDP) * 6 (inner packet)
+            self.verify(bad_outer_l4csum == 48, "Bad-outer-l4csum check error")
+            # Outer L4 checksum error = 14 (outer packets) * 3 (inner-IP)
+            self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error")
+            # Outer L4 checksum error = 14 (outer packets) * 6 (inner-L4)
+            self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error")
+        else:
+            # Outer IP checksum error = 6 (outer-ip) * 6 (inner packet)
+            self.verify(bad_outer_ipcsum == 36, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 6 (outer-UDP) * 6 (inner packet)
+            self.verify(bad_outer_l4csum == 36, "Bad-outer-l4csum check error")
+            # Outer L4 checksum error = 12 (outer packets) * 3 (inner-IP)
+            self.verify(bad_inner_ipcsum == 36, "Bad-ipcsum check error")
+            # Outer L4 checksum error = 12 (outer packets) * 6 (inner-L4)
+            self.verify(bad_inner_l4csum == 72, "Bad-l4csum check error")
+
+        self.verify(len(result) == 0, ",".join(list(result.values())))
+
+    @check_supported_nic(
+        ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
+    )
+    @skip_unsupported_pkg(["os default"])
+    def test_checksum_offload_vlan_tunnel_enable(self):
+        """
+        Enable HW checksum offload.
+        Send packet with inner and outer incorrect checksum,
+        can rx it and report the checksum error,
+        verify forwarded packets have correct checksum.
+        """
+        self.launch_testpmd(
+            dcf_flag=self.dcf_mode,
+            param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+        )
+        self.vm0_testpmd.execute_cmd("set fwd csum")
+        self.vm0_testpmd.execute_cmd("set promisc 1 on")
+        self.vm0_testpmd.execute_cmd("set promisc 0 on")
+        self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>")
+        self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>")
+        time.sleep(2)
+        port_id_0 = 0
+        mac = self.vm0_testpmd.get_port_mac(0)
+        sndIP = "10.0.0.1"
+        sndIPv6 = "::1"
+        expIP = sndIP
+        expIPv6 = sndIPv6
+
+        pkts_outer = {
+            "VLAN/IP/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()',
+            "VLAN/IP/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()',
+            "VLAN/IPv6/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()',
+            "VLAN/IPv6/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()',
+            "VLAN/IP/GRE": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE()',
+            "VLAN/IP/GRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE() / Ether()',
+            "VLAN/IP/NVGRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()',
+            "VLAN/IPv6/GRE": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE()',
+            "VLAN/IPv6/GRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE() / Ether()',
+            "VLAN/IPv6/NVGRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()',
+            "VLAN/IP/UDP/GTPU": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(dport = 2152, chksum = 0xff) / GTP_U_Header(gtp_type=255, teid=0x123456)',
+            "VLAN/IPv6/UDP/GTPU": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(dport = 2152, chksum = 0xff) / GTP_U_Header(gtp_type=255, teid=0x123456)',
+        }
+        pkts_inner = {
+            "IP/UDP": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)',
+            "IP/TCP": f'IP(src = "{sndIP}", chksum = 0xff) / TCP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)',
+            "IP/SCTP": f'IP(src = "{sndIP}", chksum = 0xff) / SCTP(sport = 29999, dport = 30000, chksum = 0x0) / Raw("x" * 128)',
+            "IPv6/UDP": f'IPv6(src = "{sndIPv6}") / UDP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)',
+            "IPv6/TCP": f'IPv6(src = "{sndIPv6}") / TCP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)',
+            "IPv6/SCTP": f'IPv6(src = "{sndIPv6}") / SCTP(sport = 29999, dport = 30000, chksum = 0x0) / Raw("x" * 128)',
+        }
+
+        if self.dcf_mode == "enable":
+            pkts_outer.update(
+                {
+                    "VLAN/IP/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()',
+                    "VLAN/IPv6/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()',
+                }
+            )
+        pkts = {
+            key_outer
+            + "/"
+            + key_inner: f'Ether(dst="{mac}", src="52:00:00:00:00:00") / '
+            + p_outer
+            + " / "
+            + p_inner
+            for key_outer, p_outer in pkts_outer.items()
+            for key_inner, p_inner in pkts_inner.items()
+        }
 
+        pkts_outer_ref = {
+            "VLAN/IP/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN()',
+            "VLAN/IP/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()',
+            "VLAN/IPv6/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN()',
+            "VLAN/IPv6/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()',
+            "VLAN/IP/GRE": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE()',
+            "VLAN/IP/GRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE() / Ether()',
+            "VLAN/IP/NVGRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()',
+            "VLAN/IPv6/GRE": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE()',
+            "VLAN/IPv6/GRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE() / Ether()',
+            "VLAN/IPv6/NVGRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()',
+            "VLAN/IP/UDP/GTPU": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)',
+            "VLAN/IPv6/UDP/GTPU": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)',
+        }
+        pkts_inner_ref = {
+            "IP/UDP": f'IP(src = "{expIP}") / UDP(sport = 29999, dport = 30000) / Raw("x" * 100)',
+            "IP/TCP": f'IP(src = "{expIP}") / TCP(sport = 29999, dport = 30000) / Raw("x" * 100)',
+            "IP/SCTP": f'IP(src = "{expIP}") / SCTP(sport = 29999, dport = 30000) / Raw("x" * 128)',
+            "IPv6/UDP": f'IPv6(src = "{expIPv6}") / UDP(sport = 29999, dport = 30000) / Raw("x" * 100)',
+            "IPv6/TCP": f'IPv6(src = "{expIPv6}") / TCP(sport = 29999, dport = 30000) / Raw("x" * 100)',
+            "IPv6/SCTP": f'IPv6(src = "{expIPv6}") / SCTP(sport = 29999, dport = 30000) / Raw("x" * 128)',
+        }
+
+        if self.dcf_mode == "enable":
+            pkts_outer.update(
+                {
+                    "VLAN/IP/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()',
+                    "VLAN/IPv6/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()',
+                }
+            )
         pkts_ref = {
             key_outer
             + "/"
@@ -526,14 +732,22 @@ class TestVfOffload(TestCase):
         bad_inner_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out)
         bad_inner_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out)
         if self.dcf_mode == "enable":
-            self.verify(bad_outer_ipcsum == 24, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 7 (outer-ip) * 6 (inner packet)
+            self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 8 (outer-UDP) * 6 (inner packet)
             self.verify(bad_outer_l4csum == 48, "Bad-outer-l4csum check error")
+            # Outer L4 checksum error = 14 (outer packets) * 3 (inner-IP)
             self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error")
+            # Outer L4 checksum error = 14 (outer packets) * 6 (inner-L4)
             self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error")
         else:
-            self.verify(bad_outer_ipcsum == 24, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 6 (outer-ip) * 6 (inner packet)
+            self.verify(bad_outer_ipcsum == 36, "Bad-outer-ipcsum check error")
+            # Outer IP checksum error = 6 (outer-UDP) * 6 (inner packet)
             self.verify(bad_outer_l4csum == 36, "Bad-outer-l4csum check error")
+            # Outer L4 checksum error = 12 (outer packets) * 3 (inner-IP)
             self.verify(bad_inner_ipcsum == 36, "Bad-ipcsum check error")
+            # Outer L4 checksum error = 12 (outer packets) * 6 (inner-L4)
             self.verify(bad_inner_l4csum == 72, "Bad-l4csum check error")
 
         self.verify(len(result) == 0, ",".join(list(result.values())))
-- 
2.25.1


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

* [DTS][PATCH V4 2/5] tests/vf_offload: improve TSO validating.
  2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 1/5] tests/vf_offload: add VLAN packets to test scope Ke Xu
@ 2023-02-14  6:28 ` Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 3/5] tests/vf_offload: improve vector path validating Ke Xu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

Use segment_validate and tso_validate
 methods to do the validate, providing
 scalarble interface for futrher cases.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 tests/TestSuite_vf_offload.py | 491 ++++++++++++++--------------------
 1 file changed, 206 insertions(+), 285 deletions(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 4a4ee5e1..d6948738 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -849,6 +849,172 @@ class TestVfOffload(TestCase):
         rx_packet_size = [len(p[Raw].load) for p in pkts]
         return rx_packet_count, rx_packet_size
 
+    def segment_validate(
+        self,
+        segment_size,
+        loading_size,
+        packet_count,
+        tx_stats,
+        rx_stats,
+        payload_size_list,
+    ):
+        """
+        Validate the segmentation, checking if the result is segmented
+        as expected.
+        segment_size: segment size,
+        loading_size: tx payload size,
+        packet_count: tx packet count,
+        tx_stats: tx packets count sniffed,
+        rx_stats: rx packets count,
+        payload_size_list: rx packets payload size list,
+        Return a message of validate result.
+        """
+        num_segs = (loading_size + segment_size - 1) // segment_size
+        num_segs_full = loading_size // segment_size
+        if not packet_count == tx_stats:
+            return "Failed: TX packet count is of inconsitent with sniffed TX packet count."
+        elif not packet_count * num_segs == rx_stats:
+            return "Failed: RX packet count is of inconsitent with expected RX packet count."
+        elif not (
+            all(
+                [
+                    # i * packet_count + j is the i-th segmentation for j-th packet.
+                    payload_size_list[i * packet_count + j] == segment_size
+                    for j in range(packet_count)
+                    for i in range(num_segs_full)
+                ]
+                + [
+                    # i * packet_count + j is i-th segmentation for j-th packet.
+                    # i range from num_segs_full to num_segs, means the last
+                    # segmentation if exists.
+                    payload_size_list[i * packet_count + j]
+                    == (loading_size % segment_size)
+                    for j in range(packet_count)
+                    for i in range(num_segs_full, num_segs)
+                ]
+            )
+        ):
+            return (
+                "Failed: RX packet segmentation size incorrect, %s." % payload_size_list
+            )
+        return None
+
+    def tso_validate(
+        self,
+        tx_interface,
+        rx_interface,
+        mac,
+        inet_type,
+        size_and_count,
+        outer_pkts=None,
+    ):
+
+        validate_result = []
+
+        self.tester.scapy_foreground()
+        time.sleep(5)
+
+        packet_l3 = {
+            "IP": 'IP(src="192.168.1.1",dst="192.168.1.2")',
+            "IPv6": 'IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")',
+        }
+
+        if not outer_pkts is None:
+            for key_outer in outer_pkts:
+                for loading_size, packet_count in size_and_count:
+                    out = self.vm0_testpmd.execute_cmd(
+                        "clear port info all", "testpmd> ", 120
+                    )
+                    self.tcpdump_start_sniffing([tx_interface, rx_interface])
+                    if "GTPU" in key_outer:
+                        self.tester.scapy_append(
+                            "from scapy.contrib.gtp import GTP_U_Header"
+                        )
+                    self.tester.scapy_append(
+                        (
+                            'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/'
+                            + outer_pkts[key_outer]
+                            + '/%s/TCP(sport=1021,dport=1021)/Raw(RandString(size=%s))], iface="%s", count=%s)'
+                        )
+                        % (
+                            mac,
+                            packet_l3[inet_type],
+                            loading_size,
+                            tx_interface,
+                            packet_count,
+                        )
+                    )
+                    out = self.tester.scapy_execute()
+                    out = self.vm0_testpmd.execute_cmd("show port stats all")
+                    print(out)
+                    # In case tcpdump working slower than expected on very limited environments,
+                    # an immediate stop sniffing causes a trimed pcap file, leading to wrong
+                    # packet statistic.
+                    # Uncommenting the following line helps resolving this problem.
+                    # time.sleep(1)
+                    self.tcpdump_stop_sniff()
+                    rx_stats, payload_size_list = self.tcpdump_analyse_sniff(
+                        rx_interface
+                    )
+                    tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
+                    payload_size_list.sort(reverse=True)
+                    self.logger.info(payload_size_list)
+                    segment_result = self.segment_validate(
+                        800,
+                        loading_size,
+                        packet_count,
+                        tx_stats,
+                        rx_stats,
+                        payload_size_list,
+                    )
+                    if segment_result:
+                        result_message = (
+                            f"Packet: {key_outer}, inet type: {inet_type}, loading size: {loading_size} packet count: {packet_count}: "
+                            + segment_result
+                        )
+                        self.logger.info(result_message)
+                        validate_result.append(result_message)
+        else:
+            for loading_size, packet_count in size_and_count:
+                out = self.vm0_testpmd.execute_cmd(
+                    "clear port info all", "testpmd> ", 120
+                )
+                self.tcpdump_start_sniffing([tx_interface, rx_interface])
+                self.tester.scapy_append(
+                    'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/%s/TCP(sport=1021,dport=1021)/Raw(RandString(size=%s))], iface="%s", count=%s)'
+                    % (
+                        mac,
+                        packet_l3[inet_type],
+                        loading_size,
+                        tx_interface,
+                        packet_count,
+                    )
+                )
+                out = self.tester.scapy_execute()
+                out = self.vm0_testpmd.execute_cmd("show port stats all")
+                print(out)
+                self.tcpdump_stop_sniff()
+                rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface)
+                tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
+                payload_size_list.sort(reverse=True)
+                self.logger.info(payload_size_list)
+                segment_result = self.segment_validate(
+                    800,
+                    loading_size,
+                    packet_count,
+                    tx_stats,
+                    rx_stats,
+                    payload_size_list,
+                )
+                if segment_result:
+                    result_message = (
+                        f"Inet type: {inet_type}, loading size: {loading_size} packet count: {packet_count}: "
+                        + segment_result
+                    )
+                    self.logger.info(result_message)
+                    validate_result.append(result_message)
+        return validate_result
+
     def test_tso(self):
         """
         TSO IPv4 TCP, IPv6 TCP testing.
@@ -863,7 +1029,7 @@ class TestVfOffload(TestCase):
         # Here size_and_count is a list of tuples for the test scopes that
         # in a tuple (size, count) means, sending packets for count times
         # for TSO with a payload size of size.
-        self.size_and_count = [
+        size_and_count = [
             (128, 10),
             (800, 10),
             (801, 10),
@@ -895,162 +1061,31 @@ class TestVfOffload(TestCase):
 
         mac = self.vm0_testpmd.get_port_mac(0)
         self.vm0_testpmd.execute_cmd("set verbose 1", "testpmd> ", 120)
-        self.vm0_testpmd.execute_cmd("port stop all", "testpmd> ", 120)
-        self.vm0_testpmd.execute_cmd(
-            "csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set udp hw %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120
-        )
-
-        self.vm0_testpmd.execute_cmd(
-            "csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set udp hw %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set tcp hw %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set sctp hw %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-        self.vm0_testpmd.execute_cmd(
-            "csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120
-        )
-
-        self.vm0_testpmd.execute_cmd("tso set 800 %d" % self.vm0_dut_ports[1])
         self.vm0_testpmd.execute_cmd("set fwd csum")
-        self.vm0_testpmd.execute_cmd("port start all", "testpmd> ", 120)
+        self.tso_enable(self.vm0_dut_ports[0], self.vm_dut_0)
+        self.tso_enable(self.vm0_dut_ports[1], self.vm_dut_0)
         self.vm0_testpmd.execute_cmd("set promisc 0 on", "testpmd> ", 120)
         self.vm0_testpmd.execute_cmd("set promisc 1 on", "testpmd> ", 120)
         self.vm0_testpmd.execute_cmd("start")
+        self.vm0_testpmd.wait_link_status_up(self.vm0_dut_ports[0])
+        self.vm0_testpmd.wait_link_status_up(self.vm0_dut_ports[1])
 
-        self.tester.scapy_foreground()
-        time.sleep(5)
-
-        for loading_size, packet_count in self.size_and_count:
-            # IPv4 tcp test
-            out = self.vm0_testpmd.execute_cmd("clear port info all", "testpmd> ", 120)
-            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)/Raw(RandString(size=%s))], iface="%s", count=%s)'
-                % (mac, loading_size, tx_interface, packet_count)
-            )
-            out = self.tester.scapy_execute()
-            out = self.vm0_testpmd.execute_cmd("show port stats all")
-            print(out)
-            self.tcpdump_stop_sniff()
-            rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface)
-            tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
-            payload_size_list.sort(reverse=True)
-            self.logger.info(payload_size_list)
-            if loading_size <= 800:
-                self.verify(
-                    # for all packet_count packets, verifying the packet size equals the size we sent.
-                    rx_stats == tx_stats
-                    and all(
-                        [
-                            int(payload_size_list[j]) == loading_size
-                            for j in range(packet_count)
-                        ]
-                    ),
-                    "IPV4 RX or TX packet number not correct",
-                )
-            else:
-                num = loading_size // 800
-                for i in range(num):
-                    self.verify(
-                        # i * packet_count + j is the i-th segmentation for j-th packet.
-                        all(
-                            [
-                                int(payload_size_list[i * packet_count + j]) == 800
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        "the packet segmentation incorrect, %s" % payload_size_list,
-                    )
-                if loading_size % 800 != 0:
-                    self.verify(
-                        # num * packet_count + j is the last segmentation for j-th packet.
-                        all(
-                            [
-                                int(payload_size_list[num * packet_count + j])
-                                == loading_size % 800
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        "the packet segmentation incorrect, %s" % payload_size_list,
-                    )
-
-        for loading_size, packet_count in self.size_and_count:
-            # IPv6 tcp test
-            out = self.vm0_testpmd.execute_cmd("clear port info all", "testpmd> ", 120)
-            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)/Raw(RandString(size=%s))], iface="%s", count=%s)'
-                % (mac, loading_size, tx_interface, packet_count)
-            )
-            out = self.tester.scapy_execute()
-            out = self.vm0_testpmd.execute_cmd("show port stats all")
-            print(out)
-            self.tcpdump_stop_sniff()
-            rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface)
-            tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
-            payload_size_list.sort(reverse=True)
-            self.logger.info(payload_size_list)
-            if loading_size <= 800:
-                self.verify(
-                    # for all packet_count packets, verifying the packet size equals the size we sent.
-                    rx_stats == tx_stats
-                    and all(
-                        [
-                            int(payload_size_list[j]) == loading_size
-                            for j in range(packet_count)
-                        ]
-                    ),
-                    "IPV6 RX or TX packet number not correct",
-                )
-            else:
-                num = loading_size // 800
-                for i in range(num):
-                    self.verify(
-                        # i * packet_count + j is the i-th segmentation for j-th packet.
-                        all(
-                            [
-                                int(payload_size_list[i * packet_count + j]) == 800
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        "the packet segmentation incorrect, %s" % payload_size_list,
-                    )
-                if loading_size % 800 != 0:
-                    self.verify(
-                        # num * packet_count + j is the last segmentation for j-th packet.
-                        all(
-                            [
-                                int(payload_size_list[num * packet_count + j])
-                                == loading_size % 800
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        "the packet segmentation incorrect, %s" % payload_size_list,
-                    )
+        validate_result = []
+        validate_result += self.tso_validate(
+            tx_interface=tx_interface,
+            rx_interface=rx_interface,
+            mac=mac,
+            inet_type="IP",
+            size_and_count=size_and_count,
+        )
+        validate_result += self.tso_validate(
+            tx_interface=tx_interface,
+            rx_interface=rx_interface,
+            mac=mac,
+            inet_type="IPv6",
+            size_and_count=size_and_count,
+        )
+        self.verify(len(validate_result) == 0, ",".join(list(validate_result)))
 
     @check_supported_nic(
         ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
@@ -1070,7 +1105,7 @@ class TestVfOffload(TestCase):
         # Here size_and_count is a list of tuples for the test scopes that
         # in a tuple (size, count) means, sending packets for count times
         # for TSO with a payload size of size.
-        self.size_and_count = [
+        size_and_count = [
             (128, 10),
             (800, 10),
             (801, 10),
@@ -1130,138 +1165,24 @@ class TestVfOffload(TestCase):
             "IPv6/UDP/GTPU": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)',
         }
 
-        self.tester.scapy_foreground()
-        time.sleep(5)
-
-        for key_outer in pkts_outer:
-            for loading_size, packet_count in self.size_and_count:
-                # IPv4 tcp test
-                out = self.vm0_testpmd.execute_cmd(
-                    "clear port info all", "testpmd> ", 120
-                )
-                self.tcpdump_start_sniffing([tx_interface, rx_interface])
-                if "GTPU" in key_outer:
-                    self.tester.scapy_append(
-                        "from scapy.contrib.gtp import GTP_U_Header"
-                    )
-                self.tester.scapy_append(
-                    (
-                        'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/'
-                        + pkts_outer[key_outer]
-                        + '/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/Raw(RandString(size=%s))], iface="%s", count=%s)'
-                    )
-                    % (mac, loading_size, tx_interface, packet_count)
-                )
-                out = self.tester.scapy_execute()
-                out = self.vm0_testpmd.execute_cmd("show port stats all")
-                print(out)
-                self.tcpdump_stop_sniff()
-                rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface)
-                tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
-                payload_size_list.sort(reverse=True)
-                self.logger.info(payload_size_list)
-                if loading_size <= 800:
-                    self.verify(
-                        # for all packet_count packets, verifying the packet size equals the size we sent.
-                        rx_stats == tx_stats
-                        and all(
-                            [
-                                int(payload_size_list[j]) == loading_size
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        f"{key_outer} tunnel IPV4 RX or TX packet number not correct",
-                    )
-                else:
-                    num = loading_size // 800
-                    for i in range(num):
-                        self.verify(
-                            # i * packet_count + j is the i-th segmentation for j-th packet.
-                            all(
-                                [
-                                    payload_size_list[i * packet_count + j] == 800
-                                    for j in range(packet_count)
-                                ]
-                            ),
-                            "the packet segmentation incorrect, %s" % payload_size_list,
-                        )
-                    if loading_size % 800 != 0:
-                        self.verify(
-                            # num * packet_count + j is the last segmentation for j-th packet.
-                            all(
-                                [
-                                    payload_size_list[num * packet_count + j]
-                                    == loading_size % 800
-                                    for j in range(packet_count)
-                                ]
-                            ),
-                            "the packet segmentation incorrect, %s" % payload_size_list,
-                        )
-
-            for loading_size, packet_count in self.size_and_count:
-                # IPv6 tcp test
-                out = self.vm0_testpmd.execute_cmd(
-                    "clear port info all", "testpmd> ", 120
-                )
-                self.tcpdump_start_sniffing([tx_interface, rx_interface])
-                if "GTPU" in key_outer:
-                    self.tester.scapy_append(
-                        "from scapy.contrib.gtp import GTP_U_Header"
-                    )
-                self.logger.info([mac, loading_size, tx_interface, packet_count])
-                self.tester.scapy_append(
-                    (
-                        'sendp([Ether(dst="%s", src="52:00:00:00:00:00")/'
-                        + pkts_outer[key_outer]
-                        + '/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", count=%s)'
-                    )
-                    % (mac, loading_size, tx_interface, packet_count)
-                )
-                out = self.tester.scapy_execute()
-                out = self.vm0_testpmd.execute_cmd("show port stats all")
-                print(out)
-                self.tcpdump_stop_sniff()
-                rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface)
-                tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface)
-                payload_size_list.sort(reverse=True)
-                self.logger.info(payload_size_list)
-                if loading_size <= 800:
-                    self.verify(
-                        # for all packet_count packets, verifying the packet size equals the size we sent.
-                        rx_stats == tx_stats
-                        and all(
-                            [
-                                payload_size_list[j] == loading_size
-                                for j in range(packet_count)
-                            ]
-                        ),
-                        f"{key_outer} tunnel IPV6 RX or TX packet number not correct",
-                    )
-                else:
-                    num = loading_size // 800
-                    for i in range(num):
-                        self.verify(
-                            # i * packet_count + j is the i-th segmentation for j-th packet.
-                            all(
-                                [
-                                    payload_size_list[i * packet_count + j] == 800
-                                    for j in range(packet_count)
-                                ]
-                            ),
-                            "the packet segmentation incorrect, %s" % payload_size_list,
-                        )
-                    if loading_size % 800 != 0:
-                        self.verify(
-                            # num * packet_count + j is the last segmentation for j-th packet.
-                            all(
-                                [
-                                    payload_size_list[num * packet_count + j]
-                                    == loading_size % 800
-                                    for j in range(packet_count)
-                                ]
-                            ),
-                            "the packet segmentation incorrect, %s" % payload_size_list,
-                        )
+        validate_result = []
+        validate_result += self.tso_validate(
+            tx_interface=tx_interface,
+            rx_interface=rx_interface,
+            mac=mac,
+            inet_type="IP",
+            size_and_count=size_and_count,
+            outer_pkts=pkts_outer,
+        )
+        validate_result += self.tso_validate(
+            tx_interface=tx_interface,
+            rx_interface=rx_interface,
+            mac=mac,
+            inet_type="IPv6",
+            size_and_count=size_and_count,
+            outer_pkts=pkts_outer,
+        )
+        self.verify(len(validate_result) == 0, ",".join(list(validate_result)))
 
     def tear_down(self):
         self.vm0_testpmd.execute_cmd("quit", "# ")
-- 
2.25.1


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

* [DTS][PATCH V4 3/5] tests/vf_offload: improve vector path validating.
  2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 1/5] tests/vf_offload: add VLAN packets to test scope Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 2/5] tests/vf_offload: improve TSO validating Ke Xu
@ 2023-02-14  6:28 ` Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 4/5] tests/vf_offload: fix error when no packet captured Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 5/5] test_plans/vf_offload: add VLAN packets to test scope and improve vector path validating Ke Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

For better deployment for daily regression, we introduce
 a wrapper to add cases for each path. Based on it,
 we add seperate cases for regression.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 tests/TestSuite_vf_offload.py | 176 ++++++++++++++++++++++++++++++++--
 1 file changed, 168 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index d6948738..f3af2379 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -185,11 +185,13 @@ class TestVfOffload(TestCase):
 
     def launch_testpmd(self, **kwargs):
         dcf_flag = kwargs.get("dcf_flag")
+        eal_param = kwargs.get("eal_param") if kwargs.get("eal_param") else ""
         param = kwargs.get("param") if kwargs.get("param") else ""
         if dcf_flag == "enable":
             self.vm0_testpmd.start_testpmd(
                 VM_CORES_MASK,
                 param=param,
+                eal_param=eal_param,
                 ports=[self.vf0_guest_pci, self.vf1_guest_pci],
                 port_options={
                     self.vf0_guest_pci: "cap=dcf",
@@ -197,7 +199,11 @@ class TestVfOffload(TestCase):
                 },
             )
         else:
-            self.vm0_testpmd.start_testpmd(VM_CORES_MASK, param=param)
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                param=param,
+                eal_param=eal_param,
+            )
 
     def checksum_enablehw(self, port, dut):
         dut.send_expect("port stop all", "testpmd>")
@@ -336,7 +342,7 @@ class TestVfOffload(TestCase):
                 )
         return result
 
-    def test_checksum_offload_enable(self):
+    def exec_checksum_offload_enable(self, specific_bitwidth=None):
         """
         Enable HW checksum offload.
         Send packet with incorrect checksum,
@@ -346,6 +352,13 @@ class TestVfOffload(TestCase):
         self.launch_testpmd(
             dcf_flag=self.dcf_mode,
             param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>")
@@ -400,7 +413,7 @@ class TestVfOffload(TestCase):
 
         self.verify(len(result) == 0, ",".join(list(result.values())))
 
-    def test_checksum_offload_vlan_enable(self):
+    def exec_checksum_offload_vlan_enable(self, specific_bitwidth=None):
         """
         Enable HW checksum offload.
         Send packet with incorrect checksum,
@@ -410,6 +423,13 @@ class TestVfOffload(TestCase):
         self.launch_testpmd(
             dcf_flag=self.dcf_mode,
             param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>")
@@ -468,7 +488,7 @@ class TestVfOffload(TestCase):
         ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
     )
     @skip_unsupported_pkg(["os default"])
-    def test_checksum_offload_tunnel_enable(self):
+    def exec_checksum_offload_tunnel_enable(self, specific_bitwidth=None):
         """
         Enable HW checksum offload.
         Send packet with inner and outer incorrect checksum,
@@ -478,6 +498,13 @@ class TestVfOffload(TestCase):
         self.launch_testpmd(
             dcf_flag=self.dcf_mode,
             param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("set promisc 1 on")
@@ -612,7 +639,7 @@ class TestVfOffload(TestCase):
         ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
     )
     @skip_unsupported_pkg(["os default"])
-    def test_checksum_offload_vlan_tunnel_enable(self):
+    def exec_checksum_offload_vlan_tunnel_enable(self, specific_bitwidth=None):
         """
         Enable HW checksum offload.
         Send packet with inner and outer incorrect checksum,
@@ -622,6 +649,13 @@ class TestVfOffload(TestCase):
         self.launch_testpmd(
             dcf_flag=self.dcf_mode,
             param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("set promisc 1 on")
@@ -752,7 +786,7 @@ class TestVfOffload(TestCase):
 
         self.verify(len(result) == 0, ",".join(list(result.values())))
 
-    def test_checksum_offload_disable(self):
+    def exec_checksum_offload_disable(self, specific_bitwidth=None):
         """
         Enable SW checksum offload.
         Send same packet with incorrect checksum and verify checksum is valid.
@@ -761,6 +795,13 @@ class TestVfOffload(TestCase):
         self.launch_testpmd(
             dcf_flag=self.dcf_mode,
             param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "",
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
         self.vm0_testpmd.execute_cmd("set fwd csum")
         self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>")
@@ -812,6 +853,81 @@ class TestVfOffload(TestCase):
 
         self.verify(len(result) == 0, ",".join(list(result.values())))
 
+    def test_checksum_offload_enable(self):
+        self.exec_checksum_offload_enable()
+
+    def test_checksum_offload_enable_scalar(self):
+        self.exec_checksum_offload_enable(specific_bitwidth=64)
+
+    def test_checksum_offload_enable_sse(self):
+        self.exec_checksum_offload_enable(specific_bitwidth=128)
+
+    def test_checksum_offload_enable_avx2(self):
+        self.exec_checksum_offload_enable(specific_bitwidth=256)
+
+    def test_checksum_offload_enable_avx512(self):
+        self.exec_checksum_offload_enable(specific_bitwidth=512)
+
+    def test_checksum_offload_vlan_enable(self):
+        self.exec_checksum_offload_vlan_enable()
+
+    def test_checksum_offload_vlan_enable_scalar(self):
+        self.exec_checksum_offload_vlan_enable(specific_bitwidth=64)
+
+    def test_checksum_offload_vlan_enable_sse(self):
+        self.exec_checksum_offload_vlan_enable(specific_bitwidth=128)
+
+    def test_checksum_offload_vlan_enable_avx2(self):
+        self.exec_checksum_offload_vlan_enable(specific_bitwidth=256)
+
+    def test_checksum_offload_vlan_enable_avx512(self):
+        self.exec_checksum_offload_vlan_enable(specific_bitwidth=512)
+
+    def test_checksum_offload_tunnel_enable(self):
+        self.exec_checksum_offload_tunnel_enable()
+
+    def test_checksum_offload_tunnel_enable_scalar(self):
+        self.exec_checksum_offload_tunnel_enable(specific_bitwidth=64)
+
+    def test_checksum_offload_tunnel_enable_sse(self):
+        self.exec_checksum_offload_tunnel_enable(specific_bitwidth=128)
+
+    def test_checksum_offload_tunnel_enable_avx2(self):
+        self.exec_checksum_offload_tunnel_enable(specific_bitwidth=256)
+
+    def test_checksum_offload_tunnel_enable_avx512(self):
+        self.exec_checksum_offload_tunnel_enable(specific_bitwidth=512)
+
+    def test_checksum_offload_vlan_tunnel_enable(self):
+        self.exec_checksum_offload_vlan_tunnel_enable()
+
+    def test_checksum_offload_vlan_tunnel_enable_scalar(self):
+        self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=64)
+
+    def test_checksum_offload_vlan_tunnel_enable_sse(self):
+        self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=128)
+
+    def test_checksum_offload_vlan_tunnel_enable_avx2(self):
+        self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=256)
+
+    def test_checksum_offload_vlan_tunnel_enable_avx512(self):
+        self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=512)
+
+    def test_checksum_offload_disable(self):
+        self.exec_checksum_offload_disable()
+
+    def test_checksum_offload_disable_scalar(self):
+        self.exec_checksum_offload_disable(specific_bitwidth=64)
+
+    def test_checksum_offload_disable_sse(self):
+        self.exec_checksum_offload_disable(specific_bitwidth=128)
+
+    def test_checksum_offload_disable_avx2(self):
+        self.exec_checksum_offload_disable(specific_bitwidth=256)
+
+    def test_checksum_offload_disable_avx512(self):
+        self.exec_checksum_offload_disable(specific_bitwidth=512)
+
     def tcpdump_start_sniffing(self, ifaces=[]):
         """
         Start tcpdump in the background to sniff the tester interface where
@@ -1015,7 +1131,7 @@ class TestVfOffload(TestCase):
                     validate_result.append(result_message)
         return validate_result
 
-    def test_tso(self):
+    def exec_tso(self, specific_bitwidth=None):
         """
         TSO IPv4 TCP, IPv6 TCP testing.
         """
@@ -1057,6 +1173,13 @@ class TestVfOffload(TestCase):
             param="--portmask=0x3 "
             + "--enable-rx-cksum "
             + "--max-pkt-len=%s" % TSO_MTU,
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
 
         mac = self.vm0_testpmd.get_port_mac(0)
@@ -1091,7 +1214,7 @@ class TestVfOffload(TestCase):
         ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"]
     )
     @skip_unsupported_pkg(["os default"])
-    def test_tso_tunnel(self):
+    def exec_tso_tunnel(self, specific_bitwidth=None):
         """
         TSO tunneled IPv4 TCP, IPv6 TCP testing.
         """
@@ -1133,6 +1256,13 @@ class TestVfOffload(TestCase):
             param="--portmask=0x3 "
             + "--enable-rx-cksum "
             + "--max-pkt-len=%s" % TSO_MTU,
+            eal_param=(
+                "--force-max-simd-bitwidth=%d " % specific_bitwidth
+                + "--log-level='iavf,7' "
+                + "--log-level='dcf,7' "
+            )
+            if (not specific_bitwidth is None)
+            else "",
         )
 
         mac = self.vm0_testpmd.get_port_mac(0)
@@ -1184,6 +1314,36 @@ class TestVfOffload(TestCase):
         )
         self.verify(len(validate_result) == 0, ",".join(list(validate_result)))
 
+    def test_tso(self):
+        self.exec_tso()
+
+    def test_tso_scalar(self):
+        self.exec_tso(specific_bitwidth=64)
+
+    def test_tso_sse(self):
+        self.exec_tso(specific_bitwidth=128)
+
+    def test_tso_avx2(self):
+        self.exec_tso(specific_bitwidth=256)
+
+    def test_tso_avx512(self):
+        self.exec_tso(specific_bitwidth=512)
+
+    def test_tso_tunnel(self):
+        self.exec_tso_tunnel()
+
+    def test_tso_tunnel_scalar(self):
+        self.exec_tso_tunnel(specific_bitwidth=64)
+
+    def test_tso_tunnel_sse(self):
+        self.exec_tso_tunnel(specific_bitwidth=128)
+
+    def test_tso_tunnel_avx2(self):
+        self.exec_tso_tunnel(specific_bitwidth=256)
+
+    def test_tso_tunnel_avx512(self):
+        self.exec_tso_tunnel(specific_bitwidth=512)
+
     def tear_down(self):
         self.vm0_testpmd.execute_cmd("quit", "# ")
         self.dut.send_expect(
-- 
2.25.1


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

* [DTS][PATCH V4 4/5] tests/vf_offload: fix error when no packet captured.
  2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
                   ` (2 preceding siblings ...)
  2023-02-14  6:28 ` [DTS][PATCH V4 3/5] tests/vf_offload: improve vector path validating Ke Xu
@ 2023-02-14  6:28 ` Ke Xu
  2023-02-14  6:28 ` [DTS][PATCH V4 5/5] test_plans/vf_offload: add VLAN packets to test scope and improve vector path validating Ke Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 tests/TestSuite_vf_offload.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index f3af2379..9475ef22 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -262,7 +262,7 @@ class TestVfOffload(TestCase):
     def filter_packets(self, packets):
         return [
             p
-            for p in packets
+            for p in (packets if packets else [])
             if len(p.layers()) >= 3
             and p.layers()[1] in {IP, IPv6, Dot1Q}
             and p.layers()[2] in {IP, IPv6, Dot1Q, UDP, TCP, SCTP, GRE, MPLS}
-- 
2.25.1


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

* [DTS][PATCH V4 5/5] test_plans/vf_offload: add VLAN packets to test scope and improve vector path validating.
  2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
                   ` (3 preceding siblings ...)
  2023-02-14  6:28 ` [DTS][PATCH V4 4/5] tests/vf_offload: fix error when no packet captured Ke Xu
@ 2023-02-14  6:28 ` Ke Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Ke Xu @ 2023-02-14  6:28 UTC (permalink / raw)
  To: dts; +Cc: ke1.xu, qi.fu, lijuan.tu, yux.jiang, zhiminx.huang

Add VLAN Packets to ensure checksum offload works well on packets with Dot1Q part.

For daily regression, we introduce wrapped cases for each path.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 test_plans/vf_offload_test_plan.rst | 158 ++++++++++++++++++++++++++++
 1 file changed, 158 insertions(+)

diff --git a/test_plans/vf_offload_test_plan.rst b/test_plans/vf_offload_test_plan.rst
index 3e9b658b..1c929371 100644
--- a/test_plans/vf_offload_test_plan.rst
+++ b/test_plans/vf_offload_test_plan.rst
@@ -286,6 +286,135 @@ be validated as pass by the tester.
 The first byte of source IPv4 address will be increased by testpmd. The checksum
 is indeed recalculated by software algorithms.
 
+
+Test Case: HW checksum offload check with vlan
+==============================================
+Start testpmd and enable checksum offload on rx port. Based on test steps of
+HW checksum offload check, configure the traffic generator to send the multiple
+packets for the following combination:
+
+  +----------------+----------------------------------------+
+  | packet type    | packet organization                    |
+  +================+========================================+
+  |                | Ether / VLAN / IPv4 / UDP / payload    |
+  |                +----------------------------------------+
+  |                | Ether / VLAN / IPv4 / TCP / payload    |
+  |                +----------------------------------------+
+  | packets        | Ether / VLAN / IPv4 / SCTP / payload   |
+  | for checksum   +----------------------------------------+
+  | offload test   | Ether / VLAN / IPv6 / UDP / payload    |
+  |                +----------------------------------------+
+  |                | Ether / VLAN / IPv6 / TCP / payload    |
+  +----------------+----------------------------------------+
+
+
+Test Case: HW tunneling checksum offload check with vlan
+========================================================
+Based on test steps of HW tunneling checksum offload check, configure the
+traffic generator to send the multiple packets combination with outer or
+tunneling package of:
+
+  +----------------+--------------------------------------------+
+  | packet type    | packet organization                        |
+  +================+============================================+
+  |                | Ether / VLAN / IPv4 / UDP / VXLAN / Ether  |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv6 / UDP / VXLAN / Ether  |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv4 / GRE                  |
+  | outer and      +--------------------------------------------+
+  | tunneling      | Ether / VLAN / IPv4 / GRE / Ether          |
+  | packets        +--------------------------------------------+
+  | for checksum   | Ether / VLAN / IPv6 / GRE                  |
+  | offload test   +--------------------------------------------+
+  |                | Ether / VLAN / IPv6 / GRE / Ether          |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv4 / NVGRE                |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv4 / NVGRE / Ether        |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv6 / NVGRE                |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv6 / NVGRE / Ether        |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv4 / UDP / GTPU           |
+  |                +--------------------------------------------+
+  |                | Ether / VLAN / IPv6 / UDP / GTPU           |
+  +----------------+--------------------------------------------+
+
+
+Test Case: HW checksum offload check on scalar path
+===================================================
+These set of cases based on existing cases are designed for better case managment for
+regression test.
+
+Start testpmd with eal parameter --force-max-simd-bitwidth=64. Based on test steps of
+'HW checksum offload check'.
+
+Test Case: HW checksum offload check on sse path
+================================================
+Start testpmd with eal parameter --force-max-simd-bitwidth=128. Based on test steps of
+'HW checksum offload check'.
+
+Test Case: HW checksum offload check on avx2 path
+=================================================
+Start testpmd with eal parameter --force-max-simd-bitwidth=256. Based on test steps of
+'HW checksum offload check'.
+
+Test Case: HW checksum offload check on avx512 path
+===================================================
+Start testpmd with eal parameter --force-max-simd-bitwidth=512. Based on test steps of
+'HW checksum offload check'.
+
+Test Case: HW checksum offload check with vlan on scalar path
+=============================================================
+
+Test Case: HW checksum offload check with vlan on sse path
+=============================================================
+
+Test Case: HW checksum offload check with vlan on avx2 path
+=============================================================
+
+Test Case: HW checksum offload check with vlan on avx512 path
+=============================================================
+
+Test Case: HW tunneling checksum offload check on scalar path
+=============================================================
+
+Test Case: HW tunneling checksum offload check on sse path
+==========================================================
+
+Test Case: HW tunneling checksum offload check on avx2 path
+===========================================================
+
+Test Case: HW tunneling checksum offload check on avx512 path
+=============================================================
+
+Test Case: HW tunneling checksum offload check with vlan on scalar path
+=======================================================================
+
+Test Case: HW tunneling checksum offload check with vlan on sse path
+====================================================================
+
+Test Case: HW tunneling checksum offload check with vlan on avx2 path
+=====================================================================
+
+Test Case: HW tunneling checksum offload check with vlan on avx512 path
+=======================================================================
+
+Test Case: SW checksum offload check on scalar path
+===================================================
+
+Test Case: SW checksum offload check on sse path
+================================================
+
+Test Case: SW checksum offload check on avx2 path
+=================================================
+
+Test Case: SW checksum offload check on avx512 path
+===================================================
+
+
 Prerequisites for TSO
 =====================
 
@@ -510,3 +639,32 @@ Test IPv6() in scapy::
 
   for one_outer_packet in outer_packet_list:
     sendp([Ether(dst="%s", src="52:00:00:00:00:00")/one_outer_packet/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/Raw(load=RandString(size=%s))], iface="%s", count = %s)
+
+Test case: csum fwd engine, use TSO, on scalar path
+===================================================
+These set of cases based on existing cases are designed for better case managment for
+regression test.
+
+Start testpmd with eal parameter --force-max-simd-bitwidth=64. Based on test steps of
+'csum fwd engine, use TSO'.
+
+Test case: csum fwd engine, use TSO, on sse path
+================================================
+
+Test case: csum fwd engine, use TSO, on avx2 path
+=================================================
+
+Test case: csum fwd engine, use TSO, on avx512 path
+===================================================
+
+Test case: csum fwd engine, use tunnel TSO, on scalar path
+==========================================================
+
+Test case: csum fwd engine, use tunnel TSO, on sse path
+=======================================================
+
+Test case: csum fwd engine, use tunnel TSO, on avx2 path
+========================================================
+
+Test case: csum fwd engine, use tunnel TSO, on avx512 path
+==========================================================
-- 
2.25.1


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

end of thread, other threads:[~2023-02-14  6:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14  6:28 [DTS][PATCH V4 0/5] Update vf_offload cases for DPDK-v23.03 validation Ke Xu
2023-02-14  6:28 ` [DTS][PATCH V4 1/5] tests/vf_offload: add VLAN packets to test scope Ke Xu
2023-02-14  6:28 ` [DTS][PATCH V4 2/5] tests/vf_offload: improve TSO validating Ke Xu
2023-02-14  6:28 ` [DTS][PATCH V4 3/5] tests/vf_offload: improve vector path validating Ke Xu
2023-02-14  6:28 ` [DTS][PATCH V4 4/5] tests/vf_offload: fix error when no packet captured Ke Xu
2023-02-14  6:28 ` [DTS][PATCH V4 5/5] test_plans/vf_offload: add VLAN packets to test scope and improve vector path validating Ke Xu

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