[dts] [DTS][PATCH 1/3] virtio: update vhost cuse cases

Xu, Qian Q qian.q.xu at intel.com
Thu Jan 21 09:03:05 CET 2016



Thanks
Qian


-----Original Message-----
From: Fu, JingguoX 
Sent: Thursday, January 21, 2016 2:43 PM
To: dts at dpdk.org
Cc: Liu, Yong; Xu, Qian Q; Fu, JingguoX
Subject: [DTS][PATCH 1/3] virtio: update vhost cuse cases

1: optimize case
2: add get rx rate for generator
3: better way to check vhost.out file
Signed-off-by: Jingguo Fu <jingguox.fu at intel.com>
---
 tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 438 +++++++++++++++++++++++++
 tests/TestSuite_vhost_cuse_sample.py          | 454 --------------------------
 tests/TestSuite_vhost_sample.py               | 425 ------------------------
 tests/TestSuite_vhost_user_one_copy_one_vm.py | 425 ++++++++++++++++++++++++
 4 files changed, 863 insertions(+), 879 deletions(-)
 create mode 100644 tests/TestSuite_vhost_cuse_one_copy_one_vm.py
 delete mode 100644 tests/TestSuite_vhost_cuse_sample.py
 delete mode 100644 tests/TestSuite_vhost_sample.py
 create mode 100644 tests/TestSuite_vhost_user_one_copy_one_vm.py

diff --git a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
new file mode 100644
index 0000000..bff5760
--- /dev/null
+++ b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
@@ -0,0 +1,438 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2015 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.
+
+Vhost Cuse one-copy sample test suite.
+"""
+import os
+import dts
+import string
+import re
+import time
+from scapy.utils import wrpcap, rdpcap
+from test_case import TestCase
+from exception import VerifyFailure
+from settings import HEADER_SIZE
+from etgen import IxiaPacketGenerator
+from qemu_kvm import QEMUKvm
+
+
+class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
+
+    def set_up_all(self):
+        # To Extend IXIA packet generator method, call the tester's method.
+        self.tester.extend_external_packet_generator(TestVhostCuseOneCopyOneVm, self)
+
+        # Change config file to enable vhost-cuse compiled.
+        self.dut.send_expect(
+            "sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST_USER=.*$/CONFIG_RTE_LIBRTE"
+            "_VHOST_USER=n/' ./config/common_linuxapp",
+            "# ",
+            30)
+        self.dut.build_install_dpdk(self.target)
+        self.dut.send_expect("cd ./lib/librte_vhost", "#", 30)
+        print self.dut.send_expect("make", "#", 30)
+        self.dut.send_expect("cd ./eventfd_link", "#", 30)
+        print self.dut.send_expect("make", "#", 30)
+        self.dut.send_expect("cd ~/dpdk", "#", 30)
+
+        # build the vhost sample in vhost-cuse mode.
+        if self.nic in ['niantic']:
+            self.dut.send_expect(
+                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 128/' "
+                "./examples/vhost/main.c",
+                "#")
+        else:
+            self.dut.send_expect(
+                "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 512/' "
+                "./examples/vhost/main.c",
+                "#")
+        out = self.dut.send_expect("make -C examples/vhost", "#")
+        self.verify("Error" not in out, "compilation error")
+        self.verify("No such file" not in out, "Not found file error")
+
+        # Build target with modified config file
+        self.dut.build_install_dpdk(self.target)
+
+        # Get and verify the ports
+        self.dut_ports = self.dut.get_ports()
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
+
+        # Get the port's socket
+        self.pf = self.dut_ports[0]
+        netdev = self.dut.ports_info[self.pf]['port']
+        self.socket = netdev.get_nic_socket()
+        self.cores = self.dut.get_core_list("1S/3C/1T", socket=self.socket)
+
+        # Set the params of vhost-cuse sample
+        self.vhost_app = "./examples/vhost/build/vhost-switch"
+        self.zero_copy = 0
+        self.vm2vm = 0
+        self.jumbo = 0
+        self.vhost_test = self.vhost_app + \
+            " -c %s -n %d --socket-mem 1024,1024 -- -p 0x1 --mergeable %d" + \
+            " --zero-copy %d --vm2vm %d 2 > ./vhost.out &"
+
+        # Define the virtio/VM variables
+        self.virtio1 = "eth1"
+        self.virtio2 = "eth2"
+        self.virtio1_mac = "52:54:00:00:00:01"
+        self.virtio2_mac = "52:54:00:00:00:02"
+        self.src1 = "192.168.4.1"
+        self.src2 = "192.168.3.1"
+        self.dst1 = "192.168.3.1"
+        self.dst2 = "192.168.4.1"
+        self.vm_dut = None
+        self.virtio_cmd_params = \
+        'csum=off,gso=off,guest_csum=off,guest_tso4=off,guest_tso6=off,guest_ecn=off'
+        # Define the table columns
+        self.header_row = ["FrameSize(B)", "RecvPackets(Mpps)", "SendPackets(Mpps)", "LineRate(%)"]
+        self.memory_channel = 4
Similar comments as vhost-user, suggest to remove RecvPackets(Mpps). 

Qian 
Thx. 



More information about the dts mailing list