[prev in list] [next in list] [prev in thread] [next in thread]
List: lnst-developers
Subject: [PATCH v3 07/12] Recipes.ENRT.ConfigMixins.PauseFramesHWConfigMixin: configure pause frames through
From: Jan Tluka <jtluka () redhat ! com>
Date: 2020-05-14 13:08:49
Message-ID: 20200514130854.32057-7-jtluka () redhat ! com
[Download RAW message or body]
The mixin now allows to configure any pause frames configuration
instead of a single option to turn them off.
For example, to turn the pause frames off:
from lnst.Recipes.ENRT import SimpleNetworkRecipe
recipe = SimpleNetworkRecipe(
rx_pause_frames=False,
tx_pause_frames=False,
)
v3:
* keep and adjust the hw_deconfig() method
Signed-off-by: Jan Tluka <jtluka@redhat.com>
---
lnst/Recipes/ENRT/BondRecipe.py | 2 +-
.../ConfigMixins/PauseFramesHWConfigMixin.py | 43 ++++++++++++-------
lnst/Recipes/ENRT/SimpleNetworkRecipe.py | 2 +-
3 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/lnst/Recipes/ENRT/BondRecipe.py b/lnst/Recipes/ENRT/BondRecipe.py
index 2d8c71ac..620a0f4b 100644
--- a/lnst/Recipes/ENRT/BondRecipe.py
+++ b/lnst/Recipes/ENRT/BondRecipe.py
@@ -241,7 +241,7 @@ class BondRecipe(CommonHWSubConfigMixin, OffloadSubConfigMixin,
self.matched.host2.eth0]
@property
- def no_pause_frames_dev_list(self):
+ def pause_frames_dev_list(self):
"""
The `parallel_stream_qdisc_hw_config_dev_list` property value for this
scenario is a list containing the matched physical devices used to create
diff --git a/lnst/Recipes/ENRT/ConfigMixins/PauseFramesHWConfigMixin.py \
b/lnst/Recipes/ENRT/ConfigMixins/PauseFramesHWConfigMixin.py index 74a1d348..389a5426 \
100644
--- a/lnst/Recipes/ENRT/ConfigMixins/PauseFramesHWConfigMixin.py
+++ b/lnst/Recipes/ENRT/ConfigMixins/PauseFramesHWConfigMixin.py
@@ -1,41 +1,54 @@
from time import sleep
+from lnst.Common.Parameters import BoolParam
from lnst.Recipes.ENRT.ConfigMixins.BaseHWConfigMixin import BaseHWConfigMixin
class PauseFramesHWConfigMixin(BaseHWConfigMixin):
"""
- This class is an extension to the :any:`BaseEnrtRecipe` class to turn off
+ This class is an extension to the :any:`BaseEnrtRecipe` class to configure
the Ethernet pause frames on the devices defined by
- the :attr:`no_pause_frames_dev_list` property.
+ the :attr:`pause_frames_dev_list` property.
"""
+ rx_pause_frames = BoolParam(mandatory=False)
+ tx_pause_frames = BoolParam(mandatory=False)
+
@property
- def no_pause_frames_dev_list(self):
+ def pause_frames_dev_list(self):
"""
The value of this property is a list of devices for which the pause
- frames should be disabled. It has to be defined by a derived class.
+ frames should be configured. It has to be defined by a derived class.
"""
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))
+ for param in ["rx_pause_frames", "tx_pause_frames"]:
+ param_value = getattr(self.params, param, None)
+ if param_value is not None:
+ self._configure_dev_attribute(
+ config,
+ self.pause_frames_dev_list,
+ param,
+ param_value
+ )
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))
+ for param in ["rx_pause_frames", "tx_pause_frames"]:
+ self._deconfigure_dev_attribute(
+ config,
+ self.pause_frames_dev_list,
+ param
+ )
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
- )
- ]
+ for param in ["rx_pause_frames", "tx_pause_frames"]:
+ desc.extend(
+ self._describe_dev_attribute(config, param)
+ )
+
return desc
diff --git a/lnst/Recipes/ENRT/SimpleNetworkRecipe.py \
b/lnst/Recipes/ENRT/SimpleNetworkRecipe.py index 508afdc0..506cbdaa 100644
--- a/lnst/Recipes/ENRT/SimpleNetworkRecipe.py
+++ b/lnst/Recipes/ENRT/SimpleNetworkRecipe.py
@@ -112,7 +112,7 @@ class SimpleNetworkRecipe(
return [(self.matched.host1.eth0, self.matched.host2.eth0)]
@property
- def no_pause_frames_dev_list(self):
+ def pause_frames_dev_list(self):
return [self.matched.host1.eth0, self.matched.host2.eth0]
@property
--
2.21.1
_______________________________________________
LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahosted.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic