Selaa lähdekoodia

iwlwifi: mvm: add trigger for firmware dump upon low RSSI

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>
Emmanuel Grumbach 10 vuotta sitten
vanhempi
commit
3ec50b5eec

+ 3 - 0
drivers/net/wireless/iwlwifi/iwl-fw-error-dump.h

@@ -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,

+ 8 - 0
drivers/net/wireless/iwlwifi/iwl-fw-file.h

@@ -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

+ 19 - 0
drivers/net/wireless/iwlwifi/mvm/rx.c

@@ -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();