iwlwifi: yoyo: support IWL_FW_INI_TIME_POINT_HOST_ALIVE_TIMEOUT time point
authorShahar S Matityahu <shahar.s.matityahu@intel.com>
Fri, 17 Apr 2020 10:21:42 +0000 (13:21 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 24 Apr 2020 13:38:10 +0000 (16:38 +0300)
Allow the driver to perform dump collection in case of alive notification
timeout in yoyo mode.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200417131727.bd46e6240590.Ibda6d9d330a1ae49670152cede34629b280f6cf9@changeid
drivers/net/wireless/intel/iwlwifi/fw/dbg.c

index 8daa83c..39c8332 100644 (file)
@@ -2329,26 +2329,40 @@ IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_desc);
 int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt,
                             enum iwl_fw_dbg_trigger trig_type)
 {
-       int ret;
-       struct iwl_fw_dump_desc *iwl_dump_error_desc;
-
        if (!test_bit(STATUS_DEVICE_ENABLED, &fwrt->trans->status))
                return -EIO;
 
-       iwl_dump_error_desc = kmalloc(sizeof(*iwl_dump_error_desc), GFP_KERNEL);
-       if (!iwl_dump_error_desc)
-               return -ENOMEM;
+       if (iwl_trans_dbg_ini_valid(fwrt->trans)) {
+               if (trig_type != FW_DBG_TRIGGER_ALIVE_TIMEOUT)
+                       return -EIO;
 
-       iwl_dump_error_desc->trig_desc.type = cpu_to_le32(trig_type);
-       iwl_dump_error_desc->len = 0;
+               iwl_dbg_tlv_time_point(fwrt,
+                                      IWL_FW_INI_TIME_POINT_HOST_ALIVE_TIMEOUT,
+                                      NULL);
+       } else {
+               struct iwl_fw_dump_desc *iwl_dump_error_desc;
+               int ret;
 
-       ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0);
-       if (ret)
-               kfree(iwl_dump_error_desc);
-       else
-               iwl_trans_sync_nmi(fwrt->trans);
+               iwl_dump_error_desc =
+                       kmalloc(sizeof(*iwl_dump_error_desc), GFP_KERNEL);
 
-       return ret;
+               if (!iwl_dump_error_desc)
+                       return -ENOMEM;
+
+               iwl_dump_error_desc->trig_desc.type = cpu_to_le32(trig_type);
+               iwl_dump_error_desc->len = 0;
+
+               ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc,
+                                             false, 0);
+               if (ret) {
+                       kfree(iwl_dump_error_desc);
+                       return ret;
+               }
+       }
+
+       iwl_trans_sync_nmi(fwrt->trans);
+
+       return 0;
 }
 IWL_EXPORT_SYMBOL(iwl_fw_dbg_error_collect);