From 07ec3a4699ac86c8e4ffa6036abab2d49e2d4134 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 10 Sep 2026 19:29:44 +0000 Subject: ethernet: T9228: only warn about unsupported NIC features when node changed EthernetIf.update() re-applies every ethernet knob on every commit touching the interface. The capability messages (offload, flow-control, ring-buffer, coalesce, switchdev) are emitted whenever the CLI-desired state differs from what the driver reports - and on drivers where a feature is fixed (virtio_net, vmxnet3, vif, veth, ...) that is permanently true. The message is correct the first time, but it then re-appears on unrelated commits like an interface description or IP address change. Record in interfaces_ethernet.py which of the affected CLI nodes were altered - the mechanism already used for speed_duplex_changed - and pass it to the setters via a "warn" argument. Settings are still applied unconditionally, only the message is gated. While at it, consolidate the seven offload setters onto a common helper and use Warning() instead of print(). --- src/conf_mode/interfaces_ethernet.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py index 16ff90300..45bd47e86 100755 --- a/src/conf_mode/interfaces_ethernet.py +++ b/src/conf_mode/interfaces_ethernet.py @@ -25,7 +25,9 @@ from vyos.configdep import call_dependents from vyos.configdict import get_interface_dict from vyos.configdict import is_node_changed from vyos.configdict import is_vrf_changed +from vyos.configdict import node_changed from vyos.configdict import get_flowtable_interfaces +from vyos.configdiff import Diff from vyos.configverify import verify_address from vyos.configverify import verify_dhcpv6 from vyos.configverify import verify_interface_exists @@ -178,6 +180,31 @@ def get_config(config=None): tmp = is_node_changed(conf, base + [ifname, 'evpn']) if tmp: ethernet.update({'frr_dict' : get_frrender_dict(conf)}) + # T9228: Some NIC drivers do not support changing all settings we offer on + # the CLI. The warning telling the user about the missing driver support is + # emitted while applying the configuration - which happens on every commit + # touching this interface. Record which nodes have been changed so the + # warning is only displayed if the node in question was altered, and not on + # any unrelated change like an interface description or IP address. + tmp = node_changed( + conf, + base + [ifname, 'offload'], + key_mangling=('-', '_'), + expand_nodes=Diff.ADD | Diff.DELETE, + ) + if tmp: + ethernet.update({'offload_changed': tmp}) + + for node, key in { + 'disable-flow-control': 'flow_control_changed', + 'ring-buffer': 'ring_buffer_changed', + 'interrupt-coalescing': 'coalesce_changed', + 'switchdev': 'switchdev_changed', + }.items(): + tmp = is_node_changed(conf, base + [ifname, node]) + if tmp: + ethernet.update({key: {}}) + ethernet['flowtable_interfaces'] = get_flowtable_interfaces(conf) vpp_config = conf.get_config_dict( -- cgit v1.2.3