diff mbox series

[V1,2/2] tests/rxtx_offload: add test case test_txoffload_port_multi_segs

Message ID 1627539383-26588-3-git-send-email-yux.jiang@intel.com (mailing list archive)
State Superseded
Headers show
Series add test plan and tests: tx offload multi_segs setting | expand

Commit Message

Yu Jiang July 29, 2021, 6:16 a.m. UTC
add test case test_txoffload_port_multi_segs

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_rxtx_offload.py | 66 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

Comments

Yu Jiang July 29, 2021, 6:20 a.m. UTC | #1
> -----Original Message-----
> From: Jiang, YuX <yux.jiang@intel.com>
> Sent: Thursday, July 29, 2021 2:16 PM
> To: dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: [dts][PATCH V1 2/2] tests/rxtx_offload: add test case
> test_txoffload_port_multi_segs
> 
> add test case test_txoffload_port_multi_segs
> 
> Signed-off-by: Yu Jiang <yux.jiang@intel.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
Lin, Xueqin Aug. 2, 2021, 9:29 a.m. UTC | #2
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Yu Jiang
> Sent: Thursday, July 29, 2021 2:16 PM
> To: dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: [dts] [PATCH V1 2/2] tests/rxtx_offload: add test case
> test_txoffload_port_multi_segs
> 
> add test case test_txoffload_port_multi_segs
> 
> Signed-off-by: Yu Jiang <yux.jiang@intel.com>
Acked-by: Xueqin Lin <Xueqin.lin@intel.com>
> ---
>  tests/TestSuite_rxtx_offload.py | 66
> +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
> 
> diff --git a/tests/TestSuite_rxtx_offload.py b/tests/TestSuite_rxtx_offload.py
> index 0e70526..48fb739 100644
> --- a/tests/TestSuite_rxtx_offload.py
> +++ b/tests/TestSuite_rxtx_offload.py
> @@ -209,6 +209,26 @@ class TestRxTx_Offload(TestCase):
>                  acl_offload = offloads[offload[i]]
>                  self.verify(acl_offload in queue_line[i], "Fail to configure offload by
> queue.")
>              i = i + 1
> +
> +    def verify_packets_increasing(self, rxtx="tx", count=2):
> +        # Verify RXTX-packets increasing on each ports, check count < 20
> +        out1 = self.dut.send_expect("show port stats all", "testpmd> ")
> +        i = 0
> +        while i < count:
> +            if rxtx == "tx":
> +                pks_l1 = re.findall(r'TX-packets: (\w+)', out1)
> +                time.sleep(15)
> +                out1 = self.dut.send_expect("show port stats all", "testpmd> ")
> +                pks_l2 = re.findall(r'TX-packets: (\w+)', out1)
> +                self.logger.info("Times="+ str(i) + ", count=" + str(count) + ",
> pks2_cur=" + str(pks_l2) + ", pks1_before=" + str(pks_l1))
> +                for index in range(len(pks_l2)):
> +                    self.verify(int(pks_l2[index]) > int(pks_l1[index]), "TX-packets
> hang")
> +                if int(pks_l1[index]) < 300000000 or int(pks_l2[index]) < 300000000:
> +                    count += 1
> +            i += 1
> +            if count > 20:
> +                self.verify(False, "Check count timeout")
> +                break
> 
>      def get_queue_number(self, packet):
>          """
> @@ -716,6 +736,52 @@ class TestRxTx_Offload(TestCase):
>          offload = ["mbuf_fast_free"]
>          self.check_port_config("tx", offload)
> 
> +    def test_txoffload_port_multi_segs(self):
> +        """
> +        Tx offload multi_segs setting.
> +        """
> +        offload = ["multi_segs"]
> +        # Start testpmd with "--tx-offloads=0x00008000" to enable multi_segs
> tx_offload
> +        self.pmdout.start_testpmd("%s" % self.cores, "--tx-offloads=0x00008000")
> +        for portid in range(len(self.dut_ports)):
> +            self.check_port_config(rxtx="tx", offload=offload,
> + port_id=portid)
> +
> +        # Set fwd to txonly, Set the length of each segment of the TX-ONLY
> packets, Set the split policy for TX packets, then start to send pkgs
> +        self.dut.send_expect("set fwd txonly", "testpmd> ")
> +        self.dut.send_expect("set txpkts 64,64", "testpmd> ")
> +        self.dut.send_expect("set txsplit rand", "testpmd> ")
> +        self.dut.send_expect("start", "testpmd> ")
> +
> +        # Check TX-packets will not hang and continue to increase
> +        self.verify_packets_increasing(rxtx="tx")
> +        self.dut.send_expect("stop", "testpmd> ")
> +        self.dut.send_expect("quit", "# ")
> +
> +        # Start testpmd again without "--tx-offloads", check multi-segs is disabled
> by default
> +        self.pmdout.start_testpmd("%s" % self.cores, " ")
> +        for portid in range(len(self.dut_ports)):
> +            outstring = self.dut.send_expect("show port %d tx_offload
> configuration" % portid, "testpmd> ")
> +            self.verify("MULTI_SEGS" not in outstring, "multi-segs is
> + not disabled by default")
> +
> +        self.dut.send_expect("port stop all", "testpmd> ")
> +        for portid in range(len(self.dut_ports)):
> +            cmd = "port config {} tx_offload multi_segs on".format(portid)
> +            self.dut.send_expect(cmd, "testpmd> ")
> +        self.dut.send_expect("port start all", "testpmd> ")
> +        for portid in range(len(self.dut_ports)):
> +              self.check_port_config(rxtx="tx", offload=offload,
> + port_id=portid)
> +
> +        # Set fwd to txonly, Set the length of each segment of the TX-ONLY
> packets, Set the split policy for TX packets, then start to send pkgs
> +        self.dut.send_expect("set fwd txonly", "testpmd> ")
> +        self.dut.send_expect("set txpkts 64,64", "testpmd> ")
> +        self.dut.send_expect("set txsplit rand", "testpmd> ")
> +        self.dut.send_expect("start", "testpmd> ")
> +
> +        # Check TX-packets will not hang and continue to increase
> +        self.verify_packets_increasing(rxtx="tx")
> +        self.dut.send_expect("stop", "testpmd> ")
> +        self.dut.send_expect("quit", "# ")
> +
>      def tear_down(self):
>          """
>          Run after each test case.
> --
> 2.7.4
diff mbox series

Patch

diff --git a/tests/TestSuite_rxtx_offload.py b/tests/TestSuite_rxtx_offload.py
index 0e70526..48fb739 100644
--- a/tests/TestSuite_rxtx_offload.py
+++ b/tests/TestSuite_rxtx_offload.py
@@ -209,6 +209,26 @@  class TestRxTx_Offload(TestCase):
                 acl_offload = offloads[offload[i]]
                 self.verify(acl_offload in queue_line[i], "Fail to configure offload by queue.")
             i = i + 1
+
+    def verify_packets_increasing(self, rxtx="tx", count=2):
+        # Verify RXTX-packets increasing on each ports, check count < 20
+        out1 = self.dut.send_expect("show port stats all", "testpmd> ")
+        i = 0
+        while i < count:
+            if rxtx == "tx":
+                pks_l1 = re.findall(r'TX-packets: (\w+)', out1)
+                time.sleep(15)
+                out1 = self.dut.send_expect("show port stats all", "testpmd> ")
+                pks_l2 = re.findall(r'TX-packets: (\w+)', out1)
+                self.logger.info("Times="+ str(i) + ", count=" + str(count) + ", pks2_cur=" + str(pks_l2) + ", pks1_before=" + str(pks_l1))
+                for index in range(len(pks_l2)):
+                    self.verify(int(pks_l2[index]) > int(pks_l1[index]), "TX-packets hang")
+                if int(pks_l1[index]) < 300000000 or int(pks_l2[index]) < 300000000:
+                    count += 1
+            i += 1
+            if count > 20:
+                self.verify(False, "Check count timeout")
+                break
  
     def get_queue_number(self, packet):
         """
@@ -716,6 +736,52 @@  class TestRxTx_Offload(TestCase):
         offload = ["mbuf_fast_free"]
         self.check_port_config("tx", offload)
 
+    def test_txoffload_port_multi_segs(self):
+        """
+        Tx offload multi_segs setting.
+        """
+        offload = ["multi_segs"]
+        # Start testpmd with "--tx-offloads=0x00008000" to enable multi_segs tx_offload
+        self.pmdout.start_testpmd("%s" % self.cores, "--tx-offloads=0x00008000")
+        for portid in range(len(self.dut_ports)):
+            self.check_port_config(rxtx="tx", offload=offload, port_id=portid)
+
+        # Set fwd to txonly, Set the length of each segment of the TX-ONLY packets, Set the split policy for TX packets, then start to send pkgs
+        self.dut.send_expect("set fwd txonly", "testpmd> ")
+        self.dut.send_expect("set txpkts 64,64", "testpmd> ")
+        self.dut.send_expect("set txsplit rand", "testpmd> ")
+        self.dut.send_expect("start", "testpmd> ")
+
+        # Check TX-packets will not hang and continue to increase
+        self.verify_packets_increasing(rxtx="tx")
+        self.dut.send_expect("stop", "testpmd> ")
+        self.dut.send_expect("quit", "# ")
+
+        # Start testpmd again without "--tx-offloads", check multi-segs is disabled by default
+        self.pmdout.start_testpmd("%s" % self.cores, " ")
+        for portid in range(len(self.dut_ports)):
+            outstring = self.dut.send_expect("show port %d tx_offload configuration" % portid, "testpmd> ")
+            self.verify("MULTI_SEGS" not in outstring, "multi-segs is not disabled by default")
+
+        self.dut.send_expect("port stop all", "testpmd> ")
+        for portid in range(len(self.dut_ports)):
+            cmd = "port config {} tx_offload multi_segs on".format(portid)
+            self.dut.send_expect(cmd, "testpmd> ")
+        self.dut.send_expect("port start all", "testpmd> ")
+        for portid in range(len(self.dut_ports)):
+              self.check_port_config(rxtx="tx", offload=offload, port_id=portid)
+
+        # Set fwd to txonly, Set the length of each segment of the TX-ONLY packets, Set the split policy for TX packets, then start to send pkgs
+        self.dut.send_expect("set fwd txonly", "testpmd> ")
+        self.dut.send_expect("set txpkts 64,64", "testpmd> ")
+        self.dut.send_expect("set txsplit rand", "testpmd> ")
+        self.dut.send_expect("start", "testpmd> ")
+
+        # Check TX-packets will not hang and continue to increase
+        self.verify_packets_increasing(rxtx="tx")
+        self.dut.send_expect("stop", "testpmd> ")
+        self.dut.send_expect("quit", "# ")
+
     def tear_down(self):
         """
         Run after each test case.