hostapd: make it possible to update station airtime weights via ubus
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 600-ubus_support.patch
index 71537c9ec6f53c8fc77c3765007400b92eb58de5..005ed54e0c7f78bb644fa43f780a3e0bee301044 100644 (file)
        /* Proceed only if DFS is not offloaded to the driver */
        if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
                return 0;
+--- a/src/ap/airtime_policy.c
++++ b/src/ap/airtime_policy.c
+@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta
+ {
+       struct sta_info *sta;
+-      for (sta = hapd->sta_list; sta; sta = sta->next)
+-              sta_set_airtime_weight(hapd, sta, weight);
++      for (sta = hapd->sta_list; sta; sta = sta->next) {
++              unsigned int sta_weight = weight;
++
++              if (sta->dyn_airtime_weight)
++                      sta_weight = (weight * sta->dyn_airtime_weight) / 256;
++
++              sta_set_airtime_weight(hapd, sta, sta_weight);
++      }
+ }
+@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap
+       unsigned int weight;
+       if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) {
+-              weight = get_weight_for_sta(hapd, sta->addr);
++              if (sta->dyn_airtime_weight)
++                      weight = sta->dyn_airtime_weight;
++              else
++                      weight = get_weight_for_sta(hapd, sta->addr);
+               if (weight)
+                       return sta_set_airtime_weight(hapd, sta, weight);
+       }
+--- a/src/ap/sta_info.h
++++ b/src/ap/sta_info.h
+@@ -324,6 +324,7 @@ struct sta_info {
+ #endif /* CONFIG_TESTING_OPTIONS */
+ #ifdef CONFIG_AIRTIME_POLICY
+       unsigned int airtime_weight;
++      unsigned int dyn_airtime_weight;
+       struct os_reltime backlogged_until;
+ #endif /* CONFIG_AIRTIME_POLICY */