Skip to content

Commit

Permalink
T6716: don't automatically set ethernet offload
Browse files Browse the repository at this point in the history
Remove the lines of code that checked if the kernel had offloading
enabled and was then forcing the config to set it to "on." The
behavior now mirrors the config and offloading will only be enabled
if the config is explicitly set to enabled.

Note: the code is still present to disable the offloading, in the
config, if the kernel doesn't support it.

Note(2): Allow the previous behavior where the offload settings get set,
based on the Kernel, if the boot is a live boot.

(cherry picked from commit b6c2a74)
  • Loading branch information
Dave Vogel authored and mergify[bot] committed Sep 17, 2024
1 parent 787f8c4 commit 778c7cb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/activation-scripts/20-ethernet_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
# CLI. See https://vyos.dev/T3619#102254 for all the details.
# T3787: Remove deprecated UDP fragmentation offloading option
# T6006: add to activation-scripts: migration-scripts/interfaces/20-to-21
# T6716: Honor the configured offload settings and don't automatically add
# them to the config if the kernel has them set (unless its a live boot)

from vyos.ethtool import Ethtool
from vyos.configtree import ConfigTree
from vyos.system.image import is_live_boot

def activate(config: ConfigTree):
base = ['interfaces', 'ethernet']
Expand All @@ -36,7 +39,7 @@ def activate(config: ConfigTree):
enabled, fixed = eth.get_generic_receive_offload()
if configured and fixed:
config.delete(base + [ifname, 'offload', 'gro'])
elif enabled and not fixed:
elif is_live_boot() and enabled and not fixed:
config.set(base + [ifname, 'offload', 'gro'])

# If GSO is enabled by the Kernel - we reflect this on the CLI. If GSO is
Expand All @@ -45,7 +48,7 @@ def activate(config: ConfigTree):
enabled, fixed = eth.get_generic_segmentation_offload()
if configured and fixed:
config.delete(base + [ifname, 'offload', 'gso'])
elif enabled and not fixed:
elif is_live_boot() and enabled and not fixed:
config.set(base + [ifname, 'offload', 'gso'])

# If LRO is enabled by the Kernel - we reflect this on the CLI. If LRO is
Expand All @@ -54,7 +57,7 @@ def activate(config: ConfigTree):
enabled, fixed = eth.get_large_receive_offload()
if configured and fixed:
config.delete(base + [ifname, 'offload', 'lro'])
elif enabled and not fixed:
elif is_live_boot() and enabled and not fixed:
config.set(base + [ifname, 'offload', 'lro'])

# If SG is enabled by the Kernel - we reflect this on the CLI. If SG is
Expand All @@ -63,7 +66,7 @@ def activate(config: ConfigTree):
enabled, fixed = eth.get_scatter_gather()
if configured and fixed:
config.delete(base + [ifname, 'offload', 'sg'])
elif enabled and not fixed:
elif is_live_boot() and enabled and not fixed:
config.set(base + [ifname, 'offload', 'sg'])

# If TSO is enabled by the Kernel - we reflect this on the CLI. If TSO is
Expand All @@ -72,7 +75,7 @@ def activate(config: ConfigTree):
enabled, fixed = eth.get_tcp_segmentation_offload()
if configured and fixed:
config.delete(base + [ifname, 'offload', 'tso'])
elif enabled and not fixed:
elif is_live_boot() and enabled and not fixed:
config.set(base + [ifname, 'offload', 'tso'])

# Remove deprecated UDP fragmentation offloading option
Expand Down

0 comments on commit 778c7cb

Please sign in to comment.