From: Matti Laakso <malaa...@elisanet.fi> This patch introduces 802.11ac support to base-files, mac80211 and hostapd. The split of VHT160 in two 80 MHz bands is not yet supported, since it requires an additional user supplied parameter for the channel of the second band.
Signed-off-by: Matti Laakso <malaa...@elisanet.fi> Signed-off-by: Simon Wunderlich <si...@open-mesh.com> [s...@open-mesh.com: Rebased patch, merged htmode and vhtmode, removed special hwmode, fixed hostapd integration] Signed-off-by: Sven Eckelmann <s...@open-mesh.com> --- v3: see http://article.gmane.org/gmane.comp.embedded.openwrt.devel/22511 The ath10k patch wasn't resent because the driver patches are now integrated in the OpenWrt mac80211 package. The answer in http://article.gmane.org/gmane.comp.embedded.openwrt.devel/22422 also wasn't quite promising. .../mac80211/files/lib/netifd/wireless/mac80211.sh | 61 +++++++++++++++++++++- package/kernel/mac80211/files/lib/wifi/mac80211.sh | 41 ++++++++++++++- .../services/hostapd/files/hostapd-full.config | 3 ++ .../services/hostapd/files/hostapd-mini.config | 3 ++ 4 files changed, 106 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 1896fe0..71d565e 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() { config_add_int rxantenna txantenna antenna_gain txpower config_add_boolean noscan config_add_array ht_capab + config_add_array vht_capab } drv_mac80211_init_iface_config() { @@ -55,12 +56,70 @@ mac80211_hostapd_setup_base() { append base_cfg "ieee80211n=1" "$N" ht_capab= - [ -n "$htmode" ] && ht_capab="[$htmode]" + case "$htmode" in + HT20|HT40-|HT40+) ht_capab="[$htmode]";; + VHT40|VHT80|VHT160) ht_capab="[HT40+]";; + esac for cap in $ht_capab_list; do ht_capab="$ht_capab[$cap]" done [ -n "$ht_capab" ] && append base_cfg "ht_capab=$ht_capab" "$N" + + # 802.11ac + enable_ac=0 + json_get_values vht_capab_list vht_capab + 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;; + 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;; + esac + enable_ac=1 + append base_cfg "vht_oper_chwidth=1" "$N" + append base_cfg "vht_oper_centr_freq_seg0_idx=$idx" "$N" + ;; + VHT160) + 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" + ;; + esac + if [ "$enable_ac" != "0" ]; then + append base_cfg "ieee80211ac=1" "$N" + for cap in $vht_capab_list; do + vht_capab="$vht_capab[$cap]" + done + [ -n "$vht_capab" ] && append base_cfg "vht_capab=$vht_capab" "$N" + fi } hostapd_prepare_device_config "$hostapd_conf_file" nl80211 diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index e33b09a..f46c23d 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -69,6 +69,8 @@ detect_mac80211() { mode_11n="" mode_band="g" channel="11" + htmode="" + ht_cap=0 for cap in $(iw phy "$dev" info | grep 'Capabilities:' | cut -d: -f2); do ht_cap="$(($ht_cap | $cap))" @@ -76,7 +78,7 @@ detect_mac80211() { ht_capab=""; [ "$ht_cap" -gt 0 ] && { mode_11n="n" - append ht_capab " option htmode HT20" "$N" + htmode="HT20" list=" list ht_capab" [ "$(($ht_cap & 1))" -eq 1 ] && append ht_capab "$list LDPC" "$N" @@ -89,8 +91,45 @@ detect_mac80211() { [ "$(($ht_cap & 768))" -eq 768 ] && append ht_capab "$list RX-STBC123" "$N" [ "$(($ht_cap & 4096))" -eq 4096 ] && append ht_capab "$list DSSS_CCK-40" "$N" } + iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; } + vht_cap=0 + for cap in $(iw phy "$dev" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do + vht_cap="$(($vht_cap | $cap))" + done + [ "$vht_cap" -gt 0 ] && { + mode_band="a"; + channel="36" + htmode="VHT80" + + list=" list vht_capab" + [ "$(($vht_cap & 3))" -eq 1 ] && append ht_capab "$list MAX-MPDU-7991" "$N" + [ "$(($vht_cap & 3))" -eq 2 ] && append ht_capab "$list MAX-MPDU-11454" "$N" + [ "$(($vht_cap & 12))" -eq 4 ] && append ht_capab "$list VHT160" "$N" + [ "$(($vht_cap & 12))" -eq 8 ] && append ht_capab "$list VHT160-80PLUS80" "$N" + [ "$(($vht_cap & 16))" -eq 16 ] && append ht_capab "$list RXLDPC" "$N" + [ "$(($vht_cap & 32))" -eq 32 ] && append ht_capab "$list SHORT-GI-80" "$N" + [ "$(($vht_cap & 64))" -eq 64 ] && append ht_capab "$list SHORT-GI-160" "$N" + [ "$(($vht_cap & 128))" -eq 128 ] && append ht_capab "$list TX-STBC-2BY1" "$N" + [ "$(($vht_cap & 1792))" -eq 256 ] && append ht_capab "$list RX-STBC-1" "$N" + [ "$(($vht_cap & 1792))" -eq 512 ] && append ht_capab "$list RX-STBC-12" "$N" + [ "$(($vht_cap & 1792))" -eq 768 ] && append ht_capab "$list RX-STBC-123" "$N" + [ "$(($vht_cap & 1792))" -eq 1024 ] && append ht_capab "$list RX-STBC-1234" "$N" + [ "$(($vht_cap & 2048))" -eq 2048 ] && append ht_capab "$list SU-BEAMFORMER" "$N" + [ "$(($vht_cap & 4096))" -eq 4096 ] && append ht_capab "$list SU-BEAMFORMEE" "$N" + [ "$(($vht_cap & 524288))" -eq 524288 ] && append ht_capab "$list MU-BEAMFORMER" "$N" + [ "$(($vht_cap & 1048576))" -eq 1048576 ] && append ht_capab "$list MU-BEAMFORMEE" "$N" + [ "$(($vht_cap & 2097152))" -eq 2097152 ] && append ht_capab "$list VHT-TXOP-PS" "$N" + [ "$(($vht_cap & 4194304))" -eq 4194304 ] && append ht_capab "$list HTC-VHT" "$N" + [ "$(($vht_cap & 201326592))" -eq 134217728 ] && append ht_capab "$list VHT-LINK-ADAPT2" "$N" + [ "$(($vht_cap & 201326592))" -eq 201326592 ] && append ht_capab "$list VHT-LINK-ADAPT3" "$N" + [ "$(($vht_cap & 268435456))" -eq 268435456 ] && append ht_capab "$list RX-ANTENNA-PATTERN" "$N" + [ "$(($vht_cap & 536870912))" -eq 536870912 ] && append ht_capab "$list TX-ANTENNA-PATTERN" "$N" + } + + [ -n $htmode ] && append ht_capab " option htmode $htmode" "$N" + if [ -x /usr/bin/readlink ]; then path="$(readlink -f /sys/class/ieee80211/${dev}/device)" path="${path##/sys/devices/}" diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config index bc999c0..e021cd0 100644 --- a/package/network/services/hostapd/files/hostapd-full.config +++ b/package/network/services/hostapd/files/hostapd-full.config @@ -139,6 +139,9 @@ CONFIG_IEEE80211R=y # IEEE 802.11n (High Throughput) support CONFIG_IEEE80211N=y +# IEEE 802.11ac (Very High Throughput) support +CONFIG_IEEE80211AC=y + # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging # code is not needed. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config index 01a04cb..3675709 100644 --- a/package/network/services/hostapd/files/hostapd-mini.config +++ b/package/network/services/hostapd/files/hostapd-mini.config @@ -138,6 +138,9 @@ CONFIG_PEERKEY=y # IEEE 802.11n (High Throughput) support CONFIG_IEEE80211N=y +# IEEE 802.11ac (Very High Throughput) support +CONFIG_IEEE80211AC=y + # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging # code is not needed. -- 1.9.rc1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel