Slow antenna diversity profiles on the AR5416 and later 11n NICs
Some hardware vendors wish to support more physical antennas than physical radios. This is to provide some (hopefully!) improvements in signal levels by using spatial diversity.
However, the 802.11n MIMO devices don't support the traditional antenna switch table and fast-diversity technique that the previous chips did. It relies purely on the MIMO signal processing from all the active radios.
(TODO: find the specific model D-Link PCI device that uses an AR9220 but has three antennas. It implements this!)
To implement this, one or more external antenna switches are used. The AR5416 and later devices do have a switch table - one global and one extra per radio chain. These are typically used to switch in and out various components based on the operating mode and required attenuation. However, there's no absolute requirement that these bits be used for this - for example, if no external attenuation stages are needed, there's no need to use an IO bit for an attenuator. That bit can just be used as an antenna switch; one just needs to ensure that said bit is always set no matter what the current operating mode.
The pre-11n devices have two switch tables - one for each antenna. The AR5416 and later MIMO devices don't. So there's no way for the MAC or baseband to switch between multiple antenna configurations during transmit or receive (eg to implement fast receive diversity.) However, there's no real reason why the software can't actually do this. It can simply load in a different antenna switch table into the relevant registers and the hardware will use that for subsequent operations.
It's then up to software to track which antenna configuration is actually better.
The relevant registers are thus:
- AR_PHY_SWITCH_COM is the common switch register. For the AR5416, AR9160, AR9220 and AR9287, it is 16 bits wide. The AR9285 has a longer switch register as it does support a form of classic diversity.
- AR_PHY_SWITCH_CHAIN_0 is the switch table register for the first radio chain. The second and third (if there) are 0x1000 and 0x2000 away respectively.
- These are programmed in ath_hal/ar5416/ar5416_reset.c:ar5416SetBoardValues(). The AR9285 and AR9287 chips have their own board configuration routines in ath_hal/ar9002/ar9285_reset.c and ath_hal/ar9002/ar9287_reset.c respectively.
The common antenna switch value in the EEPROM is 32 bits wide; however as it's 16 bits wide for the AR5416/AR9220 (and other chips, see above) it can actually hold two sets of common switch register values.
- So the software treats that as "Antenna A" or "Antenna B", with "A" being the lower 16 bits and "B" being the upper 16 bits.
Now, the important bit here is that it's totally under software control - it's up to the software to track RX RSSI/EVM and TX success rates and determine which antenna configuration behaves better.
Does the FreeBSD HAL implement this?
In short - no. It wouldn't be hard to add - but one would need a NIC that requires it, and some time to expose the antenna selection method as HAL functions. It's not all that important at the moment, so no-one has added it.
What other variants are there?
There are some Mikrotik boards based on the AR9220 which have multiple external antenna connectors. They use hard-coded antenna switch table (common and per-chain) values in their closed-source driver to select the external antenna switch settings to control which antennas are used for TX and RX. Not much more is known at this point.