From 2414c156cc21bfe51b65f8726f186c55b533bb97 Mon Sep 17 00:00:00 2001 From: Nataliia Solomko Date: Mon, 16 Feb 2026 16:53:29 +0200 Subject: vpp: T8268: Unify CPU settings into a single 'cpu-cores' node under 'resource-allocation' Replace legacy VPP CPU settings (main-core, skip-cores, workers, corelist-workers) with a single resource-allocation cpu-cores option. CPU assignment is now handled automatically: two cores are reserved for the system, the VPP main thread is placed on the first available core, and the remaining allocated cores are used as workers. This simplifies configuration and ensures consistent CPU allocation. --- src/migration-scripts/vpp/7-to-8 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/migration-scripts') diff --git a/src/migration-scripts/vpp/7-to-8 b/src/migration-scripts/vpp/7-to-8 index fa105a6b5..0b2f81b4c 100644 --- a/src/migration-scripts/vpp/7-to-8 +++ b/src/migration-scripts/vpp/7-to-8 @@ -20,6 +20,8 @@ # Drop settings for nat workers (T8254) # # Delete 'ipsec' node and all settings and replace it with single 'ipsec-acceleration' flag (T8262) +# +# Unify CPU settings into a single 'cpu-cores' node under 'resource-allocation' (T8268) from vyos.configtree import ConfigTree @@ -71,6 +73,38 @@ def _migrate_vpp_ipsec(config: ConfigTree) -> None: config.set(base + ['ipsec-acceleration']) config.delete(base + ['ipsec']) +def _migrate_vpp_cpu(config: ConfigTree) -> None: + settings_path = ['vpp', 'settings'] + cpu_path = settings_path + ['cpu'] + + if not config.exists(cpu_path): + # Nothing to do + return + + # get number of configured workers + workers = 0 + + if config.exists(cpu_path + ['workers']): + workers += int(config.return_value(cpu_path + ['workers'])) + # add main-core to total workers + workers += 1 + + if config.exists(cpu_path + ['corelist-workers']): + def _count_range(item: str) -> int: + if '-' in item: + start, end = map(int, item.split('-')) + return end - start + 1 + return 1 + + tmp = config.return_values(cpu_path + ['corelist-workers']) + workers = sum(_count_range(item) for item in tmp) + 1 # + main core + + # set 'resource-allocation cpu-cores' + if workers: + config.set(settings_path + ['resource-allocation', 'cpu-cores'], value=str(workers)) + + config.delete(cpu_path) + def migrate(config: ConfigTree) -> None: if not config.exists(['vpp']): @@ -81,3 +115,4 @@ def migrate(config: ConfigTree) -> None: _migrate_vpp_log(config) _migrate_vpp_nat44(config) _migrate_vpp_ipsec(config) + _migrate_vpp_cpu(config) -- cgit v1.2.3