From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 13E0CA0679 for ; Sun, 28 Apr 2019 09:10:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8F841B48E; Sun, 28 Apr 2019 09:10:21 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 58FEF1B48D for ; Sun, 28 Apr 2019 09:10:19 +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 orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 00:10:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,404,1549958400"; d="scan'208";a="165589404" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 28 Apr 2019 00:10:17 -0700 From: "xiao,qimai" To: dts@dpdk.org Cc: "xiao,qimai" Date: Sun, 28 Apr 2019 15:14:41 +0800 Message-Id: <1556435681-15420-1-git-send-email-qimaix.xiao@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1] update rss_to_rte_flow to reduce runtime 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" optimize function of send packages with scapy Signed-off-by: xiao,qimai --- tests/TestSuite_rss_to_rte_flow.py | 87 +++++++++++++++--------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/tests/TestSuite_rss_to_rte_flow.py b/tests/TestSuite_rss_to_rte_flow.py index 587888f..4622ede 100644 --- a/tests/TestSuite_rss_to_rte_flow.py +++ b/tests/TestSuite_rss_to_rte_flow.py @@ -36,18 +36,11 @@ Test moving RSS to rte_flow. """ -import utils -import time import re +import time -from test_case import TestCase -from settings import HEADER_SIZE from pmd_output import PmdOutput -from settings import DRIVERS - -from project_dpdk import DPDKdut -from dut import Dut -from packet import Packet +from test_case import TestCase class TestRSS_to_Rteflow(TestCase): @@ -99,14 +92,13 @@ class TestRSS_to_Rteflow(TestCase): """ get the queue which packet enter. """ - outstring = self.dut.send_expect("stop", "testpmd> ") - time.sleep(2) - result_scanner = r"Forward Stats for RX Port= %s/Queue=\s?([0-9]+)" % self.dut_ports[0] + outstring = self.pmdout.get_output() + result_scanner = r'port\s?%s/queue\s?(\d+):\s?received \d+ packets' % self.dut_ports[0] scanner = re.compile(result_scanner, re.DOTALL) m = scanner.search(outstring) queue_id = m.group(1) - print "queue is %s" % queue_id - self.dut.send_expect("start", "testpmd> ") + print("queue is %s" % queue_id) + self.pmdout.execute_cmd("clear port stats all") return queue_id def send_and_check(self, pkt, rss_queue): @@ -115,7 +107,6 @@ class TestRSS_to_Rteflow(TestCase): """ self.tester.scapy_append('sendp(%s, iface="%s")' % (pkt, self.tester_itf)) self.tester.scapy_execute() - time.sleep(2) queue = self.get_queue_number() self.verify(queue in rss_queue, "the packet doesn't enter the expected RSS queue.") return queue @@ -128,14 +119,14 @@ class TestRSS_to_Rteflow(TestCase): time.sleep(2) for i in range(128): if ptype == "ipv4-udp": - packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(dport=%d, sport=%d)], iface="%s")' % ( - self.pf_mac, itf, i + 1, i + 2, i + 21, i + 22, itf) + packet = r'sendp([Ether(dst="%s", src="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(dport=%d, sport=%d)], iface="%s")' % ( + self.pf_mac, self.tester_mac, i + 1, i + 2, i + 21, i + 22, itf) elif ptype == "ipv4-other": - packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % ( - self.pf_mac, itf, i + 1, i + 2, itf) + packet = r'sendp([Ether(dst="%s", src="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % ( + self.pf_mac, self.tester_mac, i + 1, i + 2, itf) self.tester.scapy_append(packet) - self.tester.scapy_execute() - time.sleep(2) + self.tester.scapy_execute() + time.sleep(2) def check_packet_queue(self, queue, out): """ @@ -149,7 +140,6 @@ class TestRSS_to_Rteflow(TestCase): self.verify("Queue= 0" in out and "Queue= 1" not in out and "Queue= 2" not in out and "Queue= 3" not in out, "RSS is enabled.") lines = out.split("\r\n") - reta_line = {} queue_flag = 0 packet_sumnum = 0 # collect the hash result and the queue id @@ -212,10 +202,12 @@ class TestRSS_to_Rteflow(TestCase): if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortville_25g"]): self.dut.send_expect( - "show port 0 rss-hash", "all ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other l2-payload ip udp tcp sctp") + "show port 0 rss-hash", + "all ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other l2-payload ip udp tcp sctp") else: self.dut.send_expect( - "show port 0 rss-hash", "all ipv4 ipv4-tcp ipv4-udp ipv6 ipv6-tcp ipv6-udp ipv6-ex ipv6-tcp-ex ipv6-udp-ex ip udp tcp") + "show port 0 rss-hash", + "all ipv4 ipv4-tcp ipv4-udp ipv6 ipv6-tcp ipv6-udp ipv6-ex ipv6-tcp-ex ipv6-udp-ex ip udp tcp") # send the packets and verify the results self.send_packet("ipv4-other", self.tester_itf) out = self.dut.send_expect("stop", "testpmd> ", 120) @@ -360,7 +352,8 @@ class TestRSS_to_Rteflow(TestCase): # Create a rss queue rule self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types udp ipv4-tcp ipv6-sctp ipv4-other end queues 1 4 7 end / end", "created") + "flow create 0 ingress pattern end actions rss types udp ipv4-tcp ipv6-sctp ipv4-other end queues 1 4 7 end / end", + "created") # send the packets and verify the results if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortville_25g"]): @@ -374,11 +367,6 @@ class TestRSS_to_Rteflow(TestCase): self.send_and_check(self.pkt1, rss_queue) self.send_and_check(self.pkt7, rss_queue) self.send_and_check(self.pkt8, rss_queue) - elif(self.nic in ["cavium_a063"]): - rss_queue = ["1", "4", "7"] - self.send_and_check(self.pkt2, rss_queue) - self.send_and_check(self.pkt3, rss_queue) - self.send_and_check(self.pkt6, rss_queue) else: rss_queue = ["1", "4", "7"] self.send_and_check(self.pkt2, rss_queue) @@ -401,7 +389,8 @@ class TestRSS_to_Rteflow(TestCase): """ # Only supported by i40e self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], + "NIC Unsupported: " + str(self.nic)) pkt1 = "Ether(dst='%s')/IP(src='0.0.0.0',dst='4.0.0.0')/UDP(sport=100, dport=200)/('X'*48)" % self.pf_mac pkt2 = "Ether(dst='%s')/IP(src='0.0.0.0',dst='4.0.0.0')/UDP(sport=100, dport=201)/('X'*48)" % self.pf_mac pkt3 = "Ether(dst='%s')/IP(src='0.0.0.0',dst='4.0.0.0')/UDP(sport=101, dport=201)/('X'*48)" % self.pf_mac @@ -439,14 +428,16 @@ class TestRSS_to_Rteflow(TestCase): key_queue5 = self.send_and_check(pkt5, rss_queue) list2 = [key_queue1, key_queue2, key_queue3, key_queue4, key_queue5] + # self.verify((key in out2) and (out1 != out2) and (list1 != list2), "the key setting doesn't take effect.") self.verify((key in out2) and (out1 != out2) and (list1 != list2), "the key setting doesn't take effect.") - # Create a rss rule with truncating key_len + # Create a rss rult with truncating key_len self.dut.send_expect("flow flush 0", "testpmd> ") key = "1234567890123456789012345678901234567890FFFFFFFFFFFF1234567890123456789012345678901234567890FFFFFFFFFFFF" key_len = "50" self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp end key %s key_len %s / end" % (key, key_len), "created") + "flow create 0 ingress pattern end actions rss types ipv4-udp end key %s key_len %s / end" % (key, key_len), + "created") out3 = self.dut.send_expect("show port 0 rss-hash key", "testpmd> ", 120) key_queue1 = self.send_and_check(pkt1, rss_queue) key_queue2 = self.send_and_check(pkt2, rss_queue) @@ -455,14 +446,16 @@ class TestRSS_to_Rteflow(TestCase): key_queue5 = self.send_and_check(pkt5, rss_queue) list3 = [key_queue1, key_queue2, key_queue3, key_queue4, key_queue5] - self.verify((key not in out3) and (out3 != out1 != out2) and (list3 != list1 != list2), "the key setting doesn't take effect.") + self.verify((key not in out3) and (out3 != out1 != out2) and (list3 != list1 != list2), + "the key setting doesn't take effect.") # Create a rss rule with padding key_len self.dut.send_expect("flow flush 0", "testpmd> ") key = "1234567890123456789012345678901234567890FFFFFFFFFFFF1234567890123456789012345678901234567890FFFFFF" key_len = "52" self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv4-udp end key %s key_len %s / end" % (key, key_len), "created") + "flow create 0 ingress pattern end actions rss types ipv4-udp end key %s key_len %s / end" % (key, key_len), + "created") out4 = self.dut.send_expect("show port 0 rss-hash key", "testpmd> ", 120) key_queue1 = self.send_and_check(pkt1, rss_queue) key_queue2 = self.send_and_check(pkt2, rss_queue) @@ -471,7 +464,8 @@ class TestRSS_to_Rteflow(TestCase): key_queue5 = self.send_and_check(pkt5, rss_queue) list4 = [key_queue1, key_queue2, key_queue3, key_queue4, key_queue5] - self.verify((key in out4) and (out4 != out1 != out2 != out3) and (list4 != list1 != list2), "the key setting doesn't take effect.") + self.verify((key in out4) and (out4 != out1 != out2 != out3) and (list4 != list1 != list2), + "the key setting doesn't take effect.") def test_disable_rss_in_commandline(self): """ @@ -498,7 +492,8 @@ class TestRSS_to_Rteflow(TestCase): time.sleep(2) # Create a rss queue rule self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types ipv6-tcp ipv4-udp sctp ipv6-other end queues 5 6 7 end / end", "created") + "flow create 0 ingress pattern end actions rss types ipv6-tcp ipv4-udp sctp ipv6-other end queues 5 6 7 end / end", + "created") # send the packets and verify the results if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortville_25g"]): @@ -556,14 +551,16 @@ class TestRSS_to_Rteflow(TestCase): if (self.nic in ["bartonhills", "powerville"]): # Create a flow director rule self.dut.send_expect( - "flow create 0 ingress pattern eth / ipv4 proto is 6 / udp dst is 50 / end actions queue index 1 / end", "created") + "flow create 0 ingress pattern eth / ipv4 proto is 6 / udp dst is 50 / end actions queue index 1 / end", + "created") rss_queue = ["1"] pkt = "Ether(dst='%s')/IP(src='10.0.0.1',dst='192.168.0.2',proto=6)/UDP(dport=50, sport=50)/('X'*48)" % self.pf_mac self.send_and_check(pkt, rss_queue) else: # Create a flow director rule self.dut.send_expect( - "flow create 0 ingress pattern eth / ipv4 src is 10.0.0.1 dst is 192.168.0.2 / udp src is 50 dst is 50 / end actions queue index 1 / end", "created") + "flow create 0 ingress pattern eth / ipv4 src is 10.0.0.1 dst is 192.168.0.2 / udp src is 50 dst is 50 / end actions queue index 1 / end", + "created") # send the packets and verify the results rss_queue = ["1"] self.send_and_check(self.pkt2, rss_queue) @@ -577,7 +574,8 @@ class TestRSS_to_Rteflow(TestCase): Set RSS queue rule with queue region API. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], + "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=16 --txq=16 --port-topology=chained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) @@ -586,7 +584,8 @@ class TestRSS_to_Rteflow(TestCase): # Create a rss queue rule. self.dut.send_expect( - "flow create 0 ingress pattern end actions rss types tcp end queues 7 8 10 11 12 14 15 end / end", "created") + "flow create 0 ingress pattern end actions rss types tcp end queues 7 8 10 11 12 14 15 end / end", + "created") # send the packets and verify the results rss_queue = ["7", "8", "10", "11", "12", "14", "15"] queue1 = self.send_and_check(self.prio_pkt1, rss_queue) @@ -621,7 +620,8 @@ class TestRSS_to_Rteflow(TestCase): Set RSS queue rule with invalid parameter in queue region API. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], + "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=16 --txq=16 --port-topology=chained") self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) self.dut.send_expect("set verbose 1", "testpmd> ", 120) @@ -647,7 +647,8 @@ class TestRSS_to_Rteflow(TestCase): The queue region is priority to RSS queue rule. """ self.verify(self.nic in ["fortville_eagle", "fortville_spirit", - "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], "NIC Unsupported: " + str(self.nic)) + "fortville_spirit_single", "fortpark_TLV", "fortville_25g"], + "NIC Unsupported: " + str(self.nic)) self.pmdout.start_testpmd("%s" % self.cores, "--rxq=16 --txq=16 --port-topology=chained") self.dut.send_expect("port config all rss all", "testpmd> ", 120) self.dut.send_expect("set fwd rxonly", "testpmd> ", 120) -- 2.17.0