summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-15 16:40:44 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-20 21:28:53 +0200
commitb53006d672ba008387bd3e3552070c30a4dca657 (patch)
tree21d854ad196aa3218e30612361633a16418405e0 /python
parent1df0c00879f21dcbb87bdf09291b0c74779e77cb (diff)
downloadvyos-1x-b53006d672ba008387bd3e3552070c30a4dca657.tar.gz
vyos-1x-b53006d672ba008387bd3e3552070c30a4dca657.zip
Python/ifconfig: T1557: ethernet: add offloading interfaces
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index d73e2d43e..777b185a6 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -1211,6 +1211,76 @@ class EthernetIf(VLANIf):
return self._cmd(cmd)
+ def set_gro(self, state):
+ """
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_gro('on')
+ """
+ if state not in ['on', 'off']:
+ raise ValueError('state must be "on" or "off"')
+
+ cmd = '/sbin/ethtool -K {} gro {}'.format(self._ifname, state)
+ return self._cmd(cmd)
+
+
+ def set_gso(self, state):
+ """
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_gso('on')
+ """
+ if state not in ['on', 'off']:
+ raise ValueError('state must be "on" or "off"')
+
+ cmd = '/sbin/ethtool -K {} gso {}'.format(self._ifname, state)
+ return self._cmd(cmd)
+
+
+ def set_sg(self, state):
+ """
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_sg('on')
+ """
+ if state not in ['on', 'off']:
+ raise ValueError('state must be "on" or "off"')
+
+ cmd = '/sbin/ethtool -K {} sg {}'.format(self._ifname, state)
+ return self._cmd(cmd)
+
+
+ def set_tso(self, state):
+ """
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_tso('on')
+ """
+ if state not in ['on', 'off']:
+ raise ValueError('state must be "on" or "off"')
+
+ cmd = '/sbin/ethtool -K {} tso {}'.format(self._ifname, state)
+ return self._cmd(cmd)
+
+
+ def set_ufo(self, state):
+ """
+ Example:
+ >>> from vyos.ifconfig import EthernetIf
+ >>> i = EthernetIf('eth0')
+ >>> i.set_udp_offload('on')
+ """
+ if state not in ['on', 'off']:
+ raise ValueError('state must be "on" or "off"')
+
+ cmd = '/sbin/ethtool -K {} ufo {}'.format(self._ifname, state)
+ return self._cmd(cmd)
+
+
class BondIf(VLANIf):
"""
The Linux bonding driver provides a method for aggregating multiple network