summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-08-19 07:37:13 +0200
committerGitHub <noreply@github.com>2026-08-19 07:37:13 +0200
commit6fb116ccbe0b7d4ec889244ce5e820c0704c00eb (patch)
treec6d9f489dfc3a7b11795cb2df0ca39937e701564 /python
parentfb4317a143c6d58d5a2497b0f206554d5a9d7b0a (diff)
parent47ce1c8e1df6382f6aa400d2bc55038adc63dfa0 (diff)
downloadvyos-1x-6fb116ccbe0b7d4ec889244ce5e820c0704c00eb.tar.gz
vyos-1x-6fb116ccbe0b7d4ec889244ce5e820c0704c00eb.zip
Merge pull request #5373 from ServerForge/rolling
interfaces: T9158: add option to enable/disable rx offload
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ethtool.py3
-rw-r--r--python/vyos/ifconfig/ethernet.py24
2 files changed, 27 insertions, 0 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py
index 688fa3249..cbc13a0e9 100644
--- a/python/vyos/ethtool.py
+++ b/python/vyos/ethtool.py
@@ -159,6 +159,9 @@ class Ethtool:
fixed = bool(self._features[feature]['fixed'])
return active, fixed
+ def get_rx_checksumming(self):
+ return self._get_generic('rx-checksumming')
+
def get_generic_receive_offload(self):
return self._get_generic('generic-receive-offload')
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index b7b7b12f7..84c002550 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -58,6 +58,10 @@ class EthernetIf(Interface):
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'gro', v),
},
+ 'rx': {
+ 'validate': lambda v: assert_list(v, ['on', 'off']),
+ 'possible': lambda i, v: EthernetIf.feature(i, 'rx', v),
+ },
'gso': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'gso', v),
@@ -105,6 +109,7 @@ class EthernetIf(Interface):
'offload.lro',
'offload.rfs',
'offload.rps',
+ 'offload.rx',
'offload.sg',
'offload.tso',
'redirect',
@@ -274,6 +279,22 @@ class EthernetIf(Interface):
)
return False
+ def set_rx(self, state):
+ """
+ Enable/Disable Receive Checksum Offload.
+ State can be either True or False.
+ """
+ if not isinstance(state, bool):
+ raise ValueError('Value out of range')
+
+ enabled, fixed = self.ethtool.get_rx_checksumming()
+ if enabled != state:
+ if not fixed:
+ return self.set_interface('rx', 'on' if state else 'off')
+ else:
+ print('Adapter does not support changing rx-checksumming settings!')
+ return False
+
def set_gso(self, state):
"""
Enable Generic Segmentation offload. State can be either True or False.
@@ -577,6 +598,9 @@ class EthernetIf(Interface):
# RFS - Receive Flow Steering
self.set_rfs(dict_search('offload.rfs', config) is not None)
+ # RX (receive checksum offload)
+ self.set_rx(dict_search('offload.rx', config) is not None)
+
# scatter-gather option
self.set_sg(dict_search('offload.sg', config) is not None)