test suite reviews and discussions
 help / color / mirror / Atom feed
From: Bo Chen <BoX.C.Chen@intel.com>
To: dts@dpdk.org
Cc: Bo Chen <BoX.C.Chen@intel.com>
Subject: [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow
Date: Wed, 21 Apr 2021 16:10:41 +0000	[thread overview]
Message-ID: <20210421161041.103613-1-BoX.C.Chen@intel.com> (raw)

1. replace legacy filter command with rte flow.
2. reduce execution time
3. fix wrong running logic

Signed-off-by: Bo Chen <BoX.C.Chen@intel.com>
---
 tests/TestSuite_rss_key_update.py | 99 +++++++++++++++++++------------
 1 file changed, 60 insertions(+), 39 deletions(-)

diff --git a/tests/TestSuite_rss_key_update.py b/tests/TestSuite_rss_key_update.py
index adb44f18..4a9e3d83 100644
--- a/tests/TestSuite_rss_key_update.py
+++ b/tests/TestSuite_rss_key_update.py
@@ -60,6 +60,7 @@ iptypes = {'ipv4-sctp': 'sctp',
            'ipv6-frag': 'ip'
            }
 
+
 class TestRssKeyUpdate(TestCase):
 
     def send_packet(self, itf, tran_type, symmetric):
@@ -72,7 +73,7 @@ class TestRssKeyUpdate(TestCase):
             'ipv4-frag': 'IP(src="192.168.0.%d", dst="192.168.0.%d",frag=1,flags="MF")',
             'ipv4-udp': 'IP(src="192.168.0.%d", dst="192.168.0.%d")/UDP(sport=1024,dport=1024)',
             'ipv4-tcp': 'IP(src="192.168.0.%d", dst="192.168.0.%d")/TCP(sport=1024,dport=1024)',
-            'ipv6-other':'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")',
+            'ipv6-other': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")',
             'ipv6-sctp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d", nh=132)/SCTP(sport=1024,dport=1024,tag=1)',
             'ipv6-udp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/UDP(sport=1024,dport=1024)',
             'ipv6-tcp': 'IPv6(src="3ffe:2501:200:1fff::%d", dst="3ffe:2501:200:3::%d")/TCP(sport=1024,dport=1024)',
@@ -86,12 +87,13 @@ class TestRssKeyUpdate(TestCase):
 
         # send packet with different source and dest ip
         if tran_type in packet_list.keys():
-            packet_temp = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/%s], iface="%s")' % (mac, itf, packet_list[tran_type], itf)
+            packet_temp = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/%s], iface="%s")' % (
+                mac, itf, packet_list[tran_type], itf)
             for i in range(10):
                 packet = packet_temp % (i + 1, i + 2)
                 self.tester.scapy_append(packet)
                 if symmetric:
-                    packet2 = packet_list[tran_type] % (mac, itf, i + 2, i + 1, itf)
+                    packet2 = packet_temp % (i + 2, i + 1)
                     self.tester.scapy_append(packet2)
             self.tester.scapy_execute()
             time.sleep(.5)
@@ -124,12 +126,13 @@ class TestRssKeyUpdate(TestCase):
                 reta_line[name.strip()] = value.strip()
                 received_pkts.append(reta_line)
 
-        return(self.verifyResult(received_pkts, symmetric))
+        return self.verifyResult(received_pkts, symmetric)
 
     def verifyResult(self, reta_lines, symmetric):
         """
         Verify whether or not the result passes.
         """
+        global pre_RSS_hash
         result = []
         key_id = {}
         self.verify(len(reta_lines) > 0, 'No packet received!')
