From 598d9fbb5179667aa0c525040eaa41bc7f2dc015 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 1 Sep 2023 13:35:20 +0200 Subject: [PATCH] fw4: remove special cases around hw flow offloading Now that a mix of hw and non-hw offload devices is supported in the kernel, simply put all devices in a hw offload table if enabled in the config. Signed-off-by: Felix Fietkau --- root/usr/share/ucode/fw4.uc | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index e0748cc..0330835 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -423,7 +423,7 @@ function map_setmatch(set, match, proto) { return fields; } -function resolve_lower_devices(devstatus, devname, require_hwoffload) { +function resolve_lower_devices(devstatus, devname) { let dir = fs.opendir(`/sys/class/net/${devname}`); let devs = []; @@ -435,13 +435,12 @@ function resolve_lower_devices(devstatus, devname, require_hwoffload) { while ((e = dir.read()) != null) if (index(e, "lower_") === 0) - push(devs, ...resolve_lower_devices(devstatus, substr(e, 6), require_hwoffload)); + push(devs, ...resolve_lower_devices(devstatus, substr(e, 6))); break; default: - if (!require_hwoffload || devstatus[devname]?.["hw-tc-offload"]) - push(devs, devname); + push(devs, devname); break; } @@ -519,27 +518,20 @@ return { bus.disconnect(); } - if (this.default_option("flow_offloading_hw")) { - for (let zone in this.zones()) - for (let device in zone.related_physdevs) - push(devices, ...resolve_lower_devices(devstatus, device, true)); - - devices = sort(uniq(devices)); + for (let zone in this.zones()) + for (let device in zone.related_physdevs) + push(devices, ...resolve_lower_devices(devstatus, device)); + devices = sort(uniq(devices)); + if (this.default_option("flow_offloading_hw")) { if (length(devices) && nft_try_hw_offload(devices)) return devices; this.warn('Hardware flow offloading unavailable, falling back to software offloading'); this.state.defaults.flow_offloading_hw = false; - - devices = []; } - for (let zone in this.zones()) - for (let device in zone.related_physdevs) - push(devices, ...resolve_lower_devices(devstatus, device, false)); - - return sort(uniq(devices)); + return devices; }, check_set_types: function() { -- 2.30.2