From 58bda3a0e158f93929c41fcce0849c835581b77e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 3 May 2014 18:38:20 +0000 Subject: mac80211: clean up ht capability handling, drop the use of the ht_capab list, use individual variables instead Signed-off-by: Felix Fietkau SVN-Revision: 40682 --- .../mac80211/files/lib/netifd/wireless/mac80211.sh | 56 ++++++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) (limited to 'package/kernel/mac80211/files/lib/netifd/wireless') diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index c96b4a353b..4f859a73e7 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -56,6 +56,25 @@ drv_mac80211_init_iface_config() { config_add_string $MP_CONFIG_STRING } +mac80211_add_capabilities() { + local __var="$1"; shift + local __mask="$1"; shift + local __out= oifs + + oifs="$IFS" + IFS=: + for capab in "$@"; do + set -- $capab + + [ "$(($4))" -gt 0 ] || continue + [ "$(($__mask & $2))" -eq "$((${3:-$2}))" ] || continue + __out="$__out[$1]" + done + IFS="$oifs" + + export -n -- "$__var=$__out" +} + mac80211_hostapd_setup_base() { local phy="$1" @@ -80,13 +99,40 @@ mac80211_hostapd_setup_base() { *) ieee80211n= ;; esac - [ -n "$ieee80211n" ] && append base_cfg "ieee80211n=1" "$N" + [ -n "$ieee80211n" ] && { + append base_cfg "ieee80211n=1" "$N" - for cap in $ht_capab_list; do - ht_capab="$ht_capab[$cap]" - done + json_get_vars \ + ldpc:1 \ + greenfield:1 \ + short_gi_20:1 \ + short_gi_40:1 \ + tx_stbc:1 \ + rx_stbc:3 \ + dsss_cck_40:1 + + ht_cap_mask=0 + for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do + ht_cap_mask="$(($ht_cap_mask | $cap))" + done - [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + cap_rx_stbc=$((($ht_cap_mask >> 8) & 3)) + [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc" + ht_cap_mask="$(( ($ht_cap_mask & ~(0x300)) | ($cap_rx_stbc << 8) ))" + + mac80211_add_capabilities ht_capab_flags $ht_cap_mask \ + LDPC:0x1::$ldpc \ + GF:0x10::$greenfield \ + SHORT-GI-20:0x20::$short_gi_20 \ + SHORT-GI-40:0x40::$short_gi_40 \ + TX-STBC:0x80::$max_tx_stbc \ + RX-STBC1:0x300:0x100:1 \ + RX-STBC12:0x300:0x200:1 \ + RX-STBC123:0x300:0x300:1 \ + DSSS_CCK-40:0x1000::$dsss_cck_40 + + [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab$ht_capab_flags" "$N" + } # 802.11ac enable_ac=0 -- cgit v1.2.3