[[PageOutline]] This information has been tested and created for use on the Gateworks Single Board Computers (SBCs)''', specifically the Ventana family that utilizes the Freescale i.MX6 processors. Gateworks SBCs can be viewed at the following link: [http://www.gateworks.com] [[Image(http://trac.gateworks.com/raw-attachment/wiki/OpenWrt/wireless/relayd/gw5100realsmall.png,200px)]] For information on various wireless technologies see the following pages: * [wiki:wireless/modem Cellular Modems] * [wiki:wireless/bluetooth Bluetooth] = 802.11 !WiFi = Gateworks has had extensive experience with wireless radio's. This list includes miniPCI and miniPCIe, specifically with the Atheros wireless chipsets which happen to be one of the most common chipset's used under Linux in the industrial world. Out of box, our BSP's include the latest wireless drivers available. This allows our customers to get the latest and greatest support right away. [[Image(GW17001-228x228.jpg)]] [=#radios] == Common Wireless Radio Hardware == Gateworks re-sells some of the more popular radios in our [http://shop.gateworks.com/index.php?route=product/category&path=70_74 on-line store] and has tested several others: * '''Wireless 802.11AC''' * Using ath10k Driver: * [https://www.compex.com.sg/product/wle1216v5-20/ MiniPCIe Compex WLE1216V5-20] - '''Highest Throughput''' * 802.11b/g/a/c wave2 * 4x4 MU-MIMO * single-band: 5 * tested on Newport GW630x with 4.14 kernel (required [http://www.candelatech.com/ath10k-10.4.php Candela firmware]) * [https://www.compex.com.sg/wp-content/uploads/2016/12/WLE1216V5-20-v1.3-WH-216_PRELIM.pdf Datasheet] * [http://shop.gateworks.com/index.php?route=product/product&path=70_74&product_id=196 MiniPCIe Compex WLE900VX 7AA] - '''Standard Recommended Radio''' * Pre-Certified with FCC * 802.11b/g/a/c * dual-band: 2.4, 5 * 3x3 MIMO * [http://www.compex.com.sg/index.php/minipcie/ Datasheet] * MiniPCIe Compex WLE900N5 * 802.11a/c * single-band: 5 * 3x3 MIMO * MiniPCIe Unex DAXA-O1 * 802.11n/a/c * dual-band: 2.4, 5 * 3x3 MIMO * [http://www.taiwantrade.com.tw/EP/unex/products-detail/en_US/835711/DAXA-O1%3A_802.11ac_n_a_single_band_3x3_PCIe_mini_card,_QCA9880/ Datasheet] * MiniPCIe [http://shop.gateworks.com/index.php?route=product/product&path=70_74&product_id=147 Doodle Labs ACE-DB-3 Radio] * 802.11b/g/a/c * tri-band: 2.4, 5, 4.9 * 3x3 MIMO * [http://www.doodlelabs.com/products/802-11-wifi-mimo-radio-transceivers/data-sheet-ace-db-3-aco-db-3-acm-db-3/ Datasheet] * Using Intel iwlwifi Driver: * MiniPCIe [http://www.intel.com/content/www/us/en/wireless-products/dual-band-wireless-ac-7260-bluetooth.html Intel 7260] * 802.11 ac/a/b/g/n * dual-band: 2.4, 5 * 2x2 MIMO * [http://ark.intel.com/products/75439/Intel-Dual-Band-Wireless-AC-7260 Other Specifications] * '''Note: This card cannot emit radiation in the 5GHz range, i.e. AP mode does not work in 5GHz''' * '''Wireless 802.11N''' * [http://shop.gateworks.com/index.php?route=product/product&path=70_74&product_id=172 MiniPCIe Unex DHXA-225] - '''Very common, cost effective''' * [http://shop.gateworks.com/index.php?route=product/product&product_id=92 MiniPCIe Ubiquiti SR71E] * [http://shop.gateworks.com/index.php?route=product/product&path=70_74&product_id=91 MiniPCIe Compex WLE350NX] - EOL, not recommended for new design * '''Wireless 802.11B/G''' * miniPCIe [http://shop.gateworks.com/index.php?route=product/product&product_id=8 Ubiquiti XR2] Some additional radio vendors: * Doodle Labs - High powered !WiFi radios [http://doodlelabs.com/] * Compex - High powered !WiFi radios [http://www.compex.com.sg/] * Unex - High powered !WiFi radios [http://www.unex.com.tw/wi-fi] * Silex - WiFi radios [http://www.silexamerica.com/] * Ubiquiti - High powered !WiFi 802.11abg radios [http://www.ubnt.com/] [=#prism] === [http://www.doodlelabs.com/ Doodlelabs] Prism-FES (Front End Subsystems) === [http://www.doodlelabs.com/ Doodlelabs] creates frequency shifting modules to allow frequencies between 700MHz - 6.5GHz, while using standard linux drivers. These systems are comprised of one ath9k/ath10k radio with a FES module on each chain. The below picture will help visualize this: [[Image(Prism-FES-1.png, 256px)]] In this system, a radio has two separate FES modules per chain. From the factory, Doodlelabs calibrates each chain on a specific radio to a particular FES module. This means that a radio with 2 chains is specifically paired with two FES modules. You can find which FES modules are paired with what radio by comparing serial numbers (Hint: all components in the system have the same serial). It's very highly recommended by Doodlelabs that nothing is mixed and matched. Radio's configured to be used in a Prism-FES all have EEPROM values programmed in to only allow a maximum of 10dBm output (per chain). '''Anything higher will damage the frequency translator'''. For this reason, Prism-FES's that are using ath10k are '''recommended to stay away from using the STA firmware (999.999.0.636)''' as we found that this firmware does not honor the EEPROM settings and configures the radio to output much higher than 10dBm. ==== Part Numbering Scheme ==== Before we break this down further, the following terminology used by Doodlelabs is required: Grade Breakdown: * Military Grade - This is their Industrial grade option. This grade has extended temp of -40C - +85C. This grade also has antenna port protection, and is built to a higher standard than their other radio's. * Enterprise - This is their Indoor Commercial grade option. This grade has a temperature range of 0C - +60C and has no antenna port protection. * Outdoors - This is their Outdoor Commercial grade option. This grade has a temperature range of -40C - +40C and has antenna port protection. The model number NM-770-2F is broken down into three sections: NM, 770, 2F * '''NM''' - The 'N' refers to this being an 80211N radio. If this were 'ACM', for example, that would mean the radio is a 80211AC radio. The last character of the first section refers to the grade the radio is. In this case, the 'M' stands for Military, or rugged, grade. * '''770''' - This number refers to the middle frequency of the frequency range that the card supports. In this case, the card supports 746~798, the midpoint center frequency resulting in 770. If there is no number, and instead has either 'DB' or 'TB', that only means "Dual-Band" and "Tri-Band", respectively. When DB is specified, that refers to both the 2.4GHz and 5.8GHz range. TB refers to DB, but also includes the 4.9GHz frequency range. * '''2F''' - The number '2' refers to the number of chains the radio has. In this case, there are two chains on this radio. A '3' would indicate three chains. The 'F' alludes to the fact that each chain get's frequency shifted through the frequency shifting module. This means that you're always going to have a FES module per chain. So in conclusion, the NM-770-2F system includes a 80211N radio with two chains, each getting frequency shifted by a FES module to the 770MHz range. ==== Licensed vs Unlicensed ==== In the US, the difference between Licensed and Unlicensed comes down to how the FCC regulates the frequency spectrum. In general, Doodlelabs refers to 'unlicensed' radio's the 2.4GHz and 5GHz range frequencies. All other frequencies fall under being 'licensed'. ==== Frequency !Shifting/Power Level Mappings ==== Coming Soon. ==== References ==== * http://www.doodlelabs.com/products/prism-fes/ * http://www.doodlelabs.com/products/mimo-radio-transceivers/ [=#support] == Gateworks BSP Support == Gateworks supports multiple Board Support Packages. The following table shows details on !WiFi support for each: ||= BSP =||= Product Families =||= Drivers =||= Modes =|| || OpenWrt || All || ath5k/ath9k/ath10k || AP / client || || [wiki:Yocto Yocto] || Ventana || ath5k/ath9k/ath10k || AP / client || || [wiki:Android] || Ventana || ath5k/ath9k || AP / client || || [wiki:ubuntu] || Ventana, Newport || ath9k/ath10k || AP / client || If you are looking for additional support please contact support@gateworks.com [=#openwrt] === OpenWrt Wireless Configuration === OpenWrt uses the standard Linux wireless utilities but configured and launched through its own configuration system. For more info on configuring Wireless for OpenWrt see: * [wiki:OpenWrt/wireless OpenWrt Wireless Configuration] [=#yocto] === Yocto Wireless Configuration === Yocto uses the standard Linux utilities, init scripts, and conf files. For more info on configuring Wireless for Yocto see: * [wiki:Yocto/Wireless Yocto Wireless Configuration] [=#android] === Android Wireless Configuration === Android uses the standard Linux utilities but wraps them around a Network Daemon that performs configuration and management. For more info on configuring Wireless for Android see: * [wiki:Android/wireless Android Wireless Configuration] [=#Ubuntu] === Ubuntu Wireless Configuration === Ubuntu uses the standard Linux utilities, init scripts, and conf files. For more info on configuring Wireless for Ubuntu see: * [wiki:ubuntu#wireless Ubuntu Wireless Configuration] [=#linux] == Wireless Configuration (Standard Linux) == There are several tools and applications that are used by Linux to configure wireless devices: * iw * hostapd * wpa_supplicant For more info on configuring Wireless for Yocto see: * [wiki:Yocto/Wireless Yocto Wireless Configuration] === iw === The 'iw' tool is the modern tool (which replaces the older set of WIRELESS_EXTENSION tools such as iwconfig, iwpriv, iwlist, etc) for configuration of wireless drivers. The full documentation is [http://wireless.kernel.org/en/users/Documentation/iw here] but some common commands we find useful are: * list devices: {{{ iw dev ;# 'iw dev wlan0 info' for each dev iw phy ;# 'iw phy phy0 info' for each dev }}} * list device info: {{{ iw dev wlan0 info ;# basic info: ifname, mode, mac (same as iw wlan0 info) iw phy phy0 info ;# detailed info: antennas, supported modes, bands, freqs (same as iw phy0 info) iw dev wlan0 link # info about link }}} * antenna info: {{{ iw phy phy0 | grep Antenna ;# get Antenna bitmasks iw phy phy0 set antenna_gain iw phy phy0 set antenna | all ;# set allowed antennas }}} * TX power info: {{{ iw dev wlan0 set txpower [] iw phy phy0 set txpower [] iw phy phy0 set distance ;# set appropriate coverage class (0-114750) iw phy phy0 set coverage ;# set coverage class (1 for every 3us of air prop time 0-255) }}} * channel: {{{ iw dev wlan0 set channel [HT20|HT40+|HT40-] ;# or iw phy iw dev wlan0 set freq [HT20|HT40+|HT40-] ;# or iw phy iw dev wlan0 set freq [20|40|80|80+80|160] [
] [
] iw phy phy0 set freq [HT20|HT40+|HT40-] }}} * 4-addr header parsing (WDS): {{{ iw dev wlan0 set 4addr }}} * interface mode: {{{ iw dev wlan0 set type }}} * rate masks (when fixed mask set you won't see T,p,P change in rc_stats but will see the stats change) {{{ iw dev set bitrates ;# clear masks iw dev wlan0 set bitrates ht-mcs-5 19 ;# set MCS-19 }}} * interface creation: {{{ iw phy phy0 interface add type iw phy phy0 interface add mon0 type monitor iw dev del ;# delete interface }}} * turn off powersave mode: {{{ # May increase wireless performance depending on radio iw dev wlan0 set power_save off }}} Notes: * most commands allow specification of a network device (ie wlan0) or a phy (ie phy0) * most 'set' commands will show current settings if a value isn't specified * 'iw wlan0 ...' is short for 'iw dev wlan0 ...' and 'iw phy0 ...' is short for 'iw phy phy0 ...' References: * http://wireless.kernel.org/en/users/Documentation/iw * source: - release tarballs: https://www.kernel.org/pub/software/network/iw/ - git http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git (tagged per kernel release) === hostapd === The hostapd application is the userspace application that configures and manages wireless drivers in Access Point (AP) mode. References: * http://hostap.epitest.fi/hostapd/ * http://wireless.kernel.org/en/users/Documentation/hostapd * source: - stable release tarballs: http://w1.fi/hostapd/ - git http://w1.fi/cgit/hostap/ (cgit: http://hostap.epitest.fi/cgit/hostap/) ==== Access Point Configuration (AP) ==== By default the Yocto BSP is configured to enable a Wireless Access Point. The 'hostap-daemon' package provides the [http://wireless.kernel.org/en/users/Documentation/hostapd hostapd] application which configures the radio for AP mode using configuration from {{{/etc/hostapd.conf}}}. You will need to configure {{{/etc/hostapd.conf}}} to specify important details such as: * interface * driver type (the default is nl80211 which is used for all modern mac80211 drivers) * bridge config * ssid * channel * encryption The default {{{/etc/hostapd.conf}}} file contains detailed documentation and you can find more info [http://wireless.kernel.org/en/users/Documentation/hostapd here]. However, because every wireless cards' capabilities are vastly different from one another, Gateworks has written a script to help ascertain a proper {{{hostapd.conf}}} file. Though not 100% of the functionality mentioned in the ​[http://wireless.kernel.org/en/users/Documentation/hostapd hostapd documentation] is supported, it does help the user create a {{{hostapd.conf}}} file specific to their wireless card. This '''bash''' script, named {{{hostapd-conf}}}, is included in our latest Yocto 1.8/Master branches. To read over the script, please click ​[https://github.com/Gateworks/meta-gateworks/blob/master/recipes-support/hostapd-conf/hostapd-conf/hostapd-conf here]. Usage is as follows: {{{#!bash root@ventana:~# ./hostapd-conf hostapd-conf [OPTIONS] [] [] Options: --help - This help --br-name - Name of bridge --wds <0|1> - Enable WDS --version - Print this version: v1.0 Example: Print channel information for wlan0 and exit: hostapd-conf wlan0 State wlan0 SSID is 'myssid', on channel 6 with WPA2 passphrase "nowayinside": hostapd-conf wlan0 myssid 6 nowayinside State wlan0 is in named bridge br0, enable WDS, SSID 'myssid', channel 6, in HT20(802.11n), with WPA2 passphrase "nowayinside": hostapd-conf --br-name=br0 --wds=1 wlan0 myssid 6 HT20 nowayinside }}} Below are some usage cases for this script. In these examples, a WLE900VX radio was used. Note, any information that isn't apparent in the below script may be found via the {{{iw phy phy info}}} command. ===== Step 0 : Scan Available Options ===== To view all channels/frequencies and HT modes that can emit radiation on a specified interface, indicate just the interface: {{{#!bash root@ventana:~# ./hostapd-conf wlan0 ERROR: SSID is empty Available Channel Information on phy0 ===================================== Band 1: Channel Freq Allowed HT Modes 0 0000 HT20 HT40 HT40+ HT40- 1 2412 HT20 HT40 HT40+ 2 2417 HT20 HT40 HT40+ 3 2422 HT20 HT40 HT40+ 4 2427 HT20 HT40 HT40+ 5 2432 HT20 HT40 HT40+ HT40- 6 2437 HT20 HT40 HT40+ HT40- 7 2442 HT20 HT40 HT40+ HT40- 8 2447 HT20 HT40 HT40+ HT40- 9 2452 HT20 HT40 HT40+ HT40- 10 2457 HT20 HT40 HT40- 11 2462 HT20 HT40 HT40- Band 2: Channel Freq Allowed HT Modes 0 0000 HT20 HT40 HT40+ HT40- VHT20 VHT40 VHT80 36 5180 HT20 HT40 HT40+ VHT20 VHT40 VHT80 40 5200 HT20 HT40 HT40- VHT20 VHT40 VHT80 44 5220 HT20 HT40 HT40+ VHT20 VHT40 VHT80 48 5240 HT20 HT40 HT40- VHT20 VHT40 VHT80 149 5745 HT20 HT40 HT40+ VHT20 VHT40 VHT80 153 5765 HT20 HT40 HT40- VHT20 VHT40 VHT80 157 5785 HT20 HT40 HT40+ VHT20 VHT40 VHT80 161 5805 HT20 HT40 HT40- VHT20 VHT40 VHT80 165 5825 HT20 HT40 HT40+ VHT20 VHT40 VHT80 }}} ===== Step 1 : Configure Access Point ===== '''2.4GHz 802.11g''' To create a {{{hostapd.conf}}} file in the 2.4GHz range, using 802.11g technology: {{{#!bash root@ventana:~# ./hostapd-conf wlan0 test-ssid 6 Settings: IFACE: wlan0 PHY: phy0 SSID: test-ssid CHANNEL: 6 FREQ: 2437 BANDS: 1 2 HWMODE: g Written to hostapd-phy0.conf root@ventana:~# cat hostapd-phy0.conf # For more options, please visit the following: # http://linuxwireless.org/en/users/Documentation/hostapd/ driver=nl80211 logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 # a=5GHz, g=2.4GHz hw_mode=g # channel=0 turns on ACS survey channel=6 # Please take the following into consideration: # Country code (ISO/IEC 3166-1). Used to set regulatory domain. # Set as needed to indicate country in which device is operating. # This can limit available channels and transmit power. #country_code=US # Enable IEEE 802.11d. This advertises the country_code and the set of allowed # channels and transmit power levels based on the regulatory limits. The # country_code setting must be configured with the correct country for # IEEE 802.11d functions. # (default: 0 = disabled) #ieee80211d=1 # Enable IEEE 802.11h. This enables radar detection and DFS support if # available. DFS support is required on outdoor 5 GHz channels in most countries # of the world. This can be used only with ieee80211d=1. # (default: 0 = disabled) #ieee80211h=1 interface=wlan0 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 disassoc_low_ack=1 preamble=1 wmm_enabled=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 ssid=test-ssid ieee80211n=0 ieee80211ac=0 }}} '''5.8GHz 802.11ac''' To create a {{{hostapd.conf}}} file in the 5GHz range, using 802.11ac technology, plus WPA2 encryption: {{{#!bash root@ventana:~# ./hostapd-conf wlan0 test-ssid 157 VHT80 nowayinside Settings: IFACE: wlan0 PHY: phy0 SSID: test-ssid CHANNEL: 157 FREQ: 5785 BANDS: 1 2 HWMODE: a HTMODE: VHT80 PASSPHRASE: nowayinside Written to hostapd-phy0.conf root@ventana:~# cat hostapd-phy0.conf # For more options, please visit the following: # http://linuxwireless.org/en/users/Documentation/hostapd/ driver=nl80211 logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2 # a=5GHz, g=2.4GHz hw_mode=a # channel=0 turns on ACS survey channel=157 # Please take the following into consideration: # Country code (ISO/IEC 3166-1). Used to set regulatory domain. # Set as needed to indicate country in which device is operating. # This can limit available channels and transmit power. #country_code=US # Enable IEEE 802.11d. This advertises the country_code and the set of allowed # channels and transmit power levels based on the regulatory limits. The # country_code setting must be configured with the correct country for # IEEE 802.11d functions. # (default: 0 = disabled) #ieee80211d=1 # Enable IEEE 802.11h. This enables radar detection and DFS support if # available. DFS support is required on outdoor 5 GHz channels in most countries # of the world. This can be used only with ieee80211d=1. # (default: 0 = disabled) #ieee80211h=1 interface=wlan0 ctrl_interface=/var/run/hostapd ctrl_interface_group=0 disassoc_low_ack=1 preamble=1 wmm_enabled=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 # Put a 3 here if you want both WPA/WPA2 wpa=2 wpa_passphrase=nowayinside wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP ssid=test-ssid ieee80211n=1 ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40] ieee80211ac=1 vht_oper_chwidth=1 vht_oper_centr_freq_seg0_idx=155 vht_capab=[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN][RX-STBC1][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7] }}} ===== Step 2 : Copy Access Point Configuration ===== After the {{{hostapd-.conf}}} file has been created and any edits have been made (if any), you may either: 1. Copy the {{{hostapd-phy.conf}}} file over {{{/etc/hostapd.conf}}} and restart hostapd, noting that {{{/etc/network/interfaces}}} isn't configuring the wlan interface automatically (e.g. make sure no {{{auto wlan0}}} exists in {{{/etc/network/interfaces}}}) {{{#!bash mv /etc/hostapd.conf /etc/hostapd.conf.bak # Backup original hostapd.conf file cp hostapd-phy0.conf /etc/hostapd.conf /etc/init.d/hostapd restart }}} 1. Run hostapd using this new conf file, knowing that the settings won't persist over a new boot: {{{#!bash root@ventana:~# /etc/init.d/hostapd stop root@ventana:~# hostapd -B hostapd-phy0.conf Configuration file: hostapd-phy0.conf [ 1825.468968] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready wlan0: interface state UNINITIALIZED->HT_SCAN [ 1825.636135] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready }}} At this point your wlan0 interface should be up and authenticating with WiFi clients and the next step is to configure IP networking (below). ==== Routed Access Point ==== A routed Access Point is used when you want the wireless network to have its own DHCP server and network. In this case traffic is routed across the WAN (Wide Area Network) interface (ie eth0) and WLAN (Wireless Local Area Network) interface (ie wlan0). This is the typical configuration for a wireless access point. For this you need: * the WAN (Wide Area Network) interface (ie eth0) should have an IP configuration from the WAN segment from the upstream Internet provider * the WLAN network interface (ie wlan0) should be assigned a static address on a private network * A DHCP server (ie dnsmasq) configured to serve a private IP address range on the WLAN network interface (ie wlan0) * Network Address Translation (NAT) routing configuration using Linux iptables and Linux kernel netfilter support * ip forwarding enabled in kernel Configuration: 1. configure your WAN and WLAN interfaces in /etc/network/interfaces. Here we will use eth0 as our WAN configured to obtain IP configuration via DHCP from the upstream provider and wlan0 as our WLAN configured with a DHCP server for a private subnet on the 10.0.0/24 network: {{{#!bash cat << EOF > /etc/network/interfaces # WAN interface auto eth0 iface eth0 inet dhcp # WLAN interface auto wlan0 iface wlan0 inet static address 10.0.0.1 netmask 255.255.255.0 # NAT configuration via iptables post-up iptables-restore < /etc/iptables.ipv4.nat EOF }}} 1. configure dnsmasq. Here we will configure it to serve addresses on the 10.0.0/24 network with a pool of 190 addresses from .10 to .200 with a 2hour lease: {{{#!bash cat << EOF > /etc/dnsmasq.conf interface=wlan0 dhcp-range=10.0.0.10,10.0.0.200,2h EOF }}} 1. configure Linux NAT routing. We will do this for the current boot and use that configuration to store hooks for subsequent reboots: {{{#!bash # enable forwarding on bootup echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf # configure NAT via iptables and then save its config to the restore script iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT iptables-save > /etc/iptables.ipv4.nat chmod +x /etc/iptables.ipv4.nat }}} 1. restart networking and enable forwarding (or sync and reboot at this point instead): {{{#!bash /etc/init.d/networking restart echo 1 > /proc/sys/net/ipv4/ip_forward }}} ==== Bridged Access Point ==== A bridged Access Point is used to provide an a Wireless Access Point on a LAN that already has a DHCP server and creates a bridge between the LAN interface and the WIFI interface such that wireless client DHCP requests will be bridged to the LAN and answered from there. For this you need: * bridge-utils package * CONFIG_BRIDGE support in kernel (default in our Yocto kernel) * ip forwarding enabled in kernel 1. create a bridge between your wifi interface and your lan interface. For example, assuming wlan0 and eth0: {{{#!bash # create a bride and add interfaces to it brctl addbr br0 brctl addif br0 eth0 brctl addif br0 wlan0 # bring it up ifconfig br0 up # use DHCP to assign IP info udhcpc -i br0 }}} * Note that you can use /etc/network/interfaces to bring up and configure the bridge, but if you are using a fairly limited ifup/ifdown (like busybox) you will probably need to create the bridge first (ie in an init script prior to networking coming up) 1. enable IP forwarding: {{{#!bash echo 1 > /proc/sys/net/ipv4/ip_forward }}} * you can enable IP forwarding on bootup with: {{{#!bash echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf }}} Note that if your intention is to also create a wireless client bridge where a wireless client connection is bridging its wireless to a local Ethernet network you will need to enable WDS/4-addr header parsing on both the Access Point and the Client. To do this on the Access Point, add the following to {{{/etc/hostapd.conf}}}: {{{#!bash wds_sta=1 }}} Alternatively, if using the {{{hostapd-conf}}} script, an option exists to enable this feature via {{{--wds=1}}}. ===== Troubleshooting ===== If encountering bad TCP performance with MIMO cards (typically ath10k): * see [wiki:wireless/wifi#tcp_cong TCP Congestion Control] * see [wiki:wireless/wifi#tsq TCP Small Queues] If encountering issues: * {{{hostapd-conf}}} was written for and takes advantage of the bash shell, make sure you aren't running it with another shell program (ie Ubuntu's default "dash" shell) * ensure both hostapd and wpa_supplicant are not both trying to manage the interface (ie you have it configured for both AP and Client mode) * ensure your client can see the AP (ie {{{iw dev wlan0}}} scan for a Linux client, or use a wireless scanner such as 'Wifi Analyzer' on an Android device) * For client mode ensure the kernel shows that you are associated with the AP. You should see {{{wlan0: associated}}} in the kernel messages * check your encryption settings * if you can ping between the AP and the client directly but not get through them: * check your routing configuration (ie via {{{route -n}}} on Linux) and make sure you have a proper gateway * if trying to bridge wireless to ethernet networks ensure 'both' the AP and the Client have 4addr header parsing enabled * if DNS resolution is not occurring first make sure you can ping the nameserver by IP === wpa-supplicant === The wpa-supplicant application is the userspace application that configures and manages wireless drivers in Station (STA) mode. References: * http://hostap.epitest.fi/wpa_supplicant/ * http://wireless.kernel.org/en/users/Documentation/wpa_supplicant * source: - stable release tarballs: http://w1.fi/hostapd/ - git git://w1.fi/srv/git/hostap.git (cgit: http://hostap.epitest.fi/cgit/hostap/) [=#drivers] == Linux Kernel Drivers == There are various linux kernel drivers such as madwifi, ath5k, ath9k, ath10k, iwlwifi, to name a few. The below few sections will talk at length about several of them. [=#ath5k] === Atheros AR5xxx 802.11abg cards (ath5k) === There are two driver options for the Atheros AR5xxx based 802.11abg cards: 1. madwifi driver - development of this driver has ceased but it still has been known to outperform the fully opensource ath5k replacement and has some additional features that are not (and will not be) in ath5k 2. ath5k - mac80211 driver - driver should be stable, but does not get much attention anymore as most users have moved on to 802.11n or 802.11ac devices * see [http://wireless.kernel.org/en/users/Drivers/ath5k ath5k] for more info Theoretical max throughput rate of 802.11abg is 54mbps. Typical performance is around 30mbps (TCP) [=#ath9k] === Atheros AR9xxx 802.11abgn cards (ath9k) === The linux-wireless 'ath9k' driver supports the Atheros AR9xxx based 802.11n cads. The 802.11n standard released in 2009 introduces some additions on top of the 802.11a standard: * widening the channel bandwidth (up to 40MHz) * Multiple Input(rx) Multiple Output(tx) streams (MIMO) up to 4 * 64-QAM modulation Current popular hardware available supports up to 3x3 MIMO and up to 40MHz channel bandwidths using HT40+/HT40- which can 'theoretically yield' 300mbps of throughput. Actual results will vary based on CPU and bus bottlenecks, driver performance, and RF characteristics. We regularly obtain throughputs around 150mbps. See [http://wireless.kernel.org/en/users/Drivers/ath9k ath9k] for more info [=#ath10k] === Atheros AR10xx 802.11ac cards (ath10k) === The linux-wireless 'ath10k' driver supports the Atheros AR10xx based 802.11ac cards. The 802.11ac standard which was developed from 2011 through 2013 and approved in Jan 2014, introduces some additions on top of the 802.11n standards: * widening the channel bandwidth (up to 160MHz) * increased MIMO spatial streams (up to 8 vs 4 in 802.11n) * multi-user MIMO (aka MU-MIMO) * high-density modulation (up to 256-QAM vs 64-QAM for 802.11n) Current popular hardware available supports up to 4x4 MU-MIMO and up to 160MHz channel bandwidths using VHT160 which can ''theoretically'' yield >2.0gbps of throughput. Some cards also support VHT80+80 which functions similarly to VHT160 but is composed to two 80MHz channels that do not need to be contiguous, which can help with band selection. Actual results will vary based on CPU and bus bottlenecks, driver performance, and RF characteristics. ath10k notes: * 10.1.467.2-1 * What we ship with * Focuses as AP in which DFS works. STA mode works, but not well tested. No !AdHoc or P2P support * Works in wireless bridge with upstream ath10k patches. These patches are in our 14.08 Branch (as well as trunk) of OpenWrt. * 999.999.0.636 * Supports both AP and STA, !AdHoc, and P2P. Has issues with DFS and cannot be configured an an AP in a wireless bridge * Has less than half the performance than the 10.1.467.2-1 firmware. This was a primary reason for not choosing this firmware as our default shipped firmware. * Monitor mode is not supported (crashes the firmware). * TX Power inconsistent ==== Verifying / Checking Firmware Version ==== To check which version of ath10k firmware is being used on the Single board computer, use the dmesg and grep command: {{{ root@OpenWrt:/# dmesg | grep ath10k [ 10.934967] ath10k: qca988x hw2.0 (0x4100016c, 0x043202ff) fw 10.1.467.2-1 root@OpenWrt:/# }}} ==== Altnerative Firmware instructions ==== To select between default and custom firmware you must rename or re-link it using the existing filenames in the driver directory. The driver will not use your custom firmware unless it has a name it's familiar with. This can vary depending on the chipset firmware you are intending to use as well as the BSP Some examples: * link CT's QCA988x firmware on OpenWrt 16.02: {{{#!bash $ cd /lib/firmware/ath10k/QCA988X/hw2.0/ $ ln -sf firmware-2-ct-full-community-beta.bin firmware-2.bin $ # Reboot board }}} * Replace stock QCA9984 (to support Wave2 cards such as the WLE1216) firmware with CT's: {{{#!bash # Download Candelatech's firmware.bin and board.bin files wget http://www.candelatech.com/downloads/ath10k-9984-10-4/board-2-ct.bin wget http://www.candelatech.com/downloads/ath10k-9984-10-4/firmware-5-ct-full-community.bin # Back up old files cp /lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin /lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin_old cp /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin_old # Drop in Candelatech files mv board-2-ct.bin /usr/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin mv firmware-5-ct-full-community.bin /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin }}} That's it! You can use this method to link any firmware, so long as it's called firmware-2.bin (and if using the latest ath10k drivers, firmware-3.bin). [=#candelatech] ===== Candelatech ===== [http://www.candelatech.com Candelatech] licenses the source code for the ath0k firmware from QCA and has been actively developing it to provide enhancements and bugfixes that are not necessarily limitted to QCA's stock firmware priorities. One such enhancement is that they add IBSS/adhoc support. Candelatech also has a [http://www.candelatech.com/ath10k-10.4.php web page] for custom firmware files that may be required for certain radio's such as the [https://www.compex.com.sg/product/wle1216v5-20/ WLE1216V5-20 wave 2 radio]. You may need this firmware if the ath10k driver and QCAXXXX firmware combination does not properly probe your device and create an interface. This would appear in your system log as: {{{ root@xenial-newport:~# dmesg | grep ath10k [ 2.362523] ath10k_pci 0000:02:00.0: Direct firmware load for ath10k/QCA9984/hw1.0/board-pci-168c:003e:11ad:0804.bin failed with error -2 [ 2.362527] ath10k_pci 0000:02:00.0: failed to load spec board file, falling back to generic: -2 [ 2.362536] ath10k_pci 0000:02:00.0: Direct firmware load for ath10k/QCA9984/hw1.0/board.bin failed with error -2 [ 2.362538] ath10k_pci 0000:02:00.0: failed to fetch generic board data: -2 [ 2.362540] ath10k_pci 0000:02:00.0: failed to fetch board file: -2 [ 2.362541] ath10k_pci 0000:02:00.0: could not fetch firmware files (-2) [ 2.362543] ath10k_pci 0000:02:00.0: could not probe fw (-2) }}} If this is the case, you can use CT's firmware as follows: {{{#!bash # Download Candelatech's firmware.bin and board.bin files wget http://www.candelatech.com/downloads/ath10k-9984-10-4/board-2-ct.bin wget http://www.candelatech.com/downloads/ath10k-9984-10-4/firmware-5-ct-full-community.bin # Back up old files cp /lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin /lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin_old cp /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin_old # Drop in Candelatech files mv board-2-ct.bin /lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin mv firmware-5-ct-full-community.bin /lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin }}} * Note that this example was done for the [https://www.compex.com.sg/product/wle1216v5-20/ WLE1216V5-20 wave 2 radio] using a {{{QCA9984}}} chipset. You may need to change your {{{wget}}} and {{{/usr/lib/firmware/...}}} targets accordingly. * Note that if you want to use the stock firmware you can just replace the board-2.bin file with CT's until the stock firmware supports the Wave2 cards properly. Finally, to see what's current in ath10k, see [http://wireless.kernel.org/en/users/Drivers/ath10k here] for more info [=#testing] == Wireless Testing == First, some testing vocabulary: ||||= Symbol Legend =|| ||= Key =||= Meaning =|| || AP || Access Point || || STA || Station || || <---> || Ethernet Connection || || <- -> || Wireless Connection || || (S) || iperf server ^(1)^ || || (C) || iperf client ^(2)^ || || X || Doesn't Work || || NA || Didn't Test || ,,1. TCP server run with: iperf -s -w3M; UDP server run with: iperf -su,, [[BR]] ,,2. TCP client run with: iperf -c $IP -i1 -t25 -w3M; UDP client run with: iperf -u -c $IP -i1 -t25 -b999M,, * Infrastructure mode means the following: {{{ 1. Testing between AP and STA (S) (C) AP<- ->STA 2. Testing between WAN and STA (Our standard infrastructure mode test) (S) (C) PC-A<--->AP<- ->STA }}} * Wireless Bridging means the following: {{{ (S) (C) PC-A<--->AP<- ->STA<--->PC-B }}} * !AdHoc means the following: {{{ 1. No Bridge (S) (C) NODE1<- ->NODE2 (Our standard !AdHoc test) 2. With Bridge (Requires special software) (S) (C) PC-A<--->NODE1<- ->NODE2<--->PC-B }}} Below is an example setup of how we test and with what hardware: [[Image(wireless/wifi:wirelesssetup.png)]] ,,1. 60dB Attenuators on each chain,, [[BR]] ,,2. Directional Coupler (Krytar 1850 shown),, [[BR]] ,,3. Power Sensor (Agilent 8481A shown),, [[BR]] ,,4. Power Meter (HP E4418A shown),, [[BR]] The image above shows our testing setup. In general, to test TX Power, we use a Power Meter + Power Sensor + Directional Coupler. Further, when people talk about performance, they typically are talking about throughput from AP<- ->STA. When we talk about performance, we spell out specifically which network topology we are testing, who is generating/sending packets, and who is receiving. This should make it very clear where performance numbers came from and how you can compare against them. [=#performance] === Performance === We define performance as the rate at which data can travel at. This essentially means looking at throughput numbers via performance tools such as [https://iperf.fr/ iperf]. One of the ways we stress test our product is by running it through conditions that our customers might use. Since we also support a wide variety of wireless cards, we test a whole lot. The below sections will talk about how to tune a product to get the best performance and talk about the numbers we've gotten for each card we've tested. ==== Performance Tuning ==== There are many characteristics that factor into performance (throughput): * Radio factors: * use wider channel bandwidths for the highest bandwidth (ie HT40 for 802.11n or VHT80/VHT160 for 802.11ac) * RF characteristics (look at the driver's rate control statistics to ensure you are achieving the expected modulation rate. Modulation rates are dynamic and achieving the best one will result in the highest bandwidth) * CPU factors: * CPU performance bottleneck (which can be verified by watching output of 'top' while doing performance tests) can vary greatly based on SMP configuration, IRQ configuration, kernel netfilter modules, userspace services, and CPU cache configuration: * TCP Congestion control (affecting TCP performance) * see [wiki:wireless/wifi#tcp_cong TCP Congestion Control] * see [wiki:wireless/wifi#tsq TCP Small Queues] Additional References: * see [wiki:performance_tuning#WirelessTuning Wireless Tuning] for more information * see [wiki:multicoreprocessing Multi-core Processing] for more information ==== Performance Comparison (Measured Data Rates) ==== Below are our results with the following firmware modifications: * Firewall was turned off ===== 802.11AC (ath10k|iwlwifi) ===== This table contains some throughput numbers (in Mbits/s) seen during testing. ||= Radio =||= Chipset =||= Platform =||= OS Used =||||= Infrastructure Results^2^ =||||= Wireless Bridge Results^3^ =||||= !AdHoc Results^4^ =|| || || || || || TCP || UDP || TCP || UDP || TCP || UDP || || 3x3 ACE-DB-3 || QCA9880 || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA || 271 || 380 || 4 || 9 || || || || || Yocto 1.6 (backports 20140808) || NA || NA || NA || NA || NA || NA || |||| || 3x3 WLE900VX || QCA9880 || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA || 228 || 495 || NA || NA || || || || || Yocto 1.6 (backports 20140808) || NA || NA || NA || NA || NA || NA || || || || GW6300 (Newport) || Ubuntu (16.02 Xenial) || NA || NA || 330 || 677 || NA || NA || |||| || 3x3 DAXA-O1 || QCA9880 || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA || 240 || 463 || 13^1^ || NA || || || || || Yocto 1.6 (backports 20140808) || NA || NA || NA || NA || NA || NA || |||| || 4x4 WLE1216V5-20 || QCA9984 || GW6300 (Newport) || Ubuntu (16.02 Xenial) || NA || NA || 800^1^ || 718^1^ || NA || NA || ,,1. Best performing in this category,, [[BR]] ,,2. Infrastructure tested by generating packets on PC-A and sourcing them on the STA. See [wiki:wireless#WirelessTesting the wireless testing] section for more details,, [[BR]] ,,3. Wireless bridging works only with the 10.1.467.2-1 firmware with upstream patches,, [[BR]] ,,4. !AdHoc works only with the 999.999.0.636 firmware and since there isn't wireless bridging, this number is based on NODE to NODE,, [[BR]] ===== 802.11N (ath9k) ===== ||= Radio =||= Platform =||= OS Used =||||= Infrastructure Results^3^ =||||= Wireless Bridge Results =||||= !AdHoc Results^4^ =|| || || || || TCP || UDP || TCP || UDP || TCP || UDP || || 1x1 GTM671WFSd || GW2387 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||21 || 29 || NA || NA || || (miniPCIe) || GW2388-4 (Laguna) || OpenWrt (14.08 BSP) || NA || NA ||NA || NA || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||50 || 65 || NA || NA || |||||||||||||||||||| || 2x2 SR71-15 || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||110 || 161 || NA || NA || || (miniPCI) || || OpenWrt (14.08 BSP) || NA || NA ||101 || 151 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||92 || 112 || NA || NA || |||||||||||||||||||| || 2x2 WLM200N5-26 || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||102 || 141 || NA || NA || || (miniPCI) || || OpenWrt (14.08 BSP) || NA || NA ||108 || 151 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||88 || 106 || NA || NA || |||||||||||||||||||| || 2x2 SR71e || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||122 || 147 || NA || NA || || (miniPCIe) || || OpenWrt (14.08 BSP) || NA || NA ||102 || 151 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||190^2^ || 245^2^ || NA || NA || |||||||||||||||||||| || 3x3 HNMA-H5 || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||108 || 156 || NA || NA || || (miniPCI) || || OpenWrt (14.08 BSP) || NA || NA ||115 || 151 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||111 || 119 || NA || NA || |||||||||||||||||||| || 3x3 WLE300NX || GW2387 (Laguna) || OpenWrt (12.10 BSP) || NA || NA ||82.6 || 145 || NA || NA || || (miniPCIe) || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||100 || 138 || NA || NA || || || || OpenWrt (14.08 BSP) || NA || NA ||107 || 140 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||240 || 367^1^ || NA || NA || |||||||||||||||||||| || 3x3 WLE350N5-25 || GW2388-4 (Laguna) || OpenWrt (13.06 BSP) || NA || NA ||153 || 178 || NA || NA || || (miniPCIe) || || OpenWrt (14.08 BSP) || NA || NA ||150 || 181 || NA || NA || || || GW5400 (Ventana) || OpenWrt (14.08 BSP) || NA || NA ||243^1^ || 355 || NA || NA || ,,1. Best performing in this category (802.11n),, [[BR]] ,,2. Best performing in this sub-category (802.11n, number of chains, form-factor),, [[BR]] ,,3. Infrastructure tested by generating packets on PC-A and sourcing them on the STA. See [wiki:wireless#WirelessTesting the wireless testing] section for more details,, [[BR]] ,,4. !AdHoc testing is based on NODE to NODE,, [[BR]] ===== 802.11ABG (ath5k|madwifi) ===== ||= '''Radio''' ||= '''Platform''' ||= '''OS Used''' ||||= '''Infrastructure Results^2^''' ||||= '''Wireless Bridge Results''' ||||= '''!AdHoc Results''' || || || || || TCP || UDP || TCP || UDP || TCP || UDP || || CM9 || GW2388-4 (Laguna) || OpenWrt (12.10BSP) + madwifi || NA || NA || 10.4 || 11.5 || NA || NA || || || || OpenWrt (12.10BSP) + ath5k || NA || NA || 30.1^1^ || 32.4^1^ || NA || NA || ,,1. Best performing in this category,, [[BR]] ,,2. Infrastructure tested by generating packets on PC-A and sourcing them on the STA. See [wiki:wireless#WirelessTesting the wireless testing] section for more details,, [[BR]] [=#terminology] == !WiFi Terminology and Concepts == [=#tcp_cong] === TCP Congestion Control === Starting in Linux 2.6.7 (and back-ported to 2.4.27), Linux includes alternative congestion control algorithms beside the traditional 'reno' algorithm. 2.6.13 added support for plug-able congestion control algorithms set using sysctl variable net.ipv4.tcp_congestion_control which is set to bic/cubic or reno by default depending on kernel versions. The Internet has predominantly used loss-based congestion control (largely Reno or CUBIC) since the 1980s, relying on packet loss as the signal to slow down. While this worked well for many years, loss-based congestion control is unfortunately out-dated in today's networks. On today's Internet, loss-based congestion control causes the infamous bufferbloat problem, often causing seconds of needless queuing delay, since it fills the bloated buffers in many last-mile links. On today's high-speed long-haul links using commodity switches with shallow buffers, loss-based congestion control has abysmal throughput because it over-reacts to losses caused by transient traffic bursts. TCP congestion control algorithms can be configured in the Kenrel under 'Networking support (NET) -> Networking options -> TCP/IP networking (INET) -> TCP: advanced congestion control (TCP_CONG_ADVANCED). The default is typically CONFIG_TCP_CONG_CUBIC which builds in CUBIC (default) and Reno. A more modern algorithm called BBR [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/ipv4/Kconfig?id=0f8782ea14974ce992618b55f0c041ef43ed0b78 was introduced more recently]. You can select between multiple TCP congestion control algorithms via userspace sysctl: {{{#!bash cat /proc/sys/net/ipv4/tcp_available_congestion_control # see available algos sysctl net.ipv4.tcp_congestion_control=reno # select Reno }}} References: - https://fasterdata.es.net/host-tuning/linux/expert/ - https://linuxgazette.net/135/pfeiffer.html - https://www.cs.helsinki.fi/research/iwtcp/papers/linuxtcp.pdf [=#tsq] === TCP Small Queues (TSQ) === TCP Small Queues (TSQ) performs local flow control, limiting the amount of data in the queues on the sending host. Like TSO autosizing, TSQ has its own balancing act, keeping the queues small to reduce latency and head-of-line blocking (HoLB), while keeping the queues just large enough to ensure the queues on the sending host. The kernel TSQ logic allows up to 1ms of bytes to be queued into qdisc and driver queues. However, Wifi aggregation (multiple streams) needs a bigger budget to allow bigger rates to be discovered by various TCP Congestion Control algos. A [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a9b76fd0db9f0d426533f96a68a62a58753a51e patch] has made it into the 4.15 kernel that allows wifi drivers to adjust this value as needed but drivers need to be updated to add this functionality. Gateworks has a [https://github.com/Gateworks/linux-newport/commit/64f1fcb3f7a7715dc6fa1e8b30f02f01032fb2dd patch] in the Newport kernel that allows userspace to change the default 1ms buffering time manually with sysctl. Increasing the buffering to something between 1ms and 9ms shows significant throughput increases for MIMO cards. For example: {{{#!bash sysctl net.ipv4.tcp_tsq_limit_output_interval=5 # use 5ms of buffering in TSQ logic }}} References: - [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041 Ubuntu bug with discussion] - [https://github.com/Gateworks/linux-newport/commit/64f1fcb3f7a7715dc6fa1e8b30f02f01032fb2dd Patch allowing userspace configuration of TSQ buffer time via sysctl] - [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a9b76fd0db9f0d426533f96a68a62a58753a51e patch Linux 4.15 patch to allow wifi drivers to adjust the TSQ buffer size] - [https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=111b49902465116a8353d29afe02eff0f56ea0a3 patch in LEDE adjusting TSQ logic] [=#mac80211] === mac80211 === mac80211 refers to the Linux kernel 802.11 MAC layer software stack written for !SoftMAC radios. For many years all radio drivers utilize this layer and those drivers are referred to as 'mac80211 drivers'. An exception to this would be the popular 'madwifi' driver used for Atheros AR5XXX based 802.11abg radios (the mac80211 driver alternative to madwifi is the ath5k driver). References: * http://wireless.kernel.org/en/developers/Documentation/mac80211 [=#crda] === Regulatory Domain === Different regulatory domain's exist around the world that are regulated by various bodies - examples include the FCC for North Ameriaca, and ETSI for many European countries. Modern Linux mac80211 based drivers use the crda (Central Regulatory Domain Agent) userspace agent for regulatory domain rule database and checking. It is comprised of a database of regulatory domain rules. Alternatively mac80211 can be configured at compile-time with CONFIG_CFG80211_INTERNAL_REGDB to use an internal regdb based on net/wireless/db.txt which can be easier to udpate if need be for your application (providing you are making changes that are legal in the regulatory domain you will be operating in). One example of where this would be useful is if you are licensed to operate in the US Public Safety band, which crda has no support for. Notes: * OpenWrt uses this option * If you enable CONFIG_CFG80211_INTERNAL_REGDB and fail to overwrite the default net/wireless/db.txt a default domain will be used which sets the 'no IR' flag on all channels (meaning you can not transmit) References: * http://wireless.kernel.org/en/developers/Regulatory * http://git.kernel.org/cgit/linux/kernel/git/linville/wireless-regdb.git/ [=#acs] === Automatic Channel Selection (ACS) === The Automatic Channel Selection (ACS) feature is useful if you want the operating channel to be selected based on usage in your area. A specification exists on how this is done. Notes: * a modern hostapd (2013-11-21) must be used and built with CONFIG_ACS * specify channel=0 or channel=acs_survey in hostapd.conf References: * http://wireless.kernel.org/en/users/Documentation/acs [=#dfs] === Dynamic Frequency Selection (DFS) === Dynamic Frequency Selection (DFS) is a specification required by certain regulatory domains on specific channels in order to eliminate conflicts with weather and government/military radar equipment. For this reason it is sometimes know as 'radar detection' (which is likely a better description of it). This is often required for channels on the 5.8GHz band and there are specific rules for how and if a radio can transmit on these channels. Because DFS is complex many small office and home office AP's as well as some enterprise AP's don't allow operation at all on DFS channels in the 5GHz band and many client devices are not certified for DFS operation. Notes: * a modern hostapd (2013-11-21) must be used * not supporting DFS limits the channels that can be used: * In the US (FCC regulatory domain) there are 4 channels in the 5.8GHz band that do not require DFS and 4 that do The ath9k as well as ath10k (and possibly others) fully support ETSI DFS and FCC DFS requirements according to reports on the linux-wireless maillist and various radio certifications. References: * http://wireless.kernel.org/en/developers/DFS [=#antennaselect] === Antenna Selection === MIMO (Multiple-In Multiple-Out) radios (802.11n and 802.11ac) have multiple transmit and multiple receive antennas (also known as 'chains'). On some devices/drivers you can configure which are used for tx as well as rx using the 'set antenna' command: {{{ iw phy0 info | grep Antenna # show available Antennas iw phy0 set antenna 1 2 # set tx for antenna1, rx for antenna 2 iw phy0 set antenna 1 3 # set tx for antenna1, rx for antenna 2 and 3 }}} * the values are a bitmask (ie 1 for antenna1, 2 for antenna2, 4 for antenna 3, 3 for antenna 1&2, 6 for antenna 2&3 etc) * typically the interface needs to be in a down state (ifconfig wlan0 down) in order to set the antenna selection bitmasks * not all drivers support this [=#guardband] === Guard band Interval (GI) === The guard band interval describes how long you wait in between packets before transmission. For 802.11 OFDM this is 800ns hjwever 802.11n (also supported in 802.11ac) introduced a 400ns option to increase data-rates. This new 400ns GI is referred to as a 'short' GI and the original 800ns is referred to as a 'long' GI. Notes: * The rate control algorithm may decide between short GI and long GI based on statistics and alternate this over time [=#chwidth] === Channel Width === Channel Width refers to the bandwidth per channel and varies per 802.11 mode: * [http://en.wikipedia.org/wiki/IEEE_802.11b-1999 802.11b] - defines 20MHz channel width (this allows for 3 non-overlapping channels out of the 11 channels defined in the 2.4GHz band) * [http://en.wikipedia.org/wiki/IEEE_802.11n-2009 802.11n] - added the capability of 40MHz channels referred to as 'HT' or High Throughput channels. When using 40MHz HT channels you must specify HT40- to use the current channel specified frequency and the 20MHz below it, and HT40+ to use the current channel specified frequency and the 20MHz above it * [http://en.wikipedia.org/wiki/IEEE_802.11ac 802.11ac] - added the capability of 80MHz and 160MHz channels referred to as 'VHT' or Very High Throughput channels * Wave 2 - added an 80+80MHz configuration that could be set for two non contiguous bands to minimize interference Some drivers also support 'half' channel bandwidth (10MHz) and/or 'quarter' channel bandwidth (5Mhz) which is useful if you don't need the bandwidth provided by standard (20MHz) channels or HT/VHT channels and instead want more channel separation. Note that as you increase the channel width, you increase channel overlap and decrease separation. [=#mcs] === Modulation Rates === Various 802.11 specifications allow for varying modulation schemes which trade off error resilience, throughput, and effective distance. Each transmission can vary the modulation scheme and A 'rate control algorithm' has the ability to change this dynamically for each node being transmitted to based on different statistics. Modulation Schemes: * [http://en.wikipedia.org/wiki/IEEE_802.11b-1999 802.11b] - allowed for 1M, 2M, 5.5M, 11M CCK modulation rates * [http://en.wikipedia.org/wiki/IEEE_802.11g-2003 802.11g] - added additional OFDM modulation schemes to allow for 6M, 9M, 12M, 18M, 24M, 36M, 48M, and 54M modulation rates * [http://en.wikipedia.org/wiki/IEEE_802.11n-2009 802.11n] - added additional modulation schemes to allow several more rates and introduced the concept of a Modulation and Coding Scheme (MCS) index to describe them * [http://en.wikipedia.org/wiki/IEEE_802.11ac 802.11ac] - added 2 additional MCS indexes for new 256-QAM modulation schemes * Wave 2 - Improved on the original Wave 1 release by adding MU-MIMO and an optional 4th spatial stream, see this [https://www.cisco.com/c/en/us/solutions/collateral/enterprise-networks/802-11ac-solution/q-and-a-c67-734152.html Cisco FAQ] for more information Notes: * you can use the 'iw dev wlan0 set bitrates' command to set bitmasks to indicate which modulation rates to allow * there is not a standard mac80211 way to determine what modulation rate is being used, or what the rate control algorithm is doing * some devices/drivers use the mac80211 rate control algorithms (there are 2 to choose from at compile time) and others use algorithms baked into device firmware * [http://mcsindex.com/ Modulation Table Online ] [=#adhoc] === Adhoc mode (IBSS) === Though not part of the 802.11 spec (was part of the 802.11 draft), a popular mode is referred to as 'adhoc' mode or 'IBSS' mode. In this mode there is no authentication/de-authentication and no concept of an Access Point. Instead a 'network' is defined by the 'BSSID' used by the nodes. Network discovery is performed by listening to beacons and beacon transmission is shared by nodes in a BSSID (each node has a beacon timer with a random backoff interval which is reset when a beacon matching the nodes network is received which tends to share the beacon transmission load). A scheme was defined so that nodes would join a network if a beacon is received matching the nodes network configuration and BSSID's would 'merge' depending on timestamps however this is not implemented consistently and can cause issues such as merge storms across various drivers/chipsets. Because of this often adhoc networks will define a BSSID instead. Because adhoc mode is not in the 802.11 spec and is not as popular as infrastructure mode (AP/STA) it isn't always as stable as infrastructure mode. While not required, Adhoc networking is often used as the underlying connection mode for layer2 (MAC layer) and layer3 (IP layer) MESH networks such as olsrd. When using adhoc mode, you do not need hostapd or wpa_supplicant and the iw tool can be used to join/leave adhoc network: {{{ iw phy phy0 interface add wlan0 type ibss # create an interface on phy0 called wlan0 configured for adhoc mode iw dev wlan0 ibss join myssid 5180 # join the 'myssid' network, on 5180MHz (20MHz) and rely on IBSS discovery and merging iw dev wlan0 ibss leave # leave the adhoc network }}} Some other useful commands for adhoc nodes: {{{ iw dev wlan0 set type ibss # change an existing wlan0 device to ibss mode (if must be down) iw dev wlan0 ibss join myssid 5180 0a:0b:0c:0d:0e:0f # join the 'myssid' network, on 5180MHz (20MHz) with fixed bssid iw dev wlan0 ibss join myssid 5180 HT40- 0a:0b:0c:0d:0e:0f # join the 'myssid' network, on 5180MHz (40MHz using 5180 and the ch below) with fixed bssid }}} === Frame Aggregation === As data rates increase the overhead of management and headers starts to create bandwidth bottlenecks. The 802.11n specification introduced the concept of '''Frame Aggregation''' to combat this. Two types of aggregation was introduced: A-MPDU and A-MSDU. This does not need to be enabled and should be used automatically by the driver if the card has the capability. References: * http://en.m.wikipedia.org/wiki/Frame_aggregation [=#qos] === Quality of Service === The 802.11e specification added various aspects to 802.11 to create the concept of multiple data queues with different priorities in order to create a quality of service. References: * http://en.m.wikipedia.org/wiki/802.11e#Enhanced_distributed_channel_access_.28EDCA.29 * https://wireless.wiki.kernel.org/en/developers/documentation/mac80211/queues