Skip to content

Commit e4f923c

Browse files
committed
T8030: VPP: Check support for changed driver too
1 parent cfb2a5e commit e4f923c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

python/vyos/vpp/config_verify.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from vyos.base import Warning
2323
from vyos.utils.cpu import get_core_count as total_core_count, get_cpus
2424

25-
from vyos.vpp.control_host import get_eth_driver
2625
from vyos.vpp.config_resource_checks import cpu as cpu_checks, memory as mem_checks
2726
from vyos.vpp.config_resource_checks.resource_defaults import default_resource_map
2827
from vyos.vpp.utils import human_memory_to_bytes, bytes_to_human_memory
@@ -122,7 +121,7 @@ def verify_vpp_tunnel_source_address(config: dict):
122121
)
123122

124123

125-
def verify_dev_driver(iface_name: str, driver_type: str) -> bool:
124+
def verify_dev_driver(driver_type: str, driver: str) -> bool:
126125
# Lists of drivers compatible with DPDK and XDP
127126
drivers_dpdk: list[str] = [
128127
'atlantic',
@@ -167,8 +166,6 @@ def verify_dev_driver(iface_name: str, driver_type: str) -> bool:
167166
'vmxnet3',
168167
]
169168

170-
driver: str = get_eth_driver(iface_name)
171-
172169
if driver_type == 'dpdk':
173170
if driver in drivers_dpdk:
174171
return True

src/conf_mode/vpp.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ def get_config(config=None):
346346
conf, base_settings + ['interface', iface, 'driver']
347347
)
348348

349+
if old_driver:
350+
config['settings']['interface'][iface]['driver_changed'] = {}
351+
349352
# Get current kernel module, required for extra verification and
350353
# logic for VMBus interfaces
351354
config['settings']['interface'][iface]['kernel_module'] = (
@@ -542,10 +545,14 @@ def verify(config):
542545
# ensure DPDK/XDP settings are properly configured
543546
for iface, iface_config in config['settings']['interface'].items():
544547
# check if selected driver is supported, but only for new interfaces
545-
if iface not in config.get('effective', {}).get('settings', {}).get(
546-
'interface', {}
548+
# or if driver was changed
549+
original_driver = config['persist_config'][iface]['original_driver']
550+
if (
551+
iface
552+
not in config.get('effective', {}).get('settings', {}).get('interface', {})
553+
or 'driver_changed' in iface_config
547554
):
548-
if not verify_dev_driver(iface, iface_config['driver']):
555+
if not verify_dev_driver(iface_config['driver'], original_driver):
549556
raise ConfigError(
550557
f'Driver {iface_config["driver"]} is not compatible with interface {iface}!'
551558
)

0 commit comments

Comments
 (0)