diff mbox series

[V1,3/4] tests/ice_dcf_dual_vlan: split test suite

Message ID 20220907170656.2551-3-songx.jiale@intel.com (mailing list archive)
State Changes Requested
Headers show
Series [V1,1/4] test_plans/ice_dcf_dual_vlan: split test suite | expand

Commit Message

Song Jiale Sept. 7, 2022, 5:06 p.m. UTC
split the test suite of ice_qinq into ice_dcf_dual_vlan and ice_iavf_dual_vlan.

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---
 ...qinq.py => TestSuite_ice_dcf_dual_vlan.py} | 830 +++++-------------
 1 file changed, 235 insertions(+), 595 deletions(-)
 rename tests/{TestSuite_ice_qinq.py => TestSuite_ice_dcf_dual_vlan.py} (67%)

Comments

Fu, Qi Sept. 13, 2022, 8:58 a.m. UTC | #1
> -----Original Message-----
> From: Song Jiale <songx.jiale@intel.com>
> Sent: Thursday, September 8, 2022 1:07 AM
> To: dts@dpdk.org
> Cc: Jiale, SongX <songx.jiale@intel.com>
> Subject: [dts] [PATCH V1 3/4] tests/ice_dcf_dual_vlan: split test suite
> 
> split the test suite of ice_qinq into ice_dcf_dual_vlan and ice_iavf_dual_vlan.
> 
> Signed-off-by: Song Jiale <songx.jiale@intel.com>
> ---
Acked-by: Fu, Qi <qi.fu@intel.com>
diff mbox series

Patch

diff --git a/tests/TestSuite_ice_qinq.py b/tests/TestSuite_ice_dcf_dual_vlan.py
similarity index 67%
rename from tests/TestSuite_ice_qinq.py
rename to tests/TestSuite_ice_dcf_dual_vlan.py
index c6123643..17f685f5 100644
--- a/tests/TestSuite_ice_qinq.py
+++ b/tests/TestSuite_ice_dcf_dual_vlan.py
@@ -2,7 +2,6 @@ 
 # Copyright(c) 2021 Intel Corporation
 #
 
-import random
 import re
 import time
 
@@ -11,7 +10,7 @@  from framework.pmd_output import PmdOutput
 from framework.test_case import TestCase, check_supported_nic, skip_unsupported_pkg
 from framework.utils import GREEN, RED
 
