* [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan
@ 2015-05-29 1:51 Jingguo Fu
2015-05-29 1:51 ` [dts] [DTS][PATCH 2/2] pmd rss hash: add test suite Jingguo Fu
2015-06-01 9:20 ` [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Liu, Yong
0 siblings, 2 replies; 3+ messages in thread
From: Jingguo Fu @ 2015-05-29 1:51 UTC (permalink / raw)
To: dts; +Cc: Jingguo Fu
Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
| 152 +++++++++++++++++++++++++++++++++++
1 file changed, 152 insertions(+)
create mode 100644 test_plans/pmdrss_hash_test_plan.rst
--git a/test_plans/pmdrss_hash_test_plan.rst b/test_plans/pmdrss_hash_test_plan.rst
new file mode 100644
index 0000000..4922d3b
--- /dev/null
+++ b/test_plans/pmdrss_hash_test_plan.rst
@@ -0,0 +1,152 @@
+.. Copyright (c) <2011>, Intel Corporation
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+==================================================================
+Fortville RSS full support - Support configuring hash functions
+==================================================================
+
+This document provides test plan for testing the function of Fortville:
+Support configuring hash functions.
+
+Prerequisites
+-------------
+
+2x Intel® 82599 (Niantic) NICs (2x 10GbE full duplex optical ports per NIC)
+1x Fortville_eagle NIC (4x 10G)
+1x Fortville_spirit NIC (2x 40G)
+2x Fortville_spirit_single NIC (1x 40G)
+
+The four ports of the 82599 connect to the Fortville_eagle;
+The two ports of Fortville_spirit connect to Fortville_spirit_single.
+The three kinds of NICs are the target NICs. the connected NICs can send packets
+to these three NICs using scapy.
+
+Network Traffic
+---------------
+
+The RSS feature is designed to improve networking performance by load balancing
+the packets received from a NIC port to multiple NIC RX queues, with each queue
+handled by a different logical core.
+
+#1. The receive packet is parsed into the header fields used by the hash
+operation (such as IP addresses, TCP port, etc.)
+
+#2. A hash calculation is performed. The Fortville supports four hash function:
+Toeplitz, simple XOR and their Symmetric RSS.
+
+#3. The seven LSBs of the hash result are used as an index into a 128/512 entry
+'redirection table'. Each entry provides a 4-bit RSS output index.
+
+#4. There are four cases to test the four hash function.
+
+Test Case: test_toeplitz
+=========================
+
+Testpmd configuration - 16 RX/TX queues per port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#1. set up testpmd woth fortville NICs::
+
+ ./testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=16 --txq=16
+
+#2. Reta Configuration. 128 reta entries configuration::
+
+ testpmd command: port config 0 rss reta (hash_index,queue_id)
+
+#3. PMD fwd only receive the packets::
+
+ testpmd command: set fwd rxonly
+
+#4. rss recived package type configuration two received packet types configuration::
+
+ testpmd command: port config 0 rss ip/udp
+
+#5. verbose configuration::
+
+ testpmd command: set verbose 8
+
+#6. set hash functions, can choose symmetric or not, chosse port and packet type::
+
+ set_hash_function 0 toeplitz
+
+#7. start packet receive::
+
+ testpmd command: start
+
+tester Configuration
+--------------------
+
+#1. set up scapy
+
+#2. send packets with different type ipv4/ipv4 with tcp/ipv4 with udp/
+ ipv6/ipv6 with tcp/ipv6 with udp::
+
+ sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.4", dst="192.168.0.5")], iface="eth3")
+
+test result
+-----------
+
+The testpmd will print the hash value and actual queue of every packet.
+
+#1. Calaute the queue id: hash value%128or512, then refer to teh redirection table
+ to get the theoretical queue id.
+
+#2. Compare the theoretical queue id with the actual queue id.
+
+
+Test Case: test_toeplitz_symmetric
+===================================
+
+The same with the above steps, pay attention to "set hash function", should use::
+
+ set_hash_function 0 toeplitz
+ set_sym_hash_ena_per_port 0 enable
+ set_sym_hash_ena_per_pctype 0 35 enable
+
+And send packets with the same flow in different direction::
+
+ sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.4", dst="192.168.0.5")], iface="eth3")
+ sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.5", dst="192.168.0.4")], iface="eth3")
+
+And the hash value and queue should be the same for these two flow .
+
+Test Case: test_simple
+=======================
+
+The same as the above two test cases. Just pay attention to set the hash function to "simple xor"
+
+Test Case: test_simple_symmetric
+=================================
+
+The same as the above two test cases. Just pay attention to set the hash function to "simple xor"
+
+
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [DTS][PATCH 2/2] pmd rss hash: add test suite
2015-05-29 1:51 [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Jingguo Fu
@ 2015-05-29 1:51 ` Jingguo Fu
2015-06-01 9:20 ` [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Jingguo Fu @ 2015-05-29 1:51 UTC (permalink / raw)
To: dts; +Cc: Jingguo Fu
Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
| 671 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 671 insertions(+)
create mode 100644 tests/TestSuite_pmdrss_hash.py
--git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py
new file mode 100644
index 0000000..7456d0a
--- /dev/null
+++ b/tests/TestSuite_pmdrss_hash.py
@@ -0,0 +1,671 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+
+Test DPDK1.8 feature: Fortville RSS full support - configuring hash functions.
+It can select Toeplitz or simple XOR hash function and it can configure symmetric hash functions.
+Support 4*10G, 1*40G and 2*40G NICs.
+"""
+import time
+import random
+import re
+import dts
+
+testQueues = [16]
+reta_entries = []
+reta_lines = []
+reta_num = 128
+# Use scapy to send packets with different source and dest ip.
+# and collect the hash result of five tuple and the queue id.
+from test_case import TestCase
+#
+#
+# Test class.
+#
+class TestPmdrssHash(TestCase):
+ #
+ #
+ # Utility methods and other non-test code.
+ #
+ def send_packet(self, itf, tran_type):
+ """
+ Sends packets.
+ """
+ global reta_lines
+ self.tester.scapy_foreground()
+ self.tester.scapy_append('sys.path.append("./")')
+ self.tester.scapy_append('from sctp import *')
+ self.dut.send_expect("start", "testpmd>")
+ mac = self.dut.get_mac_address(0)
+
+ # send packet with different source and dest ip
+ if tran_type == "ipv4-other":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-tcp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1024)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-udp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1024)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-sctp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1024,dport=1024,tag=1)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-frag":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "l2_payload":
+ for i in range(10):
+ packet = r'sendp([Ether(src="00:00:00:00:00:0%d",dst="%s")], iface="%s")' % (
+ i + 1, mac, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+
+ elif tran_type == "ipv6-other":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-tcp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1024)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-udp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1024)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-sctp":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/SCTP(sport=1024,dport=1024,tag=1)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-frag":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ else:
+ print "\ntran_type error!\n"
+
+ out = self.dut.send_expect("stop", "testpmd>")
+ print "******************************************************"
+ print out
+ print "*****************************************************"
+ lines = out.split("\r\n")
+ reta_line = {}
+ # collect the hash result and the queue id
+ for line in lines:
+ line = line.strip()
+ if len(line) != 0 and line.startswith(("src=",)):
+ for item in line.split("-"):
+ item = item.strip()
+ print item
+ if(item.startswith("RSS hash")):
+ name, value = item.split("=", 1)
+
+ reta_line[name.strip()] = value.strip()
+ reta_lines.append(reta_line)
+ reta_line = {}
+ elif len(line) != 0 and line.strip().startswith("port "):
+ rexp = r"port (\d)/queue (\d{1,2}): received (\d) packets"
+ m = re.match(rexp, line.strip())
+ if m:
+ reta_line["port"] = m.group(1)
+ reta_line["queue"] = m.group(2)
+ elif len(line) != 0 and line.startswith("stop"):
+ break
+ else:
+ pass
+ self.verifyResult()
+
+ def verifyResult(self):
+ """
+ Verify whether or not the result passes.
+ """
+
+ global reta_lines
+ global reta_num
+ result = []
+ dts.results_table_add_header(
+ ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass '])
+
+ i = 0
+
+ for tmp_reta_line in reta_lines:
+ status = "false"
+ # compute the hash result of five tuple into the 7 LSBs value.
+ hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num
+ print reta_entries[hash_index], tmp_reta_line
+ if(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
+ status = "true"
+ result.insert(i, 0)
+ else:
+ status = "fail"
+ result.insert(i, 1)
+ dts.results_table_add_row(
+ [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
+ i = i + 1
+
+ dts.results_table_print()
+ reta_lines = []
+ self.verify(sum(result) == 0, "the reta update function failed!")
+
+ def send_packet_symmetric(self, itf, tran_type):
+ """
+ Sends packets.
+ """
+ global reta_lines
+ self.tester.scapy_foreground()
+ self.tester.scapy_append('sys.path.append("./")')
+ self.tester.scapy_append('from sctp import *')
+ self.dut.send_expect("start", "testpmd>")
+ mac = self.dut.get_mac_address(0)
+
+ # send packet with different source and dest ip
+ if tran_type == "ipv4-other":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+
+ elif tran_type == "ipv4-tcp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1025)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-udp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1025)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-sctp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1024,dport=1025,tag=1)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d")/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv4-frag":
+ for i in range(10):
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "l2_payload":
+ for i in range(10):
+ packet = r'sendp([Ether(src="00:00:00:00:00:%02d",dst="%s")], iface="%s")' % (
+ i + 1, mac, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-other":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+
+ elif tran_type == "ipv6-tcp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1025)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:3::%d", dst="3ffe:2501:200:1fff::%d")/TCP(sport=1025,dport=1024)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+
+ elif tran_type == "ipv6-udp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1025)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1025,dport=1024)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-sctp":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/SCTP(sport=1024,dport=1025,tag=1)], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/SCTP(sport=1025,dport=1024,tag=1)], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ elif tran_type == "ipv6-frag":
+ for i in range(4):
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
+ mac, i + 1, i + 2, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ packet = r'sendp([Ether(dst="%s")/IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d",nh=44)/IPv6ExtHdrFragment()], iface="%s")' % (
+ mac, i + 2, i + 1, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ else:
+ print "\ntran_type error!\n"
+
+ out = self.dut.send_expect("stop", "testpmd>")
+ lines = out.split("\r\n")
+ reta_line = {}
+
+ # collect the hash result of five tuple and the queue id
+ for line in lines:
+ line = line.strip()
+ if len(line) != 0 and line.startswith(("src=",)):
+ for item in line.split("-"):
+ item = item.strip()
+ if(item.startswith("RSS hash")):
+ name, value = item.split("=", 1)
+
+ reta_line[name.strip()] = value.strip()
+ reta_lines.append(reta_line)
+ reta_line = {}
+ elif len(line) != 0 and line.strip().startswith("port "):
+ rexp = r"port (\d)/queue (\d{1,2}): received (\d) packets"
+ m = re.match(rexp, line.strip())
+ if m:
+ reta_line["port"] = m.group(1)
+ reta_line["queue"] = m.group(2)
+ elif len(line) != 0 and line.startswith("stop"):
+ break
+ else:
+ pass
+
+ self.verifyResult_symmetric()
+
+ def verifyResult_symmetric(self):
+ """
+ Verify whether or not the result passes.
+ """
+
+ global reta_lines
+ global reta_num
+ result = []
+ dts.results_table_add_header(
+ ['packet index', 'RSS hash', 'hash index', 'queue id', 'actual queue id', 'pass '])
+
+ i = 0
+ for tmp_reta_line in reta_lines:
+ status = "true"
+ # compute the hash result of five tuple into the 7 LSBs value.
+ hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num
+
+ if(i % 2 == 1):
+ if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
+ status = "true"
+ result.insert((i - 1) / 2, 0)
+ else:
+ status = "fail"
+ result.insert((i - 1) / 2, 1)
+ pre_RSS_hash = tmp_reta_line["RSS hash"]
+
+ dts.results_table_add_row(
+ [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
+ i = i + 1
+
+ dts.results_table_print()
+ reta_lines = []
+ self.verify(
+ sum(result) == 0, "the symmetric RSS hash function failed!")
+
+ #
+ #
+ #
+ # Test cases.
+ #
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+
+ self.verify(
+ self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"], "NIC Unsupported: " + str(self.nic))
+ global reta_num
+ if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
+ reta_num = 512
+ elif self.nic in ["niantic"]:
+ reta_num = 128
+ else:
+ self.verify(False, "NIC Unsupported:%s" % str(self.nic))
+ ports = self.dut.get_ports(self.nic)
+ self.verify(len(ports) >= 1, "Not enough ports available")
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def test_toeplitz(self):
+ dutPorts = self.dut.get_ports(self.nic)
+ localPort = self.tester.get_local_port(dutPorts[0])
+ itf = self.tester.get_interface(localPort)
+ global reta_num
+ iptypes = {'ipv4-sctp': 'sctp',
+ 'ipv4-other': 'ip',
+ 'ipv4-frag': 'ip',
+ 'ipv4-udp': 'udp',
+ 'ipv4-tcp': 'tcp',
+ # this hash not support in dpdk2.0
+ # 'l2_payload':'ether',
+ 'ipv6-other': 'ip',
+ 'ipv6-sctp': 'ip',
+ 'ipv6-udp': 'udp',
+ 'ipv6-tcp': 'tcp',
+ 'ipv6-frag': 'ip'
+ }
+
+ self.dut.kill_all()
+
+ # test with different rss queues
+ for queue in testQueues:
+ self.dut.send_expect(
+ "./%s/app/testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=%d --txq=%d" %
+ (self.target, self.dut.get_memory_channels(), queue, queue), "testpmd> ", 120)
+
+ for iptype, rsstype in iptypes.items():
+ self.dut.send_expect("set verbose 8", "testpmd> ")
+ self.dut.send_expect("set fwd rxonly", "testpmd> ")
+ self.dut.send_expect(
+ "set nbcore %d" % (queue + 1), "testpmd> ")
+
+ self.dut.send_expect("port stop all", "testpmd> ")
+ # self.dut.send_expect("port config all rss ip", "testpmd> ")
+ self.dut.send_expect(
+ "set_hash_global_config 0 toeplitz %s enable" % iptype, "testpmd> ")
+ self.dut.send_expect("port start all", "testpmd> ")
+ self.dut.send_expect(
+ "port config all rss %s" % rsstype, "testpmd> ")
+
+ # configure the reta with specific mappings.
+ for i in range(reta_num):
+ reta_entries.insert(i, random.randint(0, queue - 1))
+ self.dut.send_expect(
+ "port config 0 rss reta (%d,%d)" % (i, reta_entries[i]), "testpmd> ")
+
+ self.send_packet(itf, iptype)
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ def test_toeplitz_symmetric(self):
+ dutPorts = self.dut.get_ports(self.nic)
+ localPort = self.tester.get_local_port(dutPorts[0])
+ itf = self.tester.get_interface(localPort)
+ global reta_num
+ iptypes = {'ipv4-sctp': 'sctp',
+ 'ipv4-other': 'ip',
+ 'ipv4-frag': 'ip',
+ 'ipv4-udp': 'udp',
+ 'ipv4-tcp': 'tcp',
+ # this hash not support in dpdk2.0
+ # 'l2_payload':'ether',
+ 'ipv6-other': 'ip',
+ 'ipv6-sctp': 'ip',
+ 'ipv6-udp': 'udp',
+ 'ipv6-tcp': 'tcp',
+ 'ipv6-frag': 'ip'
+ }
+
+ self.dut.kill_all()
+
+ # test with different rss queues
+ for queue in testQueues:
+ self.dut.send_expect(
+ "./%s/app/testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=%d --txq=%d" %
+ (self.target, self.dut.get_memory_channels(), queue, queue), "testpmd> ", 120)
+
+ for iptype, rsstype in iptypes.items():
+ self.dut.send_expect("set verbose 8", "testpmd> ")
+ self.dut.send_expect("set fwd rxonly", "testpmd> ")
+ self.dut.send_expect(
+ "set nbcore %d" % (queue + 1), "testpmd> ")
+
+ self.dut.send_expect("port stop all", "testpmd> ")
+ self.dut.send_expect(
+ "set_hash_global_config 0 toeplitz %s enable" % iptype, "testpmd> ")
+ self.dut.send_expect(
+ "set_sym_hash_ena_per_port 0 enable", "testpmd> ")
+ self.dut.send_expect("port start all", "testpmd> ")
+ self.dut.send_expect(
+ "port config all rss %s" % rsstype, "testpmd> ")
+
+ # configure the reta with specific mappings.
+ for i in range(reta_num):
+ reta_entries.insert(i, random.randint(0, queue - 1))
+ self.dut.send_expect(
+ "port config 0 rss reta (%d,%d)" % (i, reta_entries[i]), "testpmd> ")
+
+ self.send_packet_symmetric(itf, iptype)
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ def test_simple(self):
+
+ dutPorts = self.dut.get_ports(self.nic)
+ localPort = self.tester.get_local_port(dutPorts[0])
+ itf = self.tester.get_interface(localPort)
+ global reta_num
+ iptypes = {'ipv4-sctp': 'sctp',
+ 'ipv4-other': 'ip',
+ 'ipv4-frag': 'ip',
+ 'ipv4-udp': 'udp',
+ 'ipv4-tcp': 'tcp',
+ # this hass not support in dpdk 2.0
+ # 'l2_payload':'ether',
+ 'ipv6-other': 'ip',
+ 'ipv6-sctp': 'ip',
+ 'ipv6-udp': 'udp',
+ 'ipv6-tcp': 'tcp',
+ 'ipv6-frag': 'ip'
+ }
+
+ self.dut.kill_all()
+
+ # test with different rss queues
+ for queue in testQueues:
+ self.dut.send_expect(
+ "./%s/app/testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=%d --txq=%d" %
+ (self.target, self.dut.get_memory_channels(), queue, queue), "testpmd> ", 120)
+
+ for iptype, rsstype in iptypes.items():
+ print "***********************%s rss test********************************" % iptype
+ self.dut.send_expect("set verbose 8", "testpmd> ")
+ self.dut.send_expect("set fwd rxonly", "testpmd> ")
+ self.dut.send_expect(
+ "set nbcore %d" % (queue + 1), "testpmd> ")
+
+ self.dut.send_expect("port stop all", "testpmd> ")
+ self.dut.send_expect(
+ "set_hash_global_config 0 simple_xor %s enable" % iptype, "testpmd> ")
+ # self.dut.send_expect("port config all rss ip", "testpmd> ")
+ self.dut.send_expect("port start all", "testpmd> ")
+ self.dut.send_expect(
+ "port config all rss %s" % rsstype, "testpmd> ")
+
+ # configure the reta with specific mappings.
+ for i in range(reta_num):
+ reta_entries.insert(i, random.randint(0, queue - 1))
+ self.dut.send_expect(
+ "port config 0 rss reta (%d,%d)" % (i, reta_entries[i]), "testpmd> ")
+
+ self.send_packet(itf, iptype)
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ def test_simple_symmetric(self):
+
+ dutPorts = self.dut.get_ports(self.nic)
+ localPort = self.tester.get_local_port(dutPorts[0])
+ itf = self.tester.get_interface(localPort)
+ global reta_num
+ iptypes = {'ipv4-sctp': 'sctp',
+ 'ipv4-other': 'ip',
+ 'ipv4-frag': 'ip',
+ 'ipv4-udp': 'udp',
+ 'ipv4-tcp': 'tcp',
+ # this hash not support in dpdk2.0
+ # 'l2_payload':'ether',
+ 'ipv6-other': 'ip',
+ 'ipv6-sctp': 'ip',
+ 'ipv6-udp': 'udp',
+ 'ipv6-tcp': 'tcp',
+ 'ipv6-frag': 'ip'
+ }
+ self.dut.kill_all()
+
+ # test with different rss queues
+ for queue in testQueues:
+ self.dut.send_expect(
+ "./%s/app/testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=%d --txq=%d" %
+ (self.target, self.dut.get_memory_channels(), queue, queue), "testpmd> ", 120)
+
+ for iptype, rsstype in iptypes.items():
+ self.dut.send_expect("set verbose 8", "testpmd> ")
+ self.dut.send_expect("set fwd rxonly", "testpmd> ")
+ self.dut.send_expect(
+ "set nbcore %d" % (queue + 1), "testpmd> ")
+
+ self.dut.send_expect("port stop all", "testpmd> ")
+ # self.dut.send_expect("port config all rss ip", "testpmd> ")
+ self.dut.send_expect(
+ "set_hash_global_config 0 simple_xor %s enable" % iptype, "testpmd> ")
+ self.dut.send_expect(
+ "set_sym_hash_ena_per_port 0 enable", "testpmd> ")
+ self.dut.send_expect("port start all", "testpmd> ")
+ self.dut.send_expect(
+ "port config all rss %s" % rsstype, "testpmd> ")
+ # configure the reta with specific mappings.
+ for i in range(reta_num):
+ reta_entries.insert(i, random.randint(0, queue - 1))
+ self.dut.send_expect(
+ "port config 0 rss reta (%d,%d)" % (i, reta_entries[i]), "testpmd> ")
+
+ self.send_packet_symmetric(itf, iptype)
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ pass
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan
2015-05-29 1:51 [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Jingguo Fu
2015-05-29 1:51 ` [dts] [DTS][PATCH 2/2] pmd rss hash: add test suite Jingguo Fu
@ 2015-06-01 9:20 ` Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2015-06-01 9:20 UTC (permalink / raw)
To: Fu, JingguoX, dts; +Cc: Fu, JingguoX
Thanks, applied in 1.1 branch.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jingguo Fu
> Sent: Friday, May 29, 2015 9:52 AM
> To: dts@dpdk.org
> Cc: Fu, JingguoX
> Subject: [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan
>
> Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
> ---
> test_plans/pmdrss_hash_test_plan.rst | 152
> +++++++++++++++++++++++++++++++++++
> 1 file changed, 152 insertions(+)
> create mode 100644 test_plans/pmdrss_hash_test_plan.rst
>
> diff --git a/test_plans/pmdrss_hash_test_plan.rst
> b/test_plans/pmdrss_hash_test_plan.rst
> new file mode 100644
> index 0000000..4922d3b
> --- /dev/null
> +++ b/test_plans/pmdrss_hash_test_plan.rst
> @@ -0,0 +1,152 @@
> +.. Copyright (c) <2011>, Intel Corporation
> + All rights reserved.
> +
> + Redistribution and use in source and binary forms, with or without
> + modification, are permitted provided that the following conditions
> + are met:
> +
> + - Redistributions of source code must retain the above copyright
> + notice, this list of conditions and the following disclaimer.
> +
> + - Redistributions in binary form must reproduce the above copyright
> + notice, this list of conditions and the following disclaimer in
> + the documentation and/or other materials provided with the
> + distribution.
> +
> + - Neither the name of Intel Corporation nor the names of its
> + contributors may be used to endorse or promote products derived
> + from this software without specific prior written permission.
> +
> + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
> + OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +==================================================================
> +Fortville RSS full support - Support configuring hash functions
> +==================================================================
> +
> +This document provides test plan for testing the function of Fortville:
> +Support configuring hash functions.
> +
> +Prerequisites
> +-------------
> +
> +2x Intel® 82599 (Niantic) NICs (2x 10GbE full duplex optical ports per
> NIC)
> +1x Fortville_eagle NIC (4x 10G)
> +1x Fortville_spirit NIC (2x 40G)
> +2x Fortville_spirit_single NIC (1x 40G)
> +
> +The four ports of the 82599 connect to the Fortville_eagle;
> +The two ports of Fortville_spirit connect to Fortville_spirit_single.
> +The three kinds of NICs are the target NICs. the connected NICs can send
> packets
> +to these three NICs using scapy.
> +
> +Network Traffic
> +---------------
> +
> +The RSS feature is designed to improve networking performance by load
> balancing
> +the packets received from a NIC port to multiple NIC RX queues, with each
> queue
> +handled by a different logical core.
> +
> +#1. The receive packet is parsed into the header fields used by the hash
> +operation (such as IP addresses, TCP port, etc.)
> +
> +#2. A hash calculation is performed. The Fortville supports four hash
> function:
> +Toeplitz, simple XOR and their Symmetric RSS.
> +
> +#3. The seven LSBs of the hash result are used as an index into a 128/512
> entry
> +'redirection table'. Each entry provides a 4-bit RSS output index.
> +
> +#4. There are four cases to test the four hash function.
> +
> +Test Case: test_toeplitz
> +=========================
> +
> +Testpmd configuration - 16 RX/TX queues per port
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +#1. set up testpmd woth fortville NICs::
> +
> + ./testpmd -c fffff -n %d -- -i --coremask=0xffffe --rxq=16 --txq=16
> +
> +#2. Reta Configuration. 128 reta entries configuration::
> +
> + testpmd command: port config 0 rss reta (hash_index,queue_id)
> +
> +#3. PMD fwd only receive the packets::
> +
> + testpmd command: set fwd rxonly
> +
> +#4. rss recived package type configuration two received packet types
> configuration::
> +
> + testpmd command: port config 0 rss ip/udp
> +
> +#5. verbose configuration::
> +
> + testpmd command: set verbose 8
> +
> +#6. set hash functions, can choose symmetric or not, chosse port and
> packet type::
> +
> + set_hash_function 0 toeplitz
> +
> +#7. start packet receive::
> +
> + testpmd command: start
> +
> +tester Configuration
> +--------------------
> +
> +#1. set up scapy
> +
> +#2. send packets with different type ipv4/ipv4 with tcp/ipv4 with udp/
> + ipv6/ipv6 with tcp/ipv6 with udp::
> +
> + sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.4",
> dst="192.168.0.5")], iface="eth3")
> +
> +test result
> +-----------
> +
> +The testpmd will print the hash value and actual queue of every packet.
> +
> +#1. Calaute the queue id: hash value%128or512, then refer to teh
> redirection table
> + to get the theoretical queue id.
> +
> +#2. Compare the theoretical queue id with the actual queue id.
> +
> +
> +Test Case: test_toeplitz_symmetric
> +===================================
> +
> +The same with the above steps, pay attention to "set hash function",
> should use::
> +
> + set_hash_function 0 toeplitz
> + set_sym_hash_ena_per_port 0 enable
> + set_sym_hash_ena_per_pctype 0 35 enable
> +
> +And send packets with the same flow in different direction::
> +
> + sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.4",
> dst="192.168.0.5")], iface="eth3")
> + sendp([Ether(dst="90:e2:ba:36:99:3c")/IP(src="192.168.0.5",
> dst="192.168.0.4")], iface="eth3")
> +
> +And the hash value and queue should be the same for these two flow .
> +
> +Test Case: test_simple
> +=======================
> +
> +The same as the above two test cases. Just pay attention to set the hash
> function to "simple xor"
> +
> +Test Case: test_simple_symmetric
> +=================================
> +
> +The same as the above two test cases. Just pay attention to set the hash
> function to "simple xor"
> +
> +
> --
> 2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-01 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 1:51 [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Jingguo Fu
2015-05-29 1:51 ` [dts] [DTS][PATCH 2/2] pmd rss hash: add test suite Jingguo Fu
2015-06-01 9:20 ` [dts] [DTS][PATCH 1/2] pmd rss hash: add test plan Liu, Yong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).