test suite reviews and discussions
 help / color / mirror / Atom feed
From: Zhimin Huang <zhiminx.huang@intel.com>
To: dts@dpdk.org, yuan.peng@intel.com
Cc: Zhimin Huang <zhiminx.huang@intel.com>
Subject: [dts] [PATCH V2 1/4] tests/cvl_advanced_rss:add pf rss cases
Date: Fri,  7 Jan 2022 23:08:14 +0800
Message-ID: <20220107150817.16139-1-zhiminx.huang@intel.com> (raw)

add pf rss test case with checksum as inputset.

v2:
- add new test case

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/TestSuite_cvl_advanced_rss.py | 468 +++++++++++++++++++++++++++-
 1 file changed, 467 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_cvl_advanced_rss.py b/tests/TestSuite_cvl_advanced_rss.py
index d84ef395..7020f8f1 100644
--- a/tests/TestSuite_cvl_advanced_rss.py
+++ b/tests/TestSuite_cvl_advanced_rss.py
@@ -37,7 +37,7 @@ from framework.packet import Packet
 from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase
 
-from .rte_flow_common import RssProcessing
+from .rte_flow_common import RssProcessing, FdirProcessing, check_mark
 
 # toeplitz related data start
 mac_ipv4_toeplitz_basic_pkt = {
@@ -683,6 +683,40 @@ mac_ipv4_all = {
     ],
 }
 
+mac_ipv4_ipv4_chksum = {
+    'sub_casename': 'mac_ipv4_ipv4_chksum',
+    'port_id': 0,
+    'rule': 'flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4-chksum  end queues end / end',
+    'test': [
+        {
+            'send_packet': eval(str(mac_ipv4_toeplitz_basic_pkt['ipv4-nonfrag']).replace('src="192.168.0.2"',
+                                                                                         'src="192.168.0.2", chksum=0x1')),
+            'action': 'save_hash',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_toeplitz_basic_pkt['ipv4-nonfrag']).replace('src="192.168.0.2"',
+                                                                                         'src="192.168.0.2", chksum=0xffff')),
+            'action': 'check_hash_different',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_toeplitz_basic_pkt['ipv4-nonfrag']).replace('dst="192.168.0.1", src="192.168.0.2"',
+                                                                                         'dst="192.168.1.1", src="192.168.1.2", chksum=0x1')),
+            'action': 'check_hash_same',
+        },
+        {
+            'send_packet': mac_ipv6_toeplitz_basic_pkt['ipv6-nonfrag'],
+            'action': 'check_no_hash',
+        },
+    ],
+    'post-test': [
+        {
+            'send_packet': eval(str(mac_ipv4_toeplitz_basic_pkt['ipv4-nonfrag']).replace('src="192.168.0.2"',
+                                                                                         'src="192.168.0.2", chksum=0x1')),
+            'action': 'check_no_hash',
+        },
+    ],
+}
+
 #mac ipv4_udp
 mac_ipv4_udp_l2_src = {
     'sub_casename': 'mac_ipv4_udp_l2_src',
@@ -1146,6 +1180,72 @@ mac_ipv4_udp_ipv4 = {
     ],
 }
 
+mac_ipv4_udp_l4_chksum = {
+    'sub_casename': 'mac_ipv4_udp_l4_chksum',
+    'port_id': 0,
+    'rule': 'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types l4-chksum  end queues end / end',
+    'test': [
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace("dport=23", "dport=23,chksum=0xffff")),
+            'action': 'save_hash',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace("dport=23", "dport=23,chksum=0xfffe")),
+            'action': 'check_hash_different',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace('dst="192.168.0.1", src="192.168.0.2"',
+                                                                                         'dst="192.168.1.1", src="192.168.1.2", chksum=0x3')
+                                                                                .replace('sport=22,dport=23', 'sport=32,dport=33,chksum=0xffff')),
+            'action': 'check_hash_same',
+        },
+        {
+            'send_packet': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1",dst="192.168.0.2")/SCTP(sport=22, dport=23,chksum=0xffff)/("X"*48)',
+            'action': 'check_no_hash',
+        },
+    ],
+    'post-test': [
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace("dport=23", "dport=23,chksum=0xffff")),
+            'action': 'check_no_hash',
+        },
+    ],
+}
+
+mac_ipv4_udp_ipv4_chksum = {
+    'sub_casename': 'mac_ipv4_udp_ipv4_chksum',
+    'port_id': 0,
+    'rule': 'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types ipv4-chksum  end queues end / end',
+    'test': [
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace('src="192.168.0.2"', 'src="192.168.0.2",chksum=0xffff')),
+            'action': 'save_hash',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace('src="192.168.0.2"', 'src="192.168.0.2",chksum=0xfffe')),
+            'action': 'check_hash_different',
+        },
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace('dst="192.168.0.1", src="192.168.0.2"',
+                                                                                         'dst="192.168.1.1", src="192.168.1.2", chksum=0xffff')
+                                                                                .replace('sport=22,dport=23', 'sport=32,dport=33,chksum=0xffff')),
+            'action': 'check_hash_same',
+        },
+        {
+            'send_packet': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1",dst="192.168.0.2")/SCTP(sport=22, dport=23,chksum=0xffff)/("X"*48)',
+            'action': 'check_no_hash',
+        },
+    ],
+    'post-test': [
+        {
+            'send_packet': eval(str(mac_ipv4_udp_toeplitz_basic_pkt['ipv4-udp']).replace('src="192.168.0.2"', 'src="192.168.0.2",chksum=0xffff')),
+            'action': 'check_no_hash',
+        },
+    ],
+}
+
+mac_ipv4_udp_chksum = [mac_ipv4_udp_l4_chksum, mac_ipv4_udp_ipv4_chksum]
+
 #mac ipv4_tcp
 mac_ipv4_tcp_l2_src = {
     'sub_casename': 'mac_ipv4_tcp_l2_src',
@@ -1609,6 +1709,11 @@ mac_ipv4_tcp_ipv4 = {
     ],
 }
 
+mac_ipv4_tcp_chksum = [eval(str(element).replace("mac_ipv4_udp", "mac_ipv4_tcp")
+                                        .replace("ipv4 / udp", "ipv4 / tcp")
+                                        .replace("/UDP(sport=", "/TCP(sport="))
+                                    for element in mac_ipv4_udp_chksum]
+
 #mac ipv4_sctp
 mac_ipv4_sctp_l2_src = {
     'sub_casename': 'mac_ipv4_sctp_l2_src',
@@ -2072,6 +2177,12 @@ mac_ipv4_sctp_ipv4 = {
     ],
 }
 
+mac_ipv4_sctp_chksum = [eval(str(element).replace("mac_ipv4_udp", "mac_ipv4_sctp")
+                                         .replace("SCTP(sport=", "TCP(sport=")
+                                         .replace("ipv4 / udp", "ipv4 / sctp")
+                                         .replace("/UDP(sport=", "/SCTP(sport="))
+                                    for element in mac_ipv4_udp_chksum]
+
 #mac_ipv6
 mac_ipv6_l2_src = {
     'sub_casename': 'mac_ipv6_l2_src',
@@ -2997,6 +3108,38 @@ mac_ipv6_udp_ipv6 = {
     ],
 }
 
+mac_ipv6_udp_l4_chksum = {
+    'sub_casename': 'mac_ipv6_udp_l4_chksum',
+    'port_id': 0,
+    'rule': 'flow create 0 ingress pattern eth / ipv6 / udp / end actions rss types l4-chksum  end queues end / end',
+    'test': [
+        {
+            'send_packet': eval(str(mac_ipv6_toeplitz_basic_pkt['ipv6-udp']).replace("dport=23", "dport=23, chksum=0x1")),
+            'action': 'save_hash',
+        },
+        {
+            'send_packet': eval(str(mac_ipv6_toeplitz_basic_pkt['ipv6-udp']).replace("dport=23", "dport=23, chksum=0x2")),
+            'action': 'check_hash_different',
+        },
+        {
+            'send_packet': eval(str(mac_ipv6_toeplitz_basic_pkt['ipv6-udp']).replace("sport=22,dport=23", "sport=22,dport=23,chksum=0x1")
+                                                                            .replace("1800:2929", "1800:3939")
+                                                                            .replace("2020", "3030")),
+            'action': 'check_hash_same',
+        },
+        {
+            'send_packet': eval(str(mac_ipv6_toeplitz_basic_pkt['ipv6-udp']).replace("/UDP(sport=22,dport=23)", "/SCTP(sport=22,dport=23,chksum=0x1)")),
+            'action': 'check_no_hash',
+        },
+    ],
+    'post-test': [
+        {
+            'send_packet': eval(str(mac_ipv6_toeplitz_basic_pkt['ipv6-udp']).replace("dport=23", "dport=23, chksum=0x1")),
+            'action': 'check_no_hash',
+        },
+    ],
+}
+
 #mac_ipv6_tcp
 mac_ipv6_tcp_l2_src = {
     'sub_casename': 'mac_ipv6_tcp_l2_src',
@@ -3444,6 +3587,10 @@ mac_ipv6_tcp_ipv6 = {
     ],
 }
 
+mac_ipv6_tcp_l4_chksum = eval(str(mac_ipv6_udp_l4_chksum).replace("mac_ipv6_udp", "mac_ipv6_tcp")
+                                                         .replace("ipv6 / udp", "ipv6 / tcp")
+                                                         .replace("/UDP(sport=", "/TCP(sport="))
+
 #mac_ipv6_sctp
 mac_ipv6_sctp_l2_src = {
     'sub_casename': 'mac_ipv6_sctp_l2_src',
@@ -3891,6 +4038,11 @@ mac_ipv6_sctp_ipv6 = {
     ],
 }
 
+mac_ipv6_sctp_l4_chksum = eval(str(mac_ipv6_udp_l4_chksum).replace("mac_ipv6_udp", "mac_ipv6_sctp")
+                                                          .replace("/SCTP(sport=", "/TCP(sport=")
+                                                          .replace("ipv6 / udp", "ipv6 / sctp")
+                                                          .replace("/UDP(sport=", "/SCTP(sport="))
+
 # toeplitz related data end
 
 mac_ipv4_1 = [mac_ipv4_l2_src, mac_ipv4_l2_dst, mac_ipv4_l2src_l2dst]
@@ -5032,6 +5184,34 @@ class AdvancedRSSTest(TestCase):
         self.switch_testpmd(symmetric=True)
         self.rssprocess.handle_rss_distribute_cases(cases_info=mac_global_simple_xor)
 
+    def test_mac_ipv4_ipv4_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=[mac_ipv4_ipv4_chksum])
+
+    def test_mac_ipv4_udp_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_udp_chksum)
+
+    def test_mac_ipv4_tcp_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_tcp_chksum)
+
+    def test_mac_ipv4_sctp_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=mac_ipv4_sctp_chksum)
+
+    def test_mac_ipv6_udp_l4_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=[mac_ipv6_udp_l4_chksum])
+
+    def test_mac_ipv6_tcp_l4_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=[mac_ipv6_tcp_l4_chksum])
+
+    def test_mac_ipv6_sctp_l4_checksum(self):
+        self.switch_testpmd(symmetric=False)
+        self.rssprocess.handle_rss_distribute_cases(cases_info=[mac_ipv6_sctp_l4_chksum])
+
     def test_negative_case(self):
         self.switch_testpmd(symmetric=False)
         rules = [
@@ -5062,6 +5242,14 @@ class AdvancedRSSTest(TestCase):
             out = self.pmd_output.execute_cmd(i, timeout=1)
             self.verify('Invalid argument' in out, "rule %s validate successfully" % i)
 
+        rules_chksum = [
+            'flow create 0 ingress pattern eth / ipv4 / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / end actions rss types ipv6-chksum  end queues end / end'
+        ]
+        for i in rules_chksum:
+            out = self.pmd_output.execute_cmd(i)
+            self.verify('Invalid argument' in out or 'Bad arguments' in out, "negative rules not support to create")
+
     def test_multirules(self):
         self.switch_testpmd(symmetric=True)
         #Subcase 1: two rules with same pattern but different hash input set, not hit default profile
@@ -5236,6 +5424,284 @@ class AdvancedRSSTest(TestCase):
         self.rssprocess.destroy_rule(port_id=0, rule_id=rule_id_0)
         self.verify(not self.rssprocess.error_msgs, 'some subcases failed')
 
+    def test_checksum_for_different_payload_length(self):
+        self.rssprocess.error_msgs = []
+        self.pmd_output.quit()
+        self.pmd_output.start_testpmd(cores="1S/4C/1T", param="--rxq={0} --txq={0}".format(self.rxq),
+                                      eal_param=f"-a {self.pci0}", socket=self.ports_socket)
+        self.pmd_output.execute_cmd("set verbose 1")
+        self.pmd_output.execute_cmd("set fwd rxonly")
+        self.pmd_output.execute_cmd("start")
+        pkt_list = [
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/("X"*64)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/UDP()/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/UDP()/("X"*64)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/TCP()/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/TCP()/("X"*64)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/SCTP()/("X"*64)',
+        ]
+        rule_list = [
+            'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types ipv4-udp  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types ipv4-tcp  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / sctp / end actions rss types ipv4-sctp  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / sctp / end actions rss types l4-chksum  end queues end / end'
+        ]
+        test_temp = {
+                'send_packet': '',
+                'action': '',
+            }
+        pre_test = []
+        for i in range(len(pkt_list)):
+            if i == 0:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'save_hash'"))
+            else:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'check_hash_same'"))
+            pre_test.append(tests)
+        self.rssprocess.handle_tests(pre_test)
+        test_5_tuple = []
+        rules = self.rssprocess.create_rule(rule_list[0:3])
+        self.rssprocess.check_rule(rule_list=rules)
+        for i in range(len(pkt_list)):
+            if i % 2 == 0:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'save_hash'"))
+            else:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'check_hash_same'"))
+            test_5_tuple.append(tests)
+        self.rssprocess.handle_tests(test_5_tuple)
+        test_l4_chksum = []
+        rules = self.rssprocess.create_rule(rule_list[3:])
+        self.rssprocess.check_rule(rule_list=rules)
+        for i in range(2, len(pkt_list)):
+            if i % 2 == 0:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'save_hash'"))
+            else:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'check_hash_different'"))
+            test_l4_chksum.append(tests)
+        self.rssprocess.handle_tests(test_l4_chksum)
+        test_ipv4_chksum = []
+        ipv4_chksum_rule = eval(str(rule_list).replace("l4-chksum", "ipv4-chksum"))
+        rules = self.rssprocess.create_rule(ipv4_chksum_rule[3:] + ["flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4-chksum  end queues end / end"])
+        self.rssprocess.check_rule(rule_list=rules)
+        for i in range(len(pkt_list)):
+            if i % 2 == 0:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'save_hash'"))
+            else:
+                tests = eval(str(test_temp).replace("'send_packet': ''", "'send_packet': '{}'".format(pkt_list[i]))
+                             .replace("'action': ''", "'action': 'check_hash_different'"))
+            test_ipv4_chksum.append(tests)
+        self.rssprocess.handle_tests(test_ipv4_chksum)
+        self.verify(not self.rssprocess.error_msgs, 'some subcases failed')
+
+    def validate_packet_checksum(self, pkts, expect_pkts):
+        expect_chksum = dict()
+        checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)")
+        self.tester.send_expect("scapy", ">>> ")
+        sniff_src = self.dut.get_mac_address(self.dut_ports[0])
+        for pkt in expect_pkts:
+            self.tester.send_expect("p = %s" % expect_pkts[pkt], ">>>")
+            out = self.tester.send_expect("p.show2()", ">>>")
+            chksums = checksum_pattern.findall(out)
+            expect_chksum[pkt] = chksums
+        self.logger.info(expect_chksum)
+        self.tester.send_expect("exit()", "#")
+        for pkt in pkts:
+            inst = self.tester.tcpdump_sniff_packets(intf=self.tester_iface0, count=len(pkts), filters=[{'layer': 'ether', 'config': {'src': sniff_src}}])
+            out = self.rssprocess.send_pkt_get_output(pkts=pkts[pkt])
+            rece_pkt = self.tester.load_tcpdump_sniff_packets(inst)
+            rece_chksum = rece_pkt[0].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%").split(";")
+            self.logger.info(rece_chksum)
+            test_chksum = []
+            [test_chksum.append(i) for i in rece_chksum if i != '??']
+            self.logger.info("expect_chksum:{} test_chksum:{}".format(expect_chksum[pkt], test_chksum))
+            self.verify(expect_chksum[pkt] == test_chksum, 'tx checksum is incorrect')
+
+    def test_flow_rule_not_impact_rx_tx_chksum(self):
+        self.pmd_output.quit()
+        self.pmd_output.start_testpmd(cores="1S/4C/1T", param="--rxq={0} --txq={0}".format(self.rxq),
+                                      eal_param=f"-a {self.pci0}", socket=self.ports_socket)
+        self.pmd_output.execute_cmd("set verbose 1")
+        self.pmd_output.execute_cmd("port stop all")
+        self.pmd_output.execute_cmd("set fwd csum")
+        self.pmd_output.execute_cmd("csum set ip hw 0")
+        self.pmd_output.execute_cmd("csum set udp hw 0")
+        self.pmd_output.execute_cmd("csum set tcp hw 0")
+        self.pmd_output.execute_cmd("csum set sctp hw 0")
+        self.pmd_output.execute_cmd("port start all")
+        self.pmd_output.execute_cmd("start")
+        self.tester.check_interfaces_link(self.tester_iface0)
+        pkt_list = {
+            'IP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1", chksum=0xfff3)/("X"*48)',
+            'IP/TCP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/TCP(sport=22, chksum=0xfff3)/("X"*48)',
+            'IP/UDP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/UDP(sport=22, chksum=0x1)/("X"*48)',
+            'IP/SCTP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/SCTP(sport=22, chksum=0x0)/("X"*48)',
+            'IPv6/TCP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/TCP(sport=22, chksum=0xe38)/("X"*48)',
+            'IPv6/UDP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/UDP(sport=22, chksum=0xe38)/("X"*48)',
+            'IPv6/SCTP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/SCTP(sport=22, chksum=0x0)/("X"*48)',
+        }
+        expect_pkt = {
+            'IP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/("X"*48)',
+            'IP/TCP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/TCP(sport=22)/("X"*48)',
+            'IP/UDP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/UDP(sport=22)/("X"*48)',
+            'IP/SCTP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/SCTP(sport=22)/("X"*48)',
+            'IPv6/TCP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/TCP(sport=22)/("X"*48)',
+            'IPv6/UDP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/UDP(sport=22)/("X"*48)',
+            'IPv6/SCTP': 'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/SCTP(sport=22)/("X"*48)',
+        }
+        rule_list = [
+            'flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / sctp / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / tcp / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / udp / end actions rss types l4-chksum end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / sctp / end actions rss types l4-chksum end queues end / end',
+        ]
+        self.validate_packet_checksum(pkt_list, expect_pkt)
+        rss_test = {
+            'sub_casename': 'rss_test',
+            'port_id': 0,
+            'rule': rule_list,
+            'pre-test': [
+                {
+                    'send_packet': pkt_list['IP'],
+                    'action': {'save_hash': 'IP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/TCP'],
+                    'action': {'save_hash': 'IP/TCP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/UDP'],
+                    'action': {'save_hash': 'IP/UDP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/SCTP'],
+                    'action': {'save_hash': 'IP/SCTP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/TCP'],
+                    'action': {'save_hash': 'IPv6/TCP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/UDP'],
+                    'action': {'save_hash': 'IPv6/UDP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/SCTP'],
+                    'action': {'save_hash': 'IPv6/SCTP'},
+                },
+            ],
+            'test': [
+                {
+                    'send_packet': pkt_list['IP'],
+                    'action': {'check_hash_different': 'IP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/TCP'],
+                    'action': {'check_hash_different': 'IP/TCP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/UDP'],
+                    'action': {'check_hash_different': 'IP/UDP'},
+                },
+                {
+                    'send_packet': pkt_list['IP/SCTP'],
+                    'action': {'check_hash_different': 'IP/SCTP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/TCP'],
+                    'action': {'check_hash_different': 'IPv6/TCP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/UDP'],
+                    'action': {'check_hash_different': 'IPv6/UDP'},
+                },
+                {
+                    'send_packet': pkt_list['IPv6/SCTP'],
+                    'action': {'check_hash_different': 'IPv6/SCTP'},
+                },
+            ],
+        }
+        self.rssprocess.handle_rss_distribute_cases(rss_test)
+        self.validate_packet_checksum(pkt_list, expect_pkt)
+
+    def test_combined_case_with_fdir_queue_group(self):
+        fdirprocess = FdirProcessing(self, self.pmd_output, [self.tester_iface0, self.tester_iface1], self.rxq)
+        hash_and_queue_list = []
+        queue_group = re.compile("end actions rss queues (\d+)\s(\d+)")
+        self.pmd_output.quit()
+        self.pmd_output.start_testpmd(cores="1S/4C/1T", param="--rxq={0} --txq={0}".format(self.rxq),
+                                      eal_param=f"-a {self.pci0}", socket=self.ports_socket)
+        self.pmd_output.execute_cmd("set verbose 1")
+        self.pmd_output.execute_cmd("set fwd rxonly")
+        self.pmd_output.execute_cmd("start")
+        pkt_list = [
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1", chksum=0xfff3)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/TCP(sport=22, chksum=0xfff3)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/UDP(sport=22, chksum=0x1)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP(src="192.168.0.1")/SCTP(sport=22, chksum=0x1)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/TCP(sport=22, chksum=0xe38)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6()/UDP(sport=22, chksum=0xe38)/("X"*48)',
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IPv6(src="ABAB:910A:2222:5498:8475:1111:3900:1010")/SCTP(sport=22, chksum=0xf)/("X"*48)',
+        ]
+        rss_rule_list = [
+            'flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / udp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv4 / sctp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / tcp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / udp / end actions rss types l4-chksum  end queues end / end',
+            'flow create 0 ingress pattern eth / ipv6 / sctp / end actions rss types l4-chksum  end queues end / end',
+        ]
+        fdir_rule_list = [
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 / tcp / end actions rss queues 4 5 end / mark / end',
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 / udp / end actions rss queues 6 7 end / mark / end',
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 / sctp / end actions rss queues 8 9 end / mark / end',
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 / tcp / end actions rss queues 10 11 end / mark / end',
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 / udp / end actions rss queues 12 13 end / mark / end',
+            'flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv6 / sctp / end actions rss queues 14 15 end / mark / end',
+        ]
+        fdirprocess.create_rule(fdir_rule_list)
+        fdir_rule_list.insert(0, "")
+        for i in range(len(pkt_list)):
+            out = fdirprocess.send_pkt_get_output(pkt_list[i])
+            hash_and_queue_tuple = self.rssprocess.get_hash_and_queues(out)
+            if i == 0:
+                check_mark(out, pkt_num=1, check_param={"port_id": 0, "rss": True})
+            else:
+                queue_list = list(map(int, queue_group.search(fdir_rule_list[i]).groups()))
+                check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": queue_list, "mark_id": 0})
+            hash_and_queue_list.append(hash_and_queue_tuple)
+        self.rssprocess.create_rule(rss_rule_list)
+        for i in range(len(pkt_list)):
+            out = fdirprocess.send_pkt_get_output(pkt_list[i])
+            hashes, queues = self.rssprocess.get_hash_and_queues(out)
+            if i == 0:
+                check_mark(out, pkt_num=1, check_param={"port_id": 0, "rss": True})
+                hashes_0 = hashes
+            else:
+                queue_list = list(map(int, queue_group.search(fdir_rule_list[i]).groups()))
+                check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": queue_list, "mark_id": 0})
+            self.logger.info("pre_hash: {}    test_hash: {}".format(hash_and_queue_list[i][0], hashes))
+            self.verify(hash_and_queue_list[i][0] != hashes, "expect hash values changed")
+        self.rssprocess.create_rule("flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 / ipv4 / end actions rss queues 0 1 2 3 end / end")
+        out = fdirprocess.send_pkt_get_output(pkt_list[0])
+        hashes, queues = self.rssprocess.get_hash_and_queues(out)
+        check_mark(out, pkt_num=1, check_param={"port_id": 0, "queue": [1, 2, 3, 4]})
+        self.logger.info("test_hash: {}       post_hash: {}".format(hashes_0, hashes))
+        self.verify(hashes == hashes_0, "expect hash values not changed")
+
     def tear_down(self):
         # destroy all flow rule on port 0
         self.dut.send_command("flow flush 0", timeout=1)
-- 
2.17.1


             reply	other threads:[~2022-01-07  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 15:08 Zhimin Huang [this message]
2022-01-07 15:08 ` [dts] [PATCH V2 2/4] tests/cvl_advanced_iavf_rss:add vf " Zhimin Huang
2022-01-07 15:08 ` [dts] [PATCH V2 3/4] test_plans/cvl_advanced_rss_test_plan:modify testplan Zhimin Huang
2022-01-07 15:08 ` [dts] [PATCH V2 4/4] test_plans/cvl_advanced_iavf_rss_test_plan:modify testplan Zhimin Huang
2022-01-12  5:40   ` 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=20220107150817.16139-1-zhiminx.huang@intel.com \
    --to=zhiminx.huang@intel.com \
    --cc=dts@dpdk.org \
    --cc=yuan.peng@intel.com \
    /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

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://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/ http://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