-from .rte_flow_common import RssProcessing
+from .rte_flow_common import FdirProcessing
 
 mac_qinq_ipv4_pay_src_ip = {
     "name": "mac_qinq_ipv4_pay_src_ip",
@@ -403,7 +402,7 @@  tv_mac_qinq_ipv6_tcp = {
 tvs_mac_l4_qinq_dcf_pipeline_mode = [tv_mac_qinq_ipv6_udp, tv_mac_qinq_ipv6_tcp]
 
 
-class TestICEQinq(TestCase):
+class TestICEDcfDualVlan(TestCase):
     @check_supported_nic(
         ["ICE_25G-E810C_SFP", "ICE_100G-E810C_QSFP", "ICE_25G-E810_XXV_SFP"]
     )
@@ -420,9 +419,7 @@  class TestICEQinq(TestCase):
         self.verify(cores is not None, "Insufficient cores for speed testing")
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
         self.tester_port0 = self.tester.get_local_port(self.dut_ports[0])
-        self.tester_port1 = self.tester.get_local_port(self.dut_ports[1])
         self.tester_iface0 = self.tester.get_interface(self.tester_port0)
-        self.tester_iface1 = self.tester.get_interface(self.tester_port1)
 
         self.used_dut_port = self.dut_ports[0]
         self.pf_interface = self.dut.ports_info[self.dut_ports[0]]["intf"]
@@ -440,9 +437,9 @@  class TestICEQinq(TestCase):
         self.path = self.dut.apps_name["test-pmd"]
         self.pkt = Packet()
         self.pmd_output = PmdOutput(self.dut)
-
-    def reload_ice(self):
-        self.dut.send_expect("rmmod ice && modprobe ice", "# ")
+        self.fdirprocess = FdirProcessing(
+            self, self.pmd_output, [self.tester_iface0], rxq=0
+        )
 
     def set_up(self):
         """
@@ -457,35 +454,69 @@  class TestICEQinq(TestCase):
                 "# ",
             )
 
-    def setup_pf_vfs_env(self, vfs_num=4):
+    def reload_ice(self):
+        self.dut.send_expect("rmmod ice && modprobe ice", "# ", timeout=60)
+
+    def launch_testpmd(self, dcf_representor=False):
+        if dcf_representor:
+            port_options = {self.pci_list[0]: "cap=dcf,representor=[1]"}
+        else:
+            port_options = {self.pci_list[0]: "cap=dcf"}
+        param = " "
+        self.pmd_output.start_testpmd(
+            cores="1S/4C/1T",
+            param=param,
+            ports=self.pci_list,
+            socket=self.ports_socket,
+            port_options=port_options,
+        )
+        self.confing_testpmd(dcf_representor)
+
+    def confing_testpmd(self, dcf_representor):
+        driver_type = "Device name.*?%s.*?\n(.*)" % self.sriov_vfs_port[0].pci
+        if dcf_representor:
+            flow_type = "mac"
+            output = self.pmd_output.execute_cmd("show port info all")
+            out = re.findall(driver_type, output)
+            self.verify(len(out) == 2, "port0 and port1 driver not is net_ice_dcf")
+        else:
+            flow_type = "rxonly"
+            output = self.pmd_output.execute_cmd("show port info 0")
+            out = re.findall(driver_type, output)
+            self.verify(len(out) == 1, "vf0 driver not is net_ice_dcf")
+        self.pmd_output.execute_cmd("set fwd %s" % flow_type)
+        self.pmd_output.execute_cmd("set verbose 1")
+        self.pmd_output.execute_cmd("start")
+
+    def reset_vf(self):
+        self.pmd_output.execute_cmd("port stop 2")
+        self.pmd_output.execute_cmd("port reset 2")
+        self.pmd_output.execute_cmd("port start 2")
+        self.pmd_output.execute_cmd("start")
+
+    def setup_pf_4vfs_env(self):
 
         if self.vf_flag is False:
             self.dut.generate_sriov_vfs_by_port(
-                self.used_dut_port, vfs_num, driver=self.kdriver
+                self.used_dut_port, 4, driver=self.kdriver
             )
             self.sriov_vfs_port = self.dut.ports_info[self.used_dut_port]["vfs_port"]
             self.vf_flag = True
-            if vfs_num > 1:
-                self.dut.send_expect(
-                    "ip link set %s vf 0 trust on" % (self.pf_interface), "# "
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 1 mac %s" % (self.pf_interface, self.vf1_mac),
-                    "# ",
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 2 mac %s" % (self.pf_interface, self.vf2_mac),
-                    "# ",
-                )
-                self.dut.send_expect(
-                    "ip link set %s vf 3 mac %s" % (self.pf_interface, self.vf3_mac),
-                    "# ",
-                )
-            else:
-                self.dut.send_expect(
-                    "ip link set %s vf 0 mac %s" % (self.pf_interface, self.vf1_mac),
-                    "# ",
-                )
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.pf_interface), "# "
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 1 mac %s" % (self.pf_interface, self.vf1_mac),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 2 mac %s" % (self.pf_interface, self.vf2_mac),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ip link set %s vf 3 mac %s" % (self.pf_interface, self.vf3_mac),
+                "# ",
+            )
 
             try:
                 for port in self.sriov_vfs_port:
@@ -497,16 +528,15 @@  class TestICEQinq(TestCase):
                 self.dut.send_expect(
                     "ip link set dev %s vf 0 spoofchk off" % self.pf_interface, "# "
                 )
-                if vfs_num == 4:
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 1 spoofchk off" % self.pf_interface, "# "
-                    )
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 2 spoofchk off" % self.pf_interface, "# "
-                    )
-                    self.dut.send_expect(
-                        "ip link set dev %s vf 3 spoofchk off" % self.pf_interface, "# "
-                    )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 1 spoofchk off" % self.pf_interface, "# "
+                )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 2 spoofchk off" % self.pf_interface, "# "
+                )
+                self.dut.send_expect(
+                    "ip link set dev %s vf 3 spoofchk off" % self.pf_interface, "# "
+                )
             except Exception as e:
                 self.destroy_iavf()
                 raise Exception(e)
@@ -516,174 +546,28 @@  class TestICEQinq(TestCase):
             self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
             self.vf_flag = False
 
-    def launch_testpmd(self, vfs_num=4, dcf_param=False):
-        if dcf_param:
-            port_options = {self.pci_list[0]: "cap=dcf,representor=[1]"}
-        else:
-            port_options = {self.pci_list[0]: "cap=dcf"}
-        if vfs_num > 1:
-            param = " "
-            self.pmd_output.start_testpmd(
-                cores="1S/4C/1T",
-                param=param,
-                ports=self.pci_list,
-                socket=self.ports_socket,
-                port_options=port_options,
-            )
-        else:
-            param = "--rxq=16 --txq=16"
-            self.pmd_output.start_testpmd(
-                cores="1S/4C/1T",
-                param=param,
-                ports=self.pci_list,
-                socket=self.ports_socket,
-            )
-        self.confing_testpmd(vfs_num, dcf_param)
-
-    def confing_testpmd(self, vfs_num, dcf_param):
-        driver_type = "Device name.*?%s.*?\n(.*)" % self.sriov_vfs_port[0].pci
-        if dcf_param or vfs_num == 1:
-            flow_type = "mac"
-            if vfs_num > 1:
-                output = self.pmd_output.execute_cmd("show port info all")
-                out = re.findall(driver_type, output)
-                self.verify(len(out) == 2, "port0 and port1 driver not is net_ice_dcf")
-        else:
-            flow_type = "rxonly"
-            output = self.pmd_output.execute_cmd("show port info 0")
-            out = re.findall(driver_type, output)
-            self.verify(len(out) == 1, "vf0 driver not is net_ice_dcf")
-        self.pmd_output.execute_cmd("set fwd %s" % flow_type)
-        self.pmd_output.execute_cmd("set verbose 1")
-        self.pmd_output.execute_cmd("start")
-
-    def create_switch_rule(self, rule, session_name="", check_stats=True):
-        if session_name == "":
-            session_name = self.pmd_output
-        p = re.compile(r"Flow rule #(\d+) created")
-        rule_list = []
-        if isinstance(rule, list):
-            for rule in rule:
-                out = session_name.execute_cmd(rule)  # create a rule
-                m = p.search(out)
-                if m:
-                    rule_list.append(m.group(1))
-                else:
-                    rule_list.append(False)
-        else:
-            out = session_name.execute_cmd(rule)  # create a rule
-            m = p.search(out)
-            if m:
-                rule_list.append(m.group(1))
-            else:
-                rule_list.append(False)
-        if check_stats:
-            self.verify(
-                all(rule_list),
-                "some rules not created successfully, result %s, rule %s"
-                % (rule_list, rule),
-            )
-        else:
-            self.verify(
-                not any(rule_list),
-                "all rules should create failed, result %s" % rule_list,
-            )
-        return rule_list
-
-    def check_switch_rule(self, port_id=0, stats=True, rule_list=None):
-        out = self.pmd_output.execute_cmd("flow list %s" % port_id)
-        p = re.compile(r"ID\s+Group\s+Prio\s+Attr\s+Rule")
-        matched = p.search(out)
-        if stats:
-            self.verify(matched, "flow rule on port %s is not existed" % port_id)
-            if rule_list:
-                p = re.compile("^(\d+)\s")
-                li = out.splitlines()
-                res = list(filter(bool, list(map(p.match, li))))
-                result = [i.group(1) for i in res]
-                self.verify(
-                    sorted(result) == sorted(rule_list),
-                    "check rule list failed. expect %s, result %s"
-                    % (rule_list, result),
-                )
-        else:
-            self.verify(not matched, "flow rule on port %s is existed" % port_id)
-
-    def destroy_switch_rule(self, port_id=0, rule_id=None):
-        if rule_id is None:
-            rule_id = 0
-        if isinstance(rule_id, list):
-            for i in rule_id:
-                out = self.dut.send_command(
-                    "flow destroy %s rule %s" % (port_id, i), timeout=1
-                )
-                p = re.compile(r"Flow rule #(\d+) destroyed")
-                m = p.search(out)
-                self.verify(m, "flow rule %s delete failed" % rule_id)
-        else:
-            out = self.dut.send_command(
-                "flow destroy %s rule %s" % (port_id, rule_id), timeout=1
-            )
-            p = re.compile(r"Flow rule #(\d+) destroyed")
-            m = p.search(out)
-            self.verify(m, "flow rule %s delete failed" % rule_id)
-        self.check_switch_rule(stats=False)
-
-    def send_packets(self, pkts, tx_port=None, count=1):
-        self.pkt.update_pkt(pkts)
-        tx_port = self.tester_iface0 if not tx_port else tx_port
-        self.pkt.send_pkt(crb=self.tester, tx_port=tx_port, count=count)
-
-    def send_pkts_getouput(self, pkts, port_id=0, count=1):
-        tx_port = self.tester_iface0 if port_id == 0 else self.tester_iface1
-        self.send_packets(pkts, tx_port=tx_port, count=count)
-        time.sleep(0.5)
-        out = self.pmd_output.get_output()
-        port_stats = self.pmd_output.execute_cmd("show port stats all")
-        self.pmd_output.execute_cmd("clear port stats all")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("start")
-        return out + port_stats
-
-    def check_packets(self, out, port_id, pkt_num=1, check_stats=True):
-        p = "port (\d+)/queue.*"
-        result_list = re.findall(p, out)
-        self.verify(
-            len(result_list) == pkt_num,
-            "received %s packets, expected to %s packets" % (result_list, pkt_num),
-        )
-        for res in result_list:
-            if check_stats:
-                self.verify(
-                    int(res) == port_id,
-                    "port {} did not received the packets".format(port_id),
-                )
-            else:
-                self.verify(
-                    int(res) != port_id,
-                    "port {} should not received a packets".format(port_id),
-                )
-
     def _rte_flow_validate_pattern(self, test_vector):
         test_results = {}
         for test in test_vector:
             self.logger.info((GREEN("========test subcase: %s========" % test["name"])))
             try:
                 port_id = test["check_param"]["port_id"]
-                rule_list = self.create_switch_rule(test["rule"])
-                self.check_switch_rule()
+                self.fdirprocess.validate_rule(test["rule"], check_stats=True)
+                rule_list = self.fdirprocess.create_rule(test["rule"], check_stats=True)
+                self.fdirprocess.check_rule(0, stats=True, rule_list=rule_list)
                 # send matched packets and check
                 matched_packets = test["scapy_str"]["matched"]
-                out = self.send_pkts_getouput(matched_packets)
+                out = self.fdirprocess.send_pkt_get_out(matched_packets)
                 self.check_packets(out, port_id, len(matched_packets))
                 # send mismatched packets and check
                 mismatched_packets = test["scapy_str"]["mismatched"]
-                out = self.send_pkts_getouput(mismatched_packets)
+                out = self.fdirprocess.send_pkt_get_out(mismatched_packets)
                 self.check_packets(
                     out, port_id, len(mismatched_packets), check_stats=False
                 )
-                self.destroy_switch_rule()
-                out = self.send_pkts_getouput(matched_packets)
+                self.fdirprocess.destroy_rule(0, rule_list)
+                self.fdirprocess.check_rule(0, stats=False, rule_list=rule_list)
+                out = self.fdirprocess.send_pkt_get_out(matched_packets)
                 self.check_packets(
                     out, port_id, len(matched_packets), check_stats=False
                 )
@@ -691,8 +575,8 @@  class TestICEQinq(TestCase):
                 self.logger.info((GREEN("subcase passed: %s" % test["name"])))
             except Exception as e:
                 self.logger.warning((RED(e)))
-                self.dut.send_command("flow flush 0", timeout=1)
-                self.dut.send_command("flow flush 1", timeout=1)
+                self.dut.send_command("flow flush 0")
+                self.dut.send_command("flow flush 1")
                 test_results[test["name"]] = False
                 self.logger.info((RED("subcase failed: %s" % test["name"])))
                 continue
@@ -702,104 +586,49 @@  class TestICEQinq(TestCase):
                 failed_cases.append(k)
         self.verify(all(test_results.values()), "{} failed.".format(failed_cases))
 
-    def start_tcpdump(self, rxItf):
-        self.tester.send_expect("rm -rf getPackageByTcpdump.cap", "#")
+    def check_packets(self, out, port_id, pkt_num=1, check_stats=True):
+        p = "port (\d+)/queue.*"
+        result_list = re.findall(p, out)
+        if check_stats:
+            self.verify(
+                len(result_list) == pkt_num, "received packets mismatch".format(port_id)
+            )
+        for res in result_list:
+            if check_stats:
+                self.verify(
+                    int(res) == port_id,
+                    "port {} did not received the packets".format(port_id),
+                )
+            else:
+                self.verify(
+                    int(res) != port_id,
+                    "port {} should not received a packets".format(port_id),
+                )
+
+    def tcpdump_send_packet_get_output(self, pkt):
+        self.tester.send_expect("rm -rf getPackageByTcpdump.cap", "# ")
         self.tester.send_expect(
             "tcpdump -A -nn -e -vv -w getPackageByTcpdump.cap -i %s 2> /dev/null& "
-            % rxItf,
+            % (self.tester_iface0),
             "#",
         )
         time.sleep(2)
-
-    def get_tcpdump_package(self):
-        time.sleep(1)
-        self.tester.send_expect("killall tcpdump", "#")
-        return self.tester.send_expect(
-            "tcpdump -A -nn -e -vv -r getPackageByTcpdump.cap", "#"
+        out1 = self.fdirprocess.send_pkt_get_out(pkt)
+        out2 = self.pmd_output.execute_cmd("show port stats 0")
+        out = out1 + out2
+        self.tester.send_expect("killall tcpdump", "# ")
+        tcpdump_out = self.tester.send_expect(
+            "tcpdump -A -nn -vv -er getPackageByTcpdump.cap", "# "
         )
 
-    def test_mac_qinq_ipv4_pay(self):
-        """
-        DCF switch for MAC_QINQ_IPV4_PAY
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_ipv4_pay)
-
-    def test_mac_qinq_ipv6_pay(self):
-        """
-        DCF switch for MAC_QINQ_IPV6_PAY
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_ipv6_pay)
-
-    @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_pay(self):
-        """
-        DCF switch for MAC_QINQ_PPPOE_PAY
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_pppoe_pay)
-
-    @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_pay_proto(self):
-        """
-        DCF switch for MAC_QINQ_PPPOE_PAY_Proto
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_pppoe_proto)
-
-    @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_ipv4(self):
-        """
-        DCF switch for MAC_QINQ_PPPOE_IPV4
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv4)
-
-    @skip_unsupported_pkg("os default")
-    def test_mac_qinq_pppoe_ipv6(self):
-        """
-        DCF switch for MAC_QINQ_PPPOE_IPV6
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv6)
-
-    def test_mac_l4_qinq_dcf_non_pipeline_mode(self):
-        """
-        DCF switch for MAC_L4_QINQ
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_non_pipeline_mode)
-
-    def test_mac_l4_qinq_dcf_pipeline_mode(self):
-        """
-        DCF switch for MAC_L4_QINQ_IPV6
-        """
-        self.setup_pf_vfs_env()
-        self.launch_testpmd()
-        self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_pipeline_mode)
-
-    def reset_vf(self):
-        self.pmd_output.execute_cmd("port stop 2")
-        self.pmd_output.execute_cmd("port reset 2")
-        self.pmd_output.execute_cmd("port start 2")
-        self.pmd_output.execute_cmd("start")
+        return (out, tcpdump_out)
 
     def send_packet_check_vlan_strip(self, pkts, outer=False, inner=False):
         for pkt in pkts:
             pkt_index = pkts.index(pkt)
