test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite
@ 2018-08-07  4:23 Xueqin Lin
  2018-08-20  7:30 ` Liu, Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Xueqin Lin @ 2018-08-07  4:23 UTC (permalink / raw)
  To: dts; +Cc: xueqin.lin

From: "xueqin.lin" <xueqin.lin@intel.com>

Signed-off-by: Xueqin Lin <xueqin.lin@intel.com>

---
 tests/TestSuite_dynamic_queue.py | 180 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 180 insertions(+)
 create mode 100644 tests/TestSuite_dynamic_queue.py

diff --git a/tests/TestSuite_dynamic_queue.py b/tests/TestSuite_dynamic_queue.py
new file mode 100644
index 0000000..880d421
--- /dev/null
+++ b/tests/TestSuite_dynamic_queue.py
@@ -0,0 +1,180 @@
+# <COPYRIGHT_TAG>
+
+import time
+import re
+import utils
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import get_nic_name
+from packet import Packet, sniff_packets, load_sniff_packets
+import random
+
+
+class TestDynamicQueue(TestCase):
+
+    def set_up_all(self):
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        out = self.dut.send_expect("cat config/common_base", "]# ", 10)
+        self.PF_Q_strip = 'CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF'
+        pattern = "%s=(\d*)" % self.PF_Q_strip
+        self.PF_QUEUE = self.element_strip(out, pattern)
+        self.used_dut_port = self.dut_ports[0]
+        tester_port = self.tester.get_local_port(self.used_dut_port)
+        self.tester_intf = self.tester.get_interface(tester_port)
+        self.dut_testpmd = PmdOutput(self.dut)
+
+    def set_up(self):
+        self.dut_testpmd.start_testpmd(
+            "Default", "--port-topology=chained --txq=%s --rxq=%s"
+            % (self.PF_QUEUE, self.PF_QUEUE))
+
+    def element_strip(self, out, pattern):
+        """
+        Strip and get queue number.
+        """
+        s = re.compile(pattern, re.DOTALL)
+        res = s.search(out)
+        if res is None:
+            print utils.RED('Fail to search number.')
+            return None
+        else:
+            result = res.group(1)
+            return int(result)
+
+    def send_packet(self):
+        """
+        Generate packets and send them to dut
+        """
+        mac = self.dut.get_mac_address(0)
+        for i in range(self.PF_QUEUE * 2):
+            pkt = Packet(pkt_type='IP_RAW')
+            pkt.config_layer('ether', {'dst': mac})
+            pkt.config_layer(
+                'ipv4', {'dst': '192.168.0.%d' % i, 'src': '191.168.0.1'})
+            pkt.send_pkt(tx_port=self.tester_intf)
+
+    def rxq_setup_test(self, chgflag=0):
+        """
+        Dynamic to setup rxq and reconfigure ring size at runtime.
+        chgflag: reconfigure ring size flag
+                 1:reconfigure Rx ring size
+                 0:no change on Rx ring size
+        """
+        queue = range(3)
+        for i in range(3):
+            queue[i] = random.randint(1, self.PF_QUEUE - 1)
+            self.dut_testpmd.execute_cmd('port 0 rxq %d stop' % queue[i])
+        self.dut_testpmd.execute_cmd('set fwd rxonly')
+        self.dut_testpmd.execute_cmd('start')
+        self.send_packet()
+        self.dut.get_session_output(timeout=10)
+        out = self.dut_testpmd.execute_cmd('stop')
+        for i in range(3):
+            self.verify(
+                "Forward Stats for RX Port= 0/Queue=%2d" % queue[i] not in out,
+                "Fail to verify rxq stop!")
+        if chgflag == 1:
+            for i in range(3):
+                out = self.dut_testpmd.execute_cmd(
+                        'show rxq info 0 %d' % queue[i])
+                qring_strip = 'Number of RXDs: '
+                pattern = "%s([0-9]+)" % qring_strip
+                qringsize = self.element_strip(out, pattern)
+                chg_qringsize = qringsize % 1024 + 256
+                self.dut_testpmd.execute_cmd(
+                    'port config 0 rxq %d ring_size %d'
+                    % (queue[i], chg_qringsize))
+                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' % queue[i])
+                out = self.dut_testpmd.execute_cmd(
+                    'show rxq info 0 %d' % queue[i])
+                chk_qringsize = self.element_strip(out, pattern)
+                self.verify(chk_qringsize == chg_qringsize,
+                            "Fail to change ring size at runtime!")
+        for i in range(3):
+            if chgflag == 0:
+                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' % queue[i])
+            self.dut_testpmd.execute_cmd('port 0 rxq %d start' % queue[i])
+        self.dut_testpmd.execute_cmd('start')
+        self.send_packet()
+        self.dut.get_session_output(timeout=10)
+        out = self.dut_testpmd.execute_cmd('stop')
+        for i in range(3):
+            self.verify("Forward Stats for RX Port= 0/Queue=%2d"
+                        % queue[i] in out, "Fail to setup rxq %d at runtime"
+                        % queue[i])
+
+    def txq_setup_test(self, chgflag=0):
+        """
+        Dynamic to setup txq and reconfigure ring size at runtime.
+        chgflag: reconfigure ring size flag
+                 1:reconfigure Tx ring size
+                 0:no change on Tx ring size
+        """
+        for i in range(3):
+            queue = random.randint(1, self.PF_QUEUE - 1)
+            out = self.dut_testpmd.execute_cmd('show txq info 0 %d' % queue)
+            qring_strip = 'Number of TXDs: '
+            pattern = "%s([0-9]+)" % qring_strip
+            qringsize = self.element_strip(out, pattern)
+            self.dut_testpmd.execute_cmd('port 0 txq %d stop' % queue)
+            self.dut_testpmd.execute_cmd('set fwd txonly')
+            self.dut_testpmd.execute_cmd('start')
+            time.sleep(10)
+            out = self.dut_testpmd.execute_cmd('stop')
+            tx_num = qringsize - 1
+            self.verify("TX-packets: %d" % tx_num in out,
+                        "Fail to stop txq at runtime")
+            if chgflag == 1:
+                chg_qringsize = qringsize % 1024 + 256
+                self.dut_testpmd.execute_cmd(
+                    'port config 0 txq %d ring_size %d'
+                    % (queue, chg_qringsize))
+                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
+                out = self.dut_testpmd.execute_cmd(
+                    'show txq info 0 %d' % queue)
+                chk_qringsize = self.element_strip(out, pattern)
+                self.verify(chk_qringsize == chg_qringsize,
+                            "Fail to change ring size at runtime!")
+            if chgflag == 0:
+                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
+            self.dut_testpmd.execute_cmd('port 0 txq %d start' % queue)
+            self.dut_testpmd.execute_cmd('start')
+            time.sleep(10)
+            out = self.dut_testpmd.execute_cmd('stop')
+            self.verify("TX-packets: %d" % tx_num not in out,
+                        "Fail to setup txq at runtime")
+            if chgflag == 1:
+                chgtx_num = chg_qringsize - 1
+                self.verify("TX-packets: %d" % chgtx_num not in out,
+                            "Fail to change txq ring size at runtime")
+
+    def test_rxq_setup(self):
+        """
+        Dynamic to setup rxq test
+        """
+        self.rxq_setup_test()
+
+    def test_rxq_chgring_setup(self):
+        """
+        Dynamic to setup rxq and change ring size test
+        """
+        self.rxq_setup_test(chgflag=1)
+
+    def test_txq_setup(self):
+        """
+        Dynamic to setup txq test
+        """
+        self.txq_setup_test()
+
+    def test_txq_chgring_setup(self):
+        """
+        Dynamic to setup txq and change ring size test
+        """
+        self.txq_setup_test(chgflag=1)
+
+    def tear_down(self):
+        self.dut_testpmd.quit()
+
+    def tear_down_all(self):
+        pass
-- 
2.7.5

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

* Re: [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite
  2018-08-07  4:23 [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite Xueqin Lin
@ 2018-08-20  7:30 ` Liu, Yong
  2018-08-24  7:57   ` Lin, Xueqin
  0 siblings, 1 reply; 3+ messages in thread
From: Liu, Yong @ 2018-08-20  7:30 UTC (permalink / raw)
  To: Lin, Xueqin, dts; +Cc: Lin, Xueqin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xueqin Lin
> Sent: Tuesday, August 07, 2018 12:24 PM
> To: dts@dpdk.org
> Cc: Lin, Xueqin <xueqin.lin@intel.com>
> Subject: [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite
> 
> From: "xueqin.lin" <xueqin.lin@intel.com>
> 
> Signed-off-by: Xueqin Lin <xueqin.lin@intel.com>
> 
> ---
>  tests/TestSuite_dynamic_queue.py | 180
> +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 180 insertions(+)
>  create mode 100644 tests/TestSuite_dynamic_queue.py
> 
> diff --git a/tests/TestSuite_dynamic_queue.py
> b/tests/TestSuite_dynamic_queue.py
> new file mode 100644
> index 0000000..880d421
> --- /dev/null
> +++ b/tests/TestSuite_dynamic_queue.py
> @@ -0,0 +1,180 @@
> +# <COPYRIGHT_TAG>
> +
> +import time
> +import re
> +import utils
> +from test_case import TestCase
> +from pmd_output import PmdOutput
> +from settings import get_nic_name
> +from packet import Packet, sniff_packets, load_sniff_packets
> +import random
> +
> +
> +class TestDynamicQueue(TestCase):
> +
> +    def set_up_all(self):
> +        self.dut_ports = self.dut.get_ports(self.nic)
> +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> +        out = self.dut.send_expect("cat config/common_base", "]# ", 10)
> +        self.PF_Q_strip = 'CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF'
> +        pattern = "%s=(\d*)" % self.PF_Q_strip
> +        self.PF_QUEUE = self.element_strip(out, pattern)

We can strip config value by existing API self.dut.get_def_rte_config. Please use that one.

> +        self.used_dut_port = self.dut_ports[0]
> +        tester_port = self.tester.get_local_port(self.used_dut_port)
> +        self.tester_intf = self.tester.get_interface(tester_port)
> +        self.dut_testpmd = PmdOutput(self.dut)
> +
> +    def set_up(self):
> +        self.dut_testpmd.start_testpmd(
> +            "Default", "--port-topology=chained --txq=%s --rxq=%s"
> +            % (self.PF_QUEUE, self.PF_QUEUE))
> +
> +    def element_strip(self, out, pattern):
> +        """
> +        Strip and get queue number.
> +        """
> +        s = re.compile(pattern, re.DOTALL)
> +        res = s.search(out)
> +        if res is None:
> +            print utils.RED('Fail to search number.')
> +            return None
> +        else:
> +            result = res.group(1)
> +            return int(result)
> +
> +    def send_packet(self):
> +        """
> +        Generate packets and send them to dut
> +        """
> +        mac = self.dut.get_mac_address(0)
> +        for i in range(self.PF_QUEUE * 2):
> +            pkt = Packet(pkt_type='IP_RAW')
> +            pkt.config_layer('ether', {'dst': mac})
> +            pkt.config_layer(
> +                'ipv4', {'dst': '192.168.0.%d' % i, 'src': '191.168.0.1'})
> +            pkt.send_pkt(tx_port=self.tester_intf)
> +
> +    def rxq_setup_test(self, chgflag=0):
> +        """
> +        Dynamic to setup rxq and reconfigure ring size at runtime.
> +        chgflag: reconfigure ring size flag
> +                 1:reconfigure Rx ring size
> +                 0:no change on Rx ring size
> +        """
> +        queue = range(3)

Queue is just list here, why not just use list() ?

> +        for i in range(3):

Recommend not use hard-code 3 here, you can define one global variable for test loop. 

> +            queue[i] = random.randint(1, self.PF_QUEUE - 1)
> +            self.dut_testpmd.execute_cmd('port 0 rxq %d stop' % queue[i])

Please add blank line here for different code block. 

> +        self.dut_testpmd.execute_cmd('set fwd rxonly')
> +        self.dut_testpmd.execute_cmd('start')
> +        self.send_packet()
> +        self.dut.get_session_output(timeout=10)
> +        out = self.dut_testpmd.execute_cmd('stop')
> +        for i in range(3):
> +            self.verify(
> +                "Forward Stats for RX Port= 0/Queue=%2d" % queue[i] not in
> out,
> +                "Fail to verify rxq stop!")

Check queue stop by "Forward stats" not shown is not straight-forward. Is there any other method like check rx stats?

> +        if chgflag == 1:
> +            for i in range(3):
> +                out = self.dut_testpmd.execute_cmd(
> +                        'show rxq info 0 %d' % queue[i])
> +                qring_strip = 'Number of RXDs: '
> +                pattern = "%s([0-9]+)" % qring_strip
> +                qringsize = self.element_strip(out, pattern)
> +                chg_qringsize = qringsize % 1024 + 256

Xueqin, why first mod 1024 and then add 256? Why not just add 256?

> +                self.dut_testpmd.execute_cmd(
> +                    'port config 0 rxq %d ring_size %d'
> +                    % (queue[i], chg_qringsize))
> +                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' %
> queue[i])
> +                out = self.dut_testpmd.execute_cmd(
> +                    'show rxq info 0 %d' % queue[i])
> +                chk_qringsize = self.element_strip(out, pattern)
> +                self.verify(chk_qringsize == chg_qringsize,
> +                            "Fail to change ring size at runtime!")
> +        for i in range(3):
> +            if chgflag == 0:
> +                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' %
> queue[i])
> +            self.dut_testpmd.execute_cmd('port 0 rxq %d start' % queue[i])
> +        self.dut_testpmd.execute_cmd('start')
> +        self.send_packet()
> +        self.dut.get_session_output(timeout=10)
> +        out = self.dut_testpmd.execute_cmd('stop')


Please add blank line here, one line comment will be helpful. 

> +        for i in range(3):
> +            self.verify("Forward Stats for RX Port= 0/Queue=%2d"
> +                        % queue[i] in out, "Fail to setup rxq %d at runtime"
> +                        % queue[i])
> +
> +    def txq_setup_test(self, chgflag=0):
> +        """
> +        Dynamic to setup txq and reconfigure ring size at runtime.
> +        chgflag: reconfigure ring size flag
> +                 1:reconfigure Tx ring size
> +                 0:no change on Tx ring size
> +        """
> +        for i in range(3):
> +            queue = random.randint(1, self.PF_QUEUE - 1)
> +            out = self.dut_testpmd.execute_cmd('show txq info 0 %d' % queue)
> +            qring_strip = 'Number of TXDs: '
> +            pattern = "%s([0-9]+)" % qring_strip
> +            qringsize = self.element_strip(out, pattern)
> +            self.dut_testpmd.execute_cmd('port 0 txq %d stop' % queue)
> +            self.dut_testpmd.execute_cmd('set fwd txonly')
> +            self.dut_testpmd.execute_cmd('start')
> +            time.sleep(10)
> +            out = self.dut_testpmd.execute_cmd('stop')
> +            tx_num = qringsize - 1
> +            self.verify("TX-packets: %d" % tx_num in out,
> +                        "Fail to stop txq at runtime")
> +            if chgflag == 1:
> +                chg_qringsize = qringsize % 1024 + 256
> +                self.dut_testpmd.execute_cmd(
> +                    'port config 0 txq %d ring_size %d'
> +                    % (queue, chg_qringsize))
> +                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
> +                out = self.dut_testpmd.execute_cmd(
> +                    'show txq info 0 %d' % queue)
> +                chk_qringsize = self.element_strip(out, pattern)
> +                self.verify(chk_qringsize == chg_qringsize,
> +                            "Fail to change ring size at runtime!")
> +            if chgflag == 0:
> +                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
> +            self.dut_testpmd.execute_cmd('port 0 txq %d start' % queue)
> +            self.dut_testpmd.execute_cmd('start')
> +            time.sleep(10)
> +            out = self.dut_testpmd.execute_cmd('stop')
> +            self.verify("TX-packets: %d" % tx_num not in out,
> +                        "Fail to setup txq at runtime")

Tx stats should be much larger than tx_num, please check that number. 

> +            if chgflag == 1:
> +                chgtx_num = chg_qringsize - 1
> +                self.verify("TX-packets: %d" % chgtx_num not in out,
> +                            "Fail to change txq ring size at runtime")
> +

Same as previous comment. 

> +    def test_rxq_setup(self):
> +        """
> +        Dynamic to setup rxq test
> +        """
> +        self.rxq_setup_test()
> +
> +    def test_rxq_chgring_setup(self):
> +        """
> +        Dynamic to setup rxq and change ring size test
> +        """
> +        self.rxq_setup_test(chgflag=1)
> +
> +    def test_txq_setup(self):
> +        """
> +        Dynamic to setup txq test
> +        """
> +        self.txq_setup_test()
> +
> +    def test_txq_chgring_setup(self):
> +        """
> +        Dynamic to setup txq and change ring size test
> +        """
> +        self.txq_setup_test(chgflag=1)
> +
> +    def tear_down(self):
> +        self.dut_testpmd.quit()
> +
> +    def tear_down_all(self):
> +        pass
> --
> 2.7.5

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

* Re: [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite
  2018-08-20  7:30 ` Liu, Yong
