From patchwork Fri Apr 29 07:02:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 110480 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 0044BA0093; Fri, 29 Apr 2022 09:02:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEBE6415D7; Fri, 29 Apr 2022 09:02:20 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id DE5C440E50 for ; Fri, 29 Apr 2022 09:02:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651215739; x=1682751739; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Y2mlGBwjD5GPQAkNMuP6OIeyEVukwXWKl8lwUdRcF2w=; b=jNHClx8dW4DDcsc8kU01hvmDXZI859rftCxo+g/gZbVh6zoJCyLTKumy 7xjMMztTUaZEfz1u0RHCzuyhD0lJz7pyOdZau1E/XZSl4MJzTeuuVNUWw fIYj5Xc81+Qw99m9cESSK6ZqeWCG/4nV5VhmeuExQlmWO76l/qe0JJynQ iuNmtjJVkn5SLyj7v0QWOXzkGG3yqMBvEdZiA5irpXCgEXP9xAGmgBRzP 6NmD3alSjjxZ5nML/crZf3FpVmkskcITWX9NuBpC+lj5/zFb3yBJmq/+X CaN0NfaoxRZjLp4PMvnN5ZLWuMirsk/jV27cylqH631tDRjQ+2MvmhHnT Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="265402972" X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="265402972" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:18 -0700 X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="542181914" Received: from unknown (HELO localhost.localdomain) ([10.239.251.222]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:16 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V2 1/3] test_plans/index: add basic_4k_pages_cbdma Date: Fri, 29 Apr 2022 07:02:02 +0000 Message-Id: <20220429070202.19107-1-weix.ling@intel.com> X-Mailer: git-send-email 2.34.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 As commit 53d3f4778c(vhost: integrate dmadev in asynchronous data-path), add new testsuite basic_4k_pages_cbdma for coverage the pvp virtio-user 4k pages with cbdma. 1) Add net basic_4k_pages_cbdma_test_plan into test_plans/index.rst. Signed-off-by: Wei Ling --- test_plans/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/test_plans/index.rst b/test_plans/index.rst index f8118d14..bc01e2de 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -40,6 +40,7 @@ The following are the test plans for the DPDK DTS automated test system. ABI_stable_test_plan asan_smoke_test_plan blocklist_test_plan + basic_4k_pages_cbdma_test_plan checksum_offload_test_plan coremask_test_plan cvl_advanced_rss_test_plan From patchwork Fri Apr 29 07:02:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 110481 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 25E7FA0093; Fri, 29 Apr 2022 09:02:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A930410E3; Fri, 29 Apr 2022 09:02:31 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id E268E40E50 for ; Fri, 29 Apr 2022 09:02:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651215750; x=1682751750; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2E0oVV/BWuRm7VFRlb2j684xe5dj+jhWPzIQNdokMbY=; b=AEci+4bTPISWjHZXWRoQIbLknFd6uSzWV7t6CyI9JS0/EVBoMk6uhG+/ 3hZT8n8Vmj6gLCCo+dJl7UDuvBX7NhyasIy9veXELr17V+bzBXhpOvieT p6Wx/iOMI4KZKXGW0fyG/w5KgbHpNfXyEXMlr+5BcYTkO1alKPpPUcd9Y 1mCXuhwLWRq7zU8eO710m02NOaz+YDBahUW1e3+7Exw//aPVmyfXOpuJ3 mJfI2Lh7te7rPK4FwIxItvjM+Qnq7mTmplqHJbB7XWgPZl1PczrTLO34B AbE0/kbL4LJImQ3vlwBneCOP/EN4gVFCiCNsRVXp1ubJeqXvKZE1xmljS w==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="266711074" X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="266711074" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:28 -0700 X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="662199327" Received: from unknown (HELO localhost.localdomain) ([10.239.251.222]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:27 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V2 2/3] test_plans/basic_4k_pages_cbdma_test_plan: add basic_4k_pages_cbdma testplan Date: Fri, 29 Apr 2022 07:02:13 +0000 Message-Id: <20220429070213.19130-1-weix.ling@intel.com> X-Mailer: git-send-email 2.34.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 v1: As commit 53d3f4778c(vhost: integrate dmadev in asynchronous data-path), add new testsuite basic_4k_pages_cbdma for coverage the pvp virtio-user 4k pages with cbdma. 1) Add new testplan basic_4k_pages_cbdma_test_plan into test_plans. v2: Modify the `Description` content in loopback_virtio_user_server_mode_cbdma_test_plan. Signed-off-by: Wei Ling --- test_plans/basic_4k_pages_cbdma_test_plan.rst | 421 ++++++++++++++++++ 1 file changed, 421 insertions(+) create mode 100644 test_plans/basic_4k_pages_cbdma_test_plan.rst diff --git a/test_plans/basic_4k_pages_cbdma_test_plan.rst b/test_plans/basic_4k_pages_cbdma_test_plan.rst new file mode 100644 index 00000000..8ade0ee1 --- /dev/null +++ b/test_plans/basic_4k_pages_cbdma_test_plan.rst @@ -0,0 +1,421 @@ +.. Copyright (c) <2022>, Intel Corporation + 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. + +============================================== +Basic test with CBDMA in 4K-pages test plan +============================================= + +DPDK 19.02 add support for using virtio-user without hugepages. The --no-huge mode was augmented to use memfd-backed memory +(on systems that support memfd), to allow using virtio-user-based NICs without hugepages. + +Vhost asynchronous data path leverages DMA devices to offload memory copies from the CPU and it is implemented in an asynchronous way. +In addition, vhost supports M:N mapping between vrings and DMA virtual channels. Specifically, one vring can use multiple different DMA +channels and one DMA channel can be shared by multiple vrings at the same time. Vhost enqueue operation with CBDMA channels is supported +in both split and packed ring. + +This document provides the test plan for testing some basic functions with CBDMA device in 4K-pages memory environment. +1. Test split and packed ring virtio path in the PVP topology environmet. +2. Check Vhost tx offload function by verifing the TSO/cksum in the TCP/IP stack with vm2vm split ring and packed ring +vhost-user/virtio-net mergeable path. +3.Check the payload of large packet (larger than 1MB) is valid after forwarding packets with vm2vm split ring and packed ring +vhost-user/virtio-net mergeable path. +4. Vhost-user using 1G hugepges and virtio-user using 4k-pages. + +Note: +1. When CBDMA channels are bound to vfio driver, VA mode is the default and recommended. + For PA mode, page by page mapping may exceed IOMMU's max capability, better to use 1G guest hugepage. +2. DPDK local patch that about vhost pmd is needed when testing Vhost asynchronous data path with testpmd. And case 4-5 have not yet been automated. + +For more about dpdk-testpmd sample, please refer to the DPDK docments: +https://doc.dpdk.org/guides/testpmd_app_ug/run_app.html +For virtio-user vdev parameter, you can refer to the DPDK docments: +https://doc.dpdk.org/guides/nics/virtio.html#virtio-paths-selection-and-usage. + +Prerequisites +============= + +Software +-------- +Trex:http://trex-tgn.cisco.com/trex/release/v2.26.tar.gz + +General set up +-------------- +1. Turn off transparent hugepage in grub by adding GRUB_CMDLINE_LINUX="transparent_hugepage=never". + +2. Compile DPDK:: + + # CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all --default-library= + # ninja -C -j 110 + For example: + CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all --default-library=x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc -j 110 + +3. Get the PCI device ID and DMA device ID of DUT, for example, 0000:18:00.0 is PCI device ID, 0000:00:04.0, 0000:00:04.1 is DMA device ID:: + + # ./usertools/dpdk-devbind.py -s + + Network devices using kernel driver + =================================== + 0000:18:00.0 'Device 159b' if=ens785f0 drv=ice unused=vfio-pci + + DMA devices using kernel driver + =============================== + 0000:00:04.0 'Sky Lake-E CBDMA Registers 2021' drv=ioatdma unused=vfio-pci + 0000:00:04.1 'Sky Lake-E CBDMA Registers 2021' drv=ioatdma unused=vfio-pci + +4. Prepare tmpfs with 4K-pages:: + + mkdir /mnt/tmpfs_nohuge0 + mkdir /mnt/tmpfs_nohuge1 + mount tmpfs /mnt/tmpfs_nohuge0 -t tmpfs -o size=4G + mount tmpfs /mnt/tmpfs_nohuge1 -t tmpfs -o size=4G + +Test case +========= + +Common steps +------------ +1. Bind 1 NIC port and CBDMA channels to vfio-pci:: + + # ./usertools/dpdk-devbind.py -b vfio-pci + # ./usertools/dpdk-devbind.py -b vfio-pci + + For example, bind 1 NIC port and 1 CBDMA channels: + # ./usertools/dpdk-devbind.py -b vfio-pci 0000:af:00.0,0000:80:04.0 + +Test Case 1: Basic test vhost/virtio-user split ring with 4K-pages and cbdma enable +----------------------------------------------------------------------------------- +This case uses testpmd Traffic Generator(For example, Trex) to test split ring when vhost uses the asynchronous enqueue operations with CBDMA channels +in 4k-pages environment. And the mapping between vrings and dsa virtual channels is 1:1. + +1. Bind 1 NIC port and 1 CBDMA channel to vfio-pci, as common steps 1. + +2. Launch vhost by below command:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 31-32 -n 4 --no-huge -m 1024 --file-prefix=vhost -a 0000:af:00.0 -a 0000:80:04.0 \ + --vdev 'net_vhost0,iface=/tmp/vhost-net,queues=1,dmas=[txq0]' -- -i --no-numa --socket-num=1 --lcore-dma=[lcore32@0000:80:04.0] + testpmd> start + +3. Launch virtio-user with 4K-pages:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 33-34 -n 4 --no-huge -m 1024 --file-prefix=virtio-user --no-pci \ + --vdev=net_virtio_user0,mac=00:11:22:33:44:10,path=/tmp/vhost-net,queues=1 -- -i + testpmd> set fwd mac + testpmd> start + +4. Send packet with packet generator with different packet size,includes [64, 128, 256, 512, 1024, 1518], check the throughput with below command:: + + testpmd> show port stats all + +Test Case 2: Basic test vhost/virtio-user packed ring with 4K-pages and cbdma enable +------------------------------------------------------------------------------------ +This case uses testpmd Traffic Generator(For example, Trex) to test packed ring when vhost uses the asynchronous enqueue operations with CBDMA channels +in 4k-pages environment. And the mapping between vrings and dsa virtual channels is 1:1. + +1. Bind 1 NIC port and 1 CBDMA channel to vfio-pci, as common steps 1. + +2. Launch vhost by below command:: + + ./usertools/dpdk-devbind.py --bind=vfio-pci 0000:af:00.0 0000:80:04.0 + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 31-32 -n 4 --no-huge -m 1024 --file-prefix=vhost -a 0000:af:00.0 -a 0000:80:04.0 \ + --vdev 'net_vhost0,iface=/tmp/vhost-net,queues=1,dmas=[txq0]' -- -i --no-numa --socket-num=1 --lcore-dma=[lcore32@0000:80:04.0] + testpmd> start + +3. Launch virtio-user with 4K-pages:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 33-34 -n 4 --no-huge -m 1024 --file-prefix=virtio-user --no-pci \ + --vdev=net_virtio_user0,mac=00:11:22:33:44:10,path=/tmp/vhost-net,packed_vq=1,queues=1 -- -i + testpmd> set fwd mac + testpmd> start + +4. Send packet with packet generator with different packet size,includes [64, 128, 256, 512, 1024, 1518], check the throughput with below command:: + + testpmd> show port stats all + +Test Case 3: VM2VM split ring vhost-user/virtio-net 4K-pages and CBDMA enable test with tcp traffic +--------------------------------------------------------------------------------------------------- +This case test the function of Vhost tx offload in the topology of vhost-user/virtio-net split ring mergeable path +by verifing the TSO/cksum in the TCP/IP stack when vhost uses the asynchronous enqueue operations with CBDMA channels +in 4k-pages environment. + +1. Bind 2 CBDMA channels to vfio-pci, as common steps 1. + +2. Launch vhost by below command:: + + ./usertools/dpdk-devbind.py --bind=vfio-pci 0000:80:04.0 0000:80:04.1 + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 30-32 -n 4 --no-huge -m 1024 --file-prefix=vhost -a 0000:80:04.0 -a 0000:80:04.1 \ + --vdev 'net_vhost0,iface=vhost-net0,queues=1,dmas=[txq0],dma_ring_size=2048' \ + --vdev 'net_vhost1,iface=vhost-net1,queues=1,dmas=[txq0],dma_ring_size=2048' \ + --iova=va -- -i --nb-cores=2 --txd=1024 --rxd=1024 --lcore-dma=[lcore31@0000:80:04.0,lcore32@0000:80:04.1] + testpmd> start + +3. Launch VM1 and VM2:: + + taskset -c 20,21,22,23,24,25,26,27 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm1 -enable-kvm -cpu host -smp 1 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/tmpfs_nohuge0,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004.img \ + -chardev socket,path=/tmp/vm1_qga0.sock,server,nowait,id=vm1_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm1_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm1_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6000-:22 \ + -chardev socket,id=char0,path=./vhost-net0 \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:01,disable-modern=false,mrg_rxbuf=on,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on -vnc :10 + + taskset -c 48,49,50,51,52,53,54,55 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm2 -enable-kvm -cpu host -smp 1 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/tmpfs_nohuge1,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004_2.img \ + -chardev socket,path=/tmp/vm2_qga0.sock,server,nowait,id=vm2_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm2_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm2_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6001-:22 \ + -chardev socket,id=char0,path=./vhost-net1 \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:02,disable-modern=false,mrg_rxbuf=on,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on -vnc :12 + +4. On VM1, set virtio device IP and run arp protocal:: + + ifconfig ens5 1.1.1.2 + arp -s 1.1.1.8 52:54:00:00:00:02 + +5. On VM2, set virtio device IP and run arp protocal:: + + ifconfig ens5 1.1.1.8 + arp -s 1.1.1.2 52:54:00:00:00:01 + +6. Check the iperf performance between two VMs by below commands:: + + Under VM1, run: `iperf -s -i 1` + Under VM2, run: `iperf -c 1.1.1.2 -i 1 -t 60` + +7. Check 2VMs can receive and send big packets to each other:: + + testpmd> show port xstats all + Port 0 should have tx packets above 1522 + Port 1 should have rx packets above 1522 + +Test Case 4: vm2vm vhost/virtio-net split ring multi queues with 4K-pages and cbdma enable +------------------------------------------------------------------------------------------- +This case uses iperf and scp to test the payload of large packet (larger than 1MB) is valid after packets forwarding in +vm2vm vhost-user/virtio-net split ring mergeable path when vhost uses the asynchronous enqueue operations with CBDMA channel. +The dynamic change of multi-queues number also test. + +1. Bind 16 CBDMA channels to vfio-pci, as common steps 1. + +2. Launch vhost by below command:: + + ./usertools/dpdk-devbind.py --bind=vfio-pci 0000:80:04.0 0000:80:04.1 0000:80:04.2 0000:80:04.3 0000:80:04.4 0000:80:04.5 0000:80:04.6 0000:80:04.7 \ + 0000:00:04.0 0000:00:04.1 0000:00:04.2 0000:00:04.3 0000:00:04.4 0000:00:04.5 0000:00:04.6 0000:00:04.7 + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 29-33 -n 4 --no-huge -m 1024 --file-prefix=vhost \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:00:04.2 -a 0000:00:04.3 -a 0000:00:04.4 -a 0000:00:04.5 -a 0000:00:04.6 -a 0000:00:04.7 \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:80:04.2 -a 0000:80:04.3 -a 0000:80:04.4 -a 0000:80:04.5 -a 0000:80:04.6 -a 0000:80:04.7 \ + --vdev 'net_vhost0,iface=vhost-net0,client=1,queues=8,dmas=[txq0;txq1;txq2;txq3;txq4;txq5;txq6;txq7]' \ + --vdev 'net_vhost1,iface=vhost-net1,client=1,queues=8,dmas=[txq0;txq1;txq2;txq3;txq4;txq5;txq6;txq7]' \ + --iova=va -- -i --nb-cores=4 --txd=1024 --rxd=1024 --rxq=8 --txq=8 \ + --lcore-dma=[lcore30@0000:80:04.0,lcore30@0000:80:04.1,lcore30@0000:00:04.2,lcore30@0000:00:04.3,lcore30@0000:00:04.4,lcore30@0000:00:04.5,lcore31@0000:00:04.6,lcore31@0000:00:04.7,lcore32@0000:80:04.0,lcore32@0000:80:04.1,lcore32@0000:80:04.2,lcore32@0000:80:04.3,lcore32@0000:80:04.4,lcore32@0000:80:04.5,lcore32@0000:80:04.6,lcore33@0000:80:04.7] + + testpmd> start + + +3. Launch VM qemu:: + + taskset -c 20,21,22,23,24,25,26,27 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm1 -enable-kvm -cpu host -smp 8 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/huge,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004.img \ + -chardev socket,path=/tmp/vm1_qga0.sock,server,nowait,id=vm2_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm1_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm1_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6000-:22 \ + -chardev socket,id=char0,path=./vhost-net0,server \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce,queues=8 \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:01,disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on -vnc :10 + + taskset -c 48,49,50,51,52,53,54,55 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm2 -enable-kvm -cpu host -smp 8 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/tmpfs_yinan1,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004_2.img \ + -chardev socket,path=/tmp/vm2_qga0.sock,server,nowait,id=vm2_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm2_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm2_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6001-:22 \ + -chardev socket,id=char0,path=./vhost-net1,server \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce,queues=8 \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:02,disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on -vnc :12 + +4. On VM1, set virtio device IP and run arp protocal:: + + ethtool -L ens5 combined 8 + ifconfig ens5 1.1.1.2 + arp -s 1.1.1.8 52:54:00:00:00:02 + +5. On VM2, set virtio device IP and run arp protocal:: + + ethtool -L ens5 combined 8 + ifconfig ens5 1.1.1.8 + arp -s 1.1.1.2 52:54:00:00:00:01 + +6. Scp 1MB file form VM1 to VM2:: + + Under VM1, run: `scp [xxx] root@1.1.1.8:/` [xxx] is the file name + +7. Check the iperf performance between two VMs by below commands:: + + Under VM1, run: `iperf -s -i 1` + Under VM2, run: `iperf -c 1.1.1.2 -i 1 -t 60` + +8. Quit and relaunch vhost w/ diff CBDMA channels:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 29-33 -n 4 --no-huge -m 1024 --file-prefix=vhost \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:00:04.2 -a 0000:00:04.3 -a 0000:00:04.4 -a 0000:00:04.5 -a 0000:00:04.6 -a 0000:00:04.7 \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:80:04.2 -a 0000:80:04.3 -a 0000:80:04.4 -a 0000:80:04.5 -a 0000:80:04.6 -a 0000:80:04.7 \ + --vdev 'net_vhost0,iface=vhost-net0,client=1,queues=8,dmas=[txq0;txq1;txq2;txq3;txq4;txq5;txq6]' \ + --vdev 'net_vhost1,iface=vhost-net1,client=1,queues=8,dmas=[txq1;txq2;txq3;txq4;txq5;txq6;txq7]' \ + --iova=va -- -i --nb-cores=4 --txd=1024 --rxd=1024 --rxq=8 --txq=8 \ + --lcore-dma=[lcore30@0000:80:04.0,lcore30@0000:80:04.1,lcore30@0000:00:04.2,lcore30@0000:00:04.3,lcore31@0000:80:04.0,lcore31@0000:00:04.2,lcore31@0000:00:04.4,lcore31@0000:00:04.5,lcore31@0000:00:04.6,lcore31@0000:00:04.7,lcore32@0000:80:04.1,lcore32@0000:00:04.3,lcore32@0000:80:04.0,lcore32@0000:80:04.1,lcore32@0000:80:04.2,lcore32@0000:80:04.3,lcore32@0000:80:04.4,lcore32@0000:80:04.5,lcore32@0000:80:04.6,lcore33@0000:80:04.7] + testpmd> start + +9. Rerun step 6-7. + +10. Quit and relaunch vhost w/o CBDMA channels:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 29-33 -n 4 --no-huge -m 1024 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=vhost-net0,client=1,queues=4' --vdev 'net_vhost1,iface=vhost-net1,client=1,queues=4' \ + -- -i --nb-cores=4 --txd=1024 --rxd=1024 --rxq=4 --txq=4 + testpmd> start + +11. On VM1, set virtio device:: + + ethtool -L ens5 combined 4 + +12. On VM2, set virtio device:: + + ethtool -L ens5 combined 4 + +13. Scp 1MB file form VM1 to VM2:: + + Under VM1, run: `scp [xxx] root@1.1.1.8:/` [xxx] is the file name + +14. Check the iperf performance and compare with CBDMA enable performance, ensure CMDMA enable performance is higher:: + + Under VM1, run: `iperf -s -i 1` + Under VM2, run: `iperf -c 1.1.1.2 -i 1 -t 60` + +15. Quit and relaunch vhost with 1 queues:: + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 29-33 -n 4 --no-huge -m 1024 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=vhost-net0,client=1,queues=4' --vdev 'net_vhost1,iface=vhost-net1,client=1,queues=4' \ + -- -i --nb-cores=4 --txd=1024 --rxd=1024 --rxq=1 --txq=1 + testpmd> start + +16. On VM1, set virtio device:: + + ethtool -L ens5 combined 1 + +17. On VM2, set virtio device:: + + ethtool -L ens5 combined 1 + +18. Scp 1MB file form VM1 to VM2M, check packets can be forwarding success by scp:: + + Under VM1, run: `scp [xxx] root@1.1.1.8:/` [xxx] is the file name + +19. Check the iperf performance, ensure queue0 can work from vhost side:: + + Under VM1, run: `iperf -s -i 1` + Under VM2, run: `iperf -c 1.1.1.2 -i 1 -t 60` + +Test Case 5: vm2vm vhost/virtio-net split packed ring multi queues with 1G/4k-pages and cbdma enable +---------------------------------------------------------------------------------------------------- +This case uses iperf and scp to test the payload of large packet (larger than 1MB) is valid after packets forwarding in +vm2vm vhost-user/virtio-net multi-queues mergeable path when vhost uses the asynchronous enqueue operations with CBDMA +channels. And one virtio-net is split ring, the other is packed ring. The vhost run in 1G hugepages and the virtio-user run in 4k-pages environment. + +1. Bind 16 CBDMA channel to vfio-pci, as common steps 1. + +2. Launch vhost by below command:: + + ./usertools/dpdk-devbind.py --bind=vfio-pci 0000:80:04.0 0000:80:04.1 0000:80:04.2 0000:80:04.3 0000:80:04.4 0000:80:04.5 0000:80:04.6 0000:80:04.7 \ + 0000:00:04.0 0000:00:04.1 0000:00:04.2 0000:00:04.3 0000:00:04.4 0000:00:04.5 0000:00:04.6 0000:00:04.7 + + # ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 29-33 -n 4 -m 1024 --file-prefix=vhost \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:00:04.2 -a 0000:00:04.3 -a 0000:00:04.4 -a 0000:00:04.5 -a 0000:00:04.6 -a 0000:00:04.7 \ + -a 0000:80:04.0 -a 0000:80:04.1 -a 0000:80:04.2 -a 0000:80:04.3 -a 0000:80:04.4 -a 0000:80:04.5 -a 0000:80:04.6 -a 0000:80:04.7 \ + --vdev 'net_vhost0,iface=vhost-net0,queues=8,dmas=[txq0;txq1;txq2;txq3;]' \ + --vdev 'net_vhost1,iface=vhost-net1,queues=8,dmas=[txq0;txq1;txq2;txq3;]' \ + --iova=va -- -i --nb-cores=4 --txd=1024 --rxd=1024 --rxq=8 --txq=8 \ + --lcore-dma=[lcore30@0000:80:04.0,lcore30@0000:80:04.1,lcore30@0000:00:04.2,lcore30@0000:00:04.3,lcore31@0000:00:04.4,lcore31@0000:00:04.5,lcore31@0000:00:04.6,lcore31@0000:00:04.7,lcore32@0000:80:04.0,lcore32@0000:80:04.1,lcore32@0000:80:04.2,lcore32@0000:80:04.3,lcore33@0000:80:04.4,lcore33@0000:80:04.5,lcore33@0000:80:04.6,lcore33@0000:80:04.7] + testpmd> start + +3. Launch VM qemu:: + + taskset -c 20,21,22,23,24,25,26,27 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm1 -enable-kvm -cpu host -smp 8 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/tmpfs_nohuge0,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004.img \ + -chardev socket,path=/tmp/vm1_qga0.sock,server,nowait,id=vm1_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm1_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm1_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6000-:22 \ + -chardev socket,id=char0,path=./vhost-net0 \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce,queues=8 \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:01,disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on -vnc :10 + + taskset -c 48,49,50,51,52,53,54,55 /home/QEMU/qemu-6.2.0/bin/qemu-system-x86_64 -name vm2 -enable-kvm -cpu host -smp 8 -m 4096 \ + -object memory-backend-file,id=mem,size=4096M,mem-path=/mnt/tmpfs_nohuge1,share=on \ + -numa node,memdev=mem -mem-prealloc -drive file=/home/image/ubuntu2004_2.img \ + -chardev socket,path=/tmp/vm2_qga0.sock,server,nowait,id=vm2_qga0 -device virtio-serial \ + -device virtserialport,chardev=vm2_qga0,name=org.qemu.guest_agent.2 -daemonize \ + -monitor unix:/tmp/vm2_monitor.sock,server,nowait -device e1000,netdev=nttsip1 \ + -netdev user,id=nttsip1,hostfwd=tcp:10.239.251.220:6001-:22 \ + -chardev socket,id=char0,path=./vhost-net1 \ + -netdev type=vhost-user,id=netdev0,chardev=char0,vhostforce,queues=8 \ + -device virtio-net-pci,netdev=netdev0,mac=52:54:00:00:00:02,disable-modern=false,mrg_rxbuf=on,packed=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on -vnc :12 + +4. On VM1, set virtio device IP and run arp protocal:: + + ethtool -L ens5 combined 8 + ifconfig ens5 1.1.1.2 + arp -s 1.1.1.8 52:54:00:00:00:02 + +5. On VM2, set virtio device IP and run arp protocal:: + + ethtool -L ens5 combined 8 + ifconfig ens5 1.1.1.8 + arp -s 1.1.1.2 52:54:00:00:00:01 + +6. Scp 1MB file form VM1 to VM2:: + + Under VM1, run: `scp [xxx] root@1.1.1.8:/` [xxx] is the file name + +7. Check the iperf performance between two VMs by below commands:: + + Under VM1, run: `iperf -s -i 1` + Under VM2, run: `iperf -c 1.1.1.2 -i 1 -t 60` From patchwork Fri Apr 29 07:02:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 110482 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 50341A0093; Fri, 29 Apr 2022 09:02:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A9184161A; Fri, 29 Apr 2022 09:02:44 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 23D2440E50 for ; Fri, 29 Apr 2022 09:02:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651215763; x=1682751763; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eRCCcqtLeojweDQtA0maiYKahy286HPGfFhfXh+wMZY=; b=GkJs5CNJZuzbwzfh5In/E9aUMps+2+/FjdGOnU3LekB0MLE6zXT+zzT0 mzrZcjnr5hCy91Xv4qDgLL1j4OJuP/44igkHgUMbKb+t/DGvEQxENjjcA QQSW9dLLX7svDiiZTjqna1aGbSd2PV8Lb1gWx5B4yz7vhWvYYco/7d4Ve hXhQpV/J/LrFA2P8kCqO7/Uj2S69HC1czyvUDO9MpeTYukSfb3noo15Mp YF9Y9rbsbLQs/IKF8IedaZoZMDhDa9NLaC+3nRJGuNNFDpgpbZp613I+d MbBJnH/RxW6QZpcrfc/PVQ57WNIrt6J8YPAAPHpiiEu/oYBSYD2ZC8FCU w==; X-IronPort-AV: E=McAfee;i="6400,9594,10331"; a="327049480" X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="327049480" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:41 -0700 X-IronPort-AV: E=Sophos;i="5.91,297,1647327600"; d="scan'208";a="581942804" Received: from unknown (HELO localhost.localdomain) ([10.239.251.222]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 00:02:39 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V2 3/3] tests/basic_4k_pages_cbdma: add basic_4k_pages_cbdma testsuite Date: Fri, 29 Apr 2022 07:02:25 +0000 Message-Id: <20220429070225.19152-1-weix.ling@intel.com> X-Mailer: git-send-email 2.34.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 As commit 53d3f4778c(vhost: integrate dmadev in asynchronous data-path), add new testsuite basic_4k_pages_cbdma for coverage the pvp virtio-user 4k pages with cbdma. 1) Add new testsuite TestSuite_basic_4k_pages_cbdma.py into tests. Signed-off-by: Wei Ling --- tests/TestSuite_basic_4k_pages_cbdma.py | 445 ++++++++++++++++++++++++ 1 file changed, 445 insertions(+) create mode 100644 tests/TestSuite_basic_4k_pages_cbdma.py diff --git a/tests/TestSuite_basic_4k_pages_cbdma.py b/tests/TestSuite_basic_4k_pages_cbdma.py new file mode 100644 index 00000000..e175c3d9 --- /dev/null +++ b/tests/TestSuite_basic_4k_pages_cbdma.py @@ -0,0 +1,445 @@ +# BSD LICENSE +# +# Copyright(c) <2022> Intel Corporation. +# 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/virtio-user pvp with 4K pages. +""" + +import re +import time + +import framework.utils as utils +from framework.packet import Packet +from framework.pktgen import PacketGeneratorHelper +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase +from framework.virt_common import VM + + +class TestBasic4kPagesCbdma(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + """ + self.dut_ports = self.dut.get_ports() + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + self.cores_num = len([n for n in self.dut.cores if int(n["socket"]) == 0]) + self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") + self.verify( + self.cores_num >= 4, + "There has not enought cores to test this suite %s" % self.suite_name, + ) + self.cores_list = self.dut.get_core_list(config="all", socket=self.ports_socket) + self.vhost_core_list = self.cores_list[0:9] + self.virtio0_core_list = self.cores_list[9:11] + self.vhost_user = self.dut.new_session(suite="vhost-user") + self.virtio_user0 = self.dut.new_session(suite="virtio-user") + self.vhost_user_pmd = PmdOutput(self.dut, self.vhost_user) + self.virtio_user0_pmd = PmdOutput(self.dut, self.virtio_user0) + self.pci_info = self.dut.ports_info[0]["pci"] + self.dst_mac = self.dut.get_mac_address(self.dut_ports[0]) + self.frame_sizes = [64, 128, 256, 512, 1024, 1518] + self.out_path = "/tmp/%s" % self.suite_name + out = self.tester.send_expect("ls -d %s" % self.out_path, "# ") + if "No such file or directory" in out: + self.tester.send_expect("mkdir -p %s" % self.out_path, "# ") + # create an instance to set stream field setting + self.pktgen_helper = PacketGeneratorHelper() + self.number_of_ports = 1 + self.app_testpmd_path = self.dut.apps_name["test-pmd"] + self.testpmd_name = self.app_testpmd_path.split("/")[-1] + self.vm_num = 2 + self.virtio_ip1 = "1.1.1.1" + self.virtio_ip2 = "1.1.1.2" + self.virtio_mac1 = "52:54:00:00:00:01" + self.virtio_mac2 = "52:54:00:00:00:02" + self.base_dir = self.dut.base_dir.replace("~", "/root") + + def set_up(self): + """ + Run before each test case. + """ + self.dut.send_expect("rm -rf /tmp/vhost-net*", "# ") + self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "# ") + self.umount_tmpfs_for_4k() + # Prepare the result table + self.table_header = ["Frame"] + self.table_header.append("Mode") + self.table_header.append("Mpps") + self.table_header.append("Queue Num") + self.table_header.append("% linerate") + self.result_table_create(self.table_header) + self.vm_dut = [] + self.vm = [] + + def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num, allow_diff_socket=False): + """ + get and bind cbdma ports into DPDK driver + """ + self.all_cbdma_list = [] + self.cbdma_list = [] + self.cbdma_str = "" + out = self.dut.send_expect( + "./usertools/dpdk-devbind.py --status-dev dma", "# ", 30 + ) + device_info = out.split("\n") + for device in device_info: + pci_info = re.search("\s*(0000:\S*:\d*.\d*)", device) + if pci_info is not None: + dev_info = pci_info.group(1) + # the numa id of ioat dev, only add the device which on same socket with nic dev + bus = int(dev_info[5:7], base=16) + if bus >= 128: + cur_socket = 1 + else: + cur_socket = 0 + if allow_diff_socket: + self.all_cbdma_list.append(pci_info.group(1)) + else: + if self.ports_socket == cur_socket: + self.all_cbdma_list.append(pci_info.group(1)) + self.verify( + len(self.all_cbdma_list) >= cbdma_num, "There no enough cbdma device" + ) + self.cbdma_list = self.all_cbdma_list[0:cbdma_num] + self.cbdma_str = " ".join(self.cbdma_list) + self.dut.send_expect( + "./usertools/dpdk-devbind.py --force --bind=%s %s" + % (self.drivername, self.cbdma_str), + "# ", + 60, + ) + + def bind_cbdma_device_to_kernel(self): + self.dut.send_expect("modprobe ioatdma", "# ") + self.dut.send_expect( + "./usertools/dpdk-devbind.py -u %s" % self.cbdma_str, "# ", 30 + ) + self.dut.send_expect( + "./usertools/dpdk-devbind.py --force --bind=ioatdma %s" % self.cbdma_str, + "# ", + 60, + ) + + def send_and_verify(self): + """ + Send packet with packet generator and verify + """ + for frame_size in self.frame_sizes: + tgen_input = [] + rx_port = self.tester.get_local_port(self.dut_ports[0]) + tx_port = self.tester.get_local_port(self.dut_ports[0]) + pkt = Packet(pkt_type="UDP", pkt_len=frame_size) + pkt.config_layer("ether", {"dst": "%s" % self.dst_mac}) + pkt.save_pcapfile(self.tester, "%s/vhost.pcap" % self.out_path) + tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % self.out_path)) + + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput( + tgen_input, 100, None, self.tester.pktgen + ) + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) + Mpps = pps / 1000000.0 + # self.verify(Mpps > self.check_value[frame_size], + # "%s of frame size %d speed verify failed, expect %s, result %s" % ( + # self.running_case, frame_size, self.check_value[frame_size], Mpps)) + throughput = Mpps * 100 / float(self.wirespeed(self.nic, 64, 1)) + results_row = [frame_size] + results_row.append("4K pages") + results_row.append(Mpps) + results_row.append("1") + results_row.append(throughput) + self.result_table_add(results_row) + + def start_vhost_user_testpmd(self, cores, param="", eal_param="", ports=""): + """ + launch the testpmd as virtio with vhost_user + """ + self.vhost_user_pmd.start_testpmd( + cores=cores, + param=param, + eal_param=eal_param, + ports=ports, + prefix="vhost", + fixed_prefix=True, + ) + + def start_virtio_user0_testpmd(self, cores, eal_param="", param=""): + """ + launch the testpmd as virtio with vhost_net0 + """ + self.virtio_user0_pmd.start_testpmd( + cores=cores, + eal_param=eal_param, + param=param, + no_pci=True, + prefix="virtio-user0", + fixed_prefix=True, + ) + + def start_vms( + self, + setting_args="", + server_mode=False, + opt_queue=None, + vm_config="vhost_sample", + ): + """ + start one VM, each VM has one virtio device + """ + vm_params = {} + if opt_queue is not None: + vm_params["opt_queue"] = opt_queue + + for i in range(self.vm_num): + vm_dut = None + vm_info = VM(self.dut, "vm%d" % i, vm_config) + + vm_params["driver"] = "vhost-user" + if not server_mode: + vm_params["opt_path"] = self.base_dir + "/vhost-net%d" % i + else: + vm_params["opt_path"] = self.base_dir + "/vhost-net%d" % i + ",server" + vm_params["opt_mac"] = "52:54:00:00:00:0%d" % (i + 1) + vm_params["opt_settings"] = setting_args + vm_info.set_vm_device(**vm_params) + time.sleep(3) + 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)))) + raise e + self.vm_dut.append(vm_dut) + self.vm.append(vm_info) + + def config_vm_ip(self): + """ + set virtio device IP and run arp protocal + """ + vm1_intf = self.vm_dut[0].ports_info[0]["intf"] + vm2_intf = self.vm_dut[1].ports_info[0]["intf"] + self.vm_dut[0].send_expect( + "ifconfig %s %s" % (vm1_intf, self.virtio_ip1), "#", 10 + ) + self.vm_dut[1].send_expect( + "ifconfig %s %s" % (vm2_intf, self.virtio_ip2), "#", 10 + ) + self.vm_dut[0].send_expect( + "arp -s %s %s" % (self.virtio_ip2, self.virtio_mac2), "#", 10 + ) + self.vm_dut[1].send_expect( + "arp -s %s %s" % (self.virtio_ip1, self.virtio_mac1), "#", 10 + ) + + def config_vm_combined(self, combined=1): + """ + set virtio device combined + """ + vm1_intf = self.vm_dut[0].ports_info[0]["intf"] + vm2_intf = self.vm_dut[1].ports_info[0]["intf"] + self.vm_dut[0].send_expect( + "ethtool -L %s combined %d" % (vm1_intf, combined), "#", 10 + ) + self.vm_dut[1].send_expect( + "ethtool -L %s combined %d" % (vm2_intf, combined), "#", 10 + ) + + def start_iperf(self): + """ + run perf command between to vms + """ + iperf_server = "iperf -s -i 1" + iperf_client = "iperf -c {} -i 1 -t 60".format(self.virtio_ip1) + self.vm_dut[0].send_expect( + "{} > iperf_server.log &".format(iperf_server), "", 10 + ) + self.vm_dut[1].send_expect( + "{} > iperf_client.log &".format(iperf_client), "", 60 + ) + time.sleep(60) + + def get_iperf_result(self): + """ + get the iperf test result + """ + self.table_header = ["Mode", "[M|G]bits/sec"] + self.result_table_create(self.table_header) + self.vm_dut[0].send_expect("pkill iperf", "# ") + self.vm_dut[1].session.copy_file_from("%s/iperf_client.log" % self.dut.base_dir) + fp = open("./iperf_client.log") + fmsg = fp.read() + fp.close() + # remove the server report info from msg + index = fmsg.find("Server Report") + if index != -1: + fmsg = fmsg[:index] + iperfdata = re.compile("\S*\s*[M|G]bits/sec").findall(fmsg) + # the last data of iperf is the ave data from 0-30 sec + self.verify(len(iperfdata) != 0, "The iperf data between to vms is 0") + self.logger.info("The iperf data between vms is %s" % iperfdata[-1]) + + # put the result to table + results_row = ["vm2vm", iperfdata[-1]] + self.result_table_add(results_row) + + # print iperf resut + self.result_table_print() + # rm the iperf log file in vm + self.vm_dut[0].send_expect("rm iperf_server.log", "#", 10) + self.vm_dut[1].send_expect("rm iperf_client.log", "#", 10) + + def verify_xstats_info_on_vhost(self): + """ + check both 2VMs can receive and send big packets to each other + """ + self.vhost_user_pmd.execute_cmd("show port stats all") + out_tx = self.vhost_user_pmd.execute_cmd("show port xstats 0") + out_rx = self.vhost_user_pmd.execute_cmd("show port xstats 1") + + tx_info = re.search("tx_size_1523_to_max_packets:\s*(\d*)", out_tx) + rx_info = re.search("rx_size_1523_to_max_packets:\s*(\d*)", out_rx) + + self.verify( + int(rx_info.group(1)) > 0, "Port 1 not receive packet greater than 1522" + ) + self.verify( + int(tx_info.group(1)) > 0, "Port 0 not forward packet greater than 1522" + ) + + def mount_tmpfs_for_4k(self, number=1): + """ + Prepare tmpfs with 4K-pages + """ + for num in range(number): + self.dut.send_expect("mkdir /mnt/tmpfs_nohuge{}".format(num), "# ") + self.dut.send_expect( + "mount tmpfs /mnt/tmpfs_nohuge{} -t tmpfs -o size=4G".format(num), "# " + ) + + def umount_tmpfs_for_4k(self): + """ + Prepare tmpfs with 4K-pages + """ + out = self.dut.send_expect( + "mount |grep 'mnt/tmpfs' |awk -F ' ' {'print $3'}", "#" + ) + mount_infos = out.replace("\r", "").split("\n") + if len(mount_infos) != 0: + for mount_info in mount_infos: + self.dut.send_expect("umount {}".format(mount_info), "# ") + + def umount_huge_pages(self): + self.dut.send_expect("mount |grep '/mnt/huge' |awk -F ' ' {'print $3'}", "#") + self.dut.send_expect("umount /mnt/huge", "# ") + + def mount_huge_pages(self): + self.dut.send_expect("mkdir -p /mnt/huge", "# ") + self.dut.send_expect("mount -t hugetlbfs nodev /mnt/huge", "# ") + + def test_perf_pvp_virtio_user_split_ring_with_4K_pages_and_cbdma_enable(self): + """ + Test Case 1: Basic test vhost/virtio-user split ring with 4K-pages and cbdma enable + """ + self.get_cbdma_ports_info_and_bind_to_dpdk(1) + lcore_dma = f"lcore{self.vhost_core_list[1]}@{self.cbdma_list[0]}" + vhost_eal_param = "--no-huge -m 1024 --vdev 'net_vhost0,iface=./vhost-net,queues=1,dmas=[txq0]'" + vhost_param = " --no-numa --socket-num={} --lcore-dma=[{}]".format( + self.ports_socket, lcore_dma + ) + ports = [self.dut.ports_info[0]["pci"]] + for i in self.cbdma_list: + ports.append(i) + self.start_vhost_user_testpmd( + cores=self.vhost_core_list[0:2], + eal_param=vhost_eal_param, + param=vhost_param, + ports=ports, + ) + self.vhost_user_pmd.execute_cmd("start") + self.mount_tmpfs_for_4k(number=1) + virtio_eal_param = "--no-huge -m 1024 --vdev net_virtio_user0,mac=00:11:22:33:44:10,path=./vhost-net,queues=1" + self.start_virtio_user0_testpmd( + cores=self.virtio0_core_list, eal_param=virtio_eal_param + ) + self.virtio_user0_pmd.execute_cmd("set fwd mac") + self.virtio_user0_pmd.execute_cmd("start") + self.send_and_verify() + self.result_table_print() + + def test_perf_pvp_virtio_user_packed_ring_with_4K_pages_and_cbdma_enable(self): + """ + Test Case 2: Basic test vhost/virtio-user packed ring with 4K-pages and cbdma enable + """ + self.get_cbdma_ports_info_and_bind_to_dpdk(1) + lcore_dma = f"lcore{self.vhost_core_list[1]}@{self.cbdma_list[0]}" + vhost_eal_param = "--no-huge -m 1024 --vdev 'net_vhost0,iface=./vhost-net,queues=1,dmas=[txq0]'" + vhost_param = " --no-numa --socket-num={} --lcore-dma=[{}]".format( + self.ports_socket, lcore_dma + ) + ports = [self.dut.ports_info[0]["pci"]] + for i in self.cbdma_list: + ports.append(i) + self.start_vhost_user_testpmd( + cores=self.vhost_core_list[0:2], + eal_param=vhost_eal_param, + param=vhost_param, + ports=ports, + ) + self.vhost_user_pmd.execute_cmd("start") + self.mount_tmpfs_for_4k(number=1) + virtio_eal_param = "--no-huge -m 1024 --vdev net_virtio_user0,mac=00:11:22:33:44:10,path=./vhost-net,packed_vq=1,queues=1" + self.start_virtio_user0_testpmd( + cores=self.virtio0_core_list, eal_param=virtio_eal_param + ) + self.virtio_user0_pmd.execute_cmd("set fwd mac") + self.virtio_user0_pmd.execute_cmd("start") + self.send_and_verify() + self.result_table_print() + + def tear_down(self): + """ + Run after each test case. + """ + self.virtio_user0_pmd.quit() + self.vhost_user_pmd.quit() + self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "# ") + self.bind_cbdma_device_to_kernel() + self.umount_tmpfs_for_4k() + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.close_session(self.vhost_user) + self.dut.close_session(self.virtio_user0)