aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c434
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h52
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c65
13 files changed, 271 insertions, 337 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 592c5958723b..7187925bd0d5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -828,8 +828,6 @@ struct iwl3945_priv {
828 unsigned long last_statistics_time; 828 unsigned long last_statistics_time;
829 829
830 /* context information */ 830 /* context information */
831 u8 essid[IW_ESSID_MAX_SIZE];
832 u8 essid_len;
833 u16 rates_mask; 831 u16 rates_mask;
834 832
835 u32 power_mode; 833 u32 power_mode;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 0953a9c56807..157cad4e9da0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2323,7 +2323,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2323 .reset = iwl4965_apm_reset, 2323 .reset = iwl4965_apm_reset,
2324 .stop = iwl4965_apm_stop, 2324 .stop = iwl4965_apm_stop,
2325 .config = iwl4965_nic_config, 2325 .config = iwl4965_nic_config,
2326 .set_pwr_src = iwl4965_set_pwr_src, 2326 .set_pwr_src = iwl_set_pwr_src,
2327 }, 2327 },
2328 .eeprom_ops = { 2328 .eeprom_ops = {
2329 .regulatory_bands = { 2329 .regulatory_bands = {
@@ -2342,7 +2342,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2342 .query_addr = iwlcore_eeprom_query_addr, 2342 .query_addr = iwlcore_eeprom_query_addr,
2343 }, 2343 },
2344 .send_tx_power = iwl4965_send_tx_power, 2344 .send_tx_power = iwl4965_send_tx_power,
2345 .update_chain_flags = iwl4965_update_chain_flags, 2345 .update_chain_flags = iwl_update_chain_flags,
2346 .temperature = iwl4965_temperature_calib, 2346 .temperature = iwl4965_temperature_calib,
2347}; 2347};
2348 2348
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 4348c7db3d1f..31e62a838ad4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -535,7 +535,7 @@ static int iwl5000_load_section(struct iwl_priv *priv,
535 iwl_write_direct32(priv, 535 iwl_write_direct32(priv,
536 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), 536 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
537 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 537 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
538 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL | 538 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE |
539 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); 539 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
540 540
541 iwl_release_nic_access(priv); 541 iwl_release_nic_access(priv);
@@ -549,14 +549,13 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv,
549{ 549{
550 int ret = 0; 550 int ret = 0;
551 551
552 ret = iwl5000_load_section( 552 ret = iwl5000_load_section(priv, inst_image, RTC_INST_LOWER_BOUND);
553 priv, inst_image, RTC_INST_LOWER_BOUND);
554 if (ret) 553 if (ret)
555 return ret; 554 return ret;
556 555
557 IWL_DEBUG_INFO("INST uCode section being loaded...\n"); 556 IWL_DEBUG_INFO("INST uCode section being loaded...\n");
558 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 557 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
559 priv->ucode_write_complete, 5 * HZ); 558 priv->ucode_write_complete, 5 * HZ);
560 if (ret == -ERESTARTSYS) { 559 if (ret == -ERESTARTSYS) {
561 IWL_ERROR("Could not load the INST uCode section due " 560 IWL_ERROR("Could not load the INST uCode section due "
562 "to interrupt\n"); 561 "to interrupt\n");
@@ -753,6 +752,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv)
753 priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7)); 752 priv->cfg->ops->lib->txq_set_sched(priv, IWL_MASK(0, 7));
754 753
755 iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); 754 iwl5000_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
755
756 /* map qos queues to fifos one-to-one */ 756 /* map qos queues to fifos one-to-one */
757 for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) { 757 for (i = 0; i < ARRAY_SIZE(iwl5000_default_queue_to_tx_fifo); i++) {
758 int ac = iwl5000_default_queue_to_tx_fifo[i]; 758 int ac = iwl5000_default_queue_to_tx_fifo[i];
@@ -1474,13 +1474,13 @@ static struct iwl_lib_ops iwl5000_lib = {
1474 .alive_notify = iwl5000_alive_notify, 1474 .alive_notify = iwl5000_alive_notify,
1475 .send_tx_power = iwl5000_send_tx_power, 1475 .send_tx_power = iwl5000_send_tx_power,
1476 .temperature = iwl5000_temperature, 1476 .temperature = iwl5000_temperature,
1477 .update_chain_flags = iwl4965_update_chain_flags, 1477 .update_chain_flags = iwl_update_chain_flags,
1478 .apm_ops = { 1478 .apm_ops = {
1479 .init = iwl5000_apm_init, 1479 .init = iwl5000_apm_init,
1480 .reset = iwl5000_apm_reset, 1480 .reset = iwl5000_apm_reset,
1481 .stop = iwl5000_apm_stop, 1481 .stop = iwl5000_apm_stop,
1482 .config = iwl5000_nic_config, 1482 .config = iwl5000_nic_config,
1483 .set_pwr_src = iwl4965_set_pwr_src, 1483 .set_pwr_src = iwl_set_pwr_src,
1484 }, 1484 },
1485 .eeprom_ops = { 1485 .eeprom_ops = {
1486 .regulatory_bands = { 1486 .regulatory_bands = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index f5e94b65a7f6..0332805cc630 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2071,15 +2071,13 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2071 if ((i < 0) || (i >= IWL_RATE_COUNT)) 2071 if ((i < 0) || (i >= IWL_RATE_COUNT))
2072 i = 0; 2072 i = 0;
2073 2073
2074 /* FIXME:RS: This is also wrong in 4965 */
2075 rate = iwl_rates[i].plcp; 2074 rate = iwl_rates[i].plcp;
2076 rate |= RATE_MCS_ANT_B_MSK; 2075 tbl->ant_type = first_antenna(valid_tx_ant);
2077 rate &= ~RATE_MCS_ANT_A_MSK; 2076 rate |= tbl->ant_type << RATE_MCS_ANT_POS;
2078 2077
2079 if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) 2078 if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE)
2080 rate |= RATE_MCS_CCK_MSK; 2079 rate |= RATE_MCS_CCK_MSK;
2081 2080
2082 tbl->ant_type = ANT_B;
2083 rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); 2081 rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx);
2084 if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) 2082 if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type))
2085 rs_toggle_antenna(valid_tx_ant, &rate, tbl); 2083 rs_toggle_antenna(valid_tx_ant, &rate, tbl);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
index ccfafcfa4767..adcbf538ed54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
@@ -294,7 +294,7 @@ static inline u8 first_antenna(u8 mask)
294} 294}
295 295
296 296
297static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index) 297static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
298{ 298{
299 u8 rate = iwl_rates[rate_index].prev_ieee; 299 u8 rate = iwl_rates[rate_index].prev_ieee;
300 300
@@ -304,11 +304,11 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
304} 304}
305 305
306/** 306/**
307 * iwl4965_rate_control_register - Register the rate control algorithm callbacks 307 * iwl_rate_control_register - Register the rate control algorithm callbacks
308 * 308 *
309 * Since the rate control algorithm is hardware specific, there is no need 309 * Since the rate control algorithm is hardware specific, there is no need
310 * or reason to place it as a stand alone module. The driver can call 310 * or reason to place it as a stand alone module. The driver can call
311 * iwl4965_rate_control_register in order to register the rate control callbacks 311 * iwl_rate_control_register in order to register the rate control callbacks
312 * with the mac80211 subsystem. This should be performed prior to calling 312 * with the mac80211 subsystem. This should be performed prior to calling
313 * ieee80211_register_hw 313 * ieee80211_register_hw
314 * 314 *
@@ -316,7 +316,7 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
316extern int iwlagn_rate_control_register(void); 316extern int iwlagn_rate_control_register(void);
317 317
318/** 318/**
319 * iwl4965_rate_control_unregister - Unregister the rate control callbacks 319 * iwl_rate_control_unregister - Unregister the rate control callbacks
320 * 320 *
321 * This should be called after calling ieee80211_unregister_hw, but before 321 * This should be called after calling ieee80211_unregister_hw, but before
322 * the driver is unloaded. 322 * the driver is unloaded.
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 2c35a017e5f6..8264d3742d08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -96,7 +96,7 @@ MODULE_ALIAS("iwl4965");
96 96
97 97
98 98
99static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 99static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
100{ 100{
101 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 101 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
102 102
@@ -108,13 +108,13 @@ static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
108} 108}
109 109
110/** 110/**
111 * iwl4965_check_rxon_cmd - validate RXON structure is valid 111 * iwl_check_rxon_cmd - validate RXON structure is valid
112 * 112 *
113 * NOTE: This is really only useful during development and can eventually 113 * NOTE: This is really only useful during development and can eventually
114 * be #ifdef'd out once the driver is stable and folks aren't actively 114 * be #ifdef'd out once the driver is stable and folks aren't actively
115 * making changes 115 * making changes
116 */ 116 */
117static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon) 117static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
118{ 118{
119 int error = 0; 119 int error = 0;
120 int counter = 1; 120 int counter = 1;
@@ -174,7 +174,7 @@ static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
174 le16_to_cpu(rxon->channel)); 174 le16_to_cpu(rxon->channel));
175 175
176 if (error) { 176 if (error) {
177 IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n"); 177 IWL_ERROR("Not a valid iwl_rxon_assoc_cmd field values\n");
178 return -1; 178 return -1;
179 } 179 }
180 return 0; 180 return 0;
@@ -228,14 +228,14 @@ static int iwl_full_rxon_required(struct iwl_priv *priv)
228} 228}
229 229
230/** 230/**
231 * iwl4965_commit_rxon - commit staging_rxon to hardware 231 * iwl_commit_rxon - commit staging_rxon to hardware
232 * 232 *
233 * The RXON command in staging_rxon is committed to the hardware and 233 * The RXON command in staging_rxon is committed to the hardware and
234 * the active_rxon structure is updated with the new data. This 234 * the active_rxon structure is updated with the new data. This
235 * function correctly transitions out of the RXON_ASSOC_MSK state if 235 * function correctly transitions out of the RXON_ASSOC_MSK state if
236 * a HW tune is required based on the RXON structure changes. 236 * a HW tune is required based on the RXON structure changes.
237 */ 237 */
238static int iwl4965_commit_rxon(struct iwl_priv *priv) 238static int iwl_commit_rxon(struct iwl_priv *priv)
239{ 239{
240 /* cast away the const for active_rxon in this function */ 240 /* cast away the const for active_rxon in this function */
241 struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; 241 struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
@@ -252,14 +252,14 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
252 * 5000, but will not damage 4965 */ 252 * 5000, but will not damage 4965 */
253 priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; 253 priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
254 254
255 ret = iwl4965_check_rxon_cmd(&priv->staging_rxon); 255 ret = iwl_check_rxon_cmd(&priv->staging_rxon);
256 if (ret) { 256 if (ret) {
257 IWL_ERROR("Invalid RXON configuration. Not committing.\n"); 257 IWL_ERROR("Invalid RXON configuration. Not committing.\n");
258 return -EINVAL; 258 return -EINVAL;
259 } 259 }
260 260
261 /* If we don't need to send a full RXON, we can use 261 /* If we don't need to send a full RXON, we can use
262 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter 262 * iwl_rxon_assoc_cmd which is used to reconfigure filter
263 * and other flags for the current radio configuration. */ 263 * and other flags for the current radio configuration. */
264 if (!iwl_full_rxon_required(priv)) { 264 if (!iwl_full_rxon_required(priv)) {
265 ret = iwl_send_rxon_assoc(priv); 265 ret = iwl_send_rxon_assoc(priv);
@@ -304,7 +304,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
304 le16_to_cpu(priv->staging_rxon.channel), 304 le16_to_cpu(priv->staging_rxon.channel),
305 priv->staging_rxon.bssid_addr); 305 priv->staging_rxon.bssid_addr);
306 306
307 iwl4965_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); 307 iwl_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto);
308 308
309 /* Apply the new configuration 309 /* Apply the new configuration
310 * RXON unassoc clears the station table in uCode, send it before 310 * RXON unassoc clears the station table in uCode, send it before
@@ -374,14 +374,14 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
374 return 0; 374 return 0;
375} 375}
376 376
377void iwl4965_update_chain_flags(struct iwl_priv *priv) 377void iwl_update_chain_flags(struct iwl_priv *priv)
378{ 378{
379 379
380 iwl_set_rxon_chain(priv); 380 iwl_set_rxon_chain(priv);
381 iwl4965_commit_rxon(priv); 381 iwl_commit_rxon(priv);
382} 382}
383 383
384static int iwl4965_send_bt_config(struct iwl_priv *priv) 384static int iwl_send_bt_config(struct iwl_priv *priv)
385{ 385{
386 struct iwl4965_bt_cmd bt_cmd = { 386 struct iwl4965_bt_cmd bt_cmd = {
387 .flags = 3, 387 .flags = 3,
@@ -459,7 +459,7 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
459 return priv->ibss_beacon->len; 459 return priv->ibss_beacon->len;
460} 460}
461 461
462static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv) 462static u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
463{ 463{
464 int i; 464 int i;
465 int rate_mask; 465 int rate_mask;
@@ -484,7 +484,7 @@ static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv)
484 return IWL_RATE_6M_PLCP; 484 return IWL_RATE_6M_PLCP;
485} 485}
486 486
487static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 487static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
488 struct iwl_frame *frame, u8 rate) 488 struct iwl_frame *frame, u8 rate)
489{ 489{
490 struct iwl_tx_beacon_cmd *tx_beacon_cmd; 490 struct iwl_tx_beacon_cmd *tx_beacon_cmd;
@@ -516,7 +516,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
516 516
517 return sizeof(*tx_beacon_cmd) + frame_size; 517 return sizeof(*tx_beacon_cmd) + frame_size;
518} 518}
519static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) 519static int iwl_send_beacon_cmd(struct iwl_priv *priv)
520{ 520{
521 struct iwl_frame *frame; 521 struct iwl_frame *frame;
522 unsigned int frame_size; 522 unsigned int frame_size;
@@ -531,9 +531,9 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
531 return -ENOMEM; 531 return -ENOMEM;
532 } 532 }
533 533
534 rate = iwl4965_rate_get_lowest_plcp(priv); 534 rate = iwl_rate_get_lowest_plcp(priv);
535 535
536 frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); 536 frame_size = iwl_hw_get_beacon_cmd(priv, frame, rate);
537 537
538 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 538 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
539 &frame->u.cmd[0]); 539 &frame->u.cmd[0]);
@@ -549,7 +549,7 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
549 * 549 *
550 ******************************************************************************/ 550 ******************************************************************************/
551 551
552static void iwl4965_ht_conf(struct iwl_priv *priv, 552static void iwl_ht_conf(struct iwl_priv *priv,
553 struct ieee80211_bss_conf *bss_conf) 553 struct ieee80211_bss_conf *bss_conf)
554{ 554{
555 struct ieee80211_sta_ht_cap *ht_conf; 555 struct ieee80211_sta_ht_cap *ht_conf;
@@ -708,7 +708,7 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv,
708 | RXON_FLG_CCK_MSK); 708 | RXON_FLG_CCK_MSK);
709 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 709 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
710 } else { 710 } else {
711 /* Copied from iwl4965_post_associate() */ 711 /* Copied from iwl_post_associate() */
712 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 712 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
713 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 713 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
714 else 714 else
@@ -726,13 +726,13 @@ static void iwl_set_flags_for_band(struct iwl_priv *priv,
726/* 726/*
727 * initialize rxon structure with default values from eeprom 727 * initialize rxon structure with default values from eeprom
728 */ 728 */
729static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) 729static void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode)
730{ 730{
731 const struct iwl_channel_info *ch_info; 731 const struct iwl_channel_info *ch_info;
732 732
733 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); 733 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
734 734
735 switch (priv->iw_mode) { 735 switch (mode) {
736 case NL80211_IFTYPE_AP: 736 case NL80211_IFTYPE_AP:
737 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; 737 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
738 break; 738 break;
@@ -755,7 +755,7 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv)
755 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; 755 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
756 break; 756 break;
757 default: 757 default:
758 IWL_ERROR("Unsupported interface type %d\n", priv->iw_mode); 758 IWL_ERROR("Unsupported interface type %d\n", mode);
759 break; 759 break;
760 } 760 }
761 761
@@ -801,11 +801,9 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv)
801 iwl_set_rxon_chain(priv); 801 iwl_set_rxon_chain(priv);
802} 802}
803 803
804static int iwl4965_set_mode(struct iwl_priv *priv, int mode) 804static int iwl_set_mode(struct iwl_priv *priv, int mode)
805{ 805{
806 priv->iw_mode = mode; 806 iwl_connection_init_rx_config(priv, mode);
807
808 iwl4965_connection_init_rx_config(priv);
809 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 807 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
810 808
811 iwl_clear_stations_table(priv); 809 iwl_clear_stations_table(priv);
@@ -821,12 +819,12 @@ static int iwl4965_set_mode(struct iwl_priv *priv, int mode)
821 return -EAGAIN; 819 return -EAGAIN;
822 } 820 }
823 821
824 iwl4965_commit_rxon(priv); 822 iwl_commit_rxon(priv);
825 823
826 return 0; 824 return 0;
827} 825}
828 826
829static void iwl4965_set_rate(struct iwl_priv *priv) 827static void iwl_set_rate(struct iwl_priv *priv)
830{ 828{
831 const struct ieee80211_supported_band *hw = NULL; 829 const struct ieee80211_supported_band *hw = NULL;
832 struct ieee80211_rate *rate; 830 struct ieee80211_rate *rate;
@@ -888,7 +886,7 @@ static void iwl4965_set_rate(struct iwl_priv *priv)
888 * the lower 3 bytes is the time in usec within one beacon interval 886 * the lower 3 bytes is the time in usec within one beacon interval
889 */ 887 */
890 888
891static u32 iwl4965_usecs_to_beacons(u32 usec, u32 beacon_interval) 889static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval)
892{ 890{
893 u32 quot; 891 u32 quot;
894 u32 rem; 892 u32 rem;
@@ -907,7 +905,7 @@ static u32 iwl4965_usecs_to_beacons(u32 usec, u32 beacon_interval)
907 * the same as HW timer counter counting down 905 * the same as HW timer counter counting down
908 */ 906 */
909 907
910static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) 908static __le32 iwl_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
911{ 909{
912 u32 base_low = base & BEACON_TIME_MASK_LOW; 910 u32 base_low = base & BEACON_TIME_MASK_LOW;
913 u32 addon_low = addon & BEACON_TIME_MASK_LOW; 911 u32 addon_low = addon & BEACON_TIME_MASK_LOW;
@@ -926,7 +924,7 @@ static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
926 return cpu_to_le32(res); 924 return cpu_to_le32(res);
927} 925}
928 926
929static int iwl4965_get_measurement(struct iwl_priv *priv, 927static int iwl_get_measurement(struct iwl_priv *priv,
930 struct ieee80211_measurement_params *params, 928 struct ieee80211_measurement_params *params,
931 u8 type) 929 u8 type)
932{ 930{
@@ -944,7 +942,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
944 942
945 if (iwl_is_associated(priv)) 943 if (iwl_is_associated(priv))
946 add_time = 944 add_time =
947 iwl4965_usecs_to_beacons( 945 iwl_usecs_to_beacons(
948 le64_to_cpu(params->start_time) - priv->last_tsf, 946 le64_to_cpu(params->start_time) - priv->last_tsf,
949 le16_to_cpu(priv->rxon_timing.beacon_interval)); 947 le16_to_cpu(priv->rxon_timing.beacon_interval));
950 948
@@ -959,7 +957,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
959 957
960 if (iwl_is_associated(priv)) 958 if (iwl_is_associated(priv))
961 spectrum.start_time = 959 spectrum.start_time =
962 iwl4965_add_beacon_time(priv->last_beacon_time, 960 iwl_add_beacon_time(priv->last_beacon_time,
963 add_time, 961 add_time,
964 le16_to_cpu(priv->rxon_timing.beacon_interval)); 962 le16_to_cpu(priv->rxon_timing.beacon_interval));
965 else 963 else
@@ -1047,7 +1045,7 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
1047 IWL_WARNING("uCode did not respond OK.\n"); 1045 IWL_WARNING("uCode did not respond OK.\n");
1048} 1046}
1049 1047
1050static void iwl4965_rx_reply_error(struct iwl_priv *priv, 1048static void iwl_rx_reply_error(struct iwl_priv *priv,
1051 struct iwl_rx_mem_buffer *rxb) 1049 struct iwl_rx_mem_buffer *rxb)
1052{ 1050{
1053 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1051 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
@@ -1063,7 +1061,7 @@ static void iwl4965_rx_reply_error(struct iwl_priv *priv,
1063 1061
1064#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x 1062#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
1065 1063
1066static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 1064static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1067{ 1065{
1068 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1066 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
1069 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon; 1067 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon;
@@ -1074,7 +1072,7 @@ static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1074 priv->staging_rxon.channel = csa->channel; 1072 priv->staging_rxon.channel = csa->channel;
1075} 1073}
1076 1074
1077static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv, 1075static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
1078 struct iwl_rx_mem_buffer *rxb) 1076 struct iwl_rx_mem_buffer *rxb)
1079{ 1077{
1080#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT 1078#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
@@ -1092,7 +1090,7 @@ static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv,
1092#endif 1090#endif
1093} 1091}
1094 1092
1095static void iwl4965_rx_pm_sleep_notif(struct iwl_priv *priv, 1093static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
1096 struct iwl_rx_mem_buffer *rxb) 1094 struct iwl_rx_mem_buffer *rxb)
1097{ 1095{
1098#ifdef CONFIG_IWLWIFI_DEBUG 1096#ifdef CONFIG_IWLWIFI_DEBUG
@@ -1103,7 +1101,7 @@ static void iwl4965_rx_pm_sleep_notif(struct iwl_priv *priv,
1103#endif 1101#endif
1104} 1102}
1105 1103
1106static void iwl4965_rx_pm_debug_statistics_notif(struct iwl_priv *priv, 1104static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
1107 struct iwl_rx_mem_buffer *rxb) 1105 struct iwl_rx_mem_buffer *rxb)
1108{ 1106{
1109 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1107 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
@@ -1113,7 +1111,7 @@ static void iwl4965_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
1113 iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 1111 iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
1114} 1112}
1115 1113
1116static void iwl4965_bg_beacon_update(struct work_struct *work) 1114static void iwl_bg_beacon_update(struct work_struct *work)
1117{ 1115{
1118 struct iwl_priv *priv = 1116 struct iwl_priv *priv =
1119 container_of(work, struct iwl_priv, beacon_update); 1117 container_of(work, struct iwl_priv, beacon_update);
@@ -1135,11 +1133,11 @@ static void iwl4965_bg_beacon_update(struct work_struct *work)
1135 priv->ibss_beacon = beacon; 1133 priv->ibss_beacon = beacon;
1136 mutex_unlock(&priv->mutex); 1134 mutex_unlock(&priv->mutex);
1137 1135
1138 iwl4965_send_beacon_cmd(priv); 1136 iwl_send_beacon_cmd(priv);
1139} 1137}
1140 1138
1141/** 1139/**
1142 * iwl4965_bg_statistics_periodic - Timer callback to queue statistics 1140 * iwl_bg_statistics_periodic - Timer callback to queue statistics
1143 * 1141 *
1144 * This callback is provided in order to send a statistics request. 1142 * This callback is provided in order to send a statistics request.
1145 * 1143 *
@@ -1148,17 +1146,21 @@ static void iwl4965_bg_beacon_update(struct work_struct *work)
1148 * was received. We need to ensure we receive the statistics in order 1146 * was received. We need to ensure we receive the statistics in order
1149 * to update the temperature used for calibrating the TXPOWER. 1147 * to update the temperature used for calibrating the TXPOWER.
1150 */ 1148 */
1151static void iwl4965_bg_statistics_periodic(unsigned long data) 1149static void iwl_bg_statistics_periodic(unsigned long data)
1152{ 1150{
1153 struct iwl_priv *priv = (struct iwl_priv *)data; 1151 struct iwl_priv *priv = (struct iwl_priv *)data;
1154 1152
1155 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1153 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1156 return; 1154 return;
1157 1155
1156 /* dont send host command if rf-kill is on */
1157 if (!iwl_is_ready_rf(priv))
1158 return;
1159
1158 iwl_send_statistics_request(priv, CMD_ASYNC); 1160 iwl_send_statistics_request(priv, CMD_ASYNC);
1159} 1161}
1160 1162
1161static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, 1163static void iwl_rx_beacon_notif(struct iwl_priv *priv,
1162 struct iwl_rx_mem_buffer *rxb) 1164 struct iwl_rx_mem_buffer *rxb)
1163{ 1165{
1164#ifdef CONFIG_IWLWIFI_DEBUG 1166#ifdef CONFIG_IWLWIFI_DEBUG
@@ -1182,7 +1184,7 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
1182 1184
1183/* Handle notification from uCode that card's power state is changing 1185/* Handle notification from uCode that card's power state is changing
1184 * due to software, hardware, or critical temperature RFKILL */ 1186 * due to software, hardware, or critical temperature RFKILL */
1185static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, 1187static void iwl_rx_card_state_notif(struct iwl_priv *priv,
1186 struct iwl_rx_mem_buffer *rxb) 1188 struct iwl_rx_mem_buffer *rxb)
1187{ 1189{
1188 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1190 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
@@ -1251,7 +1253,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
1251 wake_up_interruptible(&priv->wait_command_queue); 1253 wake_up_interruptible(&priv->wait_command_queue);
1252} 1254}
1253 1255
1254int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) 1256int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
1255{ 1257{
1256 int ret; 1258 int ret;
1257 unsigned long flags; 1259 unsigned long flags;
@@ -1283,7 +1285,7 @@ err:
1283} 1285}
1284 1286
1285/** 1287/**
1286 * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks 1288 * iwl_setup_rx_handlers - Initialize Rx handler callbacks
1287 * 1289 *
1288 * Setup the RX handlers for each of the reply types sent from the uCode 1290 * Setup the RX handlers for each of the reply types sent from the uCode
1289 * to the host. 1291 * to the host.
@@ -1294,14 +1296,14 @@ err:
1294static void iwl_setup_rx_handlers(struct iwl_priv *priv) 1296static void iwl_setup_rx_handlers(struct iwl_priv *priv)
1295{ 1297{
1296 priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive; 1298 priv->rx_handlers[REPLY_ALIVE] = iwl_rx_reply_alive;
1297 priv->rx_handlers[REPLY_ERROR] = iwl4965_rx_reply_error; 1299 priv->rx_handlers[REPLY_ERROR] = iwl_rx_reply_error;
1298 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl4965_rx_csa; 1300 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa;
1299 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 1301 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
1300 iwl4965_rx_spectrum_measure_notif; 1302 iwl_rx_spectrum_measure_notif;
1301 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl4965_rx_pm_sleep_notif; 1303 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_rx_pm_sleep_notif;
1302 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = 1304 priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
1303 iwl4965_rx_pm_debug_statistics_notif; 1305 iwl_rx_pm_debug_statistics_notif;
1304 priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; 1306 priv->rx_handlers[BEACON_NOTIFICATION] = iwl_rx_beacon_notif;
1305 1307
1306 /* 1308 /*
1307 * The same handler is used for both the REPLY to a discrete 1309 * The same handler is used for both the REPLY to a discrete
@@ -1314,7 +1316,7 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
1314 iwl_setup_rx_scan_handlers(priv); 1316 iwl_setup_rx_scan_handlers(priv);
1315 1317
1316 /* status change handler */ 1318 /* status change handler */
1317 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; 1319 priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl_rx_card_state_notif;
1318 1320
1319 priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = 1321 priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] =
1320 iwl_rx_missed_beacon_notif; 1322 iwl_rx_missed_beacon_notif;
@@ -1398,7 +1400,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
1398 1400
1399 /* Based on type of command response or notification, 1401 /* Based on type of command response or notification,
1400 * handle those that need handling via function in 1402 * handle those that need handling via function in
1401 * rx_handlers table. See iwl4965_setup_rx_handlers() */ 1403 * rx_handlers table. See iwl_setup_rx_handlers() */
1402 if (priv->rx_handlers[pkt->hdr.cmd]) { 1404 if (priv->rx_handlers[pkt->hdr.cmd]) {
1403 IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r, 1405 IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r,
1404 i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); 1406 i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
@@ -1455,7 +1457,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
1455} 1457}
1456 1458
1457#ifdef CONFIG_IWLWIFI_DEBUG 1459#ifdef CONFIG_IWLWIFI_DEBUG
1458static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv) 1460static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
1459{ 1461{
1460 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 1462 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
1461 1463
@@ -1475,7 +1477,7 @@ static void iwl4965_print_rx_config_cmd(struct iwl_priv *priv)
1475} 1477}
1476#endif 1478#endif
1477 1479
1478static void iwl4965_enable_interrupts(struct iwl_priv *priv) 1480static void iwl_enable_interrupts(struct iwl_priv *priv)
1479{ 1481{
1480 IWL_DEBUG_ISR("Enabling interrupts\n"); 1482 IWL_DEBUG_ISR("Enabling interrupts\n");
1481 set_bit(STATUS_INT_ENABLED, &priv->status); 1483 set_bit(STATUS_INT_ENABLED, &priv->status);
@@ -1490,7 +1492,7 @@ static inline void iwl_synchronize_irq(struct iwl_priv *priv)
1490 tasklet_kill(&priv->irq_tasklet); 1492 tasklet_kill(&priv->irq_tasklet);
1491} 1493}
1492 1494
1493static inline void iwl4965_disable_interrupts(struct iwl_priv *priv) 1495static inline void iwl_disable_interrupts(struct iwl_priv *priv)
1494{ 1496{
1495 clear_bit(STATUS_INT_ENABLED, &priv->status); 1497 clear_bit(STATUS_INT_ENABLED, &priv->status);
1496 1498
@@ -1506,11 +1508,11 @@ static inline void iwl4965_disable_interrupts(struct iwl_priv *priv)
1506 1508
1507 1509
1508/** 1510/**
1509 * iwl4965_irq_handle_error - called for HW or SW error interrupt from card 1511 * iwl_irq_handle_error - called for HW or SW error interrupt from card
1510 */ 1512 */
1511static void iwl4965_irq_handle_error(struct iwl_priv *priv) 1513static void iwl_irq_handle_error(struct iwl_priv *priv)
1512{ 1514{
1513 /* Set the FW error flag -- cleared on iwl4965_down */ 1515 /* Set the FW error flag -- cleared on iwl_down */
1514 set_bit(STATUS_FW_ERROR, &priv->status); 1516 set_bit(STATUS_FW_ERROR, &priv->status);
1515 1517
1516 /* Cancel currently queued command. */ 1518 /* Cancel currently queued command. */
@@ -1520,7 +1522,7 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
1520 if (priv->debug_level & IWL_DL_FW_ERRORS) { 1522 if (priv->debug_level & IWL_DL_FW_ERRORS) {
1521 iwl_dump_nic_error_log(priv); 1523 iwl_dump_nic_error_log(priv);
1522 iwl_dump_nic_event_log(priv); 1524 iwl_dump_nic_event_log(priv);
1523 iwl4965_print_rx_config_cmd(priv); 1525 iwl_print_rx_config_cmd(priv);
1524 } 1526 }
1525#endif 1527#endif
1526 1528
@@ -1544,14 +1546,14 @@ static void iwl4965_irq_handle_error(struct iwl_priv *priv)
1544 } 1546 }
1545} 1547}
1546 1548
1547static void iwl4965_error_recovery(struct iwl_priv *priv) 1549static void iwl_error_recovery(struct iwl_priv *priv)
1548{ 1550{
1549 unsigned long flags; 1551 unsigned long flags;
1550 1552
1551 memcpy(&priv->staging_rxon, &priv->recovery_rxon, 1553 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
1552 sizeof(priv->staging_rxon)); 1554 sizeof(priv->staging_rxon));
1553 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1555 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1554 iwl4965_commit_rxon(priv); 1556 iwl_commit_rxon(priv);
1555 1557
1556 iwl_rxon_add_station(priv, priv->bssid, 1); 1558 iwl_rxon_add_station(priv, priv->bssid, 1);
1557 1559
@@ -1561,7 +1563,7 @@ static void iwl4965_error_recovery(struct iwl_priv *priv)
1561 spin_unlock_irqrestore(&priv->lock, flags); 1563 spin_unlock_irqrestore(&priv->lock, flags);
1562} 1564}
1563 1565
1564static void iwl4965_irq_tasklet(struct iwl_priv *priv) 1566static void iwl_irq_tasklet(struct iwl_priv *priv)
1565{ 1567{
1566 u32 inta, handled = 0; 1568 u32 inta, handled = 0;
1567 u32 inta_fh; 1569 u32 inta_fh;
@@ -1607,9 +1609,9 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
1607 IWL_ERROR("Microcode HW error detected. Restarting.\n"); 1609 IWL_ERROR("Microcode HW error detected. Restarting.\n");
1608 1610
1609 /* Tell the device to stop sending interrupts */ 1611 /* Tell the device to stop sending interrupts */
1610 iwl4965_disable_interrupts(priv); 1612 iwl_disable_interrupts(priv);
1611 1613
1612 iwl4965_irq_handle_error(priv); 1614 iwl_irq_handle_error(priv);
1613 1615
1614 handled |= CSR_INT_BIT_HW_ERR; 1616 handled |= CSR_INT_BIT_HW_ERR;
1615 1617
@@ -1663,7 +1665,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
1663 if (inta & CSR_INT_BIT_SW_ERR) { 1665 if (inta & CSR_INT_BIT_SW_ERR) {
1664 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n", 1666 IWL_ERROR("Microcode SW error detected. Restarting 0x%X.\n",
1665 inta); 1667 inta);
1666 iwl4965_irq_handle_error(priv); 1668 iwl_irq_handle_error(priv);
1667 handled |= CSR_INT_BIT_SW_ERR; 1669 handled |= CSR_INT_BIT_SW_ERR;
1668 } 1670 }
1669 1671
@@ -1709,7 +1711,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
1709 /* Re-enable all interrupts */ 1711 /* Re-enable all interrupts */
1710 /* only Re-enable if diabled by irq */ 1712 /* only Re-enable if diabled by irq */
1711 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1713 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1712 iwl4965_enable_interrupts(priv); 1714 iwl_enable_interrupts(priv);
1713 1715
1714#ifdef CONFIG_IWLWIFI_DEBUG 1716#ifdef CONFIG_IWLWIFI_DEBUG
1715 if (priv->debug_level & (IWL_DL_ISR)) { 1717 if (priv->debug_level & (IWL_DL_ISR)) {
@@ -1723,7 +1725,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
1723 spin_unlock_irqrestore(&priv->lock, flags); 1725 spin_unlock_irqrestore(&priv->lock, flags);
1724} 1726}
1725 1727
1726static irqreturn_t iwl4965_isr(int irq, void *data) 1728static irqreturn_t iwl_isr(int irq, void *data)
1727{ 1729{
1728 struct iwl_priv *priv = data; 1730 struct iwl_priv *priv = data;
1729 u32 inta, inta_mask; 1731 u32 inta, inta_mask;
@@ -1764,7 +1766,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data)
1764 1766
1765 inta &= ~CSR_INT_BIT_SCD; 1767 inta &= ~CSR_INT_BIT_SCD;
1766 1768
1767 /* iwl4965_irq_tasklet() will service interrupts and re-enable them */ 1769 /* iwl_irq_tasklet() will service interrupts and re-enable them */
1768 if (likely(inta || inta_fh)) 1770 if (likely(inta || inta_fh))
1769 tasklet_schedule(&priv->irq_tasklet); 1771 tasklet_schedule(&priv->irq_tasklet);
1770 1772
@@ -1776,7 +1778,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data)
1776 /* re-enable interrupts here since we don't have anything to service. */ 1778 /* re-enable interrupts here since we don't have anything to service. */
1777 /* only Re-enable if diabled by irq */ 1779 /* only Re-enable if diabled by irq */
1778 if (test_bit(STATUS_INT_ENABLED, &priv->status)) 1780 if (test_bit(STATUS_INT_ENABLED, &priv->status))
1779 iwl4965_enable_interrupts(priv); 1781 iwl_enable_interrupts(priv);
1780 spin_unlock(&priv->lock); 1782 spin_unlock(&priv->lock);
1781 return IRQ_NONE; 1783 return IRQ_NONE;
1782} 1784}
@@ -1787,7 +1789,7 @@ static irqreturn_t iwl4965_isr(int irq, void *data)
1787 * 1789 *
1788 ******************************************************************************/ 1790 ******************************************************************************/
1789 1791
1790static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) 1792static void iwl_dealloc_ucode_pci(struct iwl_priv *priv)
1791{ 1793{
1792 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); 1794 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
1793 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); 1795 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
@@ -1797,7 +1799,7 @@ static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv)
1797 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); 1799 iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
1798} 1800}
1799 1801
1800static void iwl4965_nic_start(struct iwl_priv *priv) 1802static void iwl_nic_start(struct iwl_priv *priv)
1801{ 1803{
1802 /* Remove all resets to allow NIC to operate */ 1804 /* Remove all resets to allow NIC to operate */
1803 iwl_write32(priv, CSR_RESET, 0); 1805 iwl_write32(priv, CSR_RESET, 0);
@@ -1805,11 +1807,11 @@ static void iwl4965_nic_start(struct iwl_priv *priv)
1805 1807
1806 1808
1807/** 1809/**
1808 * iwl4965_read_ucode - Read uCode images from disk file. 1810 * iwl_read_ucode - Read uCode images from disk file.
1809 * 1811 *
1810 * Copy into buffers for card to fetch via bus-mastering 1812 * Copy into buffers for card to fetch via bus-mastering
1811 */ 1813 */
1812static int iwl4965_read_ucode(struct iwl_priv *priv) 1814static int iwl_read_ucode(struct iwl_priv *priv)
1813{ 1815{
1814 struct iwl_ucode *ucode; 1816 struct iwl_ucode *ucode;
1815 int ret; 1817 int ret;
@@ -1953,7 +1955,7 @@ static int iwl4965_read_ucode(struct iwl_priv *priv)
1953 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); 1955 priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
1954 1956
1955 /* Runtime data (2nd block) 1957 /* Runtime data (2nd block)
1956 * NOTE: Copy into backup buffer will be done in iwl4965_up() */ 1958 * NOTE: Copy into backup buffer will be done in iwl_up() */
1957 src = &ucode->data[inst_size]; 1959 src = &ucode->data[inst_size];
1958 len = priv->ucode_data.len; 1960 len = priv->ucode_data.len;
1959 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len); 1961 IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len);
@@ -1991,7 +1993,7 @@ static int iwl4965_read_ucode(struct iwl_priv *priv)
1991 err_pci_alloc: 1993 err_pci_alloc:
1992 IWL_ERROR("failed to allocate pci memory\n"); 1994 IWL_ERROR("failed to allocate pci memory\n");
1993 ret = -ENOMEM; 1995 ret = -ENOMEM;
1994 iwl4965_dealloc_ucode_pci(priv); 1996 iwl_dealloc_ucode_pci(priv);
1995 1997
1996 err_release: 1998 err_release:
1997 release_firmware(ucode_raw); 1999 release_firmware(ucode_raw);
@@ -2036,7 +2038,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
2036 goto restart; 2038 goto restart;
2037 } 2039 }
2038 2040
2039 /* After the ALIVE response, we can send host commands to 4965 uCode */ 2041 /* After the ALIVE response, we can send host commands to the uCode */
2040 set_bit(STATUS_ALIVE, &priv->status); 2042 set_bit(STATUS_ALIVE, &priv->status);
2041 2043
2042 if (iwl_is_rfkill(priv)) 2044 if (iwl_is_rfkill(priv))
@@ -2056,17 +2058,17 @@ static void iwl_alive_start(struct iwl_priv *priv)
2056 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2058 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2057 } else { 2059 } else {
2058 /* Initialize our rx_config data */ 2060 /* Initialize our rx_config data */
2059 iwl4965_connection_init_rx_config(priv); 2061 iwl_connection_init_rx_config(priv, priv->iw_mode);
2060 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2062 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2061 } 2063 }
2062 2064
2063 /* Configure Bluetooth device coexistence support */ 2065 /* Configure Bluetooth device coexistence support */
2064 iwl4965_send_bt_config(priv); 2066 iwl_send_bt_config(priv);
2065 2067
2066 iwl_reset_run_time_calib(priv); 2068 iwl_reset_run_time_calib(priv);
2067 2069
2068 /* Configure the adapter for unassociated operation */ 2070 /* Configure the adapter for unassociated operation */
2069 iwl4965_commit_rxon(priv); 2071 iwl_commit_rxon(priv);
2070 2072
2071 /* At this point, the NIC is initialized and operational */ 2073 /* At this point, the NIC is initialized and operational */
2072 iwl_rf_kill_ct_config(priv); 2074 iwl_rf_kill_ct_config(priv);
@@ -2078,12 +2080,12 @@ static void iwl_alive_start(struct iwl_priv *priv)
2078 wake_up_interruptible(&priv->wait_command_queue); 2080 wake_up_interruptible(&priv->wait_command_queue);
2079 2081
2080 if (priv->error_recovering) 2082 if (priv->error_recovering)
2081 iwl4965_error_recovery(priv); 2083 iwl_error_recovery(priv);
2082 2084
2083 iwl_power_update_mode(priv, 1); 2085 iwl_power_update_mode(priv, 1);
2084 2086
2085 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) 2087 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
2086 iwl4965_set_mode(priv, priv->iw_mode); 2088 iwl_set_mode(priv, priv->iw_mode);
2087 2089
2088 return; 2090 return;
2089 2091
@@ -2093,7 +2095,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
2093 2095
2094static void iwl_cancel_deferred_work(struct iwl_priv *priv); 2096static void iwl_cancel_deferred_work(struct iwl_priv *priv);
2095 2097
2096static void __iwl4965_down(struct iwl_priv *priv) 2098static void __iwl_down(struct iwl_priv *priv)
2097{ 2099{
2098 unsigned long flags; 2100 unsigned long flags;
2099 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); 2101 int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -2120,14 +2122,14 @@ static void __iwl4965_down(struct iwl_priv *priv)
2120 2122
2121 /* tell the device to stop sending interrupts */ 2123 /* tell the device to stop sending interrupts */
2122 spin_lock_irqsave(&priv->lock, flags); 2124 spin_lock_irqsave(&priv->lock, flags);
2123 iwl4965_disable_interrupts(priv); 2125 iwl_disable_interrupts(priv);
2124 spin_unlock_irqrestore(&priv->lock, flags); 2126 spin_unlock_irqrestore(&priv->lock, flags);
2125 iwl_synchronize_irq(priv); 2127 iwl_synchronize_irq(priv);
2126 2128
2127 if (priv->mac80211_registered) 2129 if (priv->mac80211_registered)
2128 ieee80211_stop_queues(priv->hw); 2130 ieee80211_stop_queues(priv->hw);
2129 2131
2130 /* If we have not previously called iwl4965_init() then 2132 /* If we have not previously called iwl_init() then
2131 * clear all bits but the RF Kill and SUSPEND bits and return */ 2133 * clear all bits but the RF Kill and SUSPEND bits and return */
2132 if (!iwl_is_init(priv)) { 2134 if (!iwl_is_init(priv)) {
2133 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 2135 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
@@ -2194,10 +2196,10 @@ static void __iwl4965_down(struct iwl_priv *priv)
2194 iwl_clear_free_frames(priv); 2196 iwl_clear_free_frames(priv);
2195} 2197}
2196 2198
2197static void iwl4965_down(struct iwl_priv *priv) 2199static void iwl_down(struct iwl_priv *priv)
2198{ 2200{
2199 mutex_lock(&priv->mutex); 2201 mutex_lock(&priv->mutex);
2200 __iwl4965_down(priv); 2202 __iwl_down(priv);
2201 mutex_unlock(&priv->mutex); 2203 mutex_unlock(&priv->mutex);
2202 2204
2203 iwl_cancel_deferred_work(priv); 2205 iwl_cancel_deferred_work(priv);
@@ -2205,7 +2207,7 @@ static void iwl4965_down(struct iwl_priv *priv)
2205 2207
2206#define MAX_HW_RESTARTS 5 2208#define MAX_HW_RESTARTS 5
2207 2209
2208static int __iwl4965_up(struct iwl_priv *priv) 2210static int __iwl_up(struct iwl_priv *priv)
2209{ 2211{
2210 int i; 2212 int i;
2211 int ret; 2213 int ret;
@@ -2227,7 +2229,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
2227 set_bit(STATUS_RF_KILL_HW, &priv->status); 2229 set_bit(STATUS_RF_KILL_HW, &priv->status);
2228 2230
2229 if (iwl_is_rfkill(priv)) { 2231 if (iwl_is_rfkill(priv)) {
2230 iwl4965_enable_interrupts(priv); 2232 iwl_enable_interrupts(priv);
2231 IWL_WARNING("Radio disabled by %s RF Kill switch\n", 2233 IWL_WARNING("Radio disabled by %s RF Kill switch\n",
2232 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); 2234 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW");
2233 return 0; 2235 return 0;
@@ -2254,7 +2256,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
2254 2256
2255 /* clear (again), then enable host interrupts */ 2257 /* clear (again), then enable host interrupts */
2256 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 2258 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
2257 iwl4965_enable_interrupts(priv); 2259 iwl_enable_interrupts(priv);
2258 2260
2259 /* really make sure rfkill handshake bits are cleared */ 2261 /* really make sure rfkill handshake bits are cleared */
2260 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 2262 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
@@ -2284,7 +2286,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
2284 clear_bit(STATUS_FW_ERROR, &priv->status); 2286 clear_bit(STATUS_FW_ERROR, &priv->status);
2285 2287
2286 /* start card; "initialize" will load runtime ucode */ 2288 /* start card; "initialize" will load runtime ucode */
2287 iwl4965_nic_start(priv); 2289 iwl_nic_start(priv);
2288 2290
2289 IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); 2291 IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
2290 2292
@@ -2292,7 +2294,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
2292 } 2294 }
2293 2295
2294 set_bit(STATUS_EXIT_PENDING, &priv->status); 2296 set_bit(STATUS_EXIT_PENDING, &priv->status);
2295 __iwl4965_down(priv); 2297 __iwl_down(priv);
2296 clear_bit(STATUS_EXIT_PENDING, &priv->status); 2298 clear_bit(STATUS_EXIT_PENDING, &priv->status);
2297 2299
2298 /* tried to restart and config the device for as long as our 2300 /* tried to restart and config the device for as long as our
@@ -2335,7 +2337,7 @@ static void iwl_bg_alive_start(struct work_struct *data)
2335 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); 2337 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
2336} 2338}
2337 2339
2338static void iwl4965_bg_rf_kill(struct work_struct *work) 2340static void iwl_bg_rf_kill(struct work_struct *work)
2339{ 2341{
2340 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); 2342 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill);
2341 2343
@@ -2369,7 +2371,7 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
2369 iwl_rfkill_set_hw_state(priv); 2371 iwl_rfkill_set_hw_state(priv);
2370} 2372}
2371 2373
2372static void iwl4965_bg_set_monitor(struct work_struct *work) 2374static void iwl_bg_set_monitor(struct work_struct *work)
2373{ 2375{
2374 struct iwl_priv *priv = container_of(work, 2376 struct iwl_priv *priv = container_of(work,
2375 struct iwl_priv, set_monitor); 2377 struct iwl_priv, set_monitor);
@@ -2379,16 +2381,16 @@ static void iwl4965_bg_set_monitor(struct work_struct *work)
2379 2381
2380 mutex_lock(&priv->mutex); 2382 mutex_lock(&priv->mutex);
2381 2383
2382 ret = iwl4965_set_mode(priv, NL80211_IFTYPE_MONITOR); 2384 ret = iwl_set_mode(priv, NL80211_IFTYPE_MONITOR);
2383
2384 if (ret) { 2385 if (ret) {
2385 if (ret == -EAGAIN) 2386 if (ret == -EAGAIN)
2386 IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n"); 2387 IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n");
2387 else 2388 else
2388 IWL_ERROR("iwl4965_set_mode() failed ret = %d\n", ret); 2389 IWL_ERROR("iwl_set_mode() failed ret = %d\n", ret);
2389 } 2390 }
2390 2391
2391 mutex_unlock(&priv->mutex); 2392 mutex_unlock(&priv->mutex);
2393 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
2392} 2394}
2393 2395
2394static void iwl_bg_run_time_calib_work(struct work_struct *work) 2396static void iwl_bg_run_time_calib_work(struct work_struct *work)
@@ -2414,7 +2416,7 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
2414 return; 2416 return;
2415} 2417}
2416 2418
2417static void iwl4965_bg_up(struct work_struct *data) 2419static void iwl_bg_up(struct work_struct *data)
2418{ 2420{
2419 struct iwl_priv *priv = container_of(data, struct iwl_priv, up); 2421 struct iwl_priv *priv = container_of(data, struct iwl_priv, up);
2420 2422
@@ -2422,23 +2424,23 @@ static void iwl4965_bg_up(struct work_struct *data)
2422 return; 2424 return;
2423 2425
2424 mutex_lock(&priv->mutex); 2426 mutex_lock(&priv->mutex);
2425 __iwl4965_up(priv); 2427 __iwl_up(priv);
2426 mutex_unlock(&priv->mutex); 2428 mutex_unlock(&priv->mutex);
2427 iwl_rfkill_set_hw_state(priv); 2429 iwl_rfkill_set_hw_state(priv);
2428} 2430}
2429 2431
2430static void iwl4965_bg_restart(struct work_struct *data) 2432static void iwl_bg_restart(struct work_struct *data)
2431{ 2433{
2432 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 2434 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
2433 2435
2434 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 2436 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2435 return; 2437 return;
2436 2438
2437 iwl4965_down(priv); 2439 iwl_down(priv);
2438 queue_work(priv->workqueue, &priv->up); 2440 queue_work(priv->workqueue, &priv->up);
2439} 2441}
2440 2442
2441static void iwl4965_bg_rx_replenish(struct work_struct *data) 2443static void iwl_bg_rx_replenish(struct work_struct *data)
2442{ 2444{
2443 struct iwl_priv *priv = 2445 struct iwl_priv *priv =
2444 container_of(data, struct iwl_priv, rx_replenish); 2446 container_of(data, struct iwl_priv, rx_replenish);
@@ -2453,7 +2455,7 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)
2453 2455
2454#define IWL_DELAY_NEXT_SCAN (HZ*2) 2456#define IWL_DELAY_NEXT_SCAN (HZ*2)
2455 2457
2456static void iwl4965_post_associate(struct iwl_priv *priv) 2458static void iwl_post_associate(struct iwl_priv *priv)
2457{ 2459{
2458 struct ieee80211_conf *conf = NULL; 2460 struct ieee80211_conf *conf = NULL;
2459 int ret = 0; 2461 int ret = 0;
@@ -2481,7 +2483,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
2481 conf = ieee80211_get_hw_conf(priv->hw); 2483 conf = ieee80211_get_hw_conf(priv->hw);
2482 2484
2483 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2485 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2484 iwl4965_commit_rxon(priv); 2486 iwl_commit_rxon(priv);
2485 2487
2486 iwl_setup_rxon_timing(priv); 2488 iwl_setup_rxon_timing(priv);
2487 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, 2489 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
@@ -2516,7 +2518,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
2516 2518
2517 } 2519 }
2518 2520
2519 iwl4965_commit_rxon(priv); 2521 iwl_commit_rxon(priv);
2520 2522
2521 switch (priv->iw_mode) { 2523 switch (priv->iw_mode) {
2522 case NL80211_IFTYPE_STATION: 2524 case NL80211_IFTYPE_STATION:
@@ -2528,7 +2530,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
2528 priv->assoc_id = 1; 2530 priv->assoc_id = 1;
2529 2531
2530 iwl_rxon_add_station(priv, priv->bssid, 0); 2532 iwl_rxon_add_station(priv, priv->bssid, 0);
2531 iwl4965_send_beacon_cmd(priv); 2533 iwl_send_beacon_cmd(priv);
2532 2534
2533 break; 2535 break;
2534 2536
@@ -2565,7 +2567,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv)
2565 2567
2566#define UCODE_READY_TIMEOUT (4 * HZ) 2568#define UCODE_READY_TIMEOUT (4 * HZ)
2567 2569
2568static int iwl4965_mac_start(struct ieee80211_hw *hw) 2570static int iwl_mac_start(struct ieee80211_hw *hw)
2569{ 2571{
2570 struct iwl_priv *priv = hw->priv; 2572 struct iwl_priv *priv = hw->priv;
2571 int ret; 2573 int ret;
@@ -2587,7 +2589,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2587 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); 2589 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
2588 } 2590 }
2589 2591
2590 ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, 2592 ret = request_irq(priv->pci_dev->irq, iwl_isr, IRQF_SHARED,
2591 DRV_NAME, priv); 2593 DRV_NAME, priv);
2592 if (ret) { 2594 if (ret) {
2593 IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq); 2595 IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq);
@@ -2602,7 +2604,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2602 * ucode filename and max sizes are card-specific. */ 2604 * ucode filename and max sizes are card-specific. */
2603 2605
2604 if (!priv->ucode_code.len) { 2606 if (!priv->ucode_code.len) {
2605 ret = iwl4965_read_ucode(priv); 2607 ret = iwl_read_ucode(priv);
2606 if (ret) { 2608 if (ret) {
2607 IWL_ERROR("Could not read microcode: %d\n", ret); 2609 IWL_ERROR("Could not read microcode: %d\n", ret);
2608 mutex_unlock(&priv->mutex); 2610 mutex_unlock(&priv->mutex);
@@ -2610,7 +2612,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2610 } 2612 }
2611 } 2613 }
2612 2614
2613 ret = __iwl4965_up(priv); 2615 ret = __iwl_up(priv);
2614 2616
2615 mutex_unlock(&priv->mutex); 2617 mutex_unlock(&priv->mutex);
2616 2618
@@ -2656,7 +2658,7 @@ out_disable_msi:
2656 return ret; 2658 return ret;
2657} 2659}
2658 2660
2659static void iwl4965_mac_stop(struct ieee80211_hw *hw) 2661static void iwl_mac_stop(struct ieee80211_hw *hw)
2660{ 2662{
2661 struct iwl_priv *priv = hw->priv; 2663 struct iwl_priv *priv = hw->priv;
2662 2664
@@ -2678,7 +2680,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
2678 mutex_unlock(&priv->mutex); 2680 mutex_unlock(&priv->mutex);
2679 } 2681 }
2680 2682
2681 iwl4965_down(priv); 2683 iwl_down(priv);
2682 2684
2683 flush_workqueue(priv->workqueue); 2685 flush_workqueue(priv->workqueue);
2684 free_irq(priv->pci_dev->irq, priv); 2686 free_irq(priv->pci_dev->irq, priv);
@@ -2689,7 +2691,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
2689 IWL_DEBUG_MAC80211("leave\n"); 2691 IWL_DEBUG_MAC80211("leave\n");
2690} 2692}
2691 2693
2692static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2694static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2693{ 2695{
2694 struct iwl_priv *priv = hw->priv; 2696 struct iwl_priv *priv = hw->priv;
2695 2697
@@ -2705,7 +2707,7 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2705 return 0; 2707 return 0;
2706} 2708}
2707 2709
2708static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, 2710static int iwl_mac_add_interface(struct ieee80211_hw *hw,
2709 struct ieee80211_if_init_conf *conf) 2711 struct ieee80211_if_init_conf *conf)
2710{ 2712{
2711 struct iwl_priv *priv = hw->priv; 2713 struct iwl_priv *priv = hw->priv;
@@ -2720,6 +2722,7 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
2720 2722
2721 spin_lock_irqsave(&priv->lock, flags); 2723 spin_lock_irqsave(&priv->lock, flags);
2722 priv->vif = conf->vif; 2724 priv->vif = conf->vif;
2725 priv->iw_mode = conf->type;
2723 2726
2724 spin_unlock_irqrestore(&priv->lock, flags); 2727 spin_unlock_irqrestore(&priv->lock, flags);
2725 2728
@@ -2730,7 +2733,7 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
2730 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); 2733 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
2731 } 2734 }
2732 2735
2733 if (iwl4965_set_mode(priv, conf->type) == -EAGAIN) 2736 if (iwl_set_mode(priv, conf->type) == -EAGAIN)
2734 /* we are not ready, will run again when ready */ 2737 /* we are not ready, will run again when ready */
2735 set_bit(STATUS_MODE_PENDING, &priv->status); 2738 set_bit(STATUS_MODE_PENDING, &priv->status);
2736 2739
@@ -2741,13 +2744,13 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
2741} 2744}
2742 2745
2743/** 2746/**
2744 * iwl4965_mac_config - mac80211 config callback 2747 * iwl_mac_config - mac80211 config callback
2745 * 2748 *
2746 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to 2749 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
2747 * be set inappropriately and the driver currently sets the hardware up to 2750 * be set inappropriately and the driver currently sets the hardware up to
2748 * use it whenever needed. 2751 * use it whenever needed.
2749 */ 2752 */
2750static int iwl4965_mac_config(struct ieee80211_hw *hw, u32 changed) 2753static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2751{ 2754{
2752 struct iwl_priv *priv = hw->priv; 2755 struct iwl_priv *priv = hw->priv;
2753 const struct iwl_channel_info *ch_info; 2756 const struct iwl_channel_info *ch_info;
@@ -2818,13 +2821,13 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, u32 changed)
2818 /* The list of supported rates and rate mask can be different 2821 /* The list of supported rates and rate mask can be different
2819 * for each band; since the band may have changed, reset 2822 * for each band; since the band may have changed, reset
2820 * the rate mask to what mac80211 lists */ 2823 * the rate mask to what mac80211 lists */
2821 iwl4965_set_rate(priv); 2824 iwl_set_rate(priv);
2822 2825
2823 spin_unlock_irqrestore(&priv->lock, flags); 2826 spin_unlock_irqrestore(&priv->lock, flags);
2824 2827
2825#ifdef IEEE80211_CONF_CHANNEL_SWITCH 2828#ifdef IEEE80211_CONF_CHANNEL_SWITCH
2826 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { 2829 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
2827 iwl4965_hw_channel_switch(priv, conf->channel); 2830 iwl_hw_channel_switch(priv, conf->channel);
2828 goto out; 2831 goto out;
2829 } 2832 }
2830#endif 2833#endif
@@ -2852,11 +2855,11 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, u32 changed)
2852 2855
2853 iwl_set_tx_power(priv, conf->power_level, false); 2856 iwl_set_tx_power(priv, conf->power_level, false);
2854 2857
2855 iwl4965_set_rate(priv); 2858 iwl_set_rate(priv);
2856 2859
2857 if (memcmp(&priv->active_rxon, 2860 if (memcmp(&priv->active_rxon,
2858 &priv->staging_rxon, sizeof(priv->staging_rxon))) 2861 &priv->staging_rxon, sizeof(priv->staging_rxon)))
2859 iwl4965_commit_rxon(priv); 2862 iwl_commit_rxon(priv);
2860 else 2863 else
2861 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 2864 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
2862 2865
@@ -2867,7 +2870,7 @@ out:
2867 return ret; 2870 return ret;
2868} 2871}
2869 2872
2870static void iwl4965_config_ap(struct iwl_priv *priv) 2873static void iwl_config_ap(struct iwl_priv *priv)
2871{ 2874{
2872 int ret = 0; 2875 int ret = 0;
2873 unsigned long flags; 2876 unsigned long flags;
@@ -2880,7 +2883,7 @@ static void iwl4965_config_ap(struct iwl_priv *priv)
2880 2883
2881 /* RXON - unassoc (to set timing command) */ 2884 /* RXON - unassoc (to set timing command) */
2882 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2885 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2883 iwl4965_commit_rxon(priv); 2886 iwl_commit_rxon(priv);
2884 2887
2885 /* RXON Timing */ 2888 /* RXON Timing */
2886 iwl_setup_rxon_timing(priv); 2889 iwl_setup_rxon_timing(priv);
@@ -2916,13 +2919,13 @@ static void iwl4965_config_ap(struct iwl_priv *priv)
2916 } 2919 }
2917 /* restore RXON assoc */ 2920 /* restore RXON assoc */
2918 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 2921 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
2919 iwl4965_commit_rxon(priv); 2922 iwl_commit_rxon(priv);
2920 spin_lock_irqsave(&priv->lock, flags); 2923 spin_lock_irqsave(&priv->lock, flags);
2921 iwl_activate_qos(priv, 1); 2924 iwl_activate_qos(priv, 1);
2922 spin_unlock_irqrestore(&priv->lock, flags); 2925 spin_unlock_irqrestore(&priv->lock, flags);
2923 iwl_rxon_add_station(priv, iwl_bcast_addr, 0); 2926 iwl_rxon_add_station(priv, iwl_bcast_addr, 0);
2924 } 2927 }
2925 iwl4965_send_beacon_cmd(priv); 2928 iwl_send_beacon_cmd(priv);
2926 2929
2927 /* FIXME - we need to add code here to detect a totally new 2930 /* FIXME - we need to add code here to detect a totally new
2928 * configuration, reset the AP, unassoc, rxon timing, assoc, 2931 * configuration, reset the AP, unassoc, rxon timing, assoc,
@@ -2930,14 +2933,13 @@ static void iwl4965_config_ap(struct iwl_priv *priv)
2930} 2933}
2931 2934
2932/* temporary */ 2935/* temporary */
2933static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); 2936static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb);
2934 2937
2935static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, 2938static int iwl_mac_config_interface(struct ieee80211_hw *hw,
2936 struct ieee80211_vif *vif, 2939 struct ieee80211_vif *vif,
2937 struct ieee80211_if_conf *conf) 2940 struct ieee80211_if_conf *conf)
2938{ 2941{
2939 struct iwl_priv *priv = hw->priv; 2942 struct iwl_priv *priv = hw->priv;
2940 unsigned long flags;
2941 int rc; 2943 int rc;
2942 2944
2943 if (conf == NULL) 2945 if (conf == NULL)
@@ -2953,18 +2955,11 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
2953 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); 2955 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
2954 if (!beacon) 2956 if (!beacon)
2955 return -ENOMEM; 2957 return -ENOMEM;
2956 rc = iwl4965_mac_beacon_update(hw, beacon); 2958 rc = iwl_mac_beacon_update(hw, beacon);
2957 if (rc) 2959 if (rc)
2958 return rc; 2960 return rc;
2959 } 2961 }
2960 2962
2961 if ((priv->iw_mode == NL80211_IFTYPE_AP) &&
2962 (!conf->ssid_len)) {
2963 IWL_DEBUG_MAC80211
2964 ("Leaving in AP mode because HostAPD is not ready.\n");
2965 return 0;
2966 }
2967
2968 if (!iwl_is_alive(priv)) 2963 if (!iwl_is_alive(priv))
2969 return -EAGAIN; 2964 return -EAGAIN;
2970 2965
@@ -3016,9 +3011,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
3016 memcpy(priv->bssid, conf->bssid, ETH_ALEN); 3011 memcpy(priv->bssid, conf->bssid, ETH_ALEN);
3017 3012
3018 if (priv->iw_mode == NL80211_IFTYPE_AP) 3013 if (priv->iw_mode == NL80211_IFTYPE_AP)
3019 iwl4965_config_ap(priv); 3014 iwl_config_ap(priv);
3020 else { 3015 else {
3021 rc = iwl4965_commit_rxon(priv); 3016 rc = iwl_commit_rxon(priv);
3022 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) 3017 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc)
3023 iwl_rxon_add_station( 3018 iwl_rxon_add_station(
3024 priv, priv->active_rxon.bssid_addr, 1); 3019 priv, priv->active_rxon.bssid_addr, 1);
@@ -3027,26 +3022,17 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
3027 } else { 3022 } else {
3028 iwl_scan_cancel_timeout(priv, 100); 3023 iwl_scan_cancel_timeout(priv, 100);
3029 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3024 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3030 iwl4965_commit_rxon(priv); 3025 iwl_commit_rxon(priv);
3031 } 3026 }
3032 3027
3033 done: 3028 done:
3034 spin_lock_irqsave(&priv->lock, flags);
3035 if (!conf->ssid_len)
3036 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
3037 else
3038 memcpy(priv->essid, conf->ssid, conf->ssid_len);
3039
3040 priv->essid_len = conf->ssid_len;
3041 spin_unlock_irqrestore(&priv->lock, flags);
3042
3043 IWL_DEBUG_MAC80211("leave\n"); 3029 IWL_DEBUG_MAC80211("leave\n");
3044 mutex_unlock(&priv->mutex); 3030 mutex_unlock(&priv->mutex);
3045 3031
3046 return 0; 3032 return 0;
3047} 3033}
3048 3034
3049static void iwl4965_configure_filter(struct ieee80211_hw *hw, 3035static void iwl_configure_filter(struct ieee80211_hw *hw,
3050 unsigned int changed_flags, 3036 unsigned int changed_flags,
3051 unsigned int *total_flags, 3037 unsigned int *total_flags,
3052 int mc_count, struct dev_addr_list *mc_list) 3038 int mc_count, struct dev_addr_list *mc_list)
@@ -3065,7 +3051,7 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw,
3065 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 3051 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
3066} 3052}
3067 3053
3068static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, 3054static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
3069 struct ieee80211_if_init_conf *conf) 3055 struct ieee80211_if_init_conf *conf)
3070{ 3056{
3071 struct iwl_priv *priv = hw->priv; 3057 struct iwl_priv *priv = hw->priv;
@@ -3077,13 +3063,11 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
3077 if (iwl_is_ready_rf(priv)) { 3063 if (iwl_is_ready_rf(priv)) {
3078 iwl_scan_cancel_timeout(priv, 100); 3064 iwl_scan_cancel_timeout(priv, 100);
3079 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3065 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3080 iwl4965_commit_rxon(priv); 3066 iwl_commit_rxon(priv);
3081 } 3067 }
3082 if (priv->vif == conf->vif) { 3068 if (priv->vif == conf->vif) {
3083 priv->vif = NULL; 3069 priv->vif = NULL;
3084 memset(priv->bssid, 0, ETH_ALEN); 3070 memset(priv->bssid, 0, ETH_ALEN);
3085 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
3086 priv->essid_len = 0;
3087 } 3071 }
3088 mutex_unlock(&priv->mutex); 3072 mutex_unlock(&priv->mutex);
3089 3073
@@ -3092,7 +3076,7 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
3092} 3076}
3093 3077
3094#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) 3078#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
3095static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, 3079static void iwl_bss_info_changed(struct ieee80211_hw *hw,
3096 struct ieee80211_vif *vif, 3080 struct ieee80211_vif *vif,
3097 struct ieee80211_bss_conf *bss_conf, 3081 struct ieee80211_bss_conf *bss_conf,
3098 u32 changes) 3082 u32 changes)
@@ -3119,7 +3103,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
3119 } 3103 }
3120 3104
3121 if (changes & BSS_CHANGED_HT) { 3105 if (changes & BSS_CHANGED_HT) {
3122 iwl4965_ht_conf(priv, bss_conf); 3106 iwl_ht_conf(priv, bss_conf);
3123 iwl_set_rxon_chain(priv); 3107 iwl_set_rxon_chain(priv);
3124 } 3108 }
3125 3109
@@ -3142,7 +3126,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw,
3142 priv->next_scan_jiffies = jiffies + 3126 priv->next_scan_jiffies = jiffies +
3143 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; 3127 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
3144 mutex_lock(&priv->mutex); 3128 mutex_lock(&priv->mutex);
3145 iwl4965_post_associate(priv); 3129 iwl_post_associate(priv);
3146 mutex_unlock(&priv->mutex); 3130 mutex_unlock(&priv->mutex);
3147 } else { 3131 } else {
3148 priv->assoc_id = 0; 3132 priv->assoc_id = 0;
@@ -3218,7 +3202,7 @@ out_unlock:
3218 return ret; 3202 return ret;
3219} 3203}
3220 3204
3221static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, 3205static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
3222 struct ieee80211_key_conf *keyconf, const u8 *addr, 3206 struct ieee80211_key_conf *keyconf, const u8 *addr,
3223 u32 iv32, u16 *phase1key) 3207 u32 iv32, u16 *phase1key)
3224{ 3208{
@@ -3269,7 +3253,7 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
3269 IWL_DEBUG_MAC80211("leave\n"); 3253 IWL_DEBUG_MAC80211("leave\n");
3270} 3254}
3271 3255
3272static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, 3256static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3273 const u8 *local_addr, const u8 *addr, 3257 const u8 *local_addr, const u8 *addr,
3274 struct ieee80211_key_conf *key) 3258 struct ieee80211_key_conf *key)
3275{ 3259{
@@ -3340,7 +3324,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3340 return ret; 3324 return ret;
3341} 3325}
3342 3326
3343static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, 3327static int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
3344 const struct ieee80211_tx_queue_params *params) 3328 const struct ieee80211_tx_queue_params *params)
3345{ 3329{
3346 struct iwl_priv *priv = hw->priv; 3330 struct iwl_priv *priv = hw->priv;
@@ -3388,7 +3372,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
3388 return 0; 3372 return 0;
3389} 3373}
3390 3374
3391static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 3375static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3392 enum ieee80211_ampdu_mlme_action action, 3376 enum ieee80211_ampdu_mlme_action action,
3393 struct ieee80211_sta *sta, u16 tid, u16 *ssn) 3377 struct ieee80211_sta *sta, u16 tid, u16 *ssn)
3394{ 3378{
@@ -3420,7 +3404,7 @@ static int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
3420 } 3404 }
3421 return 0; 3405 return 0;
3422} 3406}
3423static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, 3407static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
3424 struct ieee80211_tx_queue_stats *stats) 3408 struct ieee80211_tx_queue_stats *stats)
3425{ 3409{
3426 struct iwl_priv *priv = hw->priv; 3410 struct iwl_priv *priv = hw->priv;
@@ -3455,7 +3439,7 @@ static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw,
3455 return 0; 3439 return 0;
3456} 3440}
3457 3441
3458static int iwl4965_mac_get_stats(struct ieee80211_hw *hw, 3442static int iwl_mac_get_stats(struct ieee80211_hw *hw,
3459 struct ieee80211_low_level_stats *stats) 3443 struct ieee80211_low_level_stats *stats)
3460{ 3444{
3461 struct iwl_priv *priv = hw->priv; 3445 struct iwl_priv *priv = hw->priv;
@@ -3467,7 +3451,7 @@ static int iwl4965_mac_get_stats(struct ieee80211_hw *hw,
3467 return 0; 3451 return 0;
3468} 3452}
3469 3453
3470static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) 3454static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
3471{ 3455{
3472 struct iwl_priv *priv = hw->priv; 3456 struct iwl_priv *priv = hw->priv;
3473 unsigned long flags; 3457 unsigned long flags;
@@ -3511,7 +3495,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
3511 if (priv->iw_mode != NL80211_IFTYPE_AP) { 3495 if (priv->iw_mode != NL80211_IFTYPE_AP) {
3512 iwl_scan_cancel_timeout(priv, 100); 3496 iwl_scan_cancel_timeout(priv, 100);
3513 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3497 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3514 iwl4965_commit_rxon(priv); 3498 iwl_commit_rxon(priv);
3515 } 3499 }
3516 3500
3517 iwl_power_update_mode(priv, 0); 3501 iwl_power_update_mode(priv, 0);
@@ -3534,14 +3518,14 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
3534 return; 3518 return;
3535 } 3519 }
3536 3520
3537 iwl4965_set_rate(priv); 3521 iwl_set_rate(priv);
3538 3522
3539 mutex_unlock(&priv->mutex); 3523 mutex_unlock(&priv->mutex);
3540 3524
3541 IWL_DEBUG_MAC80211("leave\n"); 3525 IWL_DEBUG_MAC80211("leave\n");
3542} 3526}
3543 3527
3544static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) 3528static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3545{ 3529{
3546 struct iwl_priv *priv = hw->priv; 3530 struct iwl_priv *priv = hw->priv;
3547 unsigned long flags; 3531 unsigned long flags;
@@ -3578,7 +3562,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
3578 3562
3579 iwl_reset_qos(priv); 3563 iwl_reset_qos(priv);
3580 3564
3581 iwl4965_post_associate(priv); 3565 iwl_post_associate(priv);
3582 3566
3583 mutex_unlock(&priv->mutex); 3567 mutex_unlock(&priv->mutex);
3584 3568
@@ -3732,7 +3716,7 @@ static ssize_t store_flags(struct device *d,
3732 else { 3716 else {
3733 IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags); 3717 IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags);
3734 priv->staging_rxon.flags = cpu_to_le32(flags); 3718 priv->staging_rxon.flags = cpu_to_le32(flags);
3735 iwl4965_commit_rxon(priv); 3719 iwl_commit_rxon(priv);
3736 } 3720 }
3737 } 3721 }
3738 mutex_unlock(&priv->mutex); 3722 mutex_unlock(&priv->mutex);
@@ -3773,7 +3757,7 @@ static ssize_t store_filter_flags(struct device *d,
3773 "0x%04X\n", filter_flags); 3757 "0x%04X\n", filter_flags);
3774 priv->staging_rxon.filter_flags = 3758 priv->staging_rxon.filter_flags =
3775 cpu_to_le32(filter_flags); 3759 cpu_to_le32(filter_flags);
3776 iwl4965_commit_rxon(priv); 3760 iwl_commit_rxon(priv);
3777 } 3761 }
3778 } 3762 }
3779 mutex_unlock(&priv->mutex); 3763 mutex_unlock(&priv->mutex);
@@ -3848,7 +3832,7 @@ static ssize_t store_measurement(struct device *d,
3848 3832
3849 IWL_DEBUG_INFO("Invoking measurement of type %d on " 3833 IWL_DEBUG_INFO("Invoking measurement of type %d on "
3850 "channel %d (for '%s')\n", type, params.channel, buf); 3834 "channel %d (for '%s')\n", type, params.channel, buf);
3851 iwl4965_get_measurement(priv, &params, type); 3835 iwl_get_measurement(priv, &params, type);
3852 3836
3853 return count; 3837 return count;
3854} 3838}
@@ -4068,12 +4052,12 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
4068 4052
4069 init_waitqueue_head(&priv->wait_command_queue); 4053 init_waitqueue_head(&priv->wait_command_queue);
4070 4054
4071 INIT_WORK(&priv->up, iwl4965_bg_up); 4055 INIT_WORK(&priv->up, iwl_bg_up);
4072 INIT_WORK(&priv->restart, iwl4965_bg_restart); 4056 INIT_WORK(&priv->restart, iwl_bg_restart);
4073 INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish); 4057 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish);
4074 INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); 4058 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
4075 INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); 4059 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
4076 INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor); 4060 INIT_WORK(&priv->set_monitor, iwl_bg_set_monitor);
4077 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); 4061 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
4078 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 4062 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start);
4079 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 4063 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start);
@@ -4086,10 +4070,10 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
4086 4070
4087 init_timer(&priv->statistics_periodic); 4071 init_timer(&priv->statistics_periodic);
4088 priv->statistics_periodic.data = (unsigned long)priv; 4072 priv->statistics_periodic.data = (unsigned long)priv;
4089 priv->statistics_periodic.function = iwl4965_bg_statistics_periodic; 4073 priv->statistics_periodic.function = iwl_bg_statistics_periodic;
4090 4074
4091 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 4075 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
4092 iwl4965_irq_tasklet, (unsigned long)priv); 4076 iwl_irq_tasklet, (unsigned long)priv);
4093} 4077}
4094 4078
4095static void iwl_cancel_deferred_work(struct iwl_priv *priv) 4079static void iwl_cancel_deferred_work(struct iwl_priv *priv)
@@ -4105,7 +4089,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
4105 del_timer_sync(&priv->statistics_periodic); 4089 del_timer_sync(&priv->statistics_periodic);
4106} 4090}
4107 4091
4108static struct attribute *iwl4965_sysfs_entries[] = { 4092static struct attribute *iwl_sysfs_entries[] = {
4109 &dev_attr_channels.attr, 4093 &dev_attr_channels.attr,
4110 &dev_attr_flags.attr, 4094 &dev_attr_flags.attr,
4111 &dev_attr_filter_flags.attr, 4095 &dev_attr_filter_flags.attr,
@@ -4126,32 +4110,32 @@ static struct attribute *iwl4965_sysfs_entries[] = {
4126 NULL 4110 NULL
4127}; 4111};
4128 4112
4129static struct attribute_group iwl4965_attribute_group = { 4113static struct attribute_group iwl_attribute_group = {
4130 .name = NULL, /* put in device directory */ 4114 .name = NULL, /* put in device directory */
4131 .attrs = iwl4965_sysfs_entries, 4115 .attrs = iwl_sysfs_entries,
4132}; 4116};
4133 4117
4134static struct ieee80211_ops iwl4965_hw_ops = { 4118static struct ieee80211_ops iwl_hw_ops = {
4135 .tx = iwl4965_mac_tx, 4119 .tx = iwl_mac_tx,
4136 .start = iwl4965_mac_start, 4120 .start = iwl_mac_start,
4137 .stop = iwl4965_mac_stop, 4121 .stop = iwl_mac_stop,
4138 .add_interface = iwl4965_mac_add_interface, 4122 .add_interface = iwl_mac_add_interface,
4139 .remove_interface = iwl4965_mac_remove_interface, 4123 .remove_interface = iwl_mac_remove_interface,
4140 .config = iwl4965_mac_config, 4124 .config = iwl_mac_config,
4141 .config_interface = iwl4965_mac_config_interface, 4125 .config_interface = iwl_mac_config_interface,
4142 .configure_filter = iwl4965_configure_filter, 4126 .configure_filter = iwl_configure_filter,
4143 .set_key = iwl4965_mac_set_key, 4127 .set_key = iwl_mac_set_key,
4144 .update_tkip_key = iwl4965_mac_update_tkip_key, 4128 .update_tkip_key = iwl_mac_update_tkip_key,
4145 .get_stats = iwl4965_mac_get_stats, 4129 .get_stats = iwl_mac_get_stats,
4146 .get_tx_stats = iwl4965_mac_get_tx_stats, 4130 .get_tx_stats = iwl_mac_get_tx_stats,
4147 .conf_tx = iwl4965_mac_conf_tx, 4131 .conf_tx = iwl_mac_conf_tx,
4148 .reset_tsf = iwl4965_mac_reset_tsf, 4132 .reset_tsf = iwl_mac_reset_tsf,
4149 .bss_info_changed = iwl4965_bss_info_changed, 4133 .bss_info_changed = iwl_bss_info_changed,
4150 .ampdu_action = iwl4965_mac_ampdu_action, 4134 .ampdu_action = iwl_mac_ampdu_action,
4151 .hw_scan = iwl_mac_hw_scan 4135 .hw_scan = iwl_mac_hw_scan
4152}; 4136};
4153 4137
4154static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 4138static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4155{ 4139{
4156 int err = 0; 4140 int err = 0;
4157 struct iwl_priv *priv; 4141 struct iwl_priv *priv;
@@ -4169,10 +4153,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4169 if (cfg->mod_params->debug & IWL_DL_INFO) 4153 if (cfg->mod_params->debug & IWL_DL_INFO)
4170 dev_printk(KERN_DEBUG, &(pdev->dev), 4154 dev_printk(KERN_DEBUG, &(pdev->dev),
4171 "Disabling hw_scan\n"); 4155 "Disabling hw_scan\n");
4172 iwl4965_hw_ops.hw_scan = NULL; 4156 iwl_hw_ops.hw_scan = NULL;
4173 } 4157 }
4174 4158
4175 hw = iwl_alloc_all(cfg, &iwl4965_hw_ops); 4159 hw = iwl_alloc_all(cfg, &iwl_hw_ops);
4176 if (!hw) { 4160 if (!hw) {
4177 err = -ENOMEM; 4161 err = -ENOMEM;
4178 goto out; 4162 goto out;
@@ -4300,10 +4284,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4300 * 8. Setup services 4284 * 8. Setup services
4301 ********************/ 4285 ********************/
4302 spin_lock_irqsave(&priv->lock, flags); 4286 spin_lock_irqsave(&priv->lock, flags);
4303 iwl4965_disable_interrupts(priv); 4287 iwl_disable_interrupts(priv);
4304 spin_unlock_irqrestore(&priv->lock, flags); 4288 spin_unlock_irqrestore(&priv->lock, flags);
4305 4289
4306 err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); 4290 err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group);
4307 if (err) { 4291 if (err) {
4308 IWL_ERROR("failed to create sysfs device attributes\n"); 4292 IWL_ERROR("failed to create sysfs device attributes\n");
4309 goto out_uninit_drv; 4293 goto out_uninit_drv;
@@ -4339,7 +4323,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4339 return 0; 4323 return 0;
4340 4324
4341 out_remove_sysfs: 4325 out_remove_sysfs:
4342 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); 4326 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
4343 out_uninit_drv: 4327 out_uninit_drv:
4344 iwl_uninit_drv(priv); 4328 iwl_uninit_drv(priv);
4345 out_free_eeprom: 4329 out_free_eeprom:
@@ -4357,7 +4341,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4357 return err; 4341 return err;
4358} 4342}
4359 4343
4360static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) 4344static void __devexit iwl_pci_remove(struct pci_dev *pdev)
4361{ 4345{
4362 struct iwl_priv *priv = pci_get_drvdata(pdev); 4346 struct iwl_priv *priv = pci_get_drvdata(pdev);
4363 unsigned long flags; 4347 unsigned long flags;
@@ -4368,10 +4352,10 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4368 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 4352 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
4369 4353
4370 iwl_dbgfs_unregister(priv); 4354 iwl_dbgfs_unregister(priv);
4371 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); 4355 sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
4372 4356
4373 /* ieee80211_unregister_hw call wil cause iwl4965_mac_stop to 4357 /* ieee80211_unregister_hw call wil cause iwl_mac_stop to
4374 * to be called and iwl4965_down since we are removing the device 4358 * to be called and iwl_down since we are removing the device
4375 * we need to set STATUS_EXIT_PENDING bit. 4359 * we need to set STATUS_EXIT_PENDING bit.
4376 */ 4360 */
4377 set_bit(STATUS_EXIT_PENDING, &priv->status); 4361 set_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -4379,20 +4363,20 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4379 ieee80211_unregister_hw(priv->hw); 4363 ieee80211_unregister_hw(priv->hw);
4380 priv->mac80211_registered = 0; 4364 priv->mac80211_registered = 0;
4381 } else { 4365 } else {
4382 iwl4965_down(priv); 4366 iwl_down(priv);
4383 } 4367 }
4384 4368
4385 /* make sure we flush any pending irq or 4369 /* make sure we flush any pending irq or
4386 * tasklet for the driver 4370 * tasklet for the driver
4387 */ 4371 */
4388 spin_lock_irqsave(&priv->lock, flags); 4372 spin_lock_irqsave(&priv->lock, flags);
4389 iwl4965_disable_interrupts(priv); 4373 iwl_disable_interrupts(priv);
4390 spin_unlock_irqrestore(&priv->lock, flags); 4374 spin_unlock_irqrestore(&priv->lock, flags);
4391 4375
4392 iwl_synchronize_irq(priv); 4376 iwl_synchronize_irq(priv);
4393 4377
4394 iwl_rfkill_unregister(priv); 4378 iwl_rfkill_unregister(priv);
4395 iwl4965_dealloc_ucode_pci(priv); 4379 iwl_dealloc_ucode_pci(priv);
4396 4380
4397 if (priv->rxq.bd) 4381 if (priv->rxq.bd)
4398 iwl_rx_queue_free(priv, &priv->rxq); 4382 iwl_rx_queue_free(priv, &priv->rxq);
@@ -4405,7 +4389,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4405 /*netif_stop_queue(dev); */ 4389 /*netif_stop_queue(dev); */
4406 flush_workqueue(priv->workqueue); 4390 flush_workqueue(priv->workqueue);
4407 4391
4408 /* ieee80211_unregister_hw calls iwl4965_mac_stop, which flushes 4392 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
4409 * priv->workqueue... so we can't take down the workqueue 4393 * priv->workqueue... so we can't take down the workqueue
4410 * until now... */ 4394 * until now... */
4411 destroy_workqueue(priv->workqueue); 4395 destroy_workqueue(priv->workqueue);
@@ -4426,13 +4410,13 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4426 4410
4427#ifdef CONFIG_PM 4411#ifdef CONFIG_PM
4428 4412
4429static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) 4413static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
4430{ 4414{
4431 struct iwl_priv *priv = pci_get_drvdata(pdev); 4415 struct iwl_priv *priv = pci_get_drvdata(pdev);
4432 4416
4433 if (priv->is_open) { 4417 if (priv->is_open) {
4434 set_bit(STATUS_IN_SUSPEND, &priv->status); 4418 set_bit(STATUS_IN_SUSPEND, &priv->status);
4435 iwl4965_mac_stop(priv->hw); 4419 iwl_mac_stop(priv->hw);
4436 priv->is_open = 1; 4420 priv->is_open = 1;
4437 } 4421 }
4438 4422
@@ -4441,14 +4425,14 @@ static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state)
4441 return 0; 4425 return 0;
4442} 4426}
4443 4427
4444static int iwl4965_pci_resume(struct pci_dev *pdev) 4428static int iwl_pci_resume(struct pci_dev *pdev)
4445{ 4429{
4446 struct iwl_priv *priv = pci_get_drvdata(pdev); 4430 struct iwl_priv *priv = pci_get_drvdata(pdev);
4447 4431
4448 pci_set_power_state(pdev, PCI_D0); 4432 pci_set_power_state(pdev, PCI_D0);
4449 4433
4450 if (priv->is_open) 4434 if (priv->is_open)
4451 iwl4965_mac_start(priv->hw); 4435 iwl_mac_start(priv->hw);
4452 4436
4453 clear_bit(STATUS_IN_SUSPEND, &priv->status); 4437 clear_bit(STATUS_IN_SUSPEND, &priv->status);
4454 return 0; 4438 return 0;
@@ -4491,15 +4475,15 @@ MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
4491static struct pci_driver iwl_driver = { 4475static struct pci_driver iwl_driver = {
4492 .name = DRV_NAME, 4476 .name = DRV_NAME,
4493 .id_table = iwl_hw_card_ids, 4477 .id_table = iwl_hw_card_ids,
4494 .probe = iwl4965_pci_probe, 4478 .probe = iwl_pci_probe,
4495 .remove = __devexit_p(iwl4965_pci_remove), 4479 .remove = __devexit_p(iwl_pci_remove),
4496#ifdef CONFIG_PM 4480#ifdef CONFIG_PM
4497 .suspend = iwl4965_pci_suspend, 4481 .suspend = iwl_pci_suspend,
4498 .resume = iwl4965_pci_resume, 4482 .resume = iwl_pci_resume,
4499#endif 4483#endif
4500}; 4484};
4501 4485
4502static int __init iwl4965_init(void) 4486static int __init iwl_init(void)
4503{ 4487{
4504 4488
4505 int ret; 4489 int ret;
@@ -4525,11 +4509,11 @@ error_register:
4525 return ret; 4509 return ret;
4526} 4510}
4527 4511
4528static void __exit iwl4965_exit(void) 4512static void __exit iwl_exit(void)
4529{ 4513{
4530 pci_unregister_driver(&iwl_driver); 4514 pci_unregister_driver(&iwl_driver);
4531 iwlagn_rate_control_unregister(); 4515 iwlagn_rate_control_unregister();
4532} 4516}
4533 4517
4534module_exit(iwl4965_exit); 4518module_exit(iwl_exit);
4535module_init(iwl4965_init); 4519module_init(iwl_init);
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 5ab74fc0fd10..8aade00e165a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -66,8 +66,8 @@
66 * Please use iwl-dev.h for driver implementation definitions. 66 * Please use iwl-dev.h for driver implementation definitions.
67 */ 67 */
68 68
69#ifndef __iwl4965_commands_h__ 69#ifndef __iwl_commands_h__
70#define __iwl4965_commands_h__ 70#define __iwl_commands_h__
71 71
72enum { 72enum {
73 REPLY_ALIVE = 0x1, 73 REPLY_ALIVE = 0x1,
@@ -3064,4 +3064,4 @@ struct iwl_rx_packet {
3064 3064
3065#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame)) 3065#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame))
3066 3066
3067#endif /* __iwl4965_commands_h__ */ 3067#endif /* __iwl_commands_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index b58fcdef5432..eb396f26730c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -576,8 +576,8 @@ extern int iwl_send_add_sta(struct iwl_priv *priv,
576 struct iwl_addsta_cmd *sta, u8 flags); 576 struct iwl_addsta_cmd *sta, u8 flags);
577extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, 577extern u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
578 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info); 578 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
579extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 579extern void iwl_update_chain_flags(struct iwl_priv *priv);
580extern int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 580extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
581extern const u8 iwl_bcast_addr[ETH_ALEN]; 581extern const u8 iwl_bcast_addr[ETH_ALEN];
582extern int iwl_rxq_stop(struct iwl_priv *priv); 582extern int iwl_rxq_stop(struct iwl_priv *priv);
583extern void iwl_txq_ctx_stop(struct iwl_priv *priv); 583extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
@@ -926,8 +926,6 @@ struct iwl_priv {
926 unsigned long last_statistics_time; 926 unsigned long last_statistics_time;
927 927
928 /* context information */ 928 /* context information */
929 u8 essid[IW_ESSID_MAX_SIZE];
930 u8 essid_len;
931 u16 rates_mask; 929 u16 rates_mask;
932 930
933 u32 power_mode; 931 u32 power_mode;
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index f2688d551830..97e2cf41258d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -318,34 +318,40 @@
318#define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60) 318#define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60)
319 319
320/* Find Control/Status reg for given Tx DMA/FIFO channel */ 320/* Find Control/Status reg for given Tx DMA/FIFO channel */
321#define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ 321#define FH49_TCSR_CHNL_NUM (7)
322 (FH_TCSR_LOWER_BOUND + 0x20 * _chnl) 322#define FH50_TCSR_CHNL_NUM (8)
323 323
324#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) 324#define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \
325#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) 325 (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl))
326#define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \
327 (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4)
328#define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \
329 (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8)
326 330
327#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) 331#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
328#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) 332#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001)
329#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
330 333
331#define FH_TCSR_CHNL_NUM (7) 334#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000)
335#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008)
332 336
333#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) 337#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000)
334#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) 338#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000)
335#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) 339#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
336 340
337#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) 341#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
338#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) 342#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000)
339#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) 343#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000)
340 344
341#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) 345#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
342#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) 346#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000)
343#define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ 347#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
344 (FH_TCSR_LOWER_BOUND + 0x20 * _chnl) 348
345#define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ 349#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000)
346 (FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x4) 350#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000)
347#define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ 351#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003)
348 (FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x8) 352
353#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20)
354#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12)
349 355
350/** 356/**
351 * Tx Shared Status Registers (TSSR) 357 * Tx Shared Status Registers (TSSR)
@@ -362,7 +368,7 @@
362#define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0) 368#define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0)
363#define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0) 369#define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0)
364 370
365#define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010) 371#define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010)
366 372
367#define FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) ((1 << (_chnl)) << 24) 373#define FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) ((1 << (_chnl)) << 24)
368#define FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) ((1 << (_chnl)) << 16) 374#define FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) ((1 << (_chnl)) << 16)
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 6c5654f70a06..c4b90301e9a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -743,13 +743,6 @@ static void iwl_bg_request_scan(struct work_struct *data)
743 memcpy(scan->direct_scan[0].ssid, 743 memcpy(scan->direct_scan[0].ssid,
744 priv->direct_ssid, priv->direct_ssid_len); 744 priv->direct_ssid, priv->direct_ssid_len);
745 n_probes++; 745 n_probes++;
746 } else if (!iwl_is_associated(priv) && priv->essid_len) {
747 IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n",
748 print_ssid(ssid, priv->essid, priv->essid_len));
749 scan->direct_scan[0].id = WLAN_EID_SSID;
750 scan->direct_scan[0].len = priv->essid_len;
751 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
752 n_probes++;
753 } else { 746 } else {
754 IWL_DEBUG_SCAN("Start indirect scan.\n"); 747 IWL_DEBUG_SCAN("Start indirect scan.\n");
755 } 748 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index bfc009ce8a94..0c5f1221b8f3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -870,7 +870,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
870 870
871 link_cmd.rs_table[i].rate_n_flags = 871 link_cmd.rs_table[i].rate_n_flags =
872 iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); 872 iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
873 r = iwl4965_get_prev_ieee_rate(r); 873 r = iwl_get_prev_ieee_rate(r);
874 } 874 }
875 875
876 link_cmd.general_params.single_stream_ant_msk = 876 link_cmd.general_params.single_stream_ant_msk =
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 6008c0cce214..7d8b4e2d5094 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -431,8 +431,8 @@ static int iwl_hw_tx_queue_init(struct iwl_priv *priv,
431 431
432 /* Enable DMA channel, using same id as for TFD queue */ 432 /* Enable DMA channel, using same id as for TFD queue */
433 iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(txq_id), 433 iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(txq_id),
434 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 434 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
435 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL); 435 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
436 436
437 iwl_release_nic_access(priv); 437 iwl_release_nic_access(priv);
438 spin_unlock_irqrestore(&priv->lock, flags); 438 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index f675b2993a3d..119185fb1e26 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1593,7 +1593,7 @@ static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1593 */ 1593 */
1594static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv, 1594static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
1595 struct ieee80211_mgmt *frame, 1595 struct ieee80211_mgmt *frame,
1596 int left, int is_direct) 1596 int left)
1597{ 1597{
1598 int len = 0; 1598 int len = 0;
1599 u8 *pos = NULL; 1599 u8 *pos = NULL;
@@ -1623,20 +1623,6 @@ static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
1623 *pos++ = WLAN_EID_SSID; 1623 *pos++ = WLAN_EID_SSID;
1624 *pos++ = 0; 1624 *pos++ = 0;
1625 1625
1626 /* fill in our direct SSID IE... */
1627 if (is_direct) {
1628 /* ...next IE... */
1629 left -= 2 + priv->essid_len;
1630 if (left < 0)
1631 return 0;
1632 /* ... fill it in... */
1633 *pos++ = WLAN_EID_SSID;
1634 *pos++ = priv->essid_len;
1635 memcpy(pos, priv->essid, priv->essid_len);
1636 pos += priv->essid_len;
1637 len += 2 + priv->essid_len;
1638 }
1639
1640 /* fill in supported rate */ 1626 /* fill in supported rate */
1641 /* ...next IE... */ 1627 /* ...next IE... */
1642 left -= 2; 1628 left -= 2;
@@ -2189,13 +2175,14 @@ static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv,
2189/* 2175/*
2190 * initialize rxon structure with default values from eeprom 2176 * initialize rxon structure with default values from eeprom
2191 */ 2177 */
2192static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv) 2178static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv,
2179 int mode)
2193{ 2180{
2194 const struct iwl3945_channel_info *ch_info; 2181 const struct iwl3945_channel_info *ch_info;
2195 2182
2196 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); 2183 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
2197 2184
2198 switch (priv->iw_mode) { 2185 switch (mode) {
2199 case NL80211_IFTYPE_AP: 2186 case NL80211_IFTYPE_AP:
2200 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP; 2187 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
2201 break; 2188 break;
@@ -2218,7 +2205,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv)
2218 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; 2205 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
2219 break; 2206 break;
2220 default: 2207 default:
2221 IWL_ERROR("Unsupported interface type %d\n", priv->iw_mode); 2208 IWL_ERROR("Unsupported interface type %d\n", mode);
2222 break; 2209 break;
2223 } 2210 }
2224 2211
@@ -2241,8 +2228,7 @@ static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv)
2241 * in some case A channels are all non IBSS 2228 * in some case A channels are all non IBSS
2242 * in this case force B/G channel 2229 * in this case force B/G channel
2243 */ 2230 */
2244 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 2231 if ((mode == NL80211_IFTYPE_ADHOC) && !(is_channel_ibss(ch_info)))
2245 !(is_channel_ibss(ch_info)))
2246 ch_info = &priv->channel_info[0]; 2232 ch_info = &priv->channel_info[0];
2247 2233
2248 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel); 2234 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
@@ -2275,9 +2261,7 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2275 } 2261 }
2276 } 2262 }
2277 2263
2278 priv->iw_mode = mode; 2264 iwl3945_connection_init_rx_config(priv, mode);
2279
2280 iwl3945_connection_init_rx_config(priv);
2281 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2265 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2282 2266
2283 iwl3945_clear_stations_table(priv); 2267 iwl3945_clear_stations_table(priv);
@@ -5699,7 +5683,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
5699 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5683 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5700 } else { 5684 } else {
5701 /* Initialize our rx_config data */ 5685 /* Initialize our rx_config data */
5702 iwl3945_connection_init_rx_config(priv); 5686 iwl3945_connection_init_rx_config(priv, priv->iw_mode);
5703 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 5687 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
5704 } 5688 }
5705 5689
@@ -6015,6 +5999,7 @@ static void iwl3945_bg_set_monitor(struct work_struct *work)
6015 IWL_ERROR("iwl3945_set_mode() failed\n"); 5999 IWL_ERROR("iwl3945_set_mode() failed\n");
6016 6000
6017 mutex_unlock(&priv->mutex); 6001 mutex_unlock(&priv->mutex);
6002 ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC);
6018} 6003}
6019 6004
6020#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 6005#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
@@ -6162,14 +6147,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6162 memcpy(scan->direct_scan[0].ssid, 6147 memcpy(scan->direct_scan[0].ssid,
6163 priv->direct_ssid, priv->direct_ssid_len); 6148 priv->direct_ssid, priv->direct_ssid_len);
6164 n_probes++; 6149 n_probes++;
6165 } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
6166 IWL_DEBUG_SCAN
6167 ("Kicking off one direct scan for '%s' when not associated\n",
6168 print_ssid(ssid, priv->essid, priv->essid_len));
6169 scan->direct_scan[0].id = WLAN_EID_SSID;
6170 scan->direct_scan[0].len = priv->essid_len;
6171 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
6172 n_probes++;
6173 } else 6150 } else
6174 IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); 6151 IWL_DEBUG_SCAN("Kicking off one indirect scan.\n");
6175 6152
@@ -6177,7 +6154,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6177 * that based on the direct_mask added to each channel entry */ 6154 * that based on the direct_mask added to each channel entry */
6178 scan->tx_cmd.len = cpu_to_le16( 6155 scan->tx_cmd.len = cpu_to_le16(
6179 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6156 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6180 IWL_MAX_SCAN_SIZE - sizeof(*scan), 0)); 6157 IWL_MAX_SCAN_SIZE - sizeof(*scan)));
6181 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6158 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6182 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6159 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
6183 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 6160 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
@@ -6566,6 +6543,7 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
6566 6543
6567 spin_lock_irqsave(&priv->lock, flags); 6544 spin_lock_irqsave(&priv->lock, flags);
6568 priv->vif = conf->vif; 6545 priv->vif = conf->vif;
6546 priv->iw_mode = conf->type;
6569 6547
6570 spin_unlock_irqrestore(&priv->lock, flags); 6548 spin_unlock_irqrestore(&priv->lock, flags);
6571 6549
@@ -6742,7 +6720,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6742 struct ieee80211_if_conf *conf) 6720 struct ieee80211_if_conf *conf)
6743{ 6721{
6744 struct iwl3945_priv *priv = hw->priv; 6722 struct iwl3945_priv *priv = hw->priv;
6745 unsigned long flags;
6746 int rc; 6723 int rc;
6747 6724
6748 if (conf == NULL) 6725 if (conf == NULL)
@@ -6764,15 +6741,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6764 return rc; 6741 return rc;
6765 } 6742 }
6766 6743
6767 /* XXX: this MUST use conf->mac_addr */
6768
6769 if ((priv->iw_mode == NL80211_IFTYPE_AP) &&
6770 (!conf->ssid_len)) {
6771 IWL_DEBUG_MAC80211
6772 ("Leaving in AP mode because HostAPD is not ready.\n");
6773 return 0;
6774 }
6775
6776 if (!iwl3945_is_alive(priv)) 6744 if (!iwl3945_is_alive(priv))
6777 return -EAGAIN; 6745 return -EAGAIN;
6778 6746
@@ -6839,15 +6807,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
6839 } 6807 }
6840 6808
6841 done: 6809 done:
6842 spin_lock_irqsave(&priv->lock, flags);
6843 if (!conf->ssid_len)
6844 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
6845 else
6846 memcpy(priv->essid, conf->ssid, conf->ssid_len);
6847
6848 priv->essid_len = conf->ssid_len;
6849 spin_unlock_irqrestore(&priv->lock, flags);
6850
6851 IWL_DEBUG_MAC80211("leave\n"); 6810 IWL_DEBUG_MAC80211("leave\n");
6852 mutex_unlock(&priv->mutex); 6811 mutex_unlock(&priv->mutex);
6853 6812
@@ -6890,8 +6849,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
6890 if (priv->vif == conf->vif) { 6849 if (priv->vif == conf->vif) {
6891 priv->vif = NULL; 6850 priv->vif = NULL;
6892 memset(priv->bssid, 0, ETH_ALEN); 6851 memset(priv->bssid, 0, ETH_ALEN);
6893 memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
6894 priv->essid_len = 0;
6895 } 6852 }
6896 mutex_unlock(&priv->mutex); 6853 mutex_unlock(&priv->mutex);
6897 6854