NOTE: this page is for archival only, see the note at the end of the page.

Driver API tracing

Enabling

Since 2.6.32 mac80211 includes a tracing framework. To be able to use it, 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.

Using

Make sure you have debugfs mounted somewhere:

# mkdir /debug
# mount -t debugfs debugfs /debug

Then, simply enable the event tracing:

# echo 1 > /debug/tracing/events/mac80211/enable

Now do something, for example start hostapd:

# hostapd -c test.conf &

Finally, read the trace:

# less /debug/tracing/trace

If you've followed along with no other tracing configuration, you should get something like this:

# tracer: nop
#
#           TASK-PID    CPU#    TIMESTAMP  FUNCTION
#              | |       |          |         |
         hostapd-1717  [004] 10038.012037: drv_start: phy0
         hostapd-1717  [004] 10038.012047: drv_add_interface: phy0 vif:ffff88001ed31088(3) addr:02:00:00:00:00:00 ret:0
         hostapd-1717  [004] 10038.012056: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0xe
         hostapd-1717  [004] 10038.041698: drv_config: phy0 ch:0xffffffff ret:0
         hostapd-1717  [004] 10038.041703: drv_conf_tx: phy0 queue:0 ret:0
         hostapd-1717  [004] 10038.041707: drv_conf_tx: phy0 queue:1 ret:0
         hostapd-1717  [004] 10038.041711: drv_conf_tx: phy0 queue:2 ret:0
         hostapd-1717  [004] 10038.041714: drv_conf_tx: phy0 queue:3 ret:0
         hostapd-1717  [004] 10038.041720: drv_configure_filter: phy0 changed:0x0 total:0x0 mc:0
         hostapd-1717  [004] 10038.041764: drv_configure_filter: phy0 changed:0x0 total:0x0 mc:1
         hostapd-1717  [004] 10038.041811: drv_configure_filter: phy0 changed:0x0 total:0x0 mc:1
         hostapd-1717  [004] 10038.083795: drv_configure_filter: phy0 changed:0x0 total:0x0 mc:1
         hostapd-1717  [004] 10038.083860: drv_configure_filter: phy0 changed:0x0 total:0x0 mc:1
         hostapd-1717  [004] 10038.151893: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0x20
         hostapd-1717  [004] 10038.151968: drv_config: phy0 ch:0x40 ret:0
         hostapd-1717  [004] 10038.152054: drv_set_rts_threshold: phy0 value:-1 ret:0
         hostapd-1717  [004] 10038.251801: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0x300
         hostapd-1717  [004] 10038.251899: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0x2
         hostapd-1717  [004] 10038.251977: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0x8
         hostapd-1717  [004] 10038.252053: drv_bss_info_changed: phy0 vif:ffff88001ed31088(3) changed:0x4

This is a static dump of the wiki, taken after locking it in January 2015. The new wiki is at https://wireless.wiki.kernel.org/.
versions of this page: last, v7, v6, v5, v4, v3, v2, v1