diff mbox series

[V1,3/4] tests/vf_vlan: update dts code for driver change

Message ID 20220705071835.17187-3-weiyuanx.li@intel.com (mailing list archive)
State Superseded
Headers show
Series [V1,1/4] tests/kernelpf_iavf: update dts code for driver change | expand

Commit Message

Li, WeiyuanX July 5, 2022, 7:18 a.m. UTC
The out-tree driver has vf-vlan-pruning option,but in-tree driver has
not. So we need different action to enable vlan filter when we validate
the vlan filter function with in-tree and out-tree kernel drvier.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_vf_vlan.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index e73ad479..4986a21b 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -62,7 +62,26 @@  class TestVfVlan(TestCase):
         self.host_intf0 = self.dut.ports_info[self.used_dut_port_0]["intf"]
         tester_port = self.tester.get_local_port(self.used_dut_port_0)
         self.tester_intf0 = self.tester.get_interface(tester_port)
-        if self.is_eth_series_nic(800) and self.default_stats:
+        # check out tree driver whether there is flag vf-vlan-pruning.
+        # out tree path: /lib/modules/4.18.0-305.19.1.el8_4.x86_64/updates/drivers/net/ethernet/intel/i40e/i40e.ko
+        # in tree path:/lib/modules/5.15.0-27-generic/kernel/drivers/net/ethernet/intel/ice/ice.ko
+        out = self.dut.send_expect(f"modinfo {self.kdriver}", "# ")
+        pattern = "/lib/modules/(.*?)/updates/drivers"
+        regex = re.compile(pattern)
+        mo = regex.search(out)
+        if mo:
+            search_results = mo.group(0)
+        else:
+            search_results = ''
+        if "updates" in search_results and not self.default_stats:
+            self.verify(
+                False,
+                f"{self.kdriver} driver out tree does not have vf-vlan-pruning flag. Please confirm whether the driver is correct.",
+            )
+        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.host_intf0, self.flag), "# "
             )
@@ -233,7 +252,11 @@  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.kdriver == "i40e" and not self.default_stats)
+            or (self.kdriver == "ice" and not self.default_stats)
+        ):
             self.verify("received" in out, "Failed to received vlan packet!!!")
         else:
             self.verify("received" not in out, "Received vlan packet without pvid!!!")
@@ -354,7 +377,11 @@  class TestVfVlan(TestCase):
 
         # send packet with vlan
         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.kdriver == "i40e" and not self.default_stats)
+            or (self.kdriver == "ice" and not self.default_stats)
+        ):
             self.verify(
                 "received 1 packets" in out,
                 "Received mismatched vlan packet while vlan filter on",