Skip to content

Commit

Permalink
iwlwifi: dbg: don't limit dump decisions to all or monitor
Browse files Browse the repository at this point in the history
Currently opmode is limited to asking transport to either
dump all the dumps configured at startup, or monitor only.
Instead, pass to transport a bitmask, to allow flexibility.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
Sara Sharon authored and Luca Coelho committed Nov 23, 2018
1 parent 12d5617 commit 79f033f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
7 changes: 5 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/fw/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
struct iwl_fw_error_dump_file *dump_file;
struct scatterlist *sg_dump_data;
u32 file_len;
u32 dump_mask = fwrt->fw->dbg.dump_mask;

IWL_DEBUG_INFO(fwrt, "WRT dump start\n");

Expand All @@ -927,8 +928,10 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
goto out;
}

fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans,
fwrt->dump.monitor_only);
if (fwrt->dump.monitor_only)
dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR;

fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, dump_mask);
file_len = le32_to_cpu(dump_file->file_len);
fw_error_dump->fwrt_len = file_len;
if (fw_error_dump->trans_ptr) {
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/iwl-trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ struct iwl_trans_ops {
void (*resume)(struct iwl_trans *trans);

struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
bool monitor_only);
u32 dump_mask);
};

/**
Expand Down Expand Up @@ -776,7 +776,6 @@ struct iwl_trans {
const struct iwl_fw_dbg_dest_tlv_v1 *dbg_dest_tlv;
const struct iwl_fw_dbg_conf_tlv *dbg_conf_tlv[FW_DBG_CONF_MAX];
struct iwl_fw_dbg_trigger_tlv * const *dbg_trigger_tlv;
u32 dbg_dump_mask;
u8 dbg_n_dest_reg;
int num_blocks;
struct iwl_dram_data fw_mon[IWL_MAX_DEBUG_ALLOCATIONS];
Expand Down Expand Up @@ -896,11 +895,11 @@ static inline void iwl_trans_resume(struct iwl_trans *trans)
}

static inline struct iwl_trans_dump_data *
iwl_trans_dump_data(struct iwl_trans *trans, bool monitor_only)
iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask)
{
if (!trans->ops->dump_data)
return NULL;
return trans->ops->dump_data(trans, monitor_only);
return trans->ops->dump_data(trans, dump_mask);
}

static inline struct iwl_device_cmd *
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/intel/iwlwifi/mvm/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
memcpy(trans->dbg_conf_tlv, mvm->fw->dbg.conf_tlv,
sizeof(trans->dbg_conf_tlv));
trans->dbg_trigger_tlv = mvm->fw->dbg.trigger_tlv;
trans->dbg_dump_mask = mvm->fw->dbg.dump_mask;

trans->iml = mvm->fw->iml;
trans->iml_len = mvm->fw->iml_len;
Expand Down
31 changes: 14 additions & 17 deletions drivers/net/wireless/intel/iwlwifi/pcie/trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@ static int iwl_trans_get_fw_monitor_len(struct iwl_trans *trans, int *len)

static struct iwl_trans_dump_data
*iwl_trans_pcie_dump_data(struct iwl_trans *trans,
bool monitor_only)
u32 dump_mask)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
struct iwl_fw_error_dump_data *data;
Expand All @@ -3002,7 +3002,10 @@ static struct iwl_trans_dump_data
int i, ptr;
bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) &&
!trans->cfg->mq_rx_supported &&
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);
dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);

if (!dump_mask)
return NULL;

/* transport dump header */
len = sizeof(*dump_data);
Expand All @@ -3014,11 +3017,7 @@ static struct iwl_trans_dump_data
/* FW monitor */
monitor_len = iwl_trans_get_fw_monitor_len(trans, &len);

if (monitor_only) {
if (!(trans->dbg_dump_mask &
BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)))
return NULL;

if (dump_mask == BIT(IWL_FW_ERROR_DUMP_FW_MONITOR)) {
dump_data = vzalloc(len);
if (!dump_data)
return NULL;
Expand All @@ -3031,11 +3030,11 @@ static struct iwl_trans_dump_data
}

/* CSR registers */
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
len += sizeof(*data) + IWL_CSR_TO_DUMP;

/* FH registers */
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) {
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) {
if (trans->cfg->gen2)
len += sizeof(*data) +
(FH_MEM_UPPER_BOUND_GEN2 -
Expand All @@ -3060,8 +3059,7 @@ static struct iwl_trans_dump_data
}

/* Paged memory for gen2 HW */
if (trans->cfg->gen2 &&
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING))
if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING))
for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++)
len += sizeof(*data) +
sizeof(struct iwl_fw_error_dump_paging) +
Expand All @@ -3074,7 +3072,7 @@ static struct iwl_trans_dump_data
len = 0;
data = (void *)dump_data->data;

if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_TXCMD)) {
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_TXCMD)) {
u16 tfd_size = trans_pcie->tfd_size;

data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_TXCMD);
Expand Down Expand Up @@ -3108,16 +3106,15 @@ static struct iwl_trans_dump_data
data = iwl_fw_error_next_data(data);
}

if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_CSR))
len += iwl_trans_pcie_dump_csr(trans, &data);
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS))
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS))
len += iwl_trans_pcie_fh_regs_dump(trans, &data);
if (dump_rbs)
len += iwl_trans_pcie_dump_rbs(trans, &data, num_rbs);

/* Paged memory for gen2 HW */
if (trans->cfg->gen2 &&
trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) {
if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) {
for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) {
struct iwl_fw_error_dump_paging *paging;
dma_addr_t addr =
Expand All @@ -3137,7 +3134,7 @@ static struct iwl_trans_dump_data
len += sizeof(*data) + sizeof(*paging) + page_len;
}
}
if (trans->dbg_dump_mask & BIT(IWL_FW_ERROR_DUMP_FW_MONITOR))
if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FW_MONITOR))
len += iwl_trans_pcie_dump_monitor(trans, &data, monitor_len);

dump_data->len = len;
Expand Down

0 comments on commit 79f033f

Please sign in to comment.