@ 2018-08-24  7:57   ` Lin, Xueqin
  0 siblings, 0 replies; 3+ messages in thread
From: Lin, Xueqin @ 2018-08-24  7:57 UTC (permalink / raw)
  To: Liu, Yong, dts

Thanks Marvin a lot for you review. My comment as below, I will send v2 version to fix them.

Best regards,
Xueqin

> -----Original Message-----
> From: Liu, Yong
> Sent: Monday, August 20, 2018 3:31 PM
> To: Lin, Xueqin <xueqin.lin@intel.com>; dts@dpdk.org
> Cc: Lin, Xueqin <xueqin.lin@intel.com>
> Subject: RE: [dts] [PATCH] tests/dynamic_queue: add dynamic queue test
> suite
> 
> > -----Original Message-----
> > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xueqin Lin
> > Sent: Tuesday, August 07, 2018 12:24 PM
> > To: dts@dpdk.org
> > Cc: Lin, Xueqin <xueqin.lin@intel.com>
> > Subject: [dts] [PATCH] tests/dynamic_queue: add dynamic queue test
> > suite
> >
> > From: "xueqin.lin" <xueqin.lin@intel.com>
> >
> > Signed-off-by: Xueqin Lin <xueqin.lin@intel.com>
> >
> > ---
> >  tests/TestSuite_dynamic_queue.py | 180
> > +++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 180 insertions(+)
> >  create mode 100644 tests/TestSuite_dynamic_queue.py
> >
> > diff --git a/tests/TestSuite_dynamic_queue.py
> > b/tests/TestSuite_dynamic_queue.py
> > new file mode 100644
> > index 0000000..880d421
> > --- /dev/null
> > +++ b/tests/TestSuite_dynamic_queue.py
> > @@ -0,0 +1,180 @@
> > +# <COPYRIGHT_TAG>
> > +
> > +import time
> > +import re
> > +import utils
> > +from test_case import TestCase
> > +from pmd_output import PmdOutput
> > +from settings import get_nic_name
> > +from packet import Packet, sniff_packets, load_sniff_packets import
> > +random
> > +
> > +
> > +class TestDynamicQueue(TestCase):
> > +
> > +    def set_up_all(self):
> > +        self.dut_ports = self.dut.get_ports(self.nic)
> > +        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
> > +        out = self.dut.send_expect("cat config/common_base", "]# ", 10)
> > +        self.PF_Q_strip = 'CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF'
> > +        pattern = "%s=(\d*)" % self.PF_Q_strip
> > +        self.PF_QUEUE = self.element_strip(out, pattern)
> 
> We can strip config value by existing API self.dut.get_def_rte_config. Please
> use that one.

If use self.dut.get_def_rte_config, return value is None, it is wrong to strip the PF queue number.
The function call below to return search loop, the out range is wrong.
out = self.session.send_command("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
                                        % self.target, 1)

> 
> > +        self.used_dut_port = self.dut_ports[0]
> > +        tester_port = self.tester.get_local_port(self.used_dut_port)
> > +        self.tester_intf = self.tester.get_interface(tester_port)
> > +        self.dut_testpmd = PmdOutput(self.dut)
> > +
> > +    def set_up(self):
> > +        self.dut_testpmd.start_testpmd(
> > +            "Default", "--port-topology=chained --txq=%s --rxq=%s"
> > +            % (self.PF_QUEUE, self.PF_QUEUE))
> > +
> > +    def element_strip(self, out, pattern):
> > +        """
> > +        Strip and get queue number.
> > +        """
> > +        s = re.compile(pattern, re.DOTALL)
> > +        res = s.search(out)
> > +        if res is None:
> > +            print utils.RED('Fail to search number.')
> > +            return None
> > +        else:
> > +            result = res.group(1)
> > +            return int(result)
> > +
> > +    def send_packet(self):
> > +        """
> > +        Generate packets and send them to dut
> > +        """
> > +        mac = self.dut.get_mac_address(0)
> > +        for i in range(self.PF_QUEUE * 2):
> > +            pkt = Packet(pkt_type='IP_RAW')
> > +            pkt.config_layer('ether', {'dst': mac})
> > +            pkt.config_layer(
> > +                'ipv4', {'dst': '192.168.0.%d' % i, 'src': '191.168.0.1'})
> > +            pkt.send_pkt(tx_port=self.tester_intf)
> > +
> > +    def rxq_setup_test(self, chgflag=0):
> > +        """
> > +        Dynamic to setup rxq and reconfigure ring size at runtime.
> > +        chgflag: reconfigure ring size flag
> > +                 1:reconfigure Rx ring size
> > +                 0:no change on Rx ring size
> > +        """
> > +        queue = range(3)
> 
> Queue is just list here, why not just use list() ?
Agree, will fix it.
> 
> > +        for i in range(3):
> 
> Recommend not use hard-code 3 here, you can define one global variable for
> test loop.
Agree, will fix it.

> 
> > +            queue[i] = random.randint(1, self.PF_QUEUE - 1)
> > +            self.dut_testpmd.execute_cmd('port 0 rxq %d stop' %
> > + queue[i])
> 
> Please add blank line here for different code block.
NP, will add it.

> 
> > +        self.dut_testpmd.execute_cmd('set fwd rxonly')
> > +        self.dut_testpmd.execute_cmd('start')
> > +        self.send_packet()
> > +        self.dut.get_session_output(timeout=10)
> > +        out = self.dut_testpmd.execute_cmd('stop')
> > +        for i in range(3):
> > +            self.verify(
> > +                "Forward Stats for RX Port= 0/Queue=%2d" % queue[i]
> > + not in
> > out,
> > +                "Fail to verify rxq stop!")
> 
> Check queue stop by "Forward stats" not shown is not straight-forward. Is
> there any other method like check rx stats?

Don't find other better method to verify result. But if queue stop, don't have the Rx forward stats on this queue, if queue start,  have the forward stats.
Also check this with dev, he is agree this method. 
If you have other better idea, pls let me know, thanks.

> 
> > +        if chgflag == 1:
> > +            for i in range(3):
> > +                out = self.dut_testpmd.execute_cmd(
> > +                        'show rxq info 0 %d' % queue[i])
> > +                qring_strip = 'Number of RXDs: '
> > +                pattern = "%s([0-9]+)" % qring_strip
> > +                qringsize = self.element_strip(out, pattern)
> > +                chg_qringsize = qringsize % 1024 + 256
> 
> Xueqin, why first mod 1024 and then add 256? Why not just add 256?
If qringsize is max value, add 256 may not set successfully.

> 
> > +                self.dut_testpmd.execute_cmd(
> > +                    'port config 0 rxq %d ring_size %d'
> > +                    % (queue[i], chg_qringsize))
> > +                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' %
> > queue[i])
> > +                out = self.dut_testpmd.execute_cmd(
> > +                    'show rxq info 0 %d' % queue[i])
> > +                chk_qringsize = self.element_strip(out, pattern)
> > +                self.verify(chk_qringsize == chg_qringsize,
> > +                            "Fail to change ring size at runtime!")
> > +        for i in range(3):
> > +            if chgflag == 0:
> > +                self.dut_testpmd.execute_cmd('port 0 rxq %d setup' %
> > queue[i])
> > +            self.dut_testpmd.execute_cmd('port 0 rxq %d start' % queue[i])
> > +        self.dut_testpmd.execute_cmd('start')
> > +        self.send_packet()
> > +        self.dut.get_session_output(timeout=10)
> > +        out = self.dut_testpmd.execute_cmd('stop')
> 
> 
> Please add blank line here, one line comment will be helpful.
Okay.

> 
> > +        for i in range(3):
> > +            self.verify("Forward Stats for RX Port= 0/Queue=%2d"
> > +                        % queue[i] in out, "Fail to setup rxq %d at runtime"
> > +                        % queue[i])
> > +
> > +    def txq_setup_test(self, chgflag=0):
> > +        """
> > +        Dynamic to setup txq and reconfigure ring size at runtime.
> > +        chgflag: reconfigure ring size flag
> > +                 1:reconfigure Tx ring size
> > +                 0:no change on Tx ring size
> > +        """
> > +        for i in range(3):
> > +            queue = random.randint(1, self.PF_QUEUE - 1)
> > +            out = self.dut_testpmd.execute_cmd('show txq info 0 %d' % queue)
> > +            qring_strip = 'Number of TXDs: '
> > +            pattern = "%s([0-9]+)" % qring_strip
> > +            qringsize = self.element_strip(out, pattern)
> > +            self.dut_testpmd.execute_cmd('port 0 txq %d stop' % queue)
> > +            self.dut_testpmd.execute_cmd('set fwd txonly')
> > +            self.dut_testpmd.execute_cmd('start')
> > +            time.sleep(10)
> > +            out = self.dut_testpmd.execute_cmd('stop')
> > +            tx_num = qringsize - 1
> > +            self.verify("TX-packets: %d" % tx_num in out,
> > +                        "Fail to stop txq at runtime")
> > +            if chgflag == 1:
> > +                chg_qringsize = qringsize % 1024 + 256
> > +                self.dut_testpmd.execute_cmd(
> > +                    'port config 0 txq %d ring_size %d'
> > +                    % (queue, chg_qringsize))
> > +                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
> > +                out = self.dut_testpmd.execute_cmd(
> > +                    'show txq info 0 %d' % queue)
> > +                chk_qringsize = self.element_strip(out, pattern)
> > +                self.verify(chk_qringsize == chg_qringsize,
> > +                            "Fail to change ring size at runtime!")
> > +            if chgflag == 0:
> > +                self.dut_testpmd.execute_cmd('port 0 txq %d setup' % queue)
> > +            self.dut_testpmd.execute_cmd('port 0 txq %d start' % queue)
> > +            self.dut_testpmd.execute_cmd('start')
> > +            time.sleep(10)
> > +            out = self.dut_testpmd.execute_cmd('stop')
> > +            self.verify("TX-packets: %d" % tx_num not in out,
> > +                        "Fail to setup txq at runtime")
> 
> Tx stats should be much larger than tx_num, please check that number.

If queue stops, only fwd 255 packets(ringsize is 256) on this queue, other packets will be dropped.
If queue setups and starts, Tx stats on his queue is bigger than 255.

------- Forward Stats for RX Port= 0/Queue= 2 -> TX Port= 0/Queue= 2 -------
  RX-packets: 0              TX-packets: 255            TX-dropped: 177864385


> 
> > +            if chgflag == 1:
> > +                chgtx_num = chg_qringsize - 1
> > +                self.verify("TX-packets: %d" % chgtx_num not in out,
> > +                            "Fail to change txq ring size at
> > + runtime")
> > +
> 
> Same as previous comment.
> 
> > +    def test_rxq_setup(self):
> > +        """
> > +        Dynamic to setup rxq test
> > +        """
> > +        self.rxq_setup_test()
> > +
> > +    def test_rxq_chgring_setup(self):
> > +        """
> > +        Dynamic to setup rxq and change ring size test
> > +        """
> > +        self.rxq_setup_test(chgflag=1)
> > +
> > +    def test_txq_setup(self):
> > +        """
> > +        Dynamic to setup txq test
> > +        """
> > +        self.txq_setup_test()
> > +
> > +    def test_txq_chgring_setup(self):
> > +        """
> > +        Dynamic to setup txq and change ring size test
> > +        """
> > +        self.txq_setup_test(chgflag=1)
> > +
> > +    def tear_down(self):
> > +        self.dut_testpmd.quit()
> > +
> > +    def tear_down_all(self):
> > +        pass
> > --
> > 2.7.5

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

end of thread, other threads:[~2018-08-24  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07  4:23 [dts] [PATCH] tests/dynamic_queue: add dynamic queue test suite Xueqin Lin
2018-08-20  7:30 ` Liu, Yong
2018-08-24  7:57   ` Lin, Xueqin

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