summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/ethernet.py
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2021-06-17 19:50:19 +0000
committerChristian Poessinger <christian@poessinger.com>2021-06-19 08:35:01 +0200
commit9102d8ef1a5913f29602ac6aadfb3979e48ae271 (patch)
tree28a8424cf1aba0f6120d81480986216aa4ea006e /python/vyos/ifconfig/ethernet.py
parent97237c8178b8375cf1e51341ea32e517618558c0 (diff)
downloadvyos-1x-9102d8ef1a5913f29602ac6aadfb3979e48ae271.tar.gz
vyos-1x-9102d8ef1a5913f29602ac6aadfb3979e48ae271.zip
ethernet: T3633: Add LRO offload
(cherry picked from commit 4b2fef88644bb75dadbe33b9638a4150def7e14f)
Diffstat (limited to 'python/vyos/ifconfig/ethernet.py')
-rw-r--r--python/vyos/ifconfig/ethernet.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 186a2d094..aa7da35d5 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -58,6 +58,11 @@ class EthernetIf(Interface):
'possible': lambda i, v: EthernetIf.feature(i, 'gso', v),
# 'shellcmd': 'ethtool -K {ifname} gso {value}',
},
+ 'lro': {
+ 'validate': lambda v: assert_list(v, ['on', 'off']),
+ 'possible': lambda i, v: EthernetIf.feature(i, 'lro', v),
+ # 'shellcmd': 'ethtool -K {ifname} lro {value}',
+ },
'sg': {
'validate': lambda v: assert_list(v, ['on', 'off']),
'possible': lambda i, v: EthernetIf.feature(i, 'sg', v),
@@ -241,6 +246,18 @@ class EthernetIf(Interface):
raise ValueError("Value out of range")
return self.set_interface('gso', 'on' if state else 'off')
+ def set_lro(self, state):
+ """
+ Enable Large Receive offload. State can be either True or False.
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_lro(True)
+ """
+ if not isinstance(state, bool):
+ raise ValueError("Value out of range")
+ return self.set_interface('lro', 'on' if state else 'off')
+
def set_rps(self, state):
if not isinstance(state, bool):
raise ValueError("Value out of range")
@@ -331,6 +348,9 @@ class EthernetIf(Interface):
# GSO (generic segmentation offload)
self.set_gso(dict_search('offload.gso', config) != None)
+ # LRO (large receive offload)
+ self.set_lro(dict_search('offload.lro', config) != None)
+
# RPS - Receive Packet Steering
self.set_rps(dict_search('offload.rps', config) != None)