aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/QemuUtils.py
diff options
context:
space:
mode:
authorMartin Balaz <martin.balaz@pantheon.tech>2020-08-03 11:14:49 +0200
committerPeter Mikus <pmikus@cisco.com>2020-10-29 08:06:19 +0000
commit1be82a8542da6764f4ec8562cbcece0c65c8173a (patch)
tree1f6e39befd81c37bbb7a2caa882b0606008a4b93 /resources/libraries/python/QemuUtils.py
parentb9aabb97bb10297ce004f731b7b61b9dc9c83ee6 (diff)
tests: Add GSO enabled tests
Change-Id: I409b060f64ae7c6787448ae519fd76d8384e9ffb Signed-off-by: Martin Balaz <martin.balaz@pantheon.tech>
Diffstat (limited to 'resources/libraries/python/QemuUtils.py')
-rw-r--r--resources/libraries/python/QemuUtils.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py
index 7491c71021..c215dfd96f 100644
--- a/resources/libraries/python/QemuUtils.py
+++ b/resources/libraries/python/QemuUtils.py
@@ -27,6 +27,8 @@ from resources.libraries.python.DUTSetup import DUTSetup
from resources.libraries.python.OptionString import OptionString
from resources.libraries.python.ssh import exec_cmd, exec_cmd_no_error
from resources.libraries.python.topology import NodeType, Topology
+from resources.libraries.python.VhostUser import VirtioFeaturesFlags
+from resources.libraries.python.VhostUser import VirtioFeatureMask
from resources.libraries.python.VppConfigGenerator import VppConfigGenerator
__all__ = [u"QemuUtils"]
@@ -219,7 +221,7 @@ class QemuUtils:
def add_vhost_user_if(
self, socket, server=True, jumbo_frames=False, queue_size=None,
- queues=1, csum=False, gso=False):
+ queues=1, virtio_feature_mask=None):
"""Add Vhost-user interface.
:param socket: Path of the unix socket.
@@ -227,15 +229,13 @@ 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.
+ :param virtio_feature_mask: Mask of virtio features to be enabled.
:type socket: str
:type server: bool
:type jumbo_frames: bool
:type queue_size: int
:type queues: int
- :type csum: bool
- :type gso: bool
+ :type virtio_feature_mask: int
"""
self._nic_id += 1
self._params.add_with_value(
@@ -250,6 +250,14 @@ class QemuUtils:
f"{self._nic_id:02x}"
queue_size = f"rx_queue_size={queue_size},tx_queue_size={queue_size}" \
if queue_size else u""
+ if virtio_feature_mask is None:
+ gso = False
+ csum = False
+ else:
+ gso = VirtioFeatureMask.is_feature_enabled(
+ virtio_feature_mask, VirtioFeaturesFlags.VIRTIO_NET_F_API_GSO)
+ csum = VirtioFeatureMask.is_feature_enabled(
+ virtio_feature_mask, VirtioFeaturesFlags.VIRTIO_NET_F_API_CSUM)
self._params.add_with_value(
u"device", f"virtio-net-pci,netdev=vhost{self._nic_id},mac={mac},"
f"addr={self._nic_id+5}.0,mq=on,vectors={2 * queues + 2},"