iwlwifi: mvm: send udev event upon firmware error to dump logs
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Mar 2014 19:15:06 +0000 (21:15 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Mar 2014 19:15:06 +0000 (21:15 +0200)
commit1bd3cbc1a0e9ed977a6bd470c5bc7bd36fd87e26
treee630bfe41212778b8358c86f6d603fb5a90546ec
parent8bd22e7bb0b02c24b3c9997670bbb65e0e0a7371
iwlwifi: mvm: send udev event upon firmware error to dump logs

When the firmware asserts, the driver will dump the firmware
state to an internal buffer. This buffer is kept aside until
it is dumped through debugfs. Once an external application
fetched the data, the buffer is freed and a new buffer can
be allocated in case another assert occurs.

A udev event is sent to trigger an external application.

A simple rule like:
DRIVER=="iwlwifi", ACTION=="change", RUN+="/sbin/dump_sram.sh"

can fetch the data from debugfs.

Here is my dump_sram.sh:

phyname=$(basename ${DEVPATH})
date=$(date +%F_%H_%M)
filename=/var/log/iwl-sram-${phyname}-${date}.bin
cat /sys/kernel/debug/ieee80211/${phyname}/iwlwifi/iwlmvm/fw_error_dump > ${filename}

The current SRAM size is 80KB so, currently:
$ ls -lh iwl-sram-phy0-2014-03-16_13_14.bin
-rw-r--r-- 1 emmanuel emmanuel 81K Mar 16 13:15 iwl-sram-phy0-2014-03-16_13_14.bin

and after compression:
$ ls -lh iwl-sram-phy0-2014-03-16_13_14.bin.xz
-rw-r--r-- 1 emmanuel emmanuel 13K Mar 16 13:15 iwl-sram-phy0-2014-03-16_13_14.bin.xz

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/fw-error-dump.h [new file with mode: 0644]
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/ops.c
drivers/net/wireless/iwlwifi/mvm/utils.c