From patchwork Tue Dec 27 15:30:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 121404 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 5449AA04FD; Tue, 27 Dec 2022 08:32:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EE47410FC; Tue, 27 Dec 2022 08:32:56 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 3BFFD40E2D for ; Tue, 27 Dec 2022 08:32:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672126374; x=1703662374; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AwBjVFF4eMWRHlC/c2f2JnacWKKo0rADd5v0vloiik0=; b=iXtYRAaYkAeMDwuErbSqP2J756Xmn+ZENDSJOkp3uL1YV1mC4WVglIs4 MqCrYctYlZB+rjJL50oDeiZ25fIfTY9EjN8vQGiYOyN+CjFjqcf5Vm7jU tzTsjqZ+sB1OfehB+f1d6hlZ7H2/7zt3Sze3wBKdCAtKO4tU5fjpZlc1s cepbfHkPNAtyiDn+K7fkTXs4Ymy8RT+CmqQ4Sh7xIiXtV6pArarf88Btc ICMf3DuzNO3XTigcescyVPzbDvZ8NVFddgdtOfffw/o18FdJZQF+oElaU 6cb0lIkIVXH29w0XrS2IwbGyd2mOO7sQjuk7ucY7KMwk2g1pq+M9geB/I Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="347853843" X-IronPort-AV: E=Sophos;i="5.96,277,1665471600"; d="scan'208";a="347853843" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Dec 2022 23:32:53 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="777073934" X-IronPort-AV: E=Sophos;i="5.96,277,1665471600"; d="scan'208";a="777073934" Received: from unknown (HELO localhost.localdomain) ([10.239.252.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Dec 2022 23:32:51 -0800 From: Song Jiale To: dts@dpdk.org Cc: Song Jiale Subject: [dts] [PATCH V1 1/2] tests/multiprocess_iavf: add new cases according to testplan Date: Tue, 27 Dec 2022 15:30:45 +0000 Message-Id: <20221227153046.505885-1-songx.jiale@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 two cases according to testplan. Signed-off-by: Song Jiale --- tests/TestSuite_multiprocess_iavf.py | 99 +++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/tests/TestSuite_multiprocess_iavf.py b/tests/TestSuite_multiprocess_iavf.py index bb8e0c98..4a55ab5a 100644 --- a/tests/TestSuite_multiprocess_iavf.py +++ b/tests/TestSuite_multiprocess_iavf.py @@ -476,7 +476,7 @@ class TestMultiprocessIavf(TestCase): ) pkt_num = kwargs.get("pkt_num") res = self.get_pkt_statistic(out, **kwargs) - res_num = res["rx-total"] + res_num = res["rx-packets"] self.verify( res_num == pkt_num, "fail: got wrong number of packets, expect pakcet number {}, got {}".format( @@ -804,6 +804,21 @@ class TestMultiprocessIavf(TestCase): "some subcases failed, detail as below:{}".format(msg), ) + def check_port_status(self, pmd_output, status=True): + out = pmd_output.execute_cmd("show port info 0") + pattern = r"Link status:\s+(\w+)" + res = re.search(pattern, out).group(1) + if status: + self.verify( + res == "up", + "The expected link state is up, but the actual status is down", + ) + else: + self.verify( + res == "down", + "The expected link state is down, but the actual status is up", + ) + def test_multiprocess_simple_mpbasicoperation(self): """ Basic operation. @@ -1677,6 +1692,88 @@ class TestMultiprocessIavf(TestCase): } self.rte_flow(mac_ipv4_symmetric, self.multiprocess_rss_data, **pmd_param) + def test_multiprocess_port_stop(self): + packets = [ + 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/Raw(load="P"*20)', + ] + # start testpmd multi-process + self.launch_multi_testpmd( + proc_type="auto", + queue_num=8, + process_num=2, + ) + for pmd_output in self.pmd_output_list: + pmd_output.execute_cmd("stop") + # set primary process port stop + self.pmd_output_list[0].execute_cmd("port stop 0") + self.pmd_output_list[1].execute_cmd("start") + fdir_pro = fdirprocess( + self, + self.pmd_output_list[1], + self.tester_ifaces, + rxq=8, + ) + out = self.send_pkt_get_output(fdir_pro, packets, port_id=0, count=1) + # Check that no packet was received + self.check_pkt_num(out, port_id=0, pkt_num=0) + for pmd_output in self.pmd_output_list: + pmd_output.quit() + + # start testpmd multi-process + self.launch_multi_testpmd( + proc_type="auto", + queue_num=8, + process_num=2, + ) + for pmd_output in self.pmd_output_list: + pmd_output.execute_cmd("stop") + # set secondary process port stop + self.pmd_output_list[1].execute_cmd("port stop 0") + self.pmd_output_list[0].execute_cmd("start") + fdir_pro = fdirprocess( + self, + self.pmd_output_list[0], + self.tester_ifaces, + rxq=8, + ) + out = self.send_pkt_get_output(fdir_pro, packets, port_id=0, count=1) + # Check that one packet was received in primary process + self.check_pkt_num(out, port_id=0, pkt_num=len(packets)) + + def test_multiprocess_port_reset(self): + # start testpmd multi-process + self.launch_multi_testpmd( + proc_type="auto", + queue_num=8, + process_num=2, + ) + for pmd_output in self.pmd_output_list: + pmd_output.execute_cmd("stop") + # set primary process port reset + self.pmd_output_list[0].execute_cmd("port stop 0") + self.pmd_output_list[0].execute_cmd("port reset 0") + # Check that link status of port 0 is 'down' in secondary process and primary process + self.check_port_status(self.pmd_output_list[0], status=False) + self.check_port_status(self.pmd_output_list[1], status=False) + + for pmd_output in self.pmd_output_list: + pmd_output.quit() + + # start testpmd multi-process + self.launch_multi_testpmd( + proc_type="auto", + queue_num=8, + process_num=2, + ) + for pmd_output in self.pmd_output_list: + pmd_output.execute_cmd("stop") + # set secondary process port reset + self.pmd_output_list[1].execute_cmd("port stop 0") + self.pmd_output_list[1].execute_cmd("port reset 0") + # Check that link status of port 0 is 'up' in secondary process and primary process + self.check_port_status(self.pmd_output_list[0], status=True) + self.check_port_status(self.pmd_output_list[1], status=True) + def set_fields(self): """set ip protocol field behavior""" fields_config = { From patchwork Tue Dec 27 15:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 121405 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 B8DCEA0540; Tue, 27 Dec 2022 08:32:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B16041181; Tue, 27 Dec 2022 08:32:56 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 0BB2340E2D for ; Tue, 27 Dec 2022 08:32:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672126375; x=1703662375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q+UKgJqDJ4eRj6uB8rzleVZfq3IKCyG3DbeTqQqyMF8=; b=YfsUAQ18Lv+dxYoDPgq+muZAj5olj2h3PpI0SbGz2ceq97UxU7fDI1ZH 6UM0qser6dieGT3raQh8AjBZVuZ+bu9RtlSNUoh6ocTOEw93N9rQgfsjY JuXyT4JjME69L90LT59CZOfMgd2cxRKiVFGtzQAeORiMAb/ooqRKOHvev BJX67WYDacXG3q/iW6F/jkHwizmo54GD0s6Vwu/tRupO7w9xeCubuez6q 6NSOwX6TossJk/ZzW7yfBBTRmVH1nuloBlvAHiteLuzuy9gYjc90IqzLP MZZK/YR2eFId4nAjdVF42I0VsDsXUsbWn8EbtiKXzkJXoJMySNNLJlFM4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="347853846" X-IronPort-AV: E=Sophos;i="5.96,277,1665471600"; d="scan'208";a="347853846" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Dec 2022 23:32:54 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10572"; a="777073939" X-IronPort-AV: E=Sophos;i="5.96,277,1665471600"; d="scan'208";a="777073939" Received: from unknown (HELO localhost.localdomain) ([10.239.252.20]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Dec 2022 23:32:52 -0800 From: Song Jiale To: dts@dpdk.org Cc: Song Jiale , Jin Ling Subject: [dts] [PATCH V1 2/2] test_plans/multiprocess_iavf: add 2 cases Date: Tue, 27 Dec 2022 15:30:46 +0000 Message-Id: <20221227153046.505885-2-songx.jiale@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221227153046.505885-1-songx.jiale@intel.com> References: <20221227153046.505885-1-songx.jiale@intel.com> 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 in DPDK multiprocess, all operations done by the secondary process on the hardware are invalid. so action 'port stop' and 'port reset' only work in primary process. add 2 cases to test it. Signed-off-by: Jin Ling --- test_plans/multiprocess_iavf_test_plan.rst | 142 ++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/test_plans/multiprocess_iavf_test_plan.rst b/test_plans/multiprocess_iavf_test_plan.rst index 2f5ae54a..f28f2042 100644 --- a/test_plans/multiprocess_iavf_test_plan.rst +++ b/test_plans/multiprocess_iavf_test_plan.rst @@ -47,6 +47,9 @@ twice - once as a primary instance, and once as a secondary instance. Messages are sent from primary to secondary and vice versa, demonstrating the processes are sharing memory and can communicate using rte_ring structures. +In DPDK multprocess, all operations done by the secondary process on the hardware are invalid +So action `port stop` and `port reset` only work in primary process. + Prerequisites ------------- @@ -54,9 +57,11 @@ If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When using vfio, use the following commands to load the vfio driver and bind it to the device under test:: + echo 1 > /sys/bus/pci/devices/0000:17:00.0/sriov_numvfs + ip link set ens9 vf0 mac 00:11:22:33:44:55 modprobe vfio modprobe vfio-pci - usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id + usertools/dpdk-devbind.py --bind=vfio-pci {vf_pci} Assuming that a DPDK build has been set up and the multi-process sample applications have been built. @@ -948,3 +953,138 @@ Test Case: test_multiprocess_negative_exceed_process_num the first and second processes should be launched successfully the third process should be launched failed and output should contain the following string: 'multi-process option proc-id(2) should be less than num-procs(2)' + +Test Case: test_multiprocess_port_stop +====================================== +Subcase 1: primary_port_stop +---------------------------- +test steps +~~~~~~~~~~ + +1. Launch the app ``testpmd``, start 2 process with the following arguments:: + + ./dpdk-testpmd -l 1,2 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=0 + ./dpdk-testpmd -l 3,4 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=1 + +2. stop port in secondary process and start fwd in primary:: + + secondary process: + testpmd> port stop 0 + + primary process: + testpmd> set fwd rxonly + testpmd> set verbose 1 + testpmd> start + +3. send 1 packet from scapy:: + + >>> sendp([Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/Raw(load="P"*20)], iface="ens6") + +expected result +~~~~~~~~~~~~~~~ + +Check that one packet was received in primary process:: + + primary process: + testpmd> stop + + ---------------------- Forward statistics for port 0 ---------------------- + RX-packets: 1 RX-dropped: 0 RX-total: 1 + TX-packets: 0 TX-dropped: 0 TX-total: 0 + ---------------------------------------------------------------------------- + +Subcase 2:secondary_port_stop +------------------------------ +test steps +~~~~~~~~~~ + +1. Launch the app ``testpmd``, start 2 process with the following arguments:: + + ./dpdk-testpmd -l 1,2 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=0 + ./dpdk-testpmd -l 3,4 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=1 + +2. stop port in primary process and start fwd in secondary:: + + primary process: + testpmd> port stop 0 + + secondary process: + testpmd> set fwd rxonly + testpmd> set verbose 1 + testpmd> start + +3. send 1 packet from scapy:: + + >>> sendp([Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/Raw(load="P"*20)], iface="ens6") + +expected result +~~~~~~~~~~~~~~~ + + Check that no packet was received. + + secondary process:: + + testpmd> stop + Telling cores to stop... + Waiting for lcores to finish... + + ---------------------- Forward statistics for port 0 ---------------------- + RX-packets: 0 RX-dropped: 1 RX-total: 1 + TX-packets: 0 TX-dropped: 0 TX-total: 0 + ---------------------------------------------------------------------------- + + +TestCase: test_multiprocess_vf_reset +==================================== +Subcase 1: primary_port_reset +----------------------------- +test steps +~~~~~~~~~~ + +1. Launch the app ``testpmd``, start 2 process with rxq/txq set as 8 (proc_id:0~1, queue id:0~7) with the following arguments:: + + ./dpdk-testpmd -l 1,2 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=0 + ./dpdk-testpmd -l 3,4 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=1 + + +2. reset port in primary when secondary is running:: + + primary process: + testpmd> port stop 0 + testpmd> port reset 0 + + +expected result +~~~~~~~~~~~~~~~ + +secondary process & primary process:: + + testpmd>show port info 0 + + Check that link status of port 0 is `down` + + +Subcase 2: secondary_port_reset +------------------------------- +test steps +~~~~~~~~~~ + +1. Launch the app ``testpmd``, start 2 process with rxq/txq set as 8 (proc_id:0~1, queue id:0~7) with the following arguments:: + + ./dpdk-testpmd -l 1,2 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=0 + ./dpdk-testpmd -l 3,4 --proc-type=auto -a 0000:17:01.0 --log-level=ice,7 -- -i --rxq=8 --txq=8 --num-procs=2 --proc-id=1 + +2. reset port in secondary when primary is running:: + + secondary process: + testpmd> port stop 0 + testpmd> port reset 0 + +expected result +~~~~~~~~~~~~~~~ + +primary process & secondary process:: + + testpmd> show port info 0 + + Check that link status of port 0 is `up` \ No newline at end of file