From patchwork Wed Nov 24 08:33:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 104649 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 61BAAA0C52; Wed, 24 Nov 2021 09:34:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C24240A4B; Wed, 24 Nov 2021 09:34:19 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 6A27240688 for ; Wed, 24 Nov 2021 09:34:17 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="259117443" X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="259117443" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 00:34:16 -0800 X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="509789008" Received: from unknown (HELO localhost.localdomain) ([10.240.183.163]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 24 Nov 2021 00:34:04 -0800 From: Yu Jiang To: xueqin.lin@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1] Optimize script: wait_link_status_up after start testpmd Date: Wed, 24 Nov 2021 16:33:40 +0800 Message-Id: <1637742820-28741-1-git-send-email-yux.jiang@intel.com> X-Mailer: git-send-email 2.7.4 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 optimize script: checksum_offload/flow_classify_softnic/nvgre/vlan/vlan_ethertype_config/vxlan, wait_link_status_up after start testpmd or before send_packets to enhance script robustness Signed-off-by: Yu Jiang --- tests/TestSuite_checksum_offload.py | 4 ++-- tests/TestSuite_flow_classify_softnic.py | 2 ++ tests/TestSuite_nvgre.py | 5 +++-- tests/TestSuite_vlan.py | 1 + tests/TestSuite_vlan_ethertype_config.py | 2 +- tests/TestSuite_vxlan.py | 18 +++++++++++------- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 3338e33..f8b26ef 100644 --- a/tests/TestSuite_checksum_offload.py +++ b/tests/TestSuite_checksum_offload.py @@ -671,7 +671,7 @@ class TestChecksumOffload(TestCase): self.tester.send_expect("scapy", ">>>") self.checksum_enablehw(self.dut_ports[0]) self.dut.send_expect("start", "testpmd>") - + self.pmdout.wait_link_status_up(self.dut_ports[0]) verification_errors: List[VerifyFailure] = [] iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) @@ -701,7 +701,7 @@ class TestChecksumOffload(TestCase): def test_hardware_checksum_check_ip_tx(self): self.checksum_enablehw(self.dut_ports[0]) self.dut.send_expect("start", "testpmd>") - + self.pmdout.wait_link_status_up(self.dut_ports[0]) verification_errors: List[VerifyFailure] = [] iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) diff --git a/tests/TestSuite_flow_classify_softnic.py b/tests/TestSuite_flow_classify_softnic.py index a2c15dc..7b6642d 100644 --- a/tests/TestSuite_flow_classify_softnic.py +++ b/tests/TestSuite_flow_classify_softnic.py @@ -179,6 +179,7 @@ class TestFlowClassifySoftnic(TestCase): Sent pkts that read from the pcap_file. Return the sniff pkts. """ + self.pmdout.wait_link_status_up(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[from_port%self.port_num]) rx_port = self.tester.get_local_port(self.dut_ports[to_port%self.port_num]) @@ -283,6 +284,7 @@ class TestFlowClassifySoftnic(TestCase): """ Sends continuous packets. """ + self.pmdout.wait_link_status_up(self.dut_ports[0]) self.tester.scapy_foreground() time.sleep(2) if src_dst == "src": diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py index 63b95d1..4472d20 100644 --- a/tests/TestSuite_nvgre.py +++ b/tests/TestSuite_nvgre.py @@ -51,7 +51,6 @@ from scapy.layers.sctp import SCTP, SCTPChunkData from scapy.route import * from scapy.sendrecv import sniff from scapy.utils import rdpcap, socket, struct, wrpcap - import framework.utils as utils from framework.packet import IncreaseIP, IncreaseIPv6 from framework.pmd_output import PmdOutput @@ -499,6 +498,7 @@ class TestNvgre(TestCase): config.outer_mac_dst = self.dut_rx_port_mac config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_rx_port) config.send_pcap() # check whether detect nvgre type out = self.dut.get_session_output() @@ -523,6 +523,7 @@ class TestNvgre(TestCase): # send nvgre packet config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_rx_port) config.send_pcap() out = self.dut.get_session_output() print(out) @@ -595,7 +596,7 @@ class TestNvgre(TestCase): self.logger.info("nvgre packet %s" % arg_str) out = self.dut.send_expect("start", "testpmd>", 10) - + self.pmdout.wait_link_status_up(self.dut_rx_port) # create pcap file with supplied arguments config = NvgreTestConfig(self, **kwargs) config.outer_mac_dst = self.dut_rx_port_mac diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py index b8cbf8c..8318b76 100644 --- a/tests/TestSuite_vlan.py +++ b/tests/TestSuite_vlan.py @@ -90,6 +90,7 @@ class TestVlan(TestCase): """ Send $num of packets to portid, if vid is -1, it means send a packet which does not include a vlan id. """ + self.pmdout.wait_link_status_up(dutRxPortId) # The package stream : testTxPort->dutRxPort->dutTxport->testRxPort port = self.tester.get_local_port(dutRxPortId) self.txItf = self.tester.get_interface(port) diff --git a/tests/TestSuite_vlan_ethertype_config.py b/tests/TestSuite_vlan_ethertype_config.py index 5e3ed81..fc0d494 100644 --- a/tests/TestSuite_vlan_ethertype_config.py +++ b/tests/TestSuite_vlan_ethertype_config.py @@ -106,7 +106,7 @@ class TestVlanEthertypeConfig(TestCase): """ if vid is -1, it means send pakcage not include vlan id. """ - + self.pmdout.wait_link_status_up(dutRxPortId) self.tpid_ori_file = "/tmp/tpid_ori.pcap" self.tpid_new_file = "/tmp/tpid_new.pcap" self.tester.send_expect("rm -rf /tmp/tpid_ori.pcap", "# ") diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py index 1442578..9605c89 100644 --- a/tests/TestSuite_vxlan.py +++ b/tests/TestSuite_vxlan.py @@ -472,8 +472,8 @@ class TestVxlan(TestCase): config.outer_mac_dst = self.dut_port_mac config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_port) config.send_pcap(self.tester_iface) - # check whether detect vxlan type out = self.dut.get_session_output(timeout=2) print(out) @@ -572,6 +572,7 @@ class TestVxlan(TestCase): # send vxlan packet config.create_pcap() self.dut.send_expect("start", "testpmd>", 10) + self.pmdout.wait_link_status_up(self.dut_port) config.send_pcap(self.tester_iface) out = self.dut.get_session_output(timeout=2) print(out) @@ -606,7 +607,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set verbose 1", "testpmd>", 10) self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) - + self.pmdout.wait_link_status_up(self.dut_port) # check normal packet self.send_and_detect(outer_udp_dst=1234) # check vxlan + UDP inner packet @@ -642,7 +643,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set verbose 1", "testpmd>", 10) self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) - + self.pmdout.wait_link_status_up(self.dut_port) # check normal ipv6 packet self.send_and_detect(outer_ip6_src="FE80:0:0:0:0:0:0:0", outer_ip6_dst="FE80:0:0:0:0:0:0:1", @@ -692,7 +693,7 @@ class TestVxlan(TestCase): self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) - + self.pmdout.wait_link_status_up(self.dut_port) # check normal packet + ip checksum invalid self.send_and_check(outer_ip_invalid=1, outer_udp_dst=1234) # check vxlan packet + inner ip checksum invalid @@ -754,6 +755,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set fwd csum", "testpmd>", 10) self.csum_set_type('outer-ip', self.recv_port) self.csum_set_type('udp', self.recv_port) + self.csum_set_type('outer-udp', self.recv_port) self.csum_set_type('tcp', self.recv_port) self.csum_set_type('sctp', self.recv_port) self.dut.send_expect("csum parse-tunnel on %d" % @@ -761,7 +763,7 @@ class TestVxlan(TestCase): self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) - + self.pmdout.wait_link_status_up(self.dut_port) # check normal ipv6 packet self.send_and_check(outer_ip6_src="FE80:0:0:0:0:0:0:0", outer_ip6_dst="FE80:0:0:0:0:0:0:1") @@ -821,7 +823,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set verbose 1", "testpmd>", 10) self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) - + self.pmdout.wait_link_status_up(self.dut_port) config = VxlanTestConfig(self) config_vlan = VxlanTestConfig(self, inner_vlan=1) config.outer_mac_dst = self.dut_port_mac @@ -892,6 +894,7 @@ class TestVxlan(TestCase): self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) + self.pmdout.wait_link_status_up(self.dut_port) rule = 'flow create {} ingress pattern eth / ipv4 / udp / vxlan vni is {} / eth dst is {} / end actions pf ' \ '/ queue index {} / end'.format(self.dut_port, config.vni, @@ -1048,7 +1051,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set fwd io", "testpmd>", 10) self.dut.send_expect("start", "testpmd>", 10) - + self.pmdout.wait_link_status_up(self.dut_port) if BIDIRECT: wirespeed = self.wirespeed(self.nic, PACKET_LEN, 2) else: @@ -1131,6 +1134,7 @@ class TestVxlan(TestCase): self.dut.send_expect("set fwd csum", "testpmd>", 10) self.enable_vxlan(self.dut_port) self.enable_vxlan(self.recv_port) + self.pmdout.wait_link_status_up(self.dut_port) # redirect flow to another queue by tunnel filter rule_config = {