summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-21 18:22:04 +0100
committerChristian Poessinger <christian@poessinger.com>2021-02-21 18:22:04 +0100
commitcf1156a60e1d03a752cde0baadbc9ac8118b2a52 (patch)
tree85e03cc6cd2283e6c9748ca5c3e8e71ad48b3d2a /python
parent65adcc1d80d06e0e76387de0b0c5c9d6c79d8f99 (diff)
downloadvyos-1x-cf1156a60e1d03a752cde0baadbc9ac8118b2a52.tar.gz
vyos-1x-cf1156a60e1d03a752cde0baadbc9ac8118b2a52.zip
ethernet: T3163: probe driver for maximum rx/tx ring-buffer size
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ethtool.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index e8a339d2f..cef7d476f 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -33,6 +33,7 @@ class Ethtool:
# 'tx-esp-segmentation': {'fixed': True, 'on': False},
# }
features = { }
+ ring_buffers = { }
def __init__(self, ifname):
# Now populate features dictionaty
@@ -49,6 +50,16 @@ class Ethtool:
"fixed": fixed
}
+ tmp = cmd(f'ethtool -g {ifname}')
+ # We are only interested in line 2-5 which contains the device maximum
+ # ringbuffers
+ for line in tmp.splitlines()[2:6]:
+ if ':' in line:
+ key, value = [s.strip() for s in line.strip().split(":", 1)]
+ key = key.lower().replace(' ', '_')
+ self.ring_buffers[key] = int(value)
+
+
def is_fixed_lro(self):
# in case of a missing configuration, rather return "fixed". In Ethtool
# terminology "fixed" means the setting can not be changed by the user.
@@ -78,3 +89,13 @@ class Ethtool:
# in case of a missing configuration, rather return "fixed". In Ethtool
# terminology "fixed" means the setting can not be changed by the user.
return self.features.get('udp-fragmentation-offload', True).get('fixed', True)
+
+ def get_rx_buffer(self):
+ # in case of a missing configuration rather return a "small"
+ # buffer of only 512 bytes.
+ return self.ring_buffers.get('rx', '512')
+
+ def get_tx_buffer(self):
+ # in case of a missing configuration rather return a "small"
+ # buffer of only 512 bytes.
+ return self.ring_buffers.get('tx', '512')