test suite reviews and discussions
 help / color / mirror / Atom feed
From: Zhimin Huang <zhiminx.huang@intel.com>
To: dts@dpdk.org
Cc: Zhimin Huang <zhiminx.huang@intel.com>
Subject: [dts][PATCH V2 3/3] tests/*:add 22.07 new feature, support in dcf mode
Date: Fri, 19 Aug 2022 22:07:09 +0800	[thread overview]
Message-ID: <20220819140709.16971-3-zhiminx.huang@intel.com> (raw)
In-Reply-To: <20220819140709.16971-1-zhiminx.huang@intel.com>

modify test case code to support dcf.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/TestSuite_kernelpf_iavf.py | 162 +++++++++++++++++++++++++++----
 tests/TestSuite_vf_macfilter.py  |  34 ++++++-
 tests/TestSuite_vf_offload.py    |  84 ++++++++++++----
 tests/TestSuite_vf_rss.py        |  44 +++++++--
 tests/TestSuite_vf_smoke.py      |  18 +++-
 tests/TestSuite_vf_vlan.py       |  76 +++++++++++++--
 6 files changed, 359 insertions(+), 59 deletions(-)

diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index d7d17ac4..593cce20 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -16,7 +16,7 @@ import time
 import framework.utils as utils
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE
+from framework.settings import DPDK_DCFMODE_SETTING, HEADER_SIZE, load_global_setting
 from framework.test_case import TestCase
 from framework.utils import RED
 from framework.virt_common import VM
@@ -74,6 +74,7 @@ class TestKernelpfIavf(TestCase):
         # get priv-flags default stats
         self.flag = "vf-vlan-pruning"
         self.default_stats = self.dut.get_priv_flags_state(self.host_intf, self.flag)
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
 
     def set_up(self):
 
@@ -85,6 +86,10 @@ class TestKernelpfIavf(TestCase):
             self.destroy_vm_env()
         elif self.env_done is False:
             self.setup_vm_env()
+        if self.dcf_mode:
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.host_intf), "# "
+            )
 
     def setup_vm_env(self, driver="default", set_vf_mac=True):
         """
@@ -136,6 +141,7 @@ class TestKernelpfIavf(TestCase):
                 raise Exception("Set up VM ENV failed!")
 
             self.vm_testpmd = PmdOutput(self.vm_dut)
+            self.vf_guest_pci = self.vm.pci_maps[0]["guestpci"]
         except Exception as e:
             self.destroy_vm_env()
             raise Exception(e)
@@ -190,7 +196,14 @@ class TestKernelpfIavf(TestCase):
         """
         Set rxonly forward,Send 100 random packets from tester, check packets can be received
         """
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set fwd rxonly")
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("start")
@@ -225,7 +238,14 @@ class TestKernelpfIavf(TestCase):
         Not set VF MAC from kernel PF for this case, if set, will print
         "not permitted error" when add new MAC for VF.
         """
-        out = self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            out = self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            out = self.vm_testpmd.start_testpmd("all")
         self.testpmd_mac = self.get_testpmd_vf_mac(out)
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set promisc all off")
@@ -273,7 +293,14 @@ class TestKernelpfIavf(TestCase):
         Enable kernel trust mode
         """
         self.dut.send_expect("ip link set dev %s vf 0 trust on" % self.host_intf, "# ")
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("start")
@@ -312,7 +339,14 @@ class TestKernelpfIavf(TestCase):
         """
         multicast_mac = "01:80:C2:00:00:08"
         self.dut.send_expect("ip link set dev %s vf 0 trust on" % self.host_intf, "# ")
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set promisc all off")
         self.vm_testpmd.execute_cmd("set allmulti all off")
@@ -336,7 +370,14 @@ class TestKernelpfIavf(TestCase):
     def test_vf_broadcast(self):
         """ """
         broadcast_mac = "ff:ff:ff:ff:ff:ff"
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set promisc all off")
         self.vm_testpmd.execute_cmd("set verbose 1")
@@ -366,7 +407,14 @@ class TestKernelpfIavf(TestCase):
         return out
 
     def test_vf_vlan_insertion(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         random_vlan = random.randint(1, MAX_VLAN)
         self.vm_testpmd.execute_cmd("vlan set strip off 0")
         self.vm_testpmd.execute_cmd("port stop all")
@@ -387,7 +435,14 @@ class TestKernelpfIavf(TestCase):
 
     def test_vf_vlan_strip(self):
         random_vlan = random.randint(1, MAX_VLAN)
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("port stop all")
         self.vm_testpmd.execute_cmd("vlan set filter on 0")
         self.vm_testpmd.execute_cmd("rx_vlan add %s 0" % random_vlan)
@@ -423,7 +478,14 @@ class TestKernelpfIavf(TestCase):
 
     def test_vf_vlan_filter(self):
         random_vlan = random.randint(2, MAX_VLAN)
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("port stop all")
         self.vm_testpmd.execute_cmd("set promisc all off")
         self.vm_testpmd.execute_cmd("vlan set filter on 0")
@@ -460,7 +522,15 @@ class TestKernelpfIavf(TestCase):
 
     def test_vf_rss(self):
         rss_type = ["ip", "tcp", "udp"]
-        self.vm_testpmd.start_testpmd("all", "--txq=4 --rxq=4")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                "--txq=4 --rxq=4",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all", "--txq=4 --rxq=4")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set verbose 1")
         default_rss_reta = self.vm_testpmd.execute_cmd(
@@ -483,7 +553,15 @@ class TestKernelpfIavf(TestCase):
 
     def test_vf_rss_hash_key(self):
         update_hash_key = "1b9d58a4b961d9cd1c56ad1621c3ad51632c16a5d16c21c3513d132c135d132c13ad1531c23a51d6ac49879c499d798a7d949c8a"
-        self.vm_testpmd.start_testpmd("all", "--txq=4 --rxq=4")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                "--txq=4 --rxq=4",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all", "--txq=4 --rxq=4")
         self.vm_testpmd.execute_cmd("show port 0 rss-hash key")
         self.vm_testpmd.execute_cmd("set fwd rxonly")
         self.vm_testpmd.execute_cmd("set verbose 1")
@@ -644,9 +722,18 @@ class TestKernelpfIavf(TestCase):
         self.tester.send_expect(
             "ifconfig %s mtu %d" % (self.tester_intf, ETHER_JUMBO_FRAME_MTU), "#"
         )
-        self.vm_testpmd.start_testpmd(
-            "all", "--port-topology=chained --max-pkt-len=%d" % ETHER_JUMBO_FRAME_MTU
-        )
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                "--port-topology=chained --max-pkt-len=%d" % ETHER_JUMBO_FRAME_MTU,
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                "--port-topology=chained --max-pkt-len=%d" % ETHER_JUMBO_FRAME_MTU,
+            )
         self.vm_testpmd.execute_cmd("set fwd csum")
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.enable_hw_checksum()
@@ -711,7 +798,14 @@ class TestKernelpfIavf(TestCase):
         self.tester.send_expect("^C", "#")
 
     def test_vf_port_start_stop(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         for i in range(10):
             self.vm_testpmd.execute_cmd("port stop all")
             self.vm_testpmd.execute_cmd("port start all")
@@ -730,7 +824,14 @@ class TestKernelpfIavf(TestCase):
         self.verify(vf0_tx_cnt == 100, "no packet was fwd by vm0_VF0")
 
     def test_vf_statistic_reset(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("start")
@@ -752,7 +853,14 @@ class TestKernelpfIavf(TestCase):
         )
 
     def test_vf_information(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         out = self.vm_testpmd.execute_cmd("show port info 0")
         self.verify("Link status: up" in out, "link stats has error")
         self.verify("Link speed: %s" % self.speed in out, "link speed has error")
@@ -821,7 +929,14 @@ class TestKernelpfIavf(TestCase):
         )
 
     def test_vf_unicast(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set promisc all off")
@@ -839,7 +954,14 @@ class TestKernelpfIavf(TestCase):
         self.verify(packets == 10, "Not receive expected packet")
 
     def test_vf_vlan_promisc(self):
-        self.vm_testpmd.start_testpmd("all")
+        if self.dcf_mode:
+            self.vm_testpmd.start_testpmd(
+                "all",
+                ports=[self.vf_guest_pci],
+                port_options={self.vf_guest_pci: "cap=dcf"},
+            )
+        else:
+            self.vm_testpmd.start_testpmd("all")
         self.vm_testpmd.execute_cmd("port stop all")
         self.vm_testpmd.execute_cmd("set promisc all on")
         self.vm_testpmd.execute_cmd("set fwd mac")
@@ -853,7 +975,7 @@ class TestKernelpfIavf(TestCase):
         self.scapy_send_packet(self.vf_mac, self.tester_intf, vlan_flags=True, count=10)
         out = self.vm_dut.get_session_output()
         packets = len(re.findall("received 1 packets", out))
-        if self.kdriver == "i40e" and self.driver_version < "2.13.10":
+        if self.kdriver == "i40e" and self.driver_version < "2.13.10" or self.dcf_mode:
             self.verify(packets == 10, "Not receive expected packet")
         else:
             self.verify(packets == 0, "Receive expected packet")
diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
index c2007999..f49c4406 100644
--- a/tests/TestSuite_vf_macfilter.py
+++ b/tests/TestSuite_vf_macfilter.py
@@ -6,6 +6,7 @@ import re
 import time
 
 from framework.pmd_output import PmdOutput
+from framework.settings import DPDK_DCFMODE_SETTING, load_global_setting
 from framework.test_case import TestCase
 from framework.virt_common import VM
 
@@ -34,6 +35,7 @@ class TestVfMacFilter(TestCase):
         else:
             self.vf_assign_method = "vfio-pci"
             self.dut.send_expect("modprobe vfio-pci", "#")
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
 
     def set_up(self):
 
@@ -50,10 +52,15 @@ class TestVfMacFilter(TestCase):
             self.dut.send_expect(
                 "ip link set %s vf 0 mac %s" % (pf_intf0, self.pf0_vf0_mac), "#"
             )
+        if self.dcf_mode:
+            self.dut.send_expect("ip link set %s vf 0 trust on" % (pf_intf0), "# ")
 
         self.used_dut_port_1 = self.dut_ports[1]
         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, driver=driver)
         self.sriov_vfs_port_1 = self.dut.ports_info[self.used_dut_port_1]["vfs_port"]
+        pf_intf1 = self.dut.ports_info[1]["port"].get_interface_name()
+        if self.dcf_mode:
+            self.dut.send_expect("ip link set %s vf 0 trust on" % (pf_intf1), "# ")
 
         try:
 
@@ -89,6 +96,9 @@ class TestVfMacFilter(TestCase):
                 raise Exception("Set up VM0 ENV failed!")
 
             self.setup_2pf_2vf_1vm_env_flag = 1
+            self.vf0_guest_pci = self.vm0.pci_maps[0]["guestpci"]
+            self.vf1_guest_pci = self.vm0.pci_maps[1]["guestpci"]
+
         except Exception as e:
             self.destroy_2pf_2vf_1vm_env()
             raise Exception(e)
@@ -145,7 +155,17 @@ class TestVfMacFilter(TestCase):
             self.host_testpmd.execute_cmd("set vf mac addr 0 0 %s" % self.pf0_vf0_mac)
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         # Get VF's MAC
         pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
         self.vm0_testpmd.execute_cmd("set promisc all off")
@@ -242,7 +262,17 @@ class TestVfMacFilter(TestCase):
     def send_packet_and_verify(self):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
 
         # Get VF0 port MAC address
         pmd_vf0_mac = self.vm0_testpmd.get_port_mac(0)
diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 4dd05cac..b79ba4cc 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -9,7 +9,7 @@ import time
 import framework.utils as utils
 from framework.crb import Crb
 from framework.pmd_output import PmdOutput
-from framework.settings import HEADER_SIZE
+from framework.settings import DPDK_DCFMODE_SETTING, HEADER_SIZE, load_global_setting
 from framework.test_case import TestCase
 from framework.utils import GREEN, RED
 from framework.virt_common import VM
@@ -39,6 +39,7 @@ class TestVfOffload(TestCase):
         else:
             self.vf_assign_method = "vfio-pci"
             self.dut.send_expect("modprobe vfio-pci", "#")
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
 
         self.setup_2pf_2vf_1vm_env_flag = 0
         self.setup_2pf_2vf_1vm_env(driver="")
@@ -67,6 +68,11 @@ class TestVfOffload(TestCase):
         self.used_dut_port_1 = self.dut_ports[1]
         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 1, driver=driver)
         self.sriov_vfs_port_1 = self.dut.ports_info[self.used_dut_port_1]["vfs_port"]
+        pf_intf0 = self.dut.ports_info[0]["port"].get_interface_name()
+        pf_intf1 = self.dut.ports_info[1]["port"].get_interface_name()
+        if self.dcf_mode:
+            self.dut.send_expect("ip link set %s vf 0 trust on" % (pf_intf0), "# ")
+            self.dut.send_expect("ip link set %s vf 0 trust on" % (pf_intf1), "# ")
 
         try:
 
@@ -92,6 +98,8 @@ class TestVfOffload(TestCase):
             self.vm_dut_0 = self.vm0.start()
             if self.vm_dut_0 is None:
                 raise Exception("Set up VM0 ENV failed!")
+            self.vf0_guest_pci = self.vm0.pci_maps[0]["guestpci"]
+            self.vf1_guest_pci = self.vm0.pci_maps[1]["guestpci"]
 
             self.setup_2pf_2vf_1vm_env_flag = 1
         except Exception as e:
@@ -249,13 +257,27 @@ class TestVfOffload(TestCase):
         can rx it and report the checksum error,
         verify forwarded packets have correct checksum.
         """
-        self.vm0_testpmd.start_testpmd(
-            VM_CORES_MASK,
-            "--portmask=%s " % (self.portMask)
-            + "--enable-rx-cksum "
-            + ""
-            + "--port-topology=loop",
-        )
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=%s " % (self.portMask)
+                + "--enable-rx-cksum "
+                + ""
+                + "--port-topology=loop",
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=%s " % (self.portMask)
+                + "--enable-rx-cksum "
+                + ""
+                + "--port-topology=loop",
+            )
         self.vm0_testpmd.execute_cmd("set fwd csum")
 
         time.sleep(2)
@@ -312,12 +334,27 @@ class TestVfOffload(TestCase):
         Send same packet with incorrect checksum and verify checksum is valid.
         """
 
-        self.vm0_testpmd.start_testpmd(
-            VM_CORES_MASK,
-            "--portmask=%s " % (self.portMask)
-            + "--enable-rx-cksum "
-            + "--port-topology=loop",
-        )
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=%s " % (self.portMask)
+                + "--enable-rx-cksum "
+                + ""
+                + "--port-topology=loop",
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=%s " % (self.portMask)
+                + "--enable-rx-cksum "
+                + ""
+                + "--port-topology=loop",
+            )
         self.vm0_testpmd.execute_cmd("set fwd csum")
 
         time.sleep(2)
@@ -451,10 +488,21 @@ class TestVfOffload(TestCase):
         )
 
         self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
-        self.vm0_testpmd.start_testpmd(
-            VM_CORES_MASK,
-            "--portmask=0x3 " + "--enable-rx-cksum " + "--max-pkt-len=%s" % TSO_MTU,
-        )
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=0x3 " + "--enable-rx-cksum " + "--max-pkt-len=%s" % TSO_MTU,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                "--portmask=0x3 " + "--enable-rx-cksum " + "--max-pkt-len=%s" % TSO_MTU,
+            )
 
         mac = self.vm0_testpmd.get_port_mac(0)
 
diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py
index 3c97e1fe..c8b14e16 100644
--- a/tests/TestSuite_vf_rss.py
+++ b/tests/TestSuite_vf_rss.py
@@ -15,6 +15,7 @@ reta_entries = []
 reta_lines = []
 
 from framework.pmd_output import PmdOutput
+from framework.settings import DPDK_DCFMODE_SETTING, load_global_setting
 
 # Use scapy to send packets with different source and dest ip.
 # and collect the hash result of five tuple and the queue id.
@@ -289,6 +290,7 @@ class TestVfRss(TestCase):
         self.vm0 = None
         self.host_testpmd = None
         self.setup_1pf_1vf_1vm_env_flag = 0
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
         self.setup_1pf_1vf_1vm_env(driver="")
 
     def set_up(self):
@@ -302,6 +304,9 @@ class TestVfRss(TestCase):
         self.used_dut_port_0 = self.dut_ports[0]
         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_0, 1, driver=driver)
         self.sriov_vfs_port_0 = self.dut.ports_info[self.used_dut_port_0]["vfs_port"]
+        pf_intf0 = self.dut.ports_info[0]["port"].get_interface_name()
+        if self.dcf_mode:
+            self.dut.send_expect("ip link set %s vf 0 trust on" % (pf_intf0), "# ")
 
         try:
             for port in self.sriov_vfs_port_0:
@@ -322,6 +327,7 @@ class TestVfRss(TestCase):
             self.vm_dut_0 = self.vm0.start()
             if self.vm_dut_0 is None:
                 raise Exception("Set up VM0 ENV failed!")
+            self.vf0_guest_pci = self.vm0.pci_maps[0]["guestpci"]
 
             self.vm0_testpmd = PmdOutput(self.vm_dut_0)
 
@@ -381,11 +387,20 @@ class TestVfRss(TestCase):
         eal_param = ""
         for queue in testQueues:
 
-            self.vm0_testpmd.start_testpmd(
-                "all",
-                "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
-                socket=self.vm0_ports_socket,
-            )
+            if self.dcf_mode:
+                self.vm0_testpmd.start_testpmd(
+                    "all",
+                    "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
+                    ports=[self.vf0_guest_pci],
+                    port_options={self.vf0_guest_pci: "cap=dcf"},
+                    socket=self.vm0_ports_socket,
+                )
+            else:
+                self.vm0_testpmd.start_testpmd(
+                    "all",
+                    "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
+                    socket=self.vm0_ports_socket,
+                )
 
             for iptype, rss_type in list(iptypes.items()):
                 self.vm_dut_0.send_expect("set verbose 8", "testpmd> ")
@@ -453,11 +468,20 @@ class TestVfRss(TestCase):
         # test with different rss queues
         for queue in testQueues:
 
-            self.vm0_testpmd.start_testpmd(
-                "all",
-                "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
-                socket=self.vm0_ports_socket,
-            )
+            if self.dcf_mode:
+                self.vm0_testpmd.start_testpmd(
+                    "all",
+                    "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
+                    ports=[self.vf0_guest_pci],
+                    port_options={self.vf0_guest_pci: "cap=dcf"},
+                    socket=self.vm0_ports_socket,
+                )
+            else:
+                self.vm0_testpmd.start_testpmd(
+                    "all",
+                    "--rxq=%d --txq=%d %s" % (queue, queue, eal_param),
+                    socket=self.vm0_ports_socket,
+                )
 
             for iptype, rsstype in list(iptypes.items()):
                 self.vm_dut_0.send_expect("set verbose 8", "testpmd> ")
diff --git a/tests/TestSuite_vf_smoke.py b/tests/TestSuite_vf_smoke.py
index b19160c6..3ab8ba71 100644
--- a/tests/TestSuite_vf_smoke.py
+++ b/tests/TestSuite_vf_smoke.py
@@ -4,6 +4,7 @@
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
+from framework.settings import DPDK_DCFMODE_SETTING, load_global_setting
 from framework.test_case import TestCase
 
 from .smoke_base import (
@@ -60,11 +61,16 @@ class TestVfSmoke(TestCase):
         self.vf0_prop = {"opt_host": self.vf_ports[0].pci}
         self.dut.send_expect("ifconfig %s up" % self.pf_interface, "# ")
         self.tester.send_expect("ifconfig %s up" % self.smoke_tester_nic, "# ")
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
 
         # set vf mac address
         self.dut.send_expect(
             "ip link set %s vf 0 mac %s" % (self.pf_interface, self.smoke_dut_mac), "# "
         )
+        if self.dcf_mode:
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.pf_interface), "# "
+            )
 
         # set default app parameter
         if self.vf0_prop is not None:
@@ -100,7 +106,17 @@ class TestVfSmoke(TestCase):
             self.vf_launch_dpdk_app()
 
     def vf_launch_dpdk_app(self):
-        self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports, param=self.param)
+        if self.dcf_mode:
+            self.pmd_out.start_testpmd(
+                cores=self.cores,
+                ports=self.ports,
+                port_options={port: "cap=dcf" for port in self.ports},
+                param=self.param,
+            )
+        else:
+            self.pmd_out.start_testpmd(
+                cores=self.cores, ports=self.ports, param=self.param
+            )
 
         # set default param
         self.dut.send_expect("set promisc all off", "testpmd> ")
diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index e73ad479..9ce75316 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -8,7 +8,7 @@ import time
 
 from framework.packet import Packet
 from framework.pmd_output import PmdOutput
-from framework.settings import get_nic_name
+from framework.settings import DPDK_DCFMODE_SETTING, get_nic_name, load_global_setting
 from framework.test_case import TestCase
 from framework.virt_common import VM
 
@@ -47,6 +47,7 @@ class TestVfVlan(TestCase):
         # get priv-flags default stats
         self.flag = "vf-vlan-pruning"
         self.default_stats = self.dut.get_priv_flags_state(self.host_intf0, self.flag)
+        self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING)
 
     def set_up(self):
         self.setup_vm_env()
@@ -76,6 +77,10 @@ class TestVfVlan(TestCase):
         self.dut.send_expect(
             "ip link set %s vf 0 mac %s" % (self.host_intf0, self.vf0_mac), "# "
         )
+        if self.dcf_mode:
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.host_intf0), "# "
+            )
 
         self.used_dut_port_1 = self.dut_ports[1]
         self.host_intf1 = self.dut.ports_info[self.used_dut_port_1]["intf"]
@@ -92,6 +97,10 @@ class TestVfVlan(TestCase):
         self.dut.send_expect(
             "ip link set %s vf 0 mac %s" % (self.host_intf1, self.vf1_mac), "# "
         )
+        if self.dcf_mode:
+            self.dut.send_expect(
+                "ip link set %s vf 0 trust on" % (self.host_intf1), "# "
+            )
 
         try:
 
@@ -112,6 +121,8 @@ class TestVfVlan(TestCase):
             self.vm_dut_0 = self.vm0.start()
             if self.vm_dut_0 is None:
                 raise Exception("Set up VM0 ENV failed!")
+            self.vf0_guest_pci = self.vm0.pci_maps[0]["guestpci"]
+            self.vf1_guest_pci = self.vm0.pci_maps[1]["guestpci"]
 
         except Exception as e:
             self.destroy_vm_env()
@@ -159,7 +170,17 @@ class TestVfVlan(TestCase):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         self.vm0_testpmd.execute_cmd("set fwd mac")
         self.vm0_testpmd.execute_cmd("start")
 
@@ -203,7 +224,17 @@ class TestVfVlan(TestCase):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         self.vm0_testpmd.execute_cmd("set fwd rxonly")
         self.vm0_testpmd.execute_cmd("set verbose 1")
         self.vm0_testpmd.execute_cmd("start")
@@ -233,7 +264,7 @@ class TestVfVlan(TestCase):
         self.vm0_testpmd.execute_cmd("start")
 
         out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
-        if self.kdriver == "i40e" and self.driver_version < "2.13.10":
+        if self.kdriver == "i40e" and self.driver_version < "2.13.10" or self.dcf_mode:
             self.verify("received" in out, "Failed to received vlan packet!!!")
         else:
             self.verify("received" not in out, "Received vlan packet without pvid!!!")
@@ -274,7 +305,17 @@ class TestVfVlan(TestCase):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         self.vm0_testpmd.execute_cmd("set verbose 1")
 
         for tx_vlan in tx_vlans:
@@ -299,7 +340,18 @@ class TestVfVlan(TestCase):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+                eal_param="--force-max-simd-bitwidth=64",
+            )
+        else:
+            self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         self.vm0_testpmd.execute_cmd("set fwd rxonly")
         self.vm0_testpmd.execute_cmd("set verbose 1")
         self.vm0_testpmd.execute_cmd("vlan set strip on 0")
@@ -374,8 +426,16 @@ class TestVfVlan(TestCase):
         self.vm0_dut_ports = self.vm_dut_0.get_ports("any")
 
         self.vm0_testpmd = PmdOutput(self.vm_dut_0)
-        if self.kdriver == "i40e":
-            self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "")
+        if self.dcf_mode:
+            self.vm0_testpmd.start_testpmd(
+                VM_CORES_MASK,
+                ports=[self.vf0_guest_pci, self.vf1_guest_pci],
+                port_options={
+                    self.vf0_guest_pci: "cap=dcf",
+                    self.vf1_guest_pci: "cap=dcf",
+                },
+                eal_param="--force-max-simd-bitwidth=64",
+            )
         else:
             self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
         self.vm0_testpmd.execute_cmd("set fwd rxonly")
-- 
2.17.1


      parent reply	other threads:[~2022-08-19  5:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 14:07 [dts][PATCH V2 1/3] framework/*:add dcf mode into execution file Zhimin Huang
2022-08-19 14:07 ` [dts][PATCH V2 2/3] test_plans/*:add 22.07 new feature, support in dcf mode Zhimin Huang
2022-08-19 14:07 ` Zhimin Huang [this message]

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20220819140709.16971-3-zhiminx.huang@intel.com \
    --to=zhiminx.huang@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).