hostapd: add support for static airtime policy configuration
authorDobroslaw Kijowski <dobo90@gmail.com>
Mon, 16 Nov 2020 19:32:38 +0000 (20:32 +0100)
committerDavid Bauer <mail@david-bauer.net>
Tue, 17 Nov 2020 16:06:16 +0000 (17:06 +0100)
* Add support for passing airtime_sta_weight into hostapd configuration.
* Since that commit it is possible to configure station weights. Set higher
  value for larger airtime share, lower for smaller share.

I have tested this functionality by modyfing /etc/config/wireless to:

config wifi-device 'radio0'
...
        option airtime_mode '1'

config wifi-iface 'default_radio0'
...
        list airtime_sta_weight '01:02:03:04:05:06 1024'

Now, when the station associates with the access point it has been assigned
a higher weight value.
root@OpenWrt:~# cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/01\:02\:03\:04\:05\:06/airtime
RX: 12656 us
TX: 10617 us
Weight: 1024
Deficit: VO: -2075 us VI: 256 us BE: -206 us BK: 256 us

[MAC address has been changed into a dummy one.]

Signed-off-by: Dobroslaw Kijowski <dobo90@gmail.com>
package/network/services/hostapd/Makefile
package/network/services/hostapd/files/hostapd.sh

index 9a8a74ced9d1dd3d9f8ed617f74d5a552d97d4e1..e25cd20a2a0b2e72c758a3eaae236d72e7243c26 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=15
+PKG_RELEASE:=16
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
index 8a07e4d52ba351a7fa59cc634d7e03158de90f23..4d4a75b2dd244bcc0bdc6bc7f0e0a4aac631d3e0 100644 (file)
@@ -287,6 +287,7 @@ hostapd_common_add_bss_config() {
        config_add_array hs20_conn_capab
        config_add_string osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
 
+       config_add_array airtime_sta_weight
        config_add_int airtime_bss_weight airtime_bss_limit
 }
 
@@ -411,6 +412,10 @@ append_hs20_conn_capab() {
        [ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N"
 }
 
+append_airtime_sta_weight() {
+       [ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
+}
+
 hostapd_set_bss_options() {
        local var="$1"
        local phy="$2"
@@ -432,7 +437,7 @@ hostapd_set_bss_options() {
                acct_server acct_secret acct_port acct_interval \
                bss_load_update_period chan_util_avg_period sae_require_mfp \
                multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
-               airtime_bss_weight airtime_bss_limit
+               airtime_bss_weight airtime_bss_limit airtime_sta_weight
 
        set_default isolate 0
        set_default maxassoc 0
@@ -466,6 +471,7 @@ hostapd_set_bss_options() {
 
        [ "$airtime_bss_weight" -gt 0 ] && append bss_conf "airtime_bss_weight=$airtime_bss_weight" "$N"
        [ "$airtime_bss_limit" -gt 0 ] && append bss_conf "airtime_bss_limit=$airtime_bss_limit" "$N"
+       json_for_each_item append_airtime_sta_weight airtime_sta_weight
 
        append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
        append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"