diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-03-26 11:23:39 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-04-16 17:49:56 -0400 |
commit | d9fb6465802c2279ea14cc26eb66d17c133478b1 (patch) | |
tree | 976d0ac36c6fa9e4f0a09a08d4354b335ab692ab /drivers | |
parent | c14c73728b8feb01d9142f9241bf14601cfb86f7 (diff) |
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: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 175 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-shared.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 3 |
12 files changed, 144 insertions, 115 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 8e83fb8c287e..4e0c248a0050 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1242,7 +1242,7 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1242 | 1242 | ||
1243 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { | 1243 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { |
1244 | IWL_ERR(priv, "Command %s failed: FW Error\n", | 1244 | IWL_ERR(priv, "Command %s failed: FW Error\n", |
1245 | get_cmd_string(cmd->id)); | 1245 | iwl_dvm_get_cmd_string(cmd->id)); |
1246 | return -EIO; | 1246 | return -EIO; |
1247 | } | 1247 | } |
1248 | 1248 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index 93a687175fa6..db6c90f6affe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -40,89 +40,86 @@ | |||
40 | #include "iwl-agn.h" | 40 | #include "iwl-agn.h" |
41 | #include "iwl-shared.h" | 41 | #include "iwl-shared.h" |
42 | 42 | ||
43 | const char *get_cmd_string(u8 cmd) | 43 | #define IWL_CMD_ENTRY(x) [x] = #x |
44 | { | 44 | |
45 | switch (cmd) { | 45 | const char *iwl_dvm_cmd_strings[REPLY_MAX] = { |
46 | IWL_CMD(REPLY_ALIVE); | 46 | IWL_CMD_ENTRY(REPLY_ALIVE), |
47 | IWL_CMD(REPLY_ERROR); | 47 | IWL_CMD_ENTRY(REPLY_ERROR), |
48 | IWL_CMD(REPLY_ECHO); | 48 | IWL_CMD_ENTRY(REPLY_ECHO), |
49 | IWL_CMD(REPLY_RXON); | 49 | IWL_CMD_ENTRY(REPLY_RXON), |
50 | IWL_CMD(REPLY_RXON_ASSOC); | 50 | IWL_CMD_ENTRY(REPLY_RXON_ASSOC), |
51 | IWL_CMD(REPLY_QOS_PARAM); | 51 | IWL_CMD_ENTRY(REPLY_QOS_PARAM), |
52 | IWL_CMD(REPLY_RXON_TIMING); | 52 | IWL_CMD_ENTRY(REPLY_RXON_TIMING), |
53 | IWL_CMD(REPLY_ADD_STA); | 53 | IWL_CMD_ENTRY(REPLY_ADD_STA), |
54 | IWL_CMD(REPLY_REMOVE_STA); | 54 | IWL_CMD_ENTRY(REPLY_REMOVE_STA), |
55 | IWL_CMD(REPLY_REMOVE_ALL_STA); | 55 | IWL_CMD_ENTRY(REPLY_REMOVE_ALL_STA), |
56 | IWL_CMD(REPLY_TXFIFO_FLUSH); | 56 | IWL_CMD_ENTRY(REPLY_TXFIFO_FLUSH), |
57 | IWL_CMD(REPLY_WEPKEY); | 57 | IWL_CMD_ENTRY(REPLY_WEPKEY), |
58 | IWL_CMD(REPLY_TX); | 58 | IWL_CMD_ENTRY(REPLY_TX), |
59 | IWL_CMD(REPLY_LEDS_CMD); | 59 | IWL_CMD_ENTRY(REPLY_LEDS_CMD), |
60 | IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); | 60 | IWL_CMD_ENTRY(REPLY_TX_LINK_QUALITY_CMD), |
61 | IWL_CMD(COEX_PRIORITY_TABLE_CMD); | 61 | IWL_CMD_ENTRY(COEX_PRIORITY_TABLE_CMD), |
62 | IWL_CMD(COEX_MEDIUM_NOTIFICATION); | 62 | IWL_CMD_ENTRY(COEX_MEDIUM_NOTIFICATION), |
63 | IWL_CMD(COEX_EVENT_CMD); | 63 | IWL_CMD_ENTRY(COEX_EVENT_CMD), |
64 | IWL_CMD(REPLY_QUIET_CMD); | 64 | IWL_CMD_ENTRY(REPLY_QUIET_CMD), |
65 | IWL_CMD(REPLY_CHANNEL_SWITCH); | 65 | IWL_CMD_ENTRY(REPLY_CHANNEL_SWITCH), |
66 | IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); | 66 | IWL_CMD_ENTRY(CHANNEL_SWITCH_NOTIFICATION), |
67 | IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); | 67 | IWL_CMD_ENTRY(REPLY_SPECTRUM_MEASUREMENT_CMD), |
68 | IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); | 68 | IWL_CMD_ENTRY(SPECTRUM_MEASURE_NOTIFICATION), |
69 | IWL_CMD(POWER_TABLE_CMD); | 69 | IWL_CMD_ENTRY(POWER_TABLE_CMD), |
70 | IWL_CMD(PM_SLEEP_NOTIFICATION); | 70 | IWL_CMD_ENTRY(PM_SLEEP_NOTIFICATION), |
71 | IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); | 71 | IWL_CMD_ENTRY(PM_DEBUG_STATISTIC_NOTIFIC), |
72 | IWL_CMD(REPLY_SCAN_CMD); | 72 | IWL_CMD_ENTRY(REPLY_SCAN_CMD), |
73 | IWL_CMD(REPLY_SCAN_ABORT_CMD); | 73 | IWL_CMD_ENTRY(REPLY_SCAN_ABORT_CMD), |
74 | IWL_CMD(SCAN_START_NOTIFICATION); | 74 | IWL_CMD_ENTRY(SCAN_START_NOTIFICATION), |
75 | IWL_CMD(SCAN_RESULTS_NOTIFICATION); | 75 | IWL_CMD_ENTRY(SCAN_RESULTS_NOTIFICATION), |
76 | IWL_CMD(SCAN_COMPLETE_NOTIFICATION); | 76 | IWL_CMD_ENTRY(SCAN_COMPLETE_NOTIFICATION), |
77 | IWL_CMD(BEACON_NOTIFICATION); | 77 | IWL_CMD_ENTRY(BEACON_NOTIFICATION), |
78 | IWL_CMD(REPLY_TX_BEACON); | 78 | IWL_CMD_ENTRY(REPLY_TX_BEACON), |
79 | IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); | 79 | IWL_CMD_ENTRY(WHO_IS_AWAKE_NOTIFICATION), |
80 | IWL_CMD(QUIET_NOTIFICATION); | 80 | IWL_CMD_ENTRY(QUIET_NOTIFICATION), |
81 | IWL_CMD(REPLY_TX_PWR_TABLE_CMD); | 81 | IWL_CMD_ENTRY(REPLY_TX_PWR_TABLE_CMD), |
82 | IWL_CMD(MEASURE_ABORT_NOTIFICATION); | 82 | IWL_CMD_ENTRY(MEASURE_ABORT_NOTIFICATION), |
83 | IWL_CMD(REPLY_BT_CONFIG); | 83 | IWL_CMD_ENTRY(REPLY_BT_CONFIG), |
84 | IWL_CMD(REPLY_STATISTICS_CMD); | 84 | IWL_CMD_ENTRY(REPLY_STATISTICS_CMD), |
85 | IWL_CMD(STATISTICS_NOTIFICATION); | 85 | IWL_CMD_ENTRY(STATISTICS_NOTIFICATION), |
86 | IWL_CMD(REPLY_CARD_STATE_CMD); | 86 | IWL_CMD_ENTRY(REPLY_CARD_STATE_CMD), |
87 | IWL_CMD(CARD_STATE_NOTIFICATION); | 87 | IWL_CMD_ENTRY(CARD_STATE_NOTIFICATION), |
88 | IWL_CMD(MISSED_BEACONS_NOTIFICATION); | 88 | IWL_CMD_ENTRY(MISSED_BEACONS_NOTIFICATION), |
89 | IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); | 89 | IWL_CMD_ENTRY(REPLY_CT_KILL_CONFIG_CMD), |
90 | IWL_CMD(SENSITIVITY_CMD); | 90 | IWL_CMD_ENTRY(SENSITIVITY_CMD), |
91 | IWL_CMD(REPLY_PHY_CALIBRATION_CMD); | 91 | IWL_CMD_ENTRY(REPLY_PHY_CALIBRATION_CMD), |
92 | IWL_CMD(REPLY_RX_PHY_CMD); | 92 | IWL_CMD_ENTRY(REPLY_RX_PHY_CMD), |
93 | IWL_CMD(REPLY_RX_MPDU_CMD); | 93 | IWL_CMD_ENTRY(REPLY_RX_MPDU_CMD), |
94 | IWL_CMD(REPLY_RX); | 94 | IWL_CMD_ENTRY(REPLY_RX), |
95 | IWL_CMD(REPLY_COMPRESSED_BA); | 95 | IWL_CMD_ENTRY(REPLY_COMPRESSED_BA), |
96 | IWL_CMD(CALIBRATION_CFG_CMD); | 96 | IWL_CMD_ENTRY(CALIBRATION_CFG_CMD), |
97 | IWL_CMD(CALIBRATION_RES_NOTIFICATION); | 97 | IWL_CMD_ENTRY(CALIBRATION_RES_NOTIFICATION), |
98 | IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION); | 98 | IWL_CMD_ENTRY(CALIBRATION_COMPLETE_NOTIFICATION), |
99 | IWL_CMD(REPLY_TX_POWER_DBM_CMD); | 99 | IWL_CMD_ENTRY(REPLY_TX_POWER_DBM_CMD), |
100 | IWL_CMD(TEMPERATURE_NOTIFICATION); | 100 | IWL_CMD_ENTRY(TEMPERATURE_NOTIFICATION), |
101 | IWL_CMD(TX_ANT_CONFIGURATION_CMD); | 101 | IWL_CMD_ENTRY(TX_ANT_CONFIGURATION_CMD), |
102 | IWL_CMD(REPLY_BT_COEX_PROFILE_NOTIF); | 102 | IWL_CMD_ENTRY(REPLY_BT_COEX_PROFILE_NOTIF), |
103 | IWL_CMD(REPLY_BT_COEX_PRIO_TABLE); | 103 | IWL_CMD_ENTRY(REPLY_BT_COEX_PRIO_TABLE), |
104 | IWL_CMD(REPLY_BT_COEX_PROT_ENV); | 104 | IWL_CMD_ENTRY(REPLY_BT_COEX_PROT_ENV), |
105 | IWL_CMD(REPLY_WIPAN_PARAMS); | 105 | IWL_CMD_ENTRY(REPLY_WIPAN_PARAMS), |
106 | IWL_CMD(REPLY_WIPAN_RXON); | 106 | IWL_CMD_ENTRY(REPLY_WIPAN_RXON), |
107 | IWL_CMD(REPLY_WIPAN_RXON_TIMING); | 107 | IWL_CMD_ENTRY(REPLY_WIPAN_RXON_TIMING), |
108 | IWL_CMD(REPLY_WIPAN_RXON_ASSOC); | 108 | IWL_CMD_ENTRY(REPLY_WIPAN_RXON_ASSOC), |
109 | IWL_CMD(REPLY_WIPAN_QOS_PARAM); | 109 | IWL_CMD_ENTRY(REPLY_WIPAN_QOS_PARAM), |
110 | IWL_CMD(REPLY_WIPAN_WEPKEY); | 110 | IWL_CMD_ENTRY(REPLY_WIPAN_WEPKEY), |
111 | IWL_CMD(REPLY_WIPAN_P2P_CHANNEL_SWITCH); | 111 | IWL_CMD_ENTRY(REPLY_WIPAN_P2P_CHANNEL_SWITCH), |
112 | IWL_CMD(REPLY_WIPAN_NOA_NOTIFICATION); | 112 | IWL_CMD_ENTRY(REPLY_WIPAN_NOA_NOTIFICATION), |
113 | IWL_CMD(REPLY_WIPAN_DEACTIVATION_COMPLETE); | 113 | IWL_CMD_ENTRY(REPLY_WIPAN_DEACTIVATION_COMPLETE), |
114 | IWL_CMD(REPLY_WOWLAN_PATTERNS); | 114 | IWL_CMD_ENTRY(REPLY_WOWLAN_PATTERNS), |
115 | IWL_CMD(REPLY_WOWLAN_WAKEUP_FILTER); | 115 | IWL_CMD_ENTRY(REPLY_WOWLAN_WAKEUP_FILTER), |
116 | IWL_CMD(REPLY_WOWLAN_TSC_RSC_PARAMS); | 116 | IWL_CMD_ENTRY(REPLY_WOWLAN_TSC_RSC_PARAMS), |
117 | IWL_CMD(REPLY_WOWLAN_TKIP_PARAMS); | 117 | IWL_CMD_ENTRY(REPLY_WOWLAN_TKIP_PARAMS), |
118 | IWL_CMD(REPLY_WOWLAN_KEK_KCK_MATERIAL); | 118 | IWL_CMD_ENTRY(REPLY_WOWLAN_KEK_KCK_MATERIAL), |
119 | IWL_CMD(REPLY_WOWLAN_GET_STATUS); | 119 | IWL_CMD_ENTRY(REPLY_WOWLAN_GET_STATUS), |
120 | IWL_CMD(REPLY_D3_CONFIG); | 120 | IWL_CMD_ENTRY(REPLY_D3_CONFIG), |
121 | default: | 121 | }; |
122 | return "UNKNOWN"; | 122 | #undef IWL_CMD_ENTRY |
123 | |||
124 | } | ||
125 | } | ||
126 | 123 | ||
127 | /****************************************************************************** | 124 | /****************************************************************************** |
128 | * | 125 | * |
@@ -137,10 +134,9 @@ static int iwlagn_rx_reply_error(struct iwl_priv *priv, | |||
137 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 134 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
138 | struct iwl_error_resp *err_resp = (void *)pkt->data; | 135 | struct iwl_error_resp *err_resp = (void *)pkt->data; |
139 | 136 | ||
140 | IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " | 137 | IWL_ERR(priv, "Error Reply type 0x%08X cmd REPLY_ERROR (0x%02X) " |
141 | "seq 0x%04X ser 0x%08X\n", | 138 | "seq 0x%04X ser 0x%08X\n", |
142 | le32_to_cpu(err_resp->error_type), | 139 | le32_to_cpu(err_resp->error_type), |
143 | get_cmd_string(err_resp->cmd_id), | ||
144 | err_resp->cmd_id, | 140 | err_resp->cmd_id, |
145 | le16_to_cpu(err_resp->bad_cmd_seq_num), | 141 | le16_to_cpu(err_resp->bad_cmd_seq_num), |
146 | le32_to_cpu(err_resp->error_info)); | 142 | le32_to_cpu(err_resp->error_info)); |
@@ -216,8 +212,7 @@ static int iwlagn_rx_pm_debug_statistics_notif(struct iwl_priv *priv, | |||
216 | u32 __maybe_unused len = | 212 | u32 __maybe_unused len = |
217 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | 213 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; |
218 | IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " | 214 | IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " |
219 | "notification for %s:\n", len, | 215 | "notification for PM_DEBUG_STATISTIC_NOTIFIC:\n", len); |
220 | get_cmd_string(pkt->hdr.cmd)); | ||
221 | iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->data, len); | 216 | iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->data, len); |
222 | return 0; | 217 | return 0; |
223 | } | 218 | } |
@@ -1152,9 +1147,9 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, | |||
1152 | err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd); | 1147 | err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd); |
1153 | } else { | 1148 | } else { |
1154 | /* No handling needed */ | 1149 | /* No handling needed */ |
1155 | IWL_DEBUG_RX(priv, | 1150 | IWL_DEBUG_RX(priv, "No handler needed for %s, 0x%02x\n", |
1156 | "No handler needed for %s, 0x%02x\n", | 1151 | iwl_dvm_get_cmd_string(pkt->hdr.cmd), |
1157 | get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 1152 | pkt->hdr.cmd); |
1158 | } | 1153 | } |
1159 | } | 1154 | } |
1160 | return err; | 1155 | return err; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index bc585a67a200..7db39866bdc4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1560,6 +1560,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1560 | cfg(priv)->base_params->wd_timeout; | 1560 | cfg(priv)->base_params->wd_timeout; |
1561 | else | 1561 | else |
1562 | trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; | 1562 | trans_cfg.queue_watchdog_timeout = IWL_WATCHHDOG_DISABLED; |
1563 | trans_cfg.command_names = iwl_dvm_cmd_strings; | ||
1563 | 1564 | ||
1564 | ucode_flags = fw->ucode_capa.flags; | 1565 | ucode_flags = fw->ucode_capa.flags; |
1565 | 1566 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index a321b65e4272..20100c72ec6b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -495,6 +495,16 @@ do { \ | |||
495 | } while (0) | 495 | } while (0) |
496 | #endif /* CONFIG_IWLWIFI_DEBUG */ | 496 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
497 | 497 | ||
498 | extern const char *iwl_dvm_cmd_strings[REPLY_MAX]; | ||
499 | |||
500 | static inline const char *iwl_dvm_get_cmd_string(u8 cmd) | ||
501 | { | ||
502 | const char *s = iwl_dvm_cmd_strings[cmd]; | ||
503 | if (s) | ||
504 | return s; | ||
505 | return "UNKNOWN"; | ||
506 | } | ||
507 | |||
498 | /* API method exported for mvm hybrid state */ | 508 | /* API method exported for mvm hybrid state */ |
499 | void iwl_setup_deferred_work(struct iwl_priv *priv); | 509 | void iwl_setup_deferred_work(struct iwl_priv *priv); |
500 | int iwl_send_wimax_coex(struct iwl_priv *priv); | 510 | int iwl_send_wimax_coex(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 94a4ebcb447b..d7a8cde249ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -140,6 +140,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, | |||
140 | 140 | ||
141 | const char *get_mgmt_string(int cmd) | 141 | const char *get_mgmt_string(int cmd) |
142 | { | 142 | { |
143 | #define IWL_CMD(x) case x: return #x | ||
143 | switch (cmd) { | 144 | switch (cmd) { |
144 | IWL_CMD(MANAGEMENT_ASSOC_REQ); | 145 | IWL_CMD(MANAGEMENT_ASSOC_REQ); |
145 | IWL_CMD(MANAGEMENT_ASSOC_RESP); | 146 | IWL_CMD(MANAGEMENT_ASSOC_RESP); |
@@ -157,10 +158,12 @@ const char *get_mgmt_string(int cmd) | |||
157 | return "UNKNOWN"; | 158 | return "UNKNOWN"; |
158 | 159 | ||
159 | } | 160 | } |
161 | #undef IWL_CMD | ||
160 | } | 162 | } |
161 | 163 | ||
162 | const char *get_ctrl_string(int cmd) | 164 | const char *get_ctrl_string(int cmd) |
163 | { | 165 | { |
166 | #define IWL_CMD(x) case x: return #x | ||
164 | switch (cmd) { | 167 | switch (cmd) { |
165 | IWL_CMD(CONTROL_BACK_REQ); | 168 | IWL_CMD(CONTROL_BACK_REQ); |
166 | IWL_CMD(CONTROL_BACK); | 169 | IWL_CMD(CONTROL_BACK); |
@@ -174,6 +177,7 @@ const char *get_ctrl_string(int cmd) | |||
174 | return "UNKNOWN"; | 177 | return "UNKNOWN"; |
175 | 178 | ||
176 | } | 179 | } |
180 | #undef IWL_CMD | ||
177 | } | 181 | } |
178 | 182 | ||
179 | void iwl_clear_traffic_stats(struct iwl_priv *priv) | 183 | void iwl_clear_traffic_stats(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 4d1f1ddb8f6f..32834a797d11 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -575,7 +575,7 @@ static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file, | |||
575 | if (priv->rx_handlers_stats[cnt] > 0) | 575 | if (priv->rx_handlers_stats[cnt] > 0) |
576 | pos += scnprintf(buf + pos, bufsz - pos, | 576 | pos += scnprintf(buf + pos, bufsz - pos, |
577 | "\tRx handler[%36s]:\t\t %u\n", | 577 | "\tRx handler[%36s]:\t\t %u\n", |
578 | get_cmd_string(cnt), | 578 | iwl_dvm_get_cmd_string(cnt), |
579 | priv->rx_handlers_stats[cnt]); | 579 | priv->rx_handlers_stats[cnt]); |
580 | } | 580 | } |
581 | 581 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index 82b52dac38e5..35bd83ce3dae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -181,8 +181,4 @@ enum iwl_rxon_context_id { | |||
181 | NUM_IWL_RXON_CTX | 181 | NUM_IWL_RXON_CTX |
182 | }; | 182 | }; |
183 | 183 | ||
184 | const char *get_cmd_string(u8 cmd); | ||
185 | |||
186 | #define IWL_CMD(x) case x: return #x | ||
187 | |||
188 | #endif /* #__iwl_shared_h__ */ | 184 | #endif /* #__iwl_shared_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h index f98eff3abb13..70bdd0e2df38 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h | |||
@@ -273,6 +273,7 @@ struct iwl_trans_pcie { | |||
273 | bool rx_buf_size_8k; | 273 | bool rx_buf_size_8k; |
274 | u32 rx_page_order; | 274 | u32 rx_page_order; |
275 | 275 | ||
276 | const char **command_names; | ||
276 | 277 | ||
277 | /* queue watchdog */ | 278 | /* queue watchdog */ |
278 | unsigned long wd_timeout; | 279 | unsigned long wd_timeout; |
@@ -417,4 +418,12 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) | |||
417 | return index & (q->n_window - 1); | 418 | return index & (q->n_window - 1); |
418 | } | 419 | } |
419 | 420 | ||
421 | static inline const char * | ||
422 | trans_pcie_get_cmd_string(struct iwl_trans_pcie *trans_pcie, u8 cmd) | ||
423 | { | ||
424 | if (!trans_pcie->command_names || !trans_pcie->command_names[cmd]) | ||
425 | return "UNKNOWN"; | ||
426 | return trans_pcie->command_names[cmd]; | ||
427 | } | ||
428 | |||
420 | #endif /* __iwl_trans_int_pcie_h__ */ | 429 | #endif /* __iwl_trans_int_pcie_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c index bf83806130e7..de78fb8dca9f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | |||
@@ -393,8 +393,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, | |||
393 | break; | 393 | break; |
394 | 394 | ||
395 | IWL_DEBUG_RX(trans, "cmd at offset %d: %s (0x%.2x)\n", | 395 | IWL_DEBUG_RX(trans, "cmd at offset %d: %s (0x%.2x)\n", |
396 | rxcb._offset, get_cmd_string(pkt->hdr.cmd), | 396 | rxcb._offset, |
397 | pkt->hdr.cmd); | 397 | trans_pcie_get_cmd_string(trans_pcie, pkt->hdr.cmd), |
398 | pkt->hdr.cmd); | ||
398 | 399 | ||
399 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | 400 | len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; |
400 | len += sizeof(u32); /* account for status word */ | 401 | len += sizeof(u32); /* account for status word */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c index 21b7ca272af5..918874067bd3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | |||
@@ -605,12 +605,11 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
605 | cmd_dest += cmd->len[i]; | 605 | cmd_dest += cmd->len[i]; |
606 | } | 606 | } |
607 | 607 | ||
608 | IWL_DEBUG_HC(trans, "Sending command %s (#%x), seq: 0x%04X, " | 608 | IWL_DEBUG_HC(trans, |
609 | "%d bytes at %d[%d]:%d\n", | 609 | "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", |
610 | get_cmd_string(out_cmd->hdr.cmd), | 610 | trans_pcie_get_cmd_string(trans_pcie, out_cmd->hdr.cmd), |
611 | out_cmd->hdr.cmd, | 611 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), cmd_size, |
612 | le16_to_cpu(out_cmd->hdr.sequence), cmd_size, | 612 | q->write_ptr, idx, trans_pcie->cmd_queue); |
613 | q->write_ptr, idx, trans_pcie->cmd_queue); | ||
614 | 613 | ||
615 | phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, | 614 | phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, copy_size, |
616 | DMA_BIDIRECTIONAL); | 615 | DMA_BIDIRECTIONAL); |
@@ -795,11 +794,13 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb, | |||
795 | if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { | 794 | if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { |
796 | IWL_WARN(trans, | 795 | IWL_WARN(trans, |
797 | "HCMD_ACTIVE already clear for command %s\n", | 796 | "HCMD_ACTIVE already clear for command %s\n", |
798 | get_cmd_string(cmd->hdr.cmd)); | 797 | trans_pcie_get_cmd_string(trans_pcie, |
798 | cmd->hdr.cmd)); | ||
799 | } | 799 | } |
800 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); | 800 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); |
801 | IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", | 801 | IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", |
802 | get_cmd_string(cmd->hdr.cmd)); | 802 | trans_pcie_get_cmd_string(trans_pcie, |
803 | cmd->hdr.cmd)); | ||
803 | wake_up(&trans->wait_command_queue); | 804 | wake_up(&trans->wait_command_queue); |
804 | } | 805 | } |
805 | 806 | ||
@@ -812,6 +813,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_cmd_buffer *rxb, | |||
812 | 813 | ||
813 | static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | 814 | static int iwl_send_cmd_async(struct iwl_trans *trans, struct iwl_host_cmd *cmd) |
814 | { | 815 | { |
816 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
815 | int ret; | 817 | int ret; |
816 | 818 | ||
817 | /* An asynchronous command can not expect an SKB to be set. */ | 819 | /* 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 | if (ret < 0) { | 825 | if (ret < 0) { |
824 | IWL_ERR(trans, | 826 | IWL_ERR(trans, |
825 | "Error sending %s: enqueue_hcmd failed: %d\n", | 827 | "Error sending %s: enqueue_hcmd failed: %d\n", |
826 | get_cmd_string(cmd->id), ret); | 828 | trans_pcie_get_cmd_string(trans_pcie, cmd->id), ret); |
827 | return ret; | 829 | return ret; |
828 | } | 830 | } |
829 | return 0; | 831 | return 0; |
@@ -836,17 +838,17 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
836 | int ret; | 838 | int ret; |
837 | 839 | ||
838 | IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", | 840 | IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", |
839 | get_cmd_string(cmd->id)); | 841 | trans_pcie_get_cmd_string(trans_pcie, cmd->id)); |
840 | 842 | ||
841 | if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE, | 843 | if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE, |
842 | &trans_pcie->status))) { | 844 | &trans_pcie->status))) { |
843 | IWL_ERR(trans, "Command %s: a command is already active!\n", | 845 | IWL_ERR(trans, "Command %s: a command is already active!\n", |
844 | get_cmd_string(cmd->id)); | 846 | trans_pcie_get_cmd_string(trans_pcie, cmd->id)); |
845 | return -EIO; | 847 | return -EIO; |
846 | } | 848 | } |
847 | 849 | ||
848 | IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", | 850 | IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", |
849 | get_cmd_string(cmd->id)); | 851 | trans_pcie_get_cmd_string(trans_pcie, cmd->id)); |
850 | 852 | ||
851 | cmd_idx = iwl_enqueue_hcmd(trans, cmd); | 853 | cmd_idx = iwl_enqueue_hcmd(trans, cmd); |
852 | if (cmd_idx < 0) { | 854 | if (cmd_idx < 0) { |
@@ -854,7 +856,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
854 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); | 856 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); |
855 | IWL_ERR(trans, | 857 | IWL_ERR(trans, |
856 | "Error sending %s: enqueue_hcmd failed: %d\n", | 858 | "Error sending %s: enqueue_hcmd failed: %d\n", |
857 | get_cmd_string(cmd->id), ret); | 859 | trans_pcie_get_cmd_string(trans_pcie, cmd->id), ret); |
858 | return ret; | 860 | return ret; |
859 | } | 861 | } |
860 | 862 | ||
@@ -869,7 +871,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
869 | 871 | ||
870 | IWL_ERR(trans, | 872 | IWL_ERR(trans, |
871 | "Error sending %s: time out after %dms.\n", | 873 | "Error sending %s: time out after %dms.\n", |
872 | get_cmd_string(cmd->id), | 874 | trans_pcie_get_cmd_string(trans_pcie, cmd->id), |
873 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 875 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); |
874 | 876 | ||
875 | IWL_ERR(trans, | 877 | IWL_ERR(trans, |
@@ -877,8 +879,10 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
877 | q->read_ptr, q->write_ptr); | 879 | q->read_ptr, q->write_ptr); |
878 | 880 | ||
879 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); | 881 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); |
880 | IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command" | 882 | IWL_DEBUG_INFO(trans, |
881 | "%s\n", get_cmd_string(cmd->id)); | 883 | "Clearing HCMD_ACTIVE for command %s\n", |
884 | trans_pcie_get_cmd_string(trans_pcie, | ||
885 | cmd->id)); | ||
882 | ret = -ETIMEDOUT; | 886 | ret = -ETIMEDOUT; |
883 | goto cancel; | 887 | goto cancel; |
884 | } | 888 | } |
@@ -886,7 +890,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
886 | 890 | ||
887 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->resp_pkt) { | 891 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->resp_pkt) { |
888 | IWL_ERR(trans, "Error: Response NULL in '%s'\n", | 892 | IWL_ERR(trans, "Error: Response NULL in '%s'\n", |
889 | get_cmd_string(cmd->id)); | 893 | trans_pcie_get_cmd_string(trans_pcie, cmd->id)); |
890 | ret = -EIO; | 894 | ret = -EIO; |
891 | goto cancel; | 895 | goto cancel; |
892 | } | 896 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index 333a2784cf0b..14a32c420fd4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -1544,6 +1544,8 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans, | |||
1544 | 1544 | ||
1545 | trans_pcie->wd_timeout = | 1545 | trans_pcie->wd_timeout = |
1546 | msecs_to_jiffies(trans_cfg->queue_watchdog_timeout); | 1546 | msecs_to_jiffies(trans_cfg->queue_watchdog_timeout); |
1547 | |||
1548 | trans_pcie->command_names = trans_cfg->command_names; | ||
1547 | } | 1549 | } |
1548 | 1550 | ||
1549 | static void iwl_trans_pcie_free(struct iwl_trans *trans) | 1551 | 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 | 1637 | ||
1636 | static const char *get_fh_string(int cmd) | 1638 | static const char *get_fh_string(int cmd) |
1637 | { | 1639 | { |
1640 | #define IWL_CMD(x) case x: return #x | ||
1638 | switch (cmd) { | 1641 | switch (cmd) { |
1639 | IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); | 1642 | IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); |
1640 | IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); | 1643 | IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); |
@@ -1648,6 +1651,7 @@ static const char *get_fh_string(int cmd) | |||
1648 | default: | 1651 | default: |
1649 | return "UNKNOWN"; | 1652 | return "UNKNOWN"; |
1650 | } | 1653 | } |
1654 | #undef IWL_CMD | ||
1651 | } | 1655 | } |
1652 | 1656 | ||
1653 | int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display) | 1657 | 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 | 1700 | ||
1697 | static const char *get_csr_string(int cmd) | 1701 | static const char *get_csr_string(int cmd) |
1698 | { | 1702 | { |
1703 | #define IWL_CMD(x) case x: return #x | ||
1699 | switch (cmd) { | 1704 | switch (cmd) { |
1700 | IWL_CMD(CSR_HW_IF_CONFIG_REG); | 1705 | IWL_CMD(CSR_HW_IF_CONFIG_REG); |
1701 | IWL_CMD(CSR_INT_COALESCING); | 1706 | IWL_CMD(CSR_INT_COALESCING); |
@@ -1723,6 +1728,7 @@ static const char *get_csr_string(int cmd) | |||
1723 | default: | 1728 | default: |
1724 | return "UNKNOWN"; | 1729 | return "UNKNOWN"; |
1725 | } | 1730 | } |
1731 | #undef IWL_CMD | ||
1726 | } | 1732 | } |
1727 | 1733 | ||
1728 | void iwl_dump_csr(struct iwl_trans *trans) | 1734 | void iwl_dump_csr(struct iwl_trans *trans) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index d0888cc70075..f3496a0490f0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -309,6 +309,8 @@ static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r) | |||
309 | * if unset 4k will be the RX buffer size | 309 | * if unset 4k will be the RX buffer size |
310 | * @queue_watchdog_timeout: time (in ms) after which queues | 310 | * @queue_watchdog_timeout: time (in ms) after which queues |
311 | * are considered stuck and will trigger device restart | 311 | * are considered stuck and will trigger device restart |
312 | * @command_names: array of command names, must be 256 entries | ||
313 | * (one for each command); for debugging only | ||
312 | */ | 314 | */ |
313 | struct iwl_trans_config { | 315 | struct iwl_trans_config { |
314 | struct iwl_op_mode *op_mode; | 316 | struct iwl_op_mode *op_mode; |
@@ -321,6 +323,7 @@ struct iwl_trans_config { | |||
321 | 323 | ||
322 | bool rx_buf_size_8k; | 324 | bool rx_buf_size_8k; |
323 | unsigned int queue_watchdog_timeout; | 325 | unsigned int queue_watchdog_timeout; |
326 | const char **command_names; | ||
324 | }; | 327 | }; |
325 | 328 | ||
326 | /** | 329 | /** |