summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-ethernet.py
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:24:14 +0100
commitd14d2f30ef592db14777228cb9d8f592f9d87d98 (patch)
tree05a29027c18854ba6c41a14cd4a0fcf0a62b6c08 /src/conf_mode/interfaces-ethernet.py
parentd5804b19d3ffecdd4fe6bd89d50ac84dabb549fd (diff)
downloadvyos-1x-d14d2f30ef592db14777228cb9d8f592f9d87d98.tar.gz
vyos-1x-d14d2f30ef592db14777228cb9d8f592f9d87d98.zip
ethernet: T3163: probe driver for maximum rx/tx ring-buffer size
(cherry picked from commit cf1156a60e1d03a752cde0baadbc9ac8118b2a52)
Diffstat (limited to 'src/conf_mode/interfaces-ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index e7f0cd6a5..e92c16eb6 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -30,6 +30,7 @@ from vyos.configverify import verify_mtu
from vyos.configverify import verify_mtu_ipv6
from vyos.configverify import verify_vlan_config
from vyos.configverify import verify_vrf
+from vyos.ethtool import Ethtool
from vyos.ifconfig import EthernetIf
from vyos.template import render
from vyos.util import call
@@ -80,6 +81,21 @@ def verify(ethernet):
if not os.path.exists(f'/sys/class/net/{ifname}/queues/rx-0/rps_cpus'):
raise ConfigError('Interface does not suport RPS!')
+ ethtool = Ethtool(ifname)
+ if 'ring_buffer' in ethernet:
+ max_rx = ethtool.get_rx_buffer()
+ max_tx = ethtool.get_tx_buffer()
+
+ rx = dict_search('ring_buffer.rx', ethernet)
+ if rx and int(rx) > int(max_rx):
+ raise ConfigError(f'Driver only supports a maximum RX ring-buffer '\
+ f'size of "{max_rx}" bytes!')
+
+ tx = dict_search('ring_buffer.tx', ethernet)
+ if tx and int(tx) > int(max_tx):
+ raise ConfigError(f'Driver only supports a maximum TX ring-buffer '\
+ f'size of "{max_tx}" bytes!')
+
# XDP requires multiple TX queues
if 'xdp' in ethernet:
queues = glob(f'/sys/class/net/{ifname}/queues/tx-*')