iwlwifi: dbg_ini: add periodic trigger support
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Tue, 19 Mar 2019 14:40:15 +0000 (16:40 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Mon, 29 Apr 2019 15:42:47 +0000 (18:42 +0300)
Allows to configure a periodic data collection

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
drivers/net/wireless/intel/iwlwifi/fw/init.c
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 035eeeabfc8c5962f1ec0781b8aac88f4778bd9d..d8c4fdb8d4a1ab8f8555d23c40c3b2569e5b1c83 100644 (file)
@@ -2616,6 +2616,20 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
                        active->trig->occurrences = cpu_to_le32(-1);
 
                active->active = true;
+
+               if (id == IWL_FW_TRIGGER_ID_PERIODIC_TRIGGER) {
+                       u32 collect_interval = le32_to_cpu(trig->trigger_data);
+
+                       /* the minimum allowed interval is 50ms */
+                       if (collect_interval < 50) {
+                               collect_interval = 50;
+                               trig->trigger_data =
+                                       cpu_to_le32(collect_interval);
+                       }
+
+                       mod_timer(&fwrt->dump.periodic_trig,
+                                 jiffies + msecs_to_jiffies(collect_interval));
+               }
 next:
                iter += sizeof(*trig) + trig_regs_size;
 
@@ -2696,8 +2710,34 @@ IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point);
 
 void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt)
 {
+       del_timer(&fwrt->dump.periodic_trig);
        iwl_fw_dbg_collect_sync(fwrt);
 
        iwl_trans_stop_device(fwrt->trans);
 }
 IWL_EXPORT_SYMBOL(iwl_fwrt_stop_device);
+
+void iwl_fw_dbg_periodic_trig_handler(struct timer_list *t)
+{
+       struct iwl_fw_runtime *fwrt;
+       enum iwl_fw_ini_trigger_id id = IWL_FW_TRIGGER_ID_PERIODIC_TRIGGER;
+       int ret;
+       typeof(fwrt->dump) *dump_ptr = container_of(t, typeof(fwrt->dump),
+                                                   periodic_trig);
+
+       fwrt = container_of(dump_ptr, typeof(*fwrt), dump);
+
+       ret = _iwl_fw_dbg_ini_collect(fwrt, id);
+       if (!ret || ret == -EBUSY) {
+               struct iwl_fw_ini_trigger *trig =
+                       fwrt->dump.active_trigs[id].trig;
+               u32 occur = le32_to_cpu(trig->occurrences);
+               u32 collect_interval = le32_to_cpu(trig->trigger_data);
+
+               if (!occur)
+                       return;
+
+               mod_timer(&fwrt->dump.periodic_trig,
+                         jiffies + msecs_to_jiffies(collect_interval));
+       }
+}
index cccf91db74c4422f66bb290b23d7eee6760c08da..2a9e560a906bb6c287190f68cb91ee0981262e0d 100644 (file)
@@ -385,11 +385,13 @@ void iwl_fw_dbg_read_d3_debug_data(struct iwl_fw_runtime *fwrt);
 
 static inline void iwl_fw_flush_dump(struct iwl_fw_runtime *fwrt)
 {
+       del_timer(&fwrt->dump.periodic_trig);
        flush_delayed_work(&fwrt->dump.wk);
 }
 
 static inline void iwl_fw_cancel_dump(struct iwl_fw_runtime *fwrt)
 {
+       del_timer(&fwrt->dump.periodic_trig);
        cancel_delayed_work_sync(&fwrt->dump.wk);
 }
 
@@ -468,4 +470,5 @@ static inline void iwl_fw_error_collect(struct iwl_fw_runtime *fwrt)
        }
 }
 
+void iwl_fw_dbg_periodic_trig_handler(struct timer_list *t);
 #endif  /* __iwl_fw_dbg_h__ */
index 12310e3d2fc5aa7b544b08c95ad3086c3de799c1..4435c0ce301308ddd1549cd34053ccc23ad0d774 100644 (file)
@@ -76,6 +76,8 @@ void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
        fwrt->ops_ctx = ops_ctx;
        INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk);
        iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir);
+       timer_setup(&fwrt->dump.periodic_trig,
+                   iwl_fw_dbg_periodic_trig_handler, 0);
 }
 IWL_EXPORT_SYMBOL(iwl_fw_runtime_init);
 
index 88a558e082a3a39c64780a3b20bc45085491707a..a6402a0b38540050510ee9293b8bb3964b244986 100644 (file)
@@ -146,6 +146,7 @@ struct iwl_fw_runtime {
                u32 umac_err_id;
                void *fifo_iter;
                enum iwl_fw_ini_trigger_id ini_trig_id;
+               struct timer_list periodic_trig;
        } dump;
 #ifdef CONFIG_IWLWIFI_DEBUGFS
        struct {
index 55d399899d1c3b3405615472c1e2246fcb023cd6..602ff50268f2e4bf7957f9f7fadc3152053443ab 100644 (file)
@@ -1261,6 +1261,7 @@ static void iwl_mvm_reprobe_wk(struct work_struct *wk)
 void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
 {
        iwl_abort_notification_waits(&mvm->notif_wait);
+       del_timer(&mvm->fwrt.dump.periodic_trig);
 
        /*
         * This is a bit racy, but worst case we tell mac80211 about