test suite reviews and discussions
 help / color / mirror / Atom feed
* Re: [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow
  2021-04-21 16:10 [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow Bo Chen
@ 2021-04-21  8:11 ` Chen, BoX C
  2021-05-07  7:33   ` Tu, Lijuan
  0 siblings, 1 reply; 3+ messages in thread
From: Chen, BoX C @ 2021-04-21  8:11 UTC (permalink / raw)
  To: dts

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Tested-by: Bo Chen <boX.c.chen@intel.com>

Regards,
Chen Bo

> -----Original Message-----
> From: Chen, BoX C <box.c.chen@intel.com>
> Sent: April 22, 2021 0:11
> To: dts@dpdk.org
> Cc: Chen, BoX C <box.c.chen@intel.com>
> Subject: [dts][PATCH V1] tests/rss_key_update: replace legacy filter with rte
> flow


[-- Attachment #2: TestRssKeyUpdate.log --]
[-- Type: application/octet-stream, Size: 636142 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow
@ 2021-04-21 16:10 Bo Chen
  2021-04-21  8:11 ` Chen, BoX C
  0 siblings, 1 reply; 3+ messages in thread
From: Bo Chen @ 2021-04-21 16:10 UTC (permalink / raw)
  To: dts; +Cc: Bo Chen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow
  2021-04-21  8:11 ` Chen, BoX C
@ 2021-05-07  7:33   ` Tu, Lijuan
  0 siblings, 0 replies; 3+ messages in thread
From: Tu, Lijuan @ 2021-05-07  7:33 UTC (permalink / raw)
  To: Chen, BoX C, dts

Applied.

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Chen, BoX C
> Sent: 2021年4月21日 16:12
> To: dts@dpdk.org
> Subject: Re: [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte
> flow
> 
> Tested-by: Bo Chen <boX.c.chen@intel.com>
> 
> Regards,
> Chen Bo
> 
> > -----Original Message-----
> > From: Chen, BoX C <box.c.chen@intel.com>
> > Sent: April 22, 2021 0:11
> > To: dts@dpdk.org
> > Cc: Chen, BoX C <box.c.chen@intel.com>
> > Subject: [dts][PATCH V1] tests/rss_key_update: replace legacy filter
> > with rte flow


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-07  7:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 16:10 [dts] [PATCH V1] tests/rss_key_update: replace legacy filter with rte flow Bo Chen
2021-04-21  8:11 ` Chen, BoX C
2021-05-07  7:33   ` Tu, Lijuan

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git