From patchwork Fri Mar 31 06:09:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 125672 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 DD2E94287F; Fri, 31 Mar 2023 09:18:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A90FB42B71; Fri, 31 Mar 2023 09:18:10 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 11DE0427F2 for ; Fri, 31 Mar 2023 09:18:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680247089; x=1711783089; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=YkSu78ZT7M8O4dyCJTMYuQPNGdnf8fF9Cr31TeX3dw8=; b=KHlEogsp4QR9pKOdXwL2GDWLNUYGb0yZ5i8sym/z5LQuArn8qEXBI+bk ahyUQ53sTPTP3mX3ad1fie4N/DcAcwnrgMtIVyLFna0UlpB97DIOJeowk q3S5fyK71by110L5KNDVx+N9ZlPjHweDjP1RfdG21mrthSBeuaWpYHzFS PrmSgxs7sIU58L+PYELBnjKs8ycUPQgKZc6y6fR9wSUgZ0qY32NQki5ug 8hKIqmPfZPIuqTR3aQriFLEo/jsEof2fUirkOuzEL6OJ4r6hBf8uPBKXV XYEuatm7imNTVVHItg3yoXyTjGMib+HqvWlmGkoUKz3pAhCkaIrUjSuo8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="321771315" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="321771315" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="715352767" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="715352767" Received: from unknown (HELO localhost.localdomain) ([10.239.252.99]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:06 -0700 From: Lingli Chen To: dts@dpdk.org Cc: yuan.peng@intel.com, Lingli Chen Subject: [dts][PATCH V1 1/3] test_plans/vf_queue_start_stop: add new vf test_plan Date: Fri, 31 Mar 2023 02:09:07 -0400 Message-Id: <20230331060909.43701-1-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.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 1. add vf_queue_start_stop_test_plan 2. queue_start_stop: optimize test_plans to remove re-compile dpdk test step Signed-off-by: Lingli Chen --- test_plans/index.rst | 1 + test_plans/queue_start_stop_test_plan.rst | 14 ++-- test_plans/vf_queue_start_stop_test_plan.rst | 74 ++++++++++++++++++++ 3 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 test_plans/vf_queue_start_stop_test_plan.rst diff --git a/test_plans/index.rst b/test_plans/index.rst index d65bf0e5..d11854fe 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -191,6 +191,7 @@ The following are the test plans for the DPDK DTS automated test system. vf_packet_rxtx_test_plan vf_pf_reset_test_plan vf_port_start_stop_test_plan + vf_queue_start_stop_test_plan vf_rss_test_plan vf_single_core_perf_test_plan vf_smoke_test_plan diff --git a/test_plans/queue_start_stop_test_plan.rst b/test_plans/queue_start_stop_test_plan.rst index aecdb095..fe8ecea0 100644 --- a/test_plans/queue_start_stop_test_plan.rst +++ b/test_plans/queue_start_stop_test_plan.rst @@ -29,15 +29,12 @@ To run the testpmd application in linuxapp environment with 4 lcores, Test Case: queue start/stop --------------------------- -This case support PF (Intel® Ethernet 700 Series/Intel® Ethernet 800 Series/82599), VF (Intel® Ethernet 700 Series, 82599) +This case support PF (Intel® Ethernet 700 Series/Intel® Ethernet 800 Series/82599) -#. Update testpmd source code. Add the following C code in ./app/test-pmd/fwdmac.c:: - - printf("ports %u queue %u received %u packages\n", fs->rx_port, fs->rx_queue, nb_rx); - -#. Compile testpmd again, then run testpmd:: +#. Launch testpmd:: x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 -a 0000:af:00.0 -- -i --portmask=0x1 --port-topology=loop +#. Run "set verbose 1" to set verbose #. Run "set fwd mac" to set fwd type #. Run "start" to start fwd package @@ -55,9 +52,8 @@ This case support PF (Intel® Ethernet 700 Series/Intel® Ethernet 800 Series/82 #. Run "port 0 rxq 0 start" to start rxq 0 in port 0 #. Run "port 0 txq 0 stop" to stop txq 0 in port 0 #. Start packet generator to transmit and check tester port not receive packets - and in testpmd it not has "ports 0 queue 0 received 1 packages" print + and in testpmd it not has "port 0/queue 0: received 1 packets" print #. Run "port 0 txq 0 start" to start txq 0 in port 0 #. Start packet generator to transmit and check tester port receive packets - and in testpmd it has "ports 0 queue 0 received 1 packages" print -#. Test it again with VF + and in testpmd it has "port 0/queue 0: received 1 packets" print diff --git a/test_plans/vf_queue_start_stop_test_plan.rst b/test_plans/vf_queue_start_stop_test_plan.rst new file mode 100644 index 00000000..291d8362 --- /dev/null +++ b/test_plans/vf_queue_start_stop_test_plan.rst @@ -0,0 +1,74 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2023 Intel Corporation + +=========================== +VF Shutdown API Queue Tests +=========================== + +This tests for Shutdown API feature can be run on linux userspace. It +will check if NIC vf port can be stopped and restarted without exiting the +application process. Furthermore, it will check if it can reconfigure +new configurations for a port after the port is stopped, and if it is +able to restart with those new configurations. It is based on testpmd +application. + +The test is performed by running the testpmd application and using a +traffic generator. Port/queue configurations can be set interactively, +and still be set at the command line when launching the application in +order to be compatible with previous test framework. + +Prerequisites +------------- + +Assume port A and B are connected to the remote ports, e.g. packet generator. +Get the pci device id of DUT, for example:: + + ./usertools/dpdk-devbind.py -s + + 0000:af:00.0 'Ethernet Controller XXV710 for 25GbE SFP28 158b' if=enp175s0f0 drv=i40e unused=vfio-pci + +Generate 1 VF on PF:: + + echo 1 > /sys/bus/pci/devices/0000:af:00.0/sriov_numvfs + +Bind VFs to dpdk driver:: + + modprobe vfio-pci + ./usertools/dpdk-devbind.py -b vfio-pci 0000:af:01.0 + +To run the testpmd application in linuxapp environment with 4 lcores, +4 channels with other default parameters in interactive mode:: + + $ .//app/dpdk-testpmd -c 0xf -n 4 -- -i + +Test Case: vf queue start/stop +------------------------------ + +This case support VF (Intel® Ethernet 700 Series/Intel® Ethernet 800 Series) + +#. Launch testpmd:: + x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 1-2 -n 4 -a 0000:af:01.0 -- -i --portmask=0x1 --port-topology=loop + +#. Run "set verbose 1" to set verbose +#. Run "set fwd mac" to set fwd type +#. Run "start" to start fwd package + +#. Start a packet capture on the tester in the background:: + tcpdump -i ens7 'ether[12:2] != 0x88cc' -Q in -w /tmp/tester/sniff_ens7.pcap + +#. Start packet generator to transmit packets:: + sendp([Ether(dst='3c:fd:fe:c1:0f:4c', src='00:00:20:00:00:00')/IP()/UDP()/Raw(load=b'XXXXXXXXXXXXXXXXXX')],iface="ens7",count=4,inter=0,verbose=False) + +#. Quit tcpdump and check tester port receive packets + +#. Run "port 0 rxq 0 stop" to stop rxq 0 in port 0 +#. Start packet generator to transmit and check tester port not receive packets + +#. Run "port 0 rxq 0 start" to start rxq 0 in port 0 +#. Run "port 0 txq 0 stop" to stop txq 0 in port 0 +#. Start packet generator to transmit and check tester port not receive packets + and in testpmd it not has "port 0/queue 0: received 1 packets" print + +#. Run "port 0 txq 0 start" to start txq 0 in port 0 +#. Start packet generator to transmit and check tester port receive packets + and in testpmd it has "port 0/queue 0: received 1 packets" print \ No newline at end of file From patchwork Fri Mar 31 06:09:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 125673 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 5B3FF42881; Fri, 31 Mar 2023 09:18:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDD3842BFE; Fri, 31 Mar 2023 09:18:10 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id D80A9427F2 for ; Fri, 31 Mar 2023 09:18:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680247090; x=1711783090; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=FuV7IHgTmnyetzbFecufeYV8bt1bdo3KHh+TFuVxxoY=; b=kVdJas6WYmWwDDFzKxTDEfX8RgNKIGFkjr/YN3h9Vl76+MHNni7kOQiO Hq8Oux9a33VeA4m5tpXBKGLpmsLQHcq5Wt9zW6FNlzG24Nix49SX0FXog QhUHqSXzz+1VcK81EFI8BK9stxg0AeREsY800s75iOmxF9WNbWdUxdp4B sqf63dGgwCPs4NfKnChhG/aiPIcVYnSWuiNLKsdV8h4esh4cvHDSfl4iZ 0mvyytT9HXGRyAcTiGAcEPtBZvr1GIENzfzSeX9GXBEO8a809CEStiFmT feVGMMOhbwgbVS56rbZxzzF41TMMZFJJyS5HkPZFtn9kUh5+Ea2lMPWjS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="321771321" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="321771321" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="715352774" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="715352774" Received: from unknown (HELO localhost.localdomain) ([10.239.252.99]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:07 -0700 From: Lingli Chen To: dts@dpdk.org Cc: yuan.peng@intel.com, Lingli Chen Subject: [dts][PATCH V1 2/3] tests/queue_start_stop: optimize test script to remove re-compile dpdk test step Date: Fri, 31 Mar 2023 02:09:08 -0400 Message-Id: <20230331060909.43701-2-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230331060909.43701-1-linglix.chen@intel.com> References: <20230331060909.43701-1-linglix.chen@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 remove re-compile dpdk test step to sync with test_plans Signed-off-by: Lingli Chen --- tests/TestSuite_queue_start_stop.py | 42 +++-------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py index 80baf8d6..27af1419 100644 --- a/tests/TestSuite_queue_start_stop.py +++ b/tests/TestSuite_queue_start_stop.py @@ -43,21 +43,6 @@ class TestQueueStartStop(TestCase): """ Run before each test case. """ - try: - patch_file = FOLDERS["Depends"] + r"/macfwd_log.patch" - except: - self.logger.warning(str(FOLDERS)) - patch_file = r"dep/macfwd_log.patch" - FOLDERS["Depends"] = "dep" - patch_dst = "/tmp/" - - # dpdk patch and build - try: - self.dut.session.copy_file_to(patch_file, patch_dst) - self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", True) - self.dut.build_install_dpdk(self.target) - except Exception as e: - raise IOError("dpdk setup failure: %s" % e) def check_forwarding(self, ports, nic, pktSize=64, received=True): self.send_packet(ports[0], ports[1], self.nic, pktSize, received) @@ -85,20 +70,6 @@ class TestQueueStartStop(TestCase): else: self.verify(len(sniff_pkts) == 0, "stop queue not work as expected") - def patch_hotfix_dpdk(self, patch_dir, on=True): - """ - This function is to apply or remove patch for dpdk. - patch_dir: the abs path of the patch - on: True for apply, False for remove - """ - try: - if on: - self.dut.send_expect("patch -p0 < %s" % patch_dir, "[~|~\]]# ") - else: - self.dut.send_expect("patch -p0 -R < %s" % patch_dir, "[~|~\]]# ") - except Exception as e: - raise ValueError("patch_hotfix_dpdk failure: %s" % e) - def test_queue_start_stop(self): """ queue start/stop test @@ -114,6 +85,7 @@ class TestQueueStartStop(TestCase): ) time.sleep(5) self.dut.send_expect("set fwd mac", "testpmd>") + self.dut.send_expect("set verbose 1", "testpmd>") self.dut.send_expect("start", "testpmd>") self.check_forwarding([0, 0], self.nic) except Exception as e: @@ -138,7 +110,7 @@ class TestQueueStartStop(TestCase): except Exception as e: raise IOError("queue start/stop forward failure: %s" % e) self.verify( - "ports 0 queue 0 receive " not in out, + "port 0/queue 0: received 1 packets" not in out, "start queue revice package failed, out = %s" % out, ) @@ -153,7 +125,7 @@ class TestQueueStartStop(TestCase): except Exception as e: raise IOError("queue start/stop forward failure: %s" % e) self.verify( - "ports 0 queue 0 receive " in out, + "port 0/queue 0: received 1 packets" in out, "start queue revice package failed, out = %s" % out, ) @@ -161,7 +133,6 @@ class TestQueueStartStop(TestCase): """ Run after each test case. """ - patch_dst = "/tmp/" try: self.dut.send_expect("stop", "testpmd>") @@ -169,13 +140,6 @@ class TestQueueStartStop(TestCase): except: print("Failed to quit testpmd") - self.dut.kill_all() - - try: - self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", False) - except Exception as e: - print(("patch_hotfix_dpdk remove failure :%s" % e)) - def tear_down_all(self): """ Run after each test suite. From patchwork Fri Mar 31 06:09:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lingli Chen X-Patchwork-Id: 125674 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 055954287F; Fri, 31 Mar 2023 09:18:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE1F742BAC; Fri, 31 Mar 2023 09:18:12 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 9D9AB427F2 for ; Fri, 31 Mar 2023 09:18:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680247091; x=1711783091; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=l2wpySFIVFIMtuMcUdJbTf6SX2+hOI+dKoSmrxBEPM4=; b=O2Lxi262zXak64C47Rhw03SJPsBhyjQgzMi1vKcDAhApVfwlDjyA6XHI 9jZj3kqISy1KHo/Fd8tdF+v8+WPtjQANw0fR/bEpoT3NSilRqTGJKy0P+ y7s9+u3aF+ljqrxqdKpKiBO9aOMSop0WquAxfCGtPUP2xYbT+HP5NuuSi C8bD//tZerHmYIZs98a1zC8CpgJJ87pNI5z+EXDs1njSGeOvnMgqujU/s YuRQhhBrevGEzQ2aIqVgURyShfRyUvJGiJJP0Yo4vAjSfFcGG03M9esgU X7EWZQLM5Mgbs1s8WbLPX0oO5zpWIllShT29mcixKlROmvh6cnk96bWtc w==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="321771326" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="321771326" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="715352783" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="715352783" Received: from unknown (HELO localhost.localdomain) ([10.239.252.99]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:18:09 -0700 From: Lingli Chen To: dts@dpdk.org Cc: yuan.peng@intel.com, Lingli Chen Subject: [dts][PATCH V1 3/3] tests/vf_queue_start_stop: add a new vf case Date: Fri, 31 Mar 2023 02:09:09 -0400 Message-Id: <20230331060909.43701-3-linglix.chen@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230331060909.43701-1-linglix.chen@intel.com> References: <20230331060909.43701-1-linglix.chen@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 add vf_queue_start_stop test script Signed-off-by: Lingli Chen --- tests/TestSuite_vf_queue_start_stop.py | 162 +++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 tests/TestSuite_vf_queue_start_stop.py diff --git a/tests/TestSuite_vf_queue_start_stop.py b/tests/TestSuite_vf_queue_start_stop.py new file mode 100644 index 00000000..bb98eb2c --- /dev/null +++ b/tests/TestSuite_vf_queue_start_stop.py @@ -0,0 +1,162 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023 Intel Corporation +# + +""" +DPDK Test suite. + +Test queue start stop Feature + +""" + +import os +import re +import time + +import framework.utils as utils +from framework.packet import Packet, strip_pktload +from framework.pmd_output import PmdOutput +from framework.settings import FOLDERS +from framework.test_case import TestCase + +# +# +# Test class. +# + + +class TestQueueStartStop(TestCase): + # + # + # + # Test cases. + # + + def set_up_all(self): + """ + Run at the start of each test suite. + """ + self.ports = self.dut.get_ports(self.nic) + self.verify(len(self.ports) >= 1, "Insufficient number of ports.") + + self.core_config = "1S/2C/1T" + self.ports_socket = self.dut.get_numa_id(self.ports[0]) + + def set_up(self): + """ + Run before each test case. + """ + # generate vf + self.dut.bind_interfaces_linux(self.kdriver) + self.dut.generate_sriov_vfs_by_port(self.ports[0], 1) + self.vf_port = self.dut.ports_info[self.ports[0]]["vfs_port"][0] + + self.vf_port.bind_driver(driver="vfio-pci") + self.vf_port_pci = self.dut.ports_info[self.ports[0]]["sriov_vfs_pci"][0] + + def check_forwarding(self, dmac, received=True): + self.send_packet(0, 0, dmac, received) + + def send_packet(self, txPort, rxPort, dmac, received=True): + """ + Send packages according to parameters. + """ + rxitf = self.tester.get_interface(self.tester.get_local_port(rxPort)) + txitf = self.tester.get_interface(self.tester.get_local_port(txPort)) + + pkt = Packet(pkt_type="UDP", pkt_len=64) + inst = self.tester.tcpdump_sniff_packets(rxitf) + pkt.config_layer("ether", {"dst": dmac}) + pkt.send_pkt(self.tester, tx_port=txitf, count=4) + sniff_pkts = self.tester.load_tcpdump_sniff_packets(inst) + + if received: + res = strip_pktload(sniff_pkts, layer="L4") + self.verify( + "58 58 58 58 58 58 58 58" in res, "receive queue not work as expected" + ) + else: + self.verify(len(sniff_pkts) == 0, "stop queue not work as expected") + + def test_vf_queue_start_stop(self): + """ + vf queue start/stop test + """ + self.pmd_out = PmdOutput(self.dut) + cores = self.dut.get_core_list(self.core_config, socket=self.ports_socket) + # dpdk start + try: + self.pmd_out.start_testpmd( + cores=cores, + eal_param="-a %s --file-prefix=vf" % self.vf_port_pci, + param="--portmask=0x1 --port-topology=loop", + ) + self.dut.send_expect("set fwd mac", "testpmd>") + self.dut.send_expect("set verbose 1", "testpmd>") + self.dut.send_expect("start", "testpmd>") + self.pmd_out.wait_link_status_up("all") + + dmac = self.pmd_out.get_port_mac(0) + + self.check_forwarding(dmac) + except Exception as e: + raise IOError("dpdk start and first forward failure: %s" % e) + + # stop rx queue test + try: + print("test stop rx queue") + self.dut.send_expect("stop", "testpmd>") + self.dut.send_expect("port 0 rxq 0 stop", "testpmd>") + self.dut.send_expect("start", "testpmd>") + self.check_forwarding(dmac, received=False) + + # start rx queue test + print("test start rx queue stop tx queue") + self.dut.send_expect("stop", "testpmd>") + self.dut.send_expect("port 0 rxq 0 start", "testpmd>") + self.dut.send_expect("port 0 txq 0 stop", "testpmd>") + self.dut.send_expect("start", "testpmd>") + self.check_forwarding(dmac, received=False) + out = self.dut.get_session_output() + except Exception as e: + raise IOError("queue start/stop forward failure: %s" % e) + self.verify( + "port 0/queue 0: received 1 packets" not in out, + "start queue revice package failed, out = %s" % out, + ) + + try: + # start tx queue test + print("test start rx and tx queue") + self.dut.send_expect("stop", "testpmd>") + self.dut.send_expect("port 0 txq 0 start", "testpmd>") + self.dut.send_expect("start", "testpmd>") + self.check_forwarding(dmac) + out = self.dut.get_session_output() + except Exception as e: + raise IOError("queue start/stop forward failure: %s" % e) + self.verify( + "port 0/queue 0: received 1 packets" in out, + "start queue revice package failed, out = %s" % out, + ) + + def tear_down(self): + """ + Run after each test case. + """ + try: + self.dut.send_expect("stop", "testpmd>") + self.dut.send_expect("quit", "#") + except: + print("Failed to quit testpmd") + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.kill_all() + self.dut.send_expect("rm -rf ./app/test-pmd/testpmd", "#") + self.dut.send_expect("rm -rf ./app/test-pmd/*.o", "#") + self.dut.send_expect("rm -rf ./app/test-pmd/build", "#") + + self.dut.bind_interfaces_linux(self.drivername)