mac80211: add preliminary support for enabling 802.11ax in config

No advanced features are configurable yet, just basic enabling of HE modes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2020-08-26 12:30:12 +02:00
parent a38b6efbc1
commit acf1733496

View File

@ -121,8 +121,8 @@ mac80211_hostapd_setup_base() {
ieee80211n=1
ht_capab=
case "$htmode" in
VHT20|HT20) ;;
HT40*|VHT40|VHT80|VHT160)
VHT20|HT20|HE20) ;;
HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
case "$hwmode" in
a)
case "$(( ($channel / 4) % 2 ))" in
@ -192,19 +192,21 @@ mac80211_hostapd_setup_base() {
# 802.11ac
enable_ac=0
vht_oper_chwidth=0
vht_center_seg0=
idx="$channel"
case "$htmode" in
VHT20) enable_ac=1;;
VHT40)
VHT20|HE20) enable_ac=1;;
VHT40|HE40)
case "$(( ($channel / 4) % 2 ))" in
1) idx=$(($channel + 2));;
0) idx=$(($channel - 2));;
esac
enable_ac=1
append base_cfg "vht_oper_chwidth=0" "$N"
append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N"
vht_center_seg0=$idx
;;
VHT80)
VHT80|HE80)
case "$(( ($channel / 4) % 4 ))" in
1) idx=$(($channel + 6));;
2) idx=$(($channel + 2));;
@ -212,19 +214,20 @@ mac80211_hostapd_setup_base() {
0) idx=$(($channel - 6));;
esac
enable_ac=1
append base_cfg "vht_oper_chwidth=1" "$N"
append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N"
vht_oper_chwidth=1
vht_center_seg0=$idx
;;
VHT160)
VHT160|HE160)
case "$channel" in
36|40|44|48|52|56|60|64) idx=50;;
100|104|108|112|116|120|124|128) idx=114;;
esac
enable_ac=1
append base_cfg "vht_oper_chwidth=2" "$N"
append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N"
vht_oper_chwidth=2
vht_center_seg0=$idx
;;
esac
[ "$hwmode" = "a" ] || enable_ac=0
if [ "$enable_ac" != "0" ]; then
json_get_vars \
@ -253,6 +256,9 @@ mac80211_hostapd_setup_base() {
vht_cap="$(($vht_cap | $cap))"
done
append base_cfg "vht_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg "vht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
cap_rx_stbc=$((($vht_cap >> 8) & 7))
[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
@ -323,6 +329,25 @@ mac80211_hostapd_setup_base() {
[ -n "$vht_capab" ] && append base_cfg "vht_capab=$vht_capab" "$N"
fi
# 802.11ax
enable_ax=0
case "$htmode" in
HE*) enable_ax=1 ;;
esac
if [ "$enable_ax" != "0" ]; then
append base_cfg "ieee80211ax=1" "$N"
[ "$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"
}
append base_cfg "he_default_pe_duration=4" "$N"
append base_cfg "he_rts_threshold=1023" "$N"
append base_cfg "he_su_beamformer=1" "$N"
append base_cfg "he_su_beamformee=1" "$N"
append base_cfg "he_mu_beamformer=1023" "$N"
fi
hostapd_prepare_device_config "$hostapd_conf_file" nl80211
cat >> "$hostapd_conf_file" <<EOF
${channel:+channel=$channel}