diff options
| author | Kyle McClammy <kylem@serverforge.org> | 2026-08-03 17:08:40 -0400 |
|---|---|---|
| committer | Kyle McClammy <kylem@serverforge.org> | 2026-08-11 18:49:17 -0400 |
| commit | 47ce1c8e1df6382f6aa400d2bc55038adc63dfa0 (patch) | |
| tree | f5d7197727521a07f490845c77bcfbd725a253ab /python | |
| parent | dd2673bf9ad36ea7ecb6998b71f318516b95e8d8 (diff) | |
| download | vyos-1x-47ce1c8e1df6382f6aa400d2bc55038adc63dfa0.tar.gz vyos-1x-47ce1c8e1df6382f6aa400d2bc55038adc63dfa0.zip | |
interfaces: T9158: add rx offload option
Add support for receive checksum offload on ethernet interfaces.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ethtool.py | 3 | ||||
| -rw-r--r-- | python/vyos/ifconfig/ethernet.py | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py index 85e228ede..660995632 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) |
