fw4: remove special cases around hw flow offloading
authorFelix Fietkau <nbd@nbd.name>
Fri, 1 Sep 2023 11:35:20 +0000 (13:35 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 1 Sep 2023 11:35:22 +0000 (13:35 +0200)
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 <nbd@nbd.name>
root/usr/share/ucode/fw4.uc

index e0748cc9288149744e007c9cfe155582b166371e..033083505a03126505cc9123bb49d842cf12d975 100644 (file)
@@ -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() {