diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-12-20 15:22:05 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-12-20 15:22:05 +0100 |
commit | c8551d473b12c44b5bbb9d9e9d7921410eb55a5b (patch) | |
tree | 4eee4a744dcd749c00c64c4198191d6b50981d95 /src | |
parent | d60288741aab884d5a44f431682dd22ab52eefcd (diff) | |
download | vyos-1x-c8551d473b12c44b5bbb9d9e9d7921410eb55a5b.tar.gz vyos-1x-c8551d473b12c44b5bbb9d9e9d7921410eb55a5b.zip |
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
}
}
Diffstat (limited to 'src')
-rwxr-xr-x | src/migration-scripts/interfaces/17-to-18 | 36 |
1 files changed, 29 insertions, 7 deletions
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: |