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 33F31A00C2; Thu, 5 Jan 2023 09:05:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EB40400D4; Thu, 5 Jan 2023 09:05:42 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id CF03D40041 for ; Thu, 5 Jan 2023 09:05:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672905940; x=1704441940; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Vqxdoh5yOSRS4uJN4W5IFp5mm2TmoUdhasNkxqJHTBw=; b=Mp+aaJDfd4ZXyT0TkaYXnmYMKYtHXFMBfu4DkqNUTidDdQuF/a8jDDM/ JLgRzOJxjo7/e+9P7PjVhel8pIUiqfucpw4i0eB8Lz+FzMt3N4+KTl7vN mW0TCb+YHJDEQVRbqqWjm/fgj2rCzAKy6m6NotoPsokVc4C2VeahXntlU ov34vPZ1cvwfyE0OeMChMoRdASxg7Xc5QqalXJEH/54g0pNuw+QmOG6aI VkCTyCISwCZ2vh3GE0w17zZxW46nosrW0fX8pnlvDtq0+WbzQeS/rmhxM gSg6sTk5vxp81mPsIztLVJA5Dax4LRvd9zIlsfZ4fRnD8geMpOZLl1WEP g==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="408396326" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="408396326" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 00:05:39 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="900844334" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="900844334" Received: from unknown (HELO localhost.localdomain) ([10.239.252.93]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 00:05:38 -0800 From: Hongbo Li To: dts@dpdk.org Cc: Hongbo Li Subject: [dts][PATCH V1 2/2] vf_pf_reset/pf_reset_trigger_Vf_reset: add new case and plan for pf_reset_trigger_vf_reset Date: Fri, 6 Jan 2023 00:25:46 +0800 Message-Id: <20230105162546.24235-2-hongbox.li@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230105162546.24235-1-hongbox.li@intel.com> References: <20230105162546.24235-1-hongbox.li@intel.com> 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 1.add case test_pf_reset_trigger_vf_reset according to test plan. 2.optimize the logic of finding the tester port in the script Signed-off-by: Hongbo Li --- tests/TestSuite_vf_pf_reset.py | 111 +++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 5 deletions(-) diff --git a/tests/TestSuite_vf_pf_reset.py b/tests/TestSuite_vf_pf_reset.py index 6a9b5969..31cdbb39 100644 --- a/tests/TestSuite_vf_pf_reset.py +++ b/tests/TestSuite_vf_pf_reset.py @@ -61,12 +61,12 @@ class TestVfPfReset(TestCase): self.host_intf_1 = self.dut.ports_info[self.used_dut_port_1]["intf"] tester_port_0 = self.tester.get_local_port(self.used_dut_port_0) - self.tester_intf_0 = self.tester.get_interface(self.used_dut_port_0) - self.tester_mac_0 = self.tester.get_mac(self.used_dut_port_0) + self.tester_intf_0 = self.tester.get_interface(tester_port_0) + self.tester_mac_0 = self.tester.get_mac(tester_port_0) tester_port_1 = self.tester.get_local_port(self.used_dut_port_1) - self.tester_intf_1 = self.tester.get_interface(self.used_dut_port_1) - self.tester_mac_1 = self.tester.get_mac(self.used_dut_port_1) + self.tester_intf_1 = self.tester.get_interface(tester_port_1) + self.tester_mac_1 = self.tester.get_mac(tester_port_1) self.vf_mac1 = "00:11:22:33:44:11" self.vf_mac2 = "00:11:22:33:44:12" @@ -251,7 +251,8 @@ class TestVfPfReset(TestCase): pmd_output.execute_cmd(f"port reset {port}") pmd_output.execute_cmd(f"port start {port}") pmd_output.execute_cmd("start") - pmd_output.execute_cmd(f"show port info {port}") + port_info = pmd_output.execute_cmd(f"show port info {port}") + return port_info def setup_vm_env(self): """ @@ -1305,6 +1306,106 @@ class TestVfPfReset(TestCase): self.vm0_testpmd.quit() self.vm1_testpmd.quit() + def test_pf_reset_trigger_vf_reset(self): + """ + check pf reset and trigger vf reset + """ + # Set mac + self.ip_link_set( + host_intf=self.host_intf_0, + cmd="vf", + port=0, + types="mac", + value=self.vf_mac1, + ) + self.ip_link_set( + host_intf=self.host_intf_0, + cmd="vf", + port=1, + types="mac", + value=self.vf_mac2, + ) + + # Set the VLAN id of VF0 and VF1 + self.ip_link_set( + host_intf=self.host_intf_0, cmd="vf", port=0, types="vlan", value="1" + ) + self.ip_link_set( + host_intf=self.host_intf_0, cmd="vf", port=1, types="vlan", value="1" + ) + + # Launch pmd + param = "--portmask=0x3" + " --port-topology=paired" + self.pmd_output.start_testpmd( + cores="1S/4C/1T", + ports=[self.sriov_vfs_port[0].pci, self.sriov_vfs_port[1].pci], + param=param, + ) + + # Input pmd command + self.pmd_output.execute_cmd("set fwd mac") + self.pmd_output.execute_cmd("start") + self.pmd_output.execute_cmd("set allmulti all on") + self.pmd_output.execute_cmd("set promisc all off") + self.pmd_output.execute_cmd("set verbose 1") + out = self.pmd_output.execute_cmd("show port info all") + # Diable Promiscuous mode and enable Allmulticast mode + self.verify( + "Promiscuous mode: enabled" not in out, "disable promiscuous mode failed." + ) + self.verify( + "Allmulticast mode: disabled" not in out, + "enabled allmulticast mode failed.", + ) + + # The packets can be received + # By one VF and can be forward to another VF correctly + self.verify_send_packets( + self.tester_intf_0, + self.vf_mac1, + expect_value=1000, + count=1000, + vlan=1, + tx_port=self.tester_intf_0, + ) + # Pf reset + self.used_dut_port = self.dut_ports[0] + self.domain_id_0 = self.dut.ports_info[self.used_dut_port]["port"].domain_id + self.bus_id_0 = self.dut.ports_info[self.used_dut_port]["port"].bus_id + self.devfun_id_0 = self.dut.ports_info[self.used_dut_port]["port"].devfun_id + reset_cmd = ( + "echo 1 > /sys/bus/pci/devices/" + + self.domain_id_0 + + "\\:" + + self.bus_id_0 + + "\\:" + + self.devfun_id_0 + + "/reset" + ) + self.dut_new_session.send_expect(reset_cmd, "#") + # Check testpmd output "reset event" + out = self.pmd_output.get_output() + self.verify("reset event" in out, "testpmd did not report reset event") + # Send packets and verify again + port_info = self.reset_vf_ports(self.pmd_output) + # Check Diable Promiscuous mode and enable Allmulticast mode + self.verify( + "Promiscuous mode: enabled" not in port_info, + "disable promiscuous mode failed.", + ) + self.verify( + "Allmulticast mode: disabled" not in port_info, + "enabled allmulticast mode failed.", + ) + self.verify_send_packets( + self.tester_intf_0, + self.vf_mac1, + expect_value=1000, + count=1000, + vlan=1, + tx_port=self.tester_intf_0, + ) + def tear_down(self): """ Run after each test case. -- 2.17.1