[dts] [PATCH v2] tests: add check items for symmetric cases

Yao, BingX Y bingx.y.yao at intel.com
Wed Jan 30 03:41:56 CET 2019


Testyed-by: yaobing <bingx.y.yao at intel.com>

-----Original Message-----
From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Peng Yuan
Sent: Wednesday, January 23, 2019 2:46 PM
To: dts at dpdk.org
Cc: Peng, Yuan <yuan.peng at intel.com>
Subject: [dts] [PATCH v2] tests: add check items for symmetric cases

Add check items for symmetric cases of TestSuite_pmdrss_hash.py

Signed-off-by: Peng Yuan <yuan.peng at intel.com>

diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py index 07c47b4..60c9819 100644
--- a/tests/TestSuite_pmdrss_hash.py
+++ b/tests/TestSuite_pmdrss_hash.py
@@ -41,9 +41,23 @@ import random
 import re
 import utils
 
-testQueues = [16]
+queue = 16
 reta_entries = []
 reta_num = 128
+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': 'sctp',
+           'ipv6-udp': 'udp',
+           'ipv6-tcp': 'tcp',
+           'ipv6-frag': 'ip'
+           }
+
 # 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
@@ -389,19 +403,23 @@ class TestPmdrssHash(TestCase):
 
         i = 0
         for tmp_reta_line in reta_lines:
-            status = "true"
+            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
-
-            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"]
-
+            if(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
+                status = "true"
+                result.insert(i, 0)
+                if(i % 2 == 1):
+                    if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
+                        status = "true"
+                        result.insert(len(reta_lines) + (i - 1) / 2, 0)
+                    else:
+                        status = "fail"
+                        result.insert(len(reta_lines) + (i - 1) / 2, 1)
+                pre_RSS_hash = tmp_reta_line["RSS hash"]
+            else:
+                status = "fail"
+                result.insert(i, 1)
             self.result_table_add(
                 [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
             i = i + 1
@@ -417,19 +435,30 @@ class TestPmdrssHash(TestCase):
 
         self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
                     "fortville_spirit_single", "redrockcanyou", "atwood",
-                    "boulderrapid", "fortpark_TLV", "fortville_25g"],
+                    "boulderrapid", "fortpark_TLV", "fortville_25g", 
+ "niantic"],
                     "NIC Unsupported: " + str(self.nic))
         global reta_num
+        global iptypes
+
         if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "fortville_25g"]:
             reta_num = 512
         elif self.nic in ["niantic"]:
             reta_num = 128
+            iptypes = {'ipv4-other': 'ip',
+                       'ipv4-frag': 'ip',
+                       'ipv4-udp': 'udp',
+                       'ipv4-tcp': 'tcp',
+                       'ipv6-other': 'ip',
+                       'ipv6-udp': 'udp',
+                       'ipv6-tcp': 'tcp',
+                       'ipv6-frag': 'ip'
+                       }
         elif self.nic in ["redrockcanyou", "atwood", "boulderrapid"]:
             reta_num = 128
         else:
             self.verify(False, "NIC Unsupported:%s" % str(self.nic))
         ports = self.dut.get_ports(self.nic)
