From patchwork Tue Sep 20 04:19:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaqi Tang X-Patchwork-Id: 116464 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 00051A00C4; Tue, 20 Sep 2022 06:19:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEE22410E8; Tue, 20 Sep 2022 06:19:15 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id CC9CB4021D for ; Tue, 20 Sep 2022 06:19:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663647555; x=1695183555; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4unwnCwHBuc7FKRYaOmnCosCGPiXeD2feyYflHMkQuU=; b=jLY3X+kLrHFg6hBehPlNiyb2jvtHxIRWiho0nWKAKsdyiqdS6378GIMf jEDce63DzcddUMr6JKNEi/YsNZ8Ld6mNkELL+KqVlDsOxRbGWCHg2tNTW Ggrk08xgohgfo9iGjfWh3iZovrrlHY7AEwS+KCIVwC+Es5VtrplL2pCgV 5YnPAc8Vbpuj6L/9IFd18wsEXLoAvxNjsfzSuhE8HKeKtvG7h7Wfs6ORd VTY7yk44iC3w+gCGJk9Bi6rtTm2FUwPJL1T4+BuTr38P8k4Ho3NV35x/B XBb15pXxiqEGfm4Ea2fKCC+wtsAj2l+r5IfrGtNEDe9N1rRMSjjldWa/2 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="385878580" X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="385878580" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 21:19:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="687245978" Received: from dpdk-yaqi.sh.intel.com ([10.67.119.213]) by fmsmga004.fm.intel.com with ESMTP; 19 Sep 2022 21:19:13 -0700 From: Yaqi Tang To: dts@dpdk.org Cc: Yaqi Tang Subject: [dts][PATCH V3 1/3] test_plans/index: add new test plan for ice_rx_timestamp Date: Tue, 20 Sep 2022 04:19:05 +0000 Message-Id: <20220920041907.301814-2-yaqi.tang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220920041907.301814-1-yaqi.tang@intel.com> References: <20220920041907.301814-1-yaqi.tang@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 Add new test plan for ice support rx timestamp on flex descriptor. Signed-off-by: Yaqi Tang --- test_plans/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/test_plans/index.rst b/test_plans/index.rst index 8e2634bd..5fc3b4ed 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -37,6 +37,7 @@ The following are the test plans for the DPDK DTS automated test system. ice_dcf_qos_test_plan ice_ecpri_test_plan ice_fdir_test_plan + ice_rx_timestamp_test_plan ice_ip_fragment_rte_flow_test_plan ice_iavf_ip_fragment_rte_flow_test_plan ice_iavf_packet_pacing_test_plan From patchwork Tue Sep 20 04:19:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yaqi Tang X-Patchwork-Id: 116465 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 D6CCAA00C3; Tue, 20 Sep 2022 06:19:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1CF5410D0; Tue, 20 Sep 2022 06:19:17 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id CBC394021D for ; Tue, 20 Sep 2022 06:19:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663647557; x=1695183557; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EHXP5QFyerjiPTnkzJ+FohNlgHN/nXkH0HicBu05PKw=; b=O7hXonOh2OgTzREjeQ3CS3cWwy6QgREmgCYZ8tEGR2jxIZRAHTW9nT4o QnuIlwJH8P0vuBJ4h6Dw/8JHTRRw1VzAB/GwbUvxY5zUOcy5q41FEGg6Y 3XNmEO7SyYdydr4IaE/q34xEOvl3PT9j6s2F7KPD+wbfNmcuSxfhAiNGr yqm2dN98uCmx7JJIdxDRMjK2TBbZyGXC2rFzoFZ7Fyt0DLvd2uTwk9Udf OCnR/BV+og1pwwmSxsx2mw5gv9wRZZWIjltLdJa0lbzEMdgWzXQdHYQW+ +ZOUYechkRyV7zW9BPp1dF7YJ2SA7wmWKL2kd8+j9WkM1w+Bw3MwWpwPG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="385878581" X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="385878581" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 21:19:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="687245983" Received: from dpdk-yaqi.sh.intel.com ([10.67.119.213]) by fmsmga004.fm.intel.com with ESMTP; 19 Sep 2022 21:19:15 -0700 From: Yaqi Tang To: dts@dpdk.org Cc: Yaqi Tang Subject: [dts][PATCH V3 2/3] test_plans/ice_rx_timestamp: ice support rx timestamp Date: Tue, 20 Sep 2022 04:19:06 +0000 Message-Id: <20220920041907.301814-3-yaqi.tang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220920041907.301814-1-yaqi.tang@intel.com> References: <20220920041907.301814-1-yaqi.tang@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 The PF driver is able to enable rx timestamp offload. Signed-off-by: Yaqi Tang --- test_plans/ice_rx_timestamp_test_plan.rst | 156 ++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 test_plans/ice_rx_timestamp_test_plan.rst diff --git a/test_plans/ice_rx_timestamp_test_plan.rst b/test_plans/ice_rx_timestamp_test_plan.rst new file mode 100644 index 00000000..3fc48f29 --- /dev/null +++ b/test_plans/ice_rx_timestamp_test_plan.rst @@ -0,0 +1,156 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2022 Intel Corporation + +======================== +ICE Support Rx Timestamp +======================== + +Description +=========== +The PF driver is able to enable rx timestamp offload, the 64 bits timestamp is able +to extracted from the flexible Rx descriptor and be stored in mbuf's dynamic field. +The received packets have timestamp values, and the timestamp values are incremented. + +Prerequisites +============= + +Topology +-------- +DUT port 0 <----> Tester port 0 + +Hardware +-------- +Supported NICs: IntelĀ® Ethernet 800 Series E810-XXVDA4/E810-CQ + +Software +-------- +dpdk: http://dpdk.org/git/dpdk +scapy: http://www.secdev.org/projects/scapy/ + +General Set Up +-------------- +1. Compile DPDK:: + + # CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib --default-library=static + # ninja -C -j 110 + +2. Get the pci device id and interface of DUT and tester. + For example, 0000:3b:00.0 and 0000:3b:00.1 is pci device id, + ens785f0 and ens785f1 is interface:: + + # ./usertools/dpdk-devbind.py -s + + 0000:3b:00.0 'Device 159b' if=ens785f0 drv=ice unused=vfio-pci + 0000:3b:00.1 'Device 159b' if=ens785f1 drv=ice unused=vfio-pci + +3. Bind the DUT port to dpdk:: + + # ./usertools/dpdk-devbind.py -b vfio-pci + +Test Case +========= +Common Steps +------------ +All the packets in this test plan use below settings: +dst mac: 68:05:CA:C1:BA:28 +ipv4 src: 192.168.0.2 +ipv4 dst: 192.168.0.3 +ipv6 src: 2001::2 +ipv6 dst: 2001::3 +sport: 1026 +dport: 1027 +count: 3 + +1. Set fwd engine:: + + testpmd> set fwd rxonly + +2. Set verbose:: + + testpmd> set verbose 1 + +3. Start testpmd:: + + testpmd> start + +4. Send ether packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/("X"*480)], iface="",count=) + +5. Send ipv4 packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IP(src="",dst="")/("X"*480)], iface="",count=) + +6. Send ipv6 packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IPv6(src="",dst="")/("X"*480)], iface="",count=) + +7. Send ipv4-udp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IP(src="",dst="")/UDP(sport=, dport=)/("X"*480)], iface="",count=) + +8. Send ipv6-udp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IPv6(src="",dst="")/UDP(sport=, dport=)/("X"*480)], iface="",count=) + +9. Send ipv4-tcp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IP(src="",dst="")/TCP(sport=, dport=)/("X"*480)], iface="",count=) + +10. Send ipv6-tcp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IPv6(src="",dst="")/TCP(sport=, dport=)/("X"*480)], iface="",count=) + +11. Send ipv4-sctp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IP(src="",dst="")/SCTP(sport=, dport=)/("X"*480)], iface="",count=) + +12. Send ipv6-sctp packets, record the timestamp values and check the timestamp values are incremented:: + + >>> sendp([Ether(dst="")/IPv6(src="",dst="")/SCTP(sport=, dport=)/("X"*480)], iface="",count=) + +Test Case 1: Without timestamp, check no timestamp +-------------------------------------------------- +This case is designed to check no timestamp value while testpmd not enable rx timestamp. + +Test Steps +~~~~~~~~~~ +1. Start testpmd with different command line:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c f -n 4 -a 3b:00.0 -- -i --rxq=16 --txq=16 + +2. Send packets as common steps, check no timestamp value. + +Test Case 2: Single queue With timestamp, check timestamp +--------------------------------------------------------- +This case is designed to check single queue has timestamp values and the timestamp values are incremented. + +Test Steps +~~~~~~~~~~ +1. Start testpmd with different command line:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c f -n 4 -a 3b:00.0 -- -i --enable-rx-timestamp + +2. Send packets as common steps, check single queue has timestamp values and the timestamp values are incremented. + + testpmd> port 0/queue 0: received 1 packets + src=00:00:00:02:00:00 - dst=68:05:CA:C1:BA:28 - type=0x9000 - length=494 - nb_segs=1 - timestamp 1663643637602717932 - hw ptype: L2_ETHER - sw ptype: L2_ETHER - l2_len=14 - Receive queue=0x0 + ol_flags: RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN + port 0/queue 0: received 1 packets + src=00:00:00:02:00:00 - dst=68:05:CA:C1:BA:28 - type=0x9000 - length=494 - nb_segs=1 - timestamp 1663643637602871904 - hw ptype: L2_ETHER - sw ptype: L2_ETHER - l2_len=14 - Receive queue=0x0 + ol_flags: RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN + port 0/queue 0: received 1 packets + src=00:00:00:02:00:00 - dst=68:05:CA:C1:BA:28 - type=0x9000 - length=494 - nb_segs=1 - timestamp 1663643637603018449 - hw ptype: L2_ETHER - sw ptype: L2_ETHER - l2_len=14 - Receive queue=0x0 + ol_flags: RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN + +Test Case 3: Multi queues With timestamp, check timestamp +--------------------------------------------------------- +This case is designed to check multi queues have timestamp values and the timestamp values are incremented. + +Test Steps +~~~~~~~~~~ +1. Start testpmd with different command line:: + + ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c f -n 4 -a 3b:00.0 -- -i --rxq=16 --txq=16 --enable-rx-timestamp + +2. Send packets as common steps, check multi queues have timestamp values and the timestamp values are incremented. From patchwork Tue Sep 20 04:19:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaqi Tang X-Patchwork-Id: 116466 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 046B2A00C3; Tue, 20 Sep 2022 06:19:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0002A41614; Tue, 20 Sep 2022 06:19:19 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A36F24021D for ; Tue, 20 Sep 2022 06:19:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663647558; x=1695183558; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mhk6S7W4+F9bA32Zb7K4UYko5RaAcOdAOOEXBCOPRbE=; b=WsWxNY+IYSydaO7a1Lqrnr396yQKA6zvTK2v0LPHsM+GSaAtV846/9Lf 5nvkps1/c1/apHaxYfG/F6gNhAoB6cYqcv/oxeOHDU3w0rY9P4kNUV1lf ExlQzVW+IIrbkZfx7dPbVM/Ox0ExnfkDTkq51/0C3i4wlPMeMm37qoQop GNfbJoGlGkFG8BIEgFyWdl7UCpR7DXzB4Np3HlMo6S8kNCJxpe01DXlUb LmNMhj1SoE9Kf7HEMul6QO2aNJp4qroQT7jE9q6eEzSkPjZVu6iiLjGtM DXhuw4rr6cCUC6VSpxbzQeHv7EXJjgg30KDPm3tc7fnwRYD/xKyyqvXiI w==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="385878584" X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="385878584" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 21:19:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,329,1654585200"; d="scan'208";a="687245991" Received: from dpdk-yaqi.sh.intel.com ([10.67.119.213]) by fmsmga004.fm.intel.com with ESMTP; 19 Sep 2022 21:19:17 -0700 From: Yaqi Tang To: dts@dpdk.org Cc: Yaqi Tang Subject: [dts][PATCH V3 3/3] tests/ice_rx_timestamp: ice support rx timestamp Date: Tue, 20 Sep 2022 04:19:07 +0000 Message-Id: <20220920041907.301814-4-yaqi.tang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220920041907.301814-1-yaqi.tang@intel.com> References: <20220920041907.301814-1-yaqi.tang@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 The PF driver is able to enable rx timestamp offload. Signed-off-by: Yaqi Tang Reviewed-by: Lijuan Tu Acked-by: Lijuan Tu --- tests/TestSuite_ice_rx_timestamp.py | 193 ++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 tests/TestSuite_ice_rx_timestamp.py diff --git a/tests/TestSuite_ice_rx_timestamp.py b/tests/TestSuite_ice_rx_timestamp.py new file mode 100644 index 00000000..9d86edb9 --- /dev/null +++ b/tests/TestSuite_ice_rx_timestamp.py @@ -0,0 +1,193 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation +# + +import copy +import os +import re +import time + +from framework.packet import Packet +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase +from framework.utils import GREEN, RED + +tv_packets_basic = { + "tv_mac": 'Ether(dst="68:05:CA:C1:BA:28")/("X"*480)', + "tv_mac_ipv4": 'Ether(dst="68:05:CA:C1:BA:28")/IP(src="192.168.0.2",dst="192.168.0.3")/("X"*480)', + "tv_mac_ipv6": 'Ether(dst="68:05:CA:C1:BA:28")/IPv6(src="2001::2", dst="2001::3")/("X"*480)', + "tv_mac_ipv4_udp": 'Ether(dst="68:05:CA:C1:BA:28")/IP(src="192.168.0.2", dst="192.168.0.3")/UDP(sport=1026, dport=1027)/("X"*480)', + "tv_mac_ipv6_udp": 'Ether(dst="68:05:CA:C1:BA:28")/IPv6(src="2001::2", dst="2001::3")/UDP(sport=1026, dport=1027)/("X"*480)', + "tv_mac_ipv4_tcp": 'Ether(dst="68:05:CA:C1:BA:28")/IP(src="192.168.0.2", dst="192.168.0.3")/TCP(sport=1026, dport=1027)/("X"*480)', + "tv_mac_ipv6_tcp": 'Ether(dst="68:05:CA:C1:BA:28")/IPv6(src="2001::2", dst="2001::3")/TCP(sport=1026, dport=1027)/("X"*480)', + "tv_mac_ipv4_sctp": 'Ether(dst="68:05:CA:C1:BA:28")/IP(src="192.168.0.2", dst="192.168.0.3")/SCTP(sport=1026, dport=1027)/("X"*480)', + "tv_mac_ipv6_sctp": 'Ether(dst="68:05:CA:C1:BA:28")/IPv6(src="2001::2", dst="2001::3")/SCTP(sport=1026, dport=1027)/("X"*480)', +} + +command_line_option_with_timestamp = { + "port_id": 0, + "test": [ + { + "send_packet": tv_packets_basic["tv_mac"], + "action": {"check_timestamp": "ether"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv4"], + "action": {"check_timestamp": "ipv4"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv6"], + "action": {"check_timestamp": "ipv6"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv4_udp"], + "action": {"check_timestamp": "ipv4-udp"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv6_udp"], + "action": {"check_timestamp": "ipv6-udp"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv4_tcp"], + "action": {"check_timestamp": "ipv4-tcp"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv6_tcp"], + "action": {"check_timestamp": "ipv6-tcp"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv4_sctp"], + "action": {"check_timestamp": "ipv4-sctp"}, + }, + { + "send_packet": tv_packets_basic["tv_mac_ipv6_sctp"], + "action": {"check_timestamp": "ipv6-sctp"}, + }, + ], +} + + +class TimestampConfigureTest(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + Generic filter Prerequistites + """ + self.verify( + self.nic in ["ICE_25G-E810C_SFP", "ICE_100G-E810C_QSFP"], + "%s nic not support timestamp" % self.nic, + ) + self.dut_ports = self.dut.get_ports(self.nic) + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + # Verify that enough ports are available + self.verify(len(self.dut_ports) >= 1, "Insufficient ports") + self.tester_port0 = self.tester.get_local_port(self.dut_ports[0]) + self.tester_iface0 = self.tester.get_interface(self.tester_port0) + self.pkt = Packet() + self.pmdout = PmdOutput(self.dut) + self.pf_pci = self.dut.ports_info[self.dut_ports[0]]["pci"] + + def set_up(self): + """ + Run before each test case. + """ + pass + + def launch_testpmd(self, line_option=""): + """ + start testpmd + """ + # Prepare testpmd EAL and parameters + self.pmdout.start_testpmd( + param=line_option, + eal_param=f"-a {self.pf_pci}", + socket=self.ports_socket, + ) + # test link status + res = self.pmdout.wait_link_status_up("all", timeout=15) + self.verify(res is True, "there have port link is down") + self.pmdout.execute_cmd("set fwd rxonly") + self.pmdout.execute_cmd("set verbose 1") + self.pmdout.execute_cmd("start") + + def check_timestamp_increment(self, out): + timestamps = self.get_timestamp(out) + if len(timestamps) == 0: + error_msg = "There is no timestamp value" + self.logger.error(error_msg) + self.error_msgs.append(error_msg) + else: + for i in range(len(timestamps) - 1): + if timestamps[i + 1] <= timestamps[i]: + error_msg = "The timestamp values should be increment" + self.logger.error(error_msg) + self.error_msgs.append(error_msg) + + def check_no_timestamp(self, out): + timestamps = self.get_timestamp(out) + if len(timestamps) != 0: + error_msg = "The timestamp value should be empty" + self.logger.error(error_msg) + self.error_msgs.append(error_msg) + + def send_pkt_get_output(self, pkts, port_id=0, count=3): + self.logger.info("----------send packet-------------") + self.logger.info("{}".format(pkts)) + self.pkt.update_pkt(pkts) + self.pkt.send_pkt(crb=self.tester, tx_port=self.tester_iface0, count=count) + out = self.pmdout.get_output(timeout=1) + pkt_pattern = ( + "port\s%d/queue\s\d+:\sreceived\s(\d+)\spackets.+?\n.*length=\d{2,}\s" + % port_id + ) + reveived_data = re.findall(pkt_pattern, out) + reveived_pkts = sum(map(int, [i[0] for i in reveived_data])) + return out + + def get_timestamp(self, out): + timestamp_pat = ".*timestamp\s(\w+)" + timestamp_infos = re.findall(timestamp_pat, out, re.M) + timestamp_infos = list(map(int, timestamp_infos)) + self.logger.info("timestamp_infos: {}".format(timestamp_infos)) + return timestamp_infos + + def handle_timestamp_case(self, case_info, enable_timestamp=True): + self.error_msgs = [] + out = "" + # handle tests + tests = case_info["test"] + for test in tests: + if "send_packet" in test: + out = self.send_pkt_get_output(test["send_packet"]) + if "action" in test: + if enable_timestamp: + self.check_timestamp_increment(out) + else: + self.check_no_timestamp(out) + self.verify(not self.error_msgs, "some cases failed") + + def test_without_timestamp(self): + self.launch_testpmd(line_option="--rxq=16 --txq=16") + self.handle_timestamp_case( + command_line_option_with_timestamp, enable_timestamp=False + ) + + def test_single_queue_with_timestamp(self): + self.launch_testpmd(line_option="--enable-rx-timestamp") + self.handle_timestamp_case(command_line_option_with_timestamp) + + def test_multi_queues_with_timestamp(self): + self.launch_testpmd(line_option="--rxq=16 --txq=16 --enable-rx-timestamp") + self.handle_timestamp_case(command_line_option_with_timestamp) + + def tear_down(self): + """ + Run after each test case. + """ + self.pmdout.execute_cmd("quit", "#") + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.kill_all()