Commit 124e0eba authored by Sara Sharon's avatar Sara Sharon Committed by Luca Coelho

iwlwifi: dbg: avoid passing trigger around

The trigger structure is being passed around, when
all we care about is whether to dump only monitor
or not. Pass a bool instead.
Signed-off-by: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent f09450e3
...@@ -655,13 +655,8 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt, ...@@ -655,13 +655,8 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,
u32 smem_len = fwrt->fw->dbg.n_mem_tlv ? 0 : fwrt->trans->cfg->smem_len; u32 smem_len = fwrt->fw->dbg.n_mem_tlv ? 0 : fwrt->trans->cfg->smem_len;
u32 sram2_len = fwrt->fw->dbg.n_mem_tlv ? u32 sram2_len = fwrt->fw->dbg.n_mem_tlv ?
0 : fwrt->trans->cfg->dccm2_len; 0 : fwrt->trans->cfg->dccm2_len;
bool monitor_dump_only = false;
int i; int i;
if (fwrt->dump.trig &&
fwrt->dump.trig->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY)
monitor_dump_only = true;
/* SRAM - include stack CCM if driver knows the values for it */ /* SRAM - include stack CCM if driver knows the values for it */
if (!fwrt->trans->cfg->dccm_offset || !fwrt->trans->cfg->dccm_len) { if (!fwrt->trans->cfg->dccm_offset || !fwrt->trans->cfg->dccm_len) {
const struct fw_img *img; const struct fw_img *img;
...@@ -727,7 +722,7 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt, ...@@ -727,7 +722,7 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,
} }
/* If we only want a monitor dump, reset the file length */ /* If we only want a monitor dump, reset the file length */
if (monitor_dump_only) { if (fwrt->dump.monitor_only) {
file_len = sizeof(*dump_file) + sizeof(*dump_data) * 2 + file_len = sizeof(*dump_file) + sizeof(*dump_data) * 2 +
sizeof(*dump_info) + sizeof(*dump_smem_cfg); sizeof(*dump_info) + sizeof(*dump_smem_cfg);
} }
...@@ -817,7 +812,7 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt, ...@@ -817,7 +812,7 @@ _iwl_fw_error_dump(struct iwl_fw_runtime *fwrt,
} }
/* In case we only want monitor dump, skip to dump trasport data */ /* In case we only want monitor dump, skip to dump trasport data */
if (monitor_dump_only) if (fwrt->dump.monitor_only)
goto out; goto out;
if (fwrt->fw->dbg.dump_mask & BIT(IWL_FW_ERROR_DUMP_MEM)) { if (fwrt->fw->dbg.dump_mask & BIT(IWL_FW_ERROR_DUMP_MEM)) {
...@@ -932,7 +927,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt) ...@@ -932,7 +927,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
} }
fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans,
fwrt->dump.trig); fwrt->dump.monitor_only);
file_len = le32_to_cpu(dump_file->file_len); file_len = le32_to_cpu(dump_file->file_len);
fw_error_dump->fwrt_len = file_len; fw_error_dump->fwrt_len = file_len;
if (fw_error_dump->trans_ptr) { if (fw_error_dump->trans_ptr) {
...@@ -998,7 +993,8 @@ void iwl_fw_alive_error_dump(struct iwl_fw_runtime *fwrt) ...@@ -998,7 +993,8 @@ void iwl_fw_alive_error_dump(struct iwl_fw_runtime *fwrt)
IWL_EXPORT_SYMBOL(iwl_fw_alive_error_dump); IWL_EXPORT_SYMBOL(iwl_fw_alive_error_dump);
int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
const struct iwl_fw_dump_desc *desc, void *trigger, const struct iwl_fw_dump_desc *desc,
bool monitor_only,
unsigned int delay) unsigned int delay)
{ {
/* /*
...@@ -1028,7 +1024,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, ...@@ -1028,7 +1024,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
le32_to_cpu(desc->trig_desc.type)); le32_to_cpu(desc->trig_desc.type));
fwrt->dump.desc = desc; fwrt->dump.desc = desc;
fwrt->dump.trig = trigger; fwrt->dump.monitor_only = monitor_only;
schedule_delayed_work(&fwrt->dump.wk, delay); schedule_delayed_work(&fwrt->dump.wk, delay);
...@@ -1043,6 +1039,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, ...@@ -1043,6 +1039,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
{ {
struct iwl_fw_dump_desc *desc; struct iwl_fw_dump_desc *desc;
unsigned int delay = 0; unsigned int delay = 0;
bool monitor_only = false;
if (trigger) { if (trigger) {
u16 occurrences = le16_to_cpu(trigger->occurrences) - 1; u16 occurrences = le16_to_cpu(trigger->occurrences) - 1;
...@@ -1059,6 +1056,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, ...@@ -1059,6 +1056,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
trigger->occurrences = cpu_to_le16(occurrences); trigger->occurrences = cpu_to_le16(occurrences);
delay = le16_to_cpu(trigger->trig_dis_ms); delay = le16_to_cpu(trigger->trig_dis_ms);
monitor_only = trigger->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY;
} }
desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC); desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC);
...@@ -1070,7 +1068,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, ...@@ -1070,7 +1068,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
desc->trig_desc.type = cpu_to_le32(trig); desc->trig_desc.type = cpu_to_le32(trig);
memcpy(desc->trig_desc.data, str, len); memcpy(desc->trig_desc.data, str, len);
return iwl_fw_dbg_collect_desc(fwrt, desc, trigger, delay); return iwl_fw_dbg_collect_desc(fwrt, desc, monitor_only, delay);
} }
IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect); IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect);
......
...@@ -101,13 +101,12 @@ static inline void iwl_fw_free_dump_desc(struct iwl_fw_runtime *fwrt) ...@@ -101,13 +101,12 @@ static inline void iwl_fw_free_dump_desc(struct iwl_fw_runtime *fwrt)
if (fwrt->dump.desc != &iwl_dump_desc_assert) if (fwrt->dump.desc != &iwl_dump_desc_assert)
kfree(fwrt->dump.desc); kfree(fwrt->dump.desc);
fwrt->dump.desc = NULL; fwrt->dump.desc = NULL;
fwrt->dump.trig = NULL;
} }
void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt); void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt);
int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
const struct iwl_fw_dump_desc *desc, const struct iwl_fw_dump_desc *desc,
void *trigger, unsigned int delay); bool monitor_only, unsigned int delay);
int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
enum iwl_fw_dbg_trigger trig, enum iwl_fw_dbg_trigger trig,
const char *str, size_t len, const char *str, size_t len,
......
...@@ -131,7 +131,7 @@ struct iwl_fw_runtime { ...@@ -131,7 +131,7 @@ struct iwl_fw_runtime {
/* debug */ /* debug */
struct { struct {
const struct iwl_fw_dump_desc *desc; const struct iwl_fw_dump_desc *desc;
const struct iwl_fw_dbg_trigger_tlv *trig; bool monitor_only;
struct delayed_work wk; struct delayed_work wk;
u8 conf; u8 conf;
......
...@@ -602,8 +602,7 @@ struct iwl_trans_ops { ...@@ -602,8 +602,7 @@ struct iwl_trans_ops {
void (*resume)(struct iwl_trans *trans); void (*resume)(struct iwl_trans *trans);
struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans, struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
const struct iwl_fw_dbg_trigger_tlv bool monitor_only);
*trigger);
}; };
/** /**
...@@ -897,12 +896,11 @@ static inline void iwl_trans_resume(struct iwl_trans *trans) ...@@ -897,12 +896,11 @@ static inline void iwl_trans_resume(struct iwl_trans *trans)
} }
static inline struct iwl_trans_dump_data * static inline struct iwl_trans_dump_data *
iwl_trans_dump_data(struct iwl_trans *trans, iwl_trans_dump_data(struct iwl_trans *trans, bool monitor_only)
const struct iwl_fw_dbg_trigger_tlv *trigger)
{ {
if (!trans->ops->dump_data) if (!trans->ops->dump_data)
return NULL; return NULL;
return trans->ops->dump_data(trans, trigger); return trans->ops->dump_data(trans, monitor_only);
} }
static inline struct iwl_device_cmd * static inline struct iwl_device_cmd *
......
...@@ -1956,7 +1956,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) ...@@ -1956,7 +1956,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
set_bit(STATUS_FW_ERROR, &mvm->trans->status); set_bit(STATUS_FW_ERROR, &mvm->trans->status);
iwl_mvm_dump_nic_error_log(mvm); iwl_mvm_dump_nic_error_log(mvm);
iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert,
NULL, 0); false, 0);
ret = 1; ret = 1;
goto err; goto err;
} }
......
...@@ -1233,7 +1233,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) ...@@ -1233,7 +1233,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
*/ */
if (!mvm->fw_restart && fw_error) { if (!mvm->fw_restart && fw_error) {
iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert,
NULL, 0); false, 0);
} else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { } else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
struct iwl_mvm_reprobe *reprobe; struct iwl_mvm_reprobe *reprobe;
......
...@@ -2990,7 +2990,7 @@ static int iwl_trans_get_fw_monitor_len(struct iwl_trans *trans, int *len) ...@@ -2990,7 +2990,7 @@ static int iwl_trans_get_fw_monitor_len(struct iwl_trans *trans, int *len)
static struct iwl_trans_dump_data static struct iwl_trans_dump_data
*iwl_trans_pcie_dump_data(struct iwl_trans *trans, *iwl_trans_pcie_dump_data(struct iwl_trans *trans,
const struct iwl_fw_dbg_trigger_tlv *trigger) bool monitor_only)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_fw_error_dump_data *data; struct iwl_fw_error_dump_data *data;
...@@ -3014,7 +3014,7 @@ static struct iwl_trans_dump_data ...@@ -3014,7 +3014,7 @@ static struct iwl_trans_dump_data
/* FW monitor */ /* FW monitor */
monitor_len = iwl_trans_get_fw_monitor_len(trans, &len); monitor_len = iwl_trans_get_fw_monitor_len(trans, &len);
if (trigger && (trigger->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY)) { if (monitor_only) {
if (!(trans->dbg_dump_mask & if (!(trans->dbg_dump_mask &
BIT(IWL_FW_ERROR_DUMP_FW_MONITOR))) BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)))
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment