From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6BD88A2EDB for ; Sun, 29 Sep 2019 11:36:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3A89C1F28; Sun, 29 Sep 2019 11:36:21 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 87195235 for ; Sun, 29 Sep 2019 11:36:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2019 02:36:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,562,1559545200"; d="scan'208";a="220325048" Received: from unknown (HELO dpdk-wenjielx-dtspatch135.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 29 Sep 2019 02:36:16 -0700 From: "zhu,shuai" To: dts@dpdk.org Cc: "zhu,shuai" Date: Sun, 29 Sep 2019 17:40:45 +0800 Message-Id: <1569750045-22860-1-git-send-email-shuaix.zhu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V3] tests/tso:Verify the chksum value. X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "dts" Add a new verification method. Signed-off-by: zhu,shuai --- tests/TestSuite_tso.py | 57 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 36e00fe..99f4e59 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -44,6 +44,7 @@ import os from test_case import TestCase from settings import HEADER_SIZE from pktgen import PacketGeneratorHelper +from packet import load_pcapfile, save_packets DEFAULT_MUT = 1500 TSO_MTU = 9000 @@ -116,8 +117,8 @@ class TestTSO(TestCase): """ for iface in ifaces: - command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface) - del_cmd = ('rm -f tcpdump_{0}.pcap').format(iface) + command = ('tcpdump -w /tmp/tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface) + del_cmd = ('rm -f /tmp/tcpdump_{0}.pcap').format(iface) self.tester.send_expect(del_cmd, '#') self.tester.send_expect(command, '#') @@ -145,7 +146,7 @@ class TestTSO(TestCase): will add a known MAC address for the test to look for. """ - command = ('tcpdump -A -nn -e -v -r tcpdump_{iface}.pcap 2>/dev/null | ' + + command = ('tcpdump -A -nn -e -v -r /tmp/tcpdump_{iface}.pcap 2>/dev/null | ' + 'grep -c "seq"') return self.tcpdump_command(command.format(**locals())) @@ -161,9 +162,35 @@ class TestTSO(TestCase): """ Get the length of loading_sizes """ - scanner = ('tcpdump -vv -r tcpdump_{iface}.pcap 2>/dev/null | grep "seq" | grep "length"') + scanner = ('tcpdump -vv -r /tmp/tcpdump_{iface}.pcap 2>/dev/null | grep "seq" | grep "length"') return self.tcpdump_scanner(scanner.format(**locals())) + def get_chksum_value_and_verify(self, dump_pcap, save_file, Nic_list): + self.pks = load_pcapfile(dump_pcap) + for i in range(len(self.pks)): + self.pks = load_pcapfile(dump_pcap) + pks = self.pks[i] + out = pks.pktgen.pkt.show + chksum_list = re.findall(r'chksum=(0x\w+)', str(out)) + pks.pktgen.pkt['IP'].chksum=None + if "VXLAN" in str(out): + pks.pktgen.pkt['UDP'].chksum=None + pks.pktgen.pkt['VXLAN']['IP'].chksum=None + pks.pktgen.pkt['VXLAN']['TCP'].chksum=None + elif "GRE" in str(out): + pks.pktgen.pkt['GRE']['IP'].chksum=None + pks.pktgen.pkt['GRE']['TCP'].chksum=None + save_packets(self.pks, save_file) + self.pks1 = load_pcapfile(save_file) + out1 = self.pks1[i].pktgen.pkt.show + chksum_list1 = re.findall(r'chksum=(0x\w+)', str(out1)) + self.tester.send_expect("rm -rf %s" % save_file, "#") + if self.nic in Nic_list and "VXLAN" in str(out): + self.verify(chksum_list[0] == chksum_list1[0] and chksum_list[2] == chksum_list1[2] and chksum_list[3] == chksum_list1[3], \ + "The obtained chksum value is incorrect.") + else: + self.verify(chksum_list == chksum_list1, "The obtained chksum value is incorrect.") + def test_tso(self): """ TSO IPv4 TCP, IPv6 TCP, VXLan testing @@ -210,7 +237,7 @@ class TestTSO(TestCase): for loading_size in self.loading_sizes: # IPv4 tcp test self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port info all", "testpmd> ", 120) + out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface)) out = self.tester.scapy_execute() out = self.dut.send_expect("show port stats all", "testpmd> ", 120) @@ -232,7 +259,7 @@ class TestTSO(TestCase): for loading_size in self.loading_sizes: # IPv6 tcp test self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port info all", "testpmd> ", 120) + out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) self.tester.scapy_append('sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, loading_size, tx_interface)) out = self.tester.scapy_execute() out = self.dut.send_expect("show port stats all", "testpmd> ", 120) @@ -258,6 +285,10 @@ class TestTSO(TestCase): tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) rx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1])) + Nic_list = ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g"] + save_file = "/tmp/save.pcap" + dump_pcap = "/tmp/tcpdump_%s.pcap" % rx_interface + mac = self.dut.get_mac_address(self.dut_ports[0]) cores = self.dut.get_core_list("1S/2C/2T") @@ -276,6 +307,10 @@ class TestTSO(TestCase): self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120) self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120) self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120) + if self.nic in Nic_list: + self.logger.warning("Warning: fvl serise not support outer udp.") + else: + self.dut.send_expect("csum set outer-udp hw %d" % self.dut_ports[0], "testpmd> ", 120) self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120) self.dut.send_expect("csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120) @@ -283,6 +318,10 @@ class TestTSO(TestCase): self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120) + if self.nic in Nic_list: + self.logger.warning("Warning: fvl serise not support outer udp.") + else: + self.dut.send_expect("csum set outer-udp hw %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) @@ -299,7 +338,7 @@ class TestTSO(TestCase): # Vxlan test self.tcpdump_start_sniffing([tx_interface, rx_interface]) self.load_module() - out = self.dut.send_expect("clear port info all", "testpmd> ", 120) + out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/VXLAN()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface)) out = self.tester.scapy_execute() out = self.dut.send_expect("show port stats all", "testpmd> ", 120) @@ -317,12 +356,13 @@ class TestTSO(TestCase): self.verify(int(tx_outlist[i]) == 800, "the packet segmentation incorrect, %s" % tx_outlist) if loading_size% 800 != 0: self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet segmentation incorrect, %s" % tx_outlist) + self.get_chksum_value_and_verify(dump_pcap, save_file, Nic_list) for loading_size in self.loading_sizes: # Nvgre test self.tcpdump_start_sniffing([tx_interface, rx_interface]) self.load_module() - out = self.dut.send_expect("clear port info all", "testpmd> ", 120) + out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface)) out = self.tester.scapy_execute() out = self.dut.send_expect("show port stats all", "testpmd> ", 120) @@ -340,6 +380,7 @@ class TestTSO(TestCase): self.verify(int(tx_outlist[i]) == 800, "the packet segmentation incorrect, %s" % tx_outlist) if loading_size% 800 != 0: self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet segmentation incorrect, %s" % tx_outlist) + self.get_chksum_value_and_verify(dump_pcap, save_file, Nic_list) def test_perf_TSO_2ports(self): """ -- 2.17.2