summaryrefslogtreecommitdiff
path: root/python/vyos/ethtool.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-29 23:10:31 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-30 21:38:44 +0200
commitf4c6697582ddc4b6546107c9d4040bcdadf55b44 (patch)
tree2176c6e916059451b2e3bbaca8c1cfb947ed0ef2 /python/vyos/ethtool.py
parent1c9db89970943bdb3f213741c5085537e3965fe1 (diff)
downloadvyos-1x-f4c6697582ddc4b6546107c9d4040bcdadf55b44.tar.gz
vyos-1x-f4c6697582ddc4b6546107c9d4040bcdadf55b44.zip
vyos.ethtool: T3163: prefix class internal data structures with _
(cherry picked from commit 324aa9598c7d90efc917a00447380f985553b657)
Diffstat (limited to 'python/vyos/ethtool.py')
-rw-r--r--python/vyos/ethtool.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index e2cd37726..25a116d09 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -19,7 +19,6 @@ class Ethtool:
"""
Class is used to retrive and cache information about an ethernet adapter
"""
-
# dictionary containing driver featurs, it will be populated on demand and
# the content will look like:
# {
@@ -32,8 +31,8 @@ class Ethtool:
# 'tx-checksumming': {'fixed': False, 'enabled': True},
# 'tx-esp-segmentation': {'fixed': True, 'enabled': False},
# }
- features = { }
- ring_buffers = { }
+ _features = { }
+ _ring_buffers = { }
def __init__(self, ifname):
# Now populate features dictionaty
@@ -45,7 +44,7 @@ class Ethtool:
fixed = bool('fixed' in value)
if fixed:
value = value.split()[0].strip()
- self.features[key.strip()] = {
+ self._features[key.strip()] = {
'enabled' : bool(value == 'on'),
'fixed' : fixed
}
@@ -61,22 +60,22 @@ class Ethtool:
# output format from 0 -> n/a. As we are only interested in the
# tx/rx keys we do not care about RX Mini/Jumbo.
if value.isdigit():
- self.ring_buffers[key] = int(value)
+ self._ring_buffers[key] = int(value)
def _get_generic(self, feature):
"""
- Generic method to read self.features and return a tuple for feature
+ Generic method to read self._features and return a tuple for feature
enabled and feature is fixed.
In case of a missing key, return "fixed = True and enabled = False"
"""
fixed = True
enabled = False
- if feature in self.features:
- if 'enabled' in self.features[feature]:
- enabled = self.features[feature]['enabled']
- if 'fixed' in self.features[feature]:
- fixed = self.features[feature]['fixed']
+ if feature in self._features:
+ if 'enabled' in self._features[feature]:
+ enabled = self._features[feature]['enabled']
+ if 'fixed' in self._features[feature]:
+ fixed = self._features[feature]['fixed']
return enabled, fixed
def get_generic_receive_offload(self):
@@ -103,9 +102,9 @@ class Ethtool:
def get_rx_buffer(self):
# Configuration of RX ring-buffers is not supported on every device,
# thus when it's impossible return None
- return self.ring_buffers.get('rx', None)
+ return self._ring_buffers.get('rx', None)
def get_tx_buffer(self):
# Configuration of TX ring-buffers is not supported on every device,
# thus when it's impossible return None
- return self.ring_buffers.get('tx', None)
+ return self._ring_buffers.get('tx', None)