Thu, Jun 13, 2019 at 11:50:04AM CEST, olichtne(a)redhat.com wrote:
On Thu, Jun 13, 2019 at 11:42:28AM +0200, Jan Tluka wrote:
> Tue, Jun 11, 2019 at 11:33:20AM CEST, olichtne(a)redhat.com wrote:
> >From: Ondrej Lichtner <olichtne(a)redhat.com>
> >
> >The OffloadSubConfigMixin is an EnrtBaseRecipe subconfiguration mixin
> >class implementing the offload subconfiguration looping. This includes
> >generating, applying, removing and describing the subconfiguration.
> >
> >It also includes overriding the default perf test flow generation loop
> >so that certain test configurations are ignored when certain offloads
> >are configured.
> >
> >Enabling this mixin for the SimplePerfRecipe means simply adding it as a
> >base class and defining the required property 'offload_nics' indicating
> >which devices should the offload configuration be done for.
> >
> >Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
> >---
> > .../ConfigMixins/OffloadSubConfigMixin.py | 103 ++++++++++++++++++
> > lnst/Recipes/ENRT/SimplePerfRecipe.py | 13 ++-
> > 2 files changed, 115 insertions(+), 1 deletion(-)
> > create mode 100644 lnst/Recipes/ENRT/ConfigMixins/OffloadSubConfigMixin.py
> >
> >diff --git a/lnst/Recipes/ENRT/ConfigMixins/OffloadSubConfigMixin.py
b/lnst/Recipes/ENRT/ConfigMixins/OffloadSubConfigMixin.py
> >new file mode 100644
> >index 0000000..f50a165
> >--- /dev/null
> >+++ b/lnst/Recipes/ENRT/ConfigMixins/OffloadSubConfigMixin.py
> >@@ -0,0 +1,103 @@
> >+import copy
> >+
> >+from lnst.Common.Parameters import Param
> >+from lnst.Controller.RecipeResults import ResultLevel
> >+from lnst.Recipes.ENRT.ConfigMixins.BaseSubConfigMixin import
BaseSubConfigMixin
> >+
> >+
> >+class OffloadSubConfigMixin(BaseSubConfigMixin):
> >+ offload_combinations = Param(
> >+ default=(dict(gro="on", gso="on",
tso="on", tx="on", rx="on"),)
> >+ )
> >+
> >+ @property
> >+ def offload_nics(self):
> >+ raise NotImplementedError("Subclass must implement this
property")
> >+
> >+ def generate_sub_configurations(self, config):
> >+ for parent_config in super().generate_sub_configurations(config):
> >+ for offload_settings in self.params.offload_combinations:
> >+ new_config = copy.copy(config)
> >+ new_config.offload_settings = offload_settings
> >+
> >+ yield new_config
> >+
> >+ def apply_sub_configuration(self, config):
> >+ super().apply_sub_configuration(config)
> >+
> >+ offload_settings = getattr(config, "offload_settings", None)
> >+ if offload_settings:
> >+ ethtool_offload_string = ""
> >+ for name, value in list(offload_settings.items()):
> >+ ethtool_offload_string += " %s %s" % (name, value)
> >+
> >+ for nic in self.offload_nics:
> >+ if "sctp_stream" in self.params.perf_tests:
> >+ nic.netns.run(
> >+ "iptables -I OUTPUT ! -o %s -p sctp -j DROP" %
nic.name,
> >+ job_level=ResultLevel.NORMAL,
> >+ )
>
> Just a comment that we should move this to a different place.
>
> J.
>
The firewall configuration in case sctp is to be tested?
Yes I meant firewall configuration, but this can be done in a followup patch.
>Agreed, I'd say it should only really be applied for the specific
>sctp_stream instead of being part of the sub configuration which affects
>all other stream types as well.
>
>-Ondrej