Vhost: Add GSO option 53/24153/8
authorPeter Mikus <pmikus@cisco.com>
Thu, 2 Jan 2020 13:25:01 +0000 (13:25 +0000)
committerPeter Mikus <pmikus@cisco.com>
Tue, 7 Jan 2020 15:25:06 +0000 (15:25 +0000)
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: Iba9af71c293645b480203af72fcf940cbe9ccb3a

resources/libraries/python/QemuManager.py
resources/libraries/python/QemuUtils.py
resources/libraries/python/VhostUser.py
resources/libraries/robot/shared/interfaces.robot
resources/libraries/robot/shared/vm.robot

index cfc4fbd..c55e5af 100644 (file)
@@ -96,11 +96,13 @@ class QemuManager:
                 )
                 self.machines[name].qemu_add_vhost_user_if(
                     sock1, jumbo_frames=kwargs[u"jumbo"], queues=queues,
-                    queue_size=kwargs[u"perf_qemu_qsz"]
+                    queue_size=kwargs[u"perf_qemu_qsz"],
+                    csum=kwargs[u"enable_csum"], gso=kwargs[u"enable_gso"]
                 )
                 self.machines[name].qemu_add_vhost_user_if(
                     sock2, jumbo_frames=kwargs[u"jumbo"], queues=queues,
-                    queue_size=kwargs[u"perf_qemu_qsz"]
+                    queue_size=kwargs[u"perf_qemu_qsz"],
+                    csum=kwargs[u"enable_csum"], gso=kwargs[u"enable_gso"]
                 )
 
     def construct_vms_on_all_nodes(self, **kwargs):
index 96b4ebd..09c3df7 100644 (file)
@@ -384,7 +384,7 @@ class QemuUtils:
 
     def qemu_add_vhost_user_if(
             self, socket, server=True, jumbo_frames=False, queue_size=None,
-            queues=1):
+            queues=1, csum=False, gso=False):
         """Add Vhost-user interface.
 
         :param socket: Path of the unix socket.
@@ -392,11 +392,15 @@ class QemuUtils:
         :param jumbo_frames: Set True if jumbo frames are used in the test.
         :param queue_size: Vring queue size.
         :param queues: Number of queues.
+        :param csum: Checksum offloading.
+        :param gso: Generic segmentation offloading.
         :type socket: str
         :type server: bool
         :type jumbo_frames: bool
         :type queue_size: int
         :type queues: int
+        :type csum: bool
+        :type gso: bool
         """
         self._vhost_id += 1
         self._params.add_with_value(
@@ -411,12 +415,13 @@ class QemuUtils:
             f"{self._vhost_id:02x}"
         queue_size = f"rx_queue_size={queue_size},tx_queue_size={queue_size}" \
             if queue_size else u""
-        mbuf = u"on,host_mtu=9200"
         self._params.add_with_value(
             u"device", f"virtio-net-pci,netdev=vhost{self._vhost_id},mac={mac},"
             f"addr={self._vhost_id+5}.0,mq=on,vectors={2 * queues + 2},"
-            f"csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off,"
-            f"mrg_rxbuf={mbuf if jumbo_frames else u'off'},{queue_size}"
+            f"csum={u'on' if csum else u'off'},gso={u'on' if gso else u'off'},"
+            f"guest_tso4=off,guest_tso6=off,guest_ecn=off,"
+            f"mrg_rxbuf={u'on,host_mtu=9200' if jumbo_frames else u'off'},"
+            f"{queue_size}"
         )
 
         # Add interface MAC and socket to the node dict.
index 2a03835..cc9685d 100644 (file)
@@ -24,13 +24,18 @@ class VhostUser:
     """Vhost-user interfaces L1 library."""
 
     @staticmethod
-    def vpp_create_vhost_user_interface(node, socket):
+    def vpp_create_vhost_user_interface(
+            node, socket, is_server=False, enable_gso=False):
         """Create Vhost-user interface on VPP node.
 
         :param node: Node to create Vhost-user interface on.
         :param socket: Vhost-user interface socket path.
+        :param is_server: Server side of connection. Default: False
+        :param enable_gso: Generic segmentation offloading. Default: False
         :type node: dict
         :type socket: str
+        :type is_server: bool
+        :type enable_gso: bool
         :returns: SW interface index.
         :rtype: int
         """
@@ -38,7 +43,9 @@ class VhostUser:
         err_msg = f"Failed to create Vhost-user interface " \
             f"on host {node[u'host']}"
         args = dict(
-            sock_filename=str(socket)
+            is_server=bool(is_server),
+            sock_filename=str(socket),
+            enable_gso=bool(enable_gso)
         )
 
         with PapiSocketExecutor(node) as papi_exec:
index a3490a8..dd6ee56 100644 (file)
 | | ... | Type: string
 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
 | | ... | Type: string
+| | ... | - ${is_server} - Server side of connection (Optional).
+| | ... | Type: boolean
+| | ... | - ${enable_gso} - Generic segmentation offloading (Optional).
+| | ... | Type: boolean
 | |
 | | ... | _NOTE:_ This KW sets following test case variable:
 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
 | | ... | \| dut2_vhost_if2 \|
 | |
 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
-| | ... | ${vhost_if2}=vhost_if2
-| |
-| | ${vhost_1}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock1}
-| | ${vhost_2}= | Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
+| | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
+| | ... | ${enable_gso}=${False}
+| |
+| | ${vhost_1}= | Vpp Create Vhost User Interface
+| | ... | ${dut_node} | ${sock1} | is_server=${is_server}
+| | ... | enable_gso=${enable_gso}
+| | ${vhost_2}= | Vpp Create Vhost User Interface
+| | ... | ${dut_node} | ${sock2} | is_server=${is_server}
+| | ... | enable_gso=${enable_gso}
 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
index bdb1964..b0fe5cf 100644 (file)
@@ -52,7 +52,8 @@
 | | ... | auto_scale=${auto_scale} | vnf=${vnf}
 | | ... | tg_if1_mac=${tg_if1_mac} | tg_if2_mac=${tg_if2_mac}
 | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr}
-| | ... | rxq_count_int=${rxq_count_int}
+| | ... | rxq_count_int=${rxq_count_int} | enable_csum=${False}
+| | ... | enable_gso=${False}
 | | Run Keyword | vnf_manager.Start All VMs | pinning=${pinning}
 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual
@@ -97,7 +98,8 @@
 | | ... | auto_scale=${auto_scale} | vnf=${vnf}
 | | ... | tg_if1_mac=${tg_if1_mac} | tg_if2_mac=${tg_if2_mac}
 | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr}
-| | ... | rxq_count_int=${rxq_count_int}
+| | ... | rxq_count_int=${rxq_count_int} | enable_csum=${False}
+| | ... | enable_gso=${False}
 | | Run Keyword | vnf_manager.Start All VMs | pinning=${pinning}
 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual