<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 2, 2025 at 12:23 PM Dean Marx <<a href="mailto:dmarx@iol.unh.edu" target="_blank">dmarx@iol.unh.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add a physical function NIC capability that checks<br>
if the test run is using PFs. Add PF capability<br>
requirement to all suites/cases that do not<br>
run without error on virtual functions.<br>
<br>
Signed-off-by: Dean Marx <<a href="mailto:dmarx@iol.unh.edu" target="_blank">dmarx@iol.unh.edu</a>><br>
---<br>
 dts/framework/remote_session/testpmd_shell.py | 22 +++++++++++++++++++<br>
 dts/tests/TestSuite_dynamic_config.py         |  3 ++-<br>
 dts/tests/TestSuite_dynamic_queue_conf.py     |  1 +<br>
 dts/tests/TestSuite_l2fwd.py                  |  3 ++-<br>
 dts/tests/TestSuite_mac_filter.py             |  1 +<br>
 dts/tests/TestSuite_mtu.py                    |  4 +++-<br>
 dts/tests/TestSuite_pmd_buffer_scatter.py     |  1 +<br>
 dts/tests/TestSuite_port_control.py           |  3 ++-<br>
 dts/tests/TestSuite_port_stats.py             |  2 ++<br>
 dts/tests/TestSuite_promisc_support.py        |  4 +++-<br>
 dts/tests/TestSuite_rte_flow.py               |  1 +<br>
 dts/tests/TestSuite_softnic.py                |  3 ++-<br>
 dts/tests/TestSuite_uni_pkt.py                |  2 ++<br>
 13 files changed, 44 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py<br>
