iwlwifi: mvm: add trigger for firmware dump upon low RSSI
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 3 Feb 2015 12:29:36 +0000 (14:29 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 2 Mar 2015 06:20:32 +0000 (08:20 +0200)
Lots of issues can be caught when the RSSI drops. Add the
ability to collect the firmware data at that point.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h
drivers/net/wireless/iwlwifi/iwl-fw-file.h
drivers/net/wireless/iwlwifi/mvm/rx.c

index 95bef179ddc17c55f15e6c879e0a62fe13f487cd..37b38a585dd182f8fa1c44256f4a16ecc008d3df 100644 (file)
@@ -248,6 +248,8 @@ iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
  *     command response or a notification.
  * @FW_DB_TRIGGER_RESERVED: reserved
  * @FW_DBG_TRIGGER_STATS: trigger log collection upon statistics threshold.
+ * @FW_DBG_TRIGGER_RSSI: trigger log collection when the rssi of the beacon
+ *     goes below a threshold.
  */
 enum iwl_fw_dbg_trigger {
        FW_DBG_TRIGGER_INVALID = 0,
@@ -258,6 +260,7 @@ enum iwl_fw_dbg_trigger {
        FW_DBG_TRIGGER_FW_NOTIF,
        FW_DB_TRIGGER_RESERVED,
        FW_DBG_TRIGGER_STATS,
+       FW_DBG_TRIGGER_RSSI,
 
        /* must be last */
        FW_DBG_TRIGGER_MAX,
index de0e96d76fa30eb0a251c5fca985faa28f20104b..5ea381861d5d2c46c1dce922c40967681dc60185 100644 (file)
@@ -565,6 +565,14 @@ struct iwl_fw_dbg_trigger_stats {
        __le32 start_threshold;
 } __packed;
 
+/**
+ * struct iwl_fw_dbg_trigger_low_rssi - trigger for low beacon RSSI
+ * @rssi: RSSI value to trigger at
+ */
+struct iwl_fw_dbg_trigger_low_rssi {
+       __le32 rssi;
+} __packed;
+
 /**
  * struct iwl_fw_dbg_conf_tlv - a TLV that describes a debug configuration.
  * @id: conf id
index 9b2c537b5e951b267ace3ce43e22b1baccc909f9..6177e24f4c016d09c8496186d65c394d05bb5eb3 100644 (file)
@@ -345,6 +345,25 @@ int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
                struct iwl_mvm_sta *mvmsta;
                mvmsta = iwl_mvm_sta_from_mac80211(sta);
                rs_update_last_rssi(mvm, &mvmsta->lq_sta, rx_status);
+
+               if (iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_RSSI) &&
+                   ieee80211_is_beacon(hdr->frame_control)) {
+                       struct iwl_fw_dbg_trigger_tlv *trig;
+                       struct iwl_fw_dbg_trigger_low_rssi *rssi_trig;
+                       bool trig_check;
+                       s32 rssi;
+
+                       trig = iwl_fw_dbg_get_trigger(mvm->fw,
+                                                     FW_DBG_TRIGGER_RSSI);
+                       rssi_trig = (void *)trig->data;
+                       rssi = le32_to_cpu(rssi_trig->rssi);
+
+                       trig_check =
+                               iwl_fw_dbg_trigger_check_stop(mvm, mvmsta->vif,
+                                                             trig);
+                       if (trig_check && rx_status->signal < rssi)
+                               iwl_mvm_fw_dbg_collect_trig(mvm, trig, NULL, 0);
+               }
        }
 
        rcu_read_unlock();