From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 561B6A00C5; Mon, 26 Dec 2022 07:53:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5196140E2D; Mon, 26 Dec 2022 07:53:13 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 625E940143 for ; Mon, 26 Dec 2022 07:53:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672037592; x=1703573592; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GS/E2f+VltIoT8FEamDhGqGGjmM+fSEDtv4cEARqyBQ=; b=Fx+BsthhRq5/IsEwjodp61P+pBREDYQhP68KmSjTz4DmRm65YIiaZYX3 uusBlDOjev4DpGNKDyzd2JE3r6X07tn+s2KzgFde9qb0GyrpQjsw84OCz 2xktT4OaJL6RwKVMtHzL8qIs2OW8iF8AsWi2TBCSvbq7wLsWTyQBEnsaM ZFeDIUiTWJ3Dbu9NDTPj1CklLX6UraSkdFJgaldx+OR7HAxal18NRFno3 HAJDUEQi3cyUuB1wtz4z3k0hXXuKKvfhSRJBb4TvuwBfDmglLMOKQ/3Kf WURbcBYZ6M+Pi+gU8XGJThLKWiJeF0ej+688QSUotLHVm+riTgugO9jqf g==; X-IronPort-AV: E=McAfee;i="6500,9779,10571"; a="382827602" X-IronPort-AV: E=Sophos;i="5.96,274,1665471600"; d="scan'208";a="382827602" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Dec 2022 22:53:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10571"; a="795015478" X-IronPort-AV: E=Sophos;i="5.96,274,1665471600"; d="scan'208";a="795015478" Received: from unknown (HELO dpdk-VF-dut247..) ([10.239.252.247]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Dec 2022 22:53:09 -0800 From: Weiyuan Li To: dts@dpdk.org Cc: Weiyuan Li Subject: [dts][PATCH V3] tests/stats_checks: optimized and add more test points Date: Mon, 26 Dec 2022 14:57:56 +0800 Message-Id: <20221226065756.49835-1-weiyuanx.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 judgment of rx and tx bytes by adding the test point on the suite stats_check. Signed-off-by: Weiyuan Li --- v2: -modify the test that supports IXGBE RX and TX bytes. v3: -add checking errors the status of the port. tests/TestSuite_stats_checks.py | 154 +++++++++++++++++++++++++++++--- 1 file changed, 140 insertions(+), 14 deletions(-) diff --git a/tests/TestSuite_stats_checks.py b/tests/TestSuite_stats_checks.py index f81d284e..bf5b5ae0 100644 --- a/tests/TestSuite_stats_checks.py +++ b/tests/TestSuite_stats_checks.py @@ -23,7 +23,28 @@ from framework.test_case import TestCase ETHER_HEADER_LEN = 18 IP_HEADER_LEN = 20 RANDOM_IP_POOL = ["192.168.10.222/0"] -prefix_list = ["rx_good_packets", "tx_good_packets", "rx_good_bytes", "tx_good_bytes"] +prefix_list = [ + "rx_good_packets", + "tx_good_packets", + "rx_good_bytes", + "tx_good_bytes", + "tx_size_64_packets", + "tx_size_65_to_127_packets", + "tx_size_128_to_255_packets", + "tx_size_256_to_511_packets", + "tx_size_512_to_1023_packets", + "tx_size_1024_to_1522_packets", + "tx_size_1523_to_max_packets", + "rx_size_64_packets", + "rx_size_65_to_127_packets", + "rx_size_128_to_255_packets", + "rx_size_256_to_511_packets", + "rx_size_512_to_1023_packets", + "rx_size_1024_to_1522_packets", + "rx_size_1523_to_max_packets", + "rx_size_1024_to_max_packets", # ixgbe + "tx_size_1024_to_max_packets", # ixgbe +] class TestStatsChecks(TestCase): @@ -77,6 +98,10 @@ class TestStatsChecks(TestCase): port_id, f'Ether(dst=dutmac, src="52:00:00:00:00:00")/IP()/Raw(load="\x50"*{padding})', ) + self.send_scapy_packet( + port_id, + f'Ether(dst=dutmac, src="52:00:00:00:00:00")/IP()/Raw(load="\x50"*1500)', + ) return out def send_pkt_with_random_ip(self, port, count, if_vf=False): @@ -99,6 +124,21 @@ class TestStatsChecks(TestCase): self.tester.get_local_port(self.dut_ports[0]) ), ) + tester_intf = self.tester.get_interface( + self.tester.get_local_port(self.dut_ports[0]) + ) + # enable tester mtu + tester_port = self.tester.get_local_port(self.dut_ports[0]) + self.netobj = self.tester.ports_info[tester_port]["port"] + self.netobj.enable_jumbo(framesize=3000) + # add judement on rx and tx bytes, not same on if add crc 4 bytes + packets_length = [65, 128, 256, 512, 1024, 1523] + for i in range(count): + for len in packets_length: + src_ip = self.get_random_ip() + packet1 = f'sendp([Ether(dst="{mac}", src="02:00:00:00:00:00")/IP(src="{src_ip}", dst="192.168.0.{i}")/("X"*{len})], iface="{tester_intf}")' + self.tester.scapy_append(packet1) + self.tester.scapy_execute() def send_packet_of_size_to_tx_port(self, pktsize, received=True): """ @@ -110,9 +150,8 @@ class TestStatsChecks(TestCase): rx_pkts_ori, rx_err_ori, rx_bytes_ori = [ int(_) for _ in self.get_port_status_tx(self.rx_port) ] - - out = self.send_packet_of_size_to_port(self.tx_port, pktsize) - + self.used_tester_port = self.tester.get_local_port(self.dut_ports[1]) + out = self.send_packet_of_size_to_port(self.used_tester_port, pktsize) sleep(5) tx_pkts, tx_err, tx_bytes = [ @@ -139,7 +178,7 @@ class TestStatsChecks(TestCase): tx_bytes_difference == rx_bytes_difference, "different number of bytes sent and received", ) - self.verify(tx_err_difference == 0, "unexpected tx error") + self.verify(tx_err_difference == 1, "unexpected tx error") self.verify(rx_err_difference == 0, "unexpected rx error") else: self.verify( @@ -175,7 +214,7 @@ class TestStatsChecks(TestCase): return xstats_data def verify_results( - self, xstats_data, rx_port, tx_port, stats_data={}, if_zero=False + self, xstats_data, rx_port, tx_port, if_vf, stats_data={}, if_zero=False ): if if_zero: for port in xstats_data.keys(): @@ -190,7 +229,7 @@ class TestStatsChecks(TestCase): == stats_data[rx_port]["RX-packets"] == xstats_data[tx_port]["tx_good_packets"] == stats_data[tx_port]["TX-packets"] - == 100, + == 700, "pkt recieve or transport count error!", ) self.verify( @@ -200,24 +239,98 @@ class TestStatsChecks(TestCase): == stats_data[tx_port]["TX-bytes"], "pkt recieve or transport bytes error!", ) + # add judement on rx and tx bytes, not same on if add crc 4 bytes + if not if_vf and not if_zero: + self.verify( + xstats_data[rx_port]["rx_size_64_packets"] == 100, + "rx_size_64_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[rx_port]["rx_size_65_to_127_packets"] == 100, + "rx_size_65_to_127_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[rx_port]["rx_size_128_to_255_packets"] == 100, + "rx_size_128_to_255_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[rx_port]["rx_size_256_to_511_packets"] == 100, + "rx_size_256_to_511_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[rx_port]["rx_size_512_to_1023_packets"] == 100, + "rx_size_512_to_1023_packets pkt recieve or transport bytes error!", + ) + if self.kdriver == "ixgbe": + self.verify( + xstats_data[rx_port]["rx_size_1024_to_max_packets"] == 200, + "rx_size_1024_to_max_packets pkt recieve or transport bytes error!", + ) + else: + self.verify( + xstats_data[rx_port]["rx_size_1024_to_1522_packets"] == 100, + "rx_size_1024_to_1522_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[rx_port]["rx_size_1523_to_max_packets"] == 100, + "rx_size_1523_to_max_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_64_packets"] == 100, + "tx_size_64_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_65_to_127_packets"] == 100, + "tx_size_65_to_127_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_128_to_255_packets"] == 100, + "tx_size_128_to_255_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_256_to_511_packets"] == 100, + "tx_size_256_to_511_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_512_to_1023_packets"] == 100, + "tx_size_512_to_1023_packets pkt recieve or transport bytes error!", + ) + if self.kdriver == "ixgbe": + self.verify( + xstats_data[tx_port]["tx_size_1024_to_max_packets"] == 200, + "tx_size_1024_to_max_packets pkt recieve or transport bytes error!", + ) + else: + self.verify( + xstats_data[tx_port]["tx_size_1024_to_1522_packets"] == 100, + "tx_size_1024_to_1522_packets pkt recieve or transport bytes error!", + ) + self.verify( + xstats_data[tx_port]["tx_size_1523_to_max_packets"] == 100, + "tx_size_1523_to_max_packets pkt recieve or transport bytes error!", + ) def xstats_check(self, rx_port, tx_port, if_vf=False): self.exec("port config all rss all") self.exec("set fwd mac") self.exec("clear port xstats all") org_xstats = self.get_xstats([rx_port, tx_port]) - self.verify_results(org_xstats, rx_port, tx_port, if_zero=True) + self.verify_results(org_xstats, rx_port, tx_port, if_vf, if_zero=True) final_xstats, stats_data = self.sendpkt_get_xstats(rx_port, tx_port, if_vf) - self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data) + self.verify_results( + final_xstats, rx_port, tx_port, if_vf, stats_data=stats_data + ) self.exec("clear port stats all") clear_stats = self.get_xstats([rx_port, tx_port]) - self.verify_results(clear_stats, rx_port, tx_port, if_zero=True) + self.verify_results(clear_stats, rx_port, tx_port, if_vf, if_zero=True) final_xstats, stats_data = self.sendpkt_get_xstats(rx_port, tx_port, if_vf) - self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data) + self.verify_results( + final_xstats, rx_port, tx_port, if_vf, stats_data=stats_data + ) self.exec("clear port xstats all") clear_xstats = self.get_xstats([rx_port, tx_port]) - self.verify_results(clear_xstats, rx_port, tx_port, if_zero=True) + self.verify_results(clear_xstats, rx_port, tx_port, if_vf, if_zero=True) self.pmdout.quit() def sendpkt_get_xstats(self, rx_port, tx_port, if_vf): @@ -257,11 +370,16 @@ class TestStatsChecks(TestCase): This is to clear up environment before the case run. """ self.dut.kill_all() + # enable tester mtu + tester_port = self.tester.get_local_port(self.dut_ports[0]) + self.netobj = self.tester.ports_info[tester_port]["port"] + self.netobj.enable_jumbo(framesize=3000) def tear_down(self): """ Run after each test case. """ + self.netobj.enable_jumbo(framesize=1500) self.dut.kill_all() if self._suite_result.test_case == "test_xstats_check_vf": self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0]) @@ -300,7 +418,7 @@ class TestStatsChecks(TestCase): self.pmdout.quit() def test_xstats_check_pf(self): - self.pmdout.start_testpmd("default", "--rxq=4 --txq=4") + self.pmdout.start_testpmd("default", "--rxq=4 --txq=4 --max-pkt-len=9000") self.xstats_check(self.rx_port, self.tx_port) def test_xstats_check_vf(self): @@ -310,5 +428,13 @@ class TestStatsChecks(TestCase): self.vf_port = self.dut.ports_info[self.dut_ports[0]]["vfs_port"][0] self.vf_port.bind_driver(driver="vfio-pci") self.vf_port_pci = self.dut.ports_info[self.dut_ports[0]]["sriov_vfs_pci"][0] - self.launch_testpmd(dcf_flag=self.dcf_mode, param="--txq=4 --rxq=4") + if self.kdriver == "ixgbe": + self.dut.send_expect( + f'ifconfig {self.dut.ports_info[0]["intf"]} mtu 3000', "# " + ) + self.launch_testpmd(dcf_flag=self.dcf_mode, param="--txq=4 --rxq=4") + else: + self.launch_testpmd( + dcf_flag=self.dcf_mode, param="--txq=4 --rxq=4 --max-pkt-len=9000" + ) self.xstats_check(0, 0, if_vf=True) -- 2.18.2