From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2964C8D95 for ; Thu, 19 Nov 2015 03:53:12 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 18 Nov 2015 18:53:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,316,1444719600"; d="scan'208";a="823669846" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 18 Nov 2015 18:53:07 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tAJ2r5dG011457; Thu, 19 Nov 2015 10:53:05 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tAJ2r2FX017027; Thu, 19 Nov 2015 10:53:04 +0800 Received: (from hengdinx@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tAJ2r248017023; Thu, 19 Nov 2015 10:53:02 +0800 From: Ding Heng To: dts@dpdk.org Date: Thu, 19 Nov 2015 10:53:01 +0800 Message-Id: <1447901581-16992-1-git-send-email-hengx.ding@intel.com> X-Mailer: git-send-email 1.7.4.1 Cc: Ding Heng Subject: [dts] [PATCH] tests TSO: Add RRC support and fix some bug 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: , X-List-Received-Date: Thu, 19 Nov 2015 02:53:13 -0000 Add RRC support and some bug fix. Use testpmd output to verify the test result instead of tcpdump, in order to avoid wrong test result caused by it. Signed-off-by: Mihcael Qiu Signed-off-by: Ding Heng diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 1f7ecd2..62cb010 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -83,7 +83,8 @@ class TestTSO(TestCase): # this feature support Fortville, Niantic self.verify(self.nic in ["kawela_2", "niantic", "bartonhills", "82545EM", "82540EM", "springfountain", "fortville_eagle", - "fortville_spirit", "fortville_spirit_single"], + "fortville_spirit", "fortville_spirit_single", + "redrockcanyou"], "NIC Unsupported: " + str(self.nic)) # Based on h/w type, choose how many ports to use @@ -98,6 +99,7 @@ class TestTSO(TestCase): self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) self.frame_sizes = [128, 1458] + self.tso_size = [256, 500, 700, 900] self.rxfreet_values = [0, 8, 16, 32, 64, 128] # self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}}, @@ -116,7 +118,7 @@ class TestTSO(TestCase): self.blacklist = "" # self.coreMask = dts.create_mask(cores) - + # This is for ipv4, for ipv6 need addtional 20 self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[ 'ip'] + HEADER_SIZE['tcp'] @@ -138,7 +140,7 @@ class TestTSO(TestCase): for iface in ifaces: command = ('tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &').format(iface) - self.tester.send_expect('rm -f tcpdump_{0}.pcap', '#').format(iface) + self.tester.send_expect(('rm -f tcpdump_{0}.pcap').format(iface), '#') self.tester.send_expect(command, '#') def tcpdump_stop_sniff(self): @@ -182,7 +184,7 @@ class TestTSO(TestCase): self.verify(cores is not None, "Insufficient cores for speed testing") self.coreMask = dts.create_mask(cores) - padding = self.frame_sizes[0] - self.headers_size + padding = [(frame_size - self.headers_size) for frame_size in self.frame_sizes] self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ") self.tester.send_expect("ip l set %s up" % tx_interface, "# ") @@ -204,41 +206,45 @@ class TestTSO(TestCase): self.dut.send_expect("csum set outer-ip 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("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect("set fwd csum", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ") self.tester.scapy_foreground() time.sleep(5) + for tso_s in self.tso_size: + self.dut.send_expect("tso set %d %d" % (tso_s, self.dut_ports[1]), "testpmd> ", 120) + self.dut.send_expect("set fwd csum", "testpmd> ", 120) + self.dut.send_expect("set promisc all off", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ") + self.dut.send_expect("clear port stats all", "testpmd> ") + + for padd in padding: + expect_rx_stats = padd/tso_s + (1 if padd % tso_s else 0) + 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, padd, tx_interface)) + self.dut.send_expect("clear port stats all", "testpmd> ") + out = self.tester.scapy_execute() + out = self.dut.send_expect("show port stats %s" % self.dut_ports[1], "testpmd> ", 120) + rx_stats = int(dts.regexp(out, "TX-packets: ([0-9]+)")) + self.verify(rx_stats == expect_rx_stats, "FAIL: For TSO size %d and packet size %d, expect rx stats = %d, but actually received %d" %(tso_s, self.headers_size + padd, expect_rx_stats, rx_stats)) + + # IPv6 tcp test + expect_rx_stats = (padd -20)/tso_s + (1 if (padd - 20) % tso_s else 0) + 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, padd - 20, tx_interface)) + self.dut.send_expect("clear port stats all", "testpmd> ") + out = self.tester.scapy_execute() + out = self.dut.send_expect("show port stats %s" % self.dut_ports[1], "testpmd> ", 120) + rx_stats = int(dts.regexp(out, "TX-packets: ([0-9]+)")) + self.verify(rx_stats == expect_rx_stats, "FAIL: For TSO size %d and packet size %d, expect rx stats = %d, but actually received %d" %(tso_s, self.headers_size + padd, expect_rx_stats, rx_stats)) - # IPv4 tcp test - - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - 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, padding, tx_interface)) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print out - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - if (rx_stats == 2): - self.verify(1, "Pass") - - # IPv6 tcp test - - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - 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, padding, tx_interface)) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print out - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - if (rx_stats == 2): - self.verify(1, "Pass") + self.dut.send_expect("stop", "testpmd> ") def test_tso_tunneling(self): """ TSO IPv4 TCP, IPv6 TCP, VXLan testing """ + # RedRockCanyou does not support Tunneling in DPDK yet. + if self.nic == "redrockcanyou": + print dts.RED("fm10k not support this case\n") + return + 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])) @@ -248,7 +254,10 @@ class TestTSO(TestCase): self.verify(cores is not None, "Insufficient cores for speed testing") self.coreMask = dts.create_mask(cores) - padding = self.frame_sizes[0] - self.headers_size + self.headers_size_vxlan = self.headers_size + HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + HEADER_SIZE['udp'] + HEADER_SIZE['vxlan'] + self.headers_size_nvgre = 2 * self.headers_size + HEADER_SIZE['nvgre'] + padding_vxlan = [(frame_size - self.headers_size_vxlan) for frame_size in self.frame_sizes] + padding_nvgre = [(frame_size - self.headers_size_nvgre) for frame_size in self.frame_sizes] self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ") self.tester.send_expect("ip l set %s up" % tx_interface, "# ") @@ -270,34 +279,39 @@ class TestTSO(TestCase): self.dut.send_expect("csum set outer-ip 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("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect("set fwd csum", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ") - self.tester.scapy_foreground() time.sleep(5) - # Vxlan test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - 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, padding, tx_interface)) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print out - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - if (rx_stats == 2): - self.verify(1, "Pass") - - # Nvgre test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - 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, padding, tx_interface)) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print out - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - if (rx_stats == 2): - self.verify(1, "Pass") + for tso_s in self.tso_size: + self.dut.send_expect("tso set %d %d" % (tso_s, self.dut_ports[1]), "testpmd> ", 120) + self.dut.send_expect("set fwd csum", "testpmd> ", 120) + self.dut.send_expect("set promisc all off", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ") + + for padd in padding_vxlan: + # Vxlan test + expect_rx_stats = padd/tso_s + 0 if padd % tso_s else 1 + self.tcpdump_start_sniffing([tx_interface, rx_interface]) + 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, padd, tx_interface)) + out = self.tester.scapy_execute() + out = self.dut.send_expect("show port stats all", "testpmd> ", 120) + self.tcpdump_stop_sniff() + rx_stats = self.number_of_packets(rx_interface) + self.verify(rx_stats == expect_rx_stats, "FAIL: For TSO size %d and packet size %d, expect rx stats = %d, \ + but actually received %d" %(tso_s, self.headers_size_vxlan + padd, expect_rx_stats, rx_stats)) + + for padd in padding_nvgre: + # Nvgre test + expect_rx_stats = padd/tso_s + 0 if padd % tso_s else 1 + #self.tcpdump_start_sniffing([tx_interface, rx_interface]) + 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, padd, tx_interface)) + out = self.tester.scapy_execute() + out = self.dut.send_expect("show port stats all", "testpmd> ", 120) + self.tcpdump_stop_sniff() + rx_stats = self.number_of_packets(rx_interface) + self.verify(rx_stats == expect_rx_stats, "FAIL: For TSO size %d and packet size %d, expect rx stats = %d, \ + but actually received %d" %(tso_s, self.headers_size_nvgre + padd, expect_rx_stats, rx_stats)) + self.dut.send_expect("stop", "testpmd> ") def test_perf_TSO_2ports(self): """ @@ -339,6 +353,7 @@ class TestTSO(TestCase): self.dut.send_expect("csum parse_tunnel on %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("set fwd csum", "testpmd> ", 120) + self.dut.send_expect("set promisc all off", "testpmd> ", 120) self.dut.send_expect("start", "testpmd> ") for frame_size in self.frame_sizes: wirespeed = self.wirespeed(self.nic, frame_size, 2) @@ -346,10 +361,10 @@ class TestTSO(TestCase): # create pcap file self.logger.info("Running with frame size %d " % frame_size) payload_size = frame_size - self.headers_size - for _port in range(2): - mac = self.dut.get_mac_address(self.dut_ports[_port]) - self.tester.scapy_append('wrpcap("dst%d.pcap", [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size)) - tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]), + for _port in range(2): + mac = self.dut.get_mac_address(self.dut_ports[_port]) + self.tester.scapy_append('wrpcap("dst%d.pcap", [Ether(dst="%s",src="52:00:00:00:00:01")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%d)])' % (_port, mac, payload_size)) + tgen_input.append((self.tester.get_local_port(self.dut_ports[_port]), self.tester.get_local_port(self.dut_ports[1-_port]), "dst%d.pcap") % _port) self.tester.scapy_execute() -- 1.9.3