tests: Add checksum offload interface tests

Type: test

Change-Id: I6edc8858b802d3d32159d71c1e867a06cc1025d5
Signed-off-by: Naveen Joy <najoy@cisco.com>
diff --git a/test/test_vm_vpp_interfaces.py b/test/test_vm_vpp_interfaces.py
index 6866c24..b86c519 100644
--- a/test/test_vm_vpp_interfaces.py
+++ b/test/test_vm_vpp_interfaces.py
@@ -111,10 +111,12 @@
                     + f"_v{test['client_if_version']}_"
                     + f"gso_{test.get('client_if_gso', 0)}_"
                     + f"gro_{test.get('client_if_gro', 0)}_"
+                    + f"checksum_{test.get('client_if_checksum_offload', 0)}_"
                     + f"to_server_{test['server_if_type']}"
                     + f"_v{test['server_if_version']}_"
                     + f"gso_{test.get('server_if_gso', 0)}_"
                     + f"gro_{test.get('server_if_gro', 0)}_"
+                    + f"checksum_{test.get('server_if_checksum_offload', 0)}_"
                     + f"mtu_{mtu}_mode_{test['x_connect_mode']}_"
                     + f"tcp_ipv{ip_version}"
                 )
@@ -187,6 +189,8 @@
         enable_server_if_gso = test.get("server_if_gso", 0)
         enable_client_if_gro = test.get("client_if_gro", 0)
         enable_server_if_gro = test.get("server_if_gro", 0)
+        enable_client_if_checksum_offload = test.get("client_if_checksum_offload", 0)
+        enable_server_if_checksum_offload = test.get("server_if_checksum_offload", 0)
         ## Handle client interface types
         if client_if_type == "af_packet":
             create_host_interface(
@@ -240,6 +244,7 @@
                 host_if_name=f"{client_if_type}0",
                 enable_gso=enable_client_if_gso,
                 enable_gro=enable_client_if_gro,
+                enable_checksum_offload=enable_client_if_checksum_offload,
             )
             self.vpp_interfaces.append(self.ingress_if_idx)
             self.linux_interfaces.append([client_namespace, f"{client_if_type}0"])
@@ -294,6 +299,7 @@
                 host_if_name=f"{server_if_type}0",
                 enable_gso=enable_server_if_gso,
                 enable_gro=enable_server_if_gro,
+                enable_checksum_offload=enable_server_if_checksum_offload,
             )
             self.vpp_interfaces.append(self.egress_if_idx)
             self.linux_interfaces.append([server_namespace, f"{server_if_type}0"])
@@ -440,6 +446,7 @@
         host_if_name=None,
         enable_gso=0,
         enable_gro=0,
+        enable_checksum_offload=0,
     ):
         """Create a tapv2 or tunv2 interface in VPP and attach to host.
 
@@ -457,6 +464,7 @@
         host_if_name -- host side interface name
         enable_gso -- enable GSO
         enable_gro -- enable GSO/GRO-Coalesce
+        enable_checksum_offload -- enable checksum offload without gso
         """
         TapFlags = VppEnum.vl_api_tap_flags_t
         tap_flags = 0
@@ -468,6 +476,8 @@
                 )
             elif enable_gso:
                 tap_flags = tap_flags | TapFlags.TAP_API_FLAG_GSO
+            elif enable_checksum_offload:
+                tap_flags = tap_flags | TapFlags.TAP_API_FLAG_CSUM_OFFLOAD
         elif int_type == "tap":
             if enable_gro:
                 tap_flags = (
@@ -475,6 +485,8 @@
                 )
             elif enable_gso:
                 tap_flags = TapFlags.TAP_API_FLAG_GSO
+            elif enable_checksum_offload:
+                tap_flags = tap_flags | TapFlags.TAP_API_FLAG_CSUM_OFFLOAD
 
         api_args = {
             "id": id,
diff --git a/test/vm_test_config.py b/test/vm_test_config.py
index 83534a8..7c8aa4c 100644
--- a/test/vm_test_config.py
+++ b/test/vm_test_config.py
@@ -288,5 +288,35 @@
             "server_if_gso": 1,
             "x_connect_mode": "L2",
         },
+        {
+            "id": 24,
+            "client_if_type": "tap",
+            "client_if_version": 2,
+            "client_if_checksum_offload": 1,
+            "server_if_type": "tap",
+            "server_if_version": 2,
+            "server_if_checksum_offload": 1,
+            "x_connect_mode": "L2",
+        },
+        {
+            "id": 25,
+            "client_if_type": "tap",
+            "client_if_version": 2,
+            "client_if_checksum_offload": 0,
+            "server_if_type": "tap",
+            "server_if_version": 2,
+            "server_if_checksum_offload": 1,
+            "x_connect_mode": "L3",
+        },
+        {
+            "id": 26,
+            "client_if_type": "tap",
+            "client_if_version": 2,
+            "client_if_checksum_offload": 1,
+            "server_if_type": "tap",
+            "server_if_version": 2,
+            "server_if_checksum_offload": 0,
+            "x_connect_mode": "L3",
+        },
     ],
 }