test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1 0/6] add new common module and add new suites
@ 2023-06-08 18:27 Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 1/6] tests/func_test_base:add new commom module to refactor func test cases Zhimin Huang
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

func_test_base:
1.integrate the commonly used methods for test cases.
2.add some basic testing process, for vlan offload, rxtx check...

kernelpf_vf:
1.cover kernelpf_iavf/xstats_check/vf_macfilter/vf_vlan/vf_rss in
kernelpf_vf test suite.
2.use func_test_base to refactor test cases

ice_kernelpf_dcf:
1.support most of the pmd func for dcf

Zhimin Huang (6):
  tests/func_test_base:add new commom module to refactor func test cases
  tests/kernelpf_vf:add new suites to cover most of the basic vf cases
  test_plans/kernelpf_vf_test_plan:add new plan to cover most of the
    basic vf cases
  tests/ice_kernelpf_dcf:add new suite to cover dcf pmd function
  test_plans/ice_kernelpf_dcf_test_plan:add new plan to cover the most
    of dcf pmd function
  conf/*:add config file for new suites

 conf/ice_kernelpf_dcf.cfg                 |   22 +
 conf/kernelpf_vf.cfg                      |   22 +
 test_plans/ice_kernelpf_dcf_test_plan.rst |  596 ++++++++++
 test_plans/index.rst                      |    2 +
 test_plans/kernelpf_vf_test_plan.rst      | 1294 +++++++++++++++++++++
 tests/TestSuite_ice_kernelpf_dcf.py       |  732 ++++++++++++
 tests/TestSuite_kernelpf_vf.py            | 1007 ++++++++++++++++
 tests/func_test_base.py                   |  977 ++++++++++++++++
 8 files changed, 4652 insertions(+)
 create mode 100644 conf/ice_kernelpf_dcf.cfg
 create mode 100644 conf/kernelpf_vf.cfg
 create mode 100644 test_plans/ice_kernelpf_dcf_test_plan.rst
 create mode 100644 test_plans/kernelpf_vf_test_plan.rst
 create mode 100644 tests/TestSuite_ice_kernelpf_dcf.py
 create mode 100644 tests/TestSuite_kernelpf_vf.py
 create mode 100644 tests/func_test_base.py

-- 
2.25.1


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

* [dts][PATCH V1 1/6] tests/func_test_base:add new commom module to refactor func test cases
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases Zhimin Huang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

for some vf test suites, there are duplicate methods implemented in
suites.
so add the public method into func_test_base,and encapsulate
classes for the basic testing process.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/func_test_base.py | 977 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 977 insertions(+)
 create mode 100644 tests/func_test_base.py

diff --git a/tests/func_test_base.py b/tests/func_test_base.py
new file mode 100644
index 00000000..8134d5a1
--- /dev/null
+++ b/tests/func_test_base.py
@@ -0,0 +1,977 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+#
+
+import re
+import time
+import traceback
+
+from framework.packet import Packet
+from framework.pmd_output import PmdOutput
+from framework.virt_common import VM
+
+supported_vf_driver = ["pci-stub", "vfio-pci"]
+
+
+class FuncTestBase(object):
+    def __init__(self, test_case, tester_tx_interface, tester_rx_interface):
+        self.test_case = test_case
+        self.verify = self.test_case.verify
+        self.logger = test_case.logger
+        self.dut = self.test_case.dut
+        self.tester = self.test_case.tester
+
+        self.vm_info = []
+        self.pmd_session = None
+        self.tester_tx_interface = tester_tx_interface
+        self.tester_rx_interface = tester_rx_interface
+
+        self.pkt = Packet()
+        self.vf_driver = self.test_case.get_suite_cfg()["vf_driver"] or "pci-stub"
+        self.vm_specified_driver = self.get_vm_specified_driver()
+
+    def check_port_num_for_test(self, port_num: int):
+        """
+        check the port num for test requirement
+        """
+        dut_ports = self.dut.get_ports(self.test_case.nic)
+        self.verify(len(dut_ports) >= port_num, "Unsupported port num for test require")
+
+    def get_vm_specified_driver(self):
+        """
+        check the vf support driver and return vm driver
+        :return: vm_specified_driver
+        """
+        self.verify(self.vf_driver in supported_vf_driver, "Unsupported vf driver")
+        if self.vf_driver == "pci-stub":
+            vm_specified_driver = "pci-assign"
+        else:
+            vm_specified_driver = "vfio-pci"
+        return vm_specified_driver
+
+    def create_vf(self, pf_port, vfs_num: int, driver="default"):
+        """
+        create vfs, support multi pfs to create multi vfs
+        :param pf_port: pf port or port list
+        :param vfs_num: create vf num
+        :param driver: set vf driver on dpdk
+        :return: vf net device object
+        """
+        sriov_vfs_obj = []
+        try:
+            self.test_case.bind_nic_driver(
+                self.dut.get_ports(self.test_case.nic), driver=self.test_case.kdriver
+            )
+        except Exception as e:
+            self.logger.info(traceback.format_exc(e))
+        if hasattr(self.test_case, "pf_config"):
+            self.test_case.pf_config()
+        if isinstance(pf_port, int):
+            pf_port = [pf_port]
+        for _port in pf_port:
+            self.dut.generate_sriov_vfs_by_port(_port, vfs_num, driver=driver)
+            sriov_vfs_obj.append(self.dut.ports_info[_port]["vfs_port"])
+            self.dut.send_expect(
+                "ifconfig %s up" % self.dut.ports_info[_port]["intf"], "#"
+            )
+            res = self.dut.is_interface_up(self.dut.ports_info[_port]["intf"])
+            self.verify(
+                res, "%s link status is down" % self.dut.ports_info[_port]["intf"]
+            )
+        if hasattr(self.test_case, "vf_config"):
+            self.test_case.vf_config()
+        for vf_port in sriov_vfs_obj:
+            for _vf in vf_port:
+                _vf.bind_driver(self.vf_driver)
+        return sriov_vfs_obj
+
+    def destroy_vf(self, pf_port="all"):
+        """
+        destroy vfs
+        :param pf_port: select the pf port to destroy vfs.
+        the default will destroy all vfs.
+        """
+        pf_port = pf_port if isinstance(pf_port, list) else [pf_port]
+        if "all" in pf_port:
+            # destory all vfs
+            self.dut.destroy_all_sriov_vfs()
+        else:
+            for port in pf_port:
+                # destroy the vf on the specified port
+                self.dut.destroy_sriov_vfs_by_port(port)
+
+    def setup_vm_env(self, vm_name: str, sriov_pci: list):
+        """
+        passtrough the vfs into vm, start vm.
+        :param vm_name: select the vm to use
+        :param sriov_pci: pci list
+        :returns: vm object and vm dut session
+        """
+        try:
+            vm_obj = VM(self.dut, vm_name, self.test_case.suite_name)
+            for _pci in sriov_pci:
+                vm_obj.set_vm_device(
+                    driver=self.vm_specified_driver, **{"opt_host": _pci}
+                )
+            vm_dut = vm_obj.start()
+            if vm_dut is None:
+                raise Exception("Set up VM ENV failed!")
+            self.vm_info.append((vm_obj, vm_dut))
+            return vm_obj, vm_dut
+        except Exception as e:
+            self.destroy_vm_env(vm_obj_name=vm_name)
+            raise Exception(e)
+
+    def destroy_vm_env(self, vm_obj_name=""):
+        """
+        destroy the specified vm name or all vms
+        """
+        try:
+            for vm_obj, vm_session in self.vm_info:
+                if vm_obj_name == "":
+                    # destoty all vm
+                    vm_session.kill_all()
+                    vm_obj.stop()
+                    self.vm_info = []
+                elif vm_obj.vm_name == vm_obj_name:
+                    # destroy the vm with the specified name
+                    vm_session.kill_all()
+                    vm_obj.stop()
+                    self.vm_info.remove((vm_obj, vm_session))
+                else:
+                    self.logger.warning("VM %s not found!!!" % vm_obj_name)
+        except Exception as e:
+            self.dut.virt_exit()
+            time.sleep(3)
+            raise Exception(e)
+
+    def init_pmd_session(self, dut_obj):
+        """
+        init PMD session
+        """
+        self.pmd_session = PmdOutput(dut_obj)
+
+    def launch_testpmd(self, **kwargs):
+        """
+        launch testpmd with testpmd session
+        the default session is self.pmd_session
+        :return: testpmd output
+        """
+        pmd_session = kwargs.get("testpmd_obj") or self.pmd_session
+        out = pmd_session.start_testpmd(**kwargs)
+        return out
+
+    def execute_pmd_cmd(self, cmd, **kwargs):
+        """
+        execute multiple testpmd commands, return string output
+        :param cmd: testpmd cmd, support str and list
+        :return: testpmd output
+        """
+        pmd_session = kwargs.get("pmd_session") or self.pmd_session
+        _cmds = [cmd] if isinstance(cmd, str) else cmd
+        output = ""
+        for _cmd in _cmds:
+            output += pmd_session.execute_cmd(_cmd)
+        return output
+
+    def execute_host_cmd(self, cmd, **kwargs):
+        """
+        execute multiple host commands
+        :param cmd: host commands, support str and list
+        :return: host output
+        """
+        dut_obj = kwargs.get("dut_obj") or self.dut
+        _cmd = [cmd, "# ", 20] if isinstance(cmd, (str)) else cmd
+        return dut_obj.send_expect(*_cmd)
+
+    def build_dpdk_apps(self, app_path):
+        """
+        build dpdk apps and check the build status
+        """
+        out = self.dut.build_dpdk_apps(app_path)
+        self.verify("Error" not in out, "Compilation error")
+        self.verify("No such" not in out, "Compilation error")
+
+    def vf_test_preset_env_vm(self, pf_port, vfs_num, vm_name, driver="default"):
+        """
+        create vfs and setup vm env
+        """
+        if not isinstance(pf_port, list):
+            pf_port = [pf_port]
+        sriov_vfs_obj = self.create_vf(pf_port, vfs_num, driver=driver)
+        vf_list = []
+        for pf_id in pf_port:
+            vf_list += [
+                sriov_vfs_obj[pf_id][i].pci for i in range(len(sriov_vfs_obj[pf_id]))
+            ]
+        vm_obj, vm_dut = self.setup_vm_env(vm_name=vm_name, sriov_pci=vf_list)
+        return vm_obj, vm_dut
+
+    def get_vf_mac_through_pf(self, pf_intf):
+        """
+        use ip link show pf to get vf mac list
+        """
+        out = self.dut.send_expect(
+            "ip link show {}".format(pf_intf), "# ", alt_session=True
+        )
+        vf_mac_pattern = r"vf\s+\d+\s+.*\s+link\/ether\s+(\S+)\s+.*"
+        match = re.findall(vf_mac_pattern, out)
+        return match
+
+    @staticmethod
+    def generate_using_packets(pkt_type=None, pkt_str=None, **kwargs):
+        """
+        generate using pkts:
+            1.select the protocol type and generate the pkts through packet module
+            2.select customized pkt string
+        :return: pkt object
+        """
+        pkt = Packet()
+        dst_mac = kwargs.get("dst_mac")
+        vlan_id = kwargs.get("vlan_id")
+        if pkt_type:
+            pkt = Packet(pkt_type=pkt_type)
+            pkt.config_layer("ether", {"dst": dst_mac})
+            if vlan_id is not None:
+                pkt.config_layer("vlan", {"vlan": vlan_id})
+        elif pkt_str:
+            pkt.update_pkt(pkt_str)
+        else:
+            raise Exception("wrong pkt value")
+        return pkt
+
+    @staticmethod
+    def get_received_pkt_num(output, port_id=0):
+        """
+        use the testpmd output to get the receive pkts num for port
+        """
+        pkt_pattern = (
+            "port\s%d/queue\s\d+:\sreceived\s(\d+)\spackets.+?\n.*length=\d{2,}\s"
+            % port_id
+        )
+        received_data = re.findall(pkt_pattern, output)
+        received_pkts = sum(map(int, [i[0] for i in received_data]))
+        return received_pkts
+
+    @staticmethod
+    def get_hash_and_queues(out, port_id=0):
+        """
+        use testpmd output to get hash values and queues
+        """
+        hash_pattern = re.compile(
+            "port\s%s/queue\s\d+:\sreceived\s\d+\spackets.+?\n.*RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)"
+            % port_id
+        )
+        hash_infos = hash_pattern.findall(out)
+        if len(hash_infos) == 0:
+            queue_pattern = re.compile("Receive\squeue=(\w+)")
+            queues = queue_pattern.findall(out)
+            return [], queues
+        hashes = [hash_info[0].strip() for hash_info in hash_infos]
+        queues = [hash_info[1].strip() for hash_info in hash_infos]
+        return hashes, queues
+
+    @staticmethod
+    def get_pkts_vlan_layer(pkt_obj: Packet, vlan_layer):
+        """
+        get pkts vlan layers
+        :param pkt_obj: pkt object
+        :param vlan_layer: vlan, prio etc...
+        :return: vlan id list, if pkt object consists of multiple vlan pkts
+        """
+        vlans = []
+        vlan_layers_list = []
+        for i in range(len(pkt_obj)):
+            vlan_dict = {}
+            try:
+                outer_vlan = pkt_obj.strip_element_layer3(vlan_layer, p_index=i)
+                vlan_dict["outer"] = outer_vlan
+            except Exception:
+                pass
+            try:
+                inner_vlan = pkt_obj.strip_element_layer4(vlan_layer, p_index=i)
+                vlan_dict["inner"] = inner_vlan
+            except Exception:
+                pass
+            vlans.append(vlan_dict)
+        for _vlan in vlans:
+            vlan_layers_list += list(_vlan.values())
+        return vlans, vlan_layers_list
+
+    def get_pmd_port_infomation(self, port_id=0, **kwargs):
+        """
+        use 'show ports info 0' to get port link status and port speed
+        """
+        pmd_session = kwargs.get("pmd_session") or self.pmd_session
+        link_status = pmd_session.get_port_link_status(port_id)
+        link_speed = pmd_session.get_port_link_speed(port_id)
+        return link_status, link_speed
+
+    def convert_driver_version_value(self, check_version):
+        """
+        convert the driver version to int list
+        take the first three values in the list for comparison and limit intree driver
+        for example:
+            6.0.7-060007-generic: [6, 0, 7-060007-generic]
+            1.11.0_rc59: [1, 11, 0]
+            1.11.11: [1, 11, 11]
+        """
+        try:
+            value_list = list(map(int, re.split(r"[.|_]", check_version)[:3]))
+        except ValueError as e:
+            self.logger.warning(e)
+            # the intree-driver has character, so set the return value is null list as the lowest driver version
+            return []
+        return value_list
+
+    @staticmethod
+    def get_pmd_rece_pkt_len(output):
+        """
+        get the pkt length in testpmd output
+        """
+        pkt_length = re.findall("length=(\d+)", output)
+        return pkt_length
+
+    def get_xstats_table(self, port_id_list):
+        """
+        use 'show port xstats' to get xstats info dict
+        """
+        xstats_data = dict()
+        if not isinstance(port_id_list, list):
+            port_id_list = [port_id_list]
+        for port_id in port_id_list:
+            out = self.execute_pmd_cmd("show port xstats %s" % port_id)
+            tmp_data = dict()
+            matches = re.findall(r"(\w+):\s+(\d+)", out)
+            for match in matches:
+                key = match[0]
+                value = int(match[1])
+                tmp_data[key] = value
+            xstats_data[port_id] = tmp_data
+        return xstats_data
+
+    @staticmethod
+    def generate_random_packets(
+        dstmac=None,
+        pktnum=100,
+        random_type=None,
+        ip_increase=True,
+        random_payload=False,
+        options=None,
+    ):
+        """
+        generate the random packets,
+        """
+        pkt = Packet()
+        pkt.generate_random_pkts(
+            dstmac=dstmac,
+            pktnum=pktnum,
+            random_type=random_type,
+            ip_increase=ip_increase,
+            random_payload=random_payload,
+            options=options,
+        )
+        return pkt
+
+    def start_tcpdump_output_pcap_file(self, port_inface, count=0, filters=None):
+        """
+        start tcpdump to capture the pkts
+        :param port_inface: port interface name
+        :param count: limit capture the pkts num
+        :param filters:
+            add filter: [{"layer": "ether", "config": {"src": "xxxx"}}]
+        :return:
+        """
+        index = self.tester.tcpdump_sniff_packets(
+            port_inface, count=count, filters=filters
+        )
+        return index
+
+    def stop_tcpdump_and_get_pkts(self, pcap_file):
+        """
+        stop tcpdump and parse the pcap file
+        """
+        pkts = self.tester.load_tcpdump_sniff_packets(pcap_file)
+        return pkts
+
+    def set_pmd_fwd_mode(self, fwd_mode="mac", pmd_session=None):
+        """
+        set testpmd fwd
+        """
+        pmd_session = pmd_session or self.pmd_session
+        self.execute_pmd_cmd(
+            ["set fwd %s" % fwd_mode, "set verbose 1", "start"], pmd_session=pmd_session
+        )
+
+    def send_pkts(
+        self,
+        pkt_list: list,
+        tester_tx_interface=None,
+        packet_count=1,
+        packet_interval=0.01,
+    ):
+        """
+        send pkts with packet obj
+        """
+        tester_tx_interface = (
+            self.tester_tx_interface
+            if tester_tx_interface is None
+            else tester_tx_interface
+        )
+        for _pkt in pkt_list:
+            _pkt.send_pkt(
+                crb=self.tester,
+                tx_port=tester_tx_interface,
+                count=packet_count,
+                interval=packet_interval,
+            )
+
+    def execute_fwd_check_process(
+        self,
+        packets,
+        pmd_commands=None,
+        rx_port=0,
+        tx_port=0,
+        packet_interval=0.01,
+        packet_count=1,
+        tcpdump_filter=None,
+        tester_tx_interface=None,
+        tester_rx_interface=None,
+    ):
+        """
+        pkt fwd flow: tcpdump ---> send pkt ---> testpmd output/tcpdump capture pkts
+        :return:
+            1.capture the tcpdump pkts
+            2.pmd output
+            3.use pmd output to get the pkts stats
+        """
+        if isinstance(packets, list):
+            pkt_list = packets
+        else:
+            pkt_list = [packets]
+        tester_rx_interface = (
+            self.tester_rx_interface
+            if tester_rx_interface is None
+            else tester_rx_interface
+        )
+        inst = self.start_tcpdump_output_pcap_file(
+            port_inface=tester_rx_interface,
+            count=len(packets) * packet_count,
+            filters=tcpdump_filter,
+        )
+        time.sleep(3)
+        if pmd_commands:
+            self.execute_pmd_cmd(pmd_commands)
+        self.execute_pmd_cmd("clear port stats all")
+        self.send_pkts(
+            pkt_list=pkt_list,
+            packet_count=packet_count,
+            packet_interval=packet_interval,
+            tester_tx_interface=tester_tx_interface,
+        )
+        time.sleep(packet_interval * len(pkt_list) * packet_count)
+        packets_captured = self.stop_tcpdump_and_get_pkts(inst)
+        self.logger.info("capture the pkt: {}".format(str(list(packets_captured))))
+        pmdout = self.pmd_session.get_output()
+        tx_stats = self.pmd_session.get_pmd_stats(tx_port)
+        rx_stats = self.pmd_session.get_pmd_stats(rx_port)
+        stats = {tx_port: tx_stats, rx_port: rx_stats}
+
+        return packets_captured, pmdout, stats
+
+
+class RxTxBaseTest(FuncTestBase):
+    def basic_rx_check(
+        self, packets_num, packet_dst_mac=None, pmd_commands=None, rx_port=0, tx_port=0
+    ):
+        """
+        set fwd rxonly and check the rece pkts num
+        """
+        self.set_pmd_fwd_mode(fwd_mode="rxonly")
+        random_pkt = self.generate_random_packets(
+            dstmac=packet_dst_mac, pktnum=packets_num
+        )
+        _, pmdout, stats = self.execute_fwd_check_process(
+            packets=random_pkt,
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        self.verify(packet_dst_mac in pmdout, "receive packet fail")
+        rece_pkts_num = self.get_received_pkt_num(pmdout)
+        self.verify(rece_pkts_num == packets_num, "receive packet num is not match")
+
+    def basic_tx_check(self):
+        """
+        set fwd txonly, check:
+            1.testpmd output tx-pkts != 0
+            2.the tcpdump can capture pkts
+        """
+        self.execute_pmd_cmd("stop")
+        self.execute_pmd_cmd("set fwd txonly")
+        index = self.start_tcpdump_output_pcap_file(self.tester_rx_interface, count=100)
+        self.execute_pmd_cmd("start")
+        time.sleep(1)
+        self.execute_pmd_cmd("stop")
+        pkts_num = self.stop_tcpdump_and_get_pkts(index)
+        stats = self.pmd_session.get_pmd_stats(0)
+        self.verify(
+            stats["TX-packets"] != 0
+            and len(pkts_num) == 100
+            and stats["TX-packets"] > len(pkts_num),
+            "send packet num is not match",
+        )
+
+    def basic_macfwd_check(
+        self,
+        packet_num,
+        dst_mac=None,
+        check_miss=False,
+        pmd_commands=None,
+        rx_port=0,
+        tx_port=0,
+    ):
+        """
+        mac fwd, check rx-pkts and tx-pkt num is correct
+        if check_miss is true, it will check rx/tx is 0
+        """
+        random_pkt = self.generate_random_packets(dstmac=dst_mac, pktnum=packet_num)
+        if not pmd_commands:
+            self.set_pmd_fwd_mode()
+        packets_captured, pmdout, stats = self.execute_fwd_check_process(
+            packets=random_pkt,
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        rece_pkts_num = self.get_received_pkt_num(pmdout)
+        if check_miss:
+            packet_num = 0
+        self.verify(
+            stats[tx_port]["RX-packets"] == packet_num,
+            "receive packet num is not match",
+        )
+        self.verify(
+            stats[tx_port]["RX-errors"] == 0, "some pkts have rx-errors in testpmd"
+        )
+        self.verify(
+            stats[rx_port]["TX-packets"] == packet_num,
+            "receive packet num is not match",
+        )
+        self.verify(
+            rece_pkts_num == packet_num == len(packets_captured),
+            "receive packet num is not match",
+        )
+
+    def basic_xstats_check(
+        self, packet_num, dst_mac=None, rx_port=0, tx_port=0, payload_size=64
+    ):
+        """
+        1. default stats check
+        2. send pkt and check testpmd stats and xstats
+        3. send pkt and clear port stats and check xstats
+        4. send pkt and clear xstats and check xstats
+        """
+        random_pkt = self.generate_random_packets(
+            dstmac=dst_mac,
+            pktnum=packet_num,
+            options={
+                "ip": {"src": "192.168.0.1", "dst": "192.168.1.1"},
+                "layers_config": [("raw", {"payload": ["58"] * payload_size})],
+            },
+        )
+        self.execute_pmd_cmd("clear port xstats all")
+        xstats_table = self.get_xstats_table([rx_port, tx_port])
+        for port in xstats_table.keys():
+            self.verify(
+                not any(xstats_table[port].values()),
+                "xstats Initial value error! port {} xstats "
+                "data is {}".format(port, xstats_table[port]),
+            )
+        _, _, stats_table = self.execute_fwd_check_process(
+            packets=random_pkt,
+            pmd_commands=[
+                "port config all rss all",
+                "set fwd mac",
+                "clear port xstats all",
+                "start",
+            ],
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        xstats_table = self.get_xstats_table([rx_port, tx_port])
+        return stats_table, xstats_table
+
+    def basic_promisc_check(
+        self, match_mac, unmatch_mac, pmd_commands=None, rx_port=0, tx_port=0
+    ):
+        """
+        use match and unmatch pkts to test promisc
+        test flow: default mode --> set promisc off --> set promisc on
+        note: if test vf promisc, confirm the vf primisc enable(kernel need to set trust on)
+        """
+        unmatch_pkt = self.generate_random_packets(dstmac=unmatch_mac, pktnum=1)
+        match_pkt = self.generate_random_packets(dstmac=match_mac, pktnum=1)
+        self.set_pmd_fwd_mode(fwd_mode="mac")
+        self.logger.info("check the default promisc mode")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=[unmatch_pkt, match_pkt],
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        self.verify(
+            match_mac in pmdout and unmatch_mac in pmdout,
+            "enable promisc not receive all pkts",
+        )
+        self.logger.info("check disable promisc mode")
+        self.execute_pmd_cmd("set promisc all off")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=[unmatch_pkt, match_pkt], rx_port=rx_port, tx_port=tx_port
+        )
+        self.verify(
+            match_mac in pmdout and unmatch_mac not in pmdout,
+            "disable promisc should receive match pkt",
+        )
+        self.logger.info("check re-enable promisc mode")
+        self.execute_pmd_cmd("set promisc all on")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=[unmatch_pkt, match_pkt], rx_port=rx_port, tx_port=tx_port
+        )
+        self.verify(
+            match_mac in pmdout and unmatch_mac in pmdout,
+            "enable promisc should receive all pkt",
+        )
+
+    def basic_multicast_check(
+        self, normal_mac, multicast_mac, pmd_commands=None, rx_port=0, tx_port=0
+    ):
+        """
+        use normal mac and multicast mac to test
+        """
+        normal_pkt = self.generate_random_packets(dstmac=normal_mac, pktnum=1)
+        multicast_pkt = self.generate_random_packets(dstmac=multicast_mac, pktnum=1)
+        self.execute_pmd_cmd(
+            [
+                "set allmulti all off",
+                "set promisc all off",
+            ],
+        )
+        self.set_pmd_fwd_mode(fwd_mode="mac")
+        self.logger.info("check the default pmd multicast")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=[normal_pkt, multicast_pkt],
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        self.verify(
+            normal_mac in pmdout and multicast_mac not in pmdout,
+            "the default can not receive multicast pkt",
+        )
+        self.execute_pmd_cmd(
+            [
+                "set allmulti all on",
+                "mcast_addr add 0 {}".format(multicast_mac),
+            ],
+        )
+        self.logger.info("check enable pmd multicast")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=[normal_pkt, multicast_pkt], rx_port=rx_port, tx_port=tx_port
+        )
+        self.verify(
+            normal_mac in pmdout and multicast_mac in pmdout,
+            "enable multicast not receive multicast pkt",
+        )
+
+    def basic_rss_check(
+        self, dst_mac, rss_type, queue_num, pmd_commands=None, rx_port=0, tx_port=0
+    ):
+        """
+        use pkt type mapping to rss type, and check rss func
+        """
+        rss2pkt_dict = {
+            "ip": "IP_RAW",
+            "tcp": "TCP",
+            "udp": "UDP",
+        }
+        rss_pkts = self.generate_random_packets(
+            dstmac=dst_mac, pktnum=30, random_type=[rss2pkt_dict[rss_type]]
+        )
+        self.set_pmd_fwd_mode(fwd_mode="mac")
+        self.execute_pmd_cmd("port config all rss %s" % rss_type)
+        _, pmdout, stats = self.execute_fwd_check_process(
+            packets=rss_pkts,
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        hashes, queues = self.get_hash_and_queues(pmdout)
+        self.verify(
+            len(set(queues)) == int(queue_num)
+            and len(queues) == len(hashes) == stats[tx_port]["RX-packets"],
+            "some pkt and queue can not get get the hash",
+        )
+        return zip(hashes, queues)
+
+    def rss_reta_config_check(self, rss_reta: list, port_id=0, reta_size=64):
+        """
+        check the rss reta after setting new rss rate in testpmd
+        """
+        reta_mask = "0x{}".format(int(reta_size / 4) * "f")
+        default_rss_reta = self.execute_pmd_cmd(
+            "show port {} rss reta {} ({})".format(port_id, reta_size, reta_mask)
+        )
+        for i, j in zip(list(range(reta_size)), rss_reta):
+            self.execute_pmd_cmd("port config %d rss reta (%d,%d)" % (port_id, i, j))
+        change_rss_reta = self.execute_pmd_cmd(
+            "show port {} rss reta {} ({})".format(port_id, reta_size, reta_mask)
+        )
+        self.verify(default_rss_reta != change_rss_reta, "port config rss reta failed")
+
+    def rss_reta_hit_check(self, hash_table, rss_reta: list, reta_size=64):
+        """
+        check the rece pkts hash value can map the queue according to rss reta
+        """
+        hit_hash = False
+        for rss_hash, rss_queue in hash_table:
+            for i, j in zip(list(range(reta_size)), rss_reta):
+                if int(rss_hash, 16) % reta_size == i and int(rss_queue, 16) == j:
+                    hit_hash = True
+                    break
+                else:
+                    hit_hash = False
+            self.verify(hit_hash, "some pkt not directed by rss.")
+
+    def basic_rss_hash_key_check(
+        self, dst_mac, hash_key, port_id=0, pmd_commands=None, rx_port=0, tx_port=0
+    ):
+        """
+        check the hash values is different after setting rss hash key
+        """
+        pkt = self.generate_using_packets(pkt_type="UDP", dst_mac=dst_mac)
+        self.set_pmd_fwd_mode("mac")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=pkt, pmd_commands=pmd_commands, rx_port=rx_port, tx_port=tx_port
+        )
+        hash_1, queue_1 = self.get_hash_and_queues(pmdout)
+        self.execute_pmd_cmd(
+            "port config {} rss-hash-key ipv4 {}".format(port_id, hash_key)
+        )
+        out = self.execute_pmd_cmd("show port 0 rss-hash key")
+        self.verify(hash_key.upper() in out, "rss hash key update failed")
+        _, pmdout, _ = self.execute_fwd_check_process(
+            packets=pkt, rx_port=rx_port, tx_port=tx_port
+        )
+        hash_2, queue_2 = self.get_hash_and_queues(pmdout)
+        self.verify(hash_1 != hash_2, "hash value should be different")
+
+    def basic_pmd_info_check(self, port_obj, port_id=0):
+        """
+        check the link speed and link status
+        """
+        link_status, link_speed = self.get_pmd_port_infomation(port_id)
+        link_speed_host = int(port_obj.get_nic_speed()) // 1000
+        self.verify(link_status == "up", "link stats has error")
+        self.verify(
+            int(link_speed) == link_speed_host,
+            "link speed has error",
+        )
+
+
+class VlanFuncBaseTest(FuncTestBase):
+    def vlan_pkts_fwd_check(
+        self, pkts, pmd_commands=None, port_id=0, rx_port=0, tx_port=0
+    ):
+        """
+        send pkts and return rece num, vlan dict and vlan id list
+        """
+        packets_captured, pmdout, _ = self.execute_fwd_check_process(
+            packets=pkts, pmd_commands=pmd_commands, rx_port=rx_port, tx_port=tx_port
+        )
+        rece_num = self.get_received_pkt_num(pmdout, port_id=port_id)
+        vlans, vlan_id_list = self.get_pkts_vlan_layer(packets_captured, "vlan")
+        self.logger.info("capture the TX pkts vlans: {}".format(vlans))
+        return rece_num, packets_captured, vlans, vlan_id_list
+
+    def vlan_offload_flag_check(self, port_id=0, **kwargs):
+        """
+        check the vlan offload flag status:
+            filter="on"
+            strip="on"
+              ...
+        """
+        out = self.execute_pmd_cmd("show port info %d" % port_id)
+        for flag in kwargs.keys():
+            p = "VLAN offload.*\n.*?%s (\w+)" % flag
+            vlan_stats = re.search(p, out).group(1)
+            self.logger.info("{} flag is {}".format(flag, vlan_stats))
+            self.verify(
+                vlan_stats == kwargs[flag], "the vlan offload flag is incorrect"
+            )
+
+    def vlan_prio_check(self, pkts, **kwargs):
+        """
+
+        :param pkts:
+        :param kwargs:
+        :return:
+        """
+        packets_captured, _, _ = self.execute_fwd_check_process(packets=pkts)
+        vlans, _ = self.get_pkts_vlan_layer(packets_captured, "prio")
+        self.logger.info("vlan prio: {}".format(vlans))
+        for _prio in kwargs.keys():
+            for _vlan in vlans:
+                self.verify(
+                    _vlan[_prio] == kwargs[_prio], "the vlan prio values not matched"
+                )
+
+    def set_pvid_from_pf(self, pf_intf, vf_id=0, vlan_id=0):
+        """
+
+        :return:
+        """
+        self.execute_host_cmd(
+            "ip link set {} vf {} vlan {}".format(pf_intf, vf_id, vlan_id)
+        )
+        output = self.execute_host_cmd("ip link show {}".format(pf_intf))
+        if vlan_id != 0:
+            self.verify("vlan %d" % vlan_id in output, "Failed to add pvid on VF")
+        else:
+            self.verify("vlan" not in output, "Failed to add pvid on VF")
+
+    def basic_vlan_filter_check(
+        self,
+        vlan_id,
+        match_pkt,
+        unmatch_pkt,
+        pmd_commands=None,
+        port_id=0,
+        double_vlan=False,
+        rx_port=0,
+        tx_port=0,
+    ):
+        """
+        send match and unmatch pkt to check vlan filter
+        double vlan have 2 vlan id
+        """
+        if not isinstance(match_pkt, list):
+            match_pkt = [match_pkt]
+        if not isinstance(unmatch_pkt, list):
+            unmatch_pkt = [unmatch_pkt]
+        rece_num, _, _, vlan_id_list = self.vlan_pkts_fwd_check(
+            pkts=match_pkt + unmatch_pkt,
+            port_id=port_id,
+            pmd_commands=pmd_commands,
+            rx_port=rx_port,
+            tx_port=tx_port,
+        )
+        self.verify(
+            rece_num == len(match_pkt) and vlan_id in vlan_id_list,
+            "failed receive vlan pkts",
+        )
+        if double_vlan:
+            self.verify(
+                len(vlan_id_list) == len(match_pkt) * 2, "failed receive vlan pkts"
+            )
+        else:
+            self.verify(len(vlan_id_list) == len(match_pkt), "failed receive vlan pkts")
+
+    def basic_vlan_strip_check(
+        self,
+        vlan_id,
+        match_pkt,
+        pmd_commands=None,
+        port_id=0,
+        double_vlan=False,
+        rx_port=0,
+        tx_port=0,
+    ):
+        """
+        send vlan pkts to check vlan strip
+        single vlan: after strip, the rece pkt not have vlan id
+        double vlan: after strip, the rece pkt have single vlan
+        """
+        rece_num, _, _, vlan_id_list = self.vlan_pkts_fwd_check(
+            match_pkt,
+            port_id=port_id,
+            pmd_commands=pmd_commands,
+            tx_port=tx_port,
+            rx_port=rx_port,
+        )
+        if double_vlan:
+            self.verify(
+                rece_num == len(match_pkt) and len(vlan_id_list) == len(match_pkt),
+                "Failed to strip double vlan tag",
+            )
+        else:
+            self.verify(
+                rece_num == len(match_pkt) and len(vlan_id_list) == 0,
+                "Failed to strip vlan tag",
+            )
+        self.execute_pmd_cmd("vlan set strip off %s" % port_id)
+        rece_num, _, _, vlan_id_list = self.vlan_pkts_fwd_check(
+            match_pkt, port_id=port_id, tx_port=tx_port, rx_port=rx_port
+        )
+        if double_vlan:
+            self.verify(
+                rece_num == len(match_pkt)
+                and len(vlan_id_list) == len(match_pkt) * 2
+                and vlan_id in vlan_id_list,
+                "Failed to receive vlan pkts with vlan tag",
+            )
+        else:
+            self.verify(
+                rece_num == len(match_pkt)
+                and len(vlan_id_list) == len(match_pkt)
+                and vlan_id in vlan_id_list,
+                "Failed to receive vlan pkts with vlan tag",
+            )
+
+    def basic_vlan_insert_check(
+        self,
+        vlan_id,
+        insert_vlan,
+        match_pkt,
+        pmd_commands=None,
+        port_id=0,
+        double_vlan=None,
+        rx_port=0,
+        tx_port=0,
+    ):
+        """
+        single vlan insert: send normal pkt, the tx get the single vlan pkt
+        double vlan insert: send single vlan pkt, the vlan insert to outer vlan and the default vlan become inner vlan
+        """
+        rece_num, _, vlans, vlan_id_list = self.vlan_pkts_fwd_check(
+            match_pkt,
+            port_id=port_id,
+            pmd_commands=pmd_commands,
+            tx_port=tx_port,
+            rx_port=rx_port,
+        )
+        if double_vlan:
+            self.verify(
+                rece_num == len(match_pkt) and len(vlan_id_list) == len(match_pkt) * 2,
+                "Failed to receive vlan pkts with vlan tag",
+            )
+            self.verify(
+                all(
+                    [
+                        insert_vlan == _vlan["outer"] and vlan_id == _vlan["inner"]
+                        for _vlan in vlans
+                    ]
+                ),
+                "the insert vlan is incorrect",
+            )
+        else:
+            self.verify(
+                rece_num == len(match_pkt)
+                and len(vlan_id_list) == len(match_pkt)
+                and insert_vlan in vlan_id_list,
+                "Failed to receive vlan pkts with vlan tag",
+            )
+            self.verify(
+                all([insert_vlan == _vlan["outer"] for _vlan in vlans]),
+                "the insert vlan is incorrect",
+            )
-- 
2.25.1


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

* [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 1/6] tests/func_test_base:add new commom module to refactor func test cases Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-14  2:03   ` Tu, Lijuan
  2023-06-08 18:27 ` [dst][PATCH V1 3/6] test_plans/kernelpf_vf_test_plan:add new plan " Zhimin Huang
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

add kernelpf_vf new suite and refactor with func_test_base common module:
cover kernelpf_iavf/vf_vlan/vf_macfilter/vf_rss/vf_xstats_check.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/TestSuite_kernelpf_vf.py | 1007 ++++++++++++++++++++++++++++++++
 1 file changed, 1007 insertions(+)
 create mode 100644 tests/TestSuite_kernelpf_vf.py

diff --git a/tests/TestSuite_kernelpf_vf.py b/tests/TestSuite_kernelpf_vf.py
new file mode 100644
index 00000000..cbecea14
--- /dev/null
+++ b/tests/TestSuite_kernelpf_vf.py
@@ -0,0 +1,1007 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+#
+
+import random
+
+from framework.exception import VerifyFailure
+from framework.settings import DPDK_RXMODE_SETTING, ETH_800_SERIES, load_global_setting
+from framework.test_case import TestCase, check_supported_nic
+
+from .func_test_base import *
+
+VF_MAC_ADDR = "00:01:23:45:67:89"
+VF_WRONG_MAC_ADDR = "00:01:23:45:67:99"
+MULTICAST_MAC_ADDR = "01:80:C2:00:00:08"
+BROADCAST_MAC_ADDR = "FF:FF:FF:FF:FF:FF"
+
+MAX_VLAN_ID = 4095
+RANDOM_VLAN_ID = random.randint(2, MAX_VLAN_ID)
+OUTER_VLAN_ID = 1
+INNTER_VLAN_ID = 2
+
+MATCHED_VLAN_PKT = FuncTestBase.generate_using_packets(
+    pkt_type="VLAN_UDP", vlan_id=RANDOM_VLAN_ID, dst_mac=VF_MAC_ADDR
+)
+UNMATCHED_VLAN_PKT = FuncTestBase.generate_using_packets(
+    pkt_type="VLAN_UDP", vlan_id=RANDOM_VLAN_ID - 1, dst_mac=VF_MAC_ADDR
+)
+
+MATCHED_DOUBLE_VLAN_PKT = [
+    FuncTestBase.generate_using_packets(pkt_str=_pkt)
+    for _pkt in [
+        'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=%d,type=0x8100,prio=1)/Dot1Q(vlan=%d,type=0x0800,prio=2)/IP('
+        'src="196.222.232.221")/("X"*480)'
+        % (VF_MAC_ADDR, OUTER_VLAN_ID, INNTER_VLAN_ID),
+        'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=%d,type=0x0800)/IP('
+        'src="196.222.232.221")/("X"*480)' % (VF_MAC_ADDR, OUTER_VLAN_ID),
+    ]
+]
+
+UNMATCHED_DOUBLE_VLAN_PKT = [
+    FuncTestBase.generate_using_packets(pkt_str=_pkt)
+    for _pkt in [
+        'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=%d,type=0x8100,prio=1)/Dot1Q(vlan=%d,type=0x0800,prio=2)/IP('
+        'src="196.222.232.221")/("X"*480)'
+        % (VF_MAC_ADDR, OUTER_VLAN_ID + 10, INNTER_VLAN_ID),
+        'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=%d,type=0x0800)/IP('
+        'src="196.222.232.221")/("X"*480)' % (VF_MAC_ADDR, OUTER_VLAN_ID + 10),
+    ]
+]
+
+
+class TestKernelpfVf(TestCase):
+    def set_up_all(self):
+        self.dut_port = self.dut.get_ports(self.nic)
+        self.used_dut_tx_port = self.dut_port[0]
+        self.used_dut_rx_port = self.dut_port[1]
+        self.port_obj = [self.dut.ports_info[port]["port"] for port in self.dut_port]
+        self.tester_tx_interface = self.tester.get_interface(
+            self.tester.get_local_port(self.used_dut_tx_port)
+        )
+        self.tester_rx_interface = self.tester.get_interface(
+            self.tester.get_local_port(self.used_dut_rx_port)
+        )
+        self.rxtx_base = RxTxBaseTest(
+            self, self.tester_tx_interface, self.tester_rx_interface
+        )
+        self.vlan_func = VlanFuncBaseTest(
+            self, self.tester_tx_interface, self.tester_rx_interface
+        )
+        self.rxtx_base.check_port_num_for_test(2)
+        self.setup_env_configuration()
+        self.rx_mode = load_global_setting(DPDK_RXMODE_SETTING)
+
+    def set_up(self):
+        pass
+
+    def pf_config(self):
+        self.flag = "vf-vlan-pruning"
+        self.dut.bind_interfaces_linux(self.kdriver)
+        self.default_stats = self.dut.get_priv_flags_state(
+            self.port_obj[self.used_dut_tx_port].get_interface_name(), self.flag
+        )
+        if not self.default_stats:
+            self.logger.warning(
+                f"{self.kdriver + '_' + self.nic_obj.driver_version} driver does not have vf-vlan-pruning flag."
+            )
+        if (
+            any([self.is_eth_series_nic(800), self.kdriver == "i40e"])
+            and self.default_stats
+        ):
+            self.dut.send_expect(
+                "ethtool --set-priv-flags %s %s on"
+                % (
+                    self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                    self.flag,
+                ),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ethtool --set-priv-flags %s %s on"
+                % (
+                    self.port_obj[self.used_dut_rx_port].get_interface_name(),
+                    self.flag,
+                ),
+                "# ",
+            )
+
+    def vf_config(self):
+        self.orig_vf_mac = self.rxtx_base.get_vf_mac_through_pf(
+            self.port_obj[self.used_dut_tx_port].get_interface_name()
+        )
+        self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(mac=VF_MAC_ADDR)
+        self.dut.send_expect(
+            "ip link set %s vf 0 spoofchk off"
+            % (self.port_obj[self.used_dut_tx_port].get_interface_name()),
+            "# ",
+        )
+        self.dut.send_expect(
+            "ip link set %s vf 0 spoofchk off"
+            % (self.port_obj[self.used_dut_rx_port].get_interface_name()),
+            "# ",
+        )
+
+    def setup_env_configuration(self):
+        self.vm_obj, self.vm_dut = self.rxtx_base.vf_test_preset_env_vm(
+            pf_port=[self.used_dut_tx_port, self.used_dut_rx_port],
+            vfs_num=1,
+            vm_name="vm0",
+        )
+        self.rxtx_base.init_pmd_session(self.vm_dut)
+        self.vlan_func.init_pmd_session(self.vm_dut)
+
+    def test_vf_basic_rxtx(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_rx_check(packets_num=100, packet_dst_mac=VF_MAC_ADDR)
+        self.rxtx_base.basic_tx_check()
+
+    def test_vf_promisc_mode(self):
+        try:
+            self.rxtx_base.execute_host_cmd(
+                "ip link set dev %s vf 0 trust on"
+                % self.port_obj[self.used_dut_tx_port].get_interface_name()
+            )
+            self.rxtx_base.launch_testpmd()
+            self.rxtx_base.basic_promisc_check(
+                match_mac=VF_MAC_ADDR, unmatch_mac=VF_WRONG_MAC_ADDR
+            )
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.rxtx_base.pmd_session.quit()
+            self.rxtx_base.execute_host_cmd(
+                "ip link set dev %s vf 0 trust off"
+                % self.port_obj[self.used_dut_tx_port].get_interface_name()
+            )
+            self.vf_config()
+
+    def test_vf_multicast(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_multicast_check(
+            normal_mac=VF_MAC_ADDR, multicast_mac=MULTICAST_MAC_ADDR
+        )
+
+    def test_vf_broadcast(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_rx_check(packets_num=1, packet_dst_mac=BROADCAST_MAC_ADDR)
+
+    def test_vf_queue_start_stop(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=4, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=4
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 0 rxq 0 stop", "start"],
+        )
+        self.verify(
+            len(packets_captured) == 0
+            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
+            "receive packet num is not match",
+        )
+        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=4
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 0 rxq 0 start", "port 1 txq 0 stop", "start"],
+        )
+        self.verify(
+            len(packets_captured) == 0
+            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
+            "receive packet num is not match",
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=4,
+            dst_mac=VF_MAC_ADDR,
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 1 txq 0 start", "start"],
+        )
+
+    def test_vf_rss(self):
+        rss_type = ["ip", "tcp", "udp"]
+        rss_reta = [3, 2, 1, 0] * 16
+        self.rxtx_base.launch_testpmd(param="--rxq=4 --txq=4")
+        self.rxtx_base.rss_reta_config_check(rss_reta)
+        for _rss in rss_type:
+            hash_table = self.rxtx_base.basic_rss_check(
+                dst_mac=VF_MAC_ADDR, rss_type=_rss, queue_num=4
+            )
+            self.rxtx_base.rss_reta_hit_check(hash_table, rss_reta)
+            self.rxtx_base.execute_pmd_cmd("stop")
+
+    def test_vf_rss_hash_key(self):
+        update_hash_key = "1b9d58a4b961d9cd1c56ad1621c3ad51632c16a5d16c21c3513d132c135d132c13ad1531c23a51d6ac49879c499d798a7d949c8a"
+        self.rxtx_base.launch_testpmd(param="--rxq=4 --txq=4")
+        self.rxtx_base.basic_rss_hash_key_check(
+            dst_mac=VF_MAC_ADDR, hash_key=update_hash_key
+        )
+
+    def test_vf_rss_rxq_txq_inconsistent(self):
+        params = [
+            "--rxq=4 --txq=8",
+            "--rxq=6 --txq=8",
+            "--rxq=3 --txq=9",
+            "--rxq=4 --txq=16",
+        ]
+        if self.kdriver == "ixgbe":
+            params = [
+                "--rxq=2 --txq=4",
+                "--rxq=1 --txq=2",
+            ]
+        for param in params:
+            try:
+                queue_num = re.search(r"--rxq=(\d+)", param).group(1)
+                self.rxtx_base.launch_testpmd(param=param)
+                self.rxtx_base.basic_rss_check(
+                    dst_mac=VF_MAC_ADDR, rss_type="ip", queue_num=queue_num
+                )
+            except Exception as e:
+                raise VerifyFailure(e)
+            finally:
+                self.rxtx_base.pmd_session.quit()
+
+    def test_vf_port_start_stop(self):
+        self.rxtx_base.launch_testpmd()
+        for i in range(10):
+            self.rxtx_base.execute_pmd_cmd("port stop all")
+            self.rxtx_base.execute_pmd_cmd("port start all")
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_vf_statistic_reset(self):
+        self.rxtx_base.launch_testpmd()
+        out = self.rxtx_base.execute_pmd_cmd("show port stats all")
+        self.verify(
+            "RX-packets: 0" in out and "TX-packets: 0" in out,
+            "receive some misc packet",
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+        self.rxtx_base.execute_pmd_cmd("clear port stats all")
+        out = self.rxtx_base.execute_pmd_cmd("show port stats all")
+        self.verify(
+            "RX-packets: 0" in out and "TX-packets: 0" in out,
+            "clear port stats fail",
+        )
+
+    def test_vf_information(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_pmd_info_check(self.port_obj[0])
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_vf_xstats_check(self):
+        try:
+            self.tester.send_expect(
+                "ifconfig {} mtu {}".format(self.tester_tx_interface, 3000), "# "
+            )
+            if self.kdriver == "ixgbe":
+                self.rxtx_base.execute_host_cmd(
+                    "ifconfig {} mtu 3000".format(
+                        self.port_obj[self.used_dut_tx_port].get_interface_name()
+                    )
+                )
+            self.rxtx_base.launch_testpmd(param="--rxq=4 --txq=4 --max-pkt-len=9000")
+            for _payload_size in [64, 128, 256, 512, 1024, 1523]:
+
+                stats_table, xstats_table = self.rxtx_base.basic_xstats_check(
+                    packet_num=100,
+                    dst_mac=VF_MAC_ADDR,
+                    rx_port=self.used_dut_rx_port,
+                    payload_size=_payload_size,
+                )
+                self.verify(
+                    xstats_table[self.used_dut_tx_port]["rx_good_packets"]
+                    == stats_table[self.used_dut_tx_port]["RX-packets"]
+                    == xstats_table[self.used_dut_rx_port]["tx_good_packets"]
+                    == stats_table[self.used_dut_rx_port]["TX-packets"]
+                    == 100,
+                    "pkt recieve or transport count error!",
+                )
+                self.verify(
+                    xstats_table[self.used_dut_tx_port]["rx_good_bytes"]
+                    == stats_table[self.used_dut_tx_port]["RX-bytes"]
+                    == xstats_table[self.used_dut_rx_port]["tx_good_bytes"]
+                    == stats_table[self.used_dut_rx_port]["TX-bytes"],
+                    "pkt recieve or transport bytes error!",
+                )
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.tester.send_expect(
+                "ifconfig {} mtu {}".format(self.tester_tx_interface, 1500), "# "
+            )
+            if self.kdriver == "ixgbe":
+                self.rxtx_base.execute_host_cmd(
+                    "ifconfig {} mtu 1500".format(
+                        self.port_obj[self.used_dut_tx_port].get_interface_name()
+                    )
+                )
+
+    def test_vf_unicast(self):
+        self.rxtx_base.launch_testpmd()
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=10,
+            dst_mac=VF_WRONG_MAC_ADDR,
+            check_miss=True,
+            pmd_commands=[
+                "set promisc all off",
+                "set allmulti all off",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=10, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_vf_mac_add_filter(self):
+        try:
+            self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(
+                mac=self.orig_vf_mac[0]
+            )
+            self.rxtx_base.launch_testpmd()
+            default_vf_mac = self.rxtx_base.get_vf_mac_through_pf(
+                self.port_obj[self.used_dut_tx_port].get_interface_name()
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=[
+                    "port stop all",
+                    "port config all crc-strip on",
+                    "port start all",
+                    "set promisc all off",
+                    "mac_addr add 0 {}".format(VF_MAC_ADDR),
+                    "set verbose 1",
+                    "set fwd mac",
+                    "start",
+                ],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=default_vf_mac[0],
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=["clear port stats all"],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                check_miss=True,
+                pmd_commands=[
+                    "clear port stats all",
+                    "mac_addr remove 0 {}".format(VF_MAC_ADDR),
+                ],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_WRONG_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                check_miss=True,
+                pmd_commands=[
+                    "clear port stats all",
+                ],
+            )
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(mac=VF_MAC_ADDR)
+
+    def test_vf_vlan_filter(self):
+        self.vlan_func.launch_testpmd()
+        self.vlan_func.basic_vlan_filter_check(
+            vlan_id=RANDOM_VLAN_ID,
+            match_pkt=MATCHED_VLAN_PKT,
+            unmatch_pkt=UNMATCHED_VLAN_PKT,
+            pmd_commands=[
+                "set promisc all off",
+                "vlan set filter on 0",
+                "vlan set strip off 0",
+                "rx_vlan add %d 0" % RANDOM_VLAN_ID,
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+        _, _, _, vlan_id_list = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_VLAN_PKT,
+            pmd_commands=[
+                "rx_vlan rm %d 0" % RANDOM_VLAN_ID,
+                "vlan set filter off 0",
+            ],
+        )
+        if (
+            (self.kdriver == "i40e" and self.nic_obj.driver_version < "2.13.10")
+            or (self.kdriver == "i40e" and not self.default_stats)
+            or (self.kdriver == "ice" and not self.default_stats)
+        ):
+            self.verify(len(vlan_id_list) == 1, "Failed to received vlan packet!!!")
+        else:
+            self.verify(len(vlan_id_list) == 0, "Failed to received vlan packet!!!")
+
+    def test_vf_vlan_strip(self):
+        self.vlan_func.launch_testpmd()
+        self.vlan_func.basic_vlan_strip_check(
+            vlan_id=RANDOM_VLAN_ID,
+            match_pkt=MATCHED_VLAN_PKT,
+            pmd_commands=[
+                "set promisc all off",
+                "vlan set filter on 0",
+                "rx_vlan add %d 0" % RANDOM_VLAN_ID,
+                "vlan set strip on 0",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+
+    def test_vf_vlan_insertion(self):
+        self.vlan_func.launch_testpmd()
+        self.vlan_func.basic_vlan_insert_check(
+            vlan_id=RANDOM_VLAN_ID,
+            insert_vlan=RANDOM_VLAN_ID,
+            match_pkt=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            pmd_commands=[
+                "port stop all",
+                "set promisc all off",
+                "vlan set filter on 0",
+                "tx_vlan set 1 %s" % RANDOM_VLAN_ID,
+                "rx_vlan add %s 0" % RANDOM_VLAN_ID,
+                "port start all",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+        )
+
+    def test_vf_vlan_pvid_base_tx(self):
+        try:
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=RANDOM_VLAN_ID,
+            )
+            self.vlan_func.launch_testpmd()
+            packets_captured, _, _ = self.vlan_func.execute_fwd_check_process(
+                packets=self.vlan_func.generate_using_packets(
+                    pkt_type="UDP",
+                    dst_mac=self.vlan_func.get_vf_mac_through_pf(
+                        pf_intf=self.port_obj[
+                            self.used_dut_rx_port
+                        ].get_interface_name()
+                    ),
+                ),
+                tx_port=1,
+                tester_tx_interface=self.tester_rx_interface,
+                tester_rx_interface=self.tester_tx_interface,
+                pmd_commands=["set fwd mac", "set verbose 1", "start"],
+            )
+            self.verify(len(packets_captured) == 1, "Not receive expected packet")
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.vlan_func.execute_host_cmd(
+                "ip link set {} vf 0 vlan 0".format(
+                    self.port_obj[self.used_dut_tx_port].get_interface_name()
+                )
+            )
+
+    def test_vf_vlan_pvid_base_rx(self):
+        try:
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=RANDOM_VLAN_ID,
+            )
+            self.vlan_func.launch_testpmd()
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=[MATCHED_VLAN_PKT, UNMATCHED_VLAN_PKT],
+                pmd_commands=[
+                    "set fwd rxonly",
+                    "set verbose 1",
+                    "start",
+                ],
+            )
+            self.verify(rece_num == 1, "Failed to received matched vlan pkt")
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=self.vlan_func.generate_using_packets(
+                    pkt_type="UDP", dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 0, "Failed to received udp pkt without vlan")
+            self.vlan_func.pmd_session.quit()
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=0,
+            )
+            self.vlan_func.launch_testpmd()
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=MATCHED_VLAN_PKT,
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=[
+                    "set fwd rxonly",
+                    "set verbose 1",
+                    "start",
+                ],
+            )
+            if (
+                (self.kdriver == "i40e" and self.nic_obj.driver_version < "2.13.10")
+                or (self.kdriver == "i40e" and not self.default_stats)
+                or (self.kdriver == "ice" and not self.default_stats)
+            ):
+                self.verify(rece_num == 1, "Failed to received vlan packet!!!")
+            else:
+                self.verify(rece_num == 0, "Failed to received vlan packet!!!")
+
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=[
+                    self.vlan_func.generate_using_packets(
+                        pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+                    ),
+                    self.vlan_func.generate_using_packets(
+                        pkt_type="UDP", dst_mac=VF_MAC_ADDR
+                    ),
+                ],
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 2, "Not received expect packet")
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.vlan_func.execute_host_cmd(
+                "ip link set {} vf 0 vlan 0".format(
+                    self.port_obj[self.used_dut_tx_port].get_interface_name()
+                )
+            )
+
+    def test_vf_vlan_rx_combination(self):
+        rx_vlans = [1, RANDOM_VLAN_ID, MAX_VLAN_ID]
+        param = "--enable-hw-vlan" if self.kdriver != "ixgbe" else ""
+        self.rxtx_base.launch_testpmd(param=param)
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "set fwd rxonly",
+                "set verbose 1",
+                "vlan set strip on 0",
+                "vlan set filter on 0",
+                "set promisc all off",
+                "start",
+            ],
+        )
+        self.verify(rece_num == 1, "Not received normal packet as default")
+        _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+            packets=self.vlan_func.generate_using_packets(
+                pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify("VLAN tci=0x0" in pmdout, "Not received vlan 0 packet as default")
+        for rx_vlan in rx_vlans:
+            _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+                packets=self.vlan_func.generate_using_packets(
+                    pkt_type="VLAN_UDP", vlan_id=rx_vlan, dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+                pmd_commands="rx_vlan add {} 0".format(rx_vlan),
+            )
+            self.verify(
+                "VLAN tci={}".format(hex(rx_vlan)) in pmdout,
+                "Not received expected vlan packet",
+            )
+            if rx_vlan == MAX_VLAN_ID:
+                continue
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=self.vlan_func.generate_using_packets(
+                    pkt_type="VLAN_UDP", vlan_id=rx_vlan + 1, dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 0, "failed to receive unmatch vlan pkt")
+        for rx_vlan in rx_vlans:
+            self.vlan_func.execute_pmd_cmd("rx_vlan rm {} 0".format(rx_vlan))
+        _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+            packets=self.vlan_func.generate_using_packets(
+                pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify("VLAN tci=0x0" in pmdout, "Not received vlan 0 packet as default")
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify(
+            rece_num == 1, "Not received normal packet after remove vlan filter"
+        )
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_VLAN_PKT,
+            rx_port=self.used_dut_rx_port,
+        )
+        if (
+            (self.kdriver == "i40e" and self.nic_obj.driver_version < "2.13.10")
+            or (self.kdriver == "i40e" and not self.default_stats)
+            or (self.kdriver == "ice" and not self.default_stats)
+        ):
+            self.verify(rece_num == 1, "Failed to received vlan packet!!!")
+        else:
+            self.verify(rece_num == 0, "Failed to received vlan packet!!!")
+
+    def test_vf_vlan_promisc(self):
+        self.vlan_func.launch_testpmd()
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=[
+                self.vlan_func.generate_using_packets(
+                    pkt_str=[
+                        'Ether(dst="{}",type=0x8100)/Dot1Q(vlan=100,type=0x0800)/IP(src="196.222.232.{}")/("X"*480)'.format(
+                            VF_MAC_ADDR, i
+                        )
+                        for i in range(10)
+                    ]
+                )
+            ],
+            pmd_commands=[
+                "port stop all",
+                "set promisc all on",
+                "set fwd mac",
+                "set verbose 1",
+                "vlan set filter off 0",
+                "vlan set strip off 0",
+                "port start all",
+                "start",
+            ],
+        )
+        if (
+            (self.kdriver == "i40e" and self.nic_obj.driver_version < "2.13.10")
+            or (self.kdriver == "i40e" and not self.default_stats)
+            or (self.kdriver == "ice" and not self.default_stats)
+        ):
+            self.verify(rece_num == 10, "Not receive expected packet")
+        else:
+            self.verify(rece_num == 0, "Receive expected packet")
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=[
+                self.vlan_func.generate_using_packets(
+                    pkt_str=[
+                        'Ether(dst="{}")/IP(src="196.222.232.{}")/("X"*480)'.format(
+                            VF_MAC_ADDR, i
+                        )
+                        for i in range(10)
+                    ]
+                )
+            ],
+        )
+        self.verify(rece_num == 10, "Not receive expected packet")
+
+    def test_iavf_dual_vlan_filter(self):
+        self.vlan_func.launch_testpmd()
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_DOUBLE_VLAN_PKT,
+            pmd_commands=[
+                "vlan set filter on 0",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+        )
+        self.vlan_func.vlan_offload_flag_check(filter="on")
+        if self.default_stats:
+            self.verify(rece_num == 0, "Failed received vlan packet!")
+        else:
+            self.verify(
+                rece_num == len(MATCHED_DOUBLE_VLAN_PKT),
+                "Failed received vlan packet!",
+            )
+        self.vlan_func.basic_vlan_filter_check(
+            vlan_id=OUTER_VLAN_ID,
+            match_pkt=MATCHED_DOUBLE_VLAN_PKT[0],
+            unmatch_pkt=UNMATCHED_DOUBLE_VLAN_PKT[0],
+            pmd_commands=[
+                "rx_vlan add %d 0" % OUTER_VLAN_ID,
+            ],
+            double_vlan=True,
+            rx_port=self.used_dut_rx_port,
+        )
+        self.vlan_func.vlan_prio_check(
+            pkts=MATCHED_DOUBLE_VLAN_PKT[0], outer=1, inner=2
+        )
+        self.vlan_func.basic_vlan_filter_check(
+            vlan_id=OUTER_VLAN_ID,
+            match_pkt=MATCHED_DOUBLE_VLAN_PKT[1],
+            unmatch_pkt=UNMATCHED_DOUBLE_VLAN_PKT[1],
+            double_vlan=False,
+            rx_port=self.used_dut_rx_port,
+        )
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_DOUBLE_VLAN_PKT,
+            pmd_commands=[
+                "rx_vlan rm %d 0" % OUTER_VLAN_ID,
+            ],
+        )
+        if self.default_stats:
+            self.verify(rece_num == 0, "Failed error received vlan packet!")
+        else:
+            self.verify(rece_num == 2, "Failed error received vlan packet!")
+
+    def test_iavf_dual_vlan_strip(self):
+        self.vlan_func.launch_testpmd()
+        rece_num, _, _, vlan_id_list = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_DOUBLE_VLAN_PKT,
+            pmd_commands=[
+                "vlan set filter on 0",
+                "rx_vlan add %d 0" % OUTER_VLAN_ID,
+                "vlan set strip on 0",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+        )
+        self.vlan_func.vlan_offload_flag_check(filter="on", strip="on")
+        self.verify(
+            rece_num == len(MATCHED_DOUBLE_VLAN_PKT)
+            and len(vlan_id_list) == 1
+            and INNTER_VLAN_ID in vlan_id_list,
+            "Failed to receive vlan pkts with vlan tag",
+        )
+        rece_num, _, _, vlan_id_list = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_DOUBLE_VLAN_PKT,
+            pmd_commands=[
+                "vlan set strip off 0",
+            ],
+        )
+        self.vlan_func.vlan_offload_flag_check(strip="off")
+        self.verify(
+            rece_num == len(MATCHED_DOUBLE_VLAN_PKT) and len(vlan_id_list) == 3,
+            "Failed to receive vlan pkts with vlan tag",
+        )
+
+    def test_iavf_dual_vlan_insert(self):
+        """
+        Test case: IAVF DUAL VLAN header insertion
+        """
+
+        """
+        according to dpdk commit d048a0aaae27809523969904c2f7b71fe3cc1bb6,
+        when the ice driver version newer than 1.8.9, avx512 tx path not support
+        insert correct vlag tag(outer of QinQ)
+        """
+        if self.rx_mode == "avx512" and self.vlan_func.convert_driver_version_value(
+            self.nic_obj.driver_version
+        ) > self.vlan_func.convert_driver_version_value("1.8.9"):
+            self.skip_case(False, "avx512 tx path not support insert correct vlan tag")
+        self.vlan_func.launch_testpmd()
+        self.vlan_func.basic_vlan_insert_check(
+            vlan_id=RANDOM_VLAN_ID,
+            insert_vlan=INNTER_VLAN_ID,
+            match_pkt=MATCHED_VLAN_PKT,
+            pmd_commands=[
+                "vlan set filter on 0",
+                "rx_vlan add {} 0".format(RANDOM_VLAN_ID),
+                "port stop 1",
+                "tx_vlan set 1 {}".format(INNTER_VLAN_ID),
+                "port start 1",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+            double_vlan=INNTER_VLAN_ID,
+        )
+        self.vlan_func.basic_vlan_insert_check(
+            vlan_id=RANDOM_VLAN_ID,
+            insert_vlan=INNTER_VLAN_ID,
+            match_pkt=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+
+    @check_supported_nic(ETH_800_SERIES)
+    def test_enable_disable_iavf_crc_strip(self):
+        """
+        Test case: Enable/disable AVF CRC stripping
+        """
+        self.rxtx_base.launch_testpmd(param="--disable-crc-strip")
+        packets_captured, pmdout, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=1
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["set verbose 1", "set fwd mac", "start"],
+        )
+        pkt_len_list = self.rxtx_base.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            int(pkt_len_list[0]) + 4 == stats[self.used_dut_tx_port]["RX-bytes"],
+            "CRC strip off failed",
+        )
+
+        packets_captured, pmdout, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=1
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "stop",
+                "port stop 0",
+                "port config 0 rx_offload keep_crc off",
+                "port start 0",
+                "start",
+            ],
+        )
+        pkt_len_list = self.rxtx_base.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            int(pkt_len_list[0]) == stats[self.used_dut_tx_port]["RX-bytes"],
+            "CRC strip off failed",
+        )
+
+        packets_captured, pmdout, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=1
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "stop",
+                "port stop 0",
+                "port config 0 rx_offload keep_crc on",
+                "port start 0",
+                "start",
+            ],
+        )
+        pkt_len_list = self.rxtx_base.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            int(pkt_len_list[0]) + 4 == stats[self.used_dut_tx_port]["RX-bytes"],
+            "CRC strip off failed",
+        )
+
+        self.rxtx_base.pmd_session.quit()
+        self.rxtx_base.launch_testpmd()
+        packets_captured, pmdout, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=1
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+        )
+        pkt_len_list = self.rxtx_base.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            int(pkt_len_list[0]) == stats[self.used_dut_tx_port]["RX-bytes"],
+            "CRC strip off failed",
+        )
+
+    @check_supported_nic(ETH_800_SERIES)
+    def test_crc_strip_iavf_vlan_strip_coexists(self):
+        """
+        Test case: IAVF CRC strip and Vlan strip co-exists
+        """
+        self.vlan_func.launch_testpmd()
+        self.vlan_func.set_pmd_fwd_mode("mac")
+        self.vlan_func.vlan_offload_flag_check(strip="off")
+        # vlan strip off, CRC strip on
+        self.vlan_func.execute_pmd_cmd(["stop", "vlan set strip off 0"])
+        self.vlan_func.vlan_offload_flag_check(strip="off")
+        packets_captured, pmdout, stats = self.vlan_func.execute_fwd_check_process(
+            packets=MATCHED_DOUBLE_VLAN_PKT[0],
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "vlan set filter on 0",
+                "rx_vlan add %d 0" % OUTER_VLAN_ID,
+                "start",
+            ],
+        )
+        _, vlan_id_list = self.vlan_func.get_pkts_vlan_layer(packets_captured, "vlan")
+        pkt_len_list = self.vlan_func.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            len(vlan_id_list) == 2
+            and stats[self.used_dut_tx_port]["RX-bytes"]
+            == stats[self.used_dut_rx_port]["TX-bytes"]
+            == int(pkt_len_list[0]),
+            "CRC strip on and vlan strip off should have same values for rx/tx bytes and pkt_len",
+        )
+        compare_pkt_len = int(pkt_len_list[0])
+        # vlan strip on, CRC strip on
+        self.vlan_func.execute_pmd_cmd("vlan set strip on 0")
+        self.vlan_func.vlan_offload_flag_check(strip="on")
+        packets_captured, pmdout, stats = self.vlan_func.execute_fwd_check_process(
+            packets=MATCHED_DOUBLE_VLAN_PKT[0],
+            rx_port=self.used_dut_rx_port,
+        )
+        _, vlan_id_list = self.vlan_func.get_pkts_vlan_layer(packets_captured, "vlan")
+        pkt_len_list = self.vlan_func.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            stats[self.used_dut_tx_port]["RX-bytes"] == int(pkt_len_list[0]) + 4
+            and int(pkt_len_list[0]) + 4 == compare_pkt_len
+            and len(vlan_id_list) == 1,
+            "CRC strip on, vlan strip on, coexists test failed",
+        )
+        # vlan strip off, CRC strip off
+        self.vlan_func.execute_pmd_cmd("vlan set strip off 0")
+        self.vlan_func.vlan_offload_flag_check(strip="off")
+        packets_captured, pmdout, stats = self.vlan_func.execute_fwd_check_process(
+            packets=MATCHED_DOUBLE_VLAN_PKT[0],
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "stop",
+                "port stop 0",
+                "port config 0 rx_offload keep_crc on",
+                "port start 0",
+                "start",
+            ],
+        )
+        _, vlan_id_list = self.vlan_func.get_pkts_vlan_layer(packets_captured, "vlan")
+        pkt_len_list = self.vlan_func.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            stats[self.used_dut_tx_port]["RX-bytes"] == int(pkt_len_list[0]) + 4
+            and int(pkt_len_list[0]) == compare_pkt_len
+            and len(vlan_id_list) == 2,
+            "CRC strip off, vlan strip off, coexists test failed",
+        )
+        # vlan strip on, CRC strip off
+        out = self.vlan_func.execute_pmd_cmd("vlan set strip on 0")
+        self.verify(
+            "iavf_config_vlan_strip_v2(): fail to execute command VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2"
+            in out,
+            "set vlan strip on successfully",
+        )
+        packets_captured, pmdout, stats = self.vlan_func.execute_fwd_check_process(
+            packets=MATCHED_DOUBLE_VLAN_PKT[0],
+            rx_port=self.used_dut_rx_port,
+        )
+        _, vlan_id_list = self.vlan_func.get_pkts_vlan_layer(packets_captured, "vlan")
+        pkt_len_list = self.vlan_func.get_pmd_rece_pkt_len(pmdout)
+        self.verify(
+            stats[self.used_dut_tx_port]["RX-bytes"] == int(pkt_len_list[0]) + 4
+            and int(pkt_len_list[0]) == compare_pkt_len
+            and len(vlan_id_list) == 2,
+            "CRC strip off, vlan strip off, coexists test failed",
+        )
+        # vlan strip off, CRC strip on
+        self.vlan_func.execute_pmd_cmd("vlan set strip off 0")
+        self.vlan_func.vlan_offload_flag_check(strip="off")
+        packets_captured, pmdout, stats = self.vlan_func.execute_fwd_check_process(
+            packets=MATCHED_DOUBLE_VLAN_PKT[0],
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "stop",
+                "port stop 0",
+                "port config 0 rx_offload keep_crc off",
+                "port start 0",
+                "start",
+            ],
+        )
+        self.verify(
+            stats[self.used_dut_tx_port]["RX-bytes"] == int(pkt_len_list[0])
+            and int(pkt_len_list[0]) == compare_pkt_len
+            and len(vlan_id_list) == 2,
+            "CRC strip on, vlan strip off, coexists test failed",
+        )
+
+    def tear_down(self):
+        self.rxtx_base.pmd_session.quit()
+
+    def tear_down_all(self):
+        self.rxtx_base.destroy_vm_env()
+        self.rxtx_base.destroy_vf()
-- 
2.25.1


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

* [dst][PATCH V1 3/6] test_plans/kernelpf_vf_test_plan:add new plan to cover most of the basic vf cases
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 1/6] tests/func_test_base:add new commom module to refactor func test cases Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 4/6] tests/ice_kernelpf_dcf:add new suite to cover dcf pmd function Zhimin Huang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

add new testplan for kernelpf_vf test suite

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 test_plans/kernelpf_vf_test_plan.rst | 1294 ++++++++++++++++++++++++++
 1 file changed, 1294 insertions(+)
 create mode 100644 test_plans/kernelpf_vf_test_plan.rst

diff --git a/test_plans/kernelpf_vf_test_plan.rst b/test_plans/kernelpf_vf_test_plan.rst
new file mode 100644
index 00000000..7d4ecef4
--- /dev/null
+++ b/test_plans/kernelpf_vf_test_plan.rst
@@ -0,0 +1,1294 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2023 Intel Corporation
+
+========================
+Kernel PF + VF test plan
+========================
+
+Intel Adaptive Virtual Function is aimed to provide a common VF for VM
+which means just need one unified VF driver so you don't have to reload
+different VF driver when you upgrade the PF NIC.
+One of the advantages is you don't have to do any modification for code or
+hardware for an existing VM image running on the new NIC.
+
+Requirement
+===========
+This plan for VF only supports kernel PF scenario.
+
+Hardware
+========
+ICE/I40E driver NIC.
+
+Prerequisites
+=============
+1. Get the pci device id of DUT, for example::
+
+    ./usertools/dpdk-devbind.py -s
+
+    0000:18:00.0 'Device 1592' if=enp24s0f0 drv=ice unused=igb_uio
+    0000:18:00.1 'Device 1592' if=enp24s0f1 drv=ice unused=igb_uio
+
+2. Create 2 VF from 2 kernel PF::
+
+    echo 1 > /sys/bus/pci/devices/0000\:18\:00.0/sriov_numvfs
+    echo 1 > /sys/bus/pci/devices/0000\:18\:00.1/sriov_numvfs
+
+3. Set VF mac as 00:01:23:45:67:89::
+
+    ip link set $PF_INTF vf 0 mac 00:01:23:45:67:89
+
+4. Test IAVF cases on host or in qemu
+
+5. Bind VF device to vfio-pci::
+
+    usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:18:01.0 0000:18:09.0
+
+launch testpmd::
+
+    ./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i
+
+.. note::
+
+    1.the kernel driver has MAC and VLAN Anti-Spoofing feature for VFs, the default is enable.
+      disabled for vfs: ip link set <ethX> vf <vf id> spoofchk {off|on}
+
+    2.for vf-vlan-pruning in ethtool --set-priv-flag, enable function to receive specific vlan packet.
+
+Test case: VF basic RX/TX
+=========================
+Set rxonly forward, start testpmd
+
+Send 100 random packets from tester, check packets can be received
+
+Set txonly forward, start testpmd
+
+Check tester could receive the packets from application generated
+
+Test case: VF promisc
+=====================
+Enable kernel trust mode::
+
+    ip link set $PF_INTF vf 0 trust on
+
+Start VF testpmd, set mac forward and enable print output
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the VF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can be received and forwarded by the VF.
+
+Disable promisc mode::
+
+    testpmd> set promisc all off
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the VF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can't be received and forwarded by the VF.
+
+Enable promisc mode::
+
+    testpmd> set promisc all on
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the VF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can be received and forwarded by the VF.
+
+Disable kernel trust mode::
+
+    ip link set $PF_INTF vf 0 trust off
+
+Test case: VF multicast
+=======================
+
+Start VF testpmd
+
+Disable promisc and multicast mode::
+
+    testpmd> set promisc all off
+    testpmd> set allmulti all off
+    testpmd> start
+
+Send packet with current VF0's MAC, and check VF can receive the packet.
+
+Send packet with multicast MAC 01:80:C2:00:00:08, and check VF can not
+receive the packet.
+
+Enable multicast mode::
+
+    testpmd> set allmulti all on
+
+configure multicast address::
+
+    testpmd> mcast_addr add 0 01:80:C2:00:00:08
+
+Send packet with current VF0's MAC, and check VF can receive the packet.
+
+Send packet with multicast MAC 01:80:C2:00:00:08, and check VF can
+receive the packet.
+
+Test case: VF broadcast
+=======================
+Disable VF promisc mode::
+
+    testpmd> set promisc all off
+    testpmd> start
+
+Send packet with broadcast address ff:ff:ff:ff:ff:ff, and check VF can
+receive the packet
+
+Test case: VF unicast
+=====================
+Disable VF promisc and multicast mode::
+
+    testpmd> set promisc all off
+    testpmd> set allmulti all off
+    testpmd> start
+
+Send packet with unicast address, and check VF can receive the packet
+
+Test case: VF mac add filter
+============================
+Disable VF promisc and enable crc strip and add mac address::
+
+    testpmd> port stop all
+    testpmd> port config all crc-strip on
+    testpmd> port start all
+    testpmd> set promisc all off
+    testpmd> mac_addr add 0 00:11:22:33:44:55
+
+Use scapy to send 100 random packets with current VF0's MAC, verify the
+packets can be received by one VF and can be forwarded to another VF
+correctly.
+
+Use scapy to send 100 random packets with new added VF0's MAC, verify the
+packets can be received by one VF and can be forwarded to another VF correctly.
+
+remove the added mac address::
+
+      testpmd> mac_addr remove 0 00:11:22:33:44:55
+
+Use scapy to send 100 random packets to the deleted MAC to VF0, verify the
+packets can't be received by one VF and also can't be forwarded to another
+VF correctly
+
+Use scapy to send 100 random packets with a wrong MAC to VF0, verify the
+packets can't be received by one VF and also can't be forwarded to another
+VF correctly.
+
+Test case: VF vlan insertion
+============================
+
+Disable VF vlan strip::
+
+    testpmd> vlan set strip off 0
+
+Set vlan id 20 for tx_vlan::
+
+    testpmd> port stop all
+    testpmd> tx_vlan set 0 20
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan set 0 20
+    testpmd> port start all
+    testpmd> set fwd mac
+    testpmd> start
+
+Send normal packet::
+
+    p=Ether(dst="00:01:23:45:67:89")/IP()/Raw(load='X'*30)
+
+Verify packet that out from VF contains the vlan tag 20
+
+Test case: VF vlan strip
+========================
+
+Enable VF vlan strip::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 20 0
+    testpmd> vlan set strip on 0
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+    testpmd> start
+
+Send packets with vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check that out from VF doesn't contain the vlan tag.
+
+Disable VF vlan strip::
+
+    testpmd> vlan set strip off 0
+
+Send packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check that out from VF contains the vlan tag.
+
+Test case: VF vlan filter
+=========================
+
+Enable vlan filter::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 20 0
+    testpmd> vlan set strip off 0
+    testpmd> set promisc all off
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+    testpmd> start
+
+Send packets with vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check packets can be received and forwarded with vlan tag.
+
+Send packets with unmatched vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=30)/IP()/Raw(load='X'*30)
+
+Check packets can not be received and forwarded.
+
+Disable VF vlan filter::
+
+    testpmd> vlan set filter off 0
+
+Send packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded with vlan tag.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded
+
+Test case: VF vlan promisc
+==========================
+
+Enable promisc and disable vlan filter::
+
+    testpmd> port stop all
+    testpmd> set promisc all on
+    testpmd> set verbose 1
+    testpmd> vlan set filter off 0
+    testpmd> vlan set strip off 0
+    testpmd> set fwd mac
+    testpmd> port start all
+    testpmd> start
+
+Send 10 random packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89",type=0x8100)/Dot1Q(vlan=100,type=0x0800)/IP(src="196.222.232.1")/("X"*480)
+    ...
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded.
+
+Send 10 random packets without vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/IP(src="196.222.232.1")/("X"*480)
+    ...
+
+Check packets can be received and forwarded.
+
+Test case: VF add pvid base rx
+==============================
+
+Add pvid on VF0 from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 2
+
+Check pf device show correct pvid setting::
+
+     ip link show ens259f0
+     ...
+     vf 0 MAC 00:00:00:00:00:00, vlan 1, spoof checking on, link-state auto
+
+
+Start testpmd
+
+Send packet with same vlan id and check VF can receive
+
+Send packet without vlan and check VF can't receive
+
+Send packet with wrong vlan id and check Vf can't receive
+
+Remove added vlan from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 0
+
+Restart testpmd and send packet without vlan and check VF can receive
+
+Set packet with vlan id 0 and check VF can receive
+
+Set packet with random id 1-4095
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded
+
+
+send vlan=0 and not vlan pkt, also receive
+
+Test case: VF add pvid base tx
+==============================
+Add pvid on VF0 from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 2
+
+Start testpmd with mac forward mode::
+
+     testpmd> set fwd mac
+     testpmd> start
+
+Send packet from tester port1 and check packet received by tester port0::
+
+     Check port1 received packet with configured vlan 2
+
+Test case: VF vlan rx combination
+=================================
+Start testpmd with rxonly mode and parameter "--enable-hw-vlan"::
+
+     testpmd> set fwd rxonly
+     testpmd> set verbose 1
+     testpmd> start
+
+.. note::
+
+     parameter "--enable-hw-vlan" not support nic: IXGBE_10G-82599_SFP.
+
+Send packet without vlan and check packet received
+
+Send packet with vlan 0 and check packet received
+
+Add vlan on VF0 from VF driver::
+
+     testpmd> rx_vlan add 1 0
+
+Send packet with vlan0/1 and check packet received
+
+Rerun with step5-6 with random vlan and max vlan 4095
+
+Remove vlan on VF0::
+
+     rx_vlan rm 1 0
+
+Send packet with vlan 0 and check packet received
+
+Send packet without vlan and check packet received
+
+Send packet with vlan 1
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded.
+
+Test case: VF RSS
+=================
+
+Start command with multi-queues like below::
+
+   ./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i --txq=4 --rxq=4
+
+Show RSS RETA configuration::
+
+    testpmd> show port 0 rss reta 64 (0xffffffffffffffff)
+
+    RSS RETA configuration: hash index=0, queue=0
+    RSS RETA configuration: hash index=1, queue=1
+    RSS RETA configuration: hash index=2, queue=2
+    RSS RETA configuration: hash index=3, queue=3
+    ...
+    RSS RETA configuration: hash index=60, queue=0
+    RSS RETA configuration: hash index=61, queue=1
+    RSS RETA configuration: hash index=62, queue=2
+    RSS RETA configuration: hash index=63, queue=3
+
+Config hash reta table::
+
+    testpmd> port config 0 rss reta (0,3)
+    testpmd> port config 0 rss reta (1,2)
+    testpmd> port config 0 rss reta (2,1)
+    testpmd> port config 0 rss reta (3,0)
+
+Check RSS RETA configuration has changed::
+
+    testpmd> show port 0 rss reta 64 (0xffffffffffffffff)
+
+    RSS RETA configuration: hash index=0, queue=3
+    RSS RETA configuration: hash index=1, queue=2
+    RSS RETA configuration: hash index=2, queue=2
+    RSS RETA configuration: hash index=3, queue=1
+
+Enable IP/TCP/UDP RSS::
+
+  testpmd> port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)
+
+Send different flow types' IP/TCP/UDP packets to VF port, check packets are
+received by different configured queues.
+
+Test case: VF RSS hash key
+==========================
+
+Start command with multi-queues like below::
+
+   ./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i --txq=4 --rxq=4
+
+Show port rss hash key::
+
+    testpmd> show port 0 rss-hash key
+
+Set rxonly fwd, enable print, start testpmd::
+
+    testpmd> set fwd rxonly
+    testpmd> set verbose 1
+    testpmd> start
+
+Send ipv4 packets, mark the RSS hash value::
+
+    p=Ether(dst="56:0A:EC:50:A4:28")/IP(src="1.2.3.4")/Raw(load='X'*30)
+
+Update ipv4 different hash key::
+
+    testpmd> port config 0 rss-hash-key ipv4 1b9d58a4b961d9cd1c56ad1621c3ad51632c16a5d16c21c3513d132c135d132c13ad1531c23a51d6ac49879c499d798a7d949c8a
+
+Show port rss hash key, check the key is same to configured key::
+
+    testpmd> show port 0 rss-hash key
+    RSS functions:
+     all ipv4 ipv6 ip
+    RSS key:
+    1B9D58A4B961D9CD1C56AD1621C3AD51632C16A5D16C21C3513D132C135D132C13AD1531C23A51D6AC49879C499D798A7D949C8A
+
+Send ipv4 packets, check RSS hash value is different::
+
+    p=Ether(dst="56:0A:EC:50:A4:28")/IP(src="1.2.3.4")/Raw(load='X'*30)
+
+Test case: test rxq txq number inconsistent
+===========================================
+
+Start the testpmd with rxq not equal to txq::
+
+    ./<build_target>/app/dpdk-testpmd -l 1-9 -n 2 -- -i --rxq=4 --txq=8
+
+.. note::
+     queue pairs in number of 1, 2, 4, 8, 16, 32, 64, etc.
+     For vf of ixgbe, the maximum number of rxq and txq supported is 4.
+
+Set rxonly fwd, enable print, start testpmd::
+
+    testpmd> set fwd rxonly
+    testpmd> set verbose 1
+    testpmd> start
+
+Send different hash types' packets with different keywords, then check rx port
+    could receive packets by different queues::
+
+      sendp([Ether(dst="00:01:23:45:67:89")/IP(src="192.168.0.4", dst=RandIP())], iface="eth3")
+
+Check the total Rx packets in all the RxQ should be equal to the total HW Rx packets::
+
+    testpmd> show fwd stats all
+    ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 0/Queue= 0 -------
+    RX-packets: 252            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 1 -> TX Port= 0/Queue= 1 -------
+    RX-packets: 257            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 2 -> TX Port= 0/Queue= 2 -------
+    RX-packets: 259            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 3 -> TX Port= 0/Queue= 3 -------
+    RX-packets: 256            TX-packets: 0              TX-dropped: 0
+
+    ---------------------- Forward statistics for port 0  ----------------------
+    RX-packets: 1024           RX-dropped: 0             RX-total: 1024
+    TX-packets: 0              TX-dropped: 0             TX-total: 0
+    ----------------------------------------------------------------------------
+
+    +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+    RX-packets: 1024           RX-dropped: 0             RX-total: 1024
+    TX-packets: 0              TX-dropped: 0             TX-total: 0
+    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Test case: VF port stop/start
+=============================
+
+Stop VF port::
+
+    testpmd> port stop all
+
+Start VF port::
+
+    testpmd> port start all
+
+Repeat above stop and start port for 10 times
+
+Send packets from tester
+
+Check VF could receive packets
+
+Test case: VF statistics reset
+==============================
+
+Check VF port stats::
+
+    testpmd> show port stats all
+
+Clear VF port stats::
+
+    testpmd> clear port stats all
+
+Check VF port stats, RX-packets and TX-packets are 0
+
+Set mac forward, enable print out
+
+Send 100 packets from tester
+
+Check VF port stats, RX-packets and TX-packets are 100
+
+Clear VF port stats
+
+Check VF port stats, RX-packets and TX-packets are 0
+
+Test case: VF information
+=========================
+
+Start testpmd
+
+Show VF port information, check link, speed...information correctness::
+
+    testpmd> show port info all
+
+Set mac forward, enable print out
+
+Send 100 packets from tester
+
+Check VF port stats, RX-packets and TX-packets are 100
+
+Test case: VF xstats check
+==========================
+
+Launch testpmd and enable rss::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c f -n 4 -- -i --rxq=4 --txq=4 --max-pkt-len=9000
+    testpmd> port config all rss all
+    testpmd> set fwd mac
+
+.. Note::
+
+   8259x family VF device jumbo frame size setting shared with PF device.
+   ifconfig PF_intf mtu 3000
+
+show the xstats before packet forwarding, all the value are 0.
+
+Start forward and send 100 packets with random src IP address,
+   then stop forward.
+
+Check stats and xstats::
+
+    testpmd> stop
+
+    testpmd> show port stats all
+
+    testpmd> show port xstats all
+
+verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 100.
+rx_good_bytes, RX-bytes of port 0 and tx_good_bytes, TX-bytes of port 1 are the same.
+Intel® Ethernet 700 Series does not support hardware per queue stats,
+so rx_qx_packets and rx_qx_bytes are both 0.
+tx_qx_packets and tx_qx_bytes are both 0 too.
+
+Clear stats::
+
+      testpmd> clear port stats all
+
+Check stats and xstats, verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 0.
+
+Repeat above 4 and 5 steps.
+
+Clear xstats::
+
+    testpmd> clear port xstats all
+
+Check stats and xstats, verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 0.
+
+Test case: IAVF DUAL VLAN filtering
+===================================
+
+enable vlan filtering on port VF::
+
+    testpmd> set fwd mac
+    Set mac packet forwarding mode
+    testpmd> vlan set filter on 0
+
+check the vlan mode is set successfully::
+
+    testpmd> show port info 0
+
+    ********************* Infos for port 0  *********************
+    ......
+    VLAN offload:
+    strip off, filter on, extend off, qinq strip off
+
+tester send qinq pkt and single vlan pkt which outer vlan id is 1 to VF::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=1,type=0x8100,prio=1)/Dot1Q(vlan=2,type=0x0800,prio=2)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+check the pkts can't be received in VF, but if the kernel cannot set ``vf-vlan-pruning`` or kdriver is ixgbe, check can receive 2 pkts in VF.
+
+add rx_vlan in VF::
+
+    testpmd> rx_vlan add 1 0
+
+repeat step 3, check the pkts can be received by VF and fwd to tester::
+
+    check the pkts can be received by PF and fwd to tester with inner and outer correct vlan ID and priority value.
+    testpmd> port 0/queue 0: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=522 - nb_segs=1 - hw ptype: L2_ETHER  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN  - l2_len=18 - inner_l2_len=4 - Receive queue=0x0
+    ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+    port 0/queue 0: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - hw ptype: L2_ETHER  - sw ptype: L2_ETHER_VLAN  - l2_len=18 - Receive queue=0x0
+    ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    tcpdump -i ens786f0 -nn -e -v
+
+    16:50:38.807158 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 1, ethertype 802.1Q, vlan 2, p 2, ethertype 0x0800,
+    16:50:38.807217 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 1, ethertype 802.1Q, vlan 2, p 2, ethertype 0x0800,
+
+    16:51:06.083084 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype 0x0800,
+    16:51:06.083127 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype 0x0800,
+
+tester send qinq pkt and single vlan pkt which outer vlan id is 11 to VF::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=11,type=0x8100,prio=1)/Dot1Q(vlan=2,type=0x0800,prio=2)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+check the pkts can not be received by VF.
+
+remove rx_vlan in VF1::
+
+    testpmd> rx_vlan rm 1 0
+
+repeat step 3, check the pkts can not be received by VF, but if the kernel cannot set ``vf-vlan-pruning``, check can receive 2 pkts in VF.
+
+Test case: IAVF DUAL VLAN header stripping
+==========================================
+
+enable vlan filtering on port VF::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 1 0
+
+check the vlan mode is set successfully::
+
+    testpmd> show port info 0
+
+    ********************* Infos for port 0  *********************
+    ......
+    VLAN offload:
+    strip off, filter on, extend off, qinq strip off
+
+enable vlan header stripping on VF::
+
+    testpmd> vlan set strip on 0
+
+check the vlan mode is set successfully::
+
+    testpmd> show port info 0
+
+    ********************* Infos for port 0  *********************
+    ......
+    VLAN offload:
+    strip on, filter on, extend off, qinq strip off
+
+tester send qinq pkt and single vlan pkt which outer vlan id is 1 to VF::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=1,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+check the pkts can be received in VF and fwd to tester without outer vlan header::
+
+    testpmd> port 0/queue 10: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0xc7b627aa - RSS queue=0xa - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0xa
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    port 0/queue 10: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0xc7b627aa - RSS queue=0xa - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0xa
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    10:12:38.034948 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    10:12:38.035025 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+    10:12:44.806825 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    10:12:44.806865 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 514: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+disable vlan header stripping on VF1::
+
+    testpmd> vlan set strip off 0
+
+check the vlan mode is set successfully::
+
+    testpmd> show port info 0
+
+    ********************* Infos for port 0  *********************
+    ......
+    VLAN offload:
+    strip off, filter on, extend off, qinq strip off
+
+repeat step 5, check the pkts can be received in VF and fwd to tester with outer vlan header::
+
+    testpmd> port 0/queue 10: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=522 - nb_segs=1 - RSS hash=0xc7b627aa - RSS queue=0xa - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN INNER_L3_IPV4  - l2_len=18 - inner_l2_len=4 - inner_l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0xa
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    port 0/queue 10: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0xc7b627aa - RSS queue=0xa - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0xa
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    09:49:08.295172 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    09:49:08.295239 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+    09:49:41.043101 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    09:49:41.043166 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+Test case: IAVF DUAL VLAN header insertion
+==========================================
+
+.. note::
+
+   according to dpdk commit d048a0aaae27809523969904c2f7b71fe3cc1bb6,
+   when the ice driver version newer than 1.8.9, avx512 tx path not support insert correct vlag tag(outer of QinQ)
+
+enable vlan filtering on port VF::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 11 0
+
+set up test environment again::
+
+    echo 1 > /sys/bus/pci/devices/0000:18:00.0/sriov_numvfs
+    ip link set ens785f0 vf 0 mac 00:11:22:33:44:11
+    ip link set dev ens785f0 vf 0 spoofchk off
+    ./usertools/dpdk-devbind.py -b vfio-pci 0000:18:01.0
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:18:01.0 -- -i --rxq=16 --txq=16
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+
+enable vlan header insertion on VF::
+
+    testpmd> port stop 0
+    Stopping ports...
+    Checking link statuses...
+    Done
+    testpmd> tx_vlan set 0 1
+    testpmd> port start 0
+
+tester send pkt to VF::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=11,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+check the pkts with vlan header can be received in tester::
+
+    testpmd> port 0/queue 13: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0xcaf4abfd - RSS queue=0xd - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0xd
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    port 0/queue 8: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0x28099b78 - RSS queue=0x8 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Receive queue=0x8
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    10:32:55.566801 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype IPv4 (0x0800), length 514: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    10:32:55.566856 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 1, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+    06:29:32.281896 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 518: vlan 11, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    06:29:32.281940 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 11, p 0, ethertype 802.1Q, vlan 1, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+disable vlan header insertion on VF1::
+
+    testpmd> port stop 0
+    Stopping ports...
+    Checking link statuses...
+    Done
+    testpmd> tx_vlan reset 0
+    testpmd> port start 0
+
+repeat step 4, check the pkts without vlan tag can be received in tester::
+
+    testpmd> port 0/queue 9: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0xa63e8869 - RSS queue=0x9 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0x9
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    port 0/queue 12: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0x6f5533bc - RSS queue=0xc - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Receive queue=0xc
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    10:34:40.070754 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype IPv4 (0x0800), length 514: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    10:34:40.070824 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype IPv4 (0x0800), length 514: (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+    06:36:57.641871 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 518: vlan 11, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    06:36:57.641909 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 11, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+
+Test case: Enable/disable AVF CRC stripping
+===========================================
+
+start testpmd with "--disable-crc-strip"::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 20-23 -n 4 -a 0000:18:01.0 -- -i --rxq=16 --txq=16 --disable-crc-strip
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+
+send pkts to VF::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+check VF1 receive this pkts with CRC::
+
+    testpmd> port 0/queue 0: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0x890d9a70 - RSS queue=0x0 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0x0
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  518
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  514
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+    clear port stats all
+
+enable crc strip in testpmd::
+
+    testpmd> stop
+    testpmd> port stop 0
+    testpmd> port config 0 rx_offload keep_crc off
+    testpmd> port start 0
+    testpmd> start
+
+repeat step 2, check VF receive this pkts without CRC::
+
+    testpmd> port 0/queue 2: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0xa94c21d2 - RSS queue=0x2 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0x2
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  514
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  514
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+    clear port stats all
+
+disable crc strip in testpmd::
+
+    testpmd> stop
+    testpmd> port stop 0
+    testpmd> port config 0 rx_offload keep_crc on
+    testpmd> port start 0
+    testpmd> start
+
+repeat step 2, check VF1 receive this pkts with CRC::
+
+    testpmd> port 0/queue 0: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0x79c10190 - RSS queue=0x0 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0x0
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  518
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  514
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+    clear port stats all
+
+re-launch testpmd without "--disable-crc-strip"::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 20-23 -n 4 -a 0000:18:01.0 -- -i --rxq=16 --txq=16
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+
+repeat step 2, check VF receive this pkts without CRC::
+
+    testpmd> port 0/queue 2: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=514 - nb_segs=1 - RSS hash=0x898ada82 - RSS queue=0x2 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER L3_IPV4  - l2_len=14 - l3_len=20 - Receive queue=0x2
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  514
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  514
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+
+
+Test case: IAVF CRC strip and Vlan strip co-exists
+==================================================
+
+start testpmd with crc strip enable, vlan strip disable::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 20-23 -n 4 -a 0000:18:01.0 -- -i --rxq=16 --txq=16
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+    testpmd> show port info 0
+    ********************* Infos for port 0  *********************
+    MAC address: 00:11:22:33:44:11
+    Device name: 0000:18:01.1
+    Driver name: net_iavf
+    ......
+    VLAN offload:
+      strip off, filter off, extend off, qinq strip off
+
+request disable vlan strip::
+
+    testpmd> vlan set strip off 0
+
+check the vlan strip still disable::
+
+    testpmd> show port info 0
+    ********************* Infos for port 0  *********************
+    MAC address: 00:11:22:33:44:11
+    Device name: 0000:18:01.1
+    Driver name: net_iavf
+    ......
+    VLAN offload:
+      strip off, filter off, extend off, qinq strip off
+
+set vlan filter on and add rx_vlan 1::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 1 0
+    testpmd> start
+
+send qinq pkts to check vlan strip is off, crc strip is on::
+
+    sendp([Ether(dst="00:11:22:33:44:11",type=0x8100)/Dot1Q(vlan=1,type=0x8100)/Dot1Q(vlan=2,type=0x0800)/IP(src="196.222.232.221")/("X"*480)], iface="ens786f0")
+
+    testpmd> port 0/queue 6: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=522 - nb_segs=1 - RSS hash=0xf6521426 - RSS queue=0x6 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN INNER_L3_IPV4  - l2_len=18 - inner_l2_len=4 - inner_l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0x6
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  522
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  522
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+
+    09:07:45.863251 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    09:07:45.863340 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+request enable vlan strip::
+
+    testpmd> vlan set strip on 0
+
+check the vlan strip enable successfully::
+
+    testpmd> show port info 0
+    ********************* Infos for port 0  *********************
+    MAC address: 00:11:22:33:44:11
+    Device name: 0000:18:01.1
+    Driver name: net_iavf
+    ......
+    VLAN offload:
+      strip on, filter off, extend off, qinq strip off
+
+repeat step 5, send qinq pkts to check vlan strip is on(tx-4), crc strip is on::
+
+    testpmd> port 0/queue 6: received 1 packets
+    src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0xf6521426 - RSS queue=0x6 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Tail/CRC: 0x58585858/0x00000000 - Receive queue=0x6
+    ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+    show port stats all
+
+    ######################## NIC statistics for port 0  ########################
+    RX-packets: 1          RX-missed: 0          RX-bytes:  522
+    RX-errors: 0
+    RX-nombuf:  0
+    TX-packets: 1          TX-errors: 0          TX-bytes:  518
+
+    Throughput (since last show)
+    Rx-pps:            0          Rx-bps:            0
+    Tx-pps:            0          Tx-bps:            0
+    ############################################################################
+
+    11:09:03.918907 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+    11:09:03.918952 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 518: vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+    196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+request disable vlan strip::
+
+    testpmd> vlan set strip off 0
+
+check the vlan strip disable successfully::
+
+     testpmd> show port info 0
+     ********************* Infos for port 0  *********************
+     MAC address: 00:11:22:33:44:11
+     Device name: 0000:18:01.1
+     Driver name: net_iavf
+     ......
+     VLAN offload:
+       strip off, filter on, extend off, qinq strip off
+
+request disable crc strip::
+
+     testpmd> stop
+     testpmd> port stop 0
+     testpmd> port config 0 rx_offload keep_crc on
+     testpmd> port start 0
+     testpmd> start
+
+repeat step 5, send qinq pkts to check vlan strip is off, crc strip is off(rx+4)::
+
+     testpmd> port 0/queue 7: received 1 packets
+     src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=522 - nb_segs=1 - RSS hash=0xbc8b1857 - RSS queue=0x7 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN INNER_L3_IPV4  - l2_len=18 - inner_l2_len=4 - inner_l3_len=20 - Tail/CRC: 0x58585858/0x6d870bf6 - Receive queue=0x7
+     ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+     show port stats all
+     ######################## NIC statistics for port 0  ########################
+     RX-packets: 1          RX-missed: 0          RX-bytes:  526
+     RX-errors: 0
+     RX-nombuf:  0
+     TX-packets: 1          TX-errors: 0          TX-bytes:  522
+
+     Throughput (since last show)
+     Rx-pps:            0          Rx-bps:            0
+     Tx-pps:            0          Tx-bps:            0
+     ############################################################################
+
+     10:23:57.350934 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+     10:23:57.351008 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+request enable vlan strip::
+
+     testpmd> vlan set strip on 0
+     iavf_execute_vf_cmd(): No response or return failure (-64) for cmd 54
+     iavf_config_vlan_strip_v2(): fail to execute command VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2
+     rx_vlan_strip_set(port_pi=0, on=1) failed diag=-5
+
+repeat step 5, send qinq pkts to check the vlan strip can not enable::
+
+     testpmd> port 0/queue 7: received 1 packets
+     src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=518 - nb_segs=1 - RSS hash=0xbc8b1857 - RSS queue=0x7 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN L3_IPV4  - l2_len=18 - l3_len=20 - Tail/CRC: 0x58585858/0x6d870bf6 - Receive queue=0x7
+     ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+     show port stats all
+     ######################## NIC statistics for port 0  ########################
+     RX-packets: 1          RX-missed: 0          RX-bytes:  526
+     RX-errors: 0
+     RX-nombuf:  0
+     TX-packets: 1          TX-errors: 0          TX-bytes:  522
+
+     Throughput (since last show)
+     Rx-pps:            0          Rx-bps:            0
+     Tx-pps:            0          Tx-bps:            0
+     ############################################################################
+
+     10:26:08.346936 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+     10:26:08.347006 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+request disable vlan strip::
+
+     vlan set strip off 0
+
+check the vlan strip still disable::
+
+     testpmd> show port info 0
+     ********************* Infos for port 0  *********************
+     MAC address: 00:11:22:33:44:11
+     Device name: 0000:18:01.1
+     Driver name: net_iavf
+     ......
+     VLAN offload:
+       strip off, filter on, extend off, qinq strip off
+
+request enable crc strip::
+
+     testpmd> stop
+     testpmd> port stop 0
+     testpmd> port config 0 rx_offload keep_crc off
+     testpmd> port start 0
+     testpmd> start
+
+repeat step 5, send qinq pkts to check the crc strip enable successfully::
+
+     testpmd> port 0/queue 3: received 1 packets
+     src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x8100 - length=522 - nb_segs=1 - RSS hash=0x2b4ad203 - RSS queue=0x3 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN INNER_L3_IPV4  - l2_len=18 - inner_l2_len=4 - inner_l3_len=20 - Receive queue=0x3
+     ol_flags: PKT_RX_RSS_HASH PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+     port 0/queue 3: sent 1 packets
+     src=00:11:22:33:44:11 - dst=02:00:00:00:00:00 - type=0x8100 - length=522 - nb_segs=1 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_NONFRAG  - sw ptype: L2_ETHER_VLAN INNER_L2_ETHER_VLAN INNER_L3_IPV4  - l2_len=18 - inner_l2_len=4 - inner_l3_len=20 - Send queue=0x3
+     ol_flags: PKT_RX_L4_CKSUM_UNKNOWN PKT_RX_IP_CKSUM_UNKNOWN PKT_RX_OUTER_L4_CKSUM_UNKNOWN
+
+     show port stats all
+     ######################## NIC statistics for port 0  ########################
+     RX-packets: 1          RX-missed: 0          RX-bytes:  522
+     RX-errors: 0
+     RX-nombuf:  0
+     TX-packets: 1          TX-errors: 0          TX-bytes:  522
+
+     Throughput (since last show)
+     Rx-pps:            0          Rx-bps:            0
+     Tx-pps:            0          Tx-bps:            0
+     ############################################################################
+
+     10:29:19.995352 00:00:00:00:00:00 > 00:11:22:33:44:11, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+     10:29:19.995424 00:11:22:33:44:11 > 02:00:00:00:00:00, ethertype 802.1Q (0x8100), length 522: vlan 1, p 0, ethertype 802.1Q, vlan 2, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 1, offset 0, flags [none], proto Options (0), length 500)
+     196.222.232.221 > 127.0.0.1:  ip-proto-0 480
+
+Test Case: vf queue start/stop
+==============================
+
+This case support VF (Intel® Ethernet 700 Series/Intel® Ethernet 800 Series)
+
+Launch testpmd::
+
+    x86_64-native-linuxapp-gcc/app/dpdk-testpmd  -l 1-2 -n 4 -a 0000:af:01.0 -- -i --portmask=0x1 --port-topology=loop
+
+Run "set verbose 1" to set verbose
+
+Run "set fwd mac" to set fwd type
+
+Run "start" to start fwd package
+
+Start a packet capture on the tester in the background::
+
+    tcpdump -i ens7  'ether[12:2] != 0x88cc'  -Q in -w /tmp/tester/sniff_ens7.pcap
+
+Start packet generator to transmit packets::
+
+    sendp([Ether(dst='3c:fd:fe:c1:0f:4c', src='00:00:20:00:00:00')/IP()/UDP()/Raw(load=b'XXXXXXXXXXXXXXXXXX')],iface="ens7",count=4,inter=0,verbose=False)
+
+Stop testpmd::
+
+  ---------------------- Forward statistics for port 0  ----------------------
+  RX-packets: 4              RX-dropped: 0             RX-total: 4
+  TX-packets: 0              TX-dropped: 0             TX-total: 0
+  ----------------------------------------------------------------------------
+
+  ---------------------- Forward statistics for port 1  ----------------------
+  RX-packets: 0              RX-dropped: 0             RX-total: 0
+  TX-packets: 4              TX-dropped: 0             TX-total: 4
+  ----------------------------------------------------------------------------
+
+
+Quit tcpdump and check tester port receive 4 packets
+
+Run "port 0 rxq 0 stop" to stop rxq 0 in port 0
+
+Start packet generator to transmit and check tester port not receive packets
+
+Run "port 0 rxq 0 start" to start rxq 0 in port 0
+
+Run "port 0 txq 0 stop" to stop txq 0 in port 0
+
+Start packet generator to transmit and check tester port not receive packets and in testpmd it not has "port 0/queue
+0: received 1 packets" print
+
+Stop testpmd::
+
+  ---------------------- Forward statistics for port 0  ----------------------
+  RX-packets: 4              RX-dropped: 0             RX-total: 4
+  TX-packets: 0              TX-dropped: 0             TX-total: 0
+  ----------------------------------------------------------------------------
+
+  ---------------------- Forward statistics for port 1  ----------------------
+  RX-packets: 0              RX-dropped: 0             RX-total: 0
+  TX-packets: 0              TX-dropped: 0             TX-total: 0
+  ----------------------------------------------------------------------------
+
+Run "port 0 txq 0 start" to start txq 0 in port 0
+
+Start packet generator to transmit and check tester port receive 4 packets and in testpmd it has "port 0/queue 0:
+received 1 packets" print
+
+Stop testpmd::
+
+  ---------------------- Forward statistics for port 0  ----------------------
+  RX-packets: 4              RX-dropped: 0             RX-total: 4
+  TX-packets: 0              TX-dropped: 0             TX-total: 0
+  ----------------------------------------------------------------------------
+
+  ---------------------- Forward statistics for port 1  ----------------------
+  RX-packets: 0              RX-dropped: 0             RX-total: 0
+  TX-packets: 4              TX-dropped: 0             TX-total: 4
+  ----------------------------------------------------------------------------
+
-- 
2.25.1


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

* [dts][PATCH V1 4/6] tests/ice_kernelpf_dcf:add new suite to cover dcf pmd function
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
                   ` (2 preceding siblings ...)
  2023-06-08 18:27 ` [dst][PATCH V1 3/6] test_plans/kernelpf_vf_test_plan:add new plan " Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-08 18:27 ` [dst][PATCH V1 5/6] test_plans/ice_kernelpf_dcf_test_plan:add new plan to cover the most of " Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 6/6] conf/*:add config file for new suites Zhimin Huang
  5 siblings, 0 replies; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

add new test suite to test dcf pmd function, and use func_test_base to
refactor test cases.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/TestSuite_ice_kernelpf_dcf.py | 732 ++++++++++++++++++++++++++++
 1 file changed, 732 insertions(+)
 create mode 100644 tests/TestSuite_ice_kernelpf_dcf.py

diff --git a/tests/TestSuite_ice_kernelpf_dcf.py b/tests/TestSuite_ice_kernelpf_dcf.py
new file mode 100644
index 00000000..d248baaa
--- /dev/null
+++ b/tests/TestSuite_ice_kernelpf_dcf.py
@@ -0,0 +1,732 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+#
+
+import random
+
+from framework.exception import VerifyFailure
+from framework.settings import ETH_800_SERIES
+from framework.test_case import TestCase, check_supported_nic
+
+from .func_test_base import *
+
+VF_MAC_ADDR = "00:01:23:45:67:89"
+VF_WRONG_MAC_ADDR = "00:01:23:45:67:99"
+MULTICAST_MAC_ADDR = "01:80:C2:00:00:08"
+BROADCAST_MAC_ADDR = "FF:FF:FF:FF:FF:FF"
+
+MAX_VLAN_ID = 4095
+RANDOM_VLAN_ID = random.randint(2, MAX_VLAN_ID)
+OUTER_VLAN_ID = 1
+INNTER_VLAN_ID = 2
+
+MATCHED_VLAN_PKT = FuncTestBase.generate_using_packets(
+    pkt_type="VLAN_UDP", vlan_id=RANDOM_VLAN_ID, dst_mac=VF_MAC_ADDR
+)
+UNMATCHED_VLAN_PKT = FuncTestBase.generate_using_packets(
+    pkt_type="VLAN_UDP", vlan_id=RANDOM_VLAN_ID - 1, dst_mac=VF_MAC_ADDR
+)
+
+
+class TestIceKernelpfDcf(TestCase):
+    @check_supported_nic(ETH_800_SERIES)
+    def set_up_all(self):
+        self.dut_port = self.dut.get_ports(self.nic)
+        self.used_dut_tx_port = self.dut_port[0]
+        self.used_dut_rx_port = self.dut_port[1]
+        self.port_obj = [self.dut.ports_info[port]["port"] for port in self.dut_port]
+        self.tester_tx_interface = self.tester.get_interface(
+            self.tester.get_local_port(self.used_dut_tx_port)
+        )
+        self.tester_rx_interface = self.tester.get_interface(
+            self.tester.get_local_port(self.used_dut_rx_port)
+        )
+        self.rxtx_base = RxTxBaseTest(
+            self, self.tester_tx_interface, self.tester_rx_interface
+        )
+        self.vlan_func = VlanFuncBaseTest(
+            self, self.tester_tx_interface, self.tester_rx_interface
+        )
+        self.rxtx_base.check_port_num_for_test(2)
+        self.setup_env_configuration()
+
+    def set_up(self):
+        pass
+
+    def pf_config(self):
+        self.flag = "vf-vlan-pruning"
+        self.dut.bind_interfaces_linux(self.kdriver)
+        self.default_stats = self.dut.get_priv_flags_state(
+            self.port_obj[self.used_dut_tx_port].get_interface_name(), self.flag
+        )
+        if not self.default_stats:
+            self.logger.warning(
+                f"{self.kdriver + '_' + self.nic_obj.driver_version} driver does not have vf-vlan-pruning flag."
+            )
+        else:
+            self.dut.send_expect(
+                "ethtool --set-priv-flags %s %s on"
+                % (
+                    self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                    self.flag,
+                ),
+                "# ",
+            )
+            self.dut.send_expect(
+                "ethtool --set-priv-flags %s %s on"
+                % (
+                    self.port_obj[self.used_dut_rx_port].get_interface_name(),
+                    self.flag,
+                ),
+                "# ",
+            )
+
+    def vf_config(self):
+        self.orig_vf_mac = self.rxtx_base.get_vf_mac_through_pf(
+            self.port_obj[self.used_dut_tx_port].get_interface_name()
+        )
+        self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(mac=VF_MAC_ADDR)
+        self.dut.send_expect(
+            "ip link set %s vf 0 spoofchk off"
+            % (self.port_obj[self.used_dut_tx_port].get_interface_name()),
+            "# ",
+        )
+        self.dut.send_expect(
+            "ip link set %s vf 0 trust on"
+            % (self.port_obj[self.used_dut_tx_port].get_interface_name()),
+            "# ",
+        )
+        self.dut.send_expect(
+            "ip link set %s vf 0 spoofchk off"
+            % (self.port_obj[self.used_dut_rx_port].get_interface_name()),
+            "# ",
+        )
+        self.dut.send_expect(
+            "ip link set %s vf 0 trust on"
+            % (self.port_obj[self.used_dut_rx_port].get_interface_name()),
+            "# ",
+        )
+
+    def setup_env_configuration(self):
+        self.vm_obj, self.vm_dut = self.rxtx_base.vf_test_preset_env_vm(
+            pf_port=[self.used_dut_tx_port, self.used_dut_rx_port],
+            vfs_num=1,
+            vm_name="vm0",
+        )
+        self.vm_pci = [
+            self.vm_obj.pci_maps[i]["guestpci"]
+            for i in range(len(self.vm_obj.pci_maps))
+        ]
+        self.rxtx_base.init_pmd_session(self.vm_dut)
+        self.vlan_func.init_pmd_session(self.vm_dut)
+
+    def test_dcf_basic_rxtx(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_rx_check(packets_num=100, packet_dst_mac=VF_MAC_ADDR)
+        self.rxtx_base.basic_tx_check()
+
+    def test_dcf_promisc_mode(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_promisc_check(
+            match_mac=VF_MAC_ADDR, unmatch_mac=VF_WRONG_MAC_ADDR
+        )
+
+    def test_dcf_multicast(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_multicast_check(
+            normal_mac=VF_MAC_ADDR, multicast_mac=MULTICAST_MAC_ADDR
+        )
+
+    def test_dcf_broadcast(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_rx_check(packets_num=1, packet_dst_mac=BROADCAST_MAC_ADDR)
+
+    def test_dcf_queue_start_stop(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=4, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=4
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 0 rxq 0 stop", "start"],
+        )
+        self.verify(
+            len(packets_captured) == 0
+            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
+            "receive packet num is not match",
+        )
+        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
+            packets=self.rxtx_base.generate_random_packets(
+                dstmac=VF_MAC_ADDR, pktnum=4
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 0 rxq 0 start", "port 1 txq 0 stop", "start"],
+        )
+        self.verify(
+            len(packets_captured) == 0
+            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
+            "receive packet num is not match",
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=4,
+            dst_mac=VF_MAC_ADDR,
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=["stop", "port 1 txq 0 start", "start"],
+        )
+
+    def test_dcf_rss(self):
+        rss_type = ["ip", "tcp", "udp"]
+        rss_reta = [3, 2, 1, 0] * 16
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            param="--rxq=4 --txq=4",
+        )
+        self.rxtx_base.rss_reta_config_check(rss_reta)
+        for _rss in rss_type:
+            hash_table = self.rxtx_base.basic_rss_check(
+                dst_mac=VF_MAC_ADDR, rss_type=_rss, queue_num=4
+            )
+            self.rxtx_base.rss_reta_hit_check(hash_table, rss_reta)
+            self.rxtx_base.execute_pmd_cmd("stop")
+
+    def test_dcf_rss_hash_key(self):
+        update_hash_key = "1b9d58a4b961d9cd1c56ad1621c3ad51632c16a5d16c21c3513d132c135d132c13ad1531c23a51d6ac49879c499d798a7d949c8a"
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            param="--rxq=4 --txq=4",
+        )
+        self.rxtx_base.basic_rss_hash_key_check(
+            dst_mac=VF_MAC_ADDR, hash_key=update_hash_key
+        )
+
+    def test_dcf_rss_rxq_txq_inconsistent(self):
+        params = [
+            "--rxq=4 --txq=8",
+            "--rxq=6 --txq=8",
+            "--rxq=3 --txq=9",
+            "--rxq=4 --txq=16",
+        ]
+        if self.kdriver == "ixgbe":
+            params = [
+                "--rxq=2 --txq=4",
+                "--rxq=1 --txq=2",
+            ]
+        for param in params:
+            try:
+                queue_num = re.search(r"--rxq=(\d+)", param).group(1)
+                self.rxtx_base.launch_testpmd(
+                    ports=self.vm_pci,
+                    port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+                    param=param,
+                )
+                self.rxtx_base.basic_rss_check(
+                    dst_mac=VF_MAC_ADDR, rss_type="ip", queue_num=queue_num
+                )
+            except Exception as e:
+                raise VerifyFailure(e)
+            finally:
+                self.rxtx_base.pmd_session.quit()
+
+    def test_dcf_port_start_stop(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        for i in range(10):
+            self.rxtx_base.execute_pmd_cmd("port stop all")
+            self.rxtx_base.execute_pmd_cmd("port start all")
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_dcf_statistic_reset(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        out = self.rxtx_base.execute_pmd_cmd("show port stats all")
+        self.verify(
+            "RX-packets: 0" in out and "TX-packets: 0" in out,
+            "receive some misc packet",
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+        self.rxtx_base.execute_pmd_cmd("clear port stats all")
+        out = self.rxtx_base.execute_pmd_cmd("show port stats all")
+        self.verify(
+            "RX-packets: 0" in out and "TX-packets: 0" in out,
+            "clear port stats fail",
+        )
+
+    def test_dcf_information(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_pmd_info_check(self.port_obj[0])
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=100, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_dcf_xstats_check(self):
+        try:
+            self.tester.send_expect(
+                "ifconfig {} mtu {}".format(self.tester_tx_interface, 3000), "# "
+            )
+            if self.kdriver == "ixgbe":
+                self.rxtx_base.execute_host_cmd(
+                    "ifconfig {} mtu 3000".format(
+                        self.port_obj[self.used_dut_tx_port].get_interface_name()
+                    )
+                )
+            self.rxtx_base.launch_testpmd(
+                ports=self.vm_pci,
+                port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+                param="--rxq=4 --txq=4 --max-pkt-len=9000",
+            )
+            for _payload_size in [64, 128, 256, 512, 1024, 1523]:
+
+                stats_table, xstats_table = self.rxtx_base.basic_xstats_check(
+                    packet_num=100,
+                    dst_mac=VF_MAC_ADDR,
+                    rx_port=self.used_dut_rx_port,
+                    payload_size=_payload_size,
+                )
+                self.verify(
+                    xstats_table[self.used_dut_tx_port]["rx_good_packets"]
+                    == stats_table[self.used_dut_tx_port]["RX-packets"]
+                    == xstats_table[self.used_dut_rx_port]["tx_good_packets"]
+                    == stats_table[self.used_dut_rx_port]["TX-packets"]
+                    == 100,
+                    "pkt recieve or transport count error!",
+                )
+                self.verify(
+                    xstats_table[self.used_dut_tx_port]["rx_good_bytes"]
+                    == stats_table[self.used_dut_tx_port]["RX-bytes"]
+                    == xstats_table[self.used_dut_rx_port]["tx_good_bytes"]
+                    == stats_table[self.used_dut_rx_port]["TX-bytes"],
+                    "pkt recieve or transport bytes error!",
+                )
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.tester.send_expect(
+                "ifconfig {} mtu {}".format(self.tester_tx_interface, 1500), "# "
+            )
+            if self.kdriver == "ixgbe":
+                self.rxtx_base.execute_host_cmd(
+                    "ifconfig {} mtu 1500".format(
+                        self.port_obj[self.used_dut_tx_port].get_interface_name()
+                    )
+                )
+
+    def test_dcf_unicast(self):
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=10,
+            dst_mac=VF_WRONG_MAC_ADDR,
+            check_miss=True,
+            pmd_commands=[
+                "set promisc all off",
+                "set allmulti all off",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+        self.rxtx_base.basic_macfwd_check(
+            packet_num=10, dst_mac=VF_MAC_ADDR, rx_port=self.used_dut_rx_port
+        )
+
+    def test_dcf_mac_add_filter(self):
+        try:
+            self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(
+                mac=self.orig_vf_mac[0]
+            )
+            self.rxtx_base.launch_testpmd(
+                ports=self.vm_pci,
+                port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            )
+            default_vf_mac = self.rxtx_base.get_vf_mac_through_pf(
+                self.port_obj[self.used_dut_tx_port].get_interface_name()
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=[
+                    "port stop all",
+                    "port config all crc-strip on",
+                    "port start all",
+                    "set promisc all off",
+                    "mac_addr add 0 {}".format(VF_MAC_ADDR),
+                    "set verbose 1",
+                    "set fwd mac",
+                    "start",
+                ],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=default_vf_mac[0],
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=["clear port stats all"],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                check_miss=True,
+                pmd_commands=[
+                    "clear port stats all",
+                    "mac_addr remove 0 {}".format(VF_MAC_ADDR),
+                ],
+            )
+            self.rxtx_base.basic_macfwd_check(
+                packet_num=100,
+                dst_mac=VF_WRONG_MAC_ADDR,
+                rx_port=self.used_dut_rx_port,
+                check_miss=True,
+                pmd_commands=[
+                    "clear port stats all",
+                ],
+            )
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.port_obj[self.used_dut_tx_port].set_vf_mac_addr(mac=VF_MAC_ADDR)
+
+    def test_dcf_vlan_filter(self):
+        self.vlan_func.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.vlan_func.basic_vlan_filter_check(
+            vlan_id=RANDOM_VLAN_ID,
+            match_pkt=MATCHED_VLAN_PKT,
+            unmatch_pkt=UNMATCHED_VLAN_PKT,
+            pmd_commands=[
+                "set promisc all off",
+                "vlan set filter on 0",
+                "vlan set strip off 0",
+                "rx_vlan add %d 0" % RANDOM_VLAN_ID,
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+        _, _, _, vlan_id_list = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_VLAN_PKT,
+            pmd_commands=[
+                "rx_vlan rm %d 0" % RANDOM_VLAN_ID,
+                "vlan set filter off 0",
+            ],
+        )
+        if not self.default_stats:
+            self.verify(len(vlan_id_list) == 1, "Failed to received vlan packet!!!")
+        else:
+            self.verify(len(vlan_id_list) == 0, "Failed to received vlan packet!!!")
+
+    def test_dcf_vlan_strip(self):
+        self.vlan_func.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.vlan_func.basic_vlan_strip_check(
+            vlan_id=RANDOM_VLAN_ID,
+            match_pkt=MATCHED_VLAN_PKT,
+            pmd_commands=[
+                "set promisc all off",
+                "vlan set filter on 0",
+                "rx_vlan add %d 0" % RANDOM_VLAN_ID,
+                "vlan set strip on 0",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+            rx_port=self.used_dut_rx_port,
+        )
+
+    def test_dcf_vlan_insertion(self):
+        self.vlan_func.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        self.vlan_func.basic_vlan_insert_check(
+            vlan_id=RANDOM_VLAN_ID,
+            insert_vlan=RANDOM_VLAN_ID,
+            match_pkt=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            pmd_commands=[
+                "port stop all",
+                "set promisc all off",
+                "vlan set filter on 0",
+                "tx_vlan set 1 %s" % RANDOM_VLAN_ID,
+                "rx_vlan add %s 0" % RANDOM_VLAN_ID,
+                "port start all",
+                "set verbose 1",
+                "set fwd mac",
+                "start",
+            ],
+        )
+
+    def test_dcf_vlan_pvid_base_tx(self):
+        try:
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=RANDOM_VLAN_ID,
+            )
+            self.vlan_func.launch_testpmd(
+                ports=self.vm_pci,
+                port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            )
+            packets_captured, _, _ = self.vlan_func.execute_fwd_check_process(
+                packets=self.vlan_func.generate_using_packets(
+                    pkt_type="UDP",
+                    dst_mac=self.vlan_func.get_vf_mac_through_pf(
+                        pf_intf=self.port_obj[
+                            self.used_dut_rx_port
+                        ].get_interface_name()
+                    ),
+                ),
+                tx_port=1,
+                tester_tx_interface=self.tester_rx_interface,
+                tester_rx_interface=self.tester_tx_interface,
+                pmd_commands=["set fwd mac", "set verbose 1", "start"],
+            )
+            self.verify(len(packets_captured) == 1, "Not receive expected packet")
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.vlan_func.execute_host_cmd(
+                "ip link set {} vf 0 vlan 0".format(
+                    self.port_obj[self.used_dut_tx_port].get_interface_name()
+                )
+            )
+
+    def test_dcf_vlan_pvid_base_rx(self):
+        try:
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=RANDOM_VLAN_ID,
+            )
+            self.vlan_func.launch_testpmd(
+                ports=self.vm_pci,
+                port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            )
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=[MATCHED_VLAN_PKT, UNMATCHED_VLAN_PKT],
+                pmd_commands=[
+                    "set fwd rxonly",
+                    "set verbose 1",
+                    "set promisc all off",
+                    "start",
+                ],
+            )
+            self.verify(rece_num == 1, "Failed to received matched vlan pkt")
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=self.vlan_func.generate_using_packets(
+                    pkt_type="UDP", dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 0, "Failed to received udp pkt without vlan")
+            self.vlan_func.pmd_session.quit()
+            self.vlan_func.set_pvid_from_pf(
+                pf_intf=self.port_obj[self.used_dut_tx_port].get_interface_name(),
+                vlan_id=0,
+            )
+            self.vlan_func.launch_testpmd(
+                ports=self.vm_pci,
+                port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+            )
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=MATCHED_VLAN_PKT,
+                rx_port=self.used_dut_rx_port,
+                pmd_commands=[
+                    "set fwd rxonly",
+                    "set verbose 1",
+                    "set promisc all off",
+                    "start",
+                ],
+            )
+            if not self.default_stats:
+                self.verify(rece_num == 1, "Failed to received vlan packet!!!")
+            else:
+                self.verify(rece_num == 0, "Failed to received vlan packet!!!")
+
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=[
+                    self.vlan_func.generate_using_packets(
+                        pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+                    ),
+                    self.vlan_func.generate_using_packets(
+                        pkt_type="UDP", dst_mac=VF_MAC_ADDR
+                    ),
+                ],
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 2, "Not received expect packet")
+        except Exception as e:
+            raise VerifyFailure(e)
+        finally:
+            self.vlan_func.execute_host_cmd(
+                "ip link set {} vf 0 vlan 0".format(
+                    self.port_obj[self.used_dut_tx_port].get_interface_name()
+                )
+            )
+
+    def test_dcf_vlan_rx_combination(self):
+        rx_vlans = [1, RANDOM_VLAN_ID, MAX_VLAN_ID]
+        """
+        the dcf not support '--enable-hw-vlan', So change to scalar path to test dcf vlan offload.
+        """
+        self.rxtx_base.launch_testpmd(
+            ports=self.vm_pci,
+            eal_param="--force-max-simd-bitwidth=64",
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+            pmd_commands=[
+                "set fwd rxonly",
+                "set verbose 1",
+                "vlan set strip on 0",
+                "vlan set filter on 0",
+                "set promisc all off",
+                "start",
+            ],
+        )
+        self.verify(rece_num == 1, "Not received normal packet as default")
+        _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+            packets=self.vlan_func.generate_using_packets(
+                pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify("VLAN tci=0x0" in pmdout, "Not received vlan 0 packet as default")
+        for rx_vlan in rx_vlans:
+            _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+                packets=self.vlan_func.generate_using_packets(
+                    pkt_type="VLAN_UDP", vlan_id=rx_vlan, dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+                pmd_commands="rx_vlan add {} 0".format(rx_vlan),
+            )
+            self.verify(
+                "VLAN tci={}".format(hex(rx_vlan)) in pmdout,
+                "Not received expected vlan packet",
+            )
+            if rx_vlan == MAX_VLAN_ID:
+                continue
+            rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+                pkts=self.vlan_func.generate_using_packets(
+                    pkt_type="VLAN_UDP", vlan_id=rx_vlan + 1, dst_mac=VF_MAC_ADDR
+                ),
+                rx_port=self.used_dut_rx_port,
+            )
+            self.verify(rece_num == 0, "failed to receive unmatch vlan pkt")
+        for rx_vlan in rx_vlans:
+            self.vlan_func.execute_pmd_cmd("rx_vlan rm {} 0".format(rx_vlan))
+        _, pmdout, _ = self.vlan_func.execute_fwd_check_process(
+            packets=self.vlan_func.generate_using_packets(
+                pkt_type="VLAN_UDP", vlan_id=0, dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify("VLAN tci=0x0" in pmdout, "Not received vlan 0 packet as default")
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=self.vlan_func.generate_using_packets(
+                pkt_type="UDP", dst_mac=VF_MAC_ADDR
+            ),
+            rx_port=self.used_dut_rx_port,
+        )
+        self.verify(
+            rece_num == 1, "Not received normal packet after remove vlan filter"
+        )
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=MATCHED_VLAN_PKT,
+            rx_port=self.used_dut_rx_port,
+        )
+        if not self.default_stats:
+            self.verify(rece_num == 1, "Failed to received vlan packet!!!")
+        else:
+            self.verify(rece_num == 0, "Failed to received vlan packet!!!")
+
+    def test_dcf_vlan_promisc(self):
+        self.vlan_func.launch_testpmd(
+            ports=self.vm_pci,
+            port_options={self.vm_pci[0]: "cap=dcf", self.vm_pci[1]: "cap=dcf"},
+        )
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=[
+                self.vlan_func.generate_using_packets(
+                    pkt_str=[
+                        'Ether(dst="{}",type=0x8100)/Dot1Q(vlan=100,type=0x0800)/IP(src="196.222.232.{}")/("X"*480)'.format(
+                            VF_MAC_ADDR, i
+                        )
+                        for i in range(10)
+                    ]
+                )
+            ],
+            pmd_commands=[
+                "port stop all",
+                "set promisc all on",
+                "set fwd mac",
+                "set verbose 1",
+                "vlan set filter off 0",
+                "vlan set strip off 0",
+                "port start all",
+                "start",
+            ],
+        )
+        self.verify(rece_num == 10, "Not receive expected packet")
+        rece_num, _, _, _ = self.vlan_func.vlan_pkts_fwd_check(
+            pkts=[
+                self.vlan_func.generate_using_packets(
+                    pkt_str=[
+                        'Ether(dst="{}")/IP(src="196.222.232.{}")/("X"*480)'.format(
+                            VF_MAC_ADDR, i
+                        )
+                        for i in range(10)
+                    ]
+                )
+            ],
+        )
+        self.verify(rece_num == 10, "Not receive expected packet")
+
+    def tear_down(self):
+        self.rxtx_base.pmd_session.quit()
+
+    def tear_down_all(self):
+        self.rxtx_base.destroy_vm_env()
+        self.rxtx_base.destroy_vf()
-- 
2.25.1


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

* [dst][PATCH V1 5/6] test_plans/ice_kernelpf_dcf_test_plan:add new plan to cover the most of dcf pmd function
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
                   ` (3 preceding siblings ...)
  2023-06-08 18:27 ` [dts][PATCH V1 4/6] tests/ice_kernelpf_dcf:add new suite to cover dcf pmd function Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-08 18:27 ` [dts][PATCH V1 6/6] conf/*:add config file for new suites Zhimin Huang
  5 siblings, 0 replies; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

add new testplan for ice_kernelpf_dcf test suite

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 test_plans/ice_kernelpf_dcf_test_plan.rst | 596 ++++++++++++++++++++++
 1 file changed, 596 insertions(+)
 create mode 100644 test_plans/ice_kernelpf_dcf_test_plan.rst

diff --git a/test_plans/ice_kernelpf_dcf_test_plan.rst b/test_plans/ice_kernelpf_dcf_test_plan.rst
new file mode 100644
index 00000000..734c092a
--- /dev/null
+++ b/test_plans/ice_kernelpf_dcf_test_plan.rst
@@ -0,0 +1,596 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2023 Intel Corporation
+
+=========================
+Kernel PF + DCF test plan
+=========================
+
+DPDK-22.07 make DCF full pmd feature.
+This document provides the plan for testing DCF PMD function of Intel® Ethernet 800 Series.
+
+Requirement
+===========
+1. Hardware:
+
+   Intel® Ethernet 800 Series: E810-XXVDA4/E810-CQ, etc.
+
+2. Software:
+   dpdk: http://dpdk.org/git/dpdk
+   scapy: http://www.secdev.org/projects/scapy/
+
+3. create 2 VF from 2 PF in DUT, set mac address for this VF, set trust on for dcf::
+
+    echo 1 > /sys/bus/pci/devices/0000\:18\:00.0/sriov_numvfs
+    echo 1 > /sys/bus/pci/devices/0000\:18\:00.1/sriov_numvfs
+    ip link set enp24s0f0 vf 0 mac 00:11:22:33:44:55
+    ip link set enp24s0f0 vf 0 trust on
+    ip link set enp24s0f1 vf 0 trust on
+
+4. bind VF to vfio-pci::
+
+    modprobe vfio-pci
+    usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:18:01.0 0000:18:09.0
+
+5. test dcf cases on host or in qemu, and launch testpmd::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xf -n 4 -a 0000:18:01.0,cap=dcf -a 0000:18:09.0,cap=dcf -- -i --rxq=16 --txq=16
+    testpmd> set fwd rxonly
+    testpmd> set verbose 1
+    testpmd> start
+
+.. note::
+
+    1.the kernel driver has MAC and VLAN Anti-Spoofing feature for VFs, the default is enable.
+      disabled for vfs: ip link set <ethX> vf <vf id> spoofchk {off|on}
+
+    2.for vf-vlan-pruning in ethtool --set-priv-flag, enable function to receive specific vlan packet.
+
+Test case: DCF basic RX/TX
+==========================
+Set rxonly forward, start testpmd
+
+Send 100 random packets from tester, check packets can be received
+
+Set txonly forward, start testpmd
+
+Check tester could receive the packets from application generated
+
+Test case: DCF promisc
+======================
+Ensure kernel trust mode is enable::
+
+    ip link set $PF_INTF vf 0 trust on
+
+Start testpmd, set mac forward and enable print output
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the DCF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can be received and forwarded by the DCF.
+
+Disable promisc mode::
+
+    testpmd> set promisc all off
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the DCF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can't be received and forwarded by the DCF.
+
+Enable promisc mode::
+
+    testpmd> set promisc all on
+
+Use scapy to send random packets with current VF0's MAC, verify the
+packets can be received and forwarded by the DCF.
+
+Use scapy to send random packets with a wrong MAC to VF0, verify the
+packets can be received and forwarded by the DCF.
+
+Test case: DCF multicast
+========================
+
+Start testpmd
+
+Disable promisc and multicast mode::
+
+    testpmd> set promisc all off
+    testpmd> set allmulti all off
+    testpmd> start
+
+Send packet with current VF0's MAC, and check DCF can receive the packet.
+
+Send packet with multicast MAC 01:80:C2:00:00:08, and check DCF can not
+receive the packet.
+
+Enable multicast mode::
+
+    testpmd> set allmulti all on
+
+configure multicast address::
+
+    testpmd> mcast_addr add 0 01:80:C2:00:00:08
+
+Send packet with current VF0's MAC, and check DCF can receive the packet.
+
+Send packet with multicast MAC 01:80:C2:00:00:08, and check DCF can
+receive the packet.
+
+Test case: DCF broadcast
+========================
+Disable promisc mode::
+
+    testpmd> set promisc all off
+    testpmd> start
+
+Send packet with broadcast address ff:ff:ff:ff:ff:ff, and check DCF can
+receive the packet
+
+Test case: DCF unicast
+======================
+Disable promisc and multicast mode::
+
+    testpmd> set promisc all off
+    testpmd> set allmulti all off
+    testpmd> start
+
+Send packet with unicast address, and check DCF can receive the packet
+
+Test case: DCF mac add filter
+=============================
+Disable promisc and enable crc strip and add mac address::
+
+    testpmd> port stop all
+    testpmd> port config all crc-strip on
+    testpmd> port start all
+    testpmd> set promisc all off
+    testpmd> mac_addr add 0 00:11:22:33:44:55
+
+Use scapy to send 100 random packets with current VF0's MAC, verify the
+packets can be received by one DCF and can be forwarded to another DCF
+correctly.
+
+Use scapy to send 100 random packets with new added VF0's MAC, verify the
+packets can be received by one DCF and can be forwarded to another DCF correctly.
+
+remove the added mac address::
+
+      testpmd> mac_addr remove 0 00:11:22:33:44:55
+
+Use scapy to send 100 random packets to the deleted MAC to VF0, verify the
+packets can't be received by one DCF and also can't be forwarded to another
+DCF correctly
+
+Use scapy to send 100 random packets with a wrong MAC to VF0, verify the
+packets can't be received by one DCF and also can't be forwarded to another
+DCF correctly.
+
+Test case: DCF vlan insertion
+=============================
+
+Disable vlan strip::
+
+    testpmd> vlan set strip off 0
+
+Set vlan id 20 for tx_vlan::
+
+    testpmd> port stop all
+    testpmd> tx_vlan set 0 20
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan set 0 20
+    testpmd> port start all
+    testpmd> set fwd mac
+    testpmd> start
+
+Send normal packet::
+
+    p=Ether(dst="00:01:23:45:67:89")/IP()/Raw(load='X'*30)
+
+Verify packet that out from DCF contains the vlan tag 20
+
+Test case: DCF vlan strip
+=========================
+
+Enable vlan strip::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 20 0
+    testpmd> vlan set strip on 0
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+    testpmd> start
+
+Send packets with vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check that out from DCF doesn't contain the vlan tag.
+
+Disable vlan strip::
+
+    testpmd> vlan set strip off 0
+
+Send packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check that out from DCF contains the vlan tag.
+
+Test case: DCF vlan filter
+==========================
+
+Enable vlan filter::
+
+    testpmd> vlan set filter on 0
+    testpmd> rx_vlan add 20 0
+    testpmd> vlan set strip off 0
+    testpmd> set promisc all off
+    testpmd> set fwd mac
+    testpmd> set verbose 1
+    testpmd> start
+
+Send packets with vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+Check packets can be received and forwarded with vlan tag.
+
+Send packets with unmatched vlan tag::
+
+    p=Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=30)/IP()/Raw(load='X'*30)
+
+Check packets can not be received and forwarded.
+
+Disable vlan filter::
+
+    testpmd> vlan set filter off 0
+
+Send packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/Dot1Q(id=0x8100,vlan=20)/IP()/Raw(load='X'*30)
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded with vlan tag.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded
+
+Test case: DCF vlan promisc
+===========================
+
+Enable promisc and disable vlan filter::
+
+    testpmd> port stop all
+    testpmd> set promisc all on
+    testpmd> set verbose 1
+    testpmd> vlan set filter off 0
+    testpmd> vlan set strip off 0
+    testpmd> set fwd mac
+    testpmd> port start all
+    testpmd> start
+
+Send 10 random packets with vlan tag::
+
+    Ether(dst="00:01:23:45:67:89",type=0x8100)/Dot1Q(vlan=100,type=0x0800)/IP(src="196.222.232.1")/("X"*480)
+    ...
+
+Check packets can be received and forwarded.
+
+Send 10 random packets without vlan tag::
+
+    Ether(dst="00:01:23:45:67:89")/IP(src="196.222.232.1")/("X"*480)
+    ...
+
+Check packets can be received and forwarded.
+
+Test case: DCF add pvid base rx
+===============================
+
+Add pvid on DCF from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 2
+
+Check pf device show correct pvid setting::
+
+     ip link show ens259f0
+     ...
+     vf 0 MAC 00:00:00:00:00:00, vlan 1, spoof checking on, link-state auto
+
+
+Start testpmd
+
+Send packet with same vlan id and check DCF can receive
+
+Send packet without vlan and check DCF can't receive
+
+Send packet with wrong vlan id and check DCF can't receive
+
+Remove added vlan from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 0
+
+Restart testpmd and send packet without vlan and check DCF can receive
+
+Set packet with vlan id 0 and check DCF can receive
+
+Set packet with random id 1-4095
+
+if vf-vlan-pruning is on::
+
+    Check packets can be received and forwarded.
+
+if vf-vlan-pruning is off or not have this option::
+
+    Check packets can not be received and forwarded
+
+send vlan=0 and not vlan pkt, also receive
+
+Test case: DCF add pvid base tx
+===============================
+Add pvid on DCF from PF device::
+
+     ip link set $PF_INTF vf 0 vlan 2
+
+Start testpmd with mac forward mode::
+
+     testpmd> set fwd mac
+     testpmd> start
+
+Send packet from tester port1 and check packet received by tester port0::
+
+     Check port1 received packet with configured vlan 2
+
+Test case: DCF vlan rx combination
+==================================
+Start testpmd with rxonly mode::
+
+     testpmd> set fwd rxonly
+     testpmd> set verbose 1
+     testpmd> start
+
+Send packet without vlan and check packet received
+
+Send packet with vlan 0 and check packet received
+
+Add vlan on DCF from VF driver::
+
+     testpmd> rx_vlan add 1 0
+
+Send packet with vlan0/1 and check packet received
+
+Rerun with step5-6 with random vlan and max vlan 4095
+
+Remove vlan on DCF::
+
+     rx_vlan rm 1 0
+
+Send packet with vlan 0 and check packet received
+
+Send packet without vlan and check packet received
+
+Send packet with vlan 1 and check packet received
+
+Test case: DCF RSS
+==================
+
+Start command with multi-queues like below::
+
+   ./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i --txq=4 --rxq=4
+
+Show RSS RETA configuration::
+
+    testpmd> show port 0 rss reta 64 (0xffffffffffffffff)
+
+    RSS RETA configuration: hash index=0, queue=0
+    RSS RETA configuration: hash index=1, queue=1
+    RSS RETA configuration: hash index=2, queue=2
+    RSS RETA configuration: hash index=3, queue=3
+    ...
+    RSS RETA configuration: hash index=60, queue=0
+    RSS RETA configuration: hash index=61, queue=1
+    RSS RETA configuration: hash index=62, queue=2
+    RSS RETA configuration: hash index=63, queue=3
+
+Config hash reta table::
+
+    testpmd> port config 0 rss reta (0,3)
+    testpmd> port config 0 rss reta (1,2)
+    testpmd> port config 0 rss reta (2,1)
+    testpmd> port config 0 rss reta (3,0)
+
+Check RSS RETA configuration has changed::
+
+    testpmd> show port 0 rss reta 64 (0xffffffffffffffff)
+
+    RSS RETA configuration: hash index=0, queue=3
+    RSS RETA configuration: hash index=1, queue=2
+    RSS RETA configuration: hash index=2, queue=2
+    RSS RETA configuration: hash index=3, queue=1
+
+Enable IP/TCP/UDP RSS::
+
+  testpmd> port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)
+
+Send different flow types' IP/TCP/UDP packets to DCF port, check packets are
+received by different configured queues.
+
+Test case: DCF RSS hash key
+===========================
+
+Start command with multi-queues like below::
+
+   ./<build_target>/app/dpdk-testpmd -c f -n 4 -- -i --txq=4 --rxq=4
+
+Show port rss hash key::
+
+    testpmd> show port 0 rss-hash key
+
+Set rxonly fwd, enable print, start testpmd::
+
+    testpmd> set fwd rxonly
+    testpmd> set verbose 1
+    testpmd> start
+
+Send ipv4 packets, mark the RSS hash value::
+
+    p=Ether(dst="56:0A:EC:50:A4:28")/IP(src="1.2.3.4")/Raw(load='X'*30)
+
+Update ipv4 different hash key::
+
+    testpmd> port config 0 rss-hash-key ipv4 1b9d58a4b961d9cd1c56ad1621c3ad51632c16a5d16c21c3513d132c135d132c13ad1531c23a51d6ac49879c499d798a7d949c8a
+
+Show port rss hash key, check the key is same to configured key::
+
+    testpmd> show port 0 rss-hash key
+    RSS functions:
+     all ipv4 ipv6 ip
+    RSS key:
+    1B9D58A4B961D9CD1C56AD1621C3AD51632C16A5D16C21C3513D132C135D132C13AD1531C23A51D6AC49879C499D798A7D949C8A
+
+Send ipv4 packets, check RSS hash value is different::
+
+    p=Ether(dst="56:0A:EC:50:A4:28")/IP(src="1.2.3.4")/Raw(load='X'*30)
+
+Test case: DCF rxq txq number inconsistent
+==========================================
+
+Start the testpmd with rxq not equal to txq::
+
+    ./<build_target>/app/dpdk-testpmd -l 1-9 -n 2 -- -i --rxq=4 --txq=8
+
+Set rxonly fwd, enable print, start testpmd::
+
+    testpmd> set fwd rxonly
+    testpmd> set verbose 1
+    testpmd> start
+
+Send different hash types' packets with different keywords, then check rx port
+    could receive packets by different queues::
+
+      sendp([Ether(dst="00:01:23:45:67:89")/IP(src="192.168.0.4", dst=RandIP())], iface="eth3")
+
+Check the total Rx packets in all the RxQ should be equal to the total HW Rx packets::
+
+    testpmd> show fwd stats all
+    ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 0/Queue= 0 -------
+    RX-packets: 252            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 1 -> TX Port= 0/Queue= 1 -------
+    RX-packets: 257            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 2 -> TX Port= 0/Queue= 2 -------
+    RX-packets: 259            TX-packets: 0              TX-dropped: 0
+
+    ------- Forward Stats for RX Port= 0/Queue= 3 -> TX Port= 0/Queue= 3 -------
+    RX-packets: 256            TX-packets: 0              TX-dropped: 0
+
+    ---------------------- Forward statistics for port 0  ----------------------
+    RX-packets: 1024           RX-dropped: 0             RX-total: 1024
+    TX-packets: 0              TX-dropped: 0             TX-total: 0
+    ----------------------------------------------------------------------------
+
+    +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
+    RX-packets: 1024           RX-dropped: 0             RX-total: 1024
+    TX-packets: 0              TX-dropped: 0             TX-total: 0
+    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Test case: DCF port stop/start
+==============================
+
+Stop port::
+
+    testpmd> port stop all
+
+Start port::
+
+    testpmd> port start all
+
+Repeat above stop and start port for 10 times
+
+Send packets from tester
+
+Check DCF could receive packets
+
+Test case: DCF statistics reset
+===============================
+
+Check port stats::
+
+    testpmd> show port stats all
+
+Clear port stats::
+
+    testpmd> clear port stats all
+
+Check DCF port stats, RX-packets and TX-packets are 0
+
+Set mac forward, enable print out
+
+Send 100 packets from tester
+
+Check DCF port stats, RX-packets and TX-packets are 100
+
+Clear DCF port stats
+
+Check DCF port stats, RX-packets and TX-packets are 0
+
+Test case: DCF information
+==========================
+
+Start testpmd
+
+Show DCF port information, check link, speed...information correctness::
+
+    testpmd> show port info all
+
+Set mac forward, enable print out
+
+Send 100 packets from tester
+
+Check DCF port stats, RX-packets and TX-packets are 100
+
+Test case: DCF xstats check
+===========================
+
+Launch testpmd and enable rss::
+
+    ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c f -n 4 -a 0000:18:01.0,cap=dcf -a 0000:18:09.0,cap=dcf -- -i --rxq=4 --txq=4 --max-pkt-len=9000
+    testpmd> port config all rss all
+    testpmd> set fwd mac
+
+show the xstats before packet forwarding, all the value are 0.
+
+Start forward and send 100 packets with random src IP address,
+   then stop forward.
+
+Check stats and xstats::
+
+    testpmd> stop
+
+    testpmd> show port stats all
+
+    testpmd> show port xstats all
+
+verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 100.
+rx_good_bytes, RX-bytes of port 0 and tx_good_bytes, TX-bytes of port 1 are the same.
+Intel® Ethernet 700 Series does not support hardware per queue stats,
+so rx_qx_packets and rx_qx_bytes are both 0.
+tx_qx_packets and tx_qx_bytes are both 0 too.
+
+Clear stats::
+
+      testpmd> clear port stats all
+
+Check stats and xstats, verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 0.
+
+Repeat above 4 and 5 steps.
+
+Clear xstats::
+
+    testpmd> clear port xstats all
+
+Check stats and xstats, verify rx_good_packets, RX-packets of port 0 and tx_good_packets, TX-packets of port 1 are both 0.
-- 
2.25.1


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

* [dts][PATCH V1 6/6] conf/*:add config file for new suites
  2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
                   ` (4 preceding siblings ...)
  2023-06-08 18:27 ` [dst][PATCH V1 5/6] test_plans/ice_kernelpf_dcf_test_plan:add new plan to cover the most of " Zhimin Huang
@ 2023-06-08 18:27 ` Zhimin Huang
  2023-06-09  9:22   ` Peng, Yuan
  5 siblings, 1 reply; 9+ messages in thread
From: Zhimin Huang @ 2023-06-08 18:27 UTC (permalink / raw)
  To: dts; +Cc: Zhimin Huang

add config file for new test suites

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 conf/ice_kernelpf_dcf.cfg | 22 ++++++++++++++++++++++
 conf/kernelpf_vf.cfg      | 22 ++++++++++++++++++++++
 test_plans/index.rst      |  2 ++
 3 files changed, 46 insertions(+)
 create mode 100644 conf/ice_kernelpf_dcf.cfg
 create mode 100644 conf/kernelpf_vf.cfg

diff --git a/conf/ice_kernelpf_dcf.cfg b/conf/ice_kernelpf_dcf.cfg
new file mode 100644
index 00000000..2820ffed
--- /dev/null
+++ b/conf/ice_kernelpf_dcf.cfg
@@ -0,0 +1,22 @@
+# Configuration sample: kernelpf_iavf.cfg
+
+[vm0]
+cpu =
+    model=host,number=8,cpupin=5 6 7 8 9 10 11 12 ;
+disk =
+    file=/home/image/fedora23-ok.img;
+login =
+    user=root,password=tester;
+# net option is not necessary for libvirt, comment out below 2 lines if using libvirt
+net = 
+   type=nic,opt_vlan=0;
+   type=user,opt_vlan=0; 
+# monitor option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+monitor = 
+    port=;
+# vnc option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+vnc = 
+    displayNum=1;
+# daemon option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+daemon =
+    enable=yes;
diff --git a/conf/kernelpf_vf.cfg b/conf/kernelpf_vf.cfg
new file mode 100644
index 00000000..2820ffed
--- /dev/null
+++ b/conf/kernelpf_vf.cfg
@@ -0,0 +1,22 @@
+# Configuration sample: kernelpf_iavf.cfg
+
+[vm0]
+cpu =
+    model=host,number=8,cpupin=5 6 7 8 9 10 11 12 ;
+disk =
+    file=/home/image/fedora23-ok.img;
+login =
+    user=root,password=tester;
+# net option is not necessary for libvirt, comment out below 2 lines if using libvirt
+net = 
+   type=nic,opt_vlan=0;
+   type=user,opt_vlan=0; 
+# monitor option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+monitor = 
+    port=;
+# vnc option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+vnc = 
+    displayNum=1;
+# daemon option is not supported by libvirt yet, comment out below 2 lines if using libvirt
+daemon =
+    enable=yes;
diff --git a/test_plans/index.rst b/test_plans/index.rst
index 2ac4850d..e6646bb5 100644
--- a/test_plans/index.rst
+++ b/test_plans/index.rst
@@ -205,6 +205,8 @@ The following are the test plans for the DPDK DTS automated test system.
     vf_l3fwd_lpm_ipv4_rfc2544_kernelpf_test_plan
     vf_l3fwd_lpm_ipv6_kernelpf_test_plan
     kernelpf_iavf_test_plan
+    kernelpf_vf_test_plan
+    ice_kernelpf_dcf_test_plan
     vhost_multi_queue_qemu_test_plan
     vhost_qemu_mtu_test_plan
     vhost_user_live_migration_test_plan
-- 
2.25.1


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

* RE: [dts][PATCH V1 6/6] conf/*:add config file for new suites
  2023-06-08 18:27 ` [dts][PATCH V1 6/6] conf/*:add config file for new suites Zhimin Huang
@ 2023-06-09  9:22   ` Peng, Yuan
  0 siblings, 0 replies; 9+ messages in thread
From: Peng, Yuan @ 2023-06-09  9:22 UTC (permalink / raw)
  To: Huang, ZhiminX, dts; +Cc: Huang, ZhiminX



> -----Original Message-----
> From: Zhimin Huang <zhiminx.huang@intel.com>
> Sent: Friday, June 9, 2023 2:28 AM
> To: dts@dpdk.org
> Cc: Huang, ZhiminX <zhiminx.huang@intel.com>
> Subject: [dts][PATCH V1 6/6] conf/*:add config file for new suites
> 
> add config file for new test suites
> 
> Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
> ---

Acked-by: Peng, Yuan <yuan.peng@intel.com>

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

* RE: [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases
  2023-06-08 18:27 ` [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases Zhimin Huang
@ 2023-06-14  2:03   ` Tu, Lijuan
  0 siblings, 0 replies; 9+ messages in thread
From: Tu, Lijuan @ 2023-06-14  2:03 UTC (permalink / raw)
  To: Huang, ZhiminX, dts; +Cc: Huang, ZhiminX



> -----Original Message-----
> From: Zhimin Huang <zhiminx.huang@intel.com>
> Sent: Friday, June 9, 2023 2:28 AM
> To: dts@dpdk.org
> Cc: Huang, ZhiminX <zhiminx.huang@intel.com>
> Subject: [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of
> the basic vf cases
> 
> add kernelpf_vf new suite and refactor with func_test_base common module:
> cover kernelpf_iavf/vf_vlan/vf_macfilter/vf_rss/vf_xstats_check.
> 
> Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
> ---
>  tests/TestSuite_kernelpf_vf.py | 1007 ++++++++++++++++++++++++++++++++
>  1 file changed, 1007 insertions(+)
>  create mode 100644 tests/TestSuite_kernelpf_vf.py
> 
......
> +
> +    def test_vf_multicast(self):
> +        self.rxtx_base.launch_testpmd()
> +        self.rxtx_base.basic_multicast_check(
> +            normal_mac=VF_MAC_ADDR, multicast_mac=MULTICAST_MAC_ADDR
> +        )
> +
> +    def test_vf_broadcast(self):
> +        self.rxtx_base.launch_testpmd()
> +        self.rxtx_base.basic_rx_check(packets_num=1,
> + packet_dst_mac=BROADCAST_MAC_ADDR)

I don't think it is a good idea to launch testpmd in every single case. It costs a lot of time. 
A good suite and cases organization could avoid this and save a lot of execution time.
1. adjust test cases that could use same args for testpmd.
2. separate those testpmd with different args to other suites.

> +
> +    def test_vf_queue_start_stop(self):
> +        self.rxtx_base.launch_testpmd()
> +        self.rxtx_base.basic_macfwd_check(
> +            packet_num=4, dst_mac=VF_MAC_ADDR,
> rx_port=self.used_dut_rx_port
> +        )
> +        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
> +            packets=self.rxtx_base.generate_random_packets(
> +                dstmac=VF_MAC_ADDR, pktnum=4
> +            ),
> +            rx_port=self.used_dut_rx_port,
> +            pmd_commands=["stop", "port 0 rxq 0 stop", "start"],
> +        )
> +        self.verify(
> +            len(packets_captured) == 0
> +            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
> +            "receive packet num is not match",
> +        )
> +        packets_captured, _, stats = self.rxtx_base.execute_fwd_check_process(
> +            packets=self.rxtx_base.generate_random_packets(
> +                dstmac=VF_MAC_ADDR, pktnum=4
> +            ),
> +            rx_port=self.used_dut_rx_port,
> +            pmd_commands=["stop", "port 0 rxq 0 start", "port 1 txq 0 stop",
> "start"],
> +        )
> +        self.verify(
> +            len(packets_captured) == 0
> +            and stats[self.used_dut_rx_port]["TX-packets"] == 0,
> +            "receive packet num is not match",
> +        )
> +        self.rxtx_base.basic_macfwd_check(
> +            packet_num=4,
> +            dst_mac=VF_MAC_ADDR,
> +            rx_port=self.used_dut_rx_port,
> +            pmd_commands=["stop", "port 1 txq 0 start", "start"],
> +        )
> +

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

end of thread, other threads:[~2023-06-14  2:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 18:27 [dts][PATCH V1 0/6] add new common module and add new suites Zhimin Huang
2023-06-08 18:27 ` [dts][PATCH V1 1/6] tests/func_test_base:add new commom module to refactor func test cases Zhimin Huang
2023-06-08 18:27 ` [dts][PATCH V1 2/6] tests/kernelpf_vf:add new suite to cover most of the basic vf cases Zhimin Huang
2023-06-14  2:03   ` Tu, Lijuan
2023-06-08 18:27 ` [dst][PATCH V1 3/6] test_plans/kernelpf_vf_test_plan:add new plan " Zhimin Huang
2023-06-08 18:27 ` [dts][PATCH V1 4/6] tests/ice_kernelpf_dcf:add new suite to cover dcf pmd function Zhimin Huang
2023-06-08 18:27 ` [dst][PATCH V1 5/6] test_plans/ice_kernelpf_dcf_test_plan:add new plan to cover the most of " Zhimin Huang
2023-06-08 18:27 ` [dts][PATCH V1 6/6] conf/*:add config file for new suites Zhimin Huang
2023-06-09  9:22   ` Peng, Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).