-        self.verify(len(ports) >= 2, "Not enough ports available")
+        self.verify(len(ports) >= 1, "Not enough ports available")
 
     def set_up(self):
         """
@@ -442,49 +471,35 @@ class TestPmdrssHash(TestCase):
         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': 'sctp',
-                   'ipv6-udp': 'udp',
-                   'ipv6-tcp': 'tcp',
-                   'ipv6-frag': 'ip'
-                   }
+        global iptypes
 
         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(
-                "./%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)
+                "set nbcore %d" % (queue + 1), "testpmd> ")
 
-            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("port stop all", "testpmd> ")
+            self.dut.send_expect(
+                "set_hash_global_config  0 toeplitz %s enable" % iptype, "testpmd> ")
+            self.dut.send_expect("port start all", "testpmd> ")
+            out = self.dut.send_expect(
+                "port config all rss %s" % rsstype, "testpmd> ")
+            self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
+            # 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(
-                    "set nbcore %d" % (queue + 1), "testpmd> ")
+                    "port config 0 rss reta (%d,%d)" % (i, 
+ reta_entries[i]), "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> ")
-                out = self.dut.send_expect(
-                    "port config all rss %s" % rsstype, "testpmd> ")
-                self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
-                # 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.send_packet(itf, iptype)
 
         self.dut.send_expect("quit", "# ", 30)
 
@@ -493,72 +508,48 @@ class TestPmdrssHash(TestCase):
         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': 'sctp',
-                   'ipv6-udp': 'udp',
-                   'ipv6-tcp': 'tcp',
-                   'ipv6-frag': 'ip'
-                   }
+        global iptypes
 
         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)
+        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> ")
+        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("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> ")
+            out = self.dut.send_expect(
+                "port config all rss %s" % rsstype, "testpmd> ")
+            self.verify("error" not in out, "Configuration of RSS hash 
+ failed: Invalid argument")
+
+            # 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(
-                    "set_sym_hash_ena_per_port 0 enable", "testpmd> ")
-                self.dut.send_expect("port start all", "testpmd> ")
-                out = self.dut.send_expect(
-                    "port config all rss %s" % rsstype, "testpmd> ")
-                self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
+                    "port config 0 rss reta (%d,%d)" % (i, 
+ reta_entries[i]), "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.send_packet_symmetric(itf, iptype)
-
-            self.dut.send_expect("quit", "# ", 30)
+        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': 'sctp',
-                   'ipv6-udp': 'udp',
-                   'ipv6-tcp': 'tcp',
-                   'ipv6-frag': 'ip'
-                   }
+        global iptypes
+
         if self.kdriver in ["fm10k"]:
             iptypes.pop('ipv4-sctp')
             iptypes.pop('ipv6-sctp')
@@ -566,36 +557,34 @@ class TestPmdrssHash(TestCase):
         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.logger.info("***********************%s rss test********************************" % iptype)
+            self.dut.send_expect("set verbose 8", "testpmd> ")
+            self.dut.send_expect("set fwd rxonly", "testpmd> ")
             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)
+                "set nbcore %d" % (queue + 1), "testpmd> ")
 
-            for iptype, rsstype in iptypes.items():
-                self.logger.info("***********************%s rss test********************************" % iptype)
-                self.dut.send_expect("set verbose 8", "testpmd> ")
-                self.dut.send_expect("set fwd rxonly", "testpmd> ")
+            self.dut.send_expect("port stop all", "testpmd> ")
+            # some nic not support change hash algorithm
+            if self.kdriver not in ["fm10k"]:
+                self.dut.send_expect(
+                    "set_hash_global_config 0 simple_xor %s enable" % iptype, "testpmd> ")
+            self.dut.send_expect("port start all", "testpmd> ")
+            out = self.dut.send_expect(
+                "port config all rss %s" % rsstype, "testpmd> ")
+            self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
+            # 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(
-                    "set nbcore %d" % (queue + 1), "testpmd> ")
-
-                self.dut.send_expect("port stop all", "testpmd> ")
-                # some nic not support change hash algorithm
-                if self.kdriver not in ["fm10k"]:
-                    self.dut.send_expect(
-                        "set_hash_global_config 0 simple_xor %s enable" % iptype, "testpmd> ")
-                self.dut.send_expect("port start all", "testpmd> ")
-                out = self.dut.send_expect(
-                    "port config all rss %s" % rsstype, "testpmd> ")
-                self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
-                # 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)
+                    "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):
 
@@ -603,57 +592,46 @@ class TestPmdrssHash(TestCase):
         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': 'sctp',
-                   'ipv6-udp': 'udp',
-                   'ipv6-tcp': 'tcp',
-                   'ipv6-frag': 'ip'
-                   }
+        global iptypes
         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)
+        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> ")
+        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("port stop all", "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> ")
+
+            out = self.dut.send_expect(
+                "port config all rss %s" % rsstype, "testpmd> ")
+            self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
+            # 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(
-                    "set_sym_hash_ena_per_port 0 enable", "testpmd> ")
-                self.dut.send_expect("port start all", "testpmd> ")
-
-                out = self.dut.send_expect(
-                    "port config all rss %s" % rsstype, "testpmd> ")
-                self.verify("error" not in out, "Configuration of RSS hash failed: Invalid argument")
-                # 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> ")
+                    "port config 0 rss reta (%d,%d)" % (i, reta_entries[i]), "testpmd> ")
+            self.send_packet_symmetric(itf, iptype)
 
-                self.send_packet_symmetric(itf, iptype)
-
-            self.dut.send_expect("quit", "# ", 30)
+        self.dut.send_expect("quit", "# ", 30)
 
     def test_dynamic_rss_bond_config(self):
         
         # setup testpmd and finish bond config
+        self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
+                    "fortpark_TLV", "fortville_25g"],
+                    "NIC Unsupported: " + str(self.nic))
+
         self.dut.send_expect("./%s/app/testpmd -c f -n 4 -- -i" % self.target, "testpmd> ", 120)
         out = self.dut.send_expect("create bonded device 3 0", "testpmd> ", 30)
         bond_device_id = int(re.search("port \d+", out).group().split(" ")[-1].strip())
--
2.5.0



More information about the dts mailing list