@@ -137,15 +140,14 @@ class TestRssKeyUpdate(TestCase):
             ['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass '])
 
         for i, tmp_reta_line in enumerate(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
-            if(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
+            if reta_entries[hash_index] == int(tmp_reta_line["queue"]):
                 status = "true"
                 result.insert(i, 0)
                 if symmetric:
-                    if(i % 2 == 1):
-                        if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
+                    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:
@@ -168,9 +170,10 @@ class TestRssKeyUpdate(TestCase):
         Run at the start of each test suite.
         """
 
-        self.verify(self.nic in ["columbiaville_25g", "columbiaville_100g","fortville_eagle", "fortville_spirit",
-                    "fortville_spirit_single", "redrockcanyou", "atwood",
-                    "boulderrapid", "fortpark_TLV", "fortpark_BASE-T","fortville_25g", "niantic", "carlsville", "foxville"],
+        self.verify(self.nic in ["columbiaville_25g", "columbiaville_100g", "fortville_eagle", "fortville_spirit",
+                                 "fortville_spirit_single", "redrockcanyou", "atwood",
+                                 "boulderrapid", "fortpark_TLV", "fortpark_BASE-T", "fortville_25g", "niantic",
+                                 "carlsville", "foxville"],
                     "NIC Unsupported: " + str(self.nic))
         global reta_num
         global iptypes
@@ -179,7 +182,7 @@ class TestRssKeyUpdate(TestCase):
             queue = 4
 
         if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV",
-                        "fortpark_BASE-T","fortville_25g", "carlsville"]:
+                        "fortpark_BASE-T", "fortville_25g", "carlsville"]:
             reta_num = 512
         elif self.nic in ["niantic", "foxville"]:
             reta_num = 128
@@ -224,27 +227,31 @@ class TestRssKeyUpdate(TestCase):
         self.dut.send_expect("set fwd rxonly", "testpmd> ")
         self.dut.send_expect("set promisc all off", "testpmd> ")
         self.dut.send_expect(f"set nbcore {queue + 1}", "testpmd> ")
+        key = '4439796BB54C5023B675EA5B124F9F30B8A2C03DDFDC4D02A08C9B334AF64A4C05C6FA343958D8557D99583AE138C92E81150366'
+        ck = '4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF'
+
+        # 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(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ")
 
         for iptype, rsstype in list(iptypes.items()):
             self.logger.info(f"***********************{iptype} rss test********************************")
-            self.dut.send_expect("port stop all", "testpmd> ")
-            self.dut.send_expect(f"set_hash_global_config 0 toeplitz {iptype} enable", "testpmd> ")
-            self.dut.send_expect("port start all", "testpmd> ")
+            self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {key}", "testpmd> ")
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+            cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end func toeplitz / end'
+            self.dut.send_expect(cmd, "testpmd> ")
             out = self.dut.send_expect(f"port config all rss {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(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ")
-
             ori_output = self.send_packet(self.itf, iptype, False)
-
             self.dut.send_expect("show port 0 rss-hash key", "testpmd> ")
-            self.dut.send_expect(f"port config 0 rss-hash-key {iptype} 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ")
-
+            self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {ck}", "testpmd> ")
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+            cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end func toeplitz / end'
+            self.dut.send_expect(cmd, "testpmd> ")
             new_output = self.send_packet(self.itf, iptype, False)
-
-            self.verify(ori_output != new_output, "before and after results are the same, hash key configuration failed!")
+            self.verify(ori_output != new_output,
+                        "before and after results are the same, hash key configuration failed!")
 
     def test_set_hash_key_toeplitz_symmetric(self):
 
@@ -252,30 +259,44 @@ class TestRssKeyUpdate(TestCase):
         self.dut.send_expect("set fwd rxonly", "testpmd> ")
         self.dut.send_expect("set promisc all off", "testpmd> ")
         self.dut.send_expect(f"set nbcore {queue + 1}", "testpmd> ")
+        key = '4439796BB54C5023B675EA5B124F9F30B8A2C03DDFDC4D02A08C9B334AF64A4C05C6FA343958D8557D99583AE138C92E81150366'
+        ck = '4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF'
+        rule_action = 'func symmetric_toeplitz queues end / end'
+
+        # 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(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ")
 
         for iptype, rsstype in list(iptypes.items()):
             self.logger.info(f"***********************{iptype} rss test********************************")
-            self.dut.send_expect("port stop all", "testpmd> ")
-            self.dut.send_expect(f"set_hash_global_config 0 toeplitz {iptype} enable", "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(f"port config 0 rss-hash-key {iptype} {key}", "testpmd> ")
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+            rule_cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end {rule_action}'
+            if 'sctp' in iptype or 'udp' in iptype or 'tcp' in iptype:
+                rule_cmd = rule_cmd.replace('/ ipv4 /', f'/ ipv4 / {rsstype} /')
+            if 'ipv6' in iptype:
+                rule_cmd = rule_cmd.replace('ipv4', 'ipv6')
+
+            self.dut.send_expect(rule_cmd, "testpmd> ")
             out = self.dut.send_expect(f"port config all rss {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(f"port config 0 rss reta ({i},{reta_entries[i]})", "testpmd> ")
-
             ori_output = self.send_packet(self.itf, iptype, True)
-
             out = self.dut.send_expect("show port 0 rss-hash key", "testpmd> ")
             self.verify("rss disable" not in out, "rss is disable!")
-            self.dut.send_expect(f"port config 0 rss-hash-key {iptype} 4439796BB54C50f3B675EF5B124F9F30B8A2C0FFFFDC4D02A08C9B334FF64A4C05C6FA343958D855FFF9583AE138C92E81150FFF", "testpmd> ")
+            self.dut.send_expect(f"port config 0 rss-hash-key {iptype} {ck}", "testpmd> ")
 
-            new_output = self.send_packet(self.itf, iptype, True)
+            self.dut.send_expect("flow flush 0", "testpmd> ")
+            cmd = f'flow create 0 ingress pattern eth / ipv4 / end actions rss types {iptype} end queues end {rule_action}'
+            if 'sctp' in iptype or 'udp' in iptype or 'tcp' in iptype:
+                cmd = cmd.replace('/ ipv4 /', f'/ ipv4 / {rsstype} /')
+            if 'ipv6' in iptype:
+                cmd = cmd.replace('ipv4', 'ipv6')
 
-            self.verify(ori_output != new_output, "before and after results are the same, hash key configuration failed!")
+            self.dut.send_expect(cmd, "testpmd> ")
+            new_output = self.send_packet(self.itf, iptype, True)
+            self.verify(ori_output != new_output,
+                        "before and after results are the same, hash key configuration failed!")
 
     def test_set_hash_key_short_long(self):
 
-- 
2.31.1


             reply	other threads:[~2021-04-21  8:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 16:10 Bo Chen [this message]
2021-04-21  8:11 ` Chen, BoX C
2021-05-07  7:33   ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421161041.103613-1-BoX.C.Chen@intel.com \
    --to=box.c.chen@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).