From e780d08fcb20c11a8884f7622d12f449cd774c21 Mon Sep 17 00:00:00 2001 From: Jan Tluka Date: Thu, 12 Sep 2024 16:19:46 +0200 Subject: [PATCH] Recipes/ENRT/UseVfsMixin.py: add vf_trust parameter Allows user to set trust mode on created VFs. Signed-off-by: Jan Tluka --- lnst/Recipes/ENRT/UseVfsMixin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lnst/Recipes/ENRT/UseVfsMixin.py b/lnst/Recipes/ENRT/UseVfsMixin.py index 5fd5ea450..871479e8b 100644 --- a/lnst/Recipes/ENRT/UseVfsMixin.py +++ b/lnst/Recipes/ENRT/UseVfsMixin.py @@ -1,4 +1,4 @@ -from lnst.Common.Parameters import BoolParam +from lnst.Common.Parameters import BoolParam, ChoiceParam from lnst.Controller.Requirements import DeviceReq from lnst.Recipes.ENRT.SRIOVDevices import SRIOVDevices @@ -12,11 +12,16 @@ class UseVfsMixin: with VF Device instances. This allows user to interact with the network interfaces without additional changes to the code of recipe. + Mixin provides two boolean parameters: + * use_vfs - main parameter to enable or disable (default) use of VFs + * vf_trust - set the trust parameter of the used VFs, 'on' or 'off' (default) + There are some limitations, for example pause frames cannot be configured since the VF do not support these. """ use_vfs = BoolParam(default=False) + vf_trust = ChoiceParam(choices={'on', 'off'}, default='off') def test_wide_configuration(self): config = super().test_wide_configuration() @@ -33,6 +38,8 @@ def test_wide_configuration(self): for dev_name in dev_names: dev = getattr(host, dev_name) sriov_devices = SRIOVDevices(dev, 1) + dev.vf_trust(0, self.params.vf_trust) + vf_dev = sriov_devices.vfs[0] host.map_device(dev_name, {"ifname": vf_dev.name}) @@ -56,7 +63,7 @@ def generate_test_wide_description(self, config): if self.params.use_vfs: description += [ - f"Using vf device {vf_dev.name} of pf {sriov_devices.phys_dev.name} for DeviceReq {host.hostid}.{vf_dev._id}" + f"Using vf device {vf_dev.name} of pf {sriov_devices.phys_dev.name} for DeviceReq {host.hostid}.{vf_dev._id} trusted={self.params.vf_trust}" for host, sriov_devices_list in config.vf_config.items() for sriov_devices in sriov_devices_list for vf_dev in sriov_devices.vfs