On 2014-02-02 14:09, Felix Fietkau wrote: > On 2014-01-31 17:58, Sven Eckelmann wrote: >> 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> >> --- >> v4: Use autoconfig for HT40-/+ when VHT is activated as reported by Matti >> Laakso >> >> .../mac80211/files/lib/netifd/wireless/mac80211.sh | 67 >> +++++++++++++++++++++- >> 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, 112 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..bb5298d 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,76 @@ 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) >> + 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-]";; >> + esac >> + ;; >> + >> + 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/}" > Please leave the ht_capab additions out of the generated config. You can > move this code to the netifd script after the processing of the json > ht_capab array, and rework it to look something like this: > > # config options code > config_add_boolean \ > max_mpdu_7991 \ > max_mpdu_11454 [...] > > # setup code > json_get_vars \ > max_mpdu_7991:1 \ > max_mpdu_11454:1 [...] > > [ "$((($vht_cap & 3) * $max_mpdu_7991))" -eq 1 ] && \ > ht_capab="$ht_capab[MAX-MPDU-7991]" > [ "$((($vht_cap & 3) * $max_mpdu_11454))" -eq 2 ] && \ > ht_capab="$ht_capab[MAX-MPDU-11454]" > [...] Correction: Using the max-mpdu-* options as example was probably a bad idea, those should be implemented as a single max_mpdu option where you can specify the maximum value. The other flags could be implemented like above though.
- Felix _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel