diff --git a/interface-definitions/include/vpp_host_resources.xml.i b/interface-definitions/include/vpp_host_resources.xml.i deleted file mode 100644 index 1706c8c..0000000 --- a/interface-definitions/include/vpp_host_resources.xml.i +++ /dev/null @@ -1,35 +0,0 @@ - - - - Host resources control - - - - - Maximum number of memory map areas a process may have - - u32:65535-2147483647 - Areas count - - - - - - 65535 - - - - Maximum shared memory segment size that can be created - - u32:0-18446744073709551612 - Size in bytes - - - - - - 2147483648 - - - - diff --git a/interface-definitions/vpp.xml.in b/interface-definitions/vpp.xml.in index dff56a2..a0cd0be 100644 --- a/interface-definitions/vpp.xml.in +++ b/interface-definitions/vpp.xml.in @@ -449,7 +449,6 @@ - #include Interface diff --git a/python/vyos/vpp/config_resource_checks/memory.py b/python/vyos/vpp/config_resource_checks/memory.py index 64fdf9a..c9e2e61 100644 --- a/python/vyos/vpp/config_resource_checks/memory.py +++ b/python/vyos/vpp/config_resource_checks/memory.py @@ -51,14 +51,6 @@ def get_total_hugepages_free_memory() -> int: return hugepage_size * hugepages_free -def get_hugepages_total() -> int: - """ - Returns the total count of hugepages - """ - info = get_hugepages_info() - return info.get('HugePages_Total') - - def get_numa_count(): """ Run `numactl --hardware` and parse the 'available:' line. diff --git a/python/vyos/vpp/config_verify.py b/python/vyos/vpp/config_verify.py index f6c47d0..cda5cf0 100644 --- a/python/vyos/vpp/config_verify.py +++ b/python/vyos/vpp/config_verify.py @@ -19,7 +19,6 @@ import psutil from vyos import ConfigError -from vyos.base import Warning from vyos.utils.cpu import get_core_count as total_core_count from vyos.vpp.control_host import get_eth_driver @@ -390,17 +389,3 @@ def verify_vpp_interfaces_dpdk_num_queues(qtype: str, num_queues: int, workers: f'The number of {qtype} queues cannot be greater than the number of configured VPP workers: ' f'workers: {workers}, queues: {num_queues}' ) - - -def verify_vpp_host_resources(config: dict): - max_map_count = int(config['settings']['host_resources']['max_map_count']) - - # Get HugePages total count - hugepages = mem_checks.get_hugepages_total() - - if max_map_count < 2 * hugepages: - Warning( - 'The max-map-count should be greater than or equal to (2 * HugePages_Total) ' - 'or VPP could work not properly. Please set up ' - f'"vpp settings host-resources max-map-count" to {2 * hugepages} or higher' - ) diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index 16302ad..60208cf 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -31,6 +31,7 @@ from vyos.utils.process import process_named_running from vyos.utils.file import read_file from vyos.utils.process import rc_cmd +from vyos.utils.system import sysctl_read from vyos.vpp.utils import human_page_memory_to_bytes sys.path.append(os.getenv('vyos_completion_dir')) @@ -1417,6 +1418,33 @@ def test_18_vpp_sflow(self): self.cli_delete(base_sflow) self.cli_commit() + def test_19_host_resources(self): + max_map_count = '100000' + shmmax = '55555555555555' + hr_path = ['system', 'option', 'host-resources'] + + # Check if max-map-count has default auto calculated value + # but not less than '65530' + self.assertEqual(sysctl_read('vm.max_map_count'), '65530') + # The same is with: kernel.shmmax = '8589934592' + self.assertEqual(sysctl_read('kernel.shmmax'), '8589934592') + + # Change max-map-count, shmmax and check + self.cli_set(hr_path + ['max-map-count', max_map_count]) + self.cli_set(hr_path + ['shmmax', shmmax]) + self.cli_commit() + + self.assertEqual(sysctl_read('vm.max_map_count'), max_map_count) + self.assertEqual(sysctl_read('kernel.shmmax'), shmmax) + + # We expect max-map-count and shmmax will return auto calculated values + self.cli_delete(hr_path + ['max-map-count']) + self.cli_delete(hr_path + ['shmmax']) + self.cli_commit() + + self.assertEqual(sysctl_read('vm.max_map_count'), '65530') + self.assertEqual(sysctl_read('kernel.shmmax'), '8589934592') + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 0ea8d26..136755e 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -31,7 +31,6 @@ from vyos.template import render from vyos.utils.boot import boot_configuration_complete from vyos.utils.process import call -from vyos.utils.system import sysctl_read, sysctl_apply from vyos.vpp import VPPControl from vyos.vpp import control_host @@ -49,7 +48,6 @@ verify_vpp_memory, verify_vpp_statseg_size, verify_vpp_interfaces_dpdk_num_queues, - verify_vpp_host_resources, ) from vyos.vpp.config_filter import iface_filter_eth from vyos.vpp.utils import EthtoolGDrvinfo @@ -358,9 +356,6 @@ def verify(config): # Check if available memory is enough for current VPP config verify_vpp_memory(config) - if 'max_map_count' in config['settings'].get('host_resources', {}): - verify_vpp_host_resources(config) - if 'statseg' in config['settings']: verify_vpp_statseg_size(config['settings']) @@ -471,27 +466,6 @@ def generate(config): render(service_conf, 'vpp/startup.conf.j2', config['settings']) render(systemd_override, 'vpp/override.conf.j2', config) - # apply sysctl values - # default: https://github.com/FDio/vpp/blob/v23.10/src/vpp/conf/80-vpp.conf - # vm.nr_hugepages are now configured in section - # 'set system option kernel memory hugepage-size 2M hugepage-count ' - sysctl_config: dict[str, str] = { - 'vm.max_map_count': config['settings']['host_resources']['max_map_count'], - 'vm.hugetlb_shm_group': '0', - 'kernel.shmmax': config['settings']['host_resources']['shmmax'], - } - # we do not want to lower current values - for sysctl_key, sysctl_value in sysctl_config.items(): - # perform check only for quantitative params - if sysctl_key == 'vm.hugetlb_shm_group': - pass - current_value = sysctl_read(sysctl_key) - if int(current_value) > int(sysctl_value): - sysctl_config[sysctl_key] = current_value - - if not sysctl_apply(sysctl_config): - raise ConfigError('Cannot configure sysctl parameters for VPP') - return None