From patchwork Thu Jun 23 06:03:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 113302 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4F933A00C3; Thu, 23 Jun 2022 08:06:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4AAD140A87; Thu, 23 Jun 2022 08:06:04 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id A1B144069C for ; Thu, 23 Jun 2022 08:06:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655964362; x=1687500362; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tD5+D8dYZgMlopCdA8VO+wKyUOtfpQwZbSWBS0eGr04=; b=RjZBuw1GtD0CspsIjIddp012vW/vmtmrhG6x/7DD9VQw+NlXrs0I5Kou eIocSM9Oe4vt1Sel3fMBepxMjtx8NZ9ttXszCVlzovlOPzbR0iHu0+b17 bbMcWKtAcvaGiDJ0qVs23qh0Jmu5A7K0WFNj8rHMaO57SgL0ckQ8ckV37 6aUtH00huOcOyCzZWqsB6yvtl/OHiR3zwmPcG9oDy+Yx3QxUn5mrJC7Lg QpteVo5tUwtEAj0X+wsiWRqNOOCVWV9rnXbDfzLq4U/yH9dz6MiAi0+34 NEt41NCYcJoOd5HUg0V07XLLaXiVtb0urtJGl1Hc6XQN8kX+lkuUfGinC A==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="260452507" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="260452507" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 23:06:01 -0700 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="621198826" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 23:06:00 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 1/2] test_plans/vhost_qemu_mtu_test_plan: fix start VM command and delete invalid step Date: Thu, 23 Jun 2022 02:03:34 -0400 Message-Id: <20220623060334.2236922-1-weix.ling@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Fix start VM command and delete invalid step. Signed-off-by: Wei Ling --- test_plans/vhost_qemu_mtu_test_plan.rst | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/test_plans/vhost_qemu_mtu_test_plan.rst b/test_plans/vhost_qemu_mtu_test_plan.rst index 8b504a8d..22f37106 100644 --- a/test_plans/vhost_qemu_mtu_test_plan.rst +++ b/test_plans/vhost_qemu_mtu_test_plan.rst @@ -28,27 +28,23 @@ Test Case: Test the MTU in virtio-net Use the qemu_2.9 or qemu 2.10 to start the VM and the VM kernel should grand than 4.10, set the mtu value to 9000 - qemu-system-x86_64 \ - -chardev socket,id=char0,path=./vhost-net \ - -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce \ - -device virtio-net-pci,netdev=netdev0,mrg_rxbuf=on,host_mtu=9000 + taskset -c 32 qemu-system-x86_64 -name vm0 \ + -enable-kvm -pidfile /tmp/.vm0.pid -daemonize -monitor unix:/tmp/vm0_monitor.sock,server,nowait \ + -netdev user,id=nttsip1,hostfwd=tcp:127.0.0.1:6000-:22 -device e1000,netdev=nttsip1 \ + -chardev socket,id=char0,path=vhost-net -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:01,mrg_rxbuf=on,host_mtu=9000 -cpu host -smp 8 \ + -m 8192 -object memory-backend-file,id=mem,size=8192M,mem-path=/mnt/huge,share=on -numa node,memdev=mem \ + -mem-prealloc -chardev socket,path=/tmp/vm0_qga0.sock,server,nowait,id=vm0_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm0_qga0,name=org.qemu.guest_agent.0 -vnc :4 -drive file=/home/image/ubuntu2004.img 3. Check the MTU value in VM:: Use the ifconfig command to check the MTU value of virtio kernel driver is 9000 in VM. -4. Bind the virtio driver to igb_uio, launch testpmd in VM, and verify - the mtu in port info is 9000:: - - .//app/dpdk-testpmd -c 0x03 -n 3 \ - -- -i --txd=512 --rxd=128 --tx-offloads=0x0 --enable-hw-vlan-strip - testpmd> set fwd mac - testpmd> start - testpmd> show port info 0 - -5. Check the MTU value of virtio in testpmd on host is 9000:: +4. Check the MTU value of virtio in testpmd on host is 9000:: testpmd> show port info 1 -6. Repeat the step 2 ~ 5, change the mtu value to 68, 65535(the minimal value +5. Repeat the step 2 ~ 4, change the mtu value to 68, 65535(the minimal value and maximum value), verify the value is changed. + From patchwork Thu Jun 23 06:03:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 113303 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75FF7A00C3; Thu, 23 Jun 2022 08:06:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 71B964069D; Thu, 23 Jun 2022 08:06:38 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 4610B4069C for ; Thu, 23 Jun 2022 08:06:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655964396; x=1687500396; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=msJvxuwO+xX1qc3WwLd/TRbKITUPP4Ou18x5ofQ4BIo=; b=km/KoxEhBNJSRIPzpE78VDBBWhn7X7kOq5T02UvYvDYRRiHPYF9Xuh8r dVJAIKV8Go2ynwy2o+zV2KCXIimJli1R15wJaTQ+E3MYIaYbrCpFJ934D kgB9VC+MW/xGrOUOOeI61OwgSfCJ1KEzvZnR63ayhykM0b2ZN4MOILfqt bK68pyNHGQaApu8EmpqqZ8uoGxyzUXXYVOsxWr1kZMrBKFlR+NfbfTnzP ykx/B0lct1T6yVpk+ZhLvkul0RCNk0mzsXvT52pQ72w8QdYkmk3IWgvNX i4V5MIuy8ilR47VVm3fbNFUT8Oe/S/mViq4Jyr36BICQMJjZB591e8D1W A==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="344624928" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="344624928" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 23:06:11 -0700 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="621198934" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 23:06:09 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 2/2] tests/vhost_qemu_mtu: add new vhost_qemu_mtu testsuite Date: Thu, 23 Jun 2022 02:03:44 -0400 Message-Id: <20220623060344.2236982-1-weix.ling@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Add new vhost_qemu_mtu testsuite. Signed-off-by: Wei Ling --- tests/TestSuite_vhost_qemu_mtu.py | 131 ++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 tests/TestSuite_vhost_qemu_mtu.py diff --git a/tests/TestSuite_vhost_qemu_mtu.py b/tests/TestSuite_vhost_qemu_mtu.py new file mode 100644 index 00000000..7e2e2803 --- /dev/null +++ b/tests/TestSuite_vhost_qemu_mtu.py @@ -0,0 +1,131 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation +# + +import re + +import framework.utils as utils +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase +from framework.virt_common import VM + + +class TestVhostQemuMTU(TestCase): + def set_up_all(self): + self.dut_ports = self.dut.get_ports() + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + self.cores_list = self.dut.get_core_list("all", socket=self.ports_socket) + self.verify( + len(self.cores_list) >= 4, + "There has not enough cores to test this suite %s" % self.suite_name, + ) + self.vhost_core_list = self.cores_list[0:2] + self.vm_num = 1 + self.base_dir = self.dut.base_dir.replace("~", "/root") + self.vhost_user = self.dut.new_session(suite="vhost-user") + self.vhost_user_pmd = PmdOutput(self.dut, self.vhost_user) + + def set_up(self): + """ + run before each test case. + """ + self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#") + self.dut.send_expect("killall -s INT dpdk-testpmd", "#") + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") + self.vm_dut = [] + self.vm = [] + + def start_vhost_testpmd(self): + """ + start testpmd on vhost + """ + vdevs = ["net_vhost0,iface=vhost-net0,queues=1"] + ports = [self.dut.ports_info[self.dut_ports[0]]["pci"]] + param = "--txd=512 --rxd=128 --nb-cores=1 --port-topology=chained" + self.vhost_user_pmd.start_testpmd( + cores=self.vhost_core_list, + param=param, + vdevs=vdevs, + ports=ports, + prefix="vhost-user", + ) + self.vhost_user_pmd.execute_cmd("set fwd mac") + self.vhost_user_pmd.execute_cmd("start") + + def start_vm_testpmd(self): + """ + start testpmd on VM + """ + self.vm0_pmd = PmdOutput(self.vm_dut[0]) + ports = [self.vm_dut[0].ports_info[self.dut_ports[0]]["pci"]] + param = "--txd=512 --rxd=128 --tx-offloads=0x0 --enable-hw-vlan-strip" + self.vm0_pmd.start_testpmd( + cores="default", + param=param, + ports=ports, + ) + self.vm0_pmd.execute_cmd("set fwd mac") + self.vm0_pmd.execute_cmd("start") + + def start_vms(self, vm_config="vhost_sample", mtu=9000): + """ + start two VM, each VM has one virtio device + """ + for i in range(self.vm_num): + vm_dut = None + vm_info = VM(self.dut, "vm%d" % i, vm_config) + vm_params = {} + vm_params["driver"] = "vhost-user" + vm_params["opt_path"] = self.base_dir + "/vhost-net%d" % i + vm_params["opt_mac"] = "52:54:00:00:00:0%d" % (i + 1) + vm_params["opt_settings"] = "mrg_rxbuf=on,host_mtu=%d" % mtu + vm_info.set_vm_device(**vm_params) + try: + vm_dut = vm_info.start(set_target=False) + if vm_dut is None: + raise Exception("Set up VM ENV failed") + except Exception as e: + print(utils.RED("Failure for %s" % str(e))) + self.verify(vm_dut is not None, "start vm failed") + self.vm_dut.append(vm_dut) + self.vm.append(vm_info) + + def check_vm_intf_mtu_value(self, mtu): + vm1_intf = self.vm_dut[0].ports_info[0]["intf"] + out = self.vm_dut[0].send_expect("ifconfig %s" % vm1_intf, "#", 10) + self.verify("mtu %d" % mtu in out, "Config VM interface MTU FAILED!") + + def check_virtio_mtu_value(self, mtu): + out = self.vhost_user_pmd.execute_cmd("show port info 1") + self.verify("MTU: %d" % mtu in out, "Config virtio net MTU FAILED!") + + def stop_all_apps(self): + for i in range(len(self.vm)): + self.vm[i].stop() + self.vm_dut.remove(self.vm_dut[i]) + self.vm.remove(self.vm[i]) + self.vhost_user_pmd.quit() + + def test_mtu_in_virtio_net(self): + """ + Test Case: Test the MTU in virtio-net + """ + MTU_LIST = [9000, 68, 65535] + for expected_mtu in MTU_LIST: + self.start_vhost_testpmd() + self.start_vms(mtu=expected_mtu) + self.check_vm_intf_mtu_value(mtu=expected_mtu) + self.check_virtio_mtu_value(mtu=expected_mtu) + self.stop_all_apps() + + def tear_down(self): + """ + run after each test case. + """ + self.dut.kill_all() + + def tear_down_all(self): + """ + Run after each test suite. + """ + pass