mac80211: add random BSS color setting

Using BSS coloring is one way of improving performance on 802.11ax
radios, currently its only enabled by users adding he_bss_color to their
wireless UCI config.

This made sense as one could easily get BSS color collision as BSS color
range is 1-63.

Hostapd now has a way of dealing with BSS color collisions so we can just
assign a integer in the 1-63 range randomly if one is not set by users.

Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Robert Marko 2022-02-16 19:27:05 +01:00 committed by hzy
parent 5644d459d4
commit c978648d16

View File

@ -420,7 +420,16 @@ mac80211_hostapd_setup_base() {
he_mac_cap=${he_mac_cap:2}
append base_cfg "ieee80211ax=1" "$N"
[ -n "$he_bss_color" ] && append base_cfg "he_bss_color=$he_bss_color" "$N"
if [ -n "$he_bss_color" ]; then
append base_cfg "he_bss_color=$he_bss_color" "$N"
else
he_bss_color=$(head -1 /dev/urandom | tr -dc '0-9' | head -c2)
he_bss_color=$(($he_bss_color % 63))
he_bss_color=$(($he_bss_color + 1))
append base_cfg "he_bss_color=$he_bss_color" "$N"
fi
[ "$hwmode" = "a" ] && {
append base_cfg "he_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"