summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2025-02-14 16:47:48 +0200
committerNataliia Solomko <natalirs1985@gmail.com>2025-02-14 17:44:07 +0200
commitc200c1d8ebda18b5c5e5a181b7915aa2064ffa48 (patch)
treec7c093e6177239c863c084e734a2834ff562986e /src
parent6dae0f206d67e0ef8678305c279505e3a5da6208 (diff)
downloadvyos-1x-c200c1d8ebda18b5c5e5a181b7915aa2064ffa48.tar.gz
vyos-1x-c200c1d8ebda18b5c5e5a181b7915aa2064ffa48.zip
T7074: VPP add check for interface RX mode changes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vpp.py50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py
index 5126b7c79..31da75448 100755
--- a/src/conf_mode/vpp.py
+++ b/src/conf_mode/vpp.py
@@ -69,6 +69,22 @@ override_drivers: dict[str, str] = {
# drivers that does not use PCIe addresses
not_pci_drv: list[str] = ['hv_netvsc']
+# drivers that support interrupt RX mode for DPDK and XDP
+drivers_support_interrupt: dict[str, list] = {
+ 'atlantic': ['dpdk', 'xdp'],
+ 'bnx2x': ['dpdk'],
+ 'e1000': ['dpdk'],
+ 'ena': ['dpdk', 'xdp'],
+ 'i40e': ['dpdk', 'xdp'],
+ 'ice': ['dpdk', 'xdp'],
+ 'igb': ['xdp'],
+ 'igc': ['dpdk', 'xdp'],
+ 'ixgbe': ['dpdk', 'xdp'],
+ 'qede': ['dpdk', 'xdp'],
+ 'vmxnet3': ['xdp'],
+ 'virtio_net': ['xdp'],
+}
+
def get_config(config=None):
# use persistent config to store interfaces data between executions
@@ -332,6 +348,20 @@ def verify(config):
if iface_config['driver'] == 'dpdk' and 'xdp_options' in iface_config:
raise ConfigError('XDP options are not applicable for DPDK driver!')
+ # RX-mode verification
+ rx_mode = iface_config.get('rx_mode')
+ if rx_mode and rx_mode != 'polling':
+ # By default drivers operate in polling mode. Not all NIC drivers support
+ # RX mode interrupt and adaptive
+ driver = config.get('persist_config').get(iface).get('original_driver')
+ if (
+ driver not in drivers_support_interrupt
+ or iface_config['driver'] not in drivers_support_interrupt[driver]
+ ):
+ raise ConfigError(
+ f'RX mode {rx_mode} is not supported for interface {iface}'
+ )
+
# check GRE tunnels as part of the bridge, only tunnel-type teb is allowed
# set vpp interfaces bridge br1 member interface gre1
# set vpp interfaces gre gre1 tunnel-type teb
@@ -604,7 +634,16 @@ def apply(config):
if iface not in Section.interfaces():
vpp_control.lcp_pair_add(iface, iface)
- # Set rx-mode
+ # For unknown reasons, if multiple interfaces later try to be
+ # initialized by configuration scripts, some of them may stuck
+ # in an endless UP/DOWN loop
+ # We found two workarounds - pause initialization (requires
+ # main code modifications).
+ # And this one
+ dev_index = iproute.link_lookup(ifname=iface)[0]
+ iproute.link('set', index=dev_index, state='up')
+
+ # Set rx-mode. Should be configured after interface state set to UP
rx_mode = iface_config.get('rx_mode')
if rx_mode:
# to hardware side
@@ -615,15 +654,6 @@ def apply(config):
)
vpp_control.iface_rxmode(lcp_name, rx_mode)
- # For unknown reasons, if multiple interfaces later try to be
- # initialized by configuration scripts, some of them may stuck
- # in an endless UP/DOWN loop
- # We found two workarounds - pause initialization (requires
- # main code modifications).
- # And this one
- dev_index = iproute.link_lookup(ifname=iface)[0]
- iproute.link('set', index=dev_index, state='up')
-
# Syncronize routes via LCP
vpp_control.lcp_resync()