iwlwifi: dbg_ini: enable ignore consecutive trigger feature
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Sun, 13 Jan 2019 11:51:57 +0000 (13:51 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 14 Feb 2019 09:29:51 +0000 (11:29 +0200)
Enable ignore consecutive trigger feature which allows to configure the
driver to skip consecutive triggers from the same type.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.h

index 8d1416e8a2030c9fb8ce0f81f7847fa80a3649f3..202f96e9ca0cc92657dd5ec8fd1a314ff0f357f7 100644 (file)
@@ -1484,8 +1484,7 @@ _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt,
        if (id == FW_DBG_TRIGGER_FW_ASSERT)
                id = IWL_FW_TRIGGER_ID_FW_ASSERT;
 
-       if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs)) ||
-           !fwrt->dump.active_trigs[id].active)
+       if (!iwl_fw_ini_trigger_on(fwrt, id))
                return NULL;
 
        trigger = fwrt->dump.active_trigs[id].trig;
index 16656949b505e71cb54ea51538708d5f54d605f4..a199056234d3b5cf0aea64fcd4ff6d95afe85ba4 100644 (file)
@@ -162,9 +162,9 @@ iwl_fw_dbg_trigger_stop_conf_match(struct iwl_fw_runtime *fwrt,
 }
 
 static inline bool
-iwl_fw_dbg_no_trig_window(struct iwl_fw_runtime *fwrt, u32 id, u32 dis_ms)
+iwl_fw_dbg_no_trig_window(struct iwl_fw_runtime *fwrt, u32 id, u32 dis_usec)
 {
-       unsigned long wind_jiff = msecs_to_jiffies(dis_ms);
+       unsigned long wind_jiff = usecs_to_jiffies(dis_usec);
 
        /* If this is the first event checked, jump to update start ts */
        if (fwrt->dump.non_collect_ts_start[id] &&
@@ -181,11 +181,12 @@ iwl_fw_dbg_trigger_check_stop(struct iwl_fw_runtime *fwrt,
                              struct wireless_dev *wdev,
                              struct iwl_fw_dbg_trigger_tlv *trig)
 {
+       u32 usec = le16_to_cpu(trig->trig_dis_ms) * USEC_PER_MSEC;
+
        if (wdev && !iwl_fw_dbg_trigger_vif_match(trig, wdev))
                return false;
 
-       if (iwl_fw_dbg_no_trig_window(fwrt, le32_to_cpu(trig->id),
-                                     le16_to_cpu(trig->trig_dis_ms))) {
+       if (iwl_fw_dbg_no_trig_window(fwrt, le32_to_cpu(trig->id), usec)) {
                IWL_WARN(fwrt, "Trigger %d occurred while no-collect window.\n",
                         trig->id);
                return false;
@@ -222,24 +223,22 @@ _iwl_fw_dbg_trigger_on(struct iwl_fw_runtime *fwrt,
 })
 
 static inline bool
-_iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
-                      const enum iwl_fw_dbg_trigger id)
+iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
+                     enum iwl_fw_ini_trigger_id id)
 {
-       struct iwl_fw_ini_active_triggers *active =
-               &fwrt->dump.active_trigs[id];
-       u32 ms;
+       struct iwl_fw_ini_trigger *trig;
+       u32 usec;
+
 
-       if (!fwrt->trans->ini_valid)
-               return false;
 
-       if (!active->active)
+       if (!fwrt->trans->ini_valid || id >= IWL_FW_TRIGGER_ID_NUM ||
+           !fwrt->dump.active_trigs[id].active)
                return false;
 
-       ms = le32_to_cpu(active->trig->ignore_consec);
-       if (ms)
-               ms /= USEC_PER_MSEC;
+       trig = fwrt->dump.active_trigs[id].trig;
+       usec = le32_to_cpu(trig->ignore_consec);
 
-       if (iwl_fw_dbg_no_trig_window(fwrt, id, ms)) {
+       if (iwl_fw_dbg_no_trig_window(fwrt, id, usec)) {
                IWL_WARN(fwrt, "Trigger %d fired in no-collect window\n", id);
                return false;
        }
@@ -247,12 +246,6 @@ _iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
        return true;
 }
 
-#define iwl_fw_ini_trigger_on(fwrt, wdev, id) ({               \
-       BUILD_BUG_ON(!__builtin_constant_p(id));                \
-       BUILD_BUG_ON((id) >= IWL_FW_TRIGGER_ID_NUM);            \
-       _iwl_fw_ini_trigger_on((fwrt), (wdev), (id));           \
-})
-
 static inline void
 _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
                                struct wireless_dev *wdev,