-            self.start_tcpdump(self.tester_iface0)
-            out = self.send_pkts_getouput(pkt)
-            self.check_packets(out, 2, pkt_num=1)
-            tcpdump_out = self.get_tcpdump_package()
-            vlan_list = re.findall("vlan \d+", tcpdump_out)
+            out, tcpdump_out = self.tcpdump_send_packet_get_output(pkt)
+            self.check_packets(out, port_id=2, pkt_num=1)
+            vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
             if pkt_index == 1:
                 vlan_num = 2
                 if outer or inner:
@@ -815,49 +644,14 @@  class TestICEQinq(TestCase):
                     len(vlan_list) == vlan_num, "received outer vlan packet error!!!"
                 )
 
-    def test_vlan_strip_in_pvid_enable(self):
-        """
-        vlan strip when pvid enable
-        """
-        pkts = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=21,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip on 1")
-        self.reset_vf()
-        self.send_packet_check_vlan_strip(pkts, outer=True)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip off 1")
-        self.reset_vf()
-        self.send_packet_check_vlan_strip(pkts)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip on 1")
-        self.reset_vf()
-        self.pmd_output.execute_cmd("vlan set strip on 2")
-        self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
-        self.pmd_output.execute_cmd("quit", "#")
-        self.launch_testpmd(dcf_param=True)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip on 2")
-        self.pmd_output.execute_cmd("vlan set strip on 1")
-        self.reset_vf()
-        self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
-
-    def _send_packet_check_vlan_inter(
+    def send_packet_check_vlan_inter(
         self, pkts, out_vlan, port_id=3, vlan_header=None, iner_vlan=None
     ):
         for pkt in pkts:
             pkt_index = pkts.index(pkt)
-            self.start_tcpdump(self.tester_iface0)
-            out = self.send_pkts_getouput(pkt)
+            out, tcpdump_out = self.tcpdump_send_packet_get_output(pkt)
             self.check_packets(out, port_id)
-            p = "vlan (\d+)"
-            tcpdump_out = self.get_tcpdump_package()
+            p = "vlan\s+(\d+)"
             vlan_list = re.findall(p, tcpdump_out)
             if vlan_header:
                 header = re.findall(vlan_header, tcpdump_out)
@@ -916,9 +710,110 @@  class TestICEQinq(TestCase):
                     "vlan header not matched, expect: %s." % vlan_header,
                 )
 
