aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-03 18:38:20 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-05-03 18:38:20 +0000
commit58bda3a0e158f93929c41fcce0849c835581b77e (patch)
treed40ba2cc6f4fb3db673fd1ed07ff94fb0a1cfec9 /package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
parent52846f0ff53e7a4f5ecc6603200da708fb20d767 (diff)
downloadupstream-58bda3a0e158f93929c41fcce0849c835581b77e.tar.gz
upstream-58bda3a0e158f93929c41fcce0849c835581b77e.tar.bz2
upstream-58bda3a0e158f93929c41fcce0849c835581b77e.zip
mac80211: clean up ht capability handling, drop the use of the ht_capab list, use individual variables instead
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40682
Diffstat (limited to 'package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh')
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh56
1 files changed, 51 insertions, 5 deletions
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