3.2. mango_wlan Kernel Module

The mango_wlan kernel module is a Linux mac80211 driver for the Mango 802.11 MAC/PHY IP. The driver implements all required ops for the mac80211 API.

Supports:

  • Monitor mode (including control and management Rx) with Tx injection
  • STA client mode
  • AP mode
  • RTS/CTS (Request To Send / Clear To Send)
  • CTS-to-self
  • DSSS, NONHT, HTMF advertised rates in management frames
  • Virtual interfaces (up to 4)
  • Firmware-supported beaconing for tight TBTT timing
  • Custom statistics reporting through debugfs

MAC Interface

The mango_wlan module communicates with the MAC via a pair of message FIFOs with addresses and interrupt IDs defined in the device tree. These message FIFOs are used primarily for MAC/PHY configuration. Tx/Rx packets are handled by dedicated DMAs and do not transit the message FIFOs.

The mango_wlan exchanges atomic messages with the MAC for all interface configuration commands. The list of message IDs and formats varies between releases. It is essential the mango_wlan driver and MAC software versions match.

debugfs Statistics

Once the module is loaded, /sys/kernel/debug/ieee80211/mango-wlan-phy will be populated with a number of debugfs files. Most are automatically populated with data from the mac80211 framework. mango_wlan provides the following additional files:

netdev:<virtual interface>/stations/<station MAC address>/mango_wlan

This file provides Tx and Rx statistics about the link to a particular station. These statistics are organized according to PHY rate and MCS. It also provides statistics on the number of retries needed in each rate stage of the Minstel rate control algorithm.

netdev:<virtual interface>/mango_latency_debugfs

This file provides information about important system latencies measured by the driver and MAC at runtime.

Beacon Latency

When operating in AP mode, the MAC firmware handles periodic beaconing in order to abide by the strict Target Beacon Transmission Time (TBTT) requirements from the 802.11 specification, but mac80211 provides the payload of each beacon. To do this, the MAC firmware requests a new beacon payload from the driver. There is a tradeoff in the timing of this request. Too early and the beacon contents may represent stale state by the time it is actually transmitted. Too late and a beacon payload update may not occur in time for the TBTT. The default heuristic used by the mango_wlan driver is that beacon update triggers are sent \(2/3\) of the way through a beacon interval. A typical beacon interval is 100 TU, or 102,400 microseconds. In this case, we anticipate that a new beacon payload will be requested approximately 34,133 microseconds before the beacon must be sent.

An example output from mango_latency_debugfs confirms that beacon payload updates are occuring in a timely manner:

                mango_wlan Latency Statistics
----------------------------------------------------
Beacon Update Slack:
 Min: 23907 usec
 Avg: 34733 usec
 Max: 34754 usec
----------------------------------------------------