aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-03 18:38:09 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-05-03 18:38:09 +0000
commite41485344a97f44cc863112306a4fcb1a8dbffeb (patch)
tree4cc6ae57be0d814b1b48cdf6e4a87793ab4a88bc /package/kernel/mac80211/files
parenta619a87d01a68fede0ee30955baafa994962fea1 (diff)
downloadupstream-e41485344a97f44cc863112306a4fcb1a8dbffeb.tar.gz
upstream-e41485344a97f44cc863112306a4fcb1a8dbffeb.tar.bz2
upstream-e41485344a97f44cc863112306a4fcb1a8dbffeb.zip
mac80211: simplify HT40 handling, derive lower/upper channel mode automatically from channel index
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@40680 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/mac80211/files')
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh37
1 files changed, 12 insertions, 25 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 53d1cb9c8f..e940f1304e 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -71,11 +71,10 @@ mac80211_hostapd_setup_base() {
ht_capab=
case "$htmode" in
- HT20|HT40-|HT40+) ht_capab="[$htmode]";;
- VHT40|VHT80|VHT160)
- case "$channel" in
- 36|44|52|60|100|108|116|124|132|140|149|157) ht_capab="[HT40+]";;
- 40|48|56|64|104|112|120|128|136|144|153|161) ht_capab="[HT40-]";;
+ HT40*|VHT40|VHT80|VHT160)
+ case "$(( ($channel / 4) % 2 ))" in
+ 1) ht_capab="[HT40+]";;
+ 0) ht_capab="[HT40-]";;
esac
;;
esac
@@ -90,32 +89,20 @@ mac80211_hostapd_setup_base() {
idx="$channel"
case "$htmode" in
VHT40)
- case "$channel" in
- 36|40) idx=38;;
- 44|48) idx=42;;
- 52|56) idx=54;;
- 60|64) idx=58;;
- 100|104) idx=102;;
- 108|112) idx=110;;
- 116|120) idx=118;;
- 124|128) idx=126;;
- 132|136) idx=134;;
- 140|144) idx=142;;
- 149|153) idx=151;;
- 157|161) idx=159;;
+ 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"
;;
VHT80)
- case "$channel" in
- 36|40|44|48) idx=42;;
- 52|56|60|64) idx=58;;
- 100|104|108|112) idx=106;;
- 116|120|124|128) idx=122;;
- 132|136|140|144) idx=138;;
- 149|153|157|161) idx=155;;
+ case "$(( ($channel / 4) % 2 ))" in
+ 1) idx=$(($channel + 6));;
+ 2) idx=$(($channel + 2));;
+ 3) idx=$(($channel - 2));;
+ 0) idx=$(($channel - 6));;
esac
enable_ac=1
append base_cfg "vht_oper_chwidth=1" "$N"