3.2. mango_wlan Kernel Module

The mango_wlan kernel module is a Linux mac80211 SoftMAC driver. The driver implements all required ops for the mac80211 SoftMAC API.

Supports:

  • Monitor mode (including control/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 (4 by default, can be extended)
  • Firmware-supported beaconing for tight TBTT timing
  • Firmware-supported Tx queueing
  • Custom statistics reporting through debugfs

MAC Interface

The mango_wlan module communicates with the MAC via the mango_wlan_msg_fifo kernel module. This architecture allows the mango_wlan module to be hardware agnostic - it does not depend on any memory addresses or interrupt IDs from the device tree, nor any PL-specific design parameters. All hardware-specific parameters are handled by the mango_wlan_msg_fifo module.

The mango_wlan exchanges atomic messages with the MAC for all packet Tx/Rx and 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. 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.

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 via a message through mango_wlan_msg_fifo. 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
----------------------------------------------------