From patchwork Fri Nov 18 09:54: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: 119966 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 B2D3EA0542; Fri, 18 Nov 2022 10:59:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC9B342D13; Fri, 18 Nov 2022 10:59:30 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 5B9A141181 for ; Fri, 18 Nov 2022 10:59:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668765569; x=1700301569; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=f/J2IAgdaIPmpfXRo/uYfI+kMQbVny+04+lKaQcCK9c=; b=ZwB7MQWtiTzzjQV8xeMd+izgUazEUZEJCR68NmgpGncLXc6qikxmSVXx FYDqeMszqLKZM8cGvk21rdCTE+9KdPcuo6Vq8OZLeBdP5AODbzKjJu/Yz t9v2aQsfw6o3oTpU622J+6xJazymUmEEnmIZ27vf4ilmXeVgQ+WTFBRg1 Z13eOV4cUDR/+H3ZY+xc2V2gLLSzm40oGJiYEAOtn8/MuvkAf6HcO7As+ XzyCiMUNdefy/tm7x4zuJnwDS9m5tDRL20dGETx164ht/2F8FxNpkTI7l EXMC1P4c3wbo/9aw9aPGIKiMkmNRtN7Mi0dB1f1VzitTd64S0D2ggPC8l Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="310733379" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="310733379" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="708980187" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="708980187" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:26 -0800 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 1/3] test_plans/index: add vhost_virtio_user_interrupt_with_power_monitor_test_plan Date: Fri, 18 Nov 2022 17:54:13 +0800 Message-Id: <20221118095413.635778-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 vhost_virtio_user_interrupt_with_power_monitor_test_plan into 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 570e1c35..373eff3e 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -210,6 +210,7 @@ The following are the test plans for the DPDK DTS automated test system. vhost_virtio_pmd_interrupt_cbdma_test_plan vhost_virtio_user_interrupt_test_plan vhost_virtio_user_interrupt_cbdma_test_plan + vhost_virtio_user_interrupt_with_power_monitor_test_plan virtio_event_idx_interrupt_test_plan virtio_event_idx_interrupt_cbdma_test_plan virtio_ipsec_cryptodev_func_test_plan From patchwork Fri Nov 18 09:54:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 119967 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 D0BABA0542; Fri, 18 Nov 2022 10:59:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC07942D18; Fri, 18 Nov 2022 10:59:39 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 5A13241181 for ; Fri, 18 Nov 2022 10:59:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668765578; x=1700301578; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hN5g6nsEGQ86/AF3rsMsxytFwggzqE4sPEXzH3nsnQw=; b=JzzSGYa2Ziv8woX/0V91bCKMDOodw2pz6U0dnmCFDFXA+bQf2gyKITVn 4fNink7fg8RKVnQjKPvvYFRFCWCNjt9axoKfqAN+MsFPYQs3SkRsus3QY 3ZKPLh5i2xPj5kW6/IzMLzcNPy+K7NAkC9pduD5B2mtBE1Jpf0/oJKHRs Yq/T/7H4wzITnMHV/XtSJjWOeJhCGh3sId70kBTlJWWa1/iASE4bEsw1r Gb2HRoFKcPyo/KKTggWepQk/Jfxqec7oLUbahjTJ5LyUAvGvd9DOLVWm1 Kd0zuo8lb7kuMDAOKub/oapBwdpVq1JfqEkcPpy3GOq5S3NgCR6XcfT4H g==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="311806237" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="311806237" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="708980222" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="708980222" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:36 -0800 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 2/3] test_plans/vhost_virtio_user_interrupt_with_power_monitor_test_plan: add new testplan Date: Fri, 18 Nov 2022 17:54:22 +0800 Message-Id: <20221118095422.635845-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 testplan for testing vhost_user and virtio_user interrupt with power monitor mode. Signed-off-by: Wei Ling --- ...interrupt_with_power_monitor_test_plan.rst | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 test_plans/vhost_virtio_user_interrupt_with_power_monitor_test_plan.rst diff --git a/test_plans/vhost_virtio_user_interrupt_with_power_monitor_test_plan.rst b/test_plans/vhost_virtio_user_interrupt_with_power_monitor_test_plan.rst new file mode 100644 index 00000000..f55555da --- /dev/null +++ b/test_plans/vhost_virtio_user_interrupt_with_power_monitor_test_plan.rst @@ -0,0 +1,225 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2022 Intel Corporation + +======================================================================= +Vhost_user virtio_user interrupt test with power monitor mode test plan +======================================================================= + +Description +=========== + +According to current semantics of power monitor. When no packet come in, the running core will sleep. Once +packets arrive, the value of address will be changed and the running core will wakeup. +This document provides the test plan for testing vhost_user and virtio_user interrupt with power monitor mode. + +Prerequisites +============== +multi-queue per core need enable RTM(Restricted Transactional Memory) in bios + +General set up +-------------- +1. Compile DPDK:: + + meson -Dexamples=l3fwd-power x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc + +Test case +========= + +Test Case 1: Split ring virtio-user interrupt test with vhost-user as backed +---------------------------------------------------------------------------- + +1. Bind NIC port to vfio-pci. + +2. Launch vhost with testpmd:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=./vhost-net,queues=1' -- -i --rxq=1 --txq=1 + testpmd>start + +3. Launch virtio with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 3-4 -n 4 --no-pci --file-prefix=l3fwd-power \ + --vdev=virtio_user0,path=./vhost-net --log-level='user1,7' -- -p 1 --config="(0,0,4)" --parse-ptype --pmd-mgmt=monitor + +4. Sent imix packets from TG, check packets can forward back from vhost log:: + + testpmd>show port stats all + +5. Stop and start vhost, check packets can forward back again. + +Test Case 2: Split ring multi-queues virtio-user interrupt test with vhost-user as backed +----------------------------------------------------------------------------------------- + +1. Bind NIC port to vfio-pci. + +2. Launch vhost testpmd with 2queues:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=./vhost-net,queues=2' -- -i --rxq=2 --txq=2 + testpmd>start + +3. Launch virtio with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 3-4 -n 4 --no-pci --file-prefix=l3fwd-power \ + --vdev=virtio_user0,path=./vhost-net,queues=2 --log-level='user1,7' -- -p 1 --config="(0,0,3),(0,1,4)" --parse-ptype --pmd-mgmt=monitor + +4. Sent imix pkts from TG,check packets can fwd back and both 2 queues exist packets:: + + testpmd>show port stats all + testpmd>stop + +5. Restart vhost port, check packets can forward back and both 2 queues exist packets. + +Test Case 3:Wake up split ring vhost-user core with l3fwd-power sample +---------------------------------------------------------------------- + +1. bind nic port to vfio-pci + +2. Launch virtio-user with server mode:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 2-3 -n 4 --file-prefix=virtio-user \ + --vdev net_virtio_user0,path=./vhost-net,server=1 -- -i --rxq=1 --txq=1 + +3. Launch vhost with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 4-5 --file-prefix=vhost --no-pci \ + --vdev net_vhost0,iface=vhost-net,client=1 -- -p 0x01 --config="(0,0,4)" --pmd-mgmt=monitor --parse-ptype + +4. Start virtio-user:: + + testpmd>start + +5. Sent imix packets from TG, check packets can fwd back with correct payload. + +6. Stop and start virtio-user, check packets can forward back again. + +Test Case 4:Wake up split ring multi-queues vhost-user core with l3fwd-power sample +----------------------------------------------------------------------------------- + +Prerequisites +-------------- +multi-queue per core need enable RTM(Restricted Transactional Memory) in bios + +Flow:TG-->nic-->virtio-user-->vhost-user + +1. Bind NIC port to vfio-pci + +2. Launch virtio-user with server mode:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 2-3 -n 4 --file-prefix=virtio-user \ + --vdev net_virtio_user0,path=./vhost-net,queues=2,server=1 -- -i --rxq=2 --txq=2 + +3. Launch vhost with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 4-5 --file-prefix=vhost --no-pci \ + --vdev net_vhost0,iface=vhost-net,queues=2,client=1 -- -p 0x01 --config="(0,0,4),(0,1,5)" --pmd-mgmt=monitor --parse-ptype + +4. Start virtio-user:: + + testpmd>start + +5. Sent imix pkts from TG,check packets can fwd back and both 2 queues exist packets:: + + testpmd>show port stats all + testpmd>stop + +6. Restart virtio-user port, check packets can fwd back and both 2 queues exist packets. + +Test Case 5: Packed ring virtio-user interrupt test with vhost-user as backed +----------------------------------------------------------------------------- + +1. Bind NIC port to vfio-pci. + +2. Launch vhost with testpmd:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=./vhost-net,queues=1' -- -i --rxq=1 --txq=1 + testpmd>start + +3. Launch virtio with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 3-4 -n 4 --no-pci --file-prefix=l3fwd-power \ + --vdev=virtio_user0,path=./vhost-net,packed_vq=1 --log-level='user1,7' -- -p 1 --config="(0,0,3)" --parse-ptype --pmd-mgmt=monitor + +4. Sent imix pkts from TG, check packets can fwd back. + +5. Stop and start vhost, check packets can fwd back again. + +Test Case 6: Packed ring multi-queues virtio-user interrupt test with vhost-user as backed +------------------------------------------------------------------------------------------ + +Prerequisites +-------------- +multi-queue per core need enable RTM(Restricted Transactional Memory) in bios +1. Bind NIC port to vfio-pci. + +2. Launch vhost with testpmd:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 --file-prefix=vhost \ + --vdev 'net_vhost0,iface=./vhost-net,queues=2' -- -i --rxq=2 --txq=2 + testpmd>start + +3. Launch virtio with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 3-4 -n 4 --no-pci --file-prefix=l3fwd-power \ + --vdev=virtio_user0,path=./vhost-net,queues=2,packed_vq=1 --log-level='user1,7' -- -p 1 --config="(0,0,3),(0,1,4)" --parse-ptype --pmd-mgmt=monitor + +4. Sent imix pkts from TG, check packets can fwd back and both 2 queues exist packets:: + + testpmd>show port stats all + testpmd>stop + +5. Restart vhost port, check packets can fwd back and both 2 queues exist packets. + +Test Case 7:Wake up packed ring vhost-user core with l3fwd-power sample +----------------------------------------------------------------------- + +1. Bind NIC port to vfio-pci + +2.Launch virtio-user with server mode:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 2-3 -n 4 --file-prefix=virtio-user \ + --vdev net_virtio_user0,path=./vhost-net,packed_vq=1,server=1 -- -i --rxq=1 --txq=1 + +3.Launch vhost with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 4-5 --file-prefix=vhost --no-pci \ + --vdev net_vhost0,iface=vhost-net,client=1 -- -p 0x01 --config="(0,0,4)" --pmd-mgmt=monitor --parse-ptype + +4. Start virtio-user:: + + testpmd>start + +5. Sent imix pkts from TG, check packets can fwd back. + +6. Stop and start virtio-user, check packets can forward back again. + +Test Case 8:Wake up packed ring multi-queues vhost-user core with l3fwd-power sample +------------------------------------------------------------------------------------ + +Prerequisites +-------------- +multi-queue per core need enable RTM(Restricted Transactional Memory) in bios +1. Bind NIC port to vfio-pci + +2. Launch virtio-user with server mode:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 2-3 -n 4 --file-prefix=virtio-user \ + --vdev net_virtio_user0,path=./vhost-net,queues=2,packed_vq=1,server=1 -- -i --rxq=2 --txq=2 + +3. Launch vhost with l3fwd-power:: + + ./x86_64-native-linuxapp-gcc/examples/dpdk-l3fwd-power -l 4-5 --file-prefix=vhost --no-pci \ + --vdev net_vhost0,iface=vhost-net,queues=2,client=1 -- -p 0x01 --config="(0,0,4),(0,1,5)" --pmd-mgmt=monitor --parse-ptype + +4. Start virtio-user:: + + testpmd>start + +5. Sent imix pkts from T, check packets can fwd back and both 2 queues exist packets:: + + testpmd>show port stats all + testpmd>stop + +6. Restart virtio-user port, check packets can fwd back and both 2 queues exist packets. From patchwork Fri Nov 18 09:54:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 119968 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 F2665A0542; Fri, 18 Nov 2022 10:59:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECD5942D27; Fri, 18 Nov 2022 10:59:48 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 855FE41181 for ; Fri, 18 Nov 2022 10:59:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668765587; x=1700301587; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jIHSLwqe+1o0zH6lTXsU/rxMJaG8i3rUfCPBKjXAoIg=; b=VE3oTSjKjqEt6mFI5YxagonyectrNIi98J9sIcIqJc8yxU2dWShypdmg C2AcJa/aBL1tcAnj50kfac+vIJUl/9qwkOOorvZ4U4Nzxz+qZuQKoM+91 T/1YrGjs77qPYwLib3gEaPf/f5LOzdTgPV2Kes+Bz4Nw2Nir6pOex3r4c OvwAOTsd017DkeHdrHfEi4lXzGNVrihvZUAHoMa+u9tCrSA70zbVlg2jI fFsGoM0NQo2Qq1MFFqoZd5ouWYqDq9CFu/GtwbuKZ97ghxXerfJK9Y4WV tg9M71Z2VNjqBzCBKriMfa/b9ZzRnQ4AOadM6jcbK9GqESwXow+ceUSz7 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="292803683" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="292803683" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="708980244" X-IronPort-AV: E=Sophos;i="5.96,173,1665471600"; d="scan'208";a="708980244" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 01:59:45 -0800 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 3/3] tests/vhost_virtio_user_interrupt_with_power_monitor: add new testsuite Date: Fri, 18 Nov 2022 17:54:31 +0800 Message-Id: <20221118095431.635923-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 testsuite for testing vhost_user and virtio_user interrupt with power monitor mode. Signed-off-by: Wei Ling Acked-by: Xingguang He Tested-by: Dukai Yuan --- ...irtio_user_interrupt_with_power_monitor.py | 499 ++++++++++++++++++ 1 file changed, 499 insertions(+) create mode 100644 tests/TestSuite_vhost_virtio_user_interrupt_with_power_monitor.py diff --git a/tests/TestSuite_vhost_virtio_user_interrupt_with_power_monitor.py b/tests/TestSuite_vhost_virtio_user_interrupt_with_power_monitor.py new file mode 100644 index 00000000..e56d8b61 --- /dev/null +++ b/tests/TestSuite_vhost_virtio_user_interrupt_with_power_monitor.py @@ -0,0 +1,499 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation +# + +""" +DPDK Test suite. +Virtio-user interrupt need test with l3fwd-power sample +""" + +import re +import time + +import framework.rst as rst +import framework.utils as utils +from framework.packet import Packet +from framework.pktgen import PacketGeneratorHelper +from framework.pmd_output import PmdOutput +from framework.settings import HEADER_SIZE, UPDATE_EXPECTED, load_global_setting +from framework.test_case import TestCase + + +class TestVirtioUserInterruptDsa(TestCase): + def set_up_all(self): + """ + run at the start of each test suite. + """ + self.core_config = "1S/4C/1T" + 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 case" + ) + self.core_list = self.dut.get_core_list( + self.core_config, socket=self.ports_socket + ) + self.core_list_vhost = self.core_list[0:2] + self.core_list_l3fwd = self.core_list[2:4] + self.core_mask_vhost = utils.create_mask(self.core_list_vhost) + self.core_mask_l3fwd = utils.create_mask(self.core_list_l3fwd) + self.core_mask_virtio = self.core_mask_l3fwd + self.pci_info = self.dut.ports_info[0]["pci"] + self.prepare_l3fwd_power() + self.app_l3fwd_power_path = self.dut.apps_name["l3fwd-power"] + self.app_testpmd_path = self.dut.apps_name["test-pmd"] + self.testpmd_name = self.app_testpmd_path.split("/")[-1] + self.l3fwdpower_name = self.app_l3fwd_power_path.split("/")[-1] + self.vhost_user = self.dut.new_session(suite="vhost-user") + self.vhost_user_pmd = PmdOutput(self.dut, self.vhost_user) + self.virtio_user = self.dut.new_session(suite="virtio-user") + self.virtio_user_pmd = PmdOutput(self.dut, self.virtio_user) + self.l3fwd = self.dut.new_session(suite="l3fwd") + self.headers_size = HEADER_SIZE["eth"] + HEADER_SIZE["ip"] + 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, "# ") + self.pktgen_helper = PacketGeneratorHelper() + + def set_up(self): + """ + run before each test case. + """ + self.table_header = ["Frame Size(Byte)", "Mode", "Throughput(Mpps)"] + self.result_table_create(self.table_header) + + self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#") + self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#") + self.dut.send_expect("rm -rf vhost-net*", "#") + + def close_all_session(self): + self.dut.close_session(self.vhost_user) + self.dut.close_session(self.virtio_user) + self.dut.close_session(self.l3fwd) + + def prepare_l3fwd_power(self): + out = self.dut.build_dpdk_apps("./examples/l3fwd-power") + self.verify("Error" not in out, "compilation l3fwd-power error") + + @property + def check_2M_env(self): + out = self.dut.send_expect( + "cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# " + ) + return True if out == "2048" else False + + def launch_l3fwd_power(self, path, queues=1, packed=False, vhost=False): + example_para = "./%s " % self.app_l3fwd_power_path + if not vhost: + if not packed: + vdev = "virtio_user0,path=%s,cq=1,queues=%d" % (path, queues) + else: + vdev = "virtio_user0,path=%s,cq=1,packed_vq=1,queues=%d" % ( + path, + queues, + ) + else: + vdev = "net_vhost0,iface=%s,queues=%d,client=1" % (path, queues) + eal_params = self.dut.create_eal_parameters( + cores=self.core_list_l3fwd, prefix="l3fwd-pwd", no_pci=True, vdevs=[vdev] + ) + if self.check_2M_env: + eal_params += " --single-file-segments" + + config_info = "" + for queue in range(queues): + if config_info != "": + config_info += "," + config_info += "(%d,%d,%s)" % (0, queue, self.core_list_l3fwd[queue]) + para = " --config='%s' --parse-ptype --pmd-mgmt=monitor" % config_info + cmd_l3fwd = example_para + eal_params + " --log-level='user1,7' -- -p 1 " + para + self.l3fwd.get_session_before(timeout=2) + self.l3fwd.send_expect(cmd_l3fwd, "POWER", 40) + time.sleep(10) + out = self.l3fwd.get_session_before() + if "Error" in out and "Error opening" not in out: + self.logger.error("Launch l3fwd-power sample error") + else: + self.logger.info("Launch l3fwd-power sample finished") + + def launch_virtio_user(self, path="./vhost-net", queues=1, packed=False): + """ + launch virtio-user with server mode + """ + vdev = ( + "net_virtio_user0,path=%s,server=1,queues=%d" % (path, queues) + if not packed + else "net_virtio_user0,path=%s,server=1,queues=%d,packed_vq=1" + % (path, queues) + ) + core_list_virtio = self.core_list_vhost + eal_params = self.dut.create_eal_parameters( + cores=core_list_virtio, + prefix="virtio", + no_pci=False, + ports=[self.pci_info], + vdevs=[vdev], + ) + if self.check_2M_env: + eal_params += " --single-file-segments" + para = " -- -i --rxq=%d --txq=%d --rss-ip" % (queues, queues) + command_line_client = self.app_testpmd_path + " " + eal_params + para + self.virtio_user.send_expect( + command_line_client, "waiting for client connection...", 120 + ) + + def get_vhost_port_num(self): + out = self.vhost_user.send_expect("show port summary all", "testpmd> ", 60) + port_num = re.search("Number of available ports:\s*(\d*)", out) + return int(port_num.group(1)) + + def get_virtio_port_num(self): + out = self.virtio_user.send_expect("show port summary all", "testpmd> ", 60) + port_num = re.search("Number of available ports:\s*(\d*)", out) + return int(port_num.group(1)) + + def check_each_queue_of_port_packets(self, queues, vhost=True): + """ + check each queue of each port has receive packets + """ + if vhost: + out = self.vhost_user_pmd.execute_cmd("stop") + port_num = self.get_vhost_port_num() + else: + out = self.virtio_user_pmd.execute_cmd("stop") + port_num = self.get_virtio_port_num() + for port in range(port_num): + for queue in range(queues): + if queue > 0: + reg = "Port= %d/Queue= %d" % (port, queue) + else: + reg = "Forward statistics for port %d" % port + index = out.find(reg) + rx = re.search("RX-packets:\s*(\d*)", out[index:]) + tx = re.search("TX-packets:\s*(\d*)", out[index:]) + rx_packets = int(rx.group(1)) + tx_packets = int(tx.group(1)) + self.verify( + rx_packets > 0 and tx_packets > 0, + "The port %d/queue %d rx-packets or tx-packets is 0 about " + % (port, queue) + + "rx-packets: %d, tx-packets: %d" % (rx_packets, tx_packets), + ) + + def send_imix_packets(self): + """ + Send imix packet with packet generator and verify + """ + test_result = {} + frame_sizes = [64, 128, 256, 512, 1024, 1518] + tgenInput = [] + for frame_size in frame_sizes: + payload_size = frame_size - self.headers_size + port = self.tester.get_local_port(self.dut_ports[0]) + + fields_config = { + "ip": { + "src": {"action": "random"}, + }, + } + pkt = Packet() + pkt.assign_layers(["ether", "ipv4", "raw"]) + pkt.config_layers( + [ + ("ether", {"dst": "52:54:00:00:00:01"}), + ("ipv4", {"src": "1.1.1.1"}), + ("raw", {"payload": ["01"] * int("%d" % payload_size)}), + ] + ) + pkt.save_pcapfile( + self.tester, + "%s/multiqueuerandomip_%s.pcap" % (self.out_path, frame_size), + ) + tgenInput.append( + ( + port, + port, + "%s/multiqueuerandomip_%s.pcap" % (self.out_path, frame_size), + ) + ) + + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput( + tgenInput, 100, fields_config, self.tester.pktgen + ) + trans_options = {"delay": 5, "duration": 10} + bps, pps = self.tester.pktgen.measure_throughput( + stream_ids=streams, options=trans_options + ) + Mpps = pps / 1000000.0 + Mbps = bps / 1000000.0 + self.verify( + Mbps > 0, + f"{self.running_case} can not receive packets of frame size {frame_sizes}", + ) + test_result["imix"] = Mpps + return test_result + + def test_perf_split_ring_virtio_user_interrupt_test_with_vhost_user_as_backend( + self, + ): + """ + Test Case 1: Split ring virtio-user interrupt test with vhost-user as backend + """ + perf_result = [] + vhost_param = "--rxq=1 --txq=1" + vhost_eal_param = "--vdev 'net_vhost0,iface=vhost-net,queues=1'" + ports = [self.dut.ports_info[0]["pci"]] + self.logger.info(ports) + self.vhost_user_pmd.start_testpmd( + cores=self.core_list_vhost, + ports=ports, + prefix="vhost", + eal_param=vhost_eal_param, + param=vhost_param, + ) + self.vhost_user_pmd.execute_cmd("start") + self.launch_l3fwd_power(path="./vhost-net") + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1) + + self.logger.info("Stop and restart vhost port") + self.vhost_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-launch vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-launch vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_split_ring_multi_queues_virtio_user_interrupt_test_with_vhost_user_as_backend( + self, + ): + """ + Test Case 2: Split ring multi-queues virtio-user interrupt test with vhost-user as backend + """ + perf_result = [] + vhost_param = "--rxq=2 --txq=2" + vhost_eal_param = "--vdev 'net_vhost0,iface=vhost-net,queues=2'" + ports = [self.dut.ports_info[0]["pci"]] + self.logger.info(ports) + self.vhost_user_pmd.start_testpmd( + cores=self.core_list_vhost, + ports=ports, + prefix="vhost", + eal_param=vhost_eal_param, + param=vhost_param, + ) + self.vhost_user_pmd.execute_cmd("start") + self.launch_l3fwd_power(path="./vhost-net", queues=2) + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2) + + self.logger.info("Stop and restart vhost port") + self.vhost_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_wake_up_split_ring_vhost_user_core_with_l3fwd_power_sample( + self, + ): + """ + Test Case 3:Wake up split ring vhost-user core with l3fwd-power sample + """ + perf_result = [] + self.launch_virtio_user(path="./vhost-net") + self.launch_l3fwd_power(path="./vhost-net", vhost=True) + self.virtio_user_pmd.execute_cmd("start") + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1, vhost=False) + + self.logger.info("Stop and restart virtio-user") + self.virtio_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1, vhost=False) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_wake_up_split_ring_multi_queues_vhost_user_core_with_l3fwd_power_sample( + self, + ): + """ + Test Case 4:Wake up split ring multi-queues vhost-user core with l3fwd-power sample + """ + perf_result = [] + self.launch_virtio_user(queues=2, path="./vhost-net") + self.launch_l3fwd_power(queues=2, path="./vhost-net", vhost=True) + self.virtio_user_pmd.execute_cmd("start") + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2, vhost=False) + + self.logger.info("Stop and restart virtio-user") + self.virtio_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2, vhost=False) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_packed_ring_virtio_user_interrupt_test_with_vhost_user_as_backend( + self, + ): + """ + Test Case 5: Packed ring virtio-user interrupt test with vhost-user as backend + """ + perf_result = [] + vhost_param = "--rxq=1 --txq=1" + vhost_eal_param = "--vdev 'net_vhost0,iface=vhost-net,queues=1'" + ports = [self.dut.ports_info[0]["pci"]] + self.logger.info(ports) + self.vhost_user_pmd.start_testpmd( + cores=self.core_list_vhost, + ports=ports, + prefix="vhost", + eal_param=vhost_eal_param, + param=vhost_param, + ) + self.vhost_user_pmd.execute_cmd("start") + self.launch_l3fwd_power(path="./vhost-net", packed=True) + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1) + + self.logger.info("Stop and restart vhost port") + self.vhost_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-launch vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-launch vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_packed_ring_multi_queues_virtio_user_interrupt_test_with_vhost_user_as_backend( + self, + ): + """ + Test Case 6: Packed ring multi-queues virtio-user interrupt test with vhost-user as backend + """ + perf_result = [] + vhost_param = "--rxq=2 --txq=2" + vhost_eal_param = "--vdev 'net_vhost0,iface=vhost-net,queues=2'" + ports = [self.dut.ports_info[0]["pci"]] + self.logger.info(ports) + self.vhost_user_pmd.start_testpmd( + cores=self.core_list_vhost, + ports=ports, + prefix="vhost", + eal_param=vhost_eal_param, + param=vhost_param, + ) + self.vhost_user_pmd.execute_cmd("start") + self.launch_l3fwd_power(path="./vhost-net", queues=2, packed=True) + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2) + + self.logger.info("Stop and restart vhost port") + self.vhost_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_wake_up_packed_ring_vhost_user_core_with_l3fwd_power_sample( + self, + ): + """ + Test Case 7:Wake up packed ring vhost-user core with l3fwd-power sample + """ + perf_result = [] + self.launch_virtio_user(path="./vhost-net", packed=True) + self.launch_l3fwd_power(path="./vhost-net", vhost=True) + self.virtio_user_pmd.execute_cmd("start") + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1, vhost=False) + + self.logger.info("Stop and restart virtio-user") + self.virtio_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=1, vhost=False) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def test_perf_wake_up_packed_ring_multi_queues_vhost_user_core_with_l3fwd_power_sample( + self, + ): + """ + Test Case 8:Wake up packed ring multi-queues vhost-user core with l3fwd-power sample + """ + perf_result = [] + self.launch_virtio_user(queues=2, path="./vhost-net", packed=True) + self.launch_l3fwd_power(queues=2, path="./vhost-net", vhost=True) + self.virtio_user_pmd.execute_cmd("start") + before_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2, vhost=False) + + self.logger.info("Stop and restart virtio-user") + self.virtio_user_pmd.execute_cmd("start") + after_restart = self.send_imix_packets() + self.check_each_queue_of_port_packets(queues=2, vhost=False) + + for key in before_restart.keys(): + perf_result.append(["imix", "Before Re-start vhost", before_restart[key]]) + for key in after_restart.keys(): + perf_result.append(["imix", "After Re-start vhost", after_restart[key]]) + for table_row in perf_result: + self.result_table_add(table_row) + self.result_table_print() + + def tear_down(self): + """ + run after each test case. + """ + self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#") + self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#") + + def tear_down_all(self): + """ + run after each test suite. + """ + self.close_all_session()