[dts][PATCH V1 01/12] tests/kernelpf_iavf: update dts code for dpdk csum change

Weiyuan Li weiyuanx.li at intel.com
Mon Jul 18 04:54:36 CEST 2022


According to dpdk commit 9b4ea7ae77fa(app/testpmd: revert MAC update in checksum forwarding) modify
the script adapt to this chagne.

1. Modify VF case to enable promisc.
2. Modify PF case to send packet dst mac is random.

Signed-off-by: Weiyuan Li <weiyuanx.li at intel.com>
---
 tests/TestSuite_kernelpf_iavf.py | 46 ++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index d7d17ac4..57944770 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -75,6 +75,14 @@ class TestKernelpfIavf(TestCase):
         self.flag = "vf-vlan-pruning"
         self.default_stats = self.dut.get_priv_flags_state(self.host_intf, self.flag)
 
+    def ip_link_set(self, host_intf=None, cmd=None, port=None, types=None, value=0):
+        if host_intf is None or cmd is None or port is None or types is None:
+            return
+        set_command = f"ip link set {host_intf} {cmd} {port} {types} {value}"
+        out = self.dut.send_expect(set_command, "# ")
+        if "RTNETLINK answers: Invalid argument" in out:
+            self.dut.send_expect(set_command, "# ")
+
     def set_up(self):
 
         if self.running_case == "test_vf_mac_filter":
@@ -120,6 +128,22 @@ class TestKernelpfIavf(TestCase):
                 "ip link set %s vf 0 mac %s" % (self.host_intf, self.vf_mac), "# "
             )
 
+        if self.running_case == "test_vf_tso":
+            self.host_intf_0 = self.dut.ports_info[self.used_dut_port]["intf"]
+            self.ip_link_set(
+                host_intf=self.host_intf_0,
+                cmd="vf",
+                port=0,
+                types="trust",
+                value="on",
+            )
+            self.ip_link_set(
+                host_intf=self.host_intf_0,
+                cmd="vf",
+                port=0,
+                types="spoofchk",
+                value="off",
+            )
         try:
 
             for port in self.sriov_vfs_port:
@@ -656,9 +680,10 @@ class TestKernelpfIavf(TestCase):
         self.tester.scapy_foreground()
         time.sleep(5)
         self.start_tcpdump(self.tester_intf)
+        vf_mac = "00:01:23:45:67:80"
         pkt = (
-            'sendp([Ether(dst="%s")/IP(chksum=0x1234)/TCP(flags=0x10,chksum=0x1234)/'
-            'Raw(RandString(5214))], iface="%s")' % (self.vf_mac, self.tester_intf)
+            'sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x1234)/TCP(flags=0x10,chksum=0x1234)/'
+            'Raw(RandString(5214))], iface="%s")' % (vf_mac, self.tester_intf)
         )
         self.tester.scapy_append(pkt)
         self.tester.scapy_execute()
@@ -927,6 +952,23 @@ class TestKernelpfIavf(TestCase):
             self.destroy_vm_env()
         self.dut.send_expect("ip link set dev %s vf 0 trust off" % self.host_intf, "# ")
 
+        if self.running_case == "test_vf_tso":
+            self.host_intf_0 = self.dut.ports_info[self.used_dut_port]["intf"]
+            self.ip_link_set(
+                host_intf=self.host_intf_0,
+                cmd="vf",
+                port=0,
+                types="trust",
+                value="off",
+            )
+            self.ip_link_set(
+                host_intf=self.host_intf_0,
+                cmd="vf",
+                port=0,
+                types="spoofchk",
+                value="on",
+            )
+
     def tear_down_all(self):
         """
         When the case of this test suite finished, the environment should
-- 
2.27.0



More information about the dts mailing list