mac80211.sh: detect_mac80211 should check available channels
Username: Rafał Miłecki
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=395
This problem was reported by few Netgear R8000 users and I managed to reproduce it. It’s related to the following code:
vht_cap=(iw phy "
dev" info | grep -c 'VHT Capabilities')
cap_5ghz=(iw phy "
dev" info | grep -c "Band 2")
[ "vht_cap" -gt 0 -a "
cap_5ghz" -gt 0 ] && {
mode_band="a";
channel="36"
htmode="VHT80"
}
Default htmode
The first problem is that even if hardware supports VHT80 it may be not available for every/any current channel. If channel 36 doesn’t support VHT80, for better user experience, it shouldn’t be set in /etc/config/wireless by default. Example:
root@lede:/# iw phy phy2 info Wiphy phy2 max # scan SSIDs: 10 max scan IEs length: 2048 bytes max # sched scan SSIDs: 0 max # match sets: 0 max # scan plans: 1 max scan plan interval: -1 max scan plan iterations: 0 Retry short limit: 7 Retry long limit: 4 Coverage class: 0 (up to 0m) Device supports roaming. Available Antennas: TX 0 RX 0 Supported interface modes: * IBSS * managed * AP * P2P-client * P2P-GO * P2P-device Band 2: Capabilities: 0x1062 HT20/HT40 Static SM Power Save RX HT20 SGI RX HT40 SGI No RX STBC Max AMSDU length: 3839 bytes DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 16 usec (0x07) HT TX/RX MCS rate indexes supported: 0-23 VHT Capabilities (0x0c025820): Max MPDU length: 3895 Supported Channel Width: neither 160 nor 80+80 short GI (80 MHz) SU Beamformer SU Beamformee VHT RX MCS set: 1 streams: MCS 0-9 2 streams: MCS 0-9 3 streams: MCS 0-9 4 streams: not supported 5 streams: not supported 6 streams: not supported 7 streams: not supported 8 streams: not supported VHT RX highest supported: 0 Mbps VHT TX MCS set: 1 streams: MCS 0-9 2 streams: MCS 0-9 3 streams: MCS 0-9 4 streams: not supported 5 streams: not supported 6 streams: not supported 7 streams: not supported 8 streams: not supported VHT TX highest supported: 0 Mbps Frequencies: * 5170 MHz [34] (disabled) * 5180 MHz [36] (20.0 dBm) * 5190 MHz [38] (disabled) * 5200 MHz [40] (20.0 dBm) * 5210 MHz [42] (disabled) * 5220 MHz [44] (20.0 dBm) * 5230 MHz [46] (disabled) * 5240 MHz [48] (20.0 dBm) * 5260 MHz [52] (20.0 dBm) (no IR, radar detection) * 5280 MHz [56] (20.0 dBm) (no IR, radar detection) * 5300 MHz [60] (20.0 dBm) (no IR, radar detection) * 5320 MHz [64] (20.0 dBm) (no IR, radar detection) * 5500 MHz [100] (20.0 dBm) (no IR, radar detection) * 5520 MHz [104] (20.0 dBm) (no IR, radar detection) * 5540 MHz [108] (20.0 dBm) (no IR, radar detection) * 5560 MHz [112] (20.0 dBm) (no IR, radar detection) * 5580 MHz [116] (20.0 dBm) (no IR, radar detection) * 5600 MHz [120] (20.0 dBm) (no IR, radar detection) * 5620 MHz [124] (20.0 dBm) (no IR, radar detection) * 5640 MHz [128] (20.0 dBm) (no IR, radar detection) * 5660 MHz [132] (20.0 dBm) (no IR, radar detection) * 5680 MHz [136] (20.0 dBm) (no IR, radar detection) * 5700 MHz [140] (20.0 dBm) (no IR, radar detection) * 5720 MHz [144] (disabled) * 5745 MHz [149] (disabled) * 5765 MHz [153] (disabled) * 5785 MHz [157] (disabled) * 5805 MHz [161] (disabled) * 5825 MHz [165] (disabled) valid interface combinations: * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1, total <= 3, #channels <= 1 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1, total <= 4, #channels <= 1 * #{ AP } <= 4, total <= 4, #channels <= 1, STA/AP BI must match root@lede:/# iw phy phy2 channels Band 2: * 5170 MHz [34] (disabled) * 5180 MHz [36] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40+ * 5190 MHz [38] (disabled) * 5200 MHz [40] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40- * 5210 MHz [42] (disabled) * 5220 MHz [44] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40+ * 5230 MHz [46] (disabled) * 5240 MHz [48] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40- * 5260 MHz [52] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5280 MHz [56] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5300 MHz [60] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5320 MHz [64] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5500 MHz [100] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5520 MHz [104] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5540 MHz [108] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5560 MHz [112] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5580 MHz [116] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5600 MHz [120] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5620 MHz [124] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5640 MHz [128] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5660 MHz [132] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40+ DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5680 MHz [136] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz HT40- DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5700 MHz [140] Maximum TX power: 20.0 dBm No IR Radar detection Channel widths: 20MHz DFS state: usable (for 163 sec) DFS CAC time: 0 ms * 5720 MHz [144] (disabled) * 5745 MHz [149] (disabled) * 5765 MHz [153] (disabled) * 5785 MHz [157] (disabled) * 5805 MHz [161] (disabled) * 5825 MHz [165] (disabled)
as you can see, VHT80 isn’t support on any currently available channel due to regulatory limits.
Default channel
Picking channel 36 blindly is a bad idea as it may not be available. In case of phy0/radio0 on Netgear R8000 only available channels are 149+ due to hardware/board design (see
ARM: BCM5301X: Set 5 GHz wireless frequency limits on Netgear R8000
).
root@lede:/# iw phy phy0 info Wiphy phy0 max # scan SSIDs: 10 max scan IEs length: 2048 bytes max # sched scan SSIDs: 0 max # match sets: 0 max # scan plans: 1 max scan plan interval: -1 max scan plan iterations: 0 Retry short limit: 7 Retry long limit: 4 Coverage class: 0 (up to 0m) Device supports roaming. Available Antennas: TX 0 RX 0 Supported interface modes: * IBSS * managed * AP * P2P-client * P2P-GO * P2P-device Band 2: Capabilities: 0x1062 HT20/HT40 Static SM Power Save RX HT20 SGI RX HT40 SGI No RX STBC Max AMSDU length: 3839 bytes DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 16 usec (0x07) HT TX/RX MCS rate indexes supported: 0-23 VHT Capabilities (0x0c025820): Max MPDU length: 3895 Supported Channel Width: neither 160 nor 80+80 short GI (80 MHz) SU Beamformer SU Beamformee VHT RX MCS set: 1 streams: MCS 0-9 2 streams: MCS 0-9 3 streams: MCS 0-9 4 streams: not supported 5 streams: not supported 6 streams: not supported 7 streams: not supported 8 streams: not supported VHT RX highest supported: 0 Mbps VHT TX MCS set: 1 streams: MCS 0-9 2 streams: MCS 0-9 3 streams: MCS 0-9 4 streams: not supported 5 streams: not supported 6 streams: not supported 7 streams: not supported 8 streams: not supported VHT TX highest supported: 0 Mbps Frequencies: * 5170 MHz [34] (disabled) * 5180 MHz [36] (disabled) * 5190 MHz [38] (disabled) * 5200 MHz [40] (disabled) * 5210 MHz [42] (disabled) * 5220 MHz [44] (disabled) * 5230 MHz [46] (disabled) * 5240 MHz [48] (disabled) * 5260 MHz [52] (disabled) * 5280 MHz [56] (disabled) * 5300 MHz [60] (disabled) * 5320 MHz [64] (disabled) * 5500 MHz [100] (disabled) * 5520 MHz [104] (disabled) * 5540 MHz [108] (disabled) * 5560 MHz [112] (disabled) * 5580 MHz [116] (disabled) * 5600 MHz [120] (disabled) * 5620 MHz [124] (disabled) * 5640 MHz [128] (disabled) * 5660 MHz [132] (disabled) * 5680 MHz [136] (disabled) * 5700 MHz [140] (disabled) * 5720 MHz [144] (disabled) * 5745 MHz [149] (20.0 dBm) * 5765 MHz [153] (20.0 dBm) * 5785 MHz [157] (20.0 dBm) * 5805 MHz [161] (20.0 dBm) * 5825 MHz [165] (20.0 dBm) valid interface combinations: * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1, total <= 3, #channels <= 1 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1, total <= 4, #channels <= 1 * #{ AP } <= 4, total <= 4, #channels <= 1, STA/AP BI must match root@lede:/# iw phy phy0 channels Band 2: * 5170 MHz [34] (disabled) * 5180 MHz [36] (disabled) * 5190 MHz [38] (disabled) * 5200 MHz [40] (disabled) * 5210 MHz [42] (disabled) * 5220 MHz [44] (disabled) * 5230 MHz [46] (disabled) * 5240 MHz [48] (disabled) * 5260 MHz [52] (disabled) * 5280 MHz [56] (disabled) * 5300 MHz [60] (disabled) * 5320 MHz [64] (disabled) * 5500 MHz [100] (disabled) * 5520 MHz [104] (disabled) * 5540 MHz [108] (disabled) * 5560 MHz [112] (disabled) * 5580 MHz [116] (disabled) * 5600 MHz [120] (disabled) * 5620 MHz [124] (disabled) * 5640 MHz [128] (disabled) * 5660 MHz [132] (disabled) * 5680 MHz [136] (disabled) * 5700 MHz [140] (disabled) * 5720 MHz [144] (disabled) * 5745 MHz [149] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40+ VHT80 * 5765 MHz [153] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40- VHT80 * 5785 MHz [157] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40+ VHT80 * 5805 MHz [161] Maximum TX power: 20.0 dBm Channel widths: 20MHz HT40- VHT80 * 5825 MHz [165] Maximum TX power: 20.0 dBm Channel widths: 20MHz