Driver API tracing
Since 2.6.32 mac80211 includes a tracing framework, and since 3.2 it is always enabled if possible (which means if EVENT_TRACING is enabled).
To be able to use it on kernels before 3.2, enable CONFIG_MAC80211_DRIVER_API_TRACER (requires tracing and CONFIG_MAC80211_DEBUG_MENU).
CONFIG_MAC80211_DRIVER_API_TRACER: Say Y here to make mac80211 register with the ftrace framework for the driver API -- you can see which driver methods it is calling then by looking at the trace. If unsure, say N. Symbol: MAC80211_DRIVER_API_TRACER [=y] Prompt: Driver API tracer Defined at net/mac80211/Kconfig:209 Depends on: NET && WIRELESS && MAC80211_DEBUG_MENU && EVENT_TRACING Location: -> Networking support (NET [=y]) -> Wireless (WIRELESS [=y])
Now recompile your kernel (modules) and reboot/insert the modules.
The easiest way to give a trace to other people is to use trace-cmd, see https://lwn.net/Articles/341902/. To record a trace with trace-cmd, use
trace-cmd record -e mac80211
This will record until you hit Ctrl-C to abort. The result is stored in a file "trace.dat" which you can send around for analysis.
To analyse a file, use
trace-cmd report -i trace.dat | less
In addition to mac80211, some drivers include tracing as well.
For iwlwifi, set the IWLWIFI_DEVICE_TRACING Kconfig option. You can then get new trace subsystems:
- the commands exchanged between driver and device
- the device IO accesses and interrupt information
- uCode events (not sure they're useful today)
trace-cmd record -e mac80211 -e iwlwifi