aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel.ortiz@intel.com>2009-01-27 17:27:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-09 15:03:33 -0500
commit8ccde88a87a3dc906234b281a036fee9c7371949 (patch)
tree05bb74d5f11201e0a7c38169ecbab3509e18b686 /drivers/net/wireless
parentd14c7c1d6aef1175625ea72938b07cee072723dc (diff)
iwl3945: Getting rid of the *39_rxon iwl_priv fields
The iwl_rxon_cmd is really just a iwl3945_rxon_cmd structure extension. So, we can use the *_rxon fields from iwl_priv instead of the 3945 specific ones (*39_rxon). We have to then be careful when submitting REPLY_RXON host commands, since the command length as to be set according to the HW. As another precaution the reserved4 and reserved5 fields are cleared before being sent to the 3945. With the *39_rxon removal, a lot of duplicated code can be removed from the 3945 code base. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c109
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c358
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c434
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c711
11 files changed, 585 insertions, 1087 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index fec2fbf8dc02..ddc8b31b2608 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -8,7 +8,7 @@ iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
8iwlcore-$(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) += iwl-spectrum.o 8iwlcore-$(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
9 9
10obj-$(CONFIG_IWLAGN) += iwlagn.o 10obj-$(CONFIG_IWLAGN) += iwlagn.o
11iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-hcmd-check.o 11iwlagn-objs := iwl-agn.o iwl-agn-rs.o
12 12
13iwlagn-$(CONFIG_IWL4965) += iwl-4965.o 13iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
14iwlagn-$(CONFIG_IWL5000) += iwl-5000.o 14iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 044abf734eb6..b93f5ba77192 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -934,7 +934,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
934 switch (priv->band) { 934 switch (priv->band) {
935 case IEEE80211_BAND_2GHZ: 935 case IEEE80211_BAND_2GHZ:
936 /* TODO: this always does G, not a regression */ 936 /* TODO: this always does G, not a regression */
937 if (priv->active39_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { 937 if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
938 rs_sta->tgg = 1; 938 rs_sta->tgg = 1;
939 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; 939 rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
940 } else 940 } else
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 12f93b6207d6..610ee17c8406 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -251,7 +251,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
251 break; 251 break;
252 case IEEE80211_BAND_2GHZ: 252 case IEEE80211_BAND_2GHZ:
253 if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && 253 if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) &&
254 iwl3945_is_associated(priv)) { 254 iwl_is_associated(priv)) {
255 if (rate == IWL_RATE_11M_INDEX) 255 if (rate == IWL_RATE_11M_INDEX)
256 next_rate = IWL_RATE_5M_INDEX; 256 next_rate = IWL_RATE_5M_INDEX;
257 } 257 }
@@ -579,7 +579,8 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
579 skb_put(rxb->skb, le16_to_cpu(rx_hdr->len)); 579 skb_put(rxb->skb, le16_to_cpu(rx_hdr->len));
580 580
581 if (!iwl3945_mod_params.sw_crypto) 581 if (!iwl3945_mod_params.sw_crypto)
582 iwl3945_set_decrypted_flag(priv, rxb->skb, 582 iwl_set_decrypted_flag(priv,
583 (struct ieee80211_hdr *)rxb->skb->data,
583 le32_to_cpu(rx_end->status), stats); 584 le32_to_cpu(rx_end->status), stats);
584 585
585#ifdef CONFIG_IWL3945_LEDS 586#ifdef CONFIG_IWL3945_LEDS
@@ -1694,17 +1695,17 @@ int iwl3945_send_tx_power(struct iwl_priv *priv)
1694 int rate_idx, i; 1695 int rate_idx, i;
1695 const struct iwl_channel_info *ch_info = NULL; 1696 const struct iwl_channel_info *ch_info = NULL;
1696 struct iwl3945_txpowertable_cmd txpower = { 1697 struct iwl3945_txpowertable_cmd txpower = {
1697 .channel = priv->active39_rxon.channel, 1698 .channel = priv->active_rxon.channel,
1698 }; 1699 };
1699 1700
1700 txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; 1701 txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
1701 ch_info = iwl_get_channel_info(priv, 1702 ch_info = iwl_get_channel_info(priv,
1702 priv->band, 1703 priv->band,
1703 le16_to_cpu(priv->active39_rxon.channel)); 1704 le16_to_cpu(priv->active_rxon.channel));
1704 if (!ch_info) { 1705 if (!ch_info) {
1705 IWL_ERR(priv, 1706 IWL_ERR(priv,
1706 "Failed to get channel info for channel %d [%d]\n", 1707 "Failed to get channel info for channel %d [%d]\n",
1707 le16_to_cpu(priv->active39_rxon.channel), priv->band); 1708 le16_to_cpu(priv->active_rxon.channel), priv->band);
1708 return -EINVAL; 1709 return -EINVAL;
1709 } 1710 }
1710 1711
@@ -2432,7 +2433,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2432 * 1M CCK rates */ 2433 * 1M CCK rates */
2433 2434
2434 if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && 2435 if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) &&
2435 iwl3945_is_associated(priv)) { 2436 iwl_is_associated(priv)) {
2436 2437
2437 index = IWL_FIRST_CCK_RATE; 2438 index = IWL_FIRST_CCK_RATE;
2438 for (i = IWL_RATE_6M_INDEX_TABLE; 2439 for (i = IWL_RATE_6M_INDEX_TABLE;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index fef54e9cf8a8..ab7aaf6872c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -222,9 +222,6 @@ extern int __must_check iwl3945_send_cmd(struct iwl_priv *priv,
222 struct iwl_host_cmd *cmd); 222 struct iwl_host_cmd *cmd);
223extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 223extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
224 struct ieee80211_hdr *hdr,int left); 224 struct ieee80211_hdr *hdr,int left);
225extern void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
226 u32 decrypt_res,
227 struct ieee80211_rx_status *stats);
228 225
229/* 226/*
230 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't 227 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
@@ -303,11 +300,6 @@ extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv);
303extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, 300extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
304 u16 tx_rate, u8 flags); 301 u16 tx_rate, u8 flags);
305 302
306static inline int iwl3945_is_associated(struct iwl_priv *priv)
307{
308 return (priv->active39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
309}
310
311extern const struct iwl_channel_info *iwl3945_get_channel_info( 303extern const struct iwl_channel_info *iwl3945_get_channel_info(
312 const struct iwl_priv *priv, enum ieee80211_band band, u16 channel); 304 const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
313 305
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c
deleted file mode 100644
index 1217a1da88f5..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29#include <linux/kernel.h>
30#include <net/mac80211.h>
31#include "iwl-dev.h"
32#include "iwl-debug.h"
33#include "iwl-commands.h"
34
35
36/**
37 * iwl_check_rxon_cmd - validate RXON structure is valid
38 *
39 * NOTE: This is really only useful during development and can eventually
40 * be #ifdef'd out once the driver is stable and folks aren't actively
41 * making changes
42 */
43int iwl_agn_check_rxon_cmd(struct iwl_priv *priv)
44{
45 int error = 0;
46 int counter = 1;
47 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
48
49 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
50 error |= le32_to_cpu(rxon->flags &
51 (RXON_FLG_TGJ_NARROW_BAND_MSK |
52 RXON_FLG_RADAR_DETECT_MSK));
53 if (error)
54 IWL_WARN(priv, "check 24G fields %d | %d\n",
55 counter++, error);
56 } else {
57 error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
58 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
59 if (error)
60 IWL_WARN(priv, "check 52 fields %d | %d\n",
61 counter++, error);
62 error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
63 if (error)
64 IWL_WARN(priv, "check 52 CCK %d | %d\n",
65 counter++, error);
66 }
67 error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
68 if (error)
69 IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
70
71 /* make sure basic rates 6Mbps and 1Mbps are supported */
72 error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
73 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
74 if (error)
75 IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
76
77 error |= (le16_to_cpu(rxon->assoc_id) > 2007);
78 if (error)
79 IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
80
81 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
82 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
83 if (error)
84 IWL_WARN(priv, "check CCK and short slot %d | %d\n",
85 counter++, error);
86
87 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
88 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
89 if (error)
90 IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
91 counter++, error);
92
93 error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
94 RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
95 if (error)
96 IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
97 counter++, error);
98
99 if (error)
100 IWL_WARN(priv, "Tuning to channel %d\n",
101 le16_to_cpu(rxon->channel));
102
103 if (error) {
104 IWL_ERR(priv, "Not a valid iwl_rxon_assoc_cmd field values\n");
105 return -1;
106 }
107 return 0;
108}
109
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 6b7120a41ab2..c54a9bcbb2e1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -94,66 +94,6 @@ MODULE_ALIAS("iwl4965");
94 94
95/**************************************************************/ 95/**************************************************************/
96 96
97
98
99static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
100{
101 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
102
103 if (hw_decrypt)
104 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
105 else
106 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
107
108}
109
110/**
111 * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
112 * @priv: staging_rxon is compared to active_rxon
113 *
114 * If the RXON structure is changing enough to require a new tune,
115 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
116 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
117 */
118static int iwl_full_rxon_required(struct iwl_priv *priv)
119{
120
121 /* These items are only settable from the full RXON command */
122 if (!(iwl_is_associated(priv)) ||
123 compare_ether_addr(priv->staging_rxon.bssid_addr,
124 priv->active_rxon.bssid_addr) ||
125 compare_ether_addr(priv->staging_rxon.node_addr,
126 priv->active_rxon.node_addr) ||
127 compare_ether_addr(priv->staging_rxon.wlap_bssid_addr,
128 priv->active_rxon.wlap_bssid_addr) ||
129 (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) ||
130 (priv->staging_rxon.channel != priv->active_rxon.channel) ||
131 (priv->staging_rxon.air_propagation !=
132 priv->active_rxon.air_propagation) ||
133 (priv->staging_rxon.ofdm_ht_single_stream_basic_rates !=
134 priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
135 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
136 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
137 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
138 return 1;
139
140 /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
141 * be updated with the RXON_ASSOC command -- however only some
142 * flag transitions are allowed using RXON_ASSOC */
143
144 /* Check if we are not switching bands */
145 if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
146 (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
147 return 1;
148
149 /* Check if we are switching association toggle */
150 if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
151 (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
152 return 1;
153
154 return 0;
155}
156
157/** 97/**
158 * iwl_commit_rxon - commit staging_rxon to hardware 98 * iwl_commit_rxon - commit staging_rxon to hardware
159 * 99 *
@@ -179,7 +119,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
179 * 5000, but will not damage 4965 */ 119 * 5000, but will not damage 4965 */
180 priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN; 120 priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
181 121
182 ret = iwl_agn_check_rxon_cmd(priv); 122 ret = iwl_check_rxon_cmd(priv);
183 if (ret) { 123 if (ret) {
184 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 124 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
185 return -EINVAL; 125 return -EINVAL;
@@ -374,31 +314,6 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
374 return priv->ibss_beacon->len; 314 return priv->ibss_beacon->len;
375} 315}
376 316
377static u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
378{
379 int i;
380 int rate_mask;
381
382 /* Set rate mask*/
383 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
384 rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
385 else
386 rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
387
388 /* Find lowest valid rate */
389 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
390 i = iwl_rates[i].next_ieee) {
391 if (rate_mask & (1 << i))
392 return iwl_rates[i].plcp;
393 }
394
395 /* No valid rate was found. Assign the lowest one */
396 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
397 return IWL_RATE_1M_PLCP;
398 else
399 return IWL_RATE_6M_PLCP;
400}
401
402static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, 317static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
403 struct iwl_frame *frame, u8 rate) 318 struct iwl_frame *frame, u8 rate)
404{ 319{
@@ -771,111 +686,10 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
771 le16_to_cpu(priv->rxon_timing.atim_window)); 686 le16_to_cpu(priv->rxon_timing.atim_window));
772} 687}
773 688
774static void iwl_set_flags_for_band(struct iwl_priv *priv,
775 enum ieee80211_band band)
776{
777 if (band == IEEE80211_BAND_5GHZ) {
778 priv->staging_rxon.flags &=
779 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
780 | RXON_FLG_CCK_MSK);
781 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
782 } else {
783 /* Copied from iwl_post_associate() */
784 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
785 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
786 else
787 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
788
789 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
790 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
791
792 priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
793 priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
794 priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK;
795 }
796}
797
798/*
799 * initialize rxon structure with default values from eeprom
800 */
801static void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode)
802{
803 const struct iwl_channel_info *ch_info;
804
805 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
806
807 switch (mode) {
808 case NL80211_IFTYPE_AP:
809 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
810 break;
811
812 case NL80211_IFTYPE_STATION:
813 priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS;
814 priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
815 break;
816
817 case NL80211_IFTYPE_ADHOC:
818 priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS;
819 priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
820 priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
821 RXON_FILTER_ACCEPT_GRP_MSK;
822 break;
823
824 case NL80211_IFTYPE_MONITOR:
825 priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
826 priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
827 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
828 break;
829 default:
830 IWL_ERR(priv, "Unsupported interface type %d\n", mode);
831 break;
832 }
833
834#if 0
835 /* TODO: Figure out when short_preamble would be set and cache from
836 * that */
837 if (!hw_to_local(priv->hw)->short_preamble)
838 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
839 else
840 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
841#endif
842
843 ch_info = iwl_get_channel_info(priv, priv->band,
844 le16_to_cpu(priv->active_rxon.channel));
845
846 if (!ch_info)
847 ch_info = &priv->channel_info[0];
848
849 /*
850 * in some case A channels are all non IBSS
851 * in this case force B/G channel
852 */
853 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
854 !(is_channel_ibss(ch_info)))
855 ch_info = &priv->channel_info[0];
856
857 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
858 priv->band = ch_info->band;
859
860 iwl_set_flags_for_band(priv, priv->band);
861
862 priv->staging_rxon.ofdm_basic_rates =
863 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
864 priv->staging_rxon.cck_basic_rates =
865 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
866
867 priv->staging_rxon.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
868 RXON_FLG_CHANNEL_MODE_PURE_40_MSK);
869 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
870 memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN);
871 priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff;
872 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff;
873 iwl_set_rxon_chain(priv);
874}
875
876static int iwl_set_mode(struct iwl_priv *priv, int mode) 689static int iwl_set_mode(struct iwl_priv *priv, int mode)
877{ 690{
878 iwl_connection_init_rx_config(priv, mode); 691 iwl_connection_init_rx_config(priv, mode);
692 iwl_set_rxon_chain(priv);
879 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 693 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
880 694
881 iwl_clear_stations_table(priv); 695 iwl_clear_stations_table(priv);
@@ -896,54 +710,6 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
896 return 0; 710 return 0;
897} 711}
898 712
899static void iwl_set_rate(struct iwl_priv *priv)
900{
901 const struct ieee80211_supported_band *hw = NULL;
902 struct ieee80211_rate *rate;
903 int i;
904
905 hw = iwl_get_hw_mode(priv, priv->band);
906 if (!hw) {
907 IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
908 return;
909 }
910
911 priv->active_rate = 0;
912 priv->active_rate_basic = 0;
913
914 for (i = 0; i < hw->n_bitrates; i++) {
915 rate = &(hw->bitrates[i]);
916 if (rate->hw_value < IWL_RATE_COUNT)
917 priv->active_rate |= (1 << rate->hw_value);
918 }
919
920 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
921 priv->active_rate, priv->active_rate_basic);
922
923 /*
924 * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
925 * otherwise set it to the default of all CCK rates and 6, 12, 24 for
926 * OFDM
927 */
928 if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
929 priv->staging_rxon.cck_basic_rates =
930 ((priv->active_rate_basic &
931 IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
932 else
933 priv->staging_rxon.cck_basic_rates =
934 (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
935
936 if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
937 priv->staging_rxon.ofdm_basic_rates =
938 ((priv->active_rate_basic &
939 (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
940 IWL_FIRST_OFDM_RATE) & 0xFF;
941 else
942 priv->staging_rxon.ofdm_basic_rates =
943 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
944}
945
946
947/****************************************************************************** 713/******************************************************************************
948 * 714 *
949 * Generic RX handler implementations 715 * Generic RX handler implementations
@@ -999,19 +765,6 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
999 le32_to_cpu(pkt->u.err_resp.error_info)); 765 le32_to_cpu(pkt->u.err_resp.error_info));
1000} 766}
1001 767
1002#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
1003
1004static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1005{
1006 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
1007 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon;
1008 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
1009 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
1010 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
1011 rxon->channel = csa->channel;
1012 priv->staging_rxon.channel = csa->channel;
1013}
1014
1015static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 768static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
1016 struct iwl_rx_mem_buffer *rxb) 769 struct iwl_rx_mem_buffer *rxb)
1017{ 770{
@@ -1370,27 +1123,6 @@ void iwl_rx_handle(struct iwl_priv *priv)
1370 iwl_rx_queue_restock(priv); 1123 iwl_rx_queue_restock(priv);
1371} 1124}
1372 1125
1373#ifdef CONFIG_IWLWIFI_DEBUG
1374static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
1375{
1376 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
1377
1378 IWL_DEBUG_RADIO("RX CONFIG:\n");
1379 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
1380 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
1381 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
1382 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
1383 le32_to_cpu(rxon->filter_flags));
1384 IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
1385 IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
1386 rxon->ofdm_basic_rates);
1387 IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
1388 IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
1389 IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
1390 IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
1391}
1392#endif
1393
1394/* call this function to flush any scheduled tasklet */ 1126/* call this function to flush any scheduled tasklet */
1395static inline void iwl_synchronize_irq(struct iwl_priv *priv) 1127static inline void iwl_synchronize_irq(struct iwl_priv *priv)
1396{ 1128{
@@ -1399,45 +1131,6 @@ static inline void iwl_synchronize_irq(struct iwl_priv *priv)
1399 tasklet_kill(&priv->irq_tasklet); 1131 tasklet_kill(&priv->irq_tasklet);
1400} 1132}
1401 1133
1402/**
1403 * iwl_irq_handle_error - called for HW or SW error interrupt from card
1404 */
1405static void iwl_irq_handle_error(struct iwl_priv *priv)
1406{
1407 /* Set the FW error flag -- cleared on iwl_down */
1408 set_bit(STATUS_FW_ERROR, &priv->status);
1409
1410 /* Cancel currently queued command. */
1411 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
1412
1413#ifdef CONFIG_IWLWIFI_DEBUG
1414 if (priv->debug_level & IWL_DL_FW_ERRORS) {
1415 iwl_dump_nic_error_log(priv);
1416 iwl_dump_nic_event_log(priv);
1417 iwl_print_rx_config_cmd(priv);
1418 }
1419#endif
1420
1421 wake_up_interruptible(&priv->wait_command_queue);
1422
1423 /* Keep the restart process from trying to send host
1424 * commands by clearing the INIT status bit */
1425 clear_bit(STATUS_READY, &priv->status);
1426
1427 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
1428 IWL_DEBUG(IWL_DL_FW_ERRORS,
1429 "Restarting adapter due to uCode error.\n");
1430
1431 if (iwl_is_associated(priv)) {
1432 memcpy(&priv->recovery_rxon, &priv->active_rxon,
1433 sizeof(priv->recovery_rxon));
1434 priv->error_recovering = 1;
1435 }
1436 if (priv->cfg->mod_params->restart_fw)
1437 queue_work(priv->workqueue, &priv->restart);
1438 }
1439}
1440
1441static void iwl_error_recovery(struct iwl_priv *priv) 1134static void iwl_error_recovery(struct iwl_priv *priv)
1442{ 1135{
1443 unsigned long flags; 1136 unsigned long flags;
@@ -2010,6 +1703,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
2010 } else { 1703 } else {
2011 /* Initialize our rx_config data */ 1704 /* Initialize our rx_config data */
2012 iwl_connection_init_rx_config(priv, priv->iw_mode); 1705 iwl_connection_init_rx_config(priv, priv->iw_mode);
1706 iwl_set_rxon_chain(priv);
2013 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 1707 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2014 } 1708 }
2015 1709
@@ -2899,52 +2593,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
2899 return 0; 2593 return 0;
2900} 2594}
2901 2595
2902static void iwl_configure_filter(struct ieee80211_hw *hw,
2903 unsigned int changed_flags,
2904 unsigned int *total_flags,
2905 int mc_count, struct dev_addr_list *mc_list)
2906{
2907 struct iwl_priv *priv = hw->priv;
2908 __le32 *filter_flags = &priv->staging_rxon.filter_flags;
2909
2910 IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
2911 changed_flags, *total_flags);
2912
2913 if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
2914 if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
2915 *filter_flags |= RXON_FILTER_PROMISC_MSK;
2916 else
2917 *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
2918 }
2919 if (changed_flags & FIF_ALLMULTI) {
2920 if (*total_flags & FIF_ALLMULTI)
2921 *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
2922 else
2923 *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
2924 }
2925 if (changed_flags & FIF_CONTROL) {
2926 if (*total_flags & FIF_CONTROL)
2927 *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
2928 else
2929 *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
2930 }
2931 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
2932 if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
2933 *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
2934 else
2935 *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
2936 }
2937
2938 /* We avoid iwl_commit_rxon here to commit the new filter flags
2939 * since mac80211 will call ieee80211_hw_config immediately.
2940 * (mc_list is not supported at this time). Otherwise, we need to
2941 * queue a background iwl_commit_rxon work.
2942 */
2943
2944 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
2945 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
2946}
2947
2948static void iwl_mac_remove_interface(struct ieee80211_hw *hw, 2596static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
2949 struct ieee80211_if_init_conf *conf) 2597 struct ieee80211_if_init_conf *conf)
2950{ 2598{
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 21f386568c9c..4f2b88c59c71 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -28,6 +28,7 @@
28 28
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/etherdevice.h>
31#include <net/mac80211.h> 32#include <net/mac80211.h>
32 33
33#include "iwl-eeprom.h" 34#include "iwl-eeprom.h"
@@ -403,6 +404,7 @@ static void iwlcore_init_hw_rates(struct iwl_priv *priv,
403 } 404 }
404} 405}
405 406
407
406/** 408/**
407 * iwlcore_init_geos - Initialize mac80211's geo/channel info based from eeprom 409 * iwlcore_init_geos - Initialize mac80211's geo/channel info based from eeprom
408 */ 410 */
@@ -586,6 +588,167 @@ u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
586} 588}
587EXPORT_SYMBOL(iwl_is_fat_tx_allowed); 589EXPORT_SYMBOL(iwl_is_fat_tx_allowed);
588 590
591void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
592{
593 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
594
595 if (hw_decrypt)
596 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
597 else
598 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
599
600}
601EXPORT_SYMBOL(iwl_set_rxon_hwcrypto);
602
603/**
604 * iwl_check_rxon_cmd - validate RXON structure is valid
605 *
606 * NOTE: This is really only useful during development and can eventually
607 * be #ifdef'd out once the driver is stable and folks aren't actively
608 * making changes
609 */
610int iwl_check_rxon_cmd(struct iwl_priv *priv)
611{
612 int error = 0;
613 int counter = 1;
614 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
615
616 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
617 error |= le32_to_cpu(rxon->flags &
618 (RXON_FLG_TGJ_NARROW_BAND_MSK |
619 RXON_FLG_RADAR_DETECT_MSK));
620 if (error)
621 IWL_WARN(priv, "check 24G fields %d | %d\n",
622 counter++, error);
623 } else {
624 error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
625 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
626 if (error)
627 IWL_WARN(priv, "check 52 fields %d | %d\n",
628 counter++, error);
629 error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
630 if (error)
631 IWL_WARN(priv, "check 52 CCK %d | %d\n",
632 counter++, error);
633 }
634 error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
635 if (error)
636 IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
637
638 /* make sure basic rates 6Mbps and 1Mbps are supported */
639 error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
640 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
641 if (error)
642 IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
643
644 error |= (le16_to_cpu(rxon->assoc_id) > 2007);
645 if (error)
646 IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
647
648 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
649 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
650 if (error)
651 IWL_WARN(priv, "check CCK and short slot %d | %d\n",
652 counter++, error);
653
654 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
655 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
656 if (error)
657 IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
658 counter++, error);
659
660 error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
661 RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
662 if (error)
663 IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
664 counter++, error);
665
666 if (error)
667 IWL_WARN(priv, "Tuning to channel %d\n",
668 le16_to_cpu(rxon->channel));
669
670 if (error) {
671 IWL_ERR(priv, "Not a valid iwl_rxon_assoc_cmd field values\n");
672 return -1;
673 }
674 return 0;
675}
676EXPORT_SYMBOL(iwl_check_rxon_cmd);
677
678/**
679 * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
680 * @priv: staging_rxon is compared to active_rxon
681 *
682 * If the RXON structure is changing enough to require a new tune,
683 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
684 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
685 */
686int iwl_full_rxon_required(struct iwl_priv *priv)
687{
688
689 /* These items are only settable from the full RXON command */
690 if (!(iwl_is_associated(priv)) ||
691 compare_ether_addr(priv->staging_rxon.bssid_addr,
692 priv->active_rxon.bssid_addr) ||
693 compare_ether_addr(priv->staging_rxon.node_addr,
694 priv->active_rxon.node_addr) ||
695 compare_ether_addr(priv->staging_rxon.wlap_bssid_addr,
696 priv->active_rxon.wlap_bssid_addr) ||
697 (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) ||
698 (priv->staging_rxon.channel != priv->active_rxon.channel) ||
699 (priv->staging_rxon.air_propagation !=
700 priv->active_rxon.air_propagation) ||
701 (priv->staging_rxon.ofdm_ht_single_stream_basic_rates !=
702 priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
703 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
704 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
705 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
706 return 1;
707
708 /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
709 * be updated with the RXON_ASSOC command -- however only some
710 * flag transitions are allowed using RXON_ASSOC */
711
712 /* Check if we are not switching bands */
713 if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
714 (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
715 return 1;
716
717 /* Check if we are switching association toggle */
718 if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
719 (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
720 return 1;
721
722 return 0;
723}
724EXPORT_SYMBOL(iwl_full_rxon_required);
725
726u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
727{
728 int i;
729 int rate_mask;
730
731 /* Set rate mask*/
732 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
733 rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
734 else
735 rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
736
737 /* Find lowest valid rate */
738 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
739 i = iwl_rates[i].next_ieee) {
740 if (rate_mask & (1 << i))
741 return iwl_rates[i].plcp;
742 }
743
744 /* No valid rate was found. Assign the lowest one */
745 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
746 return IWL_RATE_1M_PLCP;
747 else
748 return IWL_RATE_6M_PLCP;
749}
750EXPORT_SYMBOL(iwl_rate_get_lowest_plcp);
751
589void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) 752void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
590{ 753{
591 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 754 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
@@ -821,6 +984,277 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch)
821} 984}
822EXPORT_SYMBOL(iwl_set_rxon_channel); 985EXPORT_SYMBOL(iwl_set_rxon_channel);
823 986
987void iwl_set_flags_for_band(struct iwl_priv *priv,
988 enum ieee80211_band band)
989{
990 if (band == IEEE80211_BAND_5GHZ) {
991 priv->staging_rxon.flags &=
992 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
993 | RXON_FLG_CCK_MSK);
994 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
995 } else {
996 /* Copied from iwl_post_associate() */
997 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
998 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
999 else
1000 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1001
1002 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
1003 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1004
1005 priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
1006 priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
1007 priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK;
1008 }
1009}
1010EXPORT_SYMBOL(iwl_set_flags_for_band);
1011
1012/*
1013 * initialize rxon structure with default values from eeprom
1014 */
1015void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode)
1016{
1017 const struct iwl_channel_info *ch_info;
1018
1019 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
1020
1021 switch (mode) {
1022 case NL80211_IFTYPE_AP:
1023 priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
1024 break;
1025
1026 case NL80211_IFTYPE_STATION:
1027 priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS;
1028 priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
1029 break;
1030
1031 case NL80211_IFTYPE_ADHOC:
1032 priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS;
1033 priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
1034 priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
1035 RXON_FILTER_ACCEPT_GRP_MSK;
1036 break;
1037
1038 case NL80211_IFTYPE_MONITOR:
1039 priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
1040 priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
1041 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
1042 break;
1043 default:
1044 IWL_ERR(priv, "Unsupported interface type %d\n", mode);
1045 break;
1046 }
1047
1048#if 0
1049 /* TODO: Figure out when short_preamble would be set and cache from
1050 * that */
1051 if (!hw_to_local(priv->hw)->short_preamble)
1052 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
1053 else
1054 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
1055#endif
1056
1057 ch_info = iwl_get_channel_info(priv, priv->band,
1058 le16_to_cpu(priv->active_rxon.channel));
1059
1060 if (!ch_info)
1061 ch_info = &priv->channel_info[0];
1062
1063 /*
1064 * in some case A channels are all non IBSS
1065 * in this case force B/G channel
1066 */
1067 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
1068 !(is_channel_ibss(ch_info)))
1069 ch_info = &priv->channel_info[0];
1070
1071 priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
1072 priv->band = ch_info->band;
1073
1074 iwl_set_flags_for_band(priv, priv->band);
1075
1076 priv->staging_rxon.ofdm_basic_rates =
1077 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1078 priv->staging_rxon.cck_basic_rates =
1079 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1080
1081 priv->staging_rxon.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
1082 RXON_FLG_CHANNEL_MODE_PURE_40_MSK);
1083 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
1084 memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN);
1085 priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff;
1086 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff;
1087}
1088EXPORT_SYMBOL(iwl_connection_init_rx_config);
1089
1090void iwl_set_rate(struct iwl_priv *priv)
1091{
1092 const struct ieee80211_supported_band *hw = NULL;
1093 struct ieee80211_rate *rate;
1094 int i;
1095
1096 hw = iwl_get_hw_mode(priv, priv->band);
1097 if (!hw) {
1098 IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
1099 return;
1100 }
1101
1102 priv->active_rate = 0;
1103 priv->active_rate_basic = 0;
1104
1105 for (i = 0; i < hw->n_bitrates; i++) {
1106 rate = &(hw->bitrates[i]);
1107 if (rate->hw_value < IWL_RATE_COUNT)
1108 priv->active_rate |= (1 << rate->hw_value);
1109 }
1110
1111 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
1112 priv->active_rate, priv->active_rate_basic);
1113
1114 /*
1115 * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
1116 * otherwise set it to the default of all CCK rates and 6, 12, 24 for
1117 * OFDM
1118 */
1119 if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
1120 priv->staging_rxon.cck_basic_rates =
1121 ((priv->active_rate_basic &
1122 IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
1123 else
1124 priv->staging_rxon.cck_basic_rates =
1125 (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1126
1127 if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
1128 priv->staging_rxon.ofdm_basic_rates =
1129 ((priv->active_rate_basic &
1130 (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
1131 IWL_FIRST_OFDM_RATE) & 0xFF;
1132 else
1133 priv->staging_rxon.ofdm_basic_rates =
1134 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1135}
1136EXPORT_SYMBOL(iwl_set_rate);
1137
1138void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1139{
1140 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
1141 struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon;
1142 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
1143 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
1144 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
1145 rxon->channel = csa->channel;
1146 priv->staging_rxon.channel = csa->channel;
1147}
1148EXPORT_SYMBOL(iwl_rx_csa);
1149
1150#ifdef CONFIG_IWLWIFI_DEBUG
1151static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
1152{
1153 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
1154
1155 IWL_DEBUG_RADIO("RX CONFIG:\n");
1156 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
1157 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
1158 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
1159 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
1160 le32_to_cpu(rxon->filter_flags));
1161 IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
1162 IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
1163 rxon->ofdm_basic_rates);
1164 IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
1165 IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
1166 IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
1167 IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
1168}
1169#endif
1170
1171/**
1172 * iwl_irq_handle_error - called for HW or SW error interrupt from card
1173 */
1174void iwl_irq_handle_error(struct iwl_priv *priv)
1175{
1176 /* Set the FW error flag -- cleared on iwl_down */
1177 set_bit(STATUS_FW_ERROR, &priv->status);
1178
1179 /* Cancel currently queued command. */
1180 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
1181
1182#ifdef CONFIG_IWLWIFI_DEBUG
1183 if (priv->debug_level & IWL_DL_FW_ERRORS) {
1184 iwl_dump_nic_error_log(priv);
1185 iwl_dump_nic_event_log(priv);
1186 iwl_print_rx_config_cmd(priv);
1187 }
1188#endif
1189
1190 wake_up_interruptible(&priv->wait_command_queue);
1191
1192 /* Keep the restart process from trying to send host
1193 * commands by clearing the INIT status bit */
1194 clear_bit(STATUS_READY, &priv->status);
1195
1196 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
1197 IWL_DEBUG(IWL_DL_FW_ERRORS,
1198 "Restarting adapter due to uCode error.\n");
1199
1200 if (iwl_is_associated(priv)) {
1201 memcpy(&priv->recovery_rxon, &priv->active_rxon,
1202 sizeof(priv->recovery_rxon));
1203 priv->error_recovering = 1;
1204 }
1205 if (priv->cfg->mod_params->restart_fw)
1206 queue_work(priv->workqueue, &priv->restart);
1207 }
1208}
1209EXPORT_SYMBOL(iwl_irq_handle_error);
1210
1211void iwl_configure_filter(struct ieee80211_hw *hw,
1212 unsigned int changed_flags,
1213 unsigned int *total_flags,
1214 int mc_count, struct dev_addr_list *mc_list)
1215{
1216 struct iwl_priv *priv = hw->priv;
1217 __le32 *filter_flags = &priv->staging_rxon.filter_flags;
1218
1219 IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
1220 changed_flags, *total_flags);
1221
1222 if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
1223 if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
1224 *filter_flags |= RXON_FILTER_PROMISC_MSK;
1225 else
1226 *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
1227 }
1228 if (changed_flags & FIF_ALLMULTI) {
1229 if (*total_flags & FIF_ALLMULTI)
1230 *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
1231 else
1232 *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
1233 }
1234 if (changed_flags & FIF_CONTROL) {
1235 if (*total_flags & FIF_CONTROL)
1236 *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
1237 else
1238 *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
1239 }
1240 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
1241 if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
1242 *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
1243 else
1244 *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
1245 }
1246
1247 /* We avoid iwl_commit_rxon here to commit the new filter flags
1248 * since mac80211 will call ieee80211_hw_config immediately.
1249 * (mc_list is not supported at this time). Otherwise, we need to
1250 * queue a background iwl_commit_rxon work.
1251 */
1252
1253 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
1254 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
1255}
1256EXPORT_SYMBOL(iwl_configure_filter);
1257
824int iwl_setup_mac(struct iwl_priv *priv) 1258int iwl_setup_mac(struct iwl_priv *priv)
825{ 1259{
826 int ret; 1260 int ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 3c6a4b0c2c3b..0a719aeb7349 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -221,11 +221,25 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
221 struct ieee80211_ops *hw_ops); 221 struct ieee80211_ops *hw_ops);
222void iwl_hw_detect(struct iwl_priv *priv); 222void iwl_hw_detect(struct iwl_priv *priv);
223void iwl_reset_qos(struct iwl_priv *priv); 223void iwl_reset_qos(struct iwl_priv *priv);
224void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt);
225int iwl_check_rxon_cmd(struct iwl_priv *priv);
226int iwl_full_rxon_required(struct iwl_priv *priv);
224void iwl_set_rxon_chain(struct iwl_priv *priv); 227void iwl_set_rxon_chain(struct iwl_priv *priv);
225int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); 228int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
226void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); 229void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
227u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, 230u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
228 struct ieee80211_sta_ht_cap *sta_ht_inf); 231 struct ieee80211_sta_ht_cap *sta_ht_inf);
232void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band);
233void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode);
234int iwl_set_decrypted_flag(struct iwl_priv *priv,
235 struct ieee80211_hdr *hdr,
236 u32 decrypt_res,
237 struct ieee80211_rx_status *stats);
238void iwl_irq_handle_error(struct iwl_priv *priv);
239void iwl_configure_filter(struct ieee80211_hw *hw,
240 unsigned int changed_flags,
241 unsigned int *total_flags,
242 int mc_count, struct dev_addr_list *mc_list);
229int iwl_hw_nic_init(struct iwl_priv *priv); 243int iwl_hw_nic_init(struct iwl_priv *priv);
230int iwl_setup_mac(struct iwl_priv *priv); 244int iwl_setup_mac(struct iwl_priv *priv);
231int iwl_set_hw_params(struct iwl_priv *priv); 245int iwl_set_hw_params(struct iwl_priv *priv);
@@ -253,6 +267,7 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
253 struct iwl_rx_mem_buffer *rxb); 267 struct iwl_rx_mem_buffer *rxb);
254void iwl_rx_statistics(struct iwl_priv *priv, 268void iwl_rx_statistics(struct iwl_priv *priv,
255 struct iwl_rx_mem_buffer *rxb); 269 struct iwl_rx_mem_buffer *rxb);
270void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
256 271
257/* TX helpers */ 272/* TX helpers */
258 273
@@ -296,6 +311,10 @@ void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
296 struct ieee80211_tx_info *info); 311 struct ieee80211_tx_info *info);
297int iwl_hwrate_to_plcp_idx(u32 rate_n_flags); 312int iwl_hwrate_to_plcp_idx(u32 rate_n_flags);
298 313
314u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv);
315
316void iwl_set_rate(struct iwl_priv *priv);
317
299u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx); 318u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx);
300 319
301static inline u32 iwl_ant_idx_to_flags(u8 ant_idx) 320static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 437c05b9a335..b9954bc89cf2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1078,13 +1078,6 @@ struct iwl_priv {
1078 1078
1079 /*For 3945*/ 1079 /*For 3945*/
1080#define IWL_DEFAULT_TX_POWER 0x0F 1080#define IWL_DEFAULT_TX_POWER 0x0F
1081 /* We declare this const so it can only be
1082 * changed via explicit cast within the
1083 * routines that actually update the physical
1084 * hardware */
1085 const struct iwl3945_rxon_cmd active39_rxon;
1086 struct iwl3945_rxon_cmd staging39_rxon;
1087 struct iwl3945_rxon_cmd recovery39_rxon;
1088 1081
1089 struct iwl3945_notif_statistics statistics_39; 1082 struct iwl3945_notif_statistics statistics_39;
1090 1083
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 33145207fc15..c8865d0b9067 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -772,10 +772,10 @@ static void iwl_update_rx_stats(struct iwl_priv *priv, u16 fc, u16 len)
772/* 772/*
773 * returns non-zero if packet should be dropped 773 * returns non-zero if packet should be dropped
774 */ 774 */
775static int iwl_set_decrypted_flag(struct iwl_priv *priv, 775int iwl_set_decrypted_flag(struct iwl_priv *priv,
776 struct ieee80211_hdr *hdr, 776 struct ieee80211_hdr *hdr,
777 u32 decrypt_res, 777 u32 decrypt_res,
778 struct ieee80211_rx_status *stats) 778 struct ieee80211_rx_status *stats)
779{ 779{
780 u16 fc = le16_to_cpu(hdr->frame_control); 780 u16 fc = le16_to_cpu(hdr->frame_control);
781 781
@@ -815,6 +815,7 @@ static int iwl_set_decrypted_flag(struct iwl_priv *priv,
815 } 815 }
816 return 0; 816 return 0;
817} 817}
818EXPORT_SYMBOL(iwl_set_decrypted_flag);
818 819
819static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) 820static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
820{ 821{
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 25a350810a10..6a2c8a3a3d5e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -233,166 +233,6 @@ u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flag
233 233
234} 234}
235 235
236/**
237 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
238 * @band: 2.4 or 5 GHz band
239 * @channel: Any channel valid for the requested band
240
241 * In addition to setting the staging RXON, priv->band is also set.
242 *
243 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
244 * in the staging RXON flag structure based on the band
245 */
246static int iwl3945_set_rxon_channel(struct iwl_priv *priv,
247 enum ieee80211_band band,
248 u16 channel)
249{
250 if (!iwl_get_channel_info(priv, band, channel)) {
251 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
252 channel, band);
253 return -EINVAL;
254 }
255
256 if ((le16_to_cpu(priv->staging39_rxon.channel) == channel) &&
257 (priv->band == band))
258 return 0;
259
260 priv->staging39_rxon.channel = cpu_to_le16(channel);
261 if (band == IEEE80211_BAND_5GHZ)
262 priv->staging39_rxon.flags &= ~RXON_FLG_BAND_24G_MSK;
263 else
264 priv->staging39_rxon.flags |= RXON_FLG_BAND_24G_MSK;
265
266 priv->band = band;
267
268 IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
269
270 return 0;
271}
272
273/**
274 * iwl3945_check_rxon_cmd - validate RXON structure is valid
275 *
276 * NOTE: This is really only useful during development and can eventually
277 * be #ifdef'd out once the driver is stable and folks aren't actively
278 * making changes
279 */
280static int iwl3945_check_rxon_cmd(struct iwl_priv *priv)
281{
282 int error = 0;
283 int counter = 1;
284 struct iwl3945_rxon_cmd *rxon = &priv->staging39_rxon;
285
286 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
287 error |= le32_to_cpu(rxon->flags &
288 (RXON_FLG_TGJ_NARROW_BAND_MSK |
289 RXON_FLG_RADAR_DETECT_MSK));
290 if (error)
291 IWL_WARN(priv, "check 24G fields %d | %d\n",
292 counter++, error);
293 } else {
294 error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
295 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
296 if (error)
297 IWL_WARN(priv, "check 52 fields %d | %d\n",
298 counter++, error);
299 error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
300 if (error)
301 IWL_WARN(priv, "check 52 CCK %d | %d\n",
302 counter++, error);
303 }
304 error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
305 if (error)
306 IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
307
308 /* make sure basic rates 6Mbps and 1Mbps are supported */
309 error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
310 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
311 if (error)
312 IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
313
314 error |= (le16_to_cpu(rxon->assoc_id) > 2007);
315 if (error)
316 IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
317
318 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
319 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
320 if (error)
321 IWL_WARN(priv, "check CCK and short slot %d | %d\n",
322 counter++, error);
323
324 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
325 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
326 if (error)
327 IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
328 counter++, error);
329
330 error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
331 RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
332 if (error)
333 IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
334 counter++, error);
335
336 if ((rxon->flags & RXON_FLG_DIS_DIV_MSK))
337 error |= ((rxon->flags & (RXON_FLG_ANT_B_MSK |
338 RXON_FLG_ANT_A_MSK)) == 0);
339 if (error)
340 IWL_WARN(priv, "check antenna %d %d\n", counter++, error);
341
342 if (error)
343 IWL_WARN(priv, "Tuning to channel %d\n",
344 le16_to_cpu(rxon->channel));
345
346 if (error) {
347 IWL_ERR(priv, "Not a valid rxon_assoc_cmd field values\n");
348 return -1;
349 }
350 return 0;
351}
352
353/**
354 * iwl3945_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
355 * @priv: staging_rxon is compared to active_rxon
356 *
357 * If the RXON structure is changing enough to require a new tune,
358 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
359 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
360 */
361static int iwl3945_full_rxon_required(struct iwl_priv *priv)
362{
363
364 /* These items are only settable from the full RXON command */
365 if (!(iwl3945_is_associated(priv)) ||
366 compare_ether_addr(priv->staging39_rxon.bssid_addr,
367 priv->active39_rxon.bssid_addr) ||
368 compare_ether_addr(priv->staging39_rxon.node_addr,
369 priv->active39_rxon.node_addr) ||
370 compare_ether_addr(priv->staging39_rxon.wlap_bssid_addr,
371 priv->active39_rxon.wlap_bssid_addr) ||
372 (priv->staging39_rxon.dev_type != priv->active39_rxon.dev_type) ||
373 (priv->staging39_rxon.channel != priv->active39_rxon.channel) ||
374 (priv->staging39_rxon.air_propagation !=
375 priv->active39_rxon.air_propagation) ||
376 (priv->staging39_rxon.assoc_id != priv->active39_rxon.assoc_id))
377 return 1;
378
379 /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
380 * be updated with the RXON_ASSOC command -- however only some
381 * flag transitions are allowed using RXON_ASSOC */
382
383 /* Check if we are not switching bands */
384 if ((priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
385 (priv->active39_rxon.flags & RXON_FLG_BAND_24G_MSK))
386 return 1;
387
388 /* Check if we are switching association toggle */
389 if ((priv->staging39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
390 (priv->active39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
391 return 1;
392
393 return 0;
394}
395
396static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) 236static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
397{ 237{
398 int rc = 0; 238 int rc = 0;
@@ -404,8 +244,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
404 .meta.flags = CMD_WANT_SKB, 244 .meta.flags = CMD_WANT_SKB,
405 .data = &rxon_assoc, 245 .data = &rxon_assoc,
406 }; 246 };
407 const struct iwl3945_rxon_cmd *rxon1 = &priv->staging39_rxon; 247 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon;
408 const struct iwl3945_rxon_cmd *rxon2 = &priv->active39_rxon; 248 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon;
409 249
410 if ((rxon1->flags == rxon2->flags) && 250 if ((rxon1->flags == rxon2->flags) &&
411 (rxon1->filter_flags == rxon2->filter_flags) && 251 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -415,10 +255,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
415 return 0; 255 return 0;
416 } 256 }
417 257
418 rxon_assoc.flags = priv->staging39_rxon.flags; 258 rxon_assoc.flags = priv->staging_rxon.flags;
419 rxon_assoc.filter_flags = priv->staging39_rxon.filter_flags; 259 rxon_assoc.filter_flags = priv->staging_rxon.filter_flags;
420 rxon_assoc.ofdm_basic_rates = priv->staging39_rxon.ofdm_basic_rates; 260 rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates;
421 rxon_assoc.cck_basic_rates = priv->staging39_rxon.cck_basic_rates; 261 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
422 rxon_assoc.reserved = 0; 262 rxon_assoc.reserved = 0;
423 263
424 rc = iwl_send_cmd_sync(priv, &cmd); 264 rc = iwl_send_cmd_sync(priv, &cmd);
@@ -485,21 +325,22 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
485static int iwl3945_commit_rxon(struct iwl_priv *priv) 325static int iwl3945_commit_rxon(struct iwl_priv *priv)
486{ 326{
487 /* cast away the const for active_rxon in this function */ 327 /* cast away the const for active_rxon in this function */
488 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active39_rxon; 328 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
329 struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon;
489 int rc = 0; 330 int rc = 0;
490 331
491 if (!iwl_is_alive(priv)) 332 if (!iwl_is_alive(priv))
492 return -1; 333 return -1;
493 334
494 /* always get timestamp with Rx frame */ 335 /* always get timestamp with Rx frame */
495 priv->staging39_rxon.flags |= RXON_FLG_TSF2HOST_MSK; 336 staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK;
496 337
497 /* select antenna */ 338 /* select antenna */
498 priv->staging39_rxon.flags &= 339 staging_rxon->flags &=
499 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 340 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
500 priv->staging39_rxon.flags |= iwl3945_get_antenna_flags(priv); 341 staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
501 342
502 rc = iwl3945_check_rxon_cmd(priv); 343 rc = iwl_check_rxon_cmd(priv);
503 if (rc) { 344 if (rc) {
504 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 345 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
505 return -EINVAL; 346 return -EINVAL;
@@ -508,7 +349,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
508 /* If we don't need to send a full RXON, we can use 349 /* If we don't need to send a full RXON, we can use
509 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter 350 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
510 * and other flags for the current radio configuration. */ 351 * and other flags for the current radio configuration. */
511 if (!iwl3945_full_rxon_required(priv)) { 352 if (!iwl_full_rxon_required(priv)) {
512 rc = iwl3945_send_rxon_assoc(priv); 353 rc = iwl3945_send_rxon_assoc(priv);
513 if (rc) { 354 if (rc) {
514 IWL_ERR(priv, "Error setting RXON_ASSOC " 355 IWL_ERR(priv, "Error setting RXON_ASSOC "
@@ -516,7 +357,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
516 return rc; 357 return rc;
517 } 358 }
518 359
519 memcpy(active_rxon, &priv->staging39_rxon, sizeof(*active_rxon)); 360 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
520 361
521 return 0; 362 return 0;
522 } 363 }
@@ -525,14 +366,20 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
525 * an RXON_ASSOC and the new config wants the associated mask enabled, 366 * an RXON_ASSOC and the new config wants the associated mask enabled,
526 * we must clear the associated from the active configuration 367 * we must clear the associated from the active configuration
527 * before we apply the new config */ 368 * before we apply the new config */
528 if (iwl3945_is_associated(priv) && 369 if (iwl_is_associated(priv) &&
529 (priv->staging39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 370 (staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK)) {
530 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 371 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
531 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 372 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
532 373
374 /*
375 * reserved4 and 5 could have been filled by the iwlcore code.
376 * Let's clear them before pushing to the 3945.
377 */
378 active_rxon->reserved4 = 0;
379 active_rxon->reserved5 = 0;
533 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 380 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
534 sizeof(struct iwl3945_rxon_cmd), 381 sizeof(struct iwl3945_rxon_cmd),
535 &priv->active39_rxon); 382 &priv->active_rxon);
536 383
537 /* If the mask clearing failed then we set 384 /* If the mask clearing failed then we set
538 * active_rxon back to what it was previously */ 385 * active_rxon back to what it was previously */
@@ -548,20 +395,28 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
548 "* with%s RXON_FILTER_ASSOC_MSK\n" 395 "* with%s RXON_FILTER_ASSOC_MSK\n"
549 "* channel = %d\n" 396 "* channel = %d\n"
550 "* bssid = %pM\n", 397 "* bssid = %pM\n",
551 ((priv->staging39_rxon.filter_flags & 398 ((priv->staging_rxon.filter_flags &
552 RXON_FILTER_ASSOC_MSK) ? "" : "out"), 399 RXON_FILTER_ASSOC_MSK) ? "" : "out"),
553 le16_to_cpu(priv->staging39_rxon.channel), 400 le16_to_cpu(staging_rxon->channel),
554 priv->staging_rxon.bssid_addr); 401 staging_rxon->bssid_addr);
402
403 /*
404 * reserved4 and 5 could have been filled by the iwlcore code.
405 * Let's clear them before pushing to the 3945.
406 */
407 staging_rxon->reserved4 = 0;
408 staging_rxon->reserved5 = 0;
555 409
556 /* Apply the new configuration */ 410 /* Apply the new configuration */
557 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 411 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
558 sizeof(struct iwl3945_rxon_cmd), &priv->staging39_rxon); 412 sizeof(struct iwl3945_rxon_cmd),
413 staging_rxon);
559 if (rc) { 414 if (rc) {
560 IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); 415 IWL_ERR(priv, "Error setting new configuration (%d).\n", rc);
561 return rc; 416 return rc;
562 } 417 }
563 418
564 memcpy(active_rxon, &priv->staging39_rxon, sizeof(*active_rxon)); 419 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
565 420
566 iwl3945_clear_stations_table(priv); 421 iwl3945_clear_stations_table(priv);
567 422
@@ -582,9 +437,10 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
582 437
583 /* If we have set the ASSOC_MSK and we are in BSS mode then 438 /* If we have set the ASSOC_MSK and we are in BSS mode then
584 * add the IWL_AP_ID to the station rate table */ 439 * add the IWL_AP_ID to the station rate table */
585 if (iwl3945_is_associated(priv) && 440 if (iwl_is_associated(priv) &&
586 (priv->iw_mode == NL80211_IFTYPE_STATION)) 441 (priv->iw_mode == NL80211_IFTYPE_STATION))
587 if (iwl3945_add_station(priv, priv->active39_rxon.bssid_addr, 1, 0) 442 if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr,
443 1, 0)
588 == IWL_INVALID_STATION) { 444 == IWL_INVALID_STATION) {
589 IWL_ERR(priv, "Error adding AP address for transmit\n"); 445 IWL_ERR(priv, "Error adding AP address for transmit\n");
590 return -EIO; 446 return -EIO;
@@ -710,7 +566,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
710 int left) 566 int left)
711{ 567{
712 568
713 if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || 569 if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
714 ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && 570 ((priv->iw_mode != NL80211_IFTYPE_ADHOC) &&
715 (priv->iw_mode != NL80211_IFTYPE_AP))) 571 (priv->iw_mode != NL80211_IFTYPE_AP)))
716 return 0; 572 return 0;
@@ -723,30 +579,6 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
723 return priv->ibss_beacon->len; 579 return priv->ibss_beacon->len;
724} 580}
725 581
726static u8 iwl3945_rate_get_lowest_plcp(struct iwl_priv *priv)
727{
728 u8 i;
729 int rate_mask;
730
731 /* Set rate mask*/
732 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK)
733 rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
734 else
735 rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
736
737 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
738 i = iwl3945_rates[i].next_ieee) {
739 if (rate_mask & (1 << i))
740 return iwl3945_rates[i].plcp;
741 }
742
743 /* No valid rate was found. Assign the lowest one */
744 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK)
745 return IWL_RATE_1M_PLCP;
746 else
747 return IWL_RATE_6M_PLCP;
748}
749
750static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) 582static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
751{ 583{
752 struct iwl3945_frame *frame; 584 struct iwl3945_frame *frame;
@@ -762,7 +594,7 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
762 return -ENOMEM; 594 return -ENOMEM;
763 } 595 }
764 596
765 rate = iwl3945_rate_get_lowest_plcp(priv); 597 rate = iwl_rate_get_lowest_plcp(priv);
766 598
767 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); 599 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
768 600
@@ -815,7 +647,7 @@ static void iwl3945_activate_qos(struct iwl_priv *priv, u8 force)
815 647
816 spin_unlock_irqrestore(&priv->lock, flags); 648 spin_unlock_irqrestore(&priv->lock, flags);
817 649
818 if (force || iwl3945_is_associated(priv)) { 650 if (force || iwl_is_associated(priv)) {
819 IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n", 651 IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n",
820 priv->qos_data.qos_active); 652 priv->qos_data.qos_active);
821 653
@@ -1082,115 +914,6 @@ static int iwl3945_scan_initiate(struct iwl_priv *priv)
1082 return 0; 914 return 0;
1083} 915}
1084 916
1085static int iwl3945_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
1086{
1087 struct iwl3945_rxon_cmd *rxon = &priv->staging39_rxon;
1088
1089 if (hw_decrypt)
1090 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
1091 else
1092 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
1093
1094 return 0;
1095}
1096
1097static void iwl3945_set_flags_for_phymode(struct iwl_priv *priv,
1098 enum ieee80211_band band)
1099{
1100 if (band == IEEE80211_BAND_5GHZ) {
1101 priv->staging39_rxon.flags &=
1102 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
1103 | RXON_FLG_CCK_MSK);
1104 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
1105 } else {
1106 /* Copied from iwl3945_bg_post_associate() */
1107 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
1108 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
1109 else
1110 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1111
1112 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
1113 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1114
1115 priv->staging39_rxon.flags |= RXON_FLG_BAND_24G_MSK;
1116 priv->staging39_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
1117 priv->staging39_rxon.flags &= ~RXON_FLG_CCK_MSK;
1118 }
1119}
1120
1121/*
1122 * initialize rxon structure with default values from eeprom
1123 */
1124static void iwl3945_connection_init_rx_config(struct iwl_priv *priv,
1125 int mode)
1126{
1127 const struct iwl_channel_info *ch_info;
1128
1129 memset(&priv->staging39_rxon, 0, sizeof(priv->staging39_rxon));
1130
1131 switch (mode) {
1132 case NL80211_IFTYPE_AP:
1133 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_AP;
1134 break;
1135
1136 case NL80211_IFTYPE_STATION:
1137 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_ESS;
1138 priv->staging39_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
1139 break;
1140
1141 case NL80211_IFTYPE_ADHOC:
1142 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_IBSS;
1143 priv->staging39_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
1144 priv->staging39_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
1145 RXON_FILTER_ACCEPT_GRP_MSK;
1146 break;
1147
1148 case NL80211_IFTYPE_MONITOR:
1149 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
1150 priv->staging39_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
1151 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
1152 break;
1153 default:
1154 IWL_ERR(priv, "Unsupported interface type %d\n", mode);
1155 break;
1156 }
1157
1158#if 0
1159 /* TODO: Figure out when short_preamble would be set and cache from
1160 * that */
1161 if (!hw_to_local(priv->hw)->short_preamble)
1162 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
1163 else
1164 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
1165#endif
1166
1167 ch_info = iwl_get_channel_info(priv, priv->band,
1168 le16_to_cpu(priv->active39_rxon.channel));
1169
1170 if (!ch_info)
1171 ch_info = &priv->channel_info[0];
1172
1173 /*
1174 * in some case A channels are all non IBSS
1175 * in this case force B/G channel
1176 */
1177 if ((mode == NL80211_IFTYPE_ADHOC) && !(is_channel_ibss(ch_info)))
1178 ch_info = &priv->channel_info[0];
1179
1180 priv->staging39_rxon.channel = cpu_to_le16(ch_info->channel);
1181 if (is_channel_a_band(ch_info))
1182 priv->band = IEEE80211_BAND_5GHZ;
1183 else
1184 priv->band = IEEE80211_BAND_2GHZ;
1185
1186 iwl3945_set_flags_for_phymode(priv, priv->band);
1187
1188 priv->staging39_rxon.ofdm_basic_rates =
1189 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1190 priv->staging39_rxon.cck_basic_rates =
1191 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1192}
1193
1194static int iwl3945_set_mode(struct iwl_priv *priv, int mode) 917static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
1195{ 918{
1196 if (mode == NL80211_IFTYPE_ADHOC) { 919 if (mode == NL80211_IFTYPE_ADHOC) {
@@ -1198,17 +921,16 @@ static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
1198 921
1199 ch_info = iwl_get_channel_info(priv, 922 ch_info = iwl_get_channel_info(priv,
1200 priv->band, 923 priv->band,
1201 le16_to_cpu(priv->staging39_rxon.channel)); 924 le16_to_cpu(priv->staging_rxon.channel));
1202 925
1203 if (!ch_info || !is_channel_ibss(ch_info)) { 926 if (!ch_info || !is_channel_ibss(ch_info)) {
1204 IWL_ERR(priv, "channel %d not IBSS channel\n", 927 IWL_ERR(priv, "channel %d not IBSS channel\n",
1205 le16_to_cpu(priv->staging39_rxon.channel)); 928 le16_to_cpu(priv->staging_rxon.channel));
1206 return -EINVAL; 929 return -EINVAL;
1207 } 930 }
1208 } 931 }
1209 932
1210 iwl3945_connection_init_rx_config(priv, mode); 933 iwl_connection_init_rx_config(priv, mode);
1211 memcpy(priv->staging39_rxon.node_addr, priv->mac_addr, ETH_ALEN);
1212 934
1213 iwl3945_clear_stations_table(priv); 935 iwl3945_clear_stations_table(priv);
1214 936
@@ -1455,9 +1177,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1455 /* drop all data frame if we are not associated */ 1177 /* drop all data frame if we are not associated */
1456 if (ieee80211_is_data(fc) && 1178 if (ieee80211_is_data(fc) &&
1457 (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */ 1179 (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */
1458 (!iwl3945_is_associated(priv) || 1180 (!iwl_is_associated(priv) ||
1459 ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { 1181 ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) {
1460 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 1182 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n");
1461 goto drop_unlock; 1183 goto drop_unlock;
1462 } 1184 }
1463 1185
@@ -1622,60 +1344,6 @@ drop:
1622 return -1; 1344 return -1;
1623} 1345}
1624 1346
1625static void iwl3945_set_rate(struct iwl_priv *priv)
1626{
1627 const struct ieee80211_supported_band *sband = NULL;
1628 struct ieee80211_rate *rate;
1629 int i;
1630
1631 sband = iwl_get_hw_mode(priv, priv->band);
1632 if (!sband) {
1633 IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
1634 return;
1635 }
1636
1637 priv->active_rate = 0;
1638 priv->active_rate_basic = 0;
1639
1640 IWL_DEBUG_RATE("Setting rates for %s GHz\n",
1641 sband->band == IEEE80211_BAND_2GHZ ? "2.4" : "5");
1642
1643 for (i = 0; i < sband->n_bitrates; i++) {
1644 rate = &sband->bitrates[i];
1645 if ((rate->hw_value < IWL_RATE_COUNT) &&
1646 !(rate->flags & IEEE80211_CHAN_DISABLED)) {
1647 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)\n",
1648 rate->hw_value, iwl3945_rates[rate->hw_value].plcp);
1649 priv->active_rate |= (1 << rate->hw_value);
1650 }
1651 }
1652
1653 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
1654 priv->active_rate, priv->active_rate_basic);
1655
1656 /*
1657 * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
1658 * otherwise set it to the default of all CCK rates and 6, 12, 24 for
1659 * OFDM
1660 */
1661 if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
1662 priv->staging39_rxon.cck_basic_rates =
1663 ((priv->active_rate_basic &
1664 IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
1665 else
1666 priv->staging39_rxon.cck_basic_rates =
1667 (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1668
1669 if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
1670 priv->staging39_rxon.ofdm_basic_rates =
1671 ((priv->active_rate_basic &
1672 (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
1673 IWL_FIRST_OFDM_RATE) & 0xFF;
1674 else
1675 priv->staging39_rxon.ofdm_basic_rates =
1676 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1677}
1678
1679static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 1347static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1680{ 1348{
1681 unsigned long flags; 1349 unsigned long flags;
@@ -1726,38 +1394,6 @@ static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1726 return; 1394 return;
1727} 1395}
1728 1396
1729void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
1730 u32 decrypt_res, struct ieee80211_rx_status *stats)
1731{
1732 u16 fc =
1733 le16_to_cpu(((struct ieee80211_hdr *)skb->data)->frame_control);
1734
1735 if (priv->active39_rxon.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK)
1736 return;
1737
1738 if (!(fc & IEEE80211_FCTL_PROTECTED))
1739 return;
1740
1741 IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res);
1742 switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
1743 case RX_RES_STATUS_SEC_TYPE_TKIP:
1744 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
1745 RX_RES_STATUS_BAD_ICV_MIC)
1746 stats->flag |= RX_FLAG_MMIC_ERROR;
1747 case RX_RES_STATUS_SEC_TYPE_WEP:
1748 case RX_RES_STATUS_SEC_TYPE_CCMP:
1749 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
1750 RX_RES_STATUS_DECRYPT_OK) {
1751 IWL_DEBUG_RX("hw decrypt successfully!!!\n");
1752 stats->flag |= RX_FLAG_DECRYPTED;
1753 }
1754 break;
1755
1756 default:
1757 break;
1758 }
1759}
1760
1761#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 1397#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
1762 1398
1763#include "iwl-spectrum.h" 1399#include "iwl-spectrum.h"
@@ -1827,7 +1463,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1827 int spectrum_resp_status; 1463 int spectrum_resp_status;
1828 int duration = le16_to_cpu(params->duration); 1464 int duration = le16_to_cpu(params->duration);
1829 1465
1830 if (iwl3945_is_associated(priv)) 1466 if (iwl_is_associated(priv))
1831 add_time = 1467 add_time =
1832 iwl3945_usecs_to_beacons( 1468 iwl3945_usecs_to_beacons(
1833 le64_to_cpu(params->start_time) - priv->last_tsf, 1469 le64_to_cpu(params->start_time) - priv->last_tsf,
@@ -1842,7 +1478,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1842 cmd.len = sizeof(spectrum); 1478 cmd.len = sizeof(spectrum);
1843 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 1479 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
1844 1480
1845 if (iwl3945_is_associated(priv)) 1481 if (iwl_is_associated(priv))
1846 spectrum.start_time = 1482 spectrum.start_time =
1847 iwl3945_add_beacon_time(priv->last_beacon_time, 1483 iwl3945_add_beacon_time(priv->last_beacon_time,
1848 add_time, 1484 add_time,
@@ -1853,7 +1489,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1853 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); 1489 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT);
1854 spectrum.channels[0].channel = params->channel; 1490 spectrum.channels[0].channel = params->channel;
1855 spectrum.channels[0].type = type; 1491 spectrum.channels[0].type = type;
1856 if (priv->active39_rxon.flags & RXON_FLG_BAND_24G_MSK) 1492 if (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK)
1857 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 1493 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
1858 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 1494 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
1859 1495
@@ -1951,19 +1587,6 @@ static void iwl3945_rx_reply_error(struct iwl_priv *priv,
1951 le32_to_cpu(pkt->u.err_resp.error_info)); 1587 le32_to_cpu(pkt->u.err_resp.error_info));
1952} 1588}
1953 1589
1954#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
1955
1956static void iwl3945_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1957{
1958 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
1959 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active39_rxon;
1960 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
1961 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
1962 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
1963 rxon->channel = csa->channel;
1964 priv->staging39_rxon.channel = csa->channel;
1965}
1966
1967static void iwl3945_rx_spectrum_measure_notif(struct iwl_priv *priv, 1590static void iwl3945_rx_spectrum_measure_notif(struct iwl_priv *priv,
1968 struct iwl_rx_mem_buffer *rxb) 1591 struct iwl_rx_mem_buffer *rxb)
1969{ 1592{
@@ -2224,7 +1847,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
2224 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; 1847 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive;
2225 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; 1848 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta;
2226 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error; 1849 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error;
2227 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa; 1850 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa;
2228 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 1851 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
2229 iwl3945_rx_spectrum_measure_notif; 1852 iwl3945_rx_spectrum_measure_notif;
2230 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif; 1853 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif;
@@ -2728,26 +2351,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
2728 iwl3945_rx_queue_restock(priv); 2351 iwl3945_rx_queue_restock(priv);
2729} 2352}
2730 2353
2731#ifdef CONFIG_IWLWIFI_DEBUG
2732static void iwl3945_print_rx_config_cmd(struct iwl_priv *priv,
2733 struct iwl3945_rxon_cmd *rxon)
2734{
2735 IWL_DEBUG_RADIO("RX CONFIG:\n");
2736 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
2737 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
2738 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
2739 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
2740 le32_to_cpu(rxon->filter_flags));
2741 IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
2742 IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
2743 rxon->ofdm_basic_rates);
2744 IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
2745 IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
2746 IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
2747 IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
2748}
2749#endif
2750
2751static void iwl3945_enable_interrupts(struct iwl_priv *priv) 2354static void iwl3945_enable_interrupts(struct iwl_priv *priv)
2752{ 2355{
2753 IWL_DEBUG_ISR("Enabling interrupts\n"); 2356 IWL_DEBUG_ISR("Enabling interrupts\n");
@@ -2957,58 +2560,19 @@ static void iwl3945_dump_nic_event_log(struct iwl_priv *priv)
2957 iwl_release_nic_access(priv); 2560 iwl_release_nic_access(priv);
2958} 2561}
2959 2562
2960/**
2961 * iwl3945_irq_handle_error - called for HW or SW error interrupt from card
2962 */
2963static void iwl3945_irq_handle_error(struct iwl_priv *priv)
2964{
2965 /* Set the FW error flag -- cleared on iwl3945_down */
2966 set_bit(STATUS_FW_ERROR, &priv->status);
2967
2968 /* Cancel currently queued command. */
2969 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
2970
2971#ifdef CONFIG_IWLWIFI_DEBUG
2972 if (priv->debug_level & IWL_DL_FW_ERRORS) {
2973 iwl3945_dump_nic_error_log(priv);
2974 iwl3945_dump_nic_event_log(priv);
2975 iwl3945_print_rx_config_cmd(priv, &priv->staging39_rxon);
2976 }
2977#endif
2978
2979 wake_up_interruptible(&priv->wait_command_queue);
2980
2981 /* Keep the restart process from trying to send host
2982 * commands by clearing the INIT status bit */
2983 clear_bit(STATUS_READY, &priv->status);
2984
2985 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
2986 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
2987 "Restarting adapter due to uCode error.\n");
2988
2989 if (iwl3945_is_associated(priv)) {
2990 memcpy(&priv->recovery39_rxon, &priv->active39_rxon,
2991 sizeof(priv->recovery39_rxon));
2992 priv->error_recovering = 1;
2993 }
2994 if (priv->cfg->mod_params->restart_fw)
2995 queue_work(priv->workqueue, &priv->restart);
2996 }
2997}
2998
2999static void iwl3945_error_recovery(struct iwl_priv *priv) 2563static void iwl3945_error_recovery(struct iwl_priv *priv)
3000{ 2564{
3001 unsigned long flags; 2565 unsigned long flags;
3002 2566
3003 memcpy(&priv->staging39_rxon, &priv->recovery39_rxon, 2567 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
3004 sizeof(priv->staging39_rxon)); 2568 sizeof(priv->staging_rxon));
3005 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2569 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3006 iwl3945_commit_rxon(priv); 2570 iwl3945_commit_rxon(priv);
3007 2571
3008 iwl3945_add_station(priv, priv->bssid, 1, 0); 2572 iwl3945_add_station(priv, priv->bssid, 1, 0);
3009 2573
3010 spin_lock_irqsave(&priv->lock, flags); 2574 spin_lock_irqsave(&priv->lock, flags);
3011 priv->assoc_id = le16_to_cpu(priv->staging39_rxon.assoc_id); 2575 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
3012 priv->error_recovering = 0; 2576 priv->error_recovering = 0;
3013 spin_unlock_irqrestore(&priv->lock, flags); 2577 spin_unlock_irqrestore(&priv->lock, flags);
3014} 2578}
@@ -3061,7 +2625,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
3061 /* Tell the device to stop sending interrupts */ 2625 /* Tell the device to stop sending interrupts */
3062 iwl3945_disable_interrupts(priv); 2626 iwl3945_disable_interrupts(priv);
3063 2627
3064 iwl3945_irq_handle_error(priv); 2628 iwl_irq_handle_error(priv);
3065 2629
3066 handled |= CSR_INT_BIT_HW_ERR; 2630 handled |= CSR_INT_BIT_HW_ERR;
3067 2631
@@ -3089,7 +2653,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
3089 if (inta & CSR_INT_BIT_SW_ERR) { 2653 if (inta & CSR_INT_BIT_SW_ERR) {
3090 IWL_ERR(priv, "Microcode SW error detected. " 2654 IWL_ERR(priv, "Microcode SW error detected. "
3091 "Restarting 0x%X.\n", inta); 2655 "Restarting 0x%X.\n", inta);
3092 iwl3945_irq_handle_error(priv); 2656 iwl_irq_handle_error(priv);
3093 handled |= CSR_INT_BIT_SW_ERR; 2657 handled |= CSR_INT_BIT_SW_ERR;
3094 } 2658 }
3095 2659
@@ -3893,17 +3457,16 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
3893 3457
3894 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 3458 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
3895 3459
3896 if (iwl3945_is_associated(priv)) { 3460 if (iwl_is_associated(priv)) {
3897 struct iwl3945_rxon_cmd *active_rxon = 3461 struct iwl3945_rxon_cmd *active_rxon =
3898 (struct iwl3945_rxon_cmd *)(&priv->active39_rxon); 3462 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
3899 3463
3900 memcpy(&priv->staging39_rxon, &priv->active39_rxon, 3464 memcpy(&priv->staging_rxon, &priv->active_rxon,
3901 sizeof(priv->staging39_rxon)); 3465 sizeof(priv->staging_rxon));
3902 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3466 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3903 } else { 3467 } else {
3904 /* Initialize our rx_config data */ 3468 /* Initialize our rx_config data */
3905 iwl3945_connection_init_rx_config(priv, priv->iw_mode); 3469 iwl_connection_init_rx_config(priv, priv->iw_mode);
3906 memcpy(priv->staging39_rxon.node_addr, priv->mac_addr, ETH_ALEN);
3907 } 3470 }
3908 3471
3909 /* Configure Bluetooth device coexistence support */ 3472 /* Configure Bluetooth device coexistence support */
@@ -4278,7 +3841,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
4278 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 3841 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
4279 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 3842 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
4280 3843
4281 if (iwl3945_is_associated(priv)) { 3844 if (iwl_is_associated(priv)) {
4282 u16 interval = 0; 3845 u16 interval = 0;
4283 u32 extra; 3846 u32 extra;
4284 u32 suspend_time = 100; 3847 u32 suspend_time = 100;
@@ -4449,7 +4012,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4449 4012
4450 4013
4451 IWL_DEBUG_ASSOC("Associated as %d to: %pM\n", 4014 IWL_DEBUG_ASSOC("Associated as %d to: %pM\n",
4452 priv->assoc_id, priv->active39_rxon.bssid_addr); 4015 priv->assoc_id, priv->active_rxon.bssid_addr);
4453 4016
4454 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 4017 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
4455 return; 4018 return;
@@ -4461,7 +4024,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4461 4024
4462 conf = ieee80211_get_hw_conf(priv->hw); 4025 conf = ieee80211_get_hw_conf(priv->hw);
4463 4026
4464 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4027 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4465 iwl3945_commit_rxon(priv); 4028 iwl3945_commit_rxon(priv);
4466 4029
4467 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 4030 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
@@ -4472,26 +4035,26 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4472 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 4035 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
4473 "Attempting to continue.\n"); 4036 "Attempting to continue.\n");
4474 4037
4475 priv->staging39_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 4038 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
4476 4039
4477 priv->staging39_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 4040 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
4478 4041
4479 IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n", 4042 IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n",
4480 priv->assoc_id, priv->beacon_int); 4043 priv->assoc_id, priv->beacon_int);
4481 4044
4482 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 4045 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
4483 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 4046 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
4484 else 4047 else
4485 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 4048 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
4486 4049
4487 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) { 4050 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
4488 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 4051 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
4489 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 4052 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
4490 else 4053 else
4491 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 4054 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
4492 4055
4493 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 4056 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
4494 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 4057 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
4495 4058
4496 } 4059 }
4497 4060
@@ -4547,7 +4110,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
4547 /* we should be verifying the device is ready to be opened */ 4110 /* we should be verifying the device is ready to be opened */
4548 mutex_lock(&priv->mutex); 4111 mutex_lock(&priv->mutex);
4549 4112
4550 memset(&priv->staging39_rxon, 0, sizeof(struct iwl3945_rxon_cmd)); 4113 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
4551 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 4114 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
4552 * ucode filename and max sizes are card-specific. */ 4115 * ucode filename and max sizes are card-specific. */
4553 4116
@@ -4732,14 +4295,14 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
4732 goto out; 4295 goto out;
4733 } 4296 }
4734 4297
4735 iwl3945_set_rxon_channel(priv, conf->channel->band, conf->channel->hw_value); 4298 iwl_set_rxon_channel(priv, conf->channel);
4736 4299
4737 iwl3945_set_flags_for_phymode(priv, conf->channel->band); 4300 iwl_set_flags_for_band(priv, conf->channel->band);
4738 4301
4739 /* The list of supported rates and rate mask can be different 4302 /* The list of supported rates and rate mask can be different
4740 * for each phymode; since the phymode may have changed, reset 4303 * for each phymode; since the phymode may have changed, reset
4741 * the rate mask to what mac80211 lists */ 4304 * the rate mask to what mac80211 lists */
4742 iwl3945_set_rate(priv); 4305 iwl_set_rate(priv);
4743 4306
4744 spin_unlock_irqrestore(&priv->lock, flags); 4307 spin_unlock_irqrestore(&priv->lock, flags);
4745 4308
@@ -4763,10 +4326,10 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
4763 goto out; 4326 goto out;
4764 } 4327 }
4765 4328
4766 iwl3945_set_rate(priv); 4329 iwl_set_rate(priv);
4767 4330
4768 if (memcmp(&priv->active39_rxon, 4331 if (memcmp(&priv->active_rxon,
4769 &priv->staging39_rxon, sizeof(priv->staging39_rxon))) 4332 &priv->staging_rxon, sizeof(priv->staging_rxon)))
4770 iwl3945_commit_rxon(priv); 4333 iwl3945_commit_rxon(priv);
4771 else 4334 else
4772 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 4335 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
@@ -4787,10 +4350,10 @@ static void iwl3945_config_ap(struct iwl_priv *priv)
4787 return; 4350 return;
4788 4351
4789 /* The following should be done only at AP bring up */ 4352 /* The following should be done only at AP bring up */
4790 if (!(iwl3945_is_associated(priv))) { 4353 if (!(iwl_is_associated(priv))) {
4791 4354
4792 /* RXON - unassoc (to set timing command) */ 4355 /* RXON - unassoc (to set timing command) */
4793 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4356 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4794 iwl3945_commit_rxon(priv); 4357 iwl3945_commit_rxon(priv);
4795 4358
4796 /* RXON Timing */ 4359 /* RXON Timing */
@@ -4804,29 +4367,29 @@ static void iwl3945_config_ap(struct iwl_priv *priv)
4804 "Attempting to continue.\n"); 4367 "Attempting to continue.\n");
4805 4368
4806 /* FIXME: what should be the assoc_id for AP? */ 4369 /* FIXME: what should be the assoc_id for AP? */
4807 priv->staging39_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 4370 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
4808 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 4371 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
4809 priv->staging39_rxon.flags |= 4372 priv->staging_rxon.flags |=
4810 RXON_FLG_SHORT_PREAMBLE_MSK; 4373 RXON_FLG_SHORT_PREAMBLE_MSK;
4811 else 4374 else
4812 priv->staging39_rxon.flags &= 4375 priv->staging_rxon.flags &=
4813 ~RXON_FLG_SHORT_PREAMBLE_MSK; 4376 ~RXON_FLG_SHORT_PREAMBLE_MSK;
4814 4377
4815 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) { 4378 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
4816 if (priv->assoc_capability & 4379 if (priv->assoc_capability &
4817 WLAN_CAPABILITY_SHORT_SLOT_TIME) 4380 WLAN_CAPABILITY_SHORT_SLOT_TIME)
4818 priv->staging39_rxon.flags |= 4381 priv->staging_rxon.flags |=
4819 RXON_FLG_SHORT_SLOT_MSK; 4382 RXON_FLG_SHORT_SLOT_MSK;
4820 else 4383 else
4821 priv->staging39_rxon.flags &= 4384 priv->staging_rxon.flags &=
4822 ~RXON_FLG_SHORT_SLOT_MSK; 4385 ~RXON_FLG_SHORT_SLOT_MSK;
4823 4386
4824 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 4387 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
4825 priv->staging39_rxon.flags &= 4388 priv->staging_rxon.flags &=
4826 ~RXON_FLG_SHORT_SLOT_MSK; 4389 ~RXON_FLG_SHORT_SLOT_MSK;
4827 } 4390 }
4828 /* restore RXON assoc */ 4391 /* restore RXON assoc */
4829 priv->staging39_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 4392 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
4830 iwl3945_commit_rxon(priv); 4393 iwl3945_commit_rxon(priv);
4831 iwl3945_add_station(priv, iwl_bcast_addr, 0, 0); 4394 iwl3945_add_station(priv, iwl_bcast_addr, 0, 0);
4832 } 4395 }
@@ -4907,7 +4470,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4907 mutex_unlock(&priv->mutex); 4470 mutex_unlock(&priv->mutex);
4908 return -EAGAIN; 4471 return -EAGAIN;
4909 } 4472 }
4910 memcpy(priv->staging39_rxon.bssid_addr, conf->bssid, ETH_ALEN); 4473 memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN);
4911 4474
4912 /* TODO: Audit driver for usage of these members and see 4475 /* TODO: Audit driver for usage of these members and see
4913 * if mac80211 deprecates them (priv->bssid looks like it 4476 * if mac80211 deprecates them (priv->bssid looks like it
@@ -4921,12 +4484,12 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4921 rc = iwl3945_commit_rxon(priv); 4484 rc = iwl3945_commit_rxon(priv);
4922 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) 4485 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc)
4923 iwl3945_add_station(priv, 4486 iwl3945_add_station(priv,
4924 priv->active39_rxon.bssid_addr, 1, 0); 4487 priv->active_rxon.bssid_addr, 1, 0);
4925 } 4488 }
4926 4489
4927 } else { 4490 } else {
4928 iwl_scan_cancel_timeout(priv, 100); 4491 iwl_scan_cancel_timeout(priv, 100);
4929 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4492 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4930 iwl3945_commit_rxon(priv); 4493 iwl3945_commit_rxon(priv);
4931 } 4494 }
4932 4495
@@ -4937,52 +4500,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4937 return 0; 4500 return 0;
4938} 4501}
4939 4502
4940static void iwl3945_configure_filter(struct ieee80211_hw *hw,
4941 unsigned int changed_flags,
4942 unsigned int *total_flags,
4943 int mc_count, struct dev_addr_list *mc_list)
4944{
4945 struct iwl_priv *priv = hw->priv;
4946 __le32 *filter_flags = &priv->staging39_rxon.filter_flags;
4947
4948 IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
4949 changed_flags, *total_flags);
4950
4951 if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
4952 if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
4953 *filter_flags |= RXON_FILTER_PROMISC_MSK;
4954 else
4955 *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
4956 }
4957 if (changed_flags & FIF_ALLMULTI) {
4958 if (*total_flags & FIF_ALLMULTI)
4959 *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
4960 else
4961 *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
4962 }
4963 if (changed_flags & FIF_CONTROL) {
4964 if (*total_flags & FIF_CONTROL)
4965 *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
4966 else
4967 *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
4968 }
4969 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
4970 if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
4971 *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
4972 else
4973 *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
4974 }
4975
4976 /* We avoid iwl_commit_rxon here to commit the new filter flags
4977 * since mac80211 will call ieee80211_hw_config immediately.
4978 * (mc_list is not supported at this time). Otherwise, we need to
4979 * queue a background iwl_commit_rxon work.
4980 */
4981
4982 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
4983 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
4984}
4985
4986static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, 4503static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
4987 struct ieee80211_if_init_conf *conf) 4504 struct ieee80211_if_init_conf *conf)
4988{ 4505{
@@ -4994,7 +4511,7 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
4994 4511
4995 if (iwl_is_ready_rf(priv)) { 4512 if (iwl_is_ready_rf(priv)) {
4996 iwl_scan_cancel_timeout(priv, 100); 4513 iwl_scan_cancel_timeout(priv, 100);
4997 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4514 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4998 iwl3945_commit_rxon(priv); 4515 iwl3945_commit_rxon(priv);
4999 } 4516 }
5000 if (priv->vif == conf->vif) { 4517 if (priv->vif == conf->vif) {
@@ -5021,17 +4538,18 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
5021 IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n", 4538 IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
5022 bss_conf->use_short_preamble); 4539 bss_conf->use_short_preamble);
5023 if (bss_conf->use_short_preamble) 4540 if (bss_conf->use_short_preamble)
5024 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 4541 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
5025 else 4542 else
5026 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 4543 priv->staging_rxon.flags &=
4544 ~RXON_FLG_SHORT_PREAMBLE_MSK;
5027 } 4545 }
5028 4546
5029 if (changes & BSS_CHANGED_ERP_CTS_PROT) { 4547 if (changes & BSS_CHANGED_ERP_CTS_PROT) {
5030 IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot); 4548 IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
5031 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) 4549 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
5032 priv->staging39_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; 4550 priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
5033 else 4551 else
5034 priv->staging39_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 4552 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
5035 } 4553 }
5036 4554
5037 if (changes & BSS_CHANGED_ASSOC) { 4555 if (changes & BSS_CHANGED_ASSOC) {
@@ -5055,7 +4573,7 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
5055 priv->assoc_id = 0; 4573 priv->assoc_id = 0;
5056 IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc); 4574 IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
5057 } 4575 }
5058 } else if (changes && iwl3945_is_associated(priv) && priv->assoc_id) { 4576 } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
5059 IWL_DEBUG_MAC80211("Associated Changes %d\n", changes); 4577 IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
5060 iwl3945_send_rxon_assoc(priv); 4578 iwl3945_send_rxon_assoc(priv);
5061 } 4579 }
@@ -5148,7 +4666,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5148 case SET_KEY: 4666 case SET_KEY:
5149 ret = iwl3945_update_sta_key_info(priv, key, sta_id); 4667 ret = iwl3945_update_sta_key_info(priv, key, sta_id);
5150 if (!ret) { 4668 if (!ret) {
5151 iwl3945_set_rxon_hwcrypto(priv, 1); 4669 iwl_set_rxon_hwcrypto(priv, 1);
5152 iwl3945_commit_rxon(priv); 4670 iwl3945_commit_rxon(priv);
5153 key->hw_key_idx = sta_id; 4671 key->hw_key_idx = sta_id;
5154 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); 4672 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
@@ -5158,7 +4676,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5158 case DISABLE_KEY: 4676 case DISABLE_KEY:
5159 ret = iwl3945_clear_sta_key_info(priv, sta_id); 4677 ret = iwl3945_clear_sta_key_info(priv, sta_id);
5160 if (!ret) { 4678 if (!ret) {
5161 iwl3945_set_rxon_hwcrypto(priv, 0); 4679 iwl_set_rxon_hwcrypto(priv, 0);
5162 iwl3945_commit_rxon(priv); 4680 iwl3945_commit_rxon(priv);
5163 IWL_DEBUG_MAC80211("disable hwcrypto key\n"); 4681 IWL_DEBUG_MAC80211("disable hwcrypto key\n");
5164 } 4682 }
@@ -5210,7 +4728,7 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
5210 mutex_lock(&priv->mutex); 4728 mutex_lock(&priv->mutex);
5211 if (priv->iw_mode == NL80211_IFTYPE_AP) 4729 if (priv->iw_mode == NL80211_IFTYPE_AP)
5212 iwl3945_activate_qos(priv, 1); 4730 iwl3945_activate_qos(priv, 1);
5213 else if (priv->assoc_id && iwl3945_is_associated(priv)) 4731 else if (priv->assoc_id && iwl_is_associated(priv))
5214 iwl3945_activate_qos(priv, 0); 4732 iwl3945_activate_qos(priv, 0);
5215 4733
5216 mutex_unlock(&priv->mutex); 4734 mutex_unlock(&priv->mutex);
@@ -5292,7 +4810,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
5292 */ 4810 */
5293 if (priv->iw_mode != NL80211_IFTYPE_AP) { 4811 if (priv->iw_mode != NL80211_IFTYPE_AP) {
5294 iwl_scan_cancel_timeout(priv, 100); 4812 iwl_scan_cancel_timeout(priv, 100);
5295 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4813 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5296 iwl3945_commit_rxon(priv); 4814 iwl3945_commit_rxon(priv);
5297 } 4815 }
5298 4816
@@ -5304,7 +4822,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
5304 return; 4822 return;
5305 } 4823 }
5306 4824
5307 iwl3945_set_rate(priv); 4825 iwl_set_rate(priv);
5308 4826
5309 mutex_unlock(&priv->mutex); 4827 mutex_unlock(&priv->mutex);
5310 4828
@@ -5437,7 +4955,7 @@ static ssize_t show_flags(struct device *d,
5437{ 4955{
5438 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 4956 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
5439 4957
5440 return sprintf(buf, "0x%04X\n", priv->active39_rxon.flags); 4958 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
5441} 4959}
5442 4960
5443static ssize_t store_flags(struct device *d, 4961static ssize_t store_flags(struct device *d,
@@ -5448,14 +4966,14 @@ static ssize_t store_flags(struct device *d,
5448 u32 flags = simple_strtoul(buf, NULL, 0); 4966 u32 flags = simple_strtoul(buf, NULL, 0);
5449 4967
5450 mutex_lock(&priv->mutex); 4968 mutex_lock(&priv->mutex);
5451 if (le32_to_cpu(priv->staging39_rxon.flags) != flags) { 4969 if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
5452 /* Cancel any currently running scans... */ 4970 /* Cancel any currently running scans... */
5453 if (iwl_scan_cancel_timeout(priv, 100)) 4971 if (iwl_scan_cancel_timeout(priv, 100))
5454 IWL_WARN(priv, "Could not cancel scan.\n"); 4972 IWL_WARN(priv, "Could not cancel scan.\n");
5455 else { 4973 else {
5456 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", 4974 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
5457 flags); 4975 flags);
5458 priv->staging39_rxon.flags = cpu_to_le32(flags); 4976 priv->staging_rxon.flags = cpu_to_le32(flags);
5459 iwl3945_commit_rxon(priv); 4977 iwl3945_commit_rxon(priv);
5460 } 4978 }
5461 } 4979 }
@@ -5472,7 +4990,7 @@ static ssize_t show_filter_flags(struct device *d,
5472 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 4990 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
5473 4991
5474 return sprintf(buf, "0x%04X\n", 4992 return sprintf(buf, "0x%04X\n",
5475 le32_to_cpu(priv->active39_rxon.filter_flags)); 4993 le32_to_cpu(priv->active_rxon.filter_flags));
5476} 4994}
5477 4995
5478static ssize_t store_filter_flags(struct device *d, 4996static ssize_t store_filter_flags(struct device *d,
@@ -5483,14 +5001,14 @@ static ssize_t store_filter_flags(struct device *d,
5483 u32 filter_flags = simple_strtoul(buf, NULL, 0); 5001 u32 filter_flags = simple_strtoul(buf, NULL, 0);
5484 5002
5485 mutex_lock(&priv->mutex); 5003 mutex_lock(&priv->mutex);
5486 if (le32_to_cpu(priv->staging39_rxon.filter_flags) != filter_flags) { 5004 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
5487 /* Cancel any currently running scans... */ 5005 /* Cancel any currently running scans... */
5488 if (iwl_scan_cancel_timeout(priv, 100)) 5006 if (iwl_scan_cancel_timeout(priv, 100))
5489 IWL_WARN(priv, "Could not cancel scan.\n"); 5007 IWL_WARN(priv, "Could not cancel scan.\n");
5490 else { 5008 else {
5491 IWL_DEBUG_INFO("Committing rxon.filter_flags = " 5009 IWL_DEBUG_INFO("Committing rxon.filter_flags = "
5492 "0x%04X\n", filter_flags); 5010 "0x%04X\n", filter_flags);
5493 priv->staging39_rxon.filter_flags = 5011 priv->staging_rxon.filter_flags =
5494 cpu_to_le32(filter_flags); 5012 cpu_to_le32(filter_flags);
5495 iwl3945_commit_rxon(priv); 5013 iwl3945_commit_rxon(priv);
5496 } 5014 }
@@ -5543,7 +5061,7 @@ static ssize_t store_measurement(struct device *d,
5543{ 5061{
5544 struct iwl_priv *priv = dev_get_drvdata(d); 5062 struct iwl_priv *priv = dev_get_drvdata(d);
5545 struct ieee80211_measurement_params params = { 5063 struct ieee80211_measurement_params params = {
5546 .channel = le16_to_cpu(priv->active39_rxon.channel), 5064 .channel = le16_to_cpu(priv->active_rxon.channel),
5547 .start_time = cpu_to_le64(priv->last_tsf), 5065 .start_time = cpu_to_le64(priv->last_tsf),
5548 .duration = cpu_to_le16(1), 5066 .duration = cpu_to_le16(1),
5549 }; 5067 };
@@ -5890,7 +5408,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
5890 .remove_interface = iwl3945_mac_remove_interface, 5408 .remove_interface = iwl3945_mac_remove_interface,
5891 .config = iwl3945_mac_config, 5409 .config = iwl3945_mac_config,
5892 .config_interface = iwl3945_mac_config_interface, 5410 .config_interface = iwl3945_mac_config_interface,
5893 .configure_filter = iwl3945_configure_filter, 5411 .configure_filter = iwl_configure_filter,
5894 .set_key = iwl3945_mac_set_key, 5412 .set_key = iwl3945_mac_set_key,
5895 .get_tx_stats = iwl3945_mac_get_tx_stats, 5413 .get_tx_stats = iwl3945_mac_get_tx_stats,
5896 .conf_tx = iwl3945_mac_conf_tx, 5414 .conf_tx = iwl3945_mac_conf_tx,
@@ -6163,7 +5681,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
6163 goto out_release_irq; 5681 goto out_release_irq;
6164 } 5682 }
6165 5683
6166 iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); 5684 iwl_set_rxon_channel(priv,
5685 &priv->bands[IEEE80211_BAND_2GHZ].channels[5]);
6167 iwl3945_setup_deferred_work(priv); 5686 iwl3945_setup_deferred_work(priv);
6168 iwl3945_setup_rx_handlers(priv); 5687 iwl3945_setup_rx_handlers(priv);
6169 5688