* [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite
@ 2015-05-29 8:49 Jingguo Fu
2015-05-29 8:49 ` [dts] [DTS][PATCH 2/2] pmd rss reta: add rss reta test plan Jingguo Fu
2015-06-01 9:23 ` [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite Liu, Yong
0 siblings, 2 replies; 3+ messages in thread
From: Jingguo Fu @ 2015-05-29 8:49 UTC (permalink / raw)
To: dts; +Cc: Jingguo Fu
Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
| 255 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 255 insertions(+)
create mode 100644 tests/TestSuite_pmdrssreta.py
--git a/tests/TestSuite_pmdrssreta.py b/tests/TestSuite_pmdrssreta.py
new file mode 100644
index 0000000..60f340d
--- /dev/null
+++ b/tests/TestSuite_pmdrssreta.py
@@ -0,0 +1,255 @@
+# 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 RSS reta (redirection table) update function.
+"""
+import time
+import random
+import re
+import dts
+testQueues = [16]
+reta_entries = []
+reta_lines = []
+
+# 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
+from pmd_output import PmdOutput
+#
+#
+# Test class.
+#
+class TestPmdrssreta(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":
+ for i in range(16):
+ 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(16):
+ 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(16):
+ 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 == "IPV6":
+ for i in range(16):
+ 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(16):
+ 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(16):
+ 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)
+ 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)
+ print name + "-" + value
+
+ 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
+ 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"
+ if(self.nic == "niantic"):
+ # compute the hash result of five tuple into the 7 LSBs value.
+ hash_index = int(tmp_reta_line["RSS hash"], 16) % 128
+ else:
+ # compute the hash result of five tuple into the 7 LSBs value.
+ hash_index = int(tmp_reta_line["RSS hash"], 16) % 512
+ 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!")
+
+ #
+ #
+ #
+ # Test cases.
+ #
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+
+ self.verify(
+ self.nic in ["niantic", "fortville_eagle", "fortville_spirit", "fortville_spirit_single"],
+ "NIC Unsupported: " + str(self.nic))
+ ports = self.dut.get_ports(self.nic)
+ self.ports_socket = self.dut.get_numa_id(ports[0])
+ self.verify(len(ports) >= 1, "Not enough ports available")
+
+ self.pmdout = PmdOutput(self.dut)
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def test_pmdrss_reta(self):
+ dutPorts = self.dut.get_ports(self.nic)
+ localPort = self.tester.get_local_port(dutPorts[0])
+ itf = self.tester.get_interface(localPort)
+ iptypes = ['IPV4']
+
+ self.dut.kill_all()
+
+ # test with different rss queues
+ for queue in testQueues:
+ if(queue == 16):
+ self.pmdout.start_testpmd(
+ "all", "--rxq=%d --txq=%d" % (queue, queue), socket=self.ports_socket)
+ else:
+ self.pmdout.start_testpmd(
+ "all", "--mbcache=128 --rxq=%d --txq=%d" % (queue, queue), socket=self.ports_socket)
+
+ for iptype in iptypes:
+ 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 udp", "testpmd> ")
+ # self.dut.send_expect("port start all", "testpmd> ")
+
+ # configure the reta with specific mappings.
+ if(self.nic == "niantic"):
+ for i in range(128):
+ 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> ")
+ else:
+ for i in range(512):
+ 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 tear_down(self):
+ """
+ Run after each test case.
+ """
+ pass
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ self.dut.kill_all()
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [DTS][PATCH 2/2] pmd rss reta: add rss reta test plan
2015-05-29 8:49 [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite Jingguo Fu
@ 2015-05-29 8:49 ` Jingguo Fu
2015-06-01 9:23 ` [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Jingguo Fu @ 2015-05-29 8:49 UTC (permalink / raw)
To: dts; +Cc: Jingguo Fu
Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
| 178 ++++++++++++++++++++++++++++++++++++
1 file changed, 178 insertions(+)
create mode 100644 test_plans/pmdrssreta_test_plan.rst
--git a/test_plans/pmdrssreta_test_plan.rst b/test_plans/pmdrssreta_test_plan.rst
new file mode 100644
index 0000000..d621d51
--- /dev/null
+++ b/test_plans/pmdrssreta_test_plan.rst
@@ -0,0 +1,178 @@
+.. 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.
+
+================================================================
+reta(Redirection table) benchmark Results of the 82599 10GbE PMD
+================================================================
+
+This document provides test plan for benchmarking of Rss reta(Redirection
+table) updating for the Intel® 82599 10 Gigabit Ethernet Controller
+(Niantic) Poll Mode Driver (PMD) in userland runtime configurations.
+The content of Rss Redirection table are not defined following reset
+of the Memory Configuration registers. System software must initialize
+the table prior to enabling multiple receive queues .It can also update
+the redirection table during run time. Such updates of the table are
+not synchronized with the arrival time of received packets.
+
+Prerequisites
+-------------
+
+2x Intel® 82599 (Niantic) NICs (2x 10GbE full duplex optical ports per NIC)
+plugged into the available PCIe Gen2 8-lane slots. To avoid PCIe bandwidth
+bottlenecks at high packet rates, a single optical port from each NIC is
+connected to the traffic generator.
+
+
+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 82599 supports a single hash function,
+as defined by MSFT RSS. The 82599 therefore does not indicate to the device
+driver which hash function is used. The 32-bit result is fed into the packet
+receive descriptor.
+
+#3. The seven LSBs of the hash result are used as an index into a 128-entry
+'redirection table'. Each entry provides a 4-bit RSS output index.
+
+The RSS RETA update feature is designed to make RSS more flexible by allowing
+users to define the correspondence between the seven LSBs of hash result and
+the queue id(RSS output index) by themself.
+
+
+Test Case: Results - IO Forwarding Mode
+========================================
+
+The following RX Ports/Queues configurations have to be benchmarked:
+
+- 1 RX port / 2 RX queues (1P/2Q)
+
+- 1 RX port / 9 RX queues (1P/9Q)
+
+- 1 RX ports / 16 RX queues (1P/16Q)
+
+
+Testpmd configuration - 2 RX/TX queues per port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+ testpmd -cffffff -n 3 -b 0000:05:00.1 -- -i --rxd=512 --txd=512 --burst=32 \
+ --txpt=36 --txht=0 --txwt=0 --txfreet=32 --rxfreet=64 --txrst=32 --mbcache=128 \
+ --rxq=2 --txq=2
+
+Testpmd configuration - 9 RX/TX queues per port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+ testpmd -cffffff -n 3 -b 0000:05:00.1 -- -i --rxd=512 --txd=512 --burst=32 \
+ --txpt=36 --txht=0 --txwt=0 --txfreet=32 --rxfreet=64 --txrst=32 --mbcache=128 \
+ --rxq=9 --txq=9
+
+Testpmd configuration - 16 RX/TX queues per port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+ testpmd -cffffff -n 3 -b 0000:05:00.1 -- -i --rxd=512 --txd=512 --burst=32 \
+ --txpt=36 --txht=0 --txwt=0 --txfreet=32 --rxfreet=64 --txrst=32 --mbcache=128 \
+ --rxq=16 --txq=16
+
+The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
+The -b command is used to prevent the use of pic port to receive packets. It should match the pci number of the pci device.
+
+Testpmd Configuration Options
+-----------------------------
+
+By default, a single logical core runs the test.
+The CPU IDs and the number of logical cores running the test in parallel can
+be manually set with the ``set corelist X,Y`` and the ``set nbcore N``
+interactive commands of the ``testpmd`` application.
+
+#1. Reta Configuration. 128 reta entries configuration::
+
+ testpmd command: port config 0 rss reta (hash_index,queue_id)
+
+#2. PMD fwd only receive the packets::
+
+ testpmd command: set fwd rxonly
+
+#3. rss recived package type configuration two received packet types configuration::
+
+ testpmd command: port config 0 rss ip/udp
+
+#4. verbose configuration::
+
+ testpmd command: set verbose 8
+
+#5. start packet receive::
+
+ testpmd command: start
+
+tester Configuration
+--------------------
+
+#1. In order to make most entries of the reta to be tested,the traffic generator
+has to be configured to randomize the value of the 5-tuple fields of the
+transmitted IP/UDP packets so that RSS hash function output of 5-tuple fileds covers
+most of reta index.
+
+#2. set the package numbers of one burst to a centain value.
+
+
+Example output (1P/2Q) received by the dut):::
+-----------------------------------------------
+
++--------------+-------------+------------+-----------------+------+
+| packet index | hash output | rss output | actual queue id | pass |
++--------------+-------------+------------+-----------------+------+
+| 0 | | | | |
++--------------+-------------+------------+-----------------+------+
+| 1 | | | | |
++--------------+-------------+------------+-----------------+------+
+| 2 | | | | |
++--------------+-------------+------------+-----------------+------+
+| etc. | | | | |
++--------------+-------------+------------+-----------------+------+
+| 125 | | | | |
++--------------+-------------+------------+-----------------+------+
+| 126 | | | | |
++--------------+-------------+------------+-----------------+------+
+| 127 | | | | |
++--------------+-------------+------------+-----------------+------+
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite
2015-05-29 8:49 [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite Jingguo Fu
2015-05-29 8:49 ` [dts] [DTS][PATCH 2/2] pmd rss reta: add rss reta test plan Jingguo Fu
@ 2015-06-01 9:23 ` Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2015-06-01 9:23 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 4:50 PM
> To: dts@dpdk.org
> Cc: Fu, JingguoX
> Subject: [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite
>
> Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
> ---
> tests/TestSuite_pmdrssreta.py | 255
> ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 255 insertions(+)
> create mode 100644 tests/TestSuite_pmdrssreta.py
>
> diff --git a/tests/TestSuite_pmdrssreta.py b/tests/TestSuite_pmdrssreta.py
> new file mode 100644
> index 0000000..60f340d
> --- /dev/null
> +++ b/tests/TestSuite_pmdrssreta.py
> @@ -0,0 +1,255 @@
> +# 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 RSS reta (redirection table) update function.
> +"""
> +import time
> +import random
> +import re
> +import dts
> +testQueues = [16]
> +reta_entries = []
> +reta_lines = []
> +
> +# 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
> +from pmd_output import PmdOutput
> +#
> +#
> +# Test class.
> +#
> +class TestPmdrssreta(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":
> + for i in range(16):
> + 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(16):
> + 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(16):
> + 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 == "IPV6":
> + for i in range(16):
> + 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(16):
> + 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(16):
> + 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)
> + 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)
> + print name + "-" + value
> +
> + 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
> + 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"
> + if(self.nic == "niantic"):
> + # compute the hash result of five tuple into the 7 LSBs
> value.
> + hash_index = int(tmp_reta_line["RSS hash"], 16) % 128
> + else:
> + # compute the hash result of five tuple into the 7 LSBs
> value.
> + hash_index = int(tmp_reta_line["RSS hash"], 16) % 512
> + 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!")
> +
> + #
> + #
> + #
> + # Test cases.
> + #
> + def set_up_all(self):
> + """
> + Run at the start of each test suite.
> + """
> +
> + self.verify(
> + self.nic in ["niantic", "fortville_eagle", "fortville_spirit",
> "fortville_spirit_single"],
> + "NIC Unsupported: " + str(self.nic))
> + ports = self.dut.get_ports(self.nic)
> + self.ports_socket = self.dut.get_numa_id(ports[0])
> + self.verify(len(ports) >= 1, "Not enough ports available")
> +
> + self.pmdout = PmdOutput(self.dut)
> +
> + def set_up(self):
> + """
> + Run before each test case.
> + """
> + pass
> +
> + def test_pmdrss_reta(self):
> + dutPorts = self.dut.get_ports(self.nic)
> + localPort = self.tester.get_local_port(dutPorts[0])
> + itf = self.tester.get_interface(localPort)
> + iptypes = ['IPV4']
> +
> + self.dut.kill_all()
> +
> + # test with different rss queues
> + for queue in testQueues:
> + if(queue == 16):
> + self.pmdout.start_testpmd(
> + "all", "--rxq=%d --txq=%d" % (queue, queue),
> socket=self.ports_socket)
> + else:
> + self.pmdout.start_testpmd(
> + "all", "--mbcache=128 --rxq=%d --txq=%d" % (queue,
> queue), socket=self.ports_socket)
> +
> + for iptype in iptypes:
> + 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 udp",
> "testpmd> ")
> + # self.dut.send_expect("port start all", "testpmd> ")
> +
> + # configure the reta with specific mappings.
> + if(self.nic == "niantic"):
> + for i in range(128):
> + 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> ")
> + else:
> + for i in range(512):
> + 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 tear_down(self):
> + """
> + Run after each test case.
> + """
> + pass
> +
> + def tear_down_all(self):
> + """
> + Run after each test suite.
> + """
> + self.dut.kill_all()
> --
> 2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-01 9:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 8:49 [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite Jingguo Fu
2015-05-29 8:49 ` [dts] [DTS][PATCH 2/2] pmd rss reta: add rss reta test plan Jingguo Fu
2015-06-01 9:23 ` [dts] [DTS][PATCH 1/2] pmd rss reta: add rss reta suite 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).