index 6d75f89969..ad8cb273dc 100644<br>
--- a/dts/framework/remote_session/testpmd_shell.py<br>
+++ b/dts/framework/remote_session/testpmd_shell.py<br>
@@ -2655,6 +2655,23 @@ def get_capabilities_flow_ctrl(<br>
         else:<br>
             unsupported_capabilities.add(NicCapability.FLOW_CTRL)<br>
<br>
+    def get_capabilities_physical_function(<br>
+        self,<br>
+        supported_capabilities: MutableSet["NicCapability"],<br>
+        unsupported_capabilities: MutableSet["NicCapability"],<br>
+    ) -> None:<br>
+        """Store capability representing a physical function test run.<br>
+<br>
+        Args:<br>
+            supported_capabilities: Supported capabilities will be added to this set.<br>
+            unsupported_capabilities: Unsupported capabilities will be added to this set.<br>
+        """<br>
+        ctx = get_ctx()<br>
+        if ctx.topology.vf_ports == []:<br>
+            supported_capabilities.add(NicCapability.PHYSICAL_FUNCTION)<br>
+        else:<br>
+            unsupported_capabilities.add(NicCapability.PHYSICAL_FUNCTION)<br>
+<br></blockquote><div><br></div><div>Another option would be to read directly from config.virtual_functions_testrun. But, it's the same thing at the end of the day.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 class NicCapability(NoAliasEnum):<br>
     """A mapping between capability names and the associated :class:`TestPmdShell` methods.<br>
@@ -2803,6 +2820,11 @@ class NicCapability(NoAliasEnum):<br>
     )<br>
     #: Device supports flow ctrl.<br>
     FLOW_CTRL: TestPmdShellNicCapability = (TestPmdShell.get_capabilities_flow_ctrl, None)<br>
+    #: Device is running on a physical function.<br>
+    PHYSICAL_FUNCTION: TestPmdShellNicCapability = (<br>
+        TestPmdShell.get_capabilities_physical_function,<br>
+        None,<br>
+    )<br>
<br>
     def __call__(<br>
         self,<br>
diff --git a/dts/tests/TestSuite_dynamic_config.py b/dts/tests/TestSuite_dynamic_config.py<br>
index 1fce31a0b5..49f295a39a 100644<br>
--- a/dts/tests/TestSuite_dynamic_config.py<br>
+++ b/dts/tests/TestSuite_dynamic_config.py<br>
@@ -20,11 +20,12 @@<br>
 from scapy.packet import Raw<br>
<br>
 from framework.params.testpmd import SimpleForwardingModes<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
 from framework.testbed_model.capability import TopologyType, requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(topology_type=TopologyType.two_links)<br>
 class TestDynamicConfig(TestSuite):<br>
     """Dynamic config suite.<br>
diff --git a/dts/tests/TestSuite_dynamic_queue_conf.py b/dts/tests/TestSuite_dynamic_queue_conf.py<br>
index 344dd540eb..f8c7dbfb71 100644<br>
--- a/dts/tests/TestSuite_dynamic_queue_conf.py<br>
+++ b/dts/tests/TestSuite_dynamic_queue_conf.py<br>
@@ -117,6 +117,7 @@ def wrap(self: "TestDynamicQueueConf", is_rx_testing: bool) -> None:<br>
     return wrap<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 class TestDynamicQueueConf(TestSuite):<br>
     """DPDK dynamic queue configuration test suite.<br>
<br>
diff --git a/dts/tests/TestSuite_l2fwd.py b/dts/tests/TestSuite_l2fwd.py<br>
index 0555d75ed8..5ffa2dcd19 100644<br>
--- a/dts/tests/TestSuite_l2fwd.py<br>
+++ b/dts/tests/TestSuite_l2fwd.py<br>
@@ -9,7 +9,7 @@<br>
<br>
 from framework.context import filter_cores<br>
 from framework.params.testpmd import EthPeer, SimpleForwardingModes<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
 from framework.testbed_model.capability import requires<br>
 from framework.testbed_model.cpu import LogicalCoreCount<br>
@@ -17,6 +17,7 @@<br>
 from framework.utils import generate_random_packets<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(topology_type=TopologyType.two_links)<br>
 class TestL2fwd(TestSuite):<br>
     """L2 forwarding test suite."""<br>
diff --git a/dts/tests/TestSuite_mac_filter.py b/dts/tests/TestSuite_mac_filter.py<br>
index 9dbfec5da2..2387fdfac2 100644<br>
--- a/dts/tests/TestSuite_mac_filter.py<br>
+++ b/dts/tests/TestSuite_mac_filter.py<br>
@@ -25,6 +25,7 @@<br>
 from framework.testbed_model.capability import requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 class TestMacFilter(TestSuite):<br>
     """Mac address allowlist filtering test suite.<br>
<br>
diff --git a/dts/tests/TestSuite_mtu.py b/dts/tests/TestSuite_mtu.py<br>
index af6ab88501..d5b3fe02af 100644<br>
--- a/dts/tests/TestSuite_mtu.py<br>
+++ b/dts/tests/TestSuite_mtu.py<br>
@@ -17,8 +17,9 @@<br>
 from scapy.layers.l2 import Ether<br>
 from scapy.packet import Raw<br>
<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
+from framework.testbed_model.capability import requires<br>
<br>
 STANDARD_FRAME = 1518  # --max-pkt-len will subtract l2 information at a minimum of 18 bytes.<br>
 JUMBO_FRAME = 9018<br>
@@ -30,6 +31,7 @@<br>
 VENDOR_AGNOSTIC_PADDING = 9  # Used as a work around for varying MTU definitions between vendors.<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 class TestMtu(TestSuite):<br>
     """DPDK PMD jumbo frames and MTU update test suite.<br>
<br>
diff --git a/dts/tests/TestSuite_pmd_buffer_scatter.py b/dts/tests/TestSuite_pmd_buffer_scatter.py<br>
index 5e23f28bc6..015163dd11 100644<br>
--- a/dts/tests/TestSuite_pmd_buffer_scatter.py<br>
+++ b/dts/tests/TestSuite_pmd_buffer_scatter.py<br>
@@ -28,6 +28,7 @@<br>
 from framework.testbed_model.capability import NicCapability, requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(NicCapability.RX_OFFLOAD_SCATTER)<br>
 class TestPmdBufferScatter(TestSuite):<br>
     """DPDK PMD packet scattering test suite.<br>
diff --git a/dts/tests/TestSuite_port_control.py b/dts/tests/TestSuite_port_control.py<br>
index ad5a09c58e..58783f1d18 100644<br>
--- a/dts/tests/TestSuite_port_control.py<br>
+++ b/dts/tests/TestSuite_port_control.py<br>
@@ -13,11 +13,12 @@<br>
 from scapy.packet import Packet, Raw<br>
<br>
 from framework.params.testpmd import SimpleForwardingModes<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
 from framework.testbed_model.capability import TopologyType, requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(topology_type=TopologyType.two_links)<br>
 class TestPortControl(TestSuite):<br>
     """DPDK Port Control Testing Suite."""<br>
diff --git a/dts/tests/TestSuite_port_stats.py b/dts/tests/TestSuite_port_stats.py<br>
index 2bb8747399..ddd28623b3 100644<br>
--- a/dts/tests/TestSuite_port_stats.py<br>
+++ b/dts/tests/TestSuite_port_stats.py<br>
@@ -19,6 +19,7 @@<br>
<br>
 from framework.params.testpmd import SimpleForwardingModes<br>
 from framework.remote_session.testpmd_shell import (<br>
+    NicCapability,<br>
     RtePTypes,<br>
     TestPmdShell,<br>
     TestPmdVerbosePacket,<br>
@@ -27,6 +28,7 @@<br>
 from framework.testbed_model.capability import TopologyType, requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(topology_type=TopologyType.two_links)<br>
 class TestPortStats(TestSuite):<br>
     """DPDK Port statistics testing suite.<br>
diff --git a/dts/tests/TestSuite_promisc_support.py b/dts/tests/TestSuite_promisc_support.py<br>
index 445f6e1d69..8a7a7efb57 100644<br>
--- a/dts/tests/TestSuite_promisc_support.py<br>
+++ b/dts/tests/TestSuite_promisc_support.py<br>
@@ -11,10 +11,12 @@<br>
 from scapy.layers.l2 import Ether<br>
 from scapy.packet import Raw<br>
<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
+from framework.testbed_model.capability import requires<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 class TestPromiscSupport(TestSuite):<br>
     """Promiscuous mode support test suite."""<br>
<br>
diff --git a/dts/tests/TestSuite_rte_flow.py b/dts/tests/TestSuite_rte_flow.py<br>
index e70f7ea8d1..4855e4261d 100644<br>
--- a/dts/tests/TestSuite_rte_flow.py<br>
+++ b/dts/tests/TestSuite_rte_flow.py<br>
@@ -316,6 +316,7 @@ def test_queue_action_IP(self) -> None:<br>
             test_queue=2,<br>
         )<br>
<br>
+    @requires(NicCapability.PHYSICAL_FUNCTION)<br>
     @func_test<br>
     def test_queue_action_L4(self) -> None:<br>
         """Validate flow rules with queue actions and TCP/UDP patterns.<br>
diff --git a/dts/tests/TestSuite_softnic.py b/dts/tests/TestSuite_softnic.py<br>
index c1873dca4c..27754c08e7 100644<br>
--- a/dts/tests/TestSuite_softnic.py<br>
+++ b/dts/tests/TestSuite_softnic.py<br>
@@ -9,7 +9,7 @@<br>
 from pathlib import Path, PurePath<br>
<br>
 from framework.params.testpmd import EthPeer<br>
-from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.remote_session.testpmd_shell import NicCapability, TestPmdShell<br>
 from framework.test_suite import TestSuite, func_test<br>
 from framework.testbed_model.capability import requires<br>
 from framework.testbed_model.topology import TopologyType<br>
@@ -17,6 +17,7 @@<br>
 from framework.utils import generate_random_packets<br>
<br>
<br>
+@requires(NicCapability.PHYSICAL_FUNCTION)<br>
 @requires(topology_type=TopologyType.two_links)<br>
 class TestSoftnic(TestSuite):<br>
     """Softnic test suite."""<br>
diff --git a/dts/tests/TestSuite_uni_pkt.py b/dts/tests/TestSuite_uni_pkt.py<br>
index fdb9c29059..690c5d4fd1 100644<br>
--- a/dts/tests/TestSuite_uni_pkt.py<br>
+++ b/dts/tests/TestSuite_uni_pkt.py<br>
@@ -20,6 +20,7 @@<br>
 from scapy.packet import Packet, Raw<br>
<br>
 from framework.remote_session.testpmd_shell import (<br>
+    NicCapability,<br>
     RtePTypes,<br>
     SimpleForwardingModes,<br>
     TestPmdShell,<br>
@@ -258,6 +259,7 @@ def test_nsh_packet_detect(self) -> None:<br>
         with TestPmdShell() as testpmd:<br>
             self.setup_session(testpmd=testpmd, expected_flags=flag_list, packet_list=packet_list)<br>
<br>
+    @requires(NicCapability.PHYSICAL_FUNCTION)<br>
     @func_test<br>
     def test_vxlan_tunnel_packet_detect(self) -> None:<br>
         """Ensure the correct flags are shown in the verbose output when sending VXLAN packets.<br>
-- <br>
2.49.0<br>
<br></blockquote><div><br></div><div>In principle some of the functions performed in these testsuites should be possible via VFs.</div><div><br></div><div>As a follow up task in 25.11 we should assess this and see if the total list of VF compatible testsuites can be extended.</div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>><div>Tested-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div></div><div><br></div><div> </div></div></div>
</div>