From patchwork Wed Apr 6 15:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 109324 X-Patchwork-Delegate: thomas@monjalon.net 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 E28ECA0509; Wed, 6 Apr 2022 17:26:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5E8B42886; Wed, 6 Apr 2022 17:26:54 +0200 (CEST) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id CFE8740689 for ; Wed, 6 Apr 2022 17:26:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id 30051129C28; Wed, 6 Apr 2022 17:26:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GWheexwU1gMk; Wed, 6 Apr 2022 17:26:49 +0200 (CEST) Received: from entguard.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id 7FD39184FF0; Wed, 6 Apr 2022 17:26:49 +0200 (CEST) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, david.marchand@redhat.com, Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [RFC PATCH v1 1/2] dts: merge DTS test_plans/pf_smoke_test_plan.rst to DPDK Date: Wed, 6 Apr 2022 15:26:47 +0000 Message-Id: <20220406152648.2916866-2-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220406152648.2916866-1-juraj.linkes@pantheon.tech> References: <20220406152648.2916866-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --- dts/test_plans/pf_smoke_test_plan.rst | 165 ++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 dts/test_plans/pf_smoke_test_plan.rst diff --git a/dts/test_plans/pf_smoke_test_plan.rst b/dts/test_plans/pf_smoke_test_plan.rst new file mode 100644 index 0000000000..ffcd210574 --- /dev/null +++ b/dts/test_plans/pf_smoke_test_plan.rst @@ -0,0 +1,165 @@ +.. Copyright (c) <2021>, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +================== +NIC PF Smoke Test +================== + +Description +=========== +Test the basic functions of dpdk. +1. Port connection status. +2. Launch testpmd normally. +3. Basic rx and tx. + +Prerequisites +============= + +1. Hardware: + + niantic/fortville/columbiaville + +2. Software: + + dpdk: http://dpdk.org/git/dpdk + scapy: http://www.secdev.org/projects/scapy/ + +3. Compile DPDK:: + + CC=gcc meson -Denable_kmods=True -Dlibdir=lib --default-library=static x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc + +4. Get the pci device id of DUT, for example:: + + ./usertools/dpdk-devbind.py -s + + 0000:86:00.0 'Device 1593' if=enp134s0f0 drv=ice unused=vfio-pci + +7. Bind PF to dpdk driver:: + + modprobe vfio-pci + ./usertools/dpdk-devbind.py -b vfio-pci 0000:86:00.0 + +8. Launch dpdk on PF:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:86:00.0 --file-prefix=pf -- -i --rxq=4 --txq=4 + testpmd> set fwd mac + testpmd> set verbose 3 + testpmd> start + testpmd> show port info all + +Test Case 1: test enable and disable jumbo frame +==================================================== +1. when launch dpdk on PF, add parameter '--max-pkt-len=9600 --tx-offloads=0x00008000' + +2. set fwd mode is mac:: + + testpmd> set fwd mac + testpmd> set verbose 3 + testpmd> start + +3. Send a packet with size 9601 bytes :: + + testpmd> show port stats 0 + + ######################## NIC statistics for port 0 ######################## + RX-packets: 0 RX-errors: 1 RX-bytes: 0 + TX-packets: 0 TX-errors: 0 TX-bytes: 0 + ############################################################################ + +Verify that TX-bytes on port 0 and RX-bytes on port 0 are 0. + +4. Send a packet with size 9600 bytes :: + + testpmd> show port stats 0 + + ######################## NIC statistics for port 0 ######################## + RX-packets: 1 RX-errors: 0 RX-bytes: 9600 + TX-packets: 1 TX-errors: 0 TX-bytes: 9600 + ############################################################################ + +Verify that TX-bytes on port 0 and RX-bytes on port 0 are 9600. + +5. Set mtu is 1500 :: + + testpmd> port config mtu 1500 + +6. Send a packet with size 1518 bytes :: + + testpmd> show port stats 0 + + ######################## NIC statistics for port 0 ######################## + RX-packets: 1 RX-errors: 0 RX-bytes: 1518 + TX-packets: 1 TX-errors: 0 TX-bytes: 1518 + ############################################################################ + +Verify that TX-bytes on port 0 and RX-bytes on port 0 are 1518 + +7. Send a packet with size 1519 bytes :: + + testpmd> show port stats 0 + + ######################## NIC statistics for port 0 ######################## + RX-packets: 0 RX-errors: 1 RX-bytes: 0 + TX-packets: 0 TX-errors: 0 TX-bytes: 0 + ############################################################################ + +Verify that TX-bytes on port 0 and RX-bytes on port 1 are 0 + +Test Case 2: test RSS +==================================================== +1. set fwd mode is rxonly:: + + testpmd> set fwd rxonly + testpmd> set verbose 1 + testpmd> start + +4. Send different hash types' packets with different keywords, then check rx port + could receive packets by different queues:: + + sendp([Ether(dst="00:01:23:45:67:89")/IP(src="192.168.0.4", dst=RandIP())], iface="eth3") + +Test Case 3: test reset RX/TX queues +==================================================== +1. Run ``port stop all`` to stop all ports. + +2. Run ``port config all rxq 2`` to change the number of receiving queues to two. + +3. Run ``port config all txq 2`` to change the number of transmitting queues to two. + +4. Run ``port start all`` to restart all ports. + +5. Check with ``show config rxtx`` that the configuration for these parameters changed. + +6. Run ``start`` again to restart the forwarding, then start packet generator to transmit + and receive packets, and check if testpmd is able to receive and forward packets + successfully. From patchwork Wed Apr 6 15:26:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 109325 X-Patchwork-Delegate: thomas@monjalon.net 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 673F9A0509; Wed, 6 Apr 2022 17:27:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B710542852; Wed, 6 Apr 2022 17:26:55 +0200 (CEST) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id BAB3C40689 for ; Wed, 6 Apr 2022 17:26:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id 1E255184FF0; Wed, 6 Apr 2022 17:26:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29mTeuplQnr1; Wed, 6 Apr 2022 17:26:51 +0200 (CEST) Received: from entguard.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id E2F12184FF1; Wed, 6 Apr 2022 17:26:49 +0200 (CEST) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, david.marchand@redhat.com, Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [RFC PATCH v1 2/2] dts: merge DTS tests/TestSuite_pf_smoke.py to DPDK Date: Wed, 6 Apr 2022 15:26:48 +0000 Message-Id: <20220406152648.2916866-3-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220406152648.2916866-1-juraj.linkes@pantheon.tech> References: <20220406152648.2916866-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --- dts/tests/TestSuite_pf_smoke.py | 170 ++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 dts/tests/TestSuite_pf_smoke.py diff --git a/dts/tests/TestSuite_pf_smoke.py b/dts/tests/TestSuite_pf_smoke.py new file mode 100644 index 0000000000..586ae8c685 --- /dev/null +++ b/dts/tests/TestSuite_pf_smoke.py @@ -0,0 +1,170 @@ +# BSD LICENSE +# +# Copyright(c)2021 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from framework.packet import Packet +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase + +from .smoke_base import ( + DEFAULT_MTU_VALUE, + JUMBO_FRAME_LENGTH, + JUMBO_FRAME_MTU, + LAUNCH_QUEUE, + SmokeTest, +) + + +class TestPfSmoke(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + + + Smoke Prerequisites + """ + + # Based on h/w type, choose how many ports to use + self.smoke_dut_ports = self.dut.get_ports(self.nic) + + # Verify that enough ports are available + self.verify(len(self.smoke_dut_ports) >= 1, "Insufficient ports") + self.smoke_tester_port = self.tester.get_local_port(self.smoke_dut_ports[0]) + self.smoke_tester_nic = self.tester.get_interface(self.smoke_tester_port) + self.smoke_tester_mac = self.tester.get_mac(self.smoke_dut_ports[0]) + self.smoke_dut_mac = self.dut.get_mac_address(self.smoke_dut_ports[0]) + + # Verify that enough core + self.cores = self.dut.get_core_list("1S/4C/1T") + self.verify(self.cores is not None, "Insufficient cores for speed testing") + + # init pkt + self.pkt = Packet() + + # set default app parameter + self.pmd_out = PmdOutput(self.dut) + self.ports = [self.dut.ports_info[self.smoke_dut_ports[0]]["pci"]] + self.test_func = SmokeTest(self) + self.check_session = self.dut.new_session(suite="pf_smoke_test") + + def set_up(self): + """ + Run before each test case. + """ + # set tester mtu and testpmd parameter + if self._suite_result.test_case == "test_pf_jumbo_frames": + self.tester.send_expect( + "ifconfig {} mtu {}".format(self.smoke_tester_nic, JUMBO_FRAME_MTU), + "# ", + ) + self.param = ( + "--max-pkt-len={} --tx-offloads=0x8000 --rxq={} --txq={}".format( + JUMBO_FRAME_LENGTH, LAUNCH_QUEUE, LAUNCH_QUEUE + ) + ) + else: + self.param = "--rxq={} --txq={}".format(LAUNCH_QUEUE, LAUNCH_QUEUE) + # verify app launch state. + out = self.check_session.send_expect( + "ls -l /var/run/dpdk |awk '/^d/ {print $NF}'", "# ", 1 + ) + if out == "" or "No such file or directory" in out: + self.pf_launch_dpdk_app() + + def pf_launch_dpdk_app(self): + self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports, param=self.param) + + # set default param + self.dut.send_expect("set promisc all off", "testpmd> ") + self.pmd_out.wait_link_status_up(self.smoke_dut_ports[0]) + + def test_pf_jumbo_frames(self): + """ + This case aims to test transmitting jumbo frame packet on testpmd with + jumbo frame support. + """ + self.dut.send_expect("set fwd mac", "testpmd> ") + self.dut.send_expect("set verbose 3", "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + self.pmd_out.wait_link_status_up(self.smoke_dut_ports[0]) + result = self.test_func.check_jumbo_frames() + self.verify(result, "enable disable jumbo frames failed") + + def test_pf_rss(self): + """ + Check default rss function. + """ + self.dut.send_expect("set fwd rxonly", "testpmd> ") + self.dut.send_expect("set verbose 1", "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + self.pmd_out.wait_link_status_up(self.smoke_dut_ports[0]) + result = self.test_func.check_rss() + self.verify(result, "enable disable rss failed") + + def test_pf_tx_rx_queue(self): + """ + Check dpdk queue configure. + """ + self.dut.send_expect("set verbose 1", "testpmd> ") + self.dut.send_expect("set fwd rxonly", "testpmd> ") + self.dut.send_expect("start", "testpmd> ") + self.pmd_out.wait_link_status_up(self.smoke_dut_ports[0]) + result = self.test_func.check_tx_rx_queue() + self.verify(result, "check tx rx queue failed") + + def tear_down(self): + self.pmd_out.execute_cmd("stop") + + # set tester mtu to default value + if self._suite_result.test_case == "test_pf_jumbo_frames": + self.tester.send_expect( + "ifconfig {} mtu {}".format(self.smoke_tester_nic, DEFAULT_MTU_VALUE), + "# ", + ) + + # set dpdk queues to launch value + if self._suite_result.test_case == "test_pf_tx_rx_queue": + self.dut.send_expect("stop", "testpmd> ") + self.dut.send_expect("port stop all", "testpmd> ") + self.dut.send_expect( + "port config all rxq {}".format(LAUNCH_QUEUE), "testpmd> " + ) + self.dut.send_expect( + "port config all txq {}".format(LAUNCH_QUEUE), "testpmd> " + ) + self.dut.send_expect("port start all", "testpmd> ") + self.dut.send_expect("quit", "# ") + self.dut.kill_all() + + def tear_down_all(self): + if self.check_session: + self.dut.close_session(self.check_session) + self.check_session = None + self.dut.kill_all()