diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-03-21 16:53:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-25 16:41:55 -0400 |
commit | 857485c0c46ceee5c658c1761bba4d9a5ddf433f (patch) | |
tree | df2028c6a3d99ad32491efba7b6ca69f7d45edcf /drivers | |
parent | 8622e7058a8764223ae2305d980a38d07f034717 (diff) |
iwlwifi: move host command sending functions to core module
1. Host command sending functions moved from iwl4965-base.c to iwl-hcmd.c
in iwlcore module
2. enqueue_hcmd function currently stays in iwl4965-base.c. It is invoked
through the new 'utils' field in priv's ops.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 86 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 33 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 26 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-hcmd.c | 251 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 299 |
9 files changed, 399 insertions, 322 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile index 86ac1fc60bbb..6be8012a1743 100644 --- a/drivers/net/wireless/iwlwifi/Makefile +++ b/drivers/net/wireless/iwlwifi/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-$(CONFIG_IWLCORE) += iwlcore.o | 1 | obj-$(CONFIG_IWLCORE) += iwlcore.o |
2 | iwlcore-objs = iwl-core.o iwl-eeprom.o | 2 | iwlcore-objs = iwl-core.o iwl-eeprom.o iwl-hcmd.o |
3 | 3 | ||
4 | ifeq ($(CONFIG_IWLWIFI_DEBUGFS),y) | 4 | ifeq ($(CONFIG_IWLWIFI_DEBUGFS),y) |
5 | iwlcore-objs += iwl-debugfs.o | 5 | iwlcore-objs += iwl-debugfs.o |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h index 1d82f105cc26..7e36ecb27575 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h | |||
@@ -139,7 +139,7 @@ enum { | |||
139 | REPLY_PHY_CALIBRATION_CMD = 0xb0, | 139 | REPLY_PHY_CALIBRATION_CMD = 0xb0, |
140 | REPLY_RX_PHY_CMD = 0xc0, | 140 | REPLY_RX_PHY_CMD = 0xc0, |
141 | REPLY_RX_MPDU_CMD = 0xc1, | 141 | REPLY_RX_MPDU_CMD = 0xc1, |
142 | REPLY_4965_RX = 0xc3, | 142 | REPLY_RX = 0xc3, |
143 | REPLY_COMPRESSED_BA = 0xc5, | 143 | REPLY_COMPRESSED_BA = 0xc5, |
144 | REPLY_MAX = 0xff | 144 | REPLY_MAX = 0xff |
145 | }; | 145 | }; |
@@ -151,16 +151,16 @@ enum { | |||
151 | * | 151 | * |
152 | *****************************************************************************/ | 152 | *****************************************************************************/ |
153 | 153 | ||
154 | /* iwl4965_cmd_header flags value */ | 154 | /* iwl_cmd_header flags value */ |
155 | #define IWL_CMD_FAILED_MSK 0x40 | 155 | #define IWL_CMD_FAILED_MSK 0x40 |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * struct iwl4965_cmd_header | 158 | * struct iwl_cmd_header |
159 | * | 159 | * |
160 | * This header format appears in the beginning of each command sent from the | 160 | * This header format appears in the beginning of each command sent from the |
161 | * driver, and each response/notification received from uCode. | 161 | * driver, and each response/notification received from uCode. |
162 | */ | 162 | */ |
163 | struct iwl4965_cmd_header { | 163 | struct iwl_cmd_header { |
164 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ | 164 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
165 | u8 flags; /* IWL_CMD_* */ | 165 | u8 flags; /* IWL_CMD_* */ |
166 | /* | 166 | /* |
@@ -194,7 +194,7 @@ struct iwl4965_cmd_header { | |||
194 | * 4965 rate_n_flags bit fields | 194 | * 4965 rate_n_flags bit fields |
195 | * | 195 | * |
196 | * rate_n_flags format is used in following 4965 commands: | 196 | * rate_n_flags format is used in following 4965 commands: |
197 | * REPLY_4965_RX (response only) | 197 | * REPLY_RX (response only) |
198 | * REPLY_TX (both command and response) | 198 | * REPLY_TX (both command and response) |
199 | * REPLY_TX_LINK_QUALITY_CMD | 199 | * REPLY_TX_LINK_QUALITY_CMD |
200 | * | 200 | * |
@@ -939,7 +939,7 @@ struct iwl4965_rx_non_cfg_phy { | |||
939 | } __attribute__ ((packed)); | 939 | } __attribute__ ((packed)); |
940 | 940 | ||
941 | /* | 941 | /* |
942 | * REPLY_4965_RX = 0xc3 (response only, not a command) | 942 | * REPLY_RX = 0xc3 (response only, not a command) |
943 | * Used only for legacy (non 11n) frames. | 943 | * Used only for legacy (non 11n) frames. |
944 | */ | 944 | */ |
945 | #define RX_RES_PHY_CNT 14 | 945 | #define RX_RES_PHY_CNT 14 |
@@ -2664,7 +2664,7 @@ struct iwl4965_led_cmd { | |||
2664 | 2664 | ||
2665 | struct iwl4965_rx_packet { | 2665 | struct iwl4965_rx_packet { |
2666 | __le32 len; | 2666 | __le32 len; |
2667 | struct iwl4965_cmd_header hdr; | 2667 | struct iwl_cmd_header hdr; |
2668 | union { | 2668 | union { |
2669 | struct iwl4965_alive_resp alive_frame; | 2669 | struct iwl4965_alive_resp alive_frame; |
2670 | struct iwl4965_rx_frame rx_frame; | 2670 | struct iwl4965_rx_frame rx_frame; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index c66993eb5b6a..1898888e71f2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -113,9 +113,6 @@ | |||
113 | #define TFD_TX_CMD_SLOTS 256 | 113 | #define TFD_TX_CMD_SLOTS 256 |
114 | #define TFD_CMD_SLOTS 32 | 114 | #define TFD_CMD_SLOTS 32 |
115 | 115 | ||
116 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \ | ||
117 | sizeof(struct iwl4965_cmd_meta)) | ||
118 | |||
119 | /* | 116 | /* |
120 | * RX related structures and functions | 117 | * RX related structures and functions |
121 | */ | 118 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 02990aeabab5..7d7ce7489ab5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "../net/mac80211/ieee80211_rate.h" | 39 | #include "../net/mac80211/ieee80211_rate.h" |
40 | 40 | ||
41 | #include "iwl-4965.h" | 41 | #include "iwl-4965.h" |
42 | #include "iwl-core.h" | ||
42 | #include "iwl-helpers.h" | 43 | #include "iwl-helpers.h" |
43 | 44 | ||
44 | #define RS_NAME "iwl-4965-rs" | 45 | #define RS_NAME "iwl-4965-rs" |
@@ -230,7 +231,7 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = { | |||
230 | }; | 231 | }; |
231 | 232 | ||
232 | static int iwl4965_lq_sync_callback(struct iwl_priv *priv, | 233 | static int iwl4965_lq_sync_callback(struct iwl_priv *priv, |
233 | struct iwl4965_cmd *cmd, struct sk_buff *skb) | 234 | struct iwl_cmd *cmd, struct sk_buff *skb) |
234 | { | 235 | { |
235 | /*We didn't cache the SKB; let the caller free it */ | 236 | /*We didn't cache the SKB; let the caller free it */ |
236 | return 1; | 237 | return 1; |
@@ -247,7 +248,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, | |||
247 | #ifdef CONFIG_IWLWIFI_DEBUG | 248 | #ifdef CONFIG_IWLWIFI_DEBUG |
248 | int i; | 249 | int i; |
249 | #endif | 250 | #endif |
250 | struct iwl4965_host_cmd cmd = { | 251 | struct iwl_host_cmd cmd = { |
251 | .id = REPLY_TX_LINK_QUALITY_CMD, | 252 | .id = REPLY_TX_LINK_QUALITY_CMD, |
252 | .len = sizeof(struct iwl4965_link_quality_cmd), | 253 | .len = sizeof(struct iwl4965_link_quality_cmd), |
253 | .meta.flags = flags, | 254 | .meta.flags = flags, |
@@ -276,7 +277,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv, | |||
276 | 277 | ||
277 | if (iwl4965_is_associated(priv) && priv->assoc_station_added && | 278 | if (iwl4965_is_associated(priv) && priv->assoc_station_added && |
278 | priv->lq_mngr.lq_ready) | 279 | priv->lq_mngr.lq_ready) |
279 | return iwl4965_send_cmd(priv, &cmd); | 280 | return iwl_send_cmd(priv, &cmd); |
280 | 281 | ||
281 | return 0; | 282 | return 0; |
282 | } | 283 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index c0c35d38cf5e..46b3f47edefd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -861,7 +861,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) | |||
861 | u32 temp_th; | 861 | u32 temp_th; |
862 | u32 crit_temperature; | 862 | u32 crit_temperature; |
863 | unsigned long flags; | 863 | unsigned long flags; |
864 | int rc = 0; | 864 | int ret = 0; |
865 | 865 | ||
866 | spin_lock_irqsave(&priv->lock, flags); | 866 | spin_lock_irqsave(&priv->lock, flags); |
867 | iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, | 867 | iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, |
@@ -882,9 +882,9 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) | |||
882 | 882 | ||
883 | crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; | 883 | crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; |
884 | cmd.critical_temperature_R = cpu_to_le32(crit_temperature); | 884 | cmd.critical_temperature_R = cpu_to_le32(crit_temperature); |
885 | rc = iwl4965_send_cmd_pdu(priv, | 885 | ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, |
886 | REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); | 886 | sizeof(cmd), &cmd); |
887 | if (rc) | 887 | if (ret) |
888 | IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); | 888 | IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); |
889 | else | 889 | else |
890 | IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); | 890 | IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); |
@@ -1157,7 +1157,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv, | |||
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | static int iwl4965_sensitivity_callback(struct iwl_priv *priv, | 1159 | static int iwl4965_sensitivity_callback(struct iwl_priv *priv, |
1160 | struct iwl4965_cmd *cmd, struct sk_buff *skb) | 1160 | struct iwl_cmd *cmd, struct sk_buff *skb) |
1161 | { | 1161 | { |
1162 | /* We didn't cache the SKB; let the caller free it */ | 1162 | /* We didn't cache the SKB; let the caller free it */ |
1163 | return 1; | 1163 | return 1; |
@@ -1166,15 +1166,15 @@ static int iwl4965_sensitivity_callback(struct iwl_priv *priv, | |||
1166 | /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ | 1166 | /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ |
1167 | static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) | 1167 | static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) |
1168 | { | 1168 | { |
1169 | int rc = 0; | ||
1170 | struct iwl4965_sensitivity_cmd cmd ; | 1169 | struct iwl4965_sensitivity_cmd cmd ; |
1171 | struct iwl4965_sensitivity_data *data = NULL; | 1170 | struct iwl4965_sensitivity_data *data = NULL; |
1172 | struct iwl4965_host_cmd cmd_out = { | 1171 | struct iwl_host_cmd cmd_out = { |
1173 | .id = SENSITIVITY_CMD, | 1172 | .id = SENSITIVITY_CMD, |
1174 | .len = sizeof(struct iwl4965_sensitivity_cmd), | 1173 | .len = sizeof(struct iwl4965_sensitivity_cmd), |
1175 | .meta.flags = flags, | 1174 | .meta.flags = flags, |
1176 | .data = &cmd, | 1175 | .data = &cmd, |
1177 | }; | 1176 | }; |
1177 | int ret; | ||
1178 | 1178 | ||
1179 | data = &(priv->sensitivity_data); | 1179 | data = &(priv->sensitivity_data); |
1180 | 1180 | ||
@@ -1232,20 +1232,18 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) | |||
1232 | memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), | 1232 | memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), |
1233 | sizeof(u16)*HD_TABLE_SIZE); | 1233 | sizeof(u16)*HD_TABLE_SIZE); |
1234 | 1234 | ||
1235 | rc = iwl4965_send_cmd(priv, &cmd_out); | 1235 | ret = iwl_send_cmd(priv, &cmd_out); |
1236 | if (!rc) { | 1236 | if (ret) |
1237 | IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n"); | 1237 | IWL_ERROR("SENSITIVITY_CMD failed\n"); |
1238 | return rc; | ||
1239 | } | ||
1240 | 1238 | ||
1241 | return 0; | 1239 | return ret; |
1242 | } | 1240 | } |
1243 | 1241 | ||
1244 | void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) | 1242 | void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) |
1245 | { | 1243 | { |
1246 | int rc = 0; | ||
1247 | int i; | ||
1248 | struct iwl4965_sensitivity_data *data = NULL; | 1244 | struct iwl4965_sensitivity_data *data = NULL; |
1245 | int i; | ||
1246 | int ret = 0; | ||
1249 | 1247 | ||
1250 | IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n"); | 1248 | IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n"); |
1251 | 1249 | ||
@@ -1289,8 +1287,8 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) | |||
1289 | memset(&(priv->sensitivity_tbl[0]), 0, | 1287 | memset(&(priv->sensitivity_tbl[0]), 0, |
1290 | sizeof(u16)*HD_TABLE_SIZE); | 1288 | sizeof(u16)*HD_TABLE_SIZE); |
1291 | 1289 | ||
1292 | rc |= iwl4965_sensitivity_write(priv, flags); | 1290 | ret |= iwl4965_sensitivity_write(priv, flags); |
1293 | IWL_DEBUG_CALIB("<<return 0x%X\n", rc); | 1291 | IWL_DEBUG_CALIB("<<return 0x%X\n", ret); |
1294 | 1292 | ||
1295 | return; | 1293 | return; |
1296 | } | 1294 | } |
@@ -1302,7 +1300,6 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) | |||
1302 | void iwl4965_chain_noise_reset(struct iwl_priv *priv) | 1300 | void iwl4965_chain_noise_reset(struct iwl_priv *priv) |
1303 | { | 1301 | { |
1304 | struct iwl4965_chain_noise_data *data = NULL; | 1302 | struct iwl4965_chain_noise_data *data = NULL; |
1305 | int rc = 0; | ||
1306 | 1303 | ||
1307 | data = &(priv->chain_noise_data); | 1304 | data = &(priv->chain_noise_data); |
1308 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) { | 1305 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) { |
@@ -1313,7 +1310,7 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv) | |||
1313 | cmd.diff_gain_a = 0; | 1310 | cmd.diff_gain_a = 0; |
1314 | cmd.diff_gain_b = 0; | 1311 | cmd.diff_gain_b = 0; |
1315 | cmd.diff_gain_c = 0; | 1312 | cmd.diff_gain_c = 0; |
1316 | rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 1313 | iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, |
1317 | sizeof(cmd), &cmd); | 1314 | sizeof(cmd), &cmd); |
1318 | msleep(4); | 1315 | msleep(4); |
1319 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; | 1316 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; |
@@ -1332,7 +1329,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, | |||
1332 | struct iwl4965_notif_statistics *stat_resp) | 1329 | struct iwl4965_notif_statistics *stat_resp) |
1333 | { | 1330 | { |
1334 | struct iwl4965_chain_noise_data *data = NULL; | 1331 | struct iwl4965_chain_noise_data *data = NULL; |
1335 | int rc = 0; | 1332 | int ret = 0; |
1336 | 1333 | ||
1337 | u32 chain_noise_a; | 1334 | u32 chain_noise_a; |
1338 | u32 chain_noise_b; | 1335 | u32 chain_noise_b; |
@@ -1538,9 +1535,9 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, | |||
1538 | cmd.diff_gain_a = data->delta_gain_code[0]; | 1535 | cmd.diff_gain_a = data->delta_gain_code[0]; |
1539 | cmd.diff_gain_b = data->delta_gain_code[1]; | 1536 | cmd.diff_gain_b = data->delta_gain_code[1]; |
1540 | cmd.diff_gain_c = data->delta_gain_code[2]; | 1537 | cmd.diff_gain_c = data->delta_gain_code[2]; |
1541 | rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 1538 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, |
1542 | sizeof(cmd), &cmd); | 1539 | sizeof(cmd), &cmd); |
1543 | if (rc) | 1540 | if (ret) |
1544 | IWL_DEBUG_CALIB("fail sending cmd " | 1541 | IWL_DEBUG_CALIB("fail sending cmd " |
1545 | "REPLY_PHY_CALIBRATION_CMD \n"); | 1542 | "REPLY_PHY_CALIBRATION_CMD \n"); |
1546 | 1543 | ||
@@ -1564,7 +1561,6 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv, | |||
1564 | static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, | 1561 | static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, |
1565 | struct iwl4965_notif_statistics *resp) | 1562 | struct iwl4965_notif_statistics *resp) |
1566 | { | 1563 | { |
1567 | int rc = 0; | ||
1568 | u32 rx_enable_time; | 1564 | u32 rx_enable_time; |
1569 | u32 fa_cck; | 1565 | u32 fa_cck; |
1570 | u32 fa_ofdm; | 1566 | u32 fa_ofdm; |
@@ -1577,6 +1573,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, | |||
1577 | struct statistics_rx *statistics = &(resp->rx); | 1573 | struct statistics_rx *statistics = &(resp->rx); |
1578 | unsigned long flags; | 1574 | unsigned long flags; |
1579 | struct statistics_general_data statis; | 1575 | struct statistics_general_data statis; |
1576 | int ret; | ||
1580 | 1577 | ||
1581 | data = &(priv->sensitivity_data); | 1578 | data = &(priv->sensitivity_data); |
1582 | 1579 | ||
@@ -1661,7 +1658,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, | |||
1661 | 1658 | ||
1662 | iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); | 1659 | iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); |
1663 | iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); | 1660 | iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); |
1664 | rc |= iwl4965_sensitivity_write(priv, CMD_ASYNC); | 1661 | ret = iwl4965_sensitivity_write(priv, CMD_ASYNC); |
1665 | 1662 | ||
1666 | return; | 1663 | return; |
1667 | } | 1664 | } |
@@ -1789,7 +1786,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1789 | u32 a; | 1786 | u32 a; |
1790 | int i = 0; | 1787 | int i = 0; |
1791 | unsigned long flags; | 1788 | unsigned long flags; |
1792 | int rc; | 1789 | int ret; |
1793 | 1790 | ||
1794 | spin_lock_irqsave(&priv->lock, flags); | 1791 | spin_lock_irqsave(&priv->lock, flags); |
1795 | 1792 | ||
@@ -1802,10 +1799,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1802 | priv->chain_noise_data.delta_gain_code[i] = | 1799 | priv->chain_noise_data.delta_gain_code[i] = |
1803 | CHAIN_NOISE_DELTA_GAIN_INIT_VAL; | 1800 | CHAIN_NOISE_DELTA_GAIN_INIT_VAL; |
1804 | #endif /* CONFIG_IWL4965_SENSITIVITY*/ | 1801 | #endif /* CONFIG_IWL4965_SENSITIVITY*/ |
1805 | rc = iwl4965_grab_nic_access(priv); | 1802 | ret = iwl4965_grab_nic_access(priv); |
1806 | if (rc) { | 1803 | if (ret) { |
1807 | spin_unlock_irqrestore(&priv->lock, flags); | 1804 | spin_unlock_irqrestore(&priv->lock, flags); |
1808 | return rc; | 1805 | return ret; |
1809 | } | 1806 | } |
1810 | 1807 | ||
1811 | /* Clear 4965's internal Tx Scheduler data base */ | 1808 | /* Clear 4965's internal Tx Scheduler data base */ |
@@ -1868,7 +1865,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1868 | iwl4965_release_nic_access(priv); | 1865 | iwl4965_release_nic_access(priv); |
1869 | spin_unlock_irqrestore(&priv->lock, flags); | 1866 | spin_unlock_irqrestore(&priv->lock, flags); |
1870 | 1867 | ||
1871 | return 0; | 1868 | return ret; |
1872 | } | 1869 | } |
1873 | 1870 | ||
1874 | /** | 1871 | /** |
@@ -2719,7 +2716,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel, | |||
2719 | int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) | 2716 | int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) |
2720 | { | 2717 | { |
2721 | struct iwl4965_txpowertable_cmd cmd = { 0 }; | 2718 | struct iwl4965_txpowertable_cmd cmd = { 0 }; |
2722 | int rc = 0; | 2719 | int ret; |
2723 | u8 band = 0; | 2720 | u8 band = 0; |
2724 | u8 is_fat = 0; | 2721 | u8 is_fat = 0; |
2725 | u8 ctrl_chan_high = 0; | 2722 | u8 ctrl_chan_high = 0; |
@@ -2743,14 +2740,16 @@ int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) | |||
2743 | cmd.band = band; | 2740 | cmd.band = band; |
2744 | cmd.channel = priv->active_rxon.channel; | 2741 | cmd.channel = priv->active_rxon.channel; |
2745 | 2742 | ||
2746 | rc = iwl4965_fill_txpower_tbl(priv, band, | 2743 | ret = iwl4965_fill_txpower_tbl(priv, band, |
2747 | le16_to_cpu(priv->active_rxon.channel), | 2744 | le16_to_cpu(priv->active_rxon.channel), |
2748 | is_fat, ctrl_chan_high, &cmd.tx_power); | 2745 | is_fat, ctrl_chan_high, &cmd.tx_power); |
2749 | if (rc) | 2746 | if (ret) |
2750 | return rc; | 2747 | goto out; |
2751 | 2748 | ||
2752 | rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); | 2749 | ret = iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); |
2753 | return rc; | 2750 | |
2751 | out: | ||
2752 | return ret; | ||
2754 | } | 2753 | } |
2755 | 2754 | ||
2756 | int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | 2755 | int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) |
@@ -2790,7 +2789,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | |||
2790 | return rc; | 2789 | return rc; |
2791 | } | 2790 | } |
2792 | 2791 | ||
2793 | rc = iwl4965_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); | 2792 | rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); |
2794 | return rc; | 2793 | return rc; |
2795 | } | 2794 | } |
2796 | 2795 | ||
@@ -2798,7 +2797,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) | |||
2798 | #define RTS_DFAULT_RETRY_LIMIT 60 | 2797 | #define RTS_DFAULT_RETRY_LIMIT 60 |
2799 | 2798 | ||
2800 | void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, | 2799 | void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, |
2801 | struct iwl4965_cmd *cmd, | 2800 | struct iwl_cmd *cmd, |
2802 | struct ieee80211_tx_control *ctrl, | 2801 | struct ieee80211_tx_control *ctrl, |
2803 | struct ieee80211_hdr *hdr, int sta_id, | 2802 | struct ieee80211_hdr *hdr, int sta_id, |
2804 | int is_hcca) | 2803 | int is_hcca) |
@@ -3863,7 +3862,7 @@ static inline void iwl4965_dbg_report_frame(struct iwl_priv *priv, | |||
3863 | 3862 | ||
3864 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | 3863 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) |
3865 | 3864 | ||
3866 | /* Called for REPLY_4965_RX (legacy ABG frames), or | 3865 | /* Called for REPLY_RX (legacy ABG frames), or |
3867 | * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ | 3866 | * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ |
3868 | static void iwl4965_rx_reply_rx(struct iwl_priv *priv, | 3867 | static void iwl4965_rx_reply_rx(struct iwl_priv *priv, |
3869 | struct iwl4965_rx_mem_buffer *rxb) | 3868 | struct iwl4965_rx_mem_buffer *rxb) |
@@ -3874,7 +3873,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, | |||
3874 | /* Use phy data (Rx signal strength, etc.) contained within | 3873 | /* Use phy data (Rx signal strength, etc.) contained within |
3875 | * this rx packet for legacy frames, | 3874 | * this rx packet for legacy frames, |
3876 | * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ | 3875 | * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ |
3877 | int include_phy = (pkt->hdr.cmd == REPLY_4965_RX); | 3876 | int include_phy = (pkt->hdr.cmd == REPLY_RX); |
3878 | struct iwl4965_rx_phy_res *rx_start = (include_phy) ? | 3877 | struct iwl4965_rx_phy_res *rx_start = (include_phy) ? |
3879 | (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : | 3878 | (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : |
3880 | (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; | 3879 | (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; |
@@ -4562,7 +4561,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
4562 | /* Update the rate scaling for control frame Tx to AP */ | 4561 | /* Update the rate scaling for control frame Tx to AP */ |
4563 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_setting.bcast_sta_id; | 4562 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_setting.bcast_sta_id; |
4564 | 4563 | ||
4565 | iwl4965_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), | 4564 | iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), |
4566 | &link_cmd); | 4565 | &link_cmd); |
4567 | } | 4566 | } |
4568 | 4567 | ||
@@ -4915,7 +4914,7 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
4915 | void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv) | 4914 | void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv) |
4916 | { | 4915 | { |
4917 | /* Legacy Rx frames */ | 4916 | /* Legacy Rx frames */ |
4918 | priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx; | 4917 | priv->rx_handlers[REPLY_RX] = iwl4965_rx_reply_rx; |
4919 | 4918 | ||
4920 | /* High-throughput (HT) Rx frames */ | 4919 | /* High-throughput (HT) Rx frames */ |
4921 | priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy; | 4920 | priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy; |
@@ -4948,6 +4947,10 @@ void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv) | |||
4948 | cancel_delayed_work(&priv->init_alive_start); | 4947 | cancel_delayed_work(&priv->init_alive_start); |
4949 | } | 4948 | } |
4950 | 4949 | ||
4950 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | ||
4951 | .enqueue_hcmd = iwl4965_enqueue_hcmd, | ||
4952 | }; | ||
4953 | |||
4951 | static struct iwl_lib_ops iwl4965_lib = { | 4954 | static struct iwl_lib_ops iwl4965_lib = { |
4952 | .init_drv = iwl4965_init_drv, | 4955 | .init_drv = iwl4965_init_drv, |
4953 | .eeprom_ops = { | 4956 | .eeprom_ops = { |
@@ -4959,6 +4962,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
4959 | 4962 | ||
4960 | static struct iwl_ops iwl4965_ops = { | 4963 | static struct iwl_ops iwl4965_ops = { |
4961 | .lib = &iwl4965_lib, | 4964 | .lib = &iwl4965_lib, |
4965 | .utils = &iwl4965_hcmd_utils, | ||
4962 | }; | 4966 | }; |
4963 | 4967 | ||
4964 | static struct iwl_cfg iwl4965_agn_cfg = { | 4968 | static struct iwl_cfg iwl4965_agn_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index b73c1544e909..810b8e28dc83 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -140,7 +140,7 @@ struct iwl4965_tx_info { | |||
140 | struct iwl4965_tx_queue { | 140 | struct iwl4965_tx_queue { |
141 | struct iwl4965_queue q; | 141 | struct iwl4965_queue q; |
142 | struct iwl4965_tfd_frame *bd; | 142 | struct iwl4965_tfd_frame *bd; |
143 | struct iwl4965_cmd *cmd; | 143 | struct iwl_cmd *cmd; |
144 | dma_addr_t dma_addr_cmd; | 144 | dma_addr_t dma_addr_cmd; |
145 | struct iwl4965_tx_info *txb; | 145 | struct iwl4965_tx_info *txb; |
146 | int need_update; | 146 | int need_update; |
@@ -312,15 +312,15 @@ enum { | |||
312 | CMD_WANT_SKB = (1 << 2), | 312 | CMD_WANT_SKB = (1 << 2), |
313 | }; | 313 | }; |
314 | 314 | ||
315 | struct iwl4965_cmd; | 315 | struct iwl_cmd; |
316 | struct iwl_priv; | 316 | struct iwl_priv; |
317 | 317 | ||
318 | struct iwl4965_cmd_meta { | 318 | struct iwl_cmd_meta { |
319 | struct iwl4965_cmd_meta *source; | 319 | struct iwl_cmd_meta *source; |
320 | union { | 320 | union { |
321 | struct sk_buff *skb; | 321 | struct sk_buff *skb; |
322 | int (*callback)(struct iwl_priv *priv, | 322 | int (*callback)(struct iwl_priv *priv, |
323 | struct iwl4965_cmd *cmd, struct sk_buff *skb); | 323 | struct iwl_cmd *cmd, struct sk_buff *skb); |
324 | } __attribute__ ((packed)) u; | 324 | } __attribute__ ((packed)) u; |
325 | 325 | ||
326 | /* The CMD_SIZE_HUGE flag bit indicates that the command | 326 | /* The CMD_SIZE_HUGE flag bit indicates that the command |
@@ -330,15 +330,15 @@ struct iwl4965_cmd_meta { | |||
330 | } __attribute__ ((packed)); | 330 | } __attribute__ ((packed)); |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * struct iwl4965_cmd | 333 | * struct iwl_cmd |
334 | * | 334 | * |
335 | * For allocation of the command and tx queues, this establishes the overall | 335 | * For allocation of the command and tx queues, this establishes the overall |
336 | * size of the largest command we send to uCode, except for a scan command | 336 | * size of the largest command we send to uCode, except for a scan command |
337 | * (which is relatively huge; space is allocated separately). | 337 | * (which is relatively huge; space is allocated separately). |
338 | */ | 338 | */ |
339 | struct iwl4965_cmd { | 339 | struct iwl_cmd { |
340 | struct iwl4965_cmd_meta meta; /* driver data */ | 340 | struct iwl_cmd_meta meta; /* driver data */ |
341 | struct iwl4965_cmd_header hdr; /* uCode API */ | 341 | struct iwl_cmd_header hdr; /* uCode API */ |
342 | union { | 342 | union { |
343 | struct iwl4965_addsta_cmd addsta; | 343 | struct iwl4965_addsta_cmd addsta; |
344 | struct iwl4965_led_cmd led; | 344 | struct iwl4965_led_cmd led; |
@@ -358,15 +358,15 @@ struct iwl4965_cmd { | |||
358 | } __attribute__ ((packed)) cmd; | 358 | } __attribute__ ((packed)) cmd; |
359 | } __attribute__ ((packed)); | 359 | } __attribute__ ((packed)); |
360 | 360 | ||
361 | struct iwl4965_host_cmd { | 361 | struct iwl_host_cmd { |
362 | u8 id; | 362 | u8 id; |
363 | u16 len; | 363 | u16 len; |
364 | struct iwl4965_cmd_meta meta; | 364 | struct iwl_cmd_meta meta; |
365 | const void *data; | 365 | const void *data; |
366 | }; | 366 | }; |
367 | 367 | ||
368 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \ | 368 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \ |
369 | sizeof(struct iwl4965_cmd_meta)) | 369 | sizeof(struct iwl_cmd_meta)) |
370 | 370 | ||
371 | /* | 371 | /* |
372 | * RX related structures and functions | 372 | * RX related structures and functions |
@@ -656,10 +656,6 @@ extern int iwl4965_tx_queue_init(struct iwl_priv *priv, | |||
656 | struct iwl4965_tx_queue *txq, int count, u32 id); | 656 | struct iwl4965_tx_queue *txq, int count, u32 id); |
657 | extern void iwl4965_rx_replenish(void *data); | 657 | extern void iwl4965_rx_replenish(void *data); |
658 | extern void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq); | 658 | extern void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq); |
659 | extern int iwl4965_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, | ||
660 | const void *data); | ||
661 | extern int __must_check iwl4965_send_cmd(struct iwl_priv *priv, | ||
662 | struct iwl4965_host_cmd *cmd); | ||
663 | extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, | 659 | extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, |
664 | struct ieee80211_hdr *hdr, | 660 | struct ieee80211_hdr *hdr, |
665 | const u8 *dest, int left); | 661 | const u8 *dest, int left); |
@@ -674,6 +670,7 @@ int iwl4965_init_geos(struct iwl_priv *priv); | |||
674 | void iwl4965_free_geos(struct iwl_priv *priv); | 670 | void iwl4965_free_geos(struct iwl_priv *priv); |
675 | 671 | ||
676 | extern const u8 iwl4965_broadcast_addr[ETH_ALEN]; | 672 | extern const u8 iwl4965_broadcast_addr[ETH_ALEN]; |
673 | int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | ||
677 | 674 | ||
678 | /* | 675 | /* |
679 | * Currently used by iwl-3945-rs... look at restructuring so that it doesn't | 676 | * Currently used by iwl-3945-rs... look at restructuring so that it doesn't |
@@ -718,7 +715,7 @@ extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | |||
718 | struct iwl4965_frame *frame, u8 rate); | 715 | struct iwl4965_frame *frame, u8 rate); |
719 | extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv); | 716 | extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv); |
720 | extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, | 717 | extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, |
721 | struct iwl4965_cmd *cmd, | 718 | struct iwl_cmd *cmd, |
722 | struct ieee80211_tx_control *ctrl, | 719 | struct ieee80211_tx_control *ctrl, |
723 | struct ieee80211_hdr *hdr, | 720 | struct ieee80211_hdr *hdr, |
724 | int sta_id, int tx_id); | 721 | int sta_id, int tx_id); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 4dde4d628a80..ce7f90ebf367 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -63,6 +63,13 @@ | |||
63 | #ifndef __iwl_core_h__ | 63 | #ifndef __iwl_core_h__ |
64 | #define __iwl_core_h__ | 64 | #define __iwl_core_h__ |
65 | 65 | ||
66 | /************************ | ||
67 | * forward declarations * | ||
68 | ************************/ | ||
69 | struct iwl_host_cmd; | ||
70 | struct iwl_cmd; | ||
71 | |||
72 | |||
66 | #define IWLWIFI_VERSION "1.2.26k" | 73 | #define IWLWIFI_VERSION "1.2.26k" |
67 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" | 74 | #define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation" |
68 | 75 | ||
@@ -75,6 +82,10 @@ | |||
75 | #define IWL_SKU_A 0x2 | 82 | #define IWL_SKU_A 0x2 |
76 | #define IWL_SKU_N 0x8 | 83 | #define IWL_SKU_N 0x8 |
77 | 84 | ||
85 | struct iwl_hcmd_utils_ops { | ||
86 | int (*enqueue_hcmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | ||
87 | }; | ||
88 | |||
78 | struct iwl_lib_ops { | 89 | struct iwl_lib_ops { |
79 | /* iwlwifi driver (priv) init */ | 90 | /* iwlwifi driver (priv) init */ |
80 | int (*init_drv)(struct iwl_priv *priv); | 91 | int (*init_drv)(struct iwl_priv *priv); |
@@ -84,6 +95,7 @@ struct iwl_lib_ops { | |||
84 | 95 | ||
85 | struct iwl_ops { | 96 | struct iwl_ops { |
86 | const struct iwl_lib_ops *lib; | 97 | const struct iwl_lib_ops *lib; |
98 | const struct iwl_hcmd_utils_ops *utils; | ||
87 | }; | 99 | }; |
88 | 100 | ||
89 | struct iwl_mod_params { | 101 | struct iwl_mod_params { |
@@ -120,4 +132,18 @@ int iwlcore_set_rxon_channel(struct iwl_priv *priv, | |||
120 | 132 | ||
121 | int iwl_setup(struct iwl_priv *priv); | 133 | int iwl_setup(struct iwl_priv *priv); |
122 | 134 | ||
135 | /***************************************************** | ||
136 | * S e n d i n g H o s t C o m m a n d s * | ||
137 | *****************************************************/ | ||
138 | |||
139 | const char *get_cmd_string(u8 cmd); | ||
140 | int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | ||
141 | int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); | ||
142 | int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data); | ||
143 | int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len, | ||
144 | const void *data, | ||
145 | int (*callback)(struct iwl_priv *priv, | ||
146 | struct iwl_cmd *cmd, | ||
147 | struct sk_buff *skb)); | ||
148 | |||
123 | #endif /* __iwl_core_h__ */ | 149 | #endif /* __iwl_core_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c new file mode 100644 index 000000000000..559ff739961e --- /dev/null +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -0,0 +1,251 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * GPL LICENSE SUMMARY | ||
4 | * | ||
5 | * Copyright(c) 2008 Intel Corporation. All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of version 2 of the GNU General Public License as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
19 | * USA | ||
20 | * | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * Contact Information: | ||
25 | * Tomas Winkler <tomas.winkler@intel.com> | ||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/version.h> | ||
32 | #include <net/mac80211.h> | ||
33 | |||
34 | #include "iwl-4965.h" /* FIXME: remove */ | ||
35 | #include "iwl-debug.h" | ||
36 | #include "iwl-eeprom.h" | ||
37 | #include "iwl-core.h" | ||
38 | |||
39 | |||
40 | #define IWL_CMD(x) case x : return #x | ||
41 | |||
42 | const char *get_cmd_string(u8 cmd) | ||
43 | { | ||
44 | switch (cmd) { | ||
45 | IWL_CMD(REPLY_ALIVE); | ||
46 | IWL_CMD(REPLY_ERROR); | ||
47 | IWL_CMD(REPLY_RXON); | ||
48 | IWL_CMD(REPLY_RXON_ASSOC); | ||
49 | IWL_CMD(REPLY_QOS_PARAM); | ||
50 | IWL_CMD(REPLY_RXON_TIMING); | ||
51 | IWL_CMD(REPLY_ADD_STA); | ||
52 | IWL_CMD(REPLY_REMOVE_STA); | ||
53 | IWL_CMD(REPLY_REMOVE_ALL_STA); | ||
54 | IWL_CMD(REPLY_TX); | ||
55 | IWL_CMD(REPLY_RATE_SCALE); | ||
56 | IWL_CMD(REPLY_LEDS_CMD); | ||
57 | IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); | ||
58 | IWL_CMD(RADAR_NOTIFICATION); | ||
59 | IWL_CMD(REPLY_QUIET_CMD); | ||
60 | IWL_CMD(REPLY_CHANNEL_SWITCH); | ||
61 | IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); | ||
62 | IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); | ||
63 | IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); | ||
64 | IWL_CMD(POWER_TABLE_CMD); | ||
65 | IWL_CMD(PM_SLEEP_NOTIFICATION); | ||
66 | IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); | ||
67 | IWL_CMD(REPLY_SCAN_CMD); | ||
68 | IWL_CMD(REPLY_SCAN_ABORT_CMD); | ||
69 | IWL_CMD(SCAN_START_NOTIFICATION); | ||
70 | IWL_CMD(SCAN_RESULTS_NOTIFICATION); | ||
71 | IWL_CMD(SCAN_COMPLETE_NOTIFICATION); | ||
72 | IWL_CMD(BEACON_NOTIFICATION); | ||
73 | IWL_CMD(REPLY_TX_BEACON); | ||
74 | IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); | ||
75 | IWL_CMD(QUIET_NOTIFICATION); | ||
76 | IWL_CMD(REPLY_TX_PWR_TABLE_CMD); | ||
77 | IWL_CMD(MEASURE_ABORT_NOTIFICATION); | ||
78 | IWL_CMD(REPLY_BT_CONFIG); | ||
79 | IWL_CMD(REPLY_STATISTICS_CMD); | ||
80 | IWL_CMD(STATISTICS_NOTIFICATION); | ||
81 | IWL_CMD(REPLY_CARD_STATE_CMD); | ||
82 | IWL_CMD(CARD_STATE_NOTIFICATION); | ||
83 | IWL_CMD(MISSED_BEACONS_NOTIFICATION); | ||
84 | IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); | ||
85 | IWL_CMD(SENSITIVITY_CMD); | ||
86 | IWL_CMD(REPLY_PHY_CALIBRATION_CMD); | ||
87 | IWL_CMD(REPLY_RX_PHY_CMD); | ||
88 | IWL_CMD(REPLY_RX_MPDU_CMD); | ||
89 | IWL_CMD(REPLY_RX); | ||
90 | IWL_CMD(REPLY_COMPRESSED_BA); | ||
91 | default: | ||
92 | return "UNKNOWN"; | ||
93 | |||
94 | } | ||
95 | } | ||
96 | EXPORT_SYMBOL(get_cmd_string); | ||
97 | |||
98 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) | ||
99 | |||
100 | static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | ||
101 | { | ||
102 | int ret; | ||
103 | |||
104 | BUG_ON(!(cmd->meta.flags & CMD_ASYNC)); | ||
105 | |||
106 | /* An asynchronous command can not expect an SKB to be set. */ | ||
107 | BUG_ON(cmd->meta.flags & CMD_WANT_SKB); | ||
108 | |||
109 | /* An asynchronous command MUST have a callback. */ | ||
110 | BUG_ON(!cmd->meta.u.callback); | ||
111 | |||
112 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
113 | return -EBUSY; | ||
114 | |||
115 | ret = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd); | ||
116 | if (ret < 0) { | ||
117 | IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n", | ||
118 | get_cmd_string(cmd->id), ret); | ||
119 | return ret; | ||
120 | } | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | ||
125 | { | ||
126 | int cmd_idx; | ||
127 | int ret; | ||
128 | static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */ | ||
129 | |||
130 | BUG_ON(cmd->meta.flags & CMD_ASYNC); | ||
131 | |||
132 | /* A synchronous command can not have a callback set. */ | ||
133 | BUG_ON(cmd->meta.u.callback != NULL); | ||
134 | |||
135 | if (atomic_xchg(&entry, 1)) { | ||
136 | IWL_ERROR("Error sending %s: Already sending a host command\n", | ||
137 | get_cmd_string(cmd->id)); | ||
138 | return -EBUSY; | ||
139 | } | ||
140 | |||
141 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
142 | |||
143 | if (cmd->meta.flags & CMD_WANT_SKB) | ||
144 | cmd->meta.source = &cmd->meta; | ||
145 | |||
146 | cmd_idx = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd); | ||
147 | if (cmd_idx < 0) { | ||
148 | ret = cmd_idx; | ||
149 | IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n", | ||
150 | get_cmd_string(cmd->id), ret); | ||
151 | goto out; | ||
152 | } | ||
153 | |||
154 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | ||
155 | !test_bit(STATUS_HCMD_ACTIVE, &priv->status), | ||
156 | HOST_COMPLETE_TIMEOUT); | ||
157 | if (!ret) { | ||
158 | if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { | ||
159 | IWL_ERROR("Error sending %s: time out after %dms.\n", | ||
160 | get_cmd_string(cmd->id), | ||
161 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | ||
162 | |||
163 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
164 | ret = -ETIMEDOUT; | ||
165 | goto cancel; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | ||
170 | IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n", | ||
171 | get_cmd_string(cmd->id)); | ||
172 | ret = -ECANCELED; | ||
173 | goto fail; | ||
174 | } | ||
175 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { | ||
176 | IWL_DEBUG_INFO("Command %s failed: FW Error\n", | ||
177 | get_cmd_string(cmd->id)); | ||
178 | ret = -EIO; | ||
179 | goto fail; | ||
180 | } | ||
181 | if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) { | ||
182 | IWL_ERROR("Error: Response NULL in '%s'\n", | ||
183 | get_cmd_string(cmd->id)); | ||
184 | ret = -EIO; | ||
185 | goto out; | ||
186 | } | ||
187 | |||
188 | ret = 0; | ||
189 | goto out; | ||
190 | |||
191 | cancel: | ||
192 | if (cmd->meta.flags & CMD_WANT_SKB) { | ||
193 | struct iwl_cmd *qcmd; | ||
194 | |||
195 | /* Cancel the CMD_WANT_SKB flag for the cmd in the | ||
196 | * TX cmd queue. Otherwise in case the cmd comes | ||
197 | * in later, it will possibly set an invalid | ||
198 | * address (cmd->meta.source). */ | ||
199 | qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; | ||
200 | qcmd->meta.flags &= ~CMD_WANT_SKB; | ||
201 | } | ||
202 | fail: | ||
203 | if (cmd->meta.u.skb) { | ||
204 | dev_kfree_skb_any(cmd->meta.u.skb); | ||
205 | cmd->meta.u.skb = NULL; | ||
206 | } | ||
207 | out: | ||
208 | atomic_set(&entry, 0); | ||
209 | return ret; | ||
210 | } | ||
211 | EXPORT_SYMBOL(iwl_send_cmd_sync); | ||
212 | |||
213 | int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | ||
214 | { | ||
215 | if (cmd->meta.flags & CMD_ASYNC) | ||
216 | return iwl_send_cmd_async(priv, cmd); | ||
217 | |||
218 | return iwl_send_cmd_sync(priv, cmd); | ||
219 | } | ||
220 | EXPORT_SYMBOL(iwl_send_cmd); | ||
221 | |||
222 | int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) | ||
223 | { | ||
224 | struct iwl_host_cmd cmd = { | ||
225 | .id = id, | ||
226 | .len = len, | ||
227 | .data = data, | ||
228 | }; | ||
229 | |||
230 | return iwl_send_cmd_sync(priv, &cmd); | ||
231 | } | ||
232 | EXPORT_SYMBOL(iwl_send_cmd_pdu); | ||
233 | |||
234 | int iwl_send_cmd_pdu_async(struct iwl_priv *priv, | ||
235 | u8 id, u16 len, const void *data, | ||
236 | int (*callback)(struct iwl_priv *priv, | ||
237 | struct iwl_cmd *cmd, | ||
238 | struct sk_buff *skb)) | ||
239 | { | ||
240 | struct iwl_host_cmd cmd = { | ||
241 | .id = id, | ||
242 | .len = len, | ||
243 | .data = data, | ||
244 | }; | ||
245 | |||
246 | cmd.meta.flags |= CMD_ASYNC; | ||
247 | cmd.meta.u.callback = callback; | ||
248 | |||
249 | return iwl_send_cmd_async(priv, &cmd); | ||
250 | } | ||
251 | EXPORT_SYMBOL(iwl_send_cmd_pdu_async); | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index fac9bf1aa1d7..8fe09e893279 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -305,7 +305,7 @@ int iwl4965_tx_queue_init(struct iwl_priv *priv, | |||
305 | * For normal Tx queues (all other queues), no super-size command | 305 | * For normal Tx queues (all other queues), no super-size command |
306 | * space is needed. | 306 | * space is needed. |
307 | */ | 307 | */ |
308 | len = sizeof(struct iwl4965_cmd) * slots_num; | 308 | len = sizeof(struct iwl_cmd) * slots_num; |
309 | if (txq_id == IWL_CMD_QUEUE_NUM) | 309 | if (txq_id == IWL_CMD_QUEUE_NUM) |
310 | len += IWL_MAX_SCAN_SIZE; | 310 | len += IWL_MAX_SCAN_SIZE; |
311 | txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); | 311 | txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); |
@@ -356,7 +356,7 @@ void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq) | |||
356 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) | 356 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) |
357 | iwl4965_hw_txq_free_tfd(priv, txq); | 357 | iwl4965_hw_txq_free_tfd(priv, txq); |
358 | 358 | ||
359 | len = sizeof(struct iwl4965_cmd) * q->n_window; | 359 | len = sizeof(struct iwl_cmd) * q->n_window; |
360 | if (q->id == IWL_CMD_QUEUE_NUM) | 360 | if (q->id == IWL_CMD_QUEUE_NUM) |
361 | len += IWL_MAX_SCAN_SIZE; | 361 | len += IWL_MAX_SCAN_SIZE; |
362 | 362 | ||
@@ -541,65 +541,6 @@ static inline int iwl4965_is_ready_rf(struct iwl_priv *priv) | |||
541 | 541 | ||
542 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ | 542 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ |
543 | 543 | ||
544 | #define IWL_CMD(x) case x : return #x | ||
545 | |||
546 | static const char *get_cmd_string(u8 cmd) | ||
547 | { | ||
548 | switch (cmd) { | ||
549 | IWL_CMD(REPLY_ALIVE); | ||
550 | IWL_CMD(REPLY_ERROR); | ||
551 | IWL_CMD(REPLY_RXON); | ||
552 | IWL_CMD(REPLY_RXON_ASSOC); | ||
553 | IWL_CMD(REPLY_QOS_PARAM); | ||
554 | IWL_CMD(REPLY_RXON_TIMING); | ||
555 | IWL_CMD(REPLY_ADD_STA); | ||
556 | IWL_CMD(REPLY_REMOVE_STA); | ||
557 | IWL_CMD(REPLY_REMOVE_ALL_STA); | ||
558 | IWL_CMD(REPLY_TX); | ||
559 | IWL_CMD(REPLY_RATE_SCALE); | ||
560 | IWL_CMD(REPLY_LEDS_CMD); | ||
561 | IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); | ||
562 | IWL_CMD(RADAR_NOTIFICATION); | ||
563 | IWL_CMD(REPLY_QUIET_CMD); | ||
564 | IWL_CMD(REPLY_CHANNEL_SWITCH); | ||
565 | IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); | ||
566 | IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); | ||
567 | IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); | ||
568 | IWL_CMD(POWER_TABLE_CMD); | ||
569 | IWL_CMD(PM_SLEEP_NOTIFICATION); | ||
570 | IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); | ||
571 | IWL_CMD(REPLY_SCAN_CMD); | ||
572 | IWL_CMD(REPLY_SCAN_ABORT_CMD); | ||
573 | IWL_CMD(SCAN_START_NOTIFICATION); | ||
574 | IWL_CMD(SCAN_RESULTS_NOTIFICATION); | ||
575 | IWL_CMD(SCAN_COMPLETE_NOTIFICATION); | ||
576 | IWL_CMD(BEACON_NOTIFICATION); | ||
577 | IWL_CMD(REPLY_TX_BEACON); | ||
578 | IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); | ||
579 | IWL_CMD(QUIET_NOTIFICATION); | ||
580 | IWL_CMD(REPLY_TX_PWR_TABLE_CMD); | ||
581 | IWL_CMD(MEASURE_ABORT_NOTIFICATION); | ||
582 | IWL_CMD(REPLY_BT_CONFIG); | ||
583 | IWL_CMD(REPLY_STATISTICS_CMD); | ||
584 | IWL_CMD(STATISTICS_NOTIFICATION); | ||
585 | IWL_CMD(REPLY_CARD_STATE_CMD); | ||
586 | IWL_CMD(CARD_STATE_NOTIFICATION); | ||
587 | IWL_CMD(MISSED_BEACONS_NOTIFICATION); | ||
588 | IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); | ||
589 | IWL_CMD(SENSITIVITY_CMD); | ||
590 | IWL_CMD(REPLY_PHY_CALIBRATION_CMD); | ||
591 | IWL_CMD(REPLY_RX_PHY_CMD); | ||
592 | IWL_CMD(REPLY_RX_MPDU_CMD); | ||
593 | IWL_CMD(REPLY_4965_RX); | ||
594 | IWL_CMD(REPLY_COMPRESSED_BA); | ||
595 | default: | ||
596 | return "UNKNOWN"; | ||
597 | |||
598 | } | ||
599 | } | ||
600 | |||
601 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) | ||
602 | |||
603 | /** | 544 | /** |
604 | * iwl4965_enqueue_hcmd - enqueue a uCode command | 545 | * iwl4965_enqueue_hcmd - enqueue a uCode command |
605 | * @priv: device private data point | 546 | * @priv: device private data point |
@@ -609,13 +550,13 @@ static const char *get_cmd_string(u8 cmd) | |||
609 | * failed. On success, it turns the index (> 0) of command in the | 550 | * failed. On success, it turns the index (> 0) of command in the |
610 | * command queue. | 551 | * command queue. |
611 | */ | 552 | */ |
612 | static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd) | 553 | int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) |
613 | { | 554 | { |
614 | struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 555 | struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; |
615 | struct iwl4965_queue *q = &txq->q; | 556 | struct iwl4965_queue *q = &txq->q; |
616 | struct iwl4965_tfd_frame *tfd; | 557 | struct iwl4965_tfd_frame *tfd; |
617 | u32 *control_flags; | 558 | u32 *control_flags; |
618 | struct iwl4965_cmd *out_cmd; | 559 | struct iwl_cmd *out_cmd; |
619 | u32 idx; | 560 | u32 idx; |
620 | u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | 561 | u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); |
621 | dma_addr_t phys_addr; | 562 | dma_addr_t phys_addr; |
@@ -662,7 +603,7 @@ static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd * | |||
662 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); | 603 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); |
663 | 604 | ||
664 | phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + | 605 | phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + |
665 | offsetof(struct iwl4965_cmd, hdr); | 606 | offsetof(struct iwl_cmd, hdr); |
666 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); | 607 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); |
667 | 608 | ||
668 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " | 609 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " |
@@ -684,118 +625,6 @@ static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd * | |||
684 | return ret ? ret : idx; | 625 | return ret ? ret : idx; |
685 | } | 626 | } |
686 | 627 | ||
687 | static int iwl4965_send_cmd_async(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd) | ||
688 | { | ||
689 | int ret; | ||
690 | |||
691 | BUG_ON(!(cmd->meta.flags & CMD_ASYNC)); | ||
692 | |||
693 | /* An asynchronous command can not expect an SKB to be set. */ | ||
694 | BUG_ON(cmd->meta.flags & CMD_WANT_SKB); | ||
695 | |||
696 | /* An asynchronous command MUST have a callback. */ | ||
697 | BUG_ON(!cmd->meta.u.callback); | ||
698 | |||
699 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
700 | return -EBUSY; | ||
701 | |||
702 | ret = iwl4965_enqueue_hcmd(priv, cmd); | ||
703 | if (ret < 0) { | ||
704 | IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", | ||
705 | get_cmd_string(cmd->id), ret); | ||
706 | return ret; | ||
707 | } | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | static int iwl4965_send_cmd_sync(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd) | ||
712 | { | ||
713 | int cmd_idx; | ||
714 | int ret; | ||
715 | static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */ | ||
716 | |||
717 | BUG_ON(cmd->meta.flags & CMD_ASYNC); | ||
718 | |||
719 | /* A synchronous command can not have a callback set. */ | ||
720 | BUG_ON(cmd->meta.u.callback != NULL); | ||
721 | |||
722 | if (atomic_xchg(&entry, 1)) { | ||
723 | IWL_ERROR("Error sending %s: Already sending a host command\n", | ||
724 | get_cmd_string(cmd->id)); | ||
725 | return -EBUSY; | ||
726 | } | ||
727 | |||
728 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
729 | |||
730 | if (cmd->meta.flags & CMD_WANT_SKB) | ||
731 | cmd->meta.source = &cmd->meta; | ||
732 | |||
733 | cmd_idx = iwl4965_enqueue_hcmd(priv, cmd); | ||
734 | if (cmd_idx < 0) { | ||
735 | ret = cmd_idx; | ||
736 | IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", | ||
737 | get_cmd_string(cmd->id), ret); | ||
738 | goto out; | ||
739 | } | ||
740 | |||
741 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | ||
742 | !test_bit(STATUS_HCMD_ACTIVE, &priv->status), | ||
743 | HOST_COMPLETE_TIMEOUT); | ||
744 | if (!ret) { | ||
745 | if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { | ||
746 | IWL_ERROR("Error sending %s: time out after %dms.\n", | ||
747 | get_cmd_string(cmd->id), | ||
748 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | ||
749 | |||
750 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
751 | ret = -ETIMEDOUT; | ||
752 | goto cancel; | ||
753 | } | ||
754 | } | ||
755 | |||
756 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | ||
757 | IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n", | ||
758 | get_cmd_string(cmd->id)); | ||
759 | ret = -ECANCELED; | ||
760 | goto fail; | ||
761 | } | ||
762 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { | ||
763 | IWL_DEBUG_INFO("Command %s failed: FW Error\n", | ||
764 | get_cmd_string(cmd->id)); | ||
765 | ret = -EIO; | ||
766 | goto fail; | ||
767 | } | ||
768 | if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) { | ||
769 | IWL_ERROR("Error: Response NULL in '%s'\n", | ||
770 | get_cmd_string(cmd->id)); | ||
771 | ret = -EIO; | ||
772 | goto out; | ||
773 | } | ||
774 | |||
775 | ret = 0; | ||
776 | goto out; | ||
777 | |||
778 | cancel: | ||
779 | if (cmd->meta.flags & CMD_WANT_SKB) { | ||
780 | struct iwl4965_cmd *qcmd; | ||
781 | |||
782 | /* Cancel the CMD_WANT_SKB flag for the cmd in the | ||
783 | * TX cmd queue. Otherwise in case the cmd comes | ||
784 | * in later, it will possibly set an invalid | ||
785 | * address (cmd->meta.source). */ | ||
786 | qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; | ||
787 | qcmd->meta.flags &= ~CMD_WANT_SKB; | ||
788 | } | ||
789 | fail: | ||
790 | if (cmd->meta.u.skb) { | ||
791 | dev_kfree_skb_any(cmd->meta.u.skb); | ||
792 | cmd->meta.u.skb = NULL; | ||
793 | } | ||
794 | out: | ||
795 | atomic_set(&entry, 0); | ||
796 | return ret; | ||
797 | } | ||
798 | |||
799 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | 628 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) |
800 | { | 629 | { |
801 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | 630 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; |
@@ -807,39 +636,11 @@ static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) | |||
807 | 636 | ||
808 | } | 637 | } |
809 | 638 | ||
810 | int iwl4965_send_cmd(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd) | ||
811 | { | ||
812 | if (cmd->meta.flags & CMD_ASYNC) | ||
813 | return iwl4965_send_cmd_async(priv, cmd); | ||
814 | |||
815 | return iwl4965_send_cmd_sync(priv, cmd); | ||
816 | } | ||
817 | |||
818 | int iwl4965_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data) | ||
819 | { | ||
820 | struct iwl4965_host_cmd cmd = { | ||
821 | .id = id, | ||
822 | .len = len, | ||
823 | .data = data, | ||
824 | }; | ||
825 | |||
826 | return iwl4965_send_cmd_sync(priv, &cmd); | ||
827 | } | ||
828 | |||
829 | static int __must_check iwl4965_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val) | ||
830 | { | ||
831 | struct iwl4965_host_cmd cmd = { | ||
832 | .id = id, | ||
833 | .len = sizeof(val), | ||
834 | .data = &val, | ||
835 | }; | ||
836 | |||
837 | return iwl4965_send_cmd_sync(priv, &cmd); | ||
838 | } | ||
839 | |||
840 | int iwl4965_send_statistics_request(struct iwl_priv *priv) | 639 | int iwl4965_send_statistics_request(struct iwl_priv *priv) |
841 | { | 640 | { |
842 | return iwl4965_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); | 641 | u32 flags = 0; |
642 | return iwl_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, | ||
643 | sizeof(flags), &flags); | ||
843 | } | 644 | } |
844 | 645 | ||
845 | /** | 646 | /** |
@@ -1000,7 +801,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1000 | int rc = 0; | 801 | int rc = 0; |
1001 | struct iwl4965_rx_packet *res = NULL; | 802 | struct iwl4965_rx_packet *res = NULL; |
1002 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | 803 | struct iwl4965_rxon_assoc_cmd rxon_assoc; |
1003 | struct iwl4965_host_cmd cmd = { | 804 | struct iwl_host_cmd cmd = { |
1004 | .id = REPLY_RXON_ASSOC, | 805 | .id = REPLY_RXON_ASSOC, |
1005 | .len = sizeof(rxon_assoc), | 806 | .len = sizeof(rxon_assoc), |
1006 | .meta.flags = CMD_WANT_SKB, | 807 | .meta.flags = CMD_WANT_SKB, |
@@ -1033,7 +834,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) | |||
1033 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; | 834 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; |
1034 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; | 835 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; |
1035 | 836 | ||
1036 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 837 | rc = iwl_send_cmd_sync(priv, &cmd); |
1037 | if (rc) | 838 | if (rc) |
1038 | return rc; | 839 | return rc; |
1039 | 840 | ||
@@ -1112,7 +913,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
1112 | IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); | 913 | IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); |
1113 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 914 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1114 | 915 | ||
1115 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, | 916 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1116 | sizeof(struct iwl4965_rxon_cmd), | 917 | sizeof(struct iwl4965_rxon_cmd), |
1117 | &priv->active_rxon); | 918 | &priv->active_rxon); |
1118 | 919 | ||
@@ -1137,7 +938,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv) | |||
1137 | 938 | ||
1138 | iwl4965_set_rxon_hwcrypto(priv, priv->cfg->mod_params->hw_crypto); | 939 | iwl4965_set_rxon_hwcrypto(priv, priv->cfg->mod_params->hw_crypto); |
1139 | /* Apply the new configuration */ | 940 | /* Apply the new configuration */ |
1140 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, | 941 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1141 | sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); | 942 | sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); |
1142 | if (rc) { | 943 | if (rc) { |
1143 | IWL_ERROR("Error setting new configuration (%d).\n", rc); | 944 | IWL_ERROR("Error setting new configuration (%d).\n", rc); |
@@ -1196,7 +997,7 @@ static int iwl4965_send_bt_config(struct iwl_priv *priv) | |||
1196 | .kill_cts_mask = 0, | 997 | .kill_cts_mask = 0, |
1197 | }; | 998 | }; |
1198 | 999 | ||
1199 | return iwl4965_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 1000 | return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
1200 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); | 1001 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); |
1201 | } | 1002 | } |
1202 | 1003 | ||
@@ -1204,7 +1005,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv) | |||
1204 | { | 1005 | { |
1205 | int rc = 0; | 1006 | int rc = 0; |
1206 | struct iwl4965_rx_packet *res; | 1007 | struct iwl4965_rx_packet *res; |
1207 | struct iwl4965_host_cmd cmd = { | 1008 | struct iwl_host_cmd cmd = { |
1208 | .id = REPLY_SCAN_ABORT_CMD, | 1009 | .id = REPLY_SCAN_ABORT_CMD, |
1209 | .meta.flags = CMD_WANT_SKB, | 1010 | .meta.flags = CMD_WANT_SKB, |
1210 | }; | 1011 | }; |
@@ -1217,7 +1018,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv) | |||
1217 | return 0; | 1018 | return 0; |
1218 | } | 1019 | } |
1219 | 1020 | ||
1220 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 1021 | rc = iwl_send_cmd_sync(priv, &cmd); |
1221 | if (rc) { | 1022 | if (rc) { |
1222 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | 1023 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); |
1223 | return rc; | 1024 | return rc; |
@@ -1242,7 +1043,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv) | |||
1242 | } | 1043 | } |
1243 | 1044 | ||
1244 | static int iwl4965_card_state_sync_callback(struct iwl_priv *priv, | 1045 | static int iwl4965_card_state_sync_callback(struct iwl_priv *priv, |
1245 | struct iwl4965_cmd *cmd, | 1046 | struct iwl_cmd *cmd, |
1246 | struct sk_buff *skb) | 1047 | struct sk_buff *skb) |
1247 | { | 1048 | { |
1248 | return 1; | 1049 | return 1; |
@@ -1260,7 +1061,7 @@ static int iwl4965_card_state_sync_callback(struct iwl_priv *priv, | |||
1260 | */ | 1061 | */ |
1261 | static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) | 1062 | static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) |
1262 | { | 1063 | { |
1263 | struct iwl4965_host_cmd cmd = { | 1064 | struct iwl_host_cmd cmd = { |
1264 | .id = REPLY_CARD_STATE_CMD, | 1065 | .id = REPLY_CARD_STATE_CMD, |
1265 | .len = sizeof(u32), | 1066 | .len = sizeof(u32), |
1266 | .data = &flags, | 1067 | .data = &flags, |
@@ -1270,11 +1071,11 @@ static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_fla | |||
1270 | if (meta_flag & CMD_ASYNC) | 1071 | if (meta_flag & CMD_ASYNC) |
1271 | cmd.meta.u.callback = iwl4965_card_state_sync_callback; | 1072 | cmd.meta.u.callback = iwl4965_card_state_sync_callback; |
1272 | 1073 | ||
1273 | return iwl4965_send_cmd(priv, &cmd); | 1074 | return iwl_send_cmd(priv, &cmd); |
1274 | } | 1075 | } |
1275 | 1076 | ||
1276 | static int iwl4965_add_sta_sync_callback(struct iwl_priv *priv, | 1077 | static int iwl4965_add_sta_sync_callback(struct iwl_priv *priv, |
1277 | struct iwl4965_cmd *cmd, struct sk_buff *skb) | 1078 | struct iwl_cmd *cmd, struct sk_buff *skb) |
1278 | { | 1079 | { |
1279 | struct iwl4965_rx_packet *res = NULL; | 1080 | struct iwl4965_rx_packet *res = NULL; |
1280 | 1081 | ||
@@ -1306,7 +1107,7 @@ int iwl4965_send_add_station(struct iwl_priv *priv, | |||
1306 | { | 1107 | { |
1307 | struct iwl4965_rx_packet *res = NULL; | 1108 | struct iwl4965_rx_packet *res = NULL; |
1308 | int rc = 0; | 1109 | int rc = 0; |
1309 | struct iwl4965_host_cmd cmd = { | 1110 | struct iwl_host_cmd cmd = { |
1310 | .id = REPLY_ADD_STA, | 1111 | .id = REPLY_ADD_STA, |
1311 | .len = sizeof(struct iwl4965_addsta_cmd), | 1112 | .len = sizeof(struct iwl4965_addsta_cmd), |
1312 | .meta.flags = flags, | 1113 | .meta.flags = flags, |
@@ -1318,7 +1119,7 @@ int iwl4965_send_add_station(struct iwl_priv *priv, | |||
1318 | else | 1119 | else |
1319 | cmd.meta.flags |= CMD_WANT_SKB; | 1120 | cmd.meta.flags |= CMD_WANT_SKB; |
1320 | 1121 | ||
1321 | rc = iwl4965_send_cmd(priv, &cmd); | 1122 | rc = iwl_send_cmd(priv, &cmd); |
1322 | 1123 | ||
1323 | if (rc || (flags & CMD_ASYNC)) | 1124 | if (rc || (flags & CMD_ASYNC)) |
1324 | return rc; | 1125 | return rc; |
@@ -1579,7 +1380,7 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | |||
1579 | 1380 | ||
1580 | frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); | 1381 | frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); |
1581 | 1382 | ||
1582 | rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, | 1383 | rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, |
1583 | &frame->u.cmd[0]); | 1384 | &frame->u.cmd[0]); |
1584 | 1385 | ||
1585 | iwl4965_free_frame(priv, frame); | 1386 | iwl4965_free_frame(priv, frame); |
@@ -1756,7 +1557,7 @@ static int iwl4965_send_qos_params_command(struct iwl_priv *priv, | |||
1756 | struct iwl4965_qosparam_cmd *qos) | 1557 | struct iwl4965_qosparam_cmd *qos) |
1757 | { | 1558 | { |
1758 | 1559 | ||
1759 | return iwl4965_send_cmd_pdu(priv, REPLY_QOS_PARAM, | 1560 | return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, |
1760 | sizeof(struct iwl4965_qosparam_cmd), qos); | 1561 | sizeof(struct iwl4965_qosparam_cmd), qos); |
1761 | } | 1562 | } |
1762 | 1563 | ||
@@ -1966,7 +1767,7 @@ static int iwl4965_send_power_mode(struct iwl_priv *priv, u32 mode) | |||
1966 | 1767 | ||
1967 | iwl4965_update_power_cmd(priv, &cmd, final_mode); | 1768 | iwl4965_update_power_cmd(priv, &cmd, final_mode); |
1968 | 1769 | ||
1969 | rc = iwl4965_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); | 1770 | rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); |
1970 | 1771 | ||
1971 | if (final_mode == IWL_POWER_MODE_CAM) | 1772 | if (final_mode == IWL_POWER_MODE_CAM) |
1972 | clear_bit(STATUS_POWER_PMI, &priv->status); | 1773 | clear_bit(STATUS_POWER_PMI, &priv->status); |
@@ -2345,7 +2146,7 @@ static int iwl4965_set_mode(struct iwl_priv *priv, int mode) | |||
2345 | 2146 | ||
2346 | static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 2147 | static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
2347 | struct ieee80211_tx_control *ctl, | 2148 | struct ieee80211_tx_control *ctl, |
2348 | struct iwl4965_cmd *cmd, | 2149 | struct iwl_cmd *cmd, |
2349 | struct sk_buff *skb_frag, | 2150 | struct sk_buff *skb_frag, |
2350 | int sta_id) | 2151 | int sta_id) |
2351 | { | 2152 | { |
@@ -2390,7 +2191,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | |||
2390 | * handle build REPLY_TX command notification. | 2191 | * handle build REPLY_TX command notification. |
2391 | */ | 2192 | */ |
2392 | static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv, | 2193 | static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv, |
2393 | struct iwl4965_cmd *cmd, | 2194 | struct iwl_cmd *cmd, |
2394 | struct ieee80211_tx_control *ctrl, | 2195 | struct ieee80211_tx_control *ctrl, |
2395 | struct ieee80211_hdr *hdr, | 2196 | struct ieee80211_hdr *hdr, |
2396 | int is_unicast, u8 std_id) | 2197 | int is_unicast, u8 std_id) |
@@ -2531,7 +2332,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv, | |||
2531 | dma_addr_t phys_addr; | 2332 | dma_addr_t phys_addr; |
2532 | dma_addr_t txcmd_phys; | 2333 | dma_addr_t txcmd_phys; |
2533 | dma_addr_t scratch_phys; | 2334 | dma_addr_t scratch_phys; |
2534 | struct iwl4965_cmd *out_cmd = NULL; | 2335 | struct iwl_cmd *out_cmd = NULL; |
2535 | u16 len, idx, len_org; | 2336 | u16 len, idx, len_org; |
2536 | u8 id, hdr_len, unicast; | 2337 | u8 id, hdr_len, unicast; |
2537 | u8 sta_id; | 2338 | u8 sta_id; |
@@ -2660,7 +2461,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv, | |||
2660 | * We'll tell device about this padding later. | 2461 | * We'll tell device about this padding later. |
2661 | */ | 2462 | */ |
2662 | len = priv->hw_setting.tx_cmd_len + | 2463 | len = priv->hw_setting.tx_cmd_len + |
2663 | sizeof(struct iwl4965_cmd_header) + hdr_len; | 2464 | sizeof(struct iwl_cmd_header) + hdr_len; |
2664 | 2465 | ||
2665 | len_org = len; | 2466 | len_org = len; |
2666 | len = (len + 3) & ~3; | 2467 | len = (len + 3) & ~3; |
@@ -2672,8 +2473,8 @@ static int iwl4965_tx_skb(struct iwl_priv *priv, | |||
2672 | 2473 | ||
2673 | /* Physical address of this Tx command's header (not MAC header!), | 2474 | /* Physical address of this Tx command's header (not MAC header!), |
2674 | * within command buffer array. */ | 2475 | * within command buffer array. */ |
2675 | txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx + | 2476 | txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + |
2676 | offsetof(struct iwl4965_cmd, hdr); | 2477 | offsetof(struct iwl_cmd, hdr); |
2677 | 2478 | ||
2678 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 2479 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
2679 | * first entry */ | 2480 | * first entry */ |
@@ -2707,7 +2508,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv, | |||
2707 | 2508 | ||
2708 | iwl_update_tx_stats(priv, fc, len); | 2509 | iwl_update_tx_stats(priv, fc, len); |
2709 | 2510 | ||
2710 | scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + | 2511 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + |
2711 | offsetof(struct iwl4965_tx_cmd, scratch); | 2512 | offsetof(struct iwl4965_tx_cmd, scratch); |
2712 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); | 2513 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); |
2713 | out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); | 2514 | out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); |
@@ -3020,7 +2821,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv, | |||
3020 | { | 2821 | { |
3021 | struct iwl4965_spectrum_cmd spectrum; | 2822 | struct iwl4965_spectrum_cmd spectrum; |
3022 | struct iwl4965_rx_packet *res; | 2823 | struct iwl4965_rx_packet *res; |
3023 | struct iwl4965_host_cmd cmd = { | 2824 | struct iwl_host_cmd cmd = { |
3024 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, | 2825 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, |
3025 | .data = (void *)&spectrum, | 2826 | .data = (void *)&spectrum, |
3026 | .meta.flags = CMD_WANT_SKB, | 2827 | .meta.flags = CMD_WANT_SKB, |
@@ -3060,7 +2861,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv, | |||
3060 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | 2861 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | |
3061 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | 2862 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; |
3062 | 2863 | ||
3063 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 2864 | rc = iwl_send_cmd_sync(priv, &cmd); |
3064 | if (rc) | 2865 | if (rc) |
3065 | return rc; | 2866 | return rc; |
3066 | 2867 | ||
@@ -3835,7 +3636,7 @@ static void iwl4965_tx_cmd_complete(struct iwl_priv *priv, | |||
3835 | int index = SEQ_TO_INDEX(sequence); | 3636 | int index = SEQ_TO_INDEX(sequence); |
3836 | int huge = sequence & SEQ_HUGE_FRAME; | 3637 | int huge = sequence & SEQ_HUGE_FRAME; |
3837 | int cmd_index; | 3638 | int cmd_index; |
3838 | struct iwl4965_cmd *cmd; | 3639 | struct iwl_cmd *cmd; |
3839 | 3640 | ||
3840 | /* If a Tx command is being handled and it isn't in the actual | 3641 | /* If a Tx command is being handled and it isn't in the actual |
3841 | * command queue then there a command routing bug has been introduced | 3642 | * command queue then there a command routing bug has been introduced |
@@ -4337,7 +4138,7 @@ static void iwl4965_rx_handle(struct iwl_priv *priv) | |||
4337 | * but apparently a few don't get set; catch them here. */ | 4138 | * but apparently a few don't get set; catch them here. */ |
4338 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && | 4139 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && |
4339 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && | 4140 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && |
4340 | (pkt->hdr.cmd != REPLY_4965_RX) && | 4141 | (pkt->hdr.cmd != REPLY_RX) && |
4341 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && | 4142 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && |
4342 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && | 4143 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && |
4343 | (pkt->hdr.cmd != REPLY_TX); | 4144 | (pkt->hdr.cmd != REPLY_TX); |
@@ -4360,7 +4161,7 @@ static void iwl4965_rx_handle(struct iwl_priv *priv) | |||
4360 | 4161 | ||
4361 | if (reclaim) { | 4162 | if (reclaim) { |
4362 | /* Invoke any callbacks, transfer the skb to caller, and | 4163 | /* Invoke any callbacks, transfer the skb to caller, and |
4363 | * fire off the (possibly) blocking iwl4965_send_cmd() | 4164 | * fire off the (possibly) blocking iwl_send_cmd() |
4364 | * as we reclaim the driver command queue */ | 4165 | * as we reclaim the driver command queue */ |
4365 | if (rxb && rxb->skb) | 4166 | if (rxb && rxb->skb) |
4366 | iwl4965_tx_cmd_complete(priv, rxb); | 4167 | iwl4965_tx_cmd_complete(priv, rxb); |
@@ -6213,17 +6014,17 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6213 | { | 6014 | { |
6214 | struct iwl_priv *priv = | 6015 | struct iwl_priv *priv = |
6215 | container_of(data, struct iwl_priv, request_scan); | 6016 | container_of(data, struct iwl_priv, request_scan); |
6216 | struct iwl4965_host_cmd cmd = { | 6017 | struct iwl_host_cmd cmd = { |
6217 | .id = REPLY_SCAN_CMD, | 6018 | .id = REPLY_SCAN_CMD, |
6218 | .len = sizeof(struct iwl4965_scan_cmd), | 6019 | .len = sizeof(struct iwl4965_scan_cmd), |
6219 | .meta.flags = CMD_SIZE_HUGE, | 6020 | .meta.flags = CMD_SIZE_HUGE, |
6220 | }; | 6021 | }; |
6221 | int rc = 0; | ||
6222 | struct iwl4965_scan_cmd *scan; | 6022 | struct iwl4965_scan_cmd *scan; |
6223 | struct ieee80211_conf *conf = NULL; | 6023 | struct ieee80211_conf *conf = NULL; |
6224 | u16 cmd_len; | 6024 | u16 cmd_len; |
6225 | enum ieee80211_band band; | 6025 | enum ieee80211_band band; |
6226 | u8 direct_mask; | 6026 | u8 direct_mask; |
6027 | int ret = 0; | ||
6227 | 6028 | ||
6228 | conf = ieee80211_get_hw_conf(priv->hw); | 6029 | conf = ieee80211_get_hw_conf(priv->hw); |
6229 | 6030 | ||
@@ -6244,7 +6045,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6244 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | 6045 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { |
6245 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " | 6046 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " |
6246 | "Ignoring second request.\n"); | 6047 | "Ignoring second request.\n"); |
6247 | rc = -EIO; | 6048 | ret = -EIO; |
6248 | goto done; | 6049 | goto done; |
6249 | } | 6050 | } |
6250 | 6051 | ||
@@ -6277,7 +6078,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6277 | priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + | 6078 | priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + |
6278 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); | 6079 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); |
6279 | if (!priv->scan) { | 6080 | if (!priv->scan) { |
6280 | rc = -ENOMEM; | 6081 | ret = -ENOMEM; |
6281 | goto done; | 6082 | goto done; |
6282 | } | 6083 | } |
6283 | } | 6084 | } |
@@ -6329,8 +6130,9 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6329 | scan->direct_scan[0].len = priv->essid_len; | 6130 | scan->direct_scan[0].len = priv->essid_len; |
6330 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6131 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
6331 | direct_mask = 1; | 6132 | direct_mask = 1; |
6332 | } else | 6133 | } else { |
6333 | direct_mask = 0; | 6134 | direct_mask = 0; |
6135 | } | ||
6334 | 6136 | ||
6335 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 6137 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
6336 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; | 6138 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; |
@@ -6405,8 +6207,8 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6405 | scan->len = cpu_to_le16(cmd.len); | 6207 | scan->len = cpu_to_le16(cmd.len); |
6406 | 6208 | ||
6407 | set_bit(STATUS_SCAN_HW, &priv->status); | 6209 | set_bit(STATUS_SCAN_HW, &priv->status); |
6408 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 6210 | ret = iwl_send_cmd_sync(priv, &cmd); |
6409 | if (rc) | 6211 | if (ret) |
6410 | goto done; | 6212 | goto done; |
6411 | 6213 | ||
6412 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6214 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
@@ -6463,9 +6265,8 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
6463 | { | 6265 | { |
6464 | struct iwl_priv *priv = container_of(data, struct iwl_priv, | 6266 | struct iwl_priv *priv = container_of(data, struct iwl_priv, |
6465 | post_associate.work); | 6267 | post_associate.work); |
6466 | |||
6467 | int rc = 0; | ||
6468 | struct ieee80211_conf *conf = NULL; | 6268 | struct ieee80211_conf *conf = NULL; |
6269 | int ret = 0; | ||
6469 | DECLARE_MAC_BUF(mac); | 6270 | DECLARE_MAC_BUF(mac); |
6470 | 6271 | ||
6471 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6272 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { |
@@ -6496,9 +6297,9 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
6496 | 6297 | ||
6497 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 6298 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); |
6498 | iwl4965_setup_rxon_timing(priv); | 6299 | iwl4965_setup_rxon_timing(priv); |
6499 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 6300 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
6500 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 6301 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
6501 | if (rc) | 6302 | if (ret) |
6502 | IWL_WARNING("REPLY_RXON_TIMING failed - " | 6303 | IWL_WARNING("REPLY_RXON_TIMING failed - " |
6503 | "Attempting to continue.\n"); | 6304 | "Attempting to continue.\n"); |
6504 | 6305 | ||
@@ -6894,7 +6695,7 @@ out: | |||
6894 | 6695 | ||
6895 | static void iwl4965_config_ap(struct iwl_priv *priv) | 6696 | static void iwl4965_config_ap(struct iwl_priv *priv) |
6896 | { | 6697 | { |
6897 | int rc = 0; | 6698 | int ret = 0; |
6898 | 6699 | ||
6899 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6700 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6900 | return; | 6701 | return; |
@@ -6909,9 +6710,9 @@ static void iwl4965_config_ap(struct iwl_priv *priv) | |||
6909 | /* RXON Timing */ | 6710 | /* RXON Timing */ |
6910 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 6711 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); |
6911 | iwl4965_setup_rxon_timing(priv); | 6712 | iwl4965_setup_rxon_timing(priv); |
6912 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 6713 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
6913 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 6714 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
6914 | if (rc) | 6715 | if (ret) |
6915 | IWL_WARNING("REPLY_RXON_TIMING failed - " | 6716 | IWL_WARNING("REPLY_RXON_TIMING failed - " |
6916 | "Attempting to continue.\n"); | 6717 | "Attempting to continue.\n"); |
6917 | 6718 | ||