-    def test_vlan_insert_in_pvid_enable(self):
+    def test_dcf_mac_qinq_ipv4_pay(self):
+        """
+        Test case 01: DCF switch for MAC_QINQ_IPV4_PAY
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_ipv4_pay)
+
+    def test_dcf_mac_qinq_ipv6_pay(self):
+        """
+        Test case 02: DCF switch for MAC_QINQ_IPV6_PAY
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_ipv6_pay)
+
+    @skip_unsupported_pkg("os default")
+    def test_dcf_mac_qinq_pppoe_pay(self):
+        """
+        Test case 03: DCF switch for MAC_QINQ_PPPOE_PAY
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_pppoe_pay)
+
+    @skip_unsupported_pkg("os default")
+    def test_dcf_mac_qinq_pppoe_pay_proto(self):
+        """
+        Test case 04: DCF switch for MAC_QINQ_PPPOE_PAY_Proto
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_pppoe_proto)
+
+    @skip_unsupported_pkg("os default")
+    def test_dcf_mac_qinq_pppoe_ipv4(self):
         """
-        vlan insertion when pvid enable
+        Test case 05: DCF switch for MAC_QINQ_PPPOE_IPV4
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv4)
+
+    @skip_unsupported_pkg("os default")
+    def test_dcf_mac_qinq_pppoe_ipv6(self):
+        """
+        Test case 06: DCF switch for MAC_QINQ_PPPOE_IPV6
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(mac_qinq_pppoe_ipv6)
+
+    def test_dcf_mac_l4_qinq_non_pipeline_mode(self):
+        """
+        Test case 07: DCF switch for MAC_L4_QINQ
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_non_pipeline_mode)
+
+    def test_dcf_mac_l4_qinq_pipeline_mode(self):
+        """
+        Test case 08: DCF switch for MAC_L4_QINQ_IPV6
+        """
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd()
+        self._rte_flow_validate_pattern(tvs_mac_l4_qinq_dcf_pipeline_mode)
+
+    def test_dcf_vlan_strip_in_pvid_enable(self):
+        """
+        Test case 09: DCF vlan strip when pvid enable
+        """
+        pkts = [
+            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
+            % self.vf1_mac,
+            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=21,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
+            % self.vf1_mac,
+        ]
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd(dcf_representor=True)
+        self.pmd_output.execute_cmd("stop")
+        self.pmd_output.execute_cmd("vlan set strip on 1")
+        self.reset_vf()
+        self.send_packet_check_vlan_strip(pkts, outer=True)
+        self.pmd_output.execute_cmd("stop")
+        self.pmd_output.execute_cmd("vlan set strip off 1")
+        self.reset_vf()
+        self.send_packet_check_vlan_strip(pkts)
+        self.pmd_output.execute_cmd("stop")
+        self.pmd_output.execute_cmd("vlan set strip on 1")
+        self.reset_vf()
+        self.pmd_output.execute_cmd("vlan set strip on 2")
+        self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
+        self.pmd_output.execute_cmd("quit", "#")
+        self.launch_testpmd(dcf_representor=True)
+        self.pmd_output.execute_cmd("stop")
+        self.pmd_output.execute_cmd("vlan set strip on 2")
+        self.pmd_output.execute_cmd("vlan set strip on 1")
+        self.reset_vf()
+        self.send_packet_check_vlan_strip(pkts, outer=True, inner=True)
+
+    def test_dcf_vlan_insert_in_pvid_enable(self):
+        """
+        Test case 10: DCF vlan insertion when pvid enable
         """
         out_vlan = 24
         iner_vlan = 11
@@ -929,45 +824,45 @@  class TestICEQinq(TestCase):
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
             % self.vf2_mac,
         ]
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd(dcf_representor=True)
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("tx_vlan set pvid 1 %d on" % out_vlan)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         header = "0x88a8"
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set outer tpid %s 1" % header)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         header = "0x9100"
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("vlan set outer tpid %s 1" % header)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
+        self.send_packet_check_vlan_inter(pkt_list, out_vlan, vlan_header=header)
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("port stop 2")
         self.pmd_output.execute_cmd("tx_vlan set 2 %d" % iner_vlan)
         self.pmd_output.execute_cmd("port start 2")
         self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(
+        self.send_packet_check_vlan_inter(
             pkt_list, out_vlan, vlan_header=header, iner_vlan=iner_vlan
         )
         self.pmd_output.execute_cmd("quit", "# ")
-        self.launch_testpmd(dcf_param=True)
+        self.launch_testpmd(dcf_representor=True)
         self.pmd_output.execute_cmd("stop")
         self.pmd_output.execute_cmd("port stop 2")
         self.pmd_output.execute_cmd("tx_vlan set 2 %d" % iner_vlan)
         self.pmd_output.execute_cmd("port start 2")
         self.pmd_output.execute_cmd("tx_vlan set pvid 1 %d on" % out_vlan)
         self.reset_vf()
-        self._send_packet_check_vlan_inter(
+        self.send_packet_check_vlan_inter(
             pkt_list, out_vlan, port_id=3, vlan_header=header, iner_vlan=iner_vlan
         )
 
-    def test_vlan_filter_in_pvid_enable(self):
+    def test_dcf_vlan_filter_in_pvid_enable(self):
         """
