mac80211: fix issues in HE capabilities
authorFelix Fietkau <nbd@nbd.name>
Mon, 10 Oct 2022 20:50:35 +0000 (22:50 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 13 Oct 2022 11:45:42 +0000 (13:45 +0200)
Enable HE SU beamformee by default
Fix spatial reuse configuration:
- he_spr_sr_control is not a bool for enabling, it contains multiple bits
  which disable features that should be disabled by default
- one of the features (PSR) can be enabled through he_spr_psr_enabled
- add option to disable bss color / spatial reuse

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

index f462fc8ad9751db436a4bae372d7a7bef469c9ef..66349f2599da9a5696fc354c9f185a8e65a83f39 100644 (file)
@@ -51,6 +51,8 @@ drv_mac80211_init_device_config() {
                rx_antenna_pattern \
                tx_antenna_pattern \
                he_spr_sr_control \
+               he_spr_psr_enabled \
+               he_bss_color_enabled \
                he_twt_required
        config_add_int \
                beamformer_antennas \
@@ -414,12 +416,14 @@ mac80211_hostapd_setup_base() {
        if [ "$enable_ax" != "0" ]; then
                json_get_vars \
                        he_su_beamformer:1 \
-                       he_su_beamformee:0 \
+                       he_su_beamformee:1 \
                        he_mu_beamformer:1 \
                        he_twt_required:0 \
-                       he_spr_sr_control:0 \
-                       he_spr_non_srg_obss_pd_max_offset:1 \
-                       he_bss_color
+                       he_spr_sr_control:3 \
+                       he_spr_psr_enabled:0 \
+                       he_spr_non_srg_obss_pd_max_offset:0 \
+                       he_bss_color:128 \
+                       he_bss_color_enabled:1
 
                he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
                he_phy_cap=${he_phy_cap:2}
@@ -432,17 +436,25 @@ mac80211_hostapd_setup_base() {
                        append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
                }
 
-               set_default he_bss_color 128
-               append base_cfg "he_bss_color=$he_bss_color" "$N"
-
-               mac80211_add_he_capabilities \
+               mac8q0211_add_he_capabilities \
                        he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
                        he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
                        he_mu_beamformer:${he_phy_cap:8:2}:0x2:$he_mu_beamformer \
-                       he_spr_sr_control:${he_phy_cap:14:2}:0x1:$he_spr_sr_control \
+                       he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
                        he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
 
-               [ "$he_spr_sr_control" -gt 0 ] && append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
+               if [ "$he_bss_color_enabled" -gt 0 ]; then
+                       append base_cfg "he_bss_color=$he_bss_color" "$N"
+                       [ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
+                               append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
+                               he_spr_sr_control=$((he_spr_sr_control | (1 << 2)))
+                       }
+                       [ "$he_spr_psr_enabled" -gt 0 ] || he_spr_sr_control=$((he_spr_sr_control | (1 << 0)))
+                       append base_cfg "he_spr_sr_control=$he_spr_sr_control" "$N"
+               else
+                       append base_cfg "he_bss_color_disabled=1" "$N"
+               fi
+
 
                append base_cfg "he_default_pe_duration=4" "$N"
                append base_cfg "he_rts_threshold=1023" "$N"