[PATCH] hostapd: add support for per-BSS airtime configuration

David Bauer mail at david-bauer.net
Sat Sep 5 09:41:47 EDT 2020


Add support for per-BSS airtime weight configuration. This allows to set
a airtime weight per BSS as well as a ratio limit based on the weight.

Support for this feature is only enabled in the full flavors of hostapd.

Consult the hostapd.conf documentation (Airtime policy configuration)
for more information on the inner workings of the exposed settings.

Signed-off-by: David Bauer <mail at david-bauer.net>
---
 package/network/services/hostapd/Makefile            |  2 +-
 .../services/hostapd/files/hostapd-full.config       |  2 +-
 package/network/services/hostapd/files/hostapd.sh    | 12 ++++++++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 5e56a43e9a..8f94dce782 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
index 0ecce423e7..ab9d13aae7 100644
--- a/package/network/services/hostapd/files/hostapd-full.config
+++ b/package/network/services/hostapd/files/hostapd-full.config
@@ -384,7 +384,7 @@ CONFIG_TAXONOMY=y
 #CONFIG_OWE=y
 
 # Airtime policy support
-#CONFIG_AIRTIME_POLICY=y
+CONFIG_AIRTIME_POLICY=y
 
 # Override default value for the wpa_disable_eapol_key_retries configuration
 # parameter. See that parameter in hostapd.conf for more details.
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index fe5b407bc1..dd505f6841 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -110,7 +110,7 @@ hostapd_prepare_device_config() {
 	local base_cfg=
 
 	json_get_vars country country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
-		acs_chan_bias local_pwr_constraint spectrum_mgmt_required
+		acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode
 
 	hostapd_set_log_options base_cfg
 
@@ -118,6 +118,7 @@ hostapd_prepare_device_config() {
 	set_default spectrum_mgmt_required 0
 	set_default doth 1
 	set_default legacy_rates 1
+	set_default airtime_mode 0
 
 	[ "$hwmode" = "b" ] && legacy_rates=1
 
@@ -164,6 +165,7 @@ hostapd_prepare_device_config() {
 	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
 	append base_cfg "beacon_int=$beacon_int" "$N"
 	append base_cfg "dtim_period=$dtim_period" "$N"
+	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
 
 	json_get_values opts hostapd_options
 	for val in $opts; do
@@ -315,7 +317,8 @@ hostapd_set_bss_options() {
 		iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
 		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
+		multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key \
+		airtime_bss_weight airtime_bss_limit
 
 	set_default isolate 0
 	set_default maxassoc 0
@@ -333,6 +336,8 @@ hostapd_set_bss_options() {
 	set_default chan_util_avg_period 600
 	set_default utf8_ssid 1
 	set_default multi_ap 0
+	set_default airtime_bss_weight 0
+	set_default airtime_bss_limit 0
 
 	append bss_conf "ctrl_interface=/var/run/hostapd"
 	if [ "$isolate" -gt 0 ]; then
@@ -345,6 +350,9 @@ hostapd_set_bss_options() {
 		append bss_conf "ap_max_inactivity=$max_inactivity" "$N"
 	fi
 
+	[ "$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"
+
 	append bss_conf "bss_load_update_period=$bss_load_update_period" "$N"
 	append bss_conf "chan_util_avg_period=$chan_util_avg_period" "$N"
 	append bss_conf "disassoc_low_ack=$disassoc_low_ack" "$N"
-- 
2.28.0




More information about the openwrt-devel mailing list