Commit d9fb6465 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlwifi: remove get_cmd_string

The command strings are needed through the layers for
debug and error messages, but can differ with opmode.
As a result, we need to give the command names to the
transport layer as configuration.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent c14c7372
...@@ -1242,7 +1242,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -1242,7 +1242,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
if (test_bit(STATUS_FW_ERROR, &priv->status)) { if (test_bit(STATUS_FW_ERROR, &priv->status)) {
IWL_ERR(priv, "Command %s failed: FW Error\n", IWL_ERR(priv, "Command %s failed: FW Error\n",
get_cmd_string(cmd->id)); iwl_dvm_get_cmd_string(cmd->id));
return -EIO; return -EIO;
} }
......
...@@ -40,89 +40,86 @@ ...@@ -40,89 +40,86 @@
#include "iwl-agn.h" #include "iwl-agn.h"
#include "iwl-shared.h" #include "iwl-shared.h"
const char *get_cmd_string(u8 cmd) #define IWL_CMD_ENTRY(x) [x] = #x
{
switch (cmd) { const char *iwl_dvm_cmd_strings[REPLY_MAX] = {
IWL_CMD(REPLY_ALIVE); IWL_CMD_ENTRY(REPLY_ALIVE),
IWL_CMD(REPLY_ERROR); IWL_CMD_ENTRY(REPLY_ERROR),
IWL_CMD(REPLY_ECHO); IWL_CMD_ENTRY(REPLY_ECHO),
IWL_CMD(REPLY_RXON); IWL_CMD_ENTRY(REPLY_RXON),
IWL_CMD(REPLY_RXON_ASSOC); IWL_CMD_ENTRY(REPLY_RXON_ASSOC),
IWL_CMD(REPLY_QOS_PARAM); IWL_CMD_ENTRY(REPLY_QOS_PARAM),
IWL_CMD(REPLY_RXON_TIMING); IWL_CMD_ENTRY(REPLY_RXON_TIMING),
IWL_CMD(REPLY_ADD_STA); IWL_CMD_ENTRY(REPLY_ADD_STA),
IWL_CMD(REPLY_REMOVE_STA); IWL_CMD_ENTRY(REPLY_REMOVE_STA),
IWL_CMD(REPLY_REMOVE_ALL_STA); IWL_CMD_ENTRY(REPLY_REMOVE_ALL_STA),
IWL_CMD(REPLY_TXFIFO_FLUSH); IWL_CMD_ENTRY(REPLY_TXFIFO_FLUSH),
IWL_CMD(REPLY_WEPKEY); IWL_CMD_ENTRY(REPLY_WEPKEY),
IWL_CMD(REPLY_TX); IWL_CMD_ENTRY(REPLY_TX),
IWL_CMD(REPLY_LEDS_CMD); IWL_CMD_ENTRY(REPLY_LEDS_CMD),
IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); IWL_CMD_ENTRY(REPLY_TX_LINK_QUALITY_CMD),
IWL_CMD(COEX_PRIORITY_TABLE_CMD); IWL_CMD_ENTRY(COEX_PRIORITY_TABLE_CMD),
IWL_CMD(COEX_MEDIUM_NOTIFICATION); IWL_CMD_ENTRY(COEX_MEDIUM_NOTIFICATION),
IWL_CMD(COEX_EVENT_CMD); IWL_CMD_ENTRY(COEX_EVENT_CMD),
IWL_CMD(REPLY_QUIET_CMD); IWL_CMD_ENTRY(REPLY_QUIET_CMD),
IWL_CMD(REPLY_CHANNEL_SWITCH); IWL_CMD_ENTRY(REPLY_CHANNEL_SWITCH),
IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); IWL_CMD_ENTRY(CHANNEL_SWITCH_NOTIFICATION),
IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); IWL_CMD_ENTRY(REPLY_SPECTRUM_MEASUREMENT_CMD),
IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); IWL_CMD_ENTRY(SPECTRUM_MEASURE_NOTIFICATION),
IWL_CMD(POWER_TABLE_CMD); IWL_CMD_ENTRY(POWER_TABLE_CMD),
IWL_CMD(PM_SLEEP_NOTIFICATION); IWL_CMD_ENTRY(PM_SLEEP_NOTIFICATION),
IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); IWL_CMD_ENTRY(PM_DEBUG_STATISTIC_NOTIFIC),
IWL_CMD(REPLY_SCAN_CMD); IWL_CMD_ENTRY(REPLY_SCAN_CMD),
IWL_CMD(REPLY_SCAN_ABORT_CMD); IWL_CMD_ENTRY(REPLY_SCAN_ABORT_CMD),
IWL_CMD(SCAN_START_NOTIFICATION); IWL_CMD_ENTRY(SCAN_START_NOTIFICATION),
IWL_CMD(SCAN_RESULTS_NOTIFICATION); IWL_CMD_ENTRY(SCAN_RESULTS_NOTIFICATION),
IWL_CMD(SCAN_COMPLETE_NOTIFICATION); IWL_CMD_ENTRY(SCAN_COMPLETE_NOTIFICATION),
IWL_CMD(BEACON_NOTIFICATION); IWL_CMD_ENTRY(BEACON_NOTIFICATION),
IWL_CMD(REPLY_TX_BEACON); IWL_CMD_ENTRY(REPLY_TX_BEACON),
IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); IWL_CMD_ENTRY(WHO_IS_AWAKE_NOTIFICATION),
IWL_CMD(QUIET_NOTIFICATION); IWL_CMD_ENTRY(QUIET_NOTIFICATION),
IWL_CMD(REPLY_TX_PWR_TABLE_CMD); IWL_CMD_ENTRY(REPLY_TX_PWR_TABLE_CMD),
IWL_CMD(MEASURE_ABORT_NOTIFICATION); IWL_CMD_ENTRY(MEASURE_ABORT_NOTIFICATION),
IWL_CMD(REPLY_BT_CONFIG); IWL_CMD_ENTRY(REPLY_BT_CONFIG),
IWL_CMD(REPLY_STATISTICS_CMD); IWL_CMD_ENTRY(REPLY_STATISTICS_CMD),
IWL_CMD(STATISTICS_NOTIFICATION); IWL_CMD_ENTRY(STATISTICS_NOTIFICATION),
IWL_CMD(REPLY_CARD_STATE_CMD); IWL_CMD_ENTRY(REPLY_CARD_STATE_CMD),
IWL_CMD(CARD_STATE_NOTIFICATION); IWL_CMD_ENTRY(CARD_STATE_NOTIFICATION),
IWL_CMD(MISSED_BEACONS_NOTIFICATION); IWL_CMD_ENTRY(MISSED_BEACONS_NOTIFICATION),
IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); IWL_CMD_ENTRY(REPLY_CT_KILL_CONFIG_CMD),
IWL_CMD(SENSITIVITY_CMD); IWL_CMD_ENTRY(SENSITIVITY_CMD),
IWL_CMD(REPLY_PHY_CALIBRATION_CMD); IWL_CMD_ENTRY(REPLY_PHY_CALIBRATION_CMD),
IWL_CMD(REPLY_RX_PHY_CMD); IWL_CMD_ENTRY(REPLY_RX_PHY_CMD),
IWL_CMD(REPLY_RX_MPDU_CMD); IWL_CMD_ENTRY(REPLY_RX_MPDU_CMD),
IWL_CMD(REPLY_RX); IWL_CMD_ENTRY(REPLY_RX),
IWL_CMD(REPLY_COMPRESSED_BA); IWL_CMD_ENTRY(REPLY_COMPRESSED_BA),
IWL_CMD(CALIBRATION_CFG_CMD); IWL_CMD_ENTRY(CALIBRATION_CFG_CMD),
IWL_CMD(CALIBRATION_RES_NOTIFICATION); IWL_CMD_ENTRY(CALIBRATION_RES_NOTIFICATION),
IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION); IWL_CMD_ENTRY(CALIBRATION_COMPLETE_NOTIFICATION),
IWL_CMD(REPLY_TX_POWER_DBM_CMD); IWL_CMD_ENTRY(REPLY_TX_POWER_DBM_CMD),
IWL_CMD(TEMPERATURE_NOTIFICATION); IWL_CMD_ENTRY(TEMPERATURE_NOTIFICATION),
IWL_CMD(TX_ANT_CONFIGURATION_CMD); IWL_CMD_ENTRY(TX_ANT_CONFIGURATION_CMD),
IWL_CMD(REPLY_BT_COEX_PROFILE_NOTIF); IWL_CMD_ENTRY(REPLY_BT_COEX_PROFILE_NOTIF),
IWL_CMD(REPLY_BT_COEX_PRIO_TABLE); IWL_CMD_ENTRY(REPLY_BT_COEX_PRIO_TABLE),
IWL_CMD(REPLY_BT_COEX_PROT_ENV); IWL_CMD_ENTRY(REPLY_BT_COEX_PROT_ENV),
IWL_CMD(REPLY_WIPAN_PARAMS); IWL_CMD_ENTRY(REPLY_WIPAN_PARAMS),
IWL_CMD(REPLY_WIPAN_RXON); IWL_CMD_ENTRY(REPLY_WIPAN_RXON),
IWL_CMD(REPLY_WIPAN_RXON_TIMING); IWL_CMD_ENTRY(REPLY_WIPAN_RXON_TIMING),
IWL_CMD(REPLY_WIPAN_RXON_ASSOC); IWL_CMD_ENTRY(REPLY_WIPAN_RXON_ASSOC),
IWL_CMD(REPLY_WIPAN_QOS_PARAM); IWL_CMD_ENTRY(REPLY_WIPAN_QOS_PARAM),
IWL_CMD(REPLY_WIPAN_WEPKEY); IWL_CMD_ENTRY(REPLY_WIPAN_WEPKEY),
IWL_CMD(REPLY_WIPAN_P2P_CHANNEL_SWITCH); IWL_CMD_ENTRY(REPLY_WIPAN_P2P_CHANNEL_SWITCH),
IWL_CMD(REPLY_WIPAN_NOA_NOTIFICATION); IWL_CMD_ENTRY(REPLY_WIPAN_NOA_NOTIFICATION),
IWL_CMD(REPLY_WIPAN_DEACTIVATION_COMPLETE); IWL_CMD_ENTRY(REPLY_WIPAN_DEACTIVATION_COMPLETE),
IWL_CMD(REPLY_WOWLAN_PATTERNS); IWL_CMD_ENTRY(REPLY_WOWLAN_PATTERNS),
IWL_CMD(REPLY_WOWLAN_WAKEUP_FILTER); IWL_CMD_ENTRY(REPLY_WOWLAN_WAKEUP_FILTER),
IWL_CMD(REPLY_WOWLAN_TSC_RSC_PARAMS); IWL_CMD_ENTRY(REPLY_WOWLAN_TSC_RSC_PARAMS),
IWL_CMD(REPLY_WOWLAN_TKIP_PARAMS); IWL_CMD_ENTRY(REPLY_WOWLAN_TKIP_PARAMS),
IWL_CMD(REPLY_WOWLAN_KEK_KCK_MATERIAL); IWL_CMD_ENTRY(REPLY_WOWLAN_KEK_KCK_MATERIAL),
IWL_CMD(REPLY_WOWLAN_GET_STATUS); IWL_CMD_ENTRY(REPLY_WOWLAN_GET_STATUS),
IWL_CMD(REPLY_D3_CONFIG); IWL_CMD_ENTRY(REPLY_D3_CONFIG),
default: };
return "UNKNOWN"; #undef IWL_CMD_ENTRY
}
}
/****************************************************************************** /******************************************************************************
* *
...@@ -137,10 +134,9 @@ static int iwlagn_rx_reply_error(struct iwl_priv *priv, ...@@ -137,10 +134,9 @@ static int iwlagn_rx_reply_error(struct iwl_priv *priv,
struct iwl_rx_packet *pkt = rxb_addr(rxb); struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_error_resp *err_resp = (void *)pkt->data; struct iwl_error_resp *err_resp = (void *)pkt->data;
IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " IWL_ERR(priv, "Error Reply type 0x%08X cmd REPLY_ERROR (0x%02X) "
"seq 0x%04X ser 0x%08X\n", "seq 0x%04X ser 0x%08X\n",
le32_to_cpu(err_resp->error_type), le32_to_cpu(err_resp->error_type),
get_cmd_string(err_resp->cmd_id),
err_resp->cmd_id, err_resp->cmd_id,
le16_to_cpu(err_resp->bad_cmd_seq_num), le16_to_cpu(err_resp->bad_cmd_seq_num),
le32_to_cpu(err_resp->error_info)); le32_to_cpu(err_resp->error_info));
...@@ -216,8 +212,7 @@ static int iwlagn_rx_pm_debug_statistics_notif(struct iwl_priv *priv, ...@@ -216,8 +212,7 @@ static int iwlagn_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
u32 __maybe_unused len = u32 __maybe_unused len =
le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
"notification for %s:\n", len, "notification for PM_DEBUG_STATISTIC_NOTIFIC:\n", len);
get_cmd_string(pkt->hdr.cmd));
iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->data, len); iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->data, len);
return 0; return 0;
} }
...@@ -1152,9 +1147,9 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, ...@@ -1152,9 +1147,9 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd); err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd);
} else { } else {
/* No handling needed */ /* No handling needed */
IWL_DEBUG_RX(priv, IWL_DEBUG_RX(priv, "No handler needed for %s, 0x%02x\n",
"No handler needed for %s, 0x%02x\n", iwl_dvm_get_cmd_string(pkt->hdr.cmd),
get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); pkt->hdr.cmd);
} }
} }
return err; return err;
......
...@@ -1560,6 +1560,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, ...@@ -1560,6 +1560,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
cfg(priv)->base_params->wd_timeout; cfg(priv)->base_params->wd_timeout;
else else
trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED;
trans_cfg.command_names = iwl_dvm_cmd_strings;
ucode_flags = fw->ucode_capa.flags; ucode_flags = fw->ucode_capa.flags;
......
...@@ -495,6 +495,16 @@ do { \ ...@@ -495,6 +495,16 @@ do { \
} while (0) } while (0)
#endif /* CONFIG_IWLWIFI_DEBUG */ #endif /* CONFIG_IWLWIFI_DEBUG */
extern const char *iwl_dvm_cmd_strings[REPLY_MAX];
static inline const char *iwl_dvm_get_cmd_string(u8 cmd)
{
const char *s = iwl_dvm_cmd_strings[cmd];
if (s)
return s;
return "UNKNOWN";
}
/* API method exported for mvm hybrid state */ /* API method exported for mvm hybrid state */
void iwl_setup_deferred_work(struct iwl_priv *priv); void iwl_setup_deferred_work(struct iwl_priv *priv);
int iwl_send_wimax_coex(struct iwl_priv *priv); int iwl_send_wimax_coex(struct iwl_priv *priv);
......
...@@ -140,6 +140,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, ...@@ -140,6 +140,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
const char *get_mgmt_string(int cmd) const char *get_mgmt_string(int cmd)
{ {
#define IWL_CMD(x) case x: return #x
switch (cmd) { switch (cmd) {
IWL_CMD(MANAGEMENT_ASSOC_REQ); IWL_CMD(MANAGEMENT_ASSOC_REQ);
IWL_CMD(MANAGEMENT_ASSOC_RESP); IWL_CMD(MANAGEMENT_ASSOC_RESP);
...@@ -157,10 +158,12 @@ const char *get_mgmt_string(int cmd) ...@@ -157,10 +158,12 @@ const char *get_mgmt_string(int cmd)
return "UNKNOWN"; return "UNKNOWN";
} }
#undef IWL_CMD
} }
const char *get_ctrl_string(int cmd) const char *get_ctrl_string(int cmd)
{ {
#define IWL_CMD(x) case x: return #x
switch (cmd) { switch (cmd) {
IWL_CMD(CONTROL_BACK_REQ); IWL_CMD(CONTROL_BACK_REQ);
IWL_CMD(CONTROL_BACK); IWL_CMD(CONTROL_BACK);
...@@ -174,6 +177,7 @@ const char *get_ctrl_string(int cmd) ...@@ -174,6 +177,7 @@ const char *get_ctrl_string(int cmd)
return "UNKNOWN"; return "UNKNOWN";
} }
#undef IWL_CMD
} }
void iwl_clear_traffic_stats(struct iwl_priv *priv) void iwl_clear_traffic_stats(struct iwl_priv *priv)
......
...@@ -575,7 +575,7 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file, ...@@ -575,7 +575,7 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file,
if (priv->rx_handlers_stats[cnt] > 0) if (priv->rx_handlers_stats[cnt] > 0)
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
"\tRx handler[%36s]:\t\t %u\n", "\tRx handler[%36s]:\t\t %u\n",
get_cmd_string(cnt), iwl_dvm_get_cmd_string(cnt),
priv->rx_handlers_stats[cnt]); priv->rx_handlers_stats[cnt]);
} }
......
...@@ -181,8 +181,4 @@ enum iwl_rxon_context_id { ...@@ -181,8 +181,4 @@ enum iwl_rxon_context_id {
NUM_IWL_RXON_CTX NUM_IWL_RXON_CTX
}; };
const char *get_cmd_string(u8 cmd);
#define IWL_CMD(x) case x: return #x
#endif /* #__iwl_shared_h__ */ #endif /* #__iwl_shared_h__ */
...@@ -273,6 +273,7 @@ struct iwl_trans_pcie { ...@@ -273,6 +273,7 @@ struct iwl_trans_pcie {
bool rx_buf_size_8k; bool rx_buf_size_8k;
u32 rx_page_order; u32 rx_page_order;
const char **command_names;
/* queue watchdog */ /* queue watchdog */
unsigned long wd_timeout; unsigned long wd_timeout;
...@@ -417,4 +418,12 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) ...@@ -417,4 +418,12 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)
return index & (q->n_window - 1); return index & (q->n_window - 1);
} }
static inline const char *
trans_pcie_get_cmd_string(struct iwl_trans_pcie *trans_pcie, u8 cmd)
{
if (!trans_pcie->command_names || !trans_pcie->command_names[cmd])
return "UNKNOWN";
return trans_pcie->command_names[cmd];
}
#endif /* __iwl_trans_int_pcie_h__ */ #endif /* __iwl_trans_int_pcie_h__ */
...@@ -393,8 +393,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, ...@@ -393,8 +393,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
break; break;
IWL_DEBUG_RX(trans, "cmd at offset %d: %s (0x%.2x)\n", IWL_DEBUG_RX(trans, "cmd at offset %d: %s (0x%.2x)\n",
rxcb._offset, get_cmd_string(pkt->hdr.cmd), rxcb._offset,
pkt->hdr.cmd); trans_pcie_get_cmd_string(trans_pcie, pkt->hdr.cmd),
pkt->hdr.cmd);
len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
len += sizeof(u32); /* account for status word */ len += sizeof(u32); /* account for status word */
......
...@@ -605,12 +605,11 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -605,12 +605,11 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
cmd_dest += cmd->len[i]; cmd_dest += cmd->len[i];
} }
IWL_DEBUG_HC(trans, "Sending command %s (#%x), seq: 0x%04X, " IWL_DEBUG_HC(trans,
"%d bytes at %d[%d]:%d\n", "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n",
get_cmd_string(out_cmd->hdr.cmd), trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd),
out_cmd->hdr.cmd, out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
le16_to_cpu(out_cmd->hdr.sequence), cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue);
q->write_ptr, idx, trans_pcie->cmd_queue);
phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size,
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
...@@ -795,11 +794,13 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb, ...@@ -795,11 +794,13 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) {
IWL_WARN(trans, IWL_WARN(trans,
"HCMD_ACTIVE already clear for command %s\n", "HCMD_ACTIVE already clear for command %s\n",
get_cmd_string(cmd->hdr.cmd)); trans_pcie_get_cmd_string(trans_pcie,
cmd->hdr.cmd));
} }
clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
get_cmd_string(cmd->hdr.cmd)); trans_pcie_get_cmd_string(trans_pcie,
cmd->hdr.cmd));
wake_up(&trans->wait_command_queue); wake_up(&trans->wait_command_queue);
} }
...@@ -812,6 +813,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb, ...@@ -812,6 +813,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb,
static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd) static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
int ret; int ret;
/* An asynchronous command can not expect an SKB to be set. */ /* An asynchronous command can not expect an SKB to be set. */
...@@ -823,7 +825,7 @@ static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -823,7 +825,7 @@ static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
if (ret < 0) { if (ret < 0) {
IWL_ERR(trans, IWL_ERR(trans,
"Error sending %s: enqueue_hcmd failed: %d\n", "Error sending %s: enqueue_hcmd failed: %d\n",
get_cmd_string(cmd->id), ret); trans_pcie_get_cmd_string(trans_pcie, cmd->id), ret);
return ret; return ret;
} }
return 0; return 0;
...@@ -836,17 +838,17 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -836,17 +838,17 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
int ret; int ret;
IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",
get_cmd_string(cmd->id)); trans_pcie_get_cmd_string(trans_pcie, cmd->id));
if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE, if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE,
&trans_pcie->status))) { &trans_pcie->status))) {
IWL_ERR(trans, "Command %s: a command is already active!\n", IWL_ERR(trans, "Command %s: a command is already active!\n",
get_cmd_string(cmd->id)); trans_pcie_get_cmd_string(trans_pcie, cmd->id));
return -EIO; return -EIO;
} }
IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n",
get_cmd_string(cmd->id)); trans_pcie_get_cmd_string(trans_pcie, cmd->id));
cmd_idx = iwl_enqueue_hcmd(trans, cmd); cmd_idx = iwl_enqueue_hcmd(trans, cmd);
if (cmd_idx < 0) { if (cmd_idx < 0) {
...@@ -854,7 +856,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -854,7 +856,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
IWL_ERR(trans, IWL_ERR(trans,
"Error sending %s: enqueue_hcmd failed: %d\n", "Error sending %s: enqueue_hcmd failed: %d\n",
get_cmd_string(cmd->id), ret); trans_pcie_get_cmd_string(trans_pcie, cmd->id), ret);
return ret; return ret;
} }
...@@ -869,7 +871,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -869,7 +871,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
IWL_ERR(trans, IWL_ERR(trans,
"Error sending %s: time out after %dms.\n", "Error sending %s: time out after %dms.\n",
get_cmd_string(cmd->id), trans_pcie_get_cmd_string(trans_pcie, cmd->id),
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
IWL_ERR(trans, IWL_ERR(trans,
...@@ -877,8 +879,10 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -877,8 +879,10 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
q->read_ptr, q->write_ptr); q->read_ptr, q->write_ptr);
clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command" IWL_DEBUG_INFO(trans,
"%s\n", get_cmd_string(cmd->id)); "Clearing HCMD_ACTIVE for command %s\n",
trans_pcie_get_cmd_string(trans_pcie,
cmd->id));
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
goto cancel; goto cancel;
} }
...@@ -886,7 +890,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) ...@@ -886,7 +890,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
if ((cmd->flags & CMD_WANT_SKB) && !cmd->resp_pkt) { if ((cmd->flags & CMD_WANT_SKB) && !cmd->resp_pkt) {
IWL_ERR(trans, "Error: Response NULL in '%s'\n", IWL_ERR(trans, "Error: Response NULL in '%s'\n",
get_cmd_string(cmd->id)); trans_pcie_get_cmd_string(trans_pcie, cmd->id));
ret = -EIO; ret = -EIO;
goto cancel; goto cancel;
} }
......
...@@ -1544,6 +1544,8 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, ...@@ -1544,6 +1544,8 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
trans_pcie->wd_timeout = trans_pcie->wd_timeout =
msecs_to_jiffies(trans_cfg->queue_watchdog_timeout); msecs_to_jiffies(trans_cfg->queue_watchdog_timeout);
trans_pcie->command_names = trans_cfg->command_names;
} }
static void iwl_trans_pcie_free(struct iwl_trans *trans) static void iwl_trans_pcie_free(struct iwl_trans *trans)
...@@ -1635,6 +1637,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans) ...@@ -1635,6 +1637,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
static const char *get_fh_string(int cmd) static const char *get_fh_string(int cmd)
{ {
#define IWL_CMD(x) case x: return #x
switch (cmd) { switch (cmd) {
IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
...@@ -1648,6 +1651,7 @@ static const char *get_fh_string(int cmd) ...@@ -1648,6 +1651,7 @@ static const char *get_fh_string(int cmd)
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
#undef IWL_CMD
} }
int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display) int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display)
...@@ -1696,6 +1700,7 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display) ...@@ -1696,6 +1700,7 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display)
static const char *get_csr_string(int cmd) static const char *get_csr_string(int cmd)
{ {
#define IWL_CMD(x) case x: return #x
switch (cmd) { switch (cmd) {
IWL_CMD(CSR_HW_IF_CONFIG_REG); IWL_CMD(CSR_HW_IF_CONFIG_REG);
IWL_CMD(CSR_INT_COALESCING); IWL_CMD(CSR_INT_COALESCING);
...@@ -1723,6 +1728,7 @@ static const char *get_csr_string(int cmd) ...@@ -1723,6 +1728,7 @@ static const char *get_csr_string(int cmd)
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
#undef IWL_CMD
} }
void iwl_dump_csr(struct iwl_trans *trans) void iwl_dump_csr(struct iwl_trans *trans)
......
...@@ -309,6 +309,8 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r) ...@@ -309,6 +309,8 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r)
* if unset 4k will be the RX buffer size * if unset 4k will be the RX buffer size
* @queue_watchdog_timeout: time (in ms) after which queues * @queue_watchdog_timeout: time (in ms) after which queues
* are considered stuck and will trigger device restart * are considered stuck and will trigger device restart
* @command_names: array of command names, must be 256 entries
* (one for each command); for debugging only
*/ */
struct iwl_trans_config { struct iwl_trans_config {
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
...@@ -321,6 +323,7 @@ struct iwl_trans_config { ...@@ -321,6 +323,7 @@ struct iwl_trans_config {
bool rx_buf_size_8k; bool rx_buf_size_8k;
unsigned int queue_watchdog_timeout; unsigned int queue_watchdog_timeout;
const char **command_names;
}; };
/** /**
......
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