From: Ondrej Lichtner <olichtne(a)redhat.com>
We've historically been disabling pause frames at the start of device
configuration by default. This functionality was skipped when
implementing lnst-next since it shouldn't be the default behaviour of
Device configuration classes and was forgotten when implementing the
ENRT recipes.
This commit adds a new hw config mixin and adds it to the list of
CommonHWSubConfigMixins.
We also enable the use of the mixin by the SimpleNetworkRecipe class by
defining the list of devices to disable pause frames on.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
v2: fixed confirmation command which doesn't accept additional
parameters
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
.../ConfigMixins/CommonHWSubConfigMixin.py | 4 +++
.../DisablePauseFramesHWConfigMixin.py | 31 +++++++++++++++++++
lnst/Recipes/ENRT/SimpleNetworkRecipe.py | 4 +++
3 files changed, 39 insertions(+)
create mode 100644 lnst/Recipes/ENRT/ConfigMixins/DisablePauseFramesHWConfigMixin.py
diff --git a/lnst/Recipes/ENRT/ConfigMixins/CommonHWSubConfigMixin.py b/lnst/Recipes/ENRT/ConfigMixins/CommonHWSubConfigMixin.py
index fdb5878..c73f8ea 100644
--- a/lnst/Recipes/ENRT/ConfigMixins/CommonHWSubConfigMixin.py
+++ b/lnst/Recipes/ENRT/ConfigMixins/CommonHWSubConfigMixin.py
@@ -8,10 +8,14 @@
CoalescingHWConfigMixin,
)
from lnst.Recipes.ENRT.ConfigMixins.MTUHWConfigMixin import MTUHWConfigMixin
+from lnst.Recipes.ENRT.ConfigMixins.DisablePauseFramesHWConfigMixin import (
+ DisablePauseFramesHWConfigMixin,
+)
from lnst.Recipes.ENRT.ConfigMixins.BaseSubConfigMixin import BaseSubConfigMixin
class CommonHWSubConfigMixin(
+ DisablePauseFramesHWConfigMixin,
ParallelStreamQDiscHWConfigMixin,
DevInterruptHWConfigMixin,
CoalescingHWConfigMixin,
diff --git a/lnst/Recipes/ENRT/ConfigMixins/DisablePauseFramesHWConfigMixin.py b/lnst/Recipes/ENRT/ConfigMixins/DisablePauseFramesHWConfigMixin.py
new file mode 100644
index 0000000..72857cf
--- /dev/null
+++ b/lnst/Recipes/ENRT/ConfigMixins/DisablePauseFramesHWConfigMixin.py
@@ -0,0 +1,31 @@
+from time import sleep
+from lnst.Recipes.ENRT.ConfigMixins.BaseHWConfigMixin import BaseHWConfigMixin
+
+
+class DisablePauseFramesHWConfigMixin(BaseHWConfigMixin):
+ @property
+ def no_pause_frames_dev_list(self):
+ return []
+
+ def hw_config(self, config):
+ super().hw_config(config)
+
+ for dev in self.no_pause_frames_dev_list:
+ dev.host.run("ethtool -A {} rx off tx off".format(dev.name))
+ sleep(1)
+ dev.host.run("ethtool -a {}".format(dev.name))
+
+ def hw_deconfig(self, config):
+ for dev in self.no_pause_frames_dev_list:
+ dev.host.run("ethtool -A {} rx on tx on".format(dev.name))
+
+ super().hw_deconfig(config)
+
+ def describe_hw_config(self, config):
+ desc = super().describe_hw_config(config)
+ desc += [
+ "Pause frames disabled for: {}".format(
+ self.no_pause_frames_dev_list
+ )
+ ]
+ return desc
diff --git a/lnst/Recipes/ENRT/SimpleNetworkRecipe.py b/lnst/Recipes/ENRT/SimpleNetworkRecipe.py
index a378c3a..911a996 100644
--- a/lnst/Recipes/ENRT/SimpleNetworkRecipe.py
+++ b/lnst/Recipes/ENRT/SimpleNetworkRecipe.py
@@ -69,6 +69,10 @@ def condition():
self.ctl.wait_for_condition(condition, timeout=5)
+ @property
+ def no_pause_frames_dev_list(self):
+ return [self.matched.host1.eth0, self.matched.host2.eth0]
+
@property
def offload_nics(self):
return [self.matched.host1.eth0, self.matched.host2.eth0]
--
2.23.0