* [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts
@ 2019-04-02 1:56 xiao,qimai
2019-04-03 17:41 ` Tu, Lijuan
0 siblings, 1 reply; 4+ messages in thread
From: xiao,qimai @ 2019-04-02 1:56 UTC (permalink / raw)
To: dts; +Cc: xiao,qimai
add TestSuite_runtime_vf_queue_number_kernel to dts
Signed-off-by: xiao,qimai <qimaix.xiao@intel.com>
---
...estSuite_runtime_vf_queue_number_kernel.py | 302 ++++++++++++++++++
1 file changed, 302 insertions(+)
create mode 100644 tests/TestSuite_runtime_vf_queue_number_kernel.py
diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py b/tests/TestSuite_runtime_vf_queue_number_kernel.py
new file mode 100644
index 0000000..68b9468
--- /dev/null
+++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py
@@ -0,0 +1,302 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+runtime_vf_queue_number_kernel test script.
+"""
+
+import random
+import time
+
+import utils
+from pmd_output import PmdOutput
+from test_case import TestCase
+from virt_common import VM
+
+VM_CORES_MASK = 'all'
+
+
+class TestRuntimeVfQueueNumberKernel(TestCase):
+ supported_vf_driver = ['pci-stub', 'vfio-pci']
+
+ def set_up_all(self):
+ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_25g", "fortville_spirit_single"],
+ "Only supported by Fortville")
+ self.dut_ports = self.dut.get_ports(self.nic)
+ self.verify(len(self.dut_ports) > 1, "Insufficient ports")
+ self.vm0 = None
+
+ # set vf assign method and vf driver
+ self.vf_driver = self.get_suite_cfg()['vf_driver']
+ if self.vf_driver is None:
+ self.vf_driver = 'pci-stub'
+ self.verify(self.vf_driver in self.supported_vf_driver, "Unspported vf driver")
+ if self.vf_driver == 'pci-stub':
+ self.vf_assign_method = 'pci-assign'
+ else:
+ self.vf_assign_method = 'vfio-pci'
+ self.dut.send_expect('modprobe vfio-pci', '#')
+
+ self.setup_1pf_2vf_1vm_env_flag = 0
+ self.setup_1pf_2vf_1vm_env(driver='')
+ self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
+ self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
+ self.vm_dut_0.vm_pci0 = self.vm_dut_0.ports_info[0]['pci']
+
+ def set_up(self):
+ pass
+ def setup_1pf_2vf_1vm_env(self,driver="default"):
+
+ self.used_dut_port = self.dut_ports[0]
+ self.dut.generate_sriov_vfs_by_port(self.used_dut_port, 2,driver=driver)
+ self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port]['vfs_port']
+
+ try:
+
+ for port in self.sriov_vfs_port:
+ port.bind_driver(self.vf_driver)
+
+ time.sleep(1)
+
+ vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
+ vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci}
+ if driver == 'igb_uio':
+ # start testpmd without the two VFs on the host
+ self.host_testpmd = PmdOutput(self.dut)
+ eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov_vfs_port[0].pci,
+ 'vf1': self.sriov_vfs_port[1].pci}
+ self.host_testpmd.start_testpmd("Default", eal_param=eal_param)
+ # set up VM0 ENV
+ self.vm0 = VM(self.dut, 'vm0', 'runtime_vf_queue_number_kernel')
+ self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
+ self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
+ self.vm_dut_0 = self.vm0.start()
+ if self.vm_dut_0 is None:
+ raise Exception("Set up VM0 ENV failed!")
+
+ self.setup_1pf_2vf_1vm_env_flag = 1
+ except Exception as e:
+ self.destroy_1pf_2vf_1vm_env()
+ raise Exception(e)
+
+ def destroy_1pf_2vf_1vm_env(self):
+ if getattr(self, 'vm0', None):
+ # destroy testpmd in vm0
+ self.vm0_testpmd = None
+ self.vm0_dut_ports = None
+ # destroy vm0
+ self.vm0.stop()
+ self.dut.virt_exit()
+ self.vm0 = None
+ if getattr(self, 'host_testpmd', None):
+ self.host_testpmd.execute_cmd('quit', '# ')
+ self.host_testpmd = None
+
+ if getattr(self, 'used_dut_port', None) != None:
+ self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+ port = self.dut.ports_info[self.used_dut_port]['port']
+ port.bind_driver()
+ self.used_dut_port = None
+
+ for port_id in self.dut_ports:
+ port = self.dut.ports_info[port_id]['port']
+ port.bind_driver()
+
+ self.setup_1pf_2vf_1vm_env_flag = 0
+
+ def send_packet2different_queue(self, dts, src, iface, count):
+ self.tester.scapy_foreground()
+ for i in range(count):
+ pkt = 'sendp([Ether(dst="%s", src="%s")/IP(src="10.0.0.1",dst="192.168.13.%d")/("test"*10)],iface="%s")' % (
+ dts, src, (i % 254) + 1, iface)
+ self.tester.scapy_append(pkt)
+ self.tester.scapy_execute()
+
+ def test_set_valid_vf_queue_num(self):
+ """
+ set valid VF queue number in testpmd command-line options
+ """
+ random_queue = random.randint(2, 15)
+ queue_nums = [1, random_queue, 16]
+ for nr_queue in queue_nums:
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+ eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
+ tx_port = self.tester.get_local_port(self.dut_ports[0])
+ tester_mac = self.tester.get_mac(tx_port)
+ iface = self.tester.get_interface(tx_port)
+ count = nr_queue * 20
+ times = 3
+ while times > 0:
+ out = self.vm0_testpmd.start_testpmd("all", "--rss-ip --txq=%s --rxq=%s" % (nr_queue, nr_queue), eal_param=eal_param)
+ print(out)
+ if 'Failed' in out or 'failed' in out:
+ self.vm0_testpmd.execute_cmd("port stop all")
+ time.sleep(5)
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ times -= 1
+ time.sleep(3)
+ else:
+ times = 0
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+ self.vm0_testpmd.execute_cmd('set promisc all off')
+ time.sleep(1)
+ self.vm0_testpmd.execute_cmd('set fwd mac')
+ self.vm0_testpmd.execute_cmd("clear port stats all")
+ out = self.vm0_testpmd.execute_cmd('start')
+ vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
+ self.verify("port 0: RX queue number: %s Tx queue number: %s" % (nr_queue, nr_queue) in out, "queue number maybe error")
+ self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
+ out = self.vm0_testpmd.get_output()
+ out2 = self.vm0_testpmd.execute_cmd('stop')
+ pkts_num = out.count("src=%s - dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
+ misc = out.count("dst=FF:FF:FF:FF:FF:FF")
+ print("get %d boadcast misc packages " % misc)
+ if nr_queue == 1:
+ self.verify('port 0/queue 0: received 1 packets' in out, "queue %s can not receive pkt" % (nr_queue - 1))
+ else:
+ for i in range(nr_queue):
+ if i<10:
+ i=' '+str(i)
+ self.verify('Queue=%s' % i in out2, "queue %s can not receive pkt" % i)
+ self.verify(pkts_num==count,'Received incorrect pkts number! send %d pkts,received %d pkts'%(count,pkts_num))
+ self.verify('RX-total: %d' % (count+misc) in out2 and 'TX-total: %d' % (count+misc) in out2,
+ "statistic shows rx or tx pkts number: %d incorrect" % (count+misc))
+ self.vm0_testpmd.execute_cmd("clear port stats all")
+ self.vm0_testpmd.execute_cmd("port stop all")
+ time.sleep(5)
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ time.sleep(3)
+
+ def test_set_invalid_vf_queue_num_command_line(self):
+ invalid_queue_num = [0, 17]
+ for i in invalid_queue_num:
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+ self.vm_dut_0.session_secondary = self.vm_dut_0.new_session()
+ out = self.vm_dut_0.session_secondary.send_expect(
+ './x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 1 -w %s -- -i --txq=%s --rxq=%s' % (
+ self.vm_dut_0.vm_pci0, i, i), '# ', 40)
+ if i == 0:
+ self.verify('Either rx or tx queues should be non-zero' in out, "queue number can't be zero")
+ else:
+ self.verify('txq 17 invalid - must be >= 0 && <= 16' in out, "queue number is too big")
+
+ def test_set_valid_vf_queue_num_with_function(self):
+ random_queue = random.randint(2, 15)
+ queue_nums = [1, random_queue, 16]
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+ eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
+ tx_port = self.tester.get_local_port(self.dut_ports[0])
+ tester_mac = self.tester.get_mac(tx_port)
+ iface = self.tester.get_interface(tx_port)
+ for nr_queue in queue_nums:
+ times = 3
+ count = nr_queue * 20
+ while times > 0:
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+ out = self.vm0_testpmd.start_testpmd("all", eal_param=eal_param)
+ print(out)
+ self.vm0_testpmd.execute_cmd("port stop all")
+ self.vm0_testpmd.execute_cmd('set fwd mac')
+ self.vm0_testpmd.execute_cmd("set verbose 1")
+ self.vm0_testpmd.execute_cmd('set promisc all off')
+ time.sleep(1)
+ self.vm0_testpmd.execute_cmd("port config all rxq %s" % nr_queue)
+ self.vm0_testpmd.execute_cmd("port config all txq %s" % nr_queue)
+ out = self.vm0_testpmd.execute_cmd("port start all")
+ print(out)
+ if 'failed' in out or 'fail to' in out:
+ self.vm0_testpmd.execute_cmd("port stop all")
+ time.sleep(5)
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ times -= 1
+ time.sleep(3)
+ self.vm0_testpmd.quit()
+ else:
+ times = 0
+ self.vm0_testpmd.execute_cmd("clear port stats all")
+ out = self.vm0_testpmd.execute_cmd("start")
+ print(out)
+ vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
+ self.verify("port 0: RX queue number: %s Tx queue number: %s" % (nr_queue, nr_queue) in out,
+ "queue number %s maybe error" % nr_queue)
+ self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
+ out = self.vm0_testpmd.get_output()
+ out2 = self.vm0_testpmd.execute_cmd('stop')
+ pkts_num=out.count("src=%s - dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
+ misc = out.count("dst=FF:FF:FF:FF:FF:FF")
+ print("get %d broadcast misc packages " % misc)
+ if nr_queue == 1:
+ self.verify('port 0/queue 0: received 1 packets' in out, "queue %s can not receive pkt" % (nr_queue-1))
+ else:
+ for i in range(nr_queue):
+ if i<10:
+ i=' '+str(i)
+ self.verify('Queue=%s' % i in out2, "queue %s can not receive pkt" % i)
+ self.verify(pkts_num==count,'Received incorrect pkts number! send %d pkts,received %d pkts'%(count,pkts_num))
+ self.verify('RX-total: %d' % (count+misc) in out2 and 'TX-total: %d' % (count+misc) in out2,
+ "statistic shows rx or tx pkts number: %d incorrect" % (count+misc))
+ self.vm0_testpmd.execute_cmd("clear port stats all")
+ self.vm0_testpmd.execute_cmd("port stop all")
+ time.sleep(5)
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ time.sleep(3)
+
+ def test_set_invalid_vf_queue_num_with_testpmd_command(self):
+ invalid_queue_num = [0, 17]
+ self.vm0_testpmd = PmdOutput(self.vm_dut_0)
+ eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
+ self.vm0_testpmd.start_testpmd("all", eal_param=eal_param)
+ self.vm0_testpmd.execute_cmd('set promisc all off')
+ self.vm0_testpmd.execute_cmd('set fwd mac')
+ self.vm0_testpmd.execute_cmd("port stop all")
+ for i in invalid_queue_num:
+ if i == 0:
+ self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
+ out = self.vm0_testpmd.execute_cmd("port config all txq %s" % i)
+ self.verify('Either rx or tx queues should be non zero' in out, "queue number can't be zero")
+ else:
+ out = self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
+ self.verify("input rxq (17) can't be greater than max_rx_queues (16) of port 0" in out,
+ "queue number is too big")
+ self.vm0_testpmd.execute_cmd("clear port stats all")
+ time.sleep(1)
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+
+ def tear_down(self):
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ pass
+
+ def tear_down_all(self):
+ print
+ "tear_down_all"
+ if self.setup_1pf_2vf_1vm_env_flag == 1:
+ self.destroy_1pf_2vf_1vm_env()
--
2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts
2019-04-02 1:56 [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts xiao,qimai
@ 2019-04-03 17:41 ` Tu, Lijuan
2019-04-04 2:07 ` Xiao, QimaiX
0 siblings, 1 reply; 4+ messages in thread
From: Tu, Lijuan @ 2019-04-03 17:41 UTC (permalink / raw)
To: Xiao, QimaiX, dts; +Cc: Xiao, QimaiX
Why you try 3 times to start testpmd, is there a bug , if yes, please report it out, and get fix. If no, please explain why.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xiao,qimai
> Sent: Monday, April 1, 2019 6:57 PM
> To: dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [dts] [PATCH V2 1/2] add
> TestSuite_runtime_vf_queue_number_kernel to dts
>
> add TestSuite_runtime_vf_queue_number_kernel to dts
>
> Signed-off-by: xiao,qimai <qimaix.xiao@intel.com>
> ---
> ...estSuite_runtime_vf_queue_number_kernel.py | 302
> ++++++++++++++++++
> 1 file changed, 302 insertions(+)
> create mode 100644 tests/TestSuite_runtime_vf_queue_number_kernel.py
>
> diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py
> b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> new file mode 100644
> index 0000000..68b9468
> --- /dev/null
> +++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> @@ -0,0 +1,302 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without #
> +modification, are permitted provided that the following conditions #
> +are met:
> +#
> +# * Redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in
> +# the documentation and/or other materials provided with the
> +# distribution.
> +# * Neither the name of Intel Corporation nor the names of its
> +# contributors may be used to endorse or promote products derived
> +# from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS #
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> FOR #
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT #
> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, #
> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> #
> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE, #
> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY #
> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE #
> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +"""
> +DPDK Test suite.
> +runtime_vf_queue_number_kernel test script.
> +"""
> +
> +import random
> +import time
> +
> +import utils
> +from pmd_output import PmdOutput
> +from test_case import TestCase
> +from virt_common import VM
> +
> +VM_CORES_MASK = 'all'
> +
> +
> +class TestRuntimeVfQueueNumberKernel(TestCase):
> + supported_vf_driver = ['pci-stub', 'vfio-pci']
> +
> + def set_up_all(self):
> + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_25g",
> "fortville_spirit_single"],
> + "Only supported by Fortville")
> + self.dut_ports = self.dut.get_ports(self.nic)
> + self.verify(len(self.dut_ports) > 1, "Insufficient ports")
> + self.vm0 = None
> +
> + # set vf assign method and vf driver
> + self.vf_driver = self.get_suite_cfg()['vf_driver']
> + if self.vf_driver is None:
> + self.vf_driver = 'pci-stub'
> + self.verify(self.vf_driver in self.supported_vf_driver, "Unspported vf
> driver")
> + if self.vf_driver == 'pci-stub':
> + self.vf_assign_method = 'pci-assign'
> + else:
> + self.vf_assign_method = 'vfio-pci'
> + self.dut.send_expect('modprobe vfio-pci', '#')
> +
> + self.setup_1pf_2vf_1vm_env_flag = 0
> + self.setup_1pf_2vf_1vm_env(driver='')
> + self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> + self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
> + self.vm_dut_0.vm_pci0 = self.vm_dut_0.ports_info[0]['pci']
> +
> + def set_up(self):
> + pass
> + def setup_1pf_2vf_1vm_env(self,driver="default"):
> +
> + self.used_dut_port = self.dut_ports[0]
> + self.dut.generate_sriov_vfs_by_port(self.used_dut_port,
> 2,driver=driver)
> + self.sriov_vfs_port =
> + self.dut.ports_info[self.used_dut_port]['vfs_port']
> +
> + try:
> +
> + for port in self.sriov_vfs_port:
> + port.bind_driver(self.vf_driver)
> +
> + time.sleep(1)
> +
> + vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
> + vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci}
> + if driver == 'igb_uio':
> + # start testpmd without the two VFs on the host
> + self.host_testpmd = PmdOutput(self.dut)
> + eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0':
> self.sriov_vfs_port[0].pci,
> + 'vf1': self.sriov_vfs_port[1].pci}
> + self.host_testpmd.start_testpmd("Default", eal_param=eal_param)
> + # set up VM0 ENV
> + self.vm0 = VM(self.dut, 'vm0', 'runtime_vf_queue_number_kernel')
> + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
> + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
> + self.vm_dut_0 = self.vm0.start()
> + if self.vm_dut_0 is None:
> + raise Exception("Set up VM0 ENV failed!")
> +
> + self.setup_1pf_2vf_1vm_env_flag = 1
> + except Exception as e:
> + self.destroy_1pf_2vf_1vm_env()
> + raise Exception(e)
> +
> + def destroy_1pf_2vf_1vm_env(self):
> + if getattr(self, 'vm0', None):
> + # destroy testpmd in vm0
> + self.vm0_testpmd = None
> + self.vm0_dut_ports = None
> + # destroy vm0
> + self.vm0.stop()
> + self.dut.virt_exit()
> + self.vm0 = None
> + if getattr(self, 'host_testpmd', None):
> + self.host_testpmd.execute_cmd('quit', '# ')
> + self.host_testpmd = None
> +
> + if getattr(self, 'used_dut_port', None) != None:
> + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> + port = self.dut.ports_info[self.used_dut_port]['port']
> + port.bind_driver()
> + self.used_dut_port = None
> +
> + for port_id in self.dut_ports:
> + port = self.dut.ports_info[port_id]['port']
> + port.bind_driver()
> +
> + self.setup_1pf_2vf_1vm_env_flag = 0
> +
> + def send_packet2different_queue(self, dts, src, iface, count):
> + self.tester.scapy_foreground()
> + for i in range(count):
> + pkt = 'sendp([Ether(dst="%s",
> src="%s")/IP(src="10.0.0.1",dst="192.168.13.%d")/("test"*10)],iface="%s")' % (
> + dts, src, (i % 254) + 1, iface)
> + self.tester.scapy_append(pkt)
> + self.tester.scapy_execute()
> +
> + def test_set_valid_vf_queue_num(self):
> + """
> + set valid VF queue number in testpmd command-line options
> + """
> + random_queue = random.randint(2, 15)
> + queue_nums = [1, random_queue, 16]
> + for nr_queue in queue_nums:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + tx_port = self.tester.get_local_port(self.dut_ports[0])
> + tester_mac = self.tester.get_mac(tx_port)
> + iface = self.tester.get_interface(tx_port)
> + count = nr_queue * 20
> + times = 3
> + while times > 0:
> + out = self.vm0_testpmd.start_testpmd("all", "--rss-ip --txq=%s --
> rxq=%s" % (nr_queue, nr_queue), eal_param=eal_param)
> + print(out)
> + if 'Failed' in out or 'failed' in out:
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + times -= 1
> + time.sleep(3)
> + else:
> + times = 0
> + self.vm0_testpmd.execute_cmd('set verbose 1')
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + out = self.vm0_testpmd.execute_cmd('start')
> + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> + self.verify("port 0: RX queue number: %s Tx queue number: %s" %
> (nr_queue, nr_queue) in out, "queue number maybe error")
> + self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
> + out = self.vm0_testpmd.get_output()
> + out2 = self.vm0_testpmd.execute_cmd('stop')
> + pkts_num = out.count("src=%s -
> dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> + print("get %d boadcast misc packages " % misc)
> + if nr_queue == 1:
> + self.verify('port 0/queue 0: received 1 packets' in out, "queue %s
> can not receive pkt" % (nr_queue - 1))
> + else:
> + for i in range(nr_queue):
> + if i<10:
> + i=' '+str(i)
> + self.verify('Queue=%s' % i in out2, "queue %s can not receive
> pkt" % i)
> + self.verify(pkts_num==count,'Received incorrect pkts number!
> send %d pkts,received %d pkts'%(count,pkts_num))
> + self.verify('RX-total: %d' % (count+misc) in out2 and 'TX-total: %d' %
> (count+misc) in out2,
> + "statistic shows rx or tx pkts number: %d incorrect" %
> (count+misc))
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + time.sleep(3)
> +
> + def test_set_invalid_vf_queue_num_command_line(self):
> + invalid_queue_num = [0, 17]
> + for i in invalid_queue_num:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + self.vm_dut_0.session_secondary = self.vm_dut_0.new_session()
> + out = self.vm_dut_0.session_secondary.send_expect(
> + './x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 1 -w %s -- -i --
> txq=%s --rxq=%s' % (
> + self.vm_dut_0.vm_pci0, i, i), '# ', 40)
> + if i == 0:
> + self.verify('Either rx or tx queues should be non-zero' in out,
> "queue number can't be zero")
> + else:
> + self.verify('txq 17 invalid - must be >= 0 && <= 16' in
> + out, "queue number is too big")
> +
> + def test_set_valid_vf_queue_num_with_function(self):
> + random_queue = random.randint(2, 15)
> + queue_nums = [1, random_queue, 16]
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + tx_port = self.tester.get_local_port(self.dut_ports[0])
> + tester_mac = self.tester.get_mac(tx_port)
> + iface = self.tester.get_interface(tx_port)
> + for nr_queue in queue_nums:
> + times = 3
> + count = nr_queue * 20
> + while times > 0:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + out = self.vm0_testpmd.start_testpmd("all",
> eal_param=eal_param)
> + print(out)
> + self.vm0_testpmd.execute_cmd("port stop all")
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("set verbose 1")
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd("port config all rxq %s" %
> nr_queue)
> + self.vm0_testpmd.execute_cmd("port config all txq %s" %
> nr_queue)
> + out = self.vm0_testpmd.execute_cmd("port start all")
> + print(out)
> + if 'failed' in out or 'fail to' in out:
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + times -= 1
> + time.sleep(3)
> + self.vm0_testpmd.quit()
> + else:
> + times = 0
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + out = self.vm0_testpmd.execute_cmd("start")
> + print(out)
> + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> + self.verify("port 0: RX queue number: %s Tx queue number: %s" %
> (nr_queue, nr_queue) in out,
> + "queue number %s maybe error" % nr_queue)
> + self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
> + out = self.vm0_testpmd.get_output()
> + out2 = self.vm0_testpmd.execute_cmd('stop')
> + pkts_num=out.count("src=%s -
> dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> + print("get %d broadcast misc packages " % misc)
> + if nr_queue == 1:
> + self.verify('port 0/queue 0: received 1 packets' in out, "queue %s
> can not receive pkt" % (nr_queue-1))
> + else:
> + for i in range(nr_queue):
> + if i<10:
> + i=' '+str(i)
> + self.verify('Queue=%s' % i in out2, "queue %s can not receive
> pkt" % i)
> + self.verify(pkts_num==count,'Received incorrect pkts number!
> send %d pkts,received %d pkts'%(count,pkts_num))
> + self.verify('RX-total: %d' % (count+misc) in out2 and 'TX-total: %d' %
> (count+misc) in out2,
> + "statistic shows rx or tx pkts number: %d incorrect" %
> (count+misc))
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + time.sleep(3)
> +
> + def test_set_invalid_vf_queue_num_with_testpmd_command(self):
> + invalid_queue_num = [0, 17]
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + self.vm0_testpmd.start_testpmd("all", eal_param=eal_param)
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("port stop all")
> + for i in invalid_queue_num:
> + if i == 0:
> + self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> + out = self.vm0_testpmd.execute_cmd("port config all txq %s" % i)
> + self.verify('Either rx or tx queues should be non zero' in out,
> "queue number can't be zero")
> + else:
> + out = self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> + self.verify("input rxq (17) can't be greater than max_rx_queues (16)
> of port 0" in out,
> + "queue number is too big")
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> +
> + def tear_down(self):
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + pass
> +
> + def tear_down_all(self):
> + print
> + "tear_down_all"
> + if self.setup_1pf_2vf_1vm_env_flag == 1:
> + self.destroy_1pf_2vf_1vm_env()
> --
> 2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts
2019-04-03 17:41 ` Tu, Lijuan
@ 2019-04-04 2:07 ` Xiao, QimaiX
2019-04-11 18:03 ` Tu, Lijuan
0 siblings, 1 reply; 4+ messages in thread
From: Xiao, QimaiX @ 2019-04-04 2:07 UTC (permalink / raw)
To: Tu, Lijuan, dts
After a conversation with yan, zhirun, he has comfimed that may be a bug of dpdk. I'll report it on jira.
-----Original Message-----
From: Tu, Lijuan
Sent: Thursday, April 4, 2019 1:41 AM
To: Xiao, QimaiX <qimaix.xiao@intel.com>; dts@dpdk.org
Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
Subject: RE: [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts
Why you try 3 times to start testpmd, is there a bug , if yes, please report it out, and get fix. If no, please explain why.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xiao,qimai
> Sent: Monday, April 1, 2019 6:57 PM
> To: dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: [dts] [PATCH V2 1/2] add
> TestSuite_runtime_vf_queue_number_kernel to dts
>
> add TestSuite_runtime_vf_queue_number_kernel to dts
>
> Signed-off-by: xiao,qimai <qimaix.xiao@intel.com>
> ---
> ...estSuite_runtime_vf_queue_number_kernel.py | 302
> ++++++++++++++++++
> 1 file changed, 302 insertions(+)
> create mode 100644 tests/TestSuite_runtime_vf_queue_number_kernel.py
>
> diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py
> b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> new file mode 100644
> index 0000000..68b9468
> --- /dev/null
> +++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> @@ -0,0 +1,302 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +#
> +# * Redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in
> +# the documentation and/or other materials provided with the
> +# distribution.
> +# * Neither the name of Intel Corporation nor the names of its
> +# contributors may be used to endorse or promote products derived
> +# from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS #
> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> FOR #
> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> COPYRIGHT #
> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, #
> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> #
> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE, #
> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY #
> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #
> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE #
> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +"""
> +DPDK Test suite.
> +runtime_vf_queue_number_kernel test script.
> +"""
> +
> +import random
> +import time
> +
> +import utils
> +from pmd_output import PmdOutput
> +from test_case import TestCase
> +from virt_common import VM
> +
> +VM_CORES_MASK = 'all'
> +
> +
> +class TestRuntimeVfQueueNumberKernel(TestCase):
> + supported_vf_driver = ['pci-stub', 'vfio-pci']
> +
> + def set_up_all(self):
> + self.verify(self.nic in ["fortville_eagle",
> + "fortville_spirit", "fortville_25g",
> "fortville_spirit_single"],
> + "Only supported by Fortville")
> + self.dut_ports = self.dut.get_ports(self.nic)
> + self.verify(len(self.dut_ports) > 1, "Insufficient ports")
> + self.vm0 = None
> +
> + # set vf assign method and vf driver
> + self.vf_driver = self.get_suite_cfg()['vf_driver']
> + if self.vf_driver is None:
> + self.vf_driver = 'pci-stub'
> + self.verify(self.vf_driver in self.supported_vf_driver,
> + "Unspported vf
> driver")
> + if self.vf_driver == 'pci-stub':
> + self.vf_assign_method = 'pci-assign'
> + else:
> + self.vf_assign_method = 'vfio-pci'
> + self.dut.send_expect('modprobe vfio-pci', '#')
> +
> + self.setup_1pf_2vf_1vm_env_flag = 0
> + self.setup_1pf_2vf_1vm_env(driver='')
> + self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> + self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
> + self.vm_dut_0.vm_pci0 = self.vm_dut_0.ports_info[0]['pci']
> +
> + def set_up(self):
> + pass
> + def setup_1pf_2vf_1vm_env(self,driver="default"):
> +
> + self.used_dut_port = self.dut_ports[0]
> + self.dut.generate_sriov_vfs_by_port(self.used_dut_port,
> 2,driver=driver)
> + self.sriov_vfs_port =
> + self.dut.ports_info[self.used_dut_port]['vfs_port']
> +
> + try:
> +
> + for port in self.sriov_vfs_port:
> + port.bind_driver(self.vf_driver)
> +
> + time.sleep(1)
> +
> + vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
> + vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci}
> + if driver == 'igb_uio':
> + # start testpmd without the two VFs on the host
> + self.host_testpmd = PmdOutput(self.dut)
> + eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0':
> self.sriov_vfs_port[0].pci,
> + 'vf1': self.sriov_vfs_port[1].pci}
> + self.host_testpmd.start_testpmd("Default", eal_param=eal_param)
> + # set up VM0 ENV
> + self.vm0 = VM(self.dut, 'vm0', 'runtime_vf_queue_number_kernel')
> + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
> + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
> + self.vm_dut_0 = self.vm0.start()
> + if self.vm_dut_0 is None:
> + raise Exception("Set up VM0 ENV failed!")
> +
> + self.setup_1pf_2vf_1vm_env_flag = 1
> + except Exception as e:
> + self.destroy_1pf_2vf_1vm_env()
> + raise Exception(e)
> +
> + def destroy_1pf_2vf_1vm_env(self):
> + if getattr(self, 'vm0', None):
> + # destroy testpmd in vm0
> + self.vm0_testpmd = None
> + self.vm0_dut_ports = None
> + # destroy vm0
> + self.vm0.stop()
> + self.dut.virt_exit()
> + self.vm0 = None
> + if getattr(self, 'host_testpmd', None):
> + self.host_testpmd.execute_cmd('quit', '# ')
> + self.host_testpmd = None
> +
> + if getattr(self, 'used_dut_port', None) != None:
> + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> + port = self.dut.ports_info[self.used_dut_port]['port']
> + port.bind_driver()
> + self.used_dut_port = None
> +
> + for port_id in self.dut_ports:
> + port = self.dut.ports_info[port_id]['port']
> + port.bind_driver()
> +
> + self.setup_1pf_2vf_1vm_env_flag = 0
> +
> + def send_packet2different_queue(self, dts, src, iface, count):
> + self.tester.scapy_foreground()
> + for i in range(count):
> + pkt = 'sendp([Ether(dst="%s",
> src="%s")/IP(src="10.0.0.1",dst="192.168.13.%d")/("test"*10)],iface="%
> s")' % (
> + dts, src, (i % 254) + 1, iface)
> + self.tester.scapy_append(pkt)
> + self.tester.scapy_execute()
> +
> + def test_set_valid_vf_queue_num(self):
> + """
> + set valid VF queue number in testpmd command-line options
> + """
> + random_queue = random.randint(2, 15)
> + queue_nums = [1, random_queue, 16]
> + for nr_queue in queue_nums:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + tx_port = self.tester.get_local_port(self.dut_ports[0])
> + tester_mac = self.tester.get_mac(tx_port)
> + iface = self.tester.get_interface(tx_port)
> + count = nr_queue * 20
> + times = 3
> + while times > 0:
> + out = self.vm0_testpmd.start_testpmd("all", "--rss-ip
> + --txq=%s --
> rxq=%s" % (nr_queue, nr_queue), eal_param=eal_param)
> + print(out)
> + if 'Failed' in out or 'failed' in out:
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + times -= 1
> + time.sleep(3)
> + else:
> + times = 0
> + self.vm0_testpmd.execute_cmd('set verbose 1')
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + out = self.vm0_testpmd.execute_cmd('start')
> + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> + self.verify("port 0: RX queue number: %s Tx queue number:
> + %s" %
> (nr_queue, nr_queue) in out, "queue number maybe error")
> + self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
> + out = self.vm0_testpmd.get_output()
> + out2 = self.vm0_testpmd.execute_cmd('stop')
> + pkts_num = out.count("src=%s -
> dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> + print("get %d boadcast misc packages " % misc)
> + if nr_queue == 1:
> + self.verify('port 0/queue 0: received 1 packets' in
> + out, "queue %s
> can not receive pkt" % (nr_queue - 1))
> + else:
> + for i in range(nr_queue):
> + if i<10:
> + i=' '+str(i)
> + self.verify('Queue=%s' % i in out2, "queue %s can
> + not receive
> pkt" % i)
> + self.verify(pkts_num==count,'Received incorrect pkts number!
> send %d pkts,received %d pkts'%(count,pkts_num))
> + self.verify('RX-total: %d' % (count+misc) in out2 and
> + 'TX-total: %d' %
> (count+misc) in out2,
> + "statistic shows rx or tx pkts number: %d
> + incorrect" %
> (count+misc))
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + time.sleep(3)
> +
> + def test_set_invalid_vf_queue_num_command_line(self):
> + invalid_queue_num = [0, 17]
> + for i in invalid_queue_num:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + self.vm_dut_0.session_secondary = self.vm_dut_0.new_session()
> + out = self.vm_dut_0.session_secondary.send_expect(
> + './x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 1
> + -w %s -- -i --
> txq=%s --rxq=%s' % (
> + self.vm_dut_0.vm_pci0, i, i), '# ', 40)
> + if i == 0:
> + self.verify('Either rx or tx queues should be
> + non-zero' in out,
> "queue number can't be zero")
> + else:
> + self.verify('txq 17 invalid - must be >= 0 && <= 16'
> + in out, "queue number is too big")
> +
> + def test_set_valid_vf_queue_num_with_function(self):
> + random_queue = random.randint(2, 15)
> + queue_nums = [1, random_queue, 16]
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + tx_port = self.tester.get_local_port(self.dut_ports[0])
> + tester_mac = self.tester.get_mac(tx_port)
> + iface = self.tester.get_interface(tx_port)
> + for nr_queue in queue_nums:
> + times = 3
> + count = nr_queue * 20
> + while times > 0:
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + out = self.vm0_testpmd.start_testpmd("all",
> eal_param=eal_param)
> + print(out)
> + self.vm0_testpmd.execute_cmd("port stop all")
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("set verbose 1")
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd("port config all rxq %s"
> + %
> nr_queue)
> + self.vm0_testpmd.execute_cmd("port config all txq %s"
> + %
> nr_queue)
> + out = self.vm0_testpmd.execute_cmd("port start all")
> + print(out)
> + if 'failed' in out or 'fail to' in out:
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + times -= 1
> + time.sleep(3)
> + self.vm0_testpmd.quit()
> + else:
> + times = 0
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + out = self.vm0_testpmd.execute_cmd("start")
> + print(out)
> + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> + self.verify("port 0: RX queue number: %s Tx queue number:
> + %s" %
> (nr_queue, nr_queue) in out,
> + "queue number %s maybe error" % nr_queue)
> + self.send_packet2different_queue(vf0_mac, tester_mac, iface, count)
> + out = self.vm0_testpmd.get_output()
> + out2 = self.vm0_testpmd.execute_cmd('stop')
> + pkts_num=out.count("src=%s -
> dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> + print("get %d broadcast misc packages " % misc)
> + if nr_queue == 1:
> + self.verify('port 0/queue 0: received 1 packets' in
> + out, "queue %s
> can not receive pkt" % (nr_queue-1))
> + else:
> + for i in range(nr_queue):
> + if i<10:
> + i=' '+str(i)
> + self.verify('Queue=%s' % i in out2, "queue %s can
> + not receive
> pkt" % i)
> + self.verify(pkts_num==count,'Received incorrect pkts number!
> send %d pkts,received %d pkts'%(count,pkts_num))
> + self.verify('RX-total: %d' % (count+misc) in out2 and
> + 'TX-total: %d' %
> (count+misc) in out2,
> + "statistic shows rx or tx pkts number: %d
> + incorrect" %
> (count+misc))
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + self.vm0_testpmd.execute_cmd("port stop all")
> + time.sleep(5)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + time.sleep(3)
> +
> + def test_set_invalid_vf_queue_num_with_testpmd_command(self):
> + invalid_queue_num = [0, 17]
> + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> + self.vm0_testpmd.start_testpmd("all", eal_param=eal_param)
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + self.vm0_testpmd.execute_cmd('set fwd mac')
> + self.vm0_testpmd.execute_cmd("port stop all")
> + for i in invalid_queue_num:
> + if i == 0:
> + self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> + out = self.vm0_testpmd.execute_cmd("port config all txq %s" % i)
> + self.verify('Either rx or tx queues should be non
> + zero' in out,
> "queue number can't be zero")
> + else:
> + out = self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> + self.verify("input rxq (17) can't be greater than
> + max_rx_queues (16)
> of port 0" in out,
> + "queue number is too big")
> + self.vm0_testpmd.execute_cmd("clear port stats all")
> + time.sleep(1)
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> +
> + def tear_down(self):
> + self.vm0_testpmd.execute_cmd('quit', '# ')
> + pass
> +
> + def tear_down_all(self):
> + print
> + "tear_down_all"
> + if self.setup_1pf_2vf_1vm_env_flag == 1:
> + self.destroy_1pf_2vf_1vm_env()
> --
> 2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts
2019-04-04 2:07 ` Xiao, QimaiX
@ 2019-04-11 18:03 ` Tu, Lijuan
0 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2019-04-11 18:03 UTC (permalink / raw)
To: Xiao, QimaiX, dts
If that, you'd better add some interpretation around your code, it's better to wrap them in a function if it will be called for several times.
> -----Original Message-----
> From: Xiao, QimaiX
> Sent: Wednesday, April 3, 2019 7:07 PM
> To: Tu, Lijuan <lijuan.tu@intel.com>; dts@dpdk.org
> Subject: RE: [dts] [PATCH V2 1/2] add
> TestSuite_runtime_vf_queue_number_kernel to dts
>
>
> After a conversation with yan, zhirun, he has comfimed that may be a bug of
> dpdk. I'll report it on jira.
> -----Original Message-----
> From: Tu, Lijuan
> Sent: Thursday, April 4, 2019 1:41 AM
> To: Xiao, QimaiX <qimaix.xiao@intel.com>; dts@dpdk.org
> Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> Subject: RE: [dts] [PATCH V2 1/2] add
> TestSuite_runtime_vf_queue_number_kernel to dts
>
> Why you try 3 times to start testpmd, is there a bug , if yes, please report it
> out, and get fix. If no, please explain why.
>
> > -----Original Message-----
> > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xiao,qimai
> > Sent: Monday, April 1, 2019 6:57 PM
> > To: dts@dpdk.org
> > Cc: Xiao, QimaiX <qimaix.xiao@intel.com>
> > Subject: [dts] [PATCH V2 1/2] add
> > TestSuite_runtime_vf_queue_number_kernel to dts
> >
> > add TestSuite_runtime_vf_queue_number_kernel to dts
> >
> > Signed-off-by: xiao,qimai <qimaix.xiao@intel.com>
> > ---
> > ...estSuite_runtime_vf_queue_number_kernel.py | 302
> > ++++++++++++++++++
> > 1 file changed, 302 insertions(+)
> > create mode 100644
> tests/TestSuite_runtime_vf_queue_number_kernel.py
> >
> > diff --git a/tests/TestSuite_runtime_vf_queue_number_kernel.py
> > b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> > new file mode 100644
> > index 0000000..68b9468
> > --- /dev/null
> > +++ b/tests/TestSuite_runtime_vf_queue_number_kernel.py
> > @@ -0,0 +1,302 @@
> > +# BSD LICENSE
> > +#
> > +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
> > +# All rights reserved.
> > +#
> > +# Redistribution and use in source and binary forms, with or without
> > +# modification, are permitted provided that the following conditions
> > +# are met:
> > +#
> > +# * Redistributions of source code must retain the above copyright
> > +# notice, this list of conditions and the following disclaimer.
> > +# * Redistributions in binary form must reproduce the above copyright
> > +# notice, this list of conditions and the following disclaimer in
> > +# the documentation and/or other materials provided with the
> > +# distribution.
> > +# * Neither the name of Intel Corporation nor the names of its
> > +# contributors may be used to endorse or promote products derived
> > +# from this software without specific prior written permission.
> > +#
> > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> > CONTRIBUTORS #
> > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> #
> > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS
> > FOR #
> > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> > COPYRIGHT #
> > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> > INCIDENTAL, #
> > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> NOT
> > #
> > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > USE, #
> > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > ON ANY #
> > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> #
> > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> THE
> > USE #
> > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGE.
> > +
> > +"""
> > +DPDK Test suite.
> > +runtime_vf_queue_number_kernel test script.
> > +"""
> > +
> > +import random
> > +import time
> > +
> > +import utils
> > +from pmd_output import PmdOutput
> > +from test_case import TestCase
> > +from virt_common import VM
> > +
> > +VM_CORES_MASK = 'all'
> > +
> > +
> > +class TestRuntimeVfQueueNumberKernel(TestCase):
> > + supported_vf_driver = ['pci-stub', 'vfio-pci']
> > +
> > + def set_up_all(self):
> > + self.verify(self.nic in ["fortville_eagle",
> > + "fortville_spirit", "fortville_25g",
> > "fortville_spirit_single"],
> > + "Only supported by Fortville")
> > + self.dut_ports = self.dut.get_ports(self.nic)
> > + self.verify(len(self.dut_ports) > 1, "Insufficient ports")
> > + self.vm0 = None
> > +
> > + # set vf assign method and vf driver
> > + self.vf_driver = self.get_suite_cfg()['vf_driver']
> > + if self.vf_driver is None:
> > + self.vf_driver = 'pci-stub'
> > + self.verify(self.vf_driver in self.supported_vf_driver,
> > + "Unspported vf
> > driver")
> > + if self.vf_driver == 'pci-stub':
> > + self.vf_assign_method = 'pci-assign'
> > + else:
> > + self.vf_assign_method = 'vfio-pci'
> > + self.dut.send_expect('modprobe vfio-pci', '#')
> > +
> > + self.setup_1pf_2vf_1vm_env_flag = 0
> > + self.setup_1pf_2vf_1vm_env(driver='')
> > + self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> > + self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
> > + self.vm_dut_0.vm_pci0 = self.vm_dut_0.ports_info[0]['pci']
> > +
> > + def set_up(self):
> > + pass
> > + def setup_1pf_2vf_1vm_env(self,driver="default"):
> > +
> > + self.used_dut_port = self.dut_ports[0]
> > + self.dut.generate_sriov_vfs_by_port(self.used_dut_port,
> > 2,driver=driver)
> > + self.sriov_vfs_port =
> > + self.dut.ports_info[self.used_dut_port]['vfs_port']
> > +
> > + try:
> > +
> > + for port in self.sriov_vfs_port:
> > + port.bind_driver(self.vf_driver)
> > +
> > + time.sleep(1)
> > +
> > + vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
> > + vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci}
> > + if driver == 'igb_uio':
> > + # start testpmd without the two VFs on the host
> > + self.host_testpmd = PmdOutput(self.dut)
> > + eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0':
> > self.sriov_vfs_port[0].pci,
> > + 'vf1': self.sriov_vfs_port[1].pci}
> > + self.host_testpmd.start_testpmd("Default",
> eal_param=eal_param)
> > + # set up VM0 ENV
> > + self.vm0 = VM(self.dut, 'vm0', 'runtime_vf_queue_number_kernel')
> > + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
> > + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
> > + self.vm_dut_0 = self.vm0.start()
> > + if self.vm_dut_0 is None:
> > + raise Exception("Set up VM0 ENV failed!")
> > +
> > + self.setup_1pf_2vf_1vm_env_flag = 1
> > + except Exception as e:
> > + self.destroy_1pf_2vf_1vm_env()
> > + raise Exception(e)
> > +
> > + def destroy_1pf_2vf_1vm_env(self):
> > + if getattr(self, 'vm0', None):
> > + # destroy testpmd in vm0
> > + self.vm0_testpmd = None
> > + self.vm0_dut_ports = None
> > + # destroy vm0
> > + self.vm0.stop()
> > + self.dut.virt_exit()
> > + self.vm0 = None
> > + if getattr(self, 'host_testpmd', None):
> > + self.host_testpmd.execute_cmd('quit', '# ')
> > + self.host_testpmd = None
> > +
> > + if getattr(self, 'used_dut_port', None) != None:
> > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
> > + port = self.dut.ports_info[self.used_dut_port]['port']
> > + port.bind_driver()
> > + self.used_dut_port = None
> > +
> > + for port_id in self.dut_ports:
> > + port = self.dut.ports_info[port_id]['port']
> > + port.bind_driver()
> > +
> > + self.setup_1pf_2vf_1vm_env_flag = 0
> > +
> > + def send_packet2different_queue(self, dts, src, iface, count):
> > + self.tester.scapy_foreground()
> > + for i in range(count):
> > + pkt = 'sendp([Ether(dst="%s",
> > src="%s")/IP(src="10.0.0.1",dst="192.168.13.%d")/("test"*10)],iface="%
> > s")' % (
> > + dts, src, (i % 254) + 1, iface)
> > + self.tester.scapy_append(pkt)
> > + self.tester.scapy_execute()
> > +
> > + def test_set_valid_vf_queue_num(self):
> > + """
> > + set valid VF queue number in testpmd command-line options
> > + """
> > + random_queue = random.randint(2, 15)
> > + queue_nums = [1, random_queue, 16]
> > + for nr_queue in queue_nums:
> > + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> > + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> > + tx_port = self.tester.get_local_port(self.dut_ports[0])
> > + tester_mac = self.tester.get_mac(tx_port)
> > + iface = self.tester.get_interface(tx_port)
> > + count = nr_queue * 20
> > + times = 3
> > + while times > 0:
> > + out = self.vm0_testpmd.start_testpmd("all", "--rss-ip
> > + --txq=%s --
> > rxq=%s" % (nr_queue, nr_queue), eal_param=eal_param)
> > + print(out)
> > + if 'Failed' in out or 'failed' in out:
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + time.sleep(5)
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > + times -= 1
> > + time.sleep(3)
> > + else:
> > + times = 0
> > + self.vm0_testpmd.execute_cmd('set verbose 1')
> > + self.vm0_testpmd.execute_cmd('set promisc all off')
> > + time.sleep(1)
> > + self.vm0_testpmd.execute_cmd('set fwd mac')
> > + self.vm0_testpmd.execute_cmd("clear port stats all")
> > + out = self.vm0_testpmd.execute_cmd('start')
> > + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> > + self.verify("port 0: RX queue number: %s Tx queue number:
> > + %s" %
> > (nr_queue, nr_queue) in out, "queue number maybe error")
> > + self.send_packet2different_queue(vf0_mac, tester_mac, iface,
> count)
> > + out = self.vm0_testpmd.get_output()
> > + out2 = self.vm0_testpmd.execute_cmd('stop')
> > + pkts_num = out.count("src=%s -
> > dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> > + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> > + print("get %d boadcast misc packages " % misc)
> > + if nr_queue == 1:
> > + self.verify('port 0/queue 0: received 1 packets' in
> > + out, "queue %s
> > can not receive pkt" % (nr_queue - 1))
> > + else:
> > + for i in range(nr_queue):
> > + if i<10:
> > + i=' '+str(i)
> > + self.verify('Queue=%s' % i in out2, "queue %s can
> > + not receive
> > pkt" % i)
> > + self.verify(pkts_num==count,'Received incorrect pkts number!
> > send %d pkts,received %d pkts'%(count,pkts_num))
> > + self.verify('RX-total: %d' % (count+misc) in out2 and
> > + 'TX-total: %d' %
> > (count+misc) in out2,
> > + "statistic shows rx or tx pkts number: %d
> > + incorrect" %
> > (count+misc))
> > + self.vm0_testpmd.execute_cmd("clear port stats all")
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + time.sleep(5)
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > + time.sleep(3)
> > +
> > + def test_set_invalid_vf_queue_num_command_line(self):
> > + invalid_queue_num = [0, 17]
> > + for i in invalid_queue_num:
> > + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> > + self.vm_dut_0.session_secondary = self.vm_dut_0.new_session()
> > + out = self.vm_dut_0.session_secondary.send_expect(
> > + './x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 1
> > + -w %s -- -i --
> > txq=%s --rxq=%s' % (
> > + self.vm_dut_0.vm_pci0, i, i), '# ', 40)
> > + if i == 0:
> > + self.verify('Either rx or tx queues should be
> > + non-zero' in out,
> > "queue number can't be zero")
> > + else:
> > + self.verify('txq 17 invalid - must be >= 0 && <= 16'
> > + in out, "queue number is too big")
> > +
> > + def test_set_valid_vf_queue_num_with_function(self):
> > + random_queue = random.randint(2, 15)
> > + queue_nums = [1, random_queue, 16]
> > + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> > + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> > + tx_port = self.tester.get_local_port(self.dut_ports[0])
> > + tester_mac = self.tester.get_mac(tx_port)
> > + iface = self.tester.get_interface(tx_port)
> > + for nr_queue in queue_nums:
> > + times = 3
> > + count = nr_queue * 20
> > + while times > 0:
> > + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> > + out = self.vm0_testpmd.start_testpmd("all",
> > eal_param=eal_param)
> > + print(out)
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + self.vm0_testpmd.execute_cmd('set fwd mac')
> > + self.vm0_testpmd.execute_cmd("set verbose 1")
> > + self.vm0_testpmd.execute_cmd('set promisc all off')
> > + time.sleep(1)
> > + self.vm0_testpmd.execute_cmd("port config all rxq %s"
> > + %
> > nr_queue)
> > + self.vm0_testpmd.execute_cmd("port config all txq %s"
> > + %
> > nr_queue)
> > + out = self.vm0_testpmd.execute_cmd("port start all")
> > + print(out)
> > + if 'failed' in out or 'fail to' in out:
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + time.sleep(5)
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > + times -= 1
> > + time.sleep(3)
> > + self.vm0_testpmd.quit()
> > + else:
> > + times = 0
> > + self.vm0_testpmd.execute_cmd("clear port stats all")
> > + out = self.vm0_testpmd.execute_cmd("start")
> > + print(out)
> > + vf0_mac = self.vm0_testpmd.get_port_mac(0).lower()
> > + self.verify("port 0: RX queue number: %s Tx queue number:
> > + %s" %
> > (nr_queue, nr_queue) in out,
> > + "queue number %s maybe error" % nr_queue)
> > + self.send_packet2different_queue(vf0_mac, tester_mac, iface,
> count)
> > + out = self.vm0_testpmd.get_output()
> > + out2 = self.vm0_testpmd.execute_cmd('stop')
> > + pkts_num=out.count("src=%s -
> > dst=%s"%(tester_mac.upper(),vf0_mac.upper()))
> > + misc = out.count("dst=FF:FF:FF:FF:FF:FF")
> > + print("get %d broadcast misc packages " % misc)
> > + if nr_queue == 1:
> > + self.verify('port 0/queue 0: received 1 packets' in
> > + out, "queue %s
> > can not receive pkt" % (nr_queue-1))
[Lijuan] Should be cannot
> > + else:
> > + for i in range(nr_queue):
> > + if i<10:
> > + i=' '+str(i)
> > + self.verify('Queue=%s' % i in out2, "queue %s can
> > + not receive
> > pkt" % i)
> > + self.verify(pkts_num==count,'Received incorrect pkts number!
> > send %d pkts,received %d pkts'%(count,pkts_num))
> > + self.verify('RX-total: %d' % (count+misc) in out2 and
> > + 'TX-total: %d' %
> > (count+misc) in out2,
> > + "statistic shows rx or tx pkts number: %d
> > + incorrect" %
> > (count+misc))
> > + self.vm0_testpmd.execute_cmd("clear port stats all")
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + time.sleep(5)
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > + time.sleep(3)
> > +
> > + def test_set_invalid_vf_queue_num_with_testpmd_command(self):
> > + invalid_queue_num = [0, 17]
> > + self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> > + eal_param = '-w %(vf0)s' % {'vf0': self.vm_dut_0.vm_pci0}
> > + self.vm0_testpmd.start_testpmd("all", eal_param=eal_param)
> > + self.vm0_testpmd.execute_cmd('set promisc all off')
> > + self.vm0_testpmd.execute_cmd('set fwd mac')
> > + self.vm0_testpmd.execute_cmd("port stop all")
> > + for i in invalid_queue_num:
> > + if i == 0:
> > + self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> > + out = self.vm0_testpmd.execute_cmd("port config all txq %s" % i)
> > + self.verify('Either rx or tx queues should be non
> > + zero' in out,
> > "queue number can't be zero")
> > + else:
> > + out = self.vm0_testpmd.execute_cmd("port config all rxq %s" % i)
> > + self.verify("input rxq (17) can't be greater than
> > + max_rx_queues (16)
> > of port 0" in out,
> > + "queue number is too big")
> > + self.vm0_testpmd.execute_cmd("clear port stats all")
> > + time.sleep(1)
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > +
> > + def tear_down(self):
> > + self.vm0_testpmd.execute_cmd('quit', '# ')
> > + pass
[Lijuan] useless statement
> > +
> > + def tear_down_all(self):
> > + print
> > + "tear_down_all"
[Lijuan] useless statement
> > + if self.setup_1pf_2vf_1vm_env_flag == 1:
> > + self.destroy_1pf_2vf_1vm_env()
> > --
> > 2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-11 18:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 1:56 [dts] [PATCH V2 1/2] add TestSuite_runtime_vf_queue_number_kernel to dts xiao,qimai
2019-04-03 17:41 ` Tu, Lijuan
2019-04-04 2:07 ` Xiao, QimaiX
2019-04-11 18:03 ` Tu, Lijuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).