From: Felix Fietkau Date: Fri, 1 Sep 2023 11:35:20 +0000 (+0200) Subject: fw4: remove special cases around hw flow offloading X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=598d9fbb5179667aa0c525040eaa41bc7f2dc015;p=project%2Ffirewall4.git 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 --- 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() {