From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2FE9CA00BE; Wed, 20 Apr 2022 09:51:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A99641156; Wed, 20 Apr 2022 09:51:19 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 0CDE44068E for ; Wed, 20 Apr 2022 09:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650441078; x=1681977078; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6ipZQQ5AYkFCXyfT4RgdGjnOAO1bRQEbjF2UNmCbjN4=; b=gLngjxYJ2BC+SOosMWxhfev+Hki4iySu7W30c0oOVOqETINMchA5h1y/ PsbbYS/X8mBCrSwaER6lPf3hU4zv7nNHJ0+zzMdlTFNlvKbZWN+edh7Da /Im1PAVi7eNhoe0Y/OTNOkxvG87A0k/Z7lXPoMALMr7c2CybDVSpcFZhC vcdJbjd4hpkAJ+fqKKm6r1BgLig4a9S0c11CRaddU+//8miPpBkyf2bxQ IV0TmK8fyghuuoVfmi5+/CPCCJU4f2U7LzigvD9sb3S3nH6FZRohUgR6d coCEcZlfAfss/jCuwqHnwVMAWtTwOXWNbovPDpNhIQRzPO8F2p+mtUkM+ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10322"; a="324407960" X-IronPort-AV: E=Sophos;i="5.90,275,1643702400"; d="scan'208";a="324407960" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 00:51:17 -0700 X-IronPort-AV: E=Sophos;i="5.90,275,1643702400"; d="scan'208";a="702546575" Received: from unknown (HELO localhost.localdomain) ([10.239.251.222]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 00:51:14 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1 2/2] tests/vdev_primary_secondary: add hotplug testcase2 Date: Wed, 20 Apr 2022 15:51:07 +0800 Message-Id: <20220420075107.1388807-1-weix.ling@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 hotplug testcase2. Signed-off-by: Wei Ling --- tests/TestSuite_vdev_primary_secondary.py | 104 ++++++++++++++++------ 1 file changed, 79 insertions(+), 25 deletions(-) diff --git a/tests/TestSuite_vdev_primary_secondary.py b/tests/TestSuite_vdev_primary_secondary.py index 7f054cda..f57d5c02 100644 --- a/tests/TestSuite_vdev_primary_secondary.py +++ b/tests/TestSuite_vdev_primary_secondary.py @@ -66,6 +66,7 @@ class TestVdevPrimarySecondary(TestCase): self.pci_info = self.dut.ports_info[0]["pci"] self.app_testpmd_path = self.dut.apps_name["test-pmd"] self.app_symmetric_mp_path = self.dut.apps_name["symmetric_mp"] + self.app_hotplug_mp_path = self.dut.apps_name["hotplug_mp"] self.testpmd_name = self.app_testpmd_path.split("/")[-1] def set_up(self): @@ -89,7 +90,7 @@ class TestVdevPrimarySecondary(TestCase): vm_params["opt_mac"] = "%s%d" % (self.virtio_mac, i + 2) vm_params["opt_queue"] = self.queues vm_params["opt_server"] = "server" - vm_params["opt_settings"] = "mrg_rxbuf=on,mq=on,vectors=%d" % ( + vm_params["opt_settings"] = "mrg_rxbuf=on,csum=on,mq=on,vectors=%d" % ( 2 * self.queues + 2 ) self.vm.set_vm_device(**vm_params) @@ -125,11 +126,13 @@ class TestVdevPrimarySecondary(TestCase): ) start_cmd = testcmd + eal_params + vdev1 + vdev2 + para self.dut.send_expect(start_cmd, "testpmd> ", 120) - self.dut.send_expect("set fwd txonly", "testpmd> ", 120) + + def send_packets_from_vhost(self): + self.dut.send_expect("set fwd mac", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ", 120) - def launch_examples(self): - example_cmd_auto = ( + def launch_symmetric_mp(self): + example_cmd_primary = ( self.app_symmetric_mp_path + " -l 0 -n %d --proc-type=auto -- -p 3 --num-procs=%d --proc-id=0" ) @@ -137,48 +140,99 @@ class TestVdevPrimarySecondary(TestCase): self.app_symmetric_mp_path + " -l 1 -n %d --proc-type=secondary -- -p 3 --num-procs=%d --proc-id=1" ) - final_cmd_first = example_cmd_auto % (self.mem_channels, self.queues) + final_cmd_primary = example_cmd_primary % (self.mem_channels, self.queues) + final_cmd_secondary = example_cmd_secondary % (self.mem_channels, self.queues) + self.vm_primary.send_expect(final_cmd_primary, "Lcore", 120) + time.sleep(3) + self.vm_secondary.send_expect(final_cmd_secondary, "Lcore", 120) + + def launch_hotplug_mp(self): + example_cmd_primary = ( + self.app_hotplug_mp_path + + " -l 0 -n %d --proc-type=auto -- -p 3 --num-procs=%d --proc-id=0" + ) + example_cmd_secondary = ( + self.app_hotplug_mp_path + + " -l 1 -n %d --proc-type=secondary -- -p 3 --num-procs=%d --proc-id=1" + ) + final_cmd_primary = example_cmd_primary % (self.mem_channels, self.queues) final_cmd_secondary = example_cmd_secondary % (self.mem_channels, self.queues) - self.vhost_first.send_expect(final_cmd_first, "Lcore", 120) + self.vm_primary.send_expect(final_cmd_primary, "example>", 120) time.sleep(3) - self.vhost_secondary.send_expect(final_cmd_secondary, "Lcore", 120) + self.vm_secondary.send_expect(final_cmd_secondary, "example>", 120) + + def check_etherdev(self, dev_list): + primary_out = self.vm_primary.send_expect("list", "example", 120) + for dev in dev_list: + self.verify(dev in primary_out, "dev {} not in the list") + secondary_out = self.vm_secondary.send_expect("list", "example", 120) + for dev in dev_list: + self.verify(dev in secondary_out, "dev {} not in the list") + + def detach_etherdev_from_primary(self, dev_pci): + self.vm_primary.send_expect("detach {}".format(dev_pci), "example", 120) + + def attach_etherdev_from_secondary(self, dev_pci): + self.vm_secondary.send_expect("attach {}".format(dev_pci), "example", 120) def prepare_symmetric_mp(self): out = self.vm_dut.build_dpdk_apps("./examples/multi_process/symmetric_mp") self.verify("Error" not in out, "compilation symmetric_mp error") + def prepare_hotplug_mp(self): + out = self.vm_dut.build_dpdk_apps("./examples/multi_process/hotplug_mp") + self.verify("Error" not in out, "compilation hotplug_mp error") + def close_session(self): - self.vm_dut.close_session(self.vhost_first) - self.vm_dut.close_session(self.vhost_secondary) + self.vm_dut.close_session(self.vm_primary) + self.vm_dut.close_session(self.vm_secondary) - def test_Virtio_primary_and_secondary_process(self): - # start testpmd + def test_virtio_primary_and_secondary_process(self): self.launch_testpmd() self.setup_vm_env() - # Modify code self.prepare_symmetric_mp() - # create 2 new session - self.vhost_first = self.vm_dut.new_session(suite="vhost_first") - self.vhost_secondary = self.vm_dut.new_session(suite="vhsot_secondary") - # start symmetric_mp - self.launch_examples() + self.vm_primary = self.vm_dut.new_session(suite="vm_primary") + self.vm_secondary = self.vm_dut.new_session(suite="vhsot_secondary") + self.launch_symmetric_mp() + self.send_packets_from_vhost() time.sleep(3) - vhost_first_out = self.vhost_first.send_expect("^c", "#", 15) - print(vhost_first_out) + vm_primary_out = self.vm_primary.send_expect("^c", "#", 15) + print(vm_primary_out) time.sleep(3) - vhost_secondary_out = self.vhost_secondary.send_expect("^c", "#", 15) - print(vhost_secondary_out) - result_first = re.findall(r"Port \d: RX - (\w+)", vhost_first_out) - result_secondary = re.findall(r"Port \d: RX - (\w+)", vhost_secondary_out) + vm_secondary_out = self.vm_secondary.send_expect("^c", "#", 15) + print(vm_secondary_out) + result_primary = re.findall(r"Port \d: RX - (\w+)", vm_primary_out) + result_secondary = re.findall(r"Port \d: RX - (\w+)", vm_secondary_out) self.verify( - len(result_first[0]) != 0 - and len(result_first[1]) != 0 + len(result_primary[0]) != 0 + and len(result_primary[1]) != 0 and len(result_secondary[0]) != 0 and len(result_secondary[1]) != 0, "RX no data", ) self.dut.send_expect("quit", "#", 15) + def test_virtio_primay_and_secondary_process_hotplug(self): + self.launch_testpmd() + self.setup_vm_env() + self.prepare_hotplug_mp() + self.vm_primary = self.vm_dut.new_session(suite="vm_primary") + self.vm_secondary = self.vm_dut.new_session(suite="vhsot_secondary") + self.launch_hotplug_mp() + vm_ports = [] + for pci_info in self.vm_dut.ports_info: + vm_ports.append(pci_info['pci']) + self.check_etherdev(dev_list=vm_ports) + detach_pci = vm_ports[0] + for _ in range(2): + self.detach_etherdev_from_primary(dev_pci=detach_pci) + vm_ports.remove(detach_pci) + self.check_etherdev(dev_list=vm_ports) + self.attach_etherdev_from_secondary(dev_pci=detach_pci) + vm_ports.append(detach_pci) + self.check_etherdev(dev_list=vm_ports) + self.dut.send_expect("quit", "#", 15) + def tear_down(self): """ Run after each test case. -- 2.25.1