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 7EF8EA0547; Mon, 5 Dec 2022 10:56:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 615B440F18; Mon, 5 Dec 2022 10:56:10 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 50CD540A87 for ; Mon, 5 Dec 2022 10:56:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670234168; x=1701770168; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4UMCGlb9nbX8r4TqvOV+STB1mTtw1Iw82iDoBgL02oM=; b=bkz0B/jmsP1ykyLxtnReaKBAMpJB3hwX4IIrnnzyvw/j6qSF0vSPvlmk v+27IUbyaGOwhV1QIKfEsX72irERKtEfEw++8tRVSMMWqxDdpfGnSbTq5 HUbyedYcBIjpK3ul064huERH/a5Rf+zaR+Hu7UUJEDpDzIqSLIHr0S66r 32/hm84lzSYNXl2aWOfC06ctEL1T9HSDs9wue9448W5o1Ny/FBoY02JYG R3Ohf1grwg2AHOW62TZV5+zQTS20CHsbX6VRP3eXDWJnRJe+dzrgmeo2G mnxaDi/ZkP0EBY9WavbiZ3+n4LusJX9WO1bCYMfEXo26w+nNfSigiDE6Y A==; X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="313956563" X-IronPort-AV: E=Sophos;i="5.96,219,1665471600"; d="scan'208";a="313956563" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 01:56:07 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="974626459" X-IronPort-AV: E=Sophos;i="5.96,219,1665471600"; d="scan'208";a="974626459" Received: from unknown (HELO localhost.localdomain) ([10.239.252.248]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 01:56:05 -0800 From: Weiyuan Li To: dts@dpdk.org Cc: Weiyuan Li Subject: [dts][PATCH V1] tests/*: optimized and add more test points Date: Mon, 5 Dec 2022 17:55:56 +0800 Message-Id: <20221205095556.16862-1-weiyuanx.li@intel.com> X-Mailer: git-send-email 2.27.0 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 --- tests/TestSuite_stats_checks.py | 123 ++++++++++++++++++++++++++++---- 1 file changed, 110 insertions(+), 13 deletions(-) diff --git a/tests/TestSuite_stats_checks.py b/tests/TestSuite_stats_checks.py index f81d284e..7c2e6802 100644 --- a/tests/TestSuite_stats_checks.py +++ b/tests/TestSuite_stats_checks.py @@ -23,7 +23,26 @@ 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", +] class TestStatsChecks(TestCase): @@ -99,6 +118,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 judgment 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 +144,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 = [ @@ -175,7 +208,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 +223,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 +233,86 @@ class TestStatsChecks(TestCase): == stats_data[tx_port]["TX-bytes"], "pkt recieve or transport bytes error!", ) + # add judgment 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!", + ) + 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!", + ) + 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): @@ -300,7 +395,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 +405,7 @@ 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") + 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.27.0