From c8551d473b12c44b5bbb9d9e9d7921410eb55a5b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 20 Dec 2020 15:22:05 +0100 Subject: ethernet: T3140: relax "ethernet offload-options" CLI definition Migrate from ethernet eth1 { offload-options { generic-receive on generic-segmentation on scatter-gather on tcp-segmentation on udp-fragmentation on } } to ethernet eth1 { offload { ufo tso sg gso gro } } --- src/migration-scripts/interfaces/17-to-18 | 36 +++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/migration-scripts/interfaces') diff --git a/src/migration-scripts/interfaces/17-to-18 b/src/migration-scripts/interfaces/17-to-18 index c382a7e85..b8cb8c119 100755 --- a/src/migration-scripts/interfaces/17-to-18 +++ b/src/migration-scripts/interfaces/17-to-18 @@ -16,6 +16,7 @@ # T3043: Move "system wifi-regulatory-domain" to indicidual wireless interface. # Country Code will be migratred from upper to lower case. +# T3140: Relax ethernet interface offload-options from sys import exit, argv from vyos.configtree import ConfigTree @@ -31,15 +32,36 @@ if __name__ == '__main__': config = ConfigTree(config_file) - # T3043: WIFI country-code should be lower-case - wifi_base = ['interfaces', 'wireless'] - for wifi in config.list_nodes(wifi_base): - ccode = wifi_base + [wifi, 'country-code'] - if config.exists(ccode): - tmp = config.return_value(ccode) - config.set(ccode, value=tmp.lower(), replace=True) + # T3140: Cleanup ethernet offload-options, remove on/off value and use + # valueless nodes instead. + eth_base = ['interfaces', 'ethernet'] + if config.exists(eth_base): + for eth in config.list_nodes(eth_base): + offload = eth_base + [eth, 'offload-options'] + if config.exists(offload): + mapping = { + 'generic-receive' : 'gro', + 'generic-segmentation' : 'gso', + 'scatter-gather' : 'sg', + 'tcp-segmentation' : 'tso', + 'udp-fragmentation' : 'ufo', + } + for k, v in mapping.items(): + if config.exists(offload + [k]): + tmp = config.return_value(offload + [k]) + if tmp == 'on': + config.set(eth_base + [eth, 'offload', v]) + config.delete(offload) + # T3043: WIFI country-code should be lower-case + wifi_base = ['interfaces', 'wireless'] + if config.exists(wifi_base): + for wifi in config.list_nodes(wifi_base): + ccode = wifi_base + [wifi, 'country-code'] + if config.exists(ccode): + tmp = config.return_value(ccode) + config.set(ccode, value=tmp.lower(), replace=True) try: with open(file_name, 'w') as f: -- cgit v1.2.3