wifi-scripts: mac80211.sh: allow EHT* sets

Allow to configure 80211BE.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
This commit is contained in:
Janusz Dziedzic 2024-09-01 10:56:15 +02:00 committed by John Crispin
parent d1fc8c3db0
commit 42185bf429

View File

@ -159,77 +159,79 @@ mac80211_hostapd_setup_base() {
chan_ofs=0 chan_ofs=0
[ "$band" = "6g" ] && chan_ofs=1 [ "$band" = "6g" ] && chan_ofs=1
ieee80211n=1 if [ "$band" != "6g" ]; then
ht_capab= ieee80211n=1
case "$htmode" in ht_capab=
VHT20|HT20|HE20) ;; case "$htmode" in
HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) VHT20|HT20|HE20|EHT20) ;;
case "$hwmode" in HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160|EHT40|EHT80|EHT160)
a) case "$hwmode" in
case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in a)
1) ht_capab="[HT40+]";; case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
0) ht_capab="[HT40-]";; 1) ht_capab="[HT40+]";;
esac 0) ht_capab="[HT40-]";;
;; esac
*) ;;
case "$htmode" in *)
HT40+) ht_capab="[HT40+]";; case "$htmode" in
HT40-) ht_capab="[HT40-]";; HT40+) ht_capab="[HT40+]";;
*) HT40-) ht_capab="[HT40-]";;
if [ "$channel" -lt 7 ]; then *)
ht_capab="[HT40+]" if [ "$channel" -lt 7 ]; then
else ht_capab="[HT40+]"
ht_capab="[HT40-]" else
fi ht_capab="[HT40-]"
;; fi
esac ;;
;; esac
esac ;;
[ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]" esac
;; [ "$auto_channel" -gt 0 ] && ht_capab="[HT40+]"
*) ieee80211n= ;; ;;
esac *) ieee80211n= ;;
esac
[ -n "$ieee80211n" ] && { [ -n "$ieee80211n" ] && {
append base_cfg "ieee80211n=1" "$N" append base_cfg "ieee80211n=1" "$N"
set_default ht_coex 0 set_default ht_coex 0
append base_cfg "ht_coex=$ht_coex" "$N" append base_cfg "ht_coex=$ht_coex" "$N"
json_get_vars \ json_get_vars \
ldpc:1 \ ldpc:1 \
greenfield:0 \ greenfield:0 \
short_gi_20:1 \ short_gi_20:1 \
short_gi_40:1 \ short_gi_40:1 \
tx_stbc:1 \ tx_stbc:1 \
rx_stbc:3 \ rx_stbc:3 \
max_amsdu:1 \ max_amsdu:1 \
dsss_cck_40:1 dsss_cck_40:1
ht_cap_mask=0 ht_cap_mask=0
for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
ht_cap_mask="$(($ht_cap_mask | $cap))" ht_cap_mask="$(($ht_cap_mask | $cap))"
done done
cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) cap_rx_stbc=$((($ht_cap_mask >> 8) & 3))
[ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))"
mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ mac80211_add_capabilities ht_capab_flags $ht_cap_mask \
LDPC:0x1::$ldpc \ LDPC:0x1::$ldpc \
GF:0x10::$greenfield \ GF:0x10::$greenfield \
SHORT-GI-20:0x20::$short_gi_20 \ SHORT-GI-20:0x20::$short_gi_20 \
SHORT-GI-40:0x40::$short_gi_40 \ SHORT-GI-40:0x40::$short_gi_40 \
TX-STBC:0x80::$tx_stbc \ TX-STBC:0x80::$tx_stbc \
RX-STBC1:0x300:0x100:1 \ RX-STBC1:0x300:0x100:1 \
RX-STBC12:0x300:0x200:1 \ RX-STBC12:0x300:0x200:1 \
RX-STBC123:0x300:0x300:1 \ RX-STBC123:0x300:0x300:1 \
MAX-AMSDU-7935:0x800::$max_amsdu \ MAX-AMSDU-7935:0x800::$max_amsdu \
DSSS_CCK-40:0x1000::$dsss_cck_40 DSSS_CCK-40:0x1000::$dsss_cck_40
ht_capab="$ht_capab$ht_capab_flags" ht_capab="$ht_capab$ht_capab_flags"
[ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N"
} }
fi
# 802.11ac # 802.11ac
enable_ac=0 enable_ac=0
@ -238,8 +240,8 @@ mac80211_hostapd_setup_base() {
idx="$channel" idx="$channel"
case "$htmode" in case "$htmode" in
VHT20|HE20) enable_ac=1;; VHT20|HE20|EHT20) enable_ac=1;;
VHT40|HE40) VHT40|HE40|EHT40)
case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in
1) idx=$(($channel + 2));; 1) idx=$(($channel + 2));;
0) idx=$(($channel - 2));; 0) idx=$(($channel - 2));;
@ -247,7 +249,7 @@ mac80211_hostapd_setup_base() {
enable_ac=1 enable_ac=1
vht_center_seg0=$idx vht_center_seg0=$idx
;; ;;
VHT80|HE80) VHT80|HE80|EHT80)
case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in case "$(( (($channel / 4) + $chan_ofs) % 4 ))" in
1) idx=$(($channel + 6));; 1) idx=$(($channel + 6));;
2) idx=$(($channel + 2));; 2) idx=$(($channel + 2));;
@ -258,7 +260,7 @@ mac80211_hostapd_setup_base() {
vht_oper_chwidth=1 vht_oper_chwidth=1
vht_center_seg0=$idx vht_center_seg0=$idx
;; ;;
VHT160|HE160) VHT160|HE160|EHT160)
if [ "$band" = "6g" ]; then if [ "$band" = "6g" ]; then
case "$channel" in case "$channel" in
1|5|9|13|17|21|25|29) idx=15;; 1|5|9|13|17|21|25|29) idx=15;;
@ -289,8 +291,8 @@ mac80211_hostapd_setup_base() {
[ "$band" = "6g" ] && { [ "$band" = "6g" ] && {
op_class= op_class=
case "$htmode" in case "$htmode" in
HE20) op_class=131;; HE20|EHT20) op_class=131;;
HE*) op_class=$((132 + $vht_oper_chwidth)) HE*|EHT*) op_class=$((132 + $vht_oper_chwidth));;
esac esac
[ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N" [ -n "$op_class" ] && append base_cfg "op_class=$op_class" "$N"
} }
@ -417,8 +419,10 @@ mac80211_hostapd_setup_base() {
# 802.11ax # 802.11ax
enable_ax=0 enable_ax=0
enable_be=0
case "$htmode" in case "$htmode" in
HE*) enable_ax=1 ;; HE*) enable_ax=1 ;;
EHT*) enable_ax=1; enable_be=1 ;;
esac esac
if [ "$enable_ax" != "0" ]; then if [ "$enable_ax" != "0" ]; then
@ -492,6 +496,14 @@ mac80211_hostapd_setup_base() {
append base_cfg "he_mu_edca_ac_vo_timer=255" "$N" append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
fi fi
if [ "$enable_be" != "0" ]; then
append base_cfg "ieee80211be=1" "$N"
[ "$hwmode" = "a" ] && {
append base_cfg "eht_oper_chwidth=$vht_oper_chwidth" "$N"
append base_cfg "eht_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
}
fi
hostapd_prepare_device_config "$hostapd_conf_file" nl80211 hostapd_prepare_device_config "$hostapd_conf_file" nl80211
cat >> "$hostapd_conf_file" <<EOF cat >> "$hostapd_conf_file" <<EOF
${channel:+channel=$channel} ${channel:+channel=$channel}