From patchwork Thu Dec 29 04:52:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 121460 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 17A23A0542; Thu, 29 Dec 2022 05:52:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D3ED42B8C; Thu, 29 Dec 2022 05:52:12 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id C0D8F410F9 for ; Thu, 29 Dec 2022 05:52:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672289530; x=1703825530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6EXEwoAXxt/zU1jEbMrEdifOxxo7aRDpnjeF2sLLxBw=; b=CybapgeX9yEyvepi5URJrgtDeF3vvYzwDfJPEy661zHScTZLsiJM3Qdy iTwWZeeNHafLem/2NsW4nm46/lZo4nO9A1L4UtOJsrLYWIVj64UOJOyNe ggc2kVaaz/OlB1Ksuvr47jB5Lu/1+x8qUH7ftNtbE7k4YFjwhSMhzB138 PveGmkWIkwuBi6hoK5G2nGirxhCLSwsmhnTncYYLnwiR36Ezkn6j2PTsb 0oPlvhqKr6U6uuBvQnrLV+sAd8F7JWfOl1j1exOHFKgN/TtV6UQp8hRn/ 1j+XGr/AFYre5L2L0+t0eFUnueYmeFwCqnTONtn9AyqVueX5Lp1AXNgme A==; X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="407245239" X-IronPort-AV: E=Sophos;i="5.96,282,1665471600"; d="scan'208";a="407245239" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 20:52:09 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="742198598" X-IronPort-AV: E=Sophos;i="5.96,282,1665471600"; d="scan'208";a="742198598" Received: from unknown (HELO localhost.localdomain) ([10.239.252.196]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 20:52:07 -0800 From: Yu Jiang To: qi.fu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1 1/2] test_plans/vf_l2fwd: add vf_l2fwd test plan Date: Thu, 29 Dec 2022 12:52:02 +0800 Message-Id: <20221229045203.2210928-2-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221229045203.2210928-1-yux.jiang@intel.com> References: <20221229045203.2210928-1-yux.jiang@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 test_plans/vf_l2fwd: add vf_l2fwd test plan Signed-off-by: Yu Jiang --- test_plans/index.rst | 1 + test_plans/vf_l2fwd_test_plan.rst | 133 ++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 test_plans/vf_l2fwd_test_plan.rst diff --git a/test_plans/index.rst b/test_plans/index.rst index 9ca954e2..8d54e8b6 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -203,6 +203,7 @@ The following are the test plans for the DPDK DTS automated test system. power_telemetry_test_plan power_throughput_test_plan vmdq_test_plan + vf_l2fwd_test_plan vf_l3fwd_test_plan softnic_test_plan vm_hotplug_test_plan diff --git a/test_plans/vf_l2fwd_test_plan.rst b/test_plans/vf_l2fwd_test_plan.rst new file mode 100644 index 00000000..95eb14ed --- /dev/null +++ b/test_plans/vf_l2fwd_test_plan.rst @@ -0,0 +1,133 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2022 Intel Corporation + +====================== +VF L2 Forwarding Tests +====================== + +This test application is a basic packet processing application using Intel® +DPDK. It is a layer-2 (L2) forwarding application which takes traffic from +a single RX port and transmits it with few modification on a single TX port. + +For a packet received on a RX port (RX_PORT), it would be transmitted from a +TX port (TX_PORT=RX_PORT+1) if RX_PORT is even; otherwise from a TX port +(TX_PORT=RX_PORT-1) if RX_PORT is odd. Before being transmitted, the source +mac address of the packet would be replaced by the mac address of the TX port, +while the destination mac address would be replaced by 00:09:c0:00:00:TX_PORT_ID. + +The test application should be run with the wanted paired ports configured using +the coremask parameter via the command line. i.e. port 0 and 1 is a valid pair, +while port 1 and 2 isn't. The test is performed by running the test application +and using a traffic generator. Tests are run with receiving a variety of size of +packets generated by the traffic generator and forwarding back to the traffic +generator. The packet loss and the throughput are the right ones need to be +measured. +These tests use l2fwd as a simple forwarder between NIC vfs. + +The ``l2fwd`` application is run with EAL parameters and parameters for +the application itself. For details about the EAL parameters, see the relevant +DPDK **Getting Started Guide**. +http://doc.dpdk.org/guides/sample_app_ug/l2_forward_real_virtual.html?highlight=l2fwd + +The application requires a number of command line options: + +.//examples/dpdk-l2fwd [EAL options] -- -p PORTMASK + [-P] + [-q NQ] + --[no-]mac-updating + [--portmap="(port, port)[,(port, port)]"] + +``-p PORTMASK``: A hexadecimal bitmask of the ports to configure +``-P``: Optional, set all ports to promiscuous mode so that packets are accepted regardless of the MAC destination address. +Without this option, only packets with the MAC destination address set to the Ethernet address of the port are accepted. +``-q NQ``: A number of queues (=ports) per lcore (default is 1) +``--[no-]mac-updating``: Enable or disable MAC addresses updating (enabled by default) +``--portmap=”(port,port)[,(port,port)]``: Determines forwarding ports mapping. + +Prerequisites +============= + +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:: + + modprobe vfio + modprobe vfio-pci + usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id + +Assume port 0 and 1 are connected to the traffic generator, to run the test +application in linuxapp environment with 4 lcores, 2 ports and 8 RX queues +per lcore:: + + $ ./x86_64-native-linuxapp-gcc/examples/dpdk-l2fwd -n 1-4 -c 0xf -- -q 8 -p 0x3 + +Also, if the ports to be tested are different, the port mask should be changed. +The lcore used to run the test application and the number of queue used for a +lcore could be changed. For benchmarking, the EAL parameters and the parameters +for the application itself for different test cases should be the same. +This application may be used for basic VM to VM communication too. + +Topology +-------- +DUT port 0 <----> Tester port A +DUT port 1 <----> Tester port B + +Hardware +-------- +Supported NICs + +Software +-------- + +dpdk: http://dpdk.org/git/dpdk +scapy: http://www.secdev.org/projects/scapy/ + +General set up +-------------- +Compile DPDK and l2fwd app:: + + CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib --default-library=static x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc -j 110 + meson configure -Dexamples=l2fwd x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc + ls x86_64-native-linuxapp-gcc/examples/dpdk-l2fwd + +Get the pci device id of DUT, for example:: + + ./usertools/dpdk-devbind.py -s + + 0000:18:00.0 'Device 159b' if=ens785f0 drv=ice unused=vfio-pci + 0000:18:00.1 'Device 159b' if=ens785f1 drv=ice unused=vfio-pci + +Generate 1 VF on each PF:: + + echo 1 > /sys/bus/pci/devices/0000:18:00.0/sriov_numvfs + echo 1 > /sys/bus/pci/devices/0000:18:00.1/sriov_numvfs + +Set mac addr for VFs:: + + ip link set ens785f0 vf 0 mac 00:11:22:33:44:55 + ip link set ens785f1 vf 0 mac 00:11:22:33:44:11 + +Bind VFs to dpdk driver:: + + modprobe vfio-pci + ./usertools/dpdk-devbind.py -b vfio-pci 0000:18:01.0 0000:18:02.0 + + +Test Case: Port testing +======================= + +Assume ``port A`` on packet generator connects to NIC ``port 0``, while ``port B`` +on packet generator connects to NIC ``port 1``. Set the destination mac address +of the packet stream to be sent out from ``port A`` to the mac address of +``port 0``, while the destination mac address of the packet stream to be sent out +from ``port B`` to the mac address of ``port 1``. Other parameters of the packet +stream could be anything valid. Then run the test application as below:: + + $ ./x86_64-native-linuxapp-gcc/examples/dpdk-l2fwd -n 4 -c 0xf -a -a -- -q [1|2|4|8] -p 0x3 + +Trigger the packet generator of bursting packets from ``port A``, then check if +``port 0`` could receive them and ``port 1`` could forward them back. Stop it +and then trigger the packet generator of bursting packets from ``port B``, then +check if ``port 1`` could receive them and ``port 0`` could forward them back. From patchwork Thu Dec 29 04:52:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 121461 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 3C610A0542; Thu, 29 Dec 2022 05:52:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36A4B42D20; Thu, 29 Dec 2022 05:52:16 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A1DE7410F9 for ; Thu, 29 Dec 2022 05:52:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672289534; x=1703825534; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rXE7GsTn98j3EMMN1dIv/ytfqE9KAMwGh2DqpOgZhRw=; b=JU+8MX4jEzkML2nqhw2D7kmh4ZurSSKYHwDRMH2g0fONt+2LpcdoOsiB +o+elQi5/N4eb/5wNO7OGcCTfFeJmD2+r1wZVRbzDOhIQLHQfHUPldR7n sl3BTCNDgTeCg9Zv6sBpl+VjIawgbeoC+PxocZIbRGayYbAJoY8E82JR1 9+lxxOqLek5Qz5gthYmvW8bMlV9vjkg0RTooSCisaLCBPVC4k+tBMb08g 6OqSbxPzvDJHAjFDTlvP1X7migBeiCkHQkgKEPU7up1wE/N4wo/YNaXyW qlEFsJ4cY1c7sTNYVOxMFeQM8WjUrpaOL5ekrFtju20SRk+ZutIxHpo1I g==; X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="407245240" X-IronPort-AV: E=Sophos;i="5.96,282,1665471600"; d="scan'208";a="407245240" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 20:52:13 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10574"; a="742198616" X-IronPort-AV: E=Sophos;i="5.96,282,1665471600"; d="scan'208";a="742198616" Received: from unknown (HELO localhost.localdomain) ([10.239.252.196]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 20:52:10 -0800 From: Yu Jiang To: qi.fu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1 2/2] tests/vf_l2fwd: add vf_l2fwd test script Date: Thu, 29 Dec 2022 12:52:03 +0800 Message-Id: <20221229045203.2210928-3-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221229045203.2210928-1-yux.jiang@intel.com> References: <20221229045203.2210928-1-yux.jiang@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 tests/vf_l2fwd: add vf_l2fwd test script Signed-off-by: Yu Jiang Acked-by: Yuan Peng Tested-by: Song Jiale Acked-by: Lijuan Tu --- tests/TestSuite_vf_l2fwd.py | 136 ++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 tests/TestSuite_vf_l2fwd.py diff --git a/tests/TestSuite_vf_l2fwd.py b/tests/TestSuite_vf_l2fwd.py new file mode 100644 index 00000000..542838c6 --- /dev/null +++ b/tests/TestSuite_vf_l2fwd.py @@ -0,0 +1,136 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation +# + +""" +DPDK Test suite. +Test Layer-2 Forwarding support +""" +import os +import time + +import framework.utils as utils +from framework.pktgen import PacketGeneratorHelper +from framework.settings import HEADER_SIZE +from framework.test_case import TestCase + + +class TestVfL2fwd(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + + L2fwd prerequisites. + """ + self.core_config = "1S/4C/1T" + self.dut_ports = self.dut.get_ports() + self.test_queues = [ + {"queues": 1, "Mpps": {}, "pct": {}}, + {"queues": 2, "Mpps": {}, "pct": {}}, + {"queues": 4, "Mpps": {}, "pct": {}}, + {"queues": 8, "Mpps": {}, "pct": {}}, + ] + self.number_of_ports = 2 + self.headers_size = HEADER_SIZE["eth"] + HEADER_SIZE["ip"] + HEADER_SIZE["udp"] + self.verify( + len(self.dut_ports) >= self.number_of_ports, + "Not enough ports for " + self.nic, + ) + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + # compile + out = self.dut.build_dpdk_apps("./examples/l2fwd") + self.app_l2fwd_path = self.dut.apps_name["l2fwd"] + + def set_up(self): + """ + Run before each test case. + """ + pass + + def quit_l2fwd(self): + self.dut.send_expect("fg", "l2fwd ", 5) + self.dut.send_expect("^C", "# ", 5) + + def test_vf_l2fwd_port_forward(self): + """ + Check port forwarding testing. + """ + VF_MAC_ADDR_port0 = "00:11:22:33:44:55" + VF_MAC_ADDR_port1 = "00:11:22:33:44:66" + # generate vf + self.dut.bind_interfaces_linux(self.kdriver) + self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 1, self.kdriver) + self.sriov_vfs_port_0 = self.dut.ports_info[self.dut_ports[0]]["vfs_port"] + self.verify(len(self.sriov_vfs_port_0) != 0, "VF create failed") + self.dut.generate_sriov_vfs_by_port(self.dut_ports[1], 1, self.kdriver) + self.sriov_vfs_port_1 = self.dut.ports_info[self.dut_ports[1]]["vfs_port"] + self.vf_ports = [self.sriov_vfs_port_0[0].pci, self.sriov_vfs_port_1[0].pci] + for port in self.sriov_vfs_port_0 + self.sriov_vfs_port_1: + port.bind_driver(self.drivername) + + # set vf mac address + self.dut.send_expect( + "ip link set %s vf 0 mac %s" + % (self.dut.ports_info[self.dut_ports[0]]["intf"], VF_MAC_ADDR_port0), + "# ", + ) + self.dut.send_expect( + "ip link set %s vf 0 mac %s" + % (self.dut.ports_info[self.dut_ports[1]]["intf"], VF_MAC_ADDR_port1), + "# ", + ) + # the cases use the first two ports + port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) + cores = self.dut.get_core_list(self.core_config, socket=self.ports_socket) + eal_params = self.dut.create_eal_parameters(cores=cores, ports=self.vf_ports) + for queues in self.test_queues: + command_line = "./%s %s -- -q %s -p %s &" % ( + self.app_l2fwd_path, + eal_params, + str(queues["queues"]), + port_mask, + ) + self.dut.send_expect(command_line, "L2FWD: entering main loop", 60) + # Trigger the packet generator of bursting packets from ``port A``, then check if + # ``port 0`` could receive them and ``port 1`` could forward them back. + tgen_input = [] + tx_port = self.tester.get_local_port(self.dut_ports[0]) + rx_port = self.tester.get_local_port(self.dut_ports[1]) + self.tester.is_interface_up(self.tester.get_interface(rx_port)) + tgen_input.append((tx_port, rx_port)) + self.logger.info("check port A -> port 0 -> port 1 -> port B") + result_B = self.tester.check_random_pkts( + tgen_input, + allow_miss=False, + params=[("ether", {"dst": "%s" % (VF_MAC_ADDR_port0)})], + ) + # trigger the packet generator of bursting packets from ``port B``, then + # check if ``port 1`` could receive them and ``port 0`` could forward them back. + tgen_input = [] + rx_port = self.tester.get_local_port(self.dut_ports[0]) + tx_port = self.tester.get_local_port(self.dut_ports[1]) + tgen_input.append((tx_port, rx_port)) + self.logger.info("check port B -> port 1 -> port 0 -> port A") + result_A = self.tester.check_random_pkts( + tgen_input, + allow_miss=False, + params=[("ether", {"dst": "%s" % (VF_MAC_ADDR_port1)})], + ) + + self.verify(result_B != False, "result_B Packet integrity check failed") + self.verify(result_A != False, "result_A Packet integrity check failed") + + self.quit_l2fwd() + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.send_expect("fg", "l2fwd|# ", 5) + self.dut.send_expect("^C", "# ", 5) + + def tear_down_all(self): + """ + Run after each test suite. + """ + pass