-        vlan filter when pvid enable
+        Test case 11: DCF vlan filter when pvid enable
         """
         pkt_list1 = [
             'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
@@ -986,281 +881,26 @@  class TestICEQinq(TestCase):
                 "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
                 "# ",
             )
-        self.setup_pf_vfs_env()
-        self.launch_testpmd(dcf_param=True)
+        self.setup_pf_4vfs_env()
+        self.launch_testpmd(dcf_representor=True)
         self.pmd_output.execute_cmd("vlan set filter on 1")
         out = self.pmd_output.execute_cmd("rx_vlan add 11 1")
         self.verify("failed" in out, "add rx_vlan successfully for VF1 by representor")
         self.pmd_output.execute_cmd("vlan set filter on 2")
         self.pmd_output.execute_cmd("rx_vlan add 11 2")
         for pkt in pkt_list1:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2)
         for pkt in pkt_list2:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2, pkt_num=0, check_stats=False)
         self.pmd_output.execute_cmd("rx_vlan rm 11 2")
         for pkt in pkt_list1:
-            out = self.send_pkts_getouput(pkt)
+            out = self.fdirprocess.send_pkt_get_out(pkt)
             self.check_packets(out, 2, pkt_num=0, check_stats=False)
 
-    def check_vlan_offload(self, vlan_type, stats):
-        p = "VLAN offload.*\n.*?%s (\w+)" % vlan_type
-        out = self.pmd_output.execute_cmd("show port info 0")
-        vlan_stats = re.search(p, out).group(1)
-        self.verify(vlan_stats == stats, "VLAN stats mismatch")
-
-    def test_enable_disable_iavf_vlan_filter(self):
-        """
-        Enable/Disable IAVF VLAN filtering
-        """
-        pkt_list1 = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        pkt_list2 = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.check_vlan_offload(vlan_type="filter", stats="on")
-        out = self.send_pkts_getouput(pkt_list1)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list1)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 6, "Failed pass received vlan packet!")
-
-        out = self.send_pkts_getouput(pkt_list2)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-        self.pmd_output.execute_cmd("rx_vlan rm 1 0")
-        out = self.send_pkts_getouput(pkt_list1)
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 0, "Failed error received vlan packet!")
-
-    def test_enable_disable_iavf_vlan_strip(self):
-        """
-        Enable/Disable IAVF VLAN header stripping
-        """
-        pkt_list = [
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.check_vlan_offload(vlan_type="filter", stats="on")
-        self.pmd_output.execute_cmd("vlan set strip on 0")
-        self.check_vlan_offload(vlan_type="strip", stats="on")
-
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 4, "Failed pass received vlan packet!")
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt_list)
-        tcpdump_out = self.get_tcpdump_package()
-        receive_pkt = re.findall("dst=%s" % self.vf1_mac, out)
-        self.verify(len(receive_pkt) == 2, "Failed error received vlan packet!")
-        tester_pkt = re.findall("vlan \d+", tcpdump_out)
-        self.verify(len(tester_pkt) == 6, "Failed pass received vlan packet!")
-
-    def test_enable_disable_iavf_vlan_insert(self):
-        """
-        Enable/Disable IAVF VLAN header insertion
-        """
-        out_vlan = 1
-        pkt_list = [
-            'Ether(dst="%s",type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac,
-        ]
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s off" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("tx_vlan set 0 1")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan, port_id=0)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("tx_vlan reset 0")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_packet_check_vlan_inter(pkt_list, out_vlan=0, port_id=0)
-
-    def _send_pkt_check_vlan_and_crc(
-        self, pkt, pkt_len=None, vlan_strip=False, crc_strip=False
-    ):
-        if pkt_len:
-            self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt)
-        pkt_length = re.search("length=(\d+)", out).group(1)
-        rx_bytes = re.search("RX-bytes:\s+(\d+)", out).group(1)
-        if crc_strip:
-            self.verify(rx_bytes == pkt_length, "CRC strip on failed")
-        else:
-            self.verify(int(rx_bytes) == int(pkt_length) + 4, "CRC strip off failed")
-        if pkt_len:
-            tcpdump_out = self.get_tcpdump_package()
-            vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
-            if not vlan_strip:
-                self.verify(pkt_length == pkt_len, "vlan strip off failed")
-                self.verify(len(vlan_list) == 4, "Failed pass received vlan packet")
-            elif vlan_strip:
-                self.verify(
-                    int(pkt_length) + 4 == int(pkt_len), "vlan strip off failed"
-                )
-                self.verify(
-                    len(vlan_list) == 3 and vlan_list[0] != vlan_list[-1],
-                    "Failed error received vlan packet",
-                )
-
-    def test_enable_disable_iavf_CRC_strip(self):
-        """
-        Enable/disable AVF CRC stripping
-        """
-        param = "--rxq=16 --txq=16 --disable-crc-strip"
-        pkt = (
-            'Ether(dst="%s",type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac
-        )
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.pmd_output.start_testpmd(
-            cores="1S/4C/1T", param=param, ports=self.pci_list, socket=self.ports_socket
-        )
-        self.pmd_output.execute_cmd("set fwd mac")
-        self.pmd_output.execute_cmd("set verbose 1")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc off")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt, crc_strip=True)
-
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc on")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt)
-
-        self.pmd_output.execute_cmd("quit", "#")
-        self.launch_testpmd(vfs_num=1)
-        self.start_tcpdump(self.tester_iface0)
-        self._send_pkt_check_vlan_and_crc(pkt, crc_strip=True)
-
-    def test_CRC_strip_iavf_vlan_strip_coexists(self):
-        """
-        AVF CRC strip and Vlan strip co-exists
-        """
-        pkt = (
-            'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)'
-            % self.vf1_mac
-        )
-        if self.default_stats:
-            self.dut.send_expect(
-                "ethtool --set-priv-flags %s %s on" % (self.pf_interface, self.flag),
-                "# ",
-            )
-        self.setup_pf_vfs_env(vfs_num=1)
-        self.launch_testpmd(vfs_num=1)
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("vlan set filter on 0")
-        self.pmd_output.execute_cmd("rx_vlan add 1 0")
-        self.pmd_output.execute_cmd("start")
-
-        self.start_tcpdump(self.tester_iface0)
-        out = self.send_pkts_getouput(pkt)
-        tcpdump_out = self.get_tcpdump_package()
-        pkt_len = re.search("length=(\d+)", out).group(1)
-        vlan_list = re.findall("vlan\s+\d+", tcpdump_out)
-        self.verify(len(vlan_list) == 4, "vlan strip off failed")
-        rx_bytes = re.search("RX-bytes:\s+(\d+)", out).group(1)
-        tx_bytes = re.search("TX-bytes:\s+(\d+)", out).group(1)
-        self.verify(rx_bytes == tx_bytes == pkt_len, "CRC strip on failed")
-
-        self.pmd_output.execute_cmd("vlan set strip on 0")
-        self.check_vlan_offload(vlan_type="strip", stats="on")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len, vlan_strip=True)
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc on")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len)
-
-        out = self.pmd_output.execute_cmd("vlan set strip on 0")
-        p = "iavf_config_vlan_strip_v2(): fail to execute command VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2"
-        self.verify(p in out, "set vlan strip on successfully")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len)
-
-        self.pmd_output.execute_cmd("vlan set strip off 0")
-        self.check_vlan_offload(vlan_type="strip", stats="off")
-        self.pmd_output.execute_cmd("stop")
-        self.pmd_output.execute_cmd("port stop 0")
-        self.pmd_output.execute_cmd("port config 0 rx_offload keep_crc off")
-        self.pmd_output.execute_cmd("port start 0")
-        self.pmd_output.execute_cmd("start")
-        self._send_pkt_check_vlan_and_crc(pkt=pkt, pkt_len=pkt_len, crc_strip=True)
-
     def tear_down(self):
-        self.pmd_output.execute_cmd("quit", "#")
+        self.pmd_output.quit()
         self.dut.kill_all()
         self.destroy_iavf()