aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:10:39 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:25:30 -0400
commitd618912417fbce4f6514fe1cbef7df2e73bdb6c2 (patch)
treee14bf2a7a09d898431cd0bac6d8b38318cb6dc48 /drivers/net/wireless/iwlwifi
parent8f470ce31de1a9dfe6b53e0967eaa7e72b741714 (diff)
iwlagn: hw_params moves to iwl_shared
Since it is used by all the layers, it needs to move to iwl_shared. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c38
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c62
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c38
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c66
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c48
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c30
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h54
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-prph.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h51
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c24
19 files changed, 278 insertions, 262 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 4314c61c40bb..bd0ce3993b52 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -77,8 +77,8 @@
77static void iwl1000_set_ct_threshold(struct iwl_priv *priv) 77static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
78{ 78{
79 /* want Celsius */ 79 /* want Celsius */
80 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; 80 hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
81 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; 81 hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
82} 82}
83 83
84/* NIC configuration for 1000 series */ 84/* NIC configuration for 1000 series */
@@ -128,43 +128,43 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
128 priv->cfg->base_params->num_of_queues = 128 priv->cfg->base_params->num_of_queues =
129 iwlagn_mod_params.num_of_queues; 129 iwlagn_mod_params.num_of_queues;
130 130
131 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 131 hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
132 priv->hw_params.scd_bc_tbls_size = 132 hw_params(priv).scd_bc_tbls_size =
133 priv->cfg->base_params->num_of_queues * 133 priv->cfg->base_params->num_of_queues *
134 sizeof(struct iwlagn_scd_bc_tbl); 134 sizeof(struct iwlagn_scd_bc_tbl);
135 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 135 hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
136 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 136 hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
137 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; 137 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
138 138
139 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; 139 hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
140 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; 140 hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
141 141
142 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ); 142 hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ);
143 143
144 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 144 hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
145 if (priv->cfg->rx_with_siso_diversity) 145 if (priv->cfg->rx_with_siso_diversity)
146 priv->hw_params.rx_chains_num = 1; 146 hw_params(priv).rx_chains_num = 1;
147 else 147 else
148 priv->hw_params.rx_chains_num = 148 hw_params(priv).rx_chains_num =
149 num_of_ant(priv->cfg->valid_rx_ant); 149 num_of_ant(priv->cfg->valid_rx_ant);
150 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 150 hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
151 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 151 hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
152 152
153 iwl1000_set_ct_threshold(priv); 153 iwl1000_set_ct_threshold(priv);
154 154
155 /* Set initial sensitivity parameters */ 155 /* Set initial sensitivity parameters */
156 /* Set initial calibration set */ 156 /* Set initial calibration set */
157 priv->hw_params.sens = &iwl1000_sensitivity; 157 hw_params(priv).sens = &iwl1000_sensitivity;
158 priv->hw_params.calib_init_cfg = 158 hw_params(priv).calib_init_cfg =
159 BIT(IWL_CALIB_XTAL) | 159 BIT(IWL_CALIB_XTAL) |
160 BIT(IWL_CALIB_LO) | 160 BIT(IWL_CALIB_LO) |
161 BIT(IWL_CALIB_TX_IQ) | 161 BIT(IWL_CALIB_TX_IQ) |
162 BIT(IWL_CALIB_TX_IQ_PERD) | 162 BIT(IWL_CALIB_TX_IQ_PERD) |
163 BIT(IWL_CALIB_BASE_BAND); 163 BIT(IWL_CALIB_BASE_BAND);
164 if (priv->cfg->need_dc_calib) 164 if (priv->cfg->need_dc_calib)
165 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC); 165 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
166 166
167 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 167 hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
168 168
169 return 0; 169 return 0;
170} 170}
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index e623870c0fe7..1a36edf05ee4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -79,8 +79,8 @@
79static void iwl2000_set_ct_threshold(struct iwl_priv *priv) 79static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
80{ 80{
81 /* want Celsius */ 81 /* want Celsius */
82 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; 82 hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
83 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; 83 hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
84} 84}
85 85
86/* NIC configuration for 2000 series */ 86/* NIC configuration for 2000 series */
@@ -125,44 +125,44 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
125 priv->cfg->base_params->num_of_queues = 125 priv->cfg->base_params->num_of_queues =
126 iwlagn_mod_params.num_of_queues; 126 iwlagn_mod_params.num_of_queues;
127 127
128 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 128 hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
129 priv->hw_params.scd_bc_tbls_size = 129 hw_params(priv).scd_bc_tbls_size =
130 priv->cfg->base_params->num_of_queues * 130 priv->cfg->base_params->num_of_queues *
131 sizeof(struct iwlagn_scd_bc_tbl); 131 sizeof(struct iwlagn_scd_bc_tbl);
132 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 132 hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
133 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 133 hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
134 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; 134 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
135 135
136 priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; 136 hw_params(priv).max_data_size = IWL60_RTC_DATA_SIZE;
137 priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; 137 hw_params(priv).max_inst_size = IWL60_RTC_INST_SIZE;
138 138
139 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ); 139 hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ);
140 140
141 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 141 hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
142 if (priv->cfg->rx_with_siso_diversity) 142 if (priv->cfg->rx_with_siso_diversity)
143 priv->hw_params.rx_chains_num = 1; 143 hw_params(priv).rx_chains_num = 1;
144 else 144 else
145 priv->hw_params.rx_chains_num = 145 hw_params(priv).rx_chains_num =
146 num_of_ant(priv->cfg->valid_rx_ant); 146 num_of_ant(priv->cfg->valid_rx_ant);
147 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 147 hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
148 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 148 hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
149 149
150 iwl2000_set_ct_threshold(priv); 150 iwl2000_set_ct_threshold(priv);
151 151
152 /* Set initial sensitivity parameters */ 152 /* Set initial sensitivity parameters */
153 /* Set initial calibration set */ 153 /* Set initial calibration set */
154 priv->hw_params.sens = &iwl2000_sensitivity; 154 hw_params(priv).sens = &iwl2000_sensitivity;
155 priv->hw_params.calib_init_cfg = 155 hw_params(priv).calib_init_cfg =
156 BIT(IWL_CALIB_XTAL) | 156 BIT(IWL_CALIB_XTAL) |
157 BIT(IWL_CALIB_LO) | 157 BIT(IWL_CALIB_LO) |
158 BIT(IWL_CALIB_TX_IQ) | 158 BIT(IWL_CALIB_TX_IQ) |
159 BIT(IWL_CALIB_BASE_BAND); 159 BIT(IWL_CALIB_BASE_BAND);
160 if (priv->cfg->need_dc_calib) 160 if (priv->cfg->need_dc_calib)
161 priv->hw_params.calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX; 161 hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
162 if (priv->cfg->need_temp_offset_calib) 162 if (priv->cfg->need_temp_offset_calib)
163 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET); 163 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
164 164
165 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 165 hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
166 166
167 return 0; 167 return 0;
168} 168}
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index c79f1f7830b0..e073422edab4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -140,13 +140,13 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv)
140 s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - 140 s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) -
141 iwl_temp_calib_to_offset(priv); 141 iwl_temp_calib_to_offset(priv);
142 142
143 priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef; 143 hw_params(priv).ct_kill_threshold = threshold * volt2temp_coef;
144} 144}
145 145
146static void iwl5000_set_ct_threshold(struct iwl_priv *priv) 146static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
147{ 147{
148 /* want Celsius */ 148 /* want Celsius */
149 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; 149 hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY;
150} 150}
151 151
152static int iwl5000_hw_set_hw_params(struct iwl_priv *priv) 152static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
@@ -156,38 +156,38 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
156 priv->cfg->base_params->num_of_queues = 156 priv->cfg->base_params->num_of_queues =
157 iwlagn_mod_params.num_of_queues; 157 iwlagn_mod_params.num_of_queues;
158 158
159 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 159 hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
160 priv->hw_params.scd_bc_tbls_size = 160 hw_params(priv).scd_bc_tbls_size =
161 priv->cfg->base_params->num_of_queues * 161 priv->cfg->base_params->num_of_queues *
162 sizeof(struct iwlagn_scd_bc_tbl); 162 sizeof(struct iwlagn_scd_bc_tbl);
163 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 163 hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
164 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 164 hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
165 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; 165 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
166 166
167 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; 167 hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
168 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; 168 hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
169 169
170 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | 170 hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
171 BIT(IEEE80211_BAND_5GHZ); 171 BIT(IEEE80211_BAND_5GHZ);
172 172
173 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 173 hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
174 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); 174 hw_params(priv).rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
175 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 175 hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
176 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 176 hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
177 177
178 iwl5000_set_ct_threshold(priv); 178 iwl5000_set_ct_threshold(priv);
179 179
180 /* Set initial sensitivity parameters */ 180 /* Set initial sensitivity parameters */
181 /* Set initial calibration set */ 181 /* Set initial calibration set */
182 priv->hw_params.sens = &iwl5000_sensitivity; 182 hw_params(priv).sens = &iwl5000_sensitivity;
183 priv->hw_params.calib_init_cfg = 183 hw_params(priv).calib_init_cfg =
184 BIT(IWL_CALIB_XTAL) | 184 BIT(IWL_CALIB_XTAL) |
185 BIT(IWL_CALIB_LO) | 185 BIT(IWL_CALIB_LO) |
186 BIT(IWL_CALIB_TX_IQ) | 186 BIT(IWL_CALIB_TX_IQ) |
187 BIT(IWL_CALIB_TX_IQ_PERD) | 187 BIT(IWL_CALIB_TX_IQ_PERD) |
188 BIT(IWL_CALIB_BASE_BAND); 188 BIT(IWL_CALIB_BASE_BAND);
189 189
190 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 190 hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
191 191
192 return 0; 192 return 0;
193} 193}
@@ -199,38 +199,38 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
199 priv->cfg->base_params->num_of_queues = 199 priv->cfg->base_params->num_of_queues =
200 iwlagn_mod_params.num_of_queues; 200 iwlagn_mod_params.num_of_queues;
201 201
202 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 202 hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
203 priv->hw_params.scd_bc_tbls_size = 203 hw_params(priv).scd_bc_tbls_size =
204 priv->cfg->base_params->num_of_queues * 204 priv->cfg->base_params->num_of_queues *
205 sizeof(struct iwlagn_scd_bc_tbl); 205 sizeof(struct iwlagn_scd_bc_tbl);
206 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 206 hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
207 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 207 hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
208 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; 208 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
209 209
210 priv->hw_params.max_data_size = IWLAGN_RTC_DATA_SIZE; 210 hw_params(priv).max_data_size = IWLAGN_RTC_DATA_SIZE;
211 priv->hw_params.max_inst_size = IWLAGN_RTC_INST_SIZE; 211 hw_params(priv).max_inst_size = IWLAGN_RTC_INST_SIZE;
212 212
213 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | 213 hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
214 BIT(IEEE80211_BAND_5GHZ); 214 BIT(IEEE80211_BAND_5GHZ);
215 215
216 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 216 hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
217 priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant); 217 hw_params(priv).rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
218 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 218 hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
219 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 219 hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
220 220
221 iwl5150_set_ct_threshold(priv); 221 iwl5150_set_ct_threshold(priv);
222 222
223 /* Set initial sensitivity parameters */ 223 /* Set initial sensitivity parameters */
224 /* Set initial calibration set */ 224 /* Set initial calibration set */
225 priv->hw_params.sens = &iwl5150_sensitivity; 225 hw_params(priv).sens = &iwl5150_sensitivity;
226 priv->hw_params.calib_init_cfg = 226 hw_params(priv).calib_init_cfg =
227 BIT(IWL_CALIB_LO) | 227 BIT(IWL_CALIB_LO) |
228 BIT(IWL_CALIB_TX_IQ) | 228 BIT(IWL_CALIB_TX_IQ) |
229 BIT(IWL_CALIB_BASE_BAND); 229 BIT(IWL_CALIB_BASE_BAND);
230 if (priv->cfg->need_dc_calib) 230 if (priv->cfg->need_dc_calib)
231 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_DC); 231 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
232 232
233 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 233 hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
234 234
235 return 0; 235 return 0;
236} 236}
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index bf84fa697209..e7be968b1784 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -75,8 +75,8 @@
75static void iwl6000_set_ct_threshold(struct iwl_priv *priv) 75static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
76{ 76{
77 /* want Celsius */ 77 /* want Celsius */
78 priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; 78 hw_params(priv).ct_kill_threshold = CT_KILL_THRESHOLD;
79 priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; 79 hw_params(priv).ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD;
80} 80}
81 81
82static void iwl6050_additional_nic_config(struct iwl_priv *priv) 82static void iwl6050_additional_nic_config(struct iwl_priv *priv)
@@ -145,45 +145,45 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
145 priv->cfg->base_params->num_of_queues = 145 priv->cfg->base_params->num_of_queues =
146 iwlagn_mod_params.num_of_queues; 146 iwlagn_mod_params.num_of_queues;
147 147
148 priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; 148 hw_params(priv).max_txq_num = priv->cfg->base_params->num_of_queues;
149 priv->hw_params.scd_bc_tbls_size = 149 hw_params(priv).scd_bc_tbls_size =
150 priv->cfg->base_params->num_of_queues * 150 priv->cfg->base_params->num_of_queues *
151 sizeof(struct iwlagn_scd_bc_tbl); 151 sizeof(struct iwlagn_scd_bc_tbl);
152 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 152 hw_params(priv).tfd_size = sizeof(struct iwl_tfd);
153 priv->hw_params.max_stations = IWLAGN_STATION_COUNT; 153 hw_params(priv).max_stations = IWLAGN_STATION_COUNT;
154 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; 154 priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID;
155 155
156 priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE; 156 hw_params(priv).max_data_size = IWL60_RTC_DATA_SIZE;
157 priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE; 157 hw_params(priv).max_inst_size = IWL60_RTC_INST_SIZE;
158 158
159 priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_2GHZ) | 159 hw_params(priv).ht40_channel = BIT(IEEE80211_BAND_2GHZ) |
160 BIT(IEEE80211_BAND_5GHZ); 160 BIT(IEEE80211_BAND_5GHZ);
161 161
162 priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant); 162 hw_params(priv).tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
163 if (priv->cfg->rx_with_siso_diversity) 163 if (priv->cfg->rx_with_siso_diversity)
164 priv->hw_params.rx_chains_num = 1; 164 hw_params(priv).rx_chains_num = 1;
165 else 165 else
166 priv->hw_params.rx_chains_num = 166 hw_params(priv).rx_chains_num =
167 num_of_ant(priv->cfg->valid_rx_ant); 167 num_of_ant(priv->cfg->valid_rx_ant);
168 priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; 168 hw_params(priv).valid_tx_ant = priv->cfg->valid_tx_ant;
169 priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; 169 hw_params(priv).valid_rx_ant = priv->cfg->valid_rx_ant;
170 170
171 iwl6000_set_ct_threshold(priv); 171 iwl6000_set_ct_threshold(priv);
172 172
173 /* Set initial sensitivity parameters */ 173 /* Set initial sensitivity parameters */
174 /* Set initial calibration set */ 174 /* Set initial calibration set */
175 priv->hw_params.sens = &iwl6000_sensitivity; 175 hw_params(priv).sens = &iwl6000_sensitivity;
176 priv->hw_params.calib_init_cfg = 176 hw_params(priv).calib_init_cfg =
177 BIT(IWL_CALIB_XTAL) | 177 BIT(IWL_CALIB_XTAL) |
178 BIT(IWL_CALIB_LO) | 178 BIT(IWL_CALIB_LO) |
179 BIT(IWL_CALIB_TX_IQ) | 179 BIT(IWL_CALIB_TX_IQ) |
180 BIT(IWL_CALIB_BASE_BAND); 180 BIT(IWL_CALIB_BASE_BAND);
181 if (priv->cfg->need_dc_calib) 181 if (priv->cfg->need_dc_calib)
182 priv->hw_params.calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX; 182 hw_params(priv).calib_rt_cfg |= IWL_CALIB_CFG_DC_IDX;
183 if (priv->cfg->need_temp_offset_calib) 183 if (priv->cfg->need_temp_offset_calib)
184 priv->hw_params.calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET); 184 hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
185 185
186 priv->hw_params.beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS; 186 hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
187 187
188 return 0; 188 return 0;
189} 189}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index 1789e3af8101..f0e38a14053a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -93,7 +93,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
93 }; 93 };
94 94
95 for (i = 0; i < IWL_CALIB_MAX; i++) { 95 for (i = 0; i < IWL_CALIB_MAX; i++) {
96 if ((BIT(i) & priv->hw_params.calib_init_cfg) && 96 if ((BIT(i) & hw_params(priv).calib_init_cfg) &&
97 priv->calib_results[i].buf) { 97 priv->calib_results[i].buf) {
98 hcmd.len[0] = priv->calib_results[i].buf_len; 98 hcmd.len[0] = priv->calib_results[i].buf_len;
99 hcmd.data[0] = priv->calib_results[i].buf; 99 hcmd.data[0] = priv->calib_results[i].buf;
@@ -174,7 +174,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
174 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; 174 u32 max_false_alarms = MAX_FA_CCK * rx_enable_time;
175 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; 175 u32 min_false_alarms = MIN_FA_CCK * rx_enable_time;
176 struct iwl_sensitivity_data *data = NULL; 176 struct iwl_sensitivity_data *data = NULL;
177 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 177 const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
178 178
179 data = &(priv->sensitivity_data); 179 data = &(priv->sensitivity_data);
180 180
@@ -357,7 +357,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
357 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; 357 u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time;
358 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; 358 u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time;
359 struct iwl_sensitivity_data *data = NULL; 359 struct iwl_sensitivity_data *data = NULL;
360 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 360 const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
361 361
362 data = &(priv->sensitivity_data); 362 data = &(priv->sensitivity_data);
363 363
@@ -581,7 +581,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
581 int ret = 0; 581 int ret = 0;
582 int i; 582 int i;
583 struct iwl_sensitivity_data *data = NULL; 583 struct iwl_sensitivity_data *data = NULL;
584 const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; 584 const struct iwl_sensitivity_ranges *ranges = hw_params(priv).sens;
585 585
586 if (priv->disable_sens_cal) 586 if (priv->disable_sens_cal)
587 return; 587 return;
@@ -821,21 +821,21 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
821 * To be safe, simply mask out any chains that we know 821 * To be safe, simply mask out any chains that we know
822 * are not on the device. 822 * are not on the device.
823 */ 823 */
824 active_chains &= priv->hw_params.valid_rx_ant; 824 active_chains &= hw_params(priv).valid_rx_ant;
825 825
826 num_tx_chains = 0; 826 num_tx_chains = 0;
827 for (i = 0; i < NUM_RX_CHAINS; i++) { 827 for (i = 0; i < NUM_RX_CHAINS; i++) {
828 /* loops on all the bits of 828 /* loops on all the bits of
829 * priv->hw_setting.valid_tx_ant */ 829 * priv->hw_setting.valid_tx_ant */
830 u8 ant_msk = (1 << i); 830 u8 ant_msk = (1 << i);
831 if (!(priv->hw_params.valid_tx_ant & ant_msk)) 831 if (!(hw_params(priv).valid_tx_ant & ant_msk))
832 continue; 832 continue;
833 833
834 num_tx_chains++; 834 num_tx_chains++;
835 if (data->disconn_array[i] == 0) 835 if (data->disconn_array[i] == 0)
836 /* there is a Tx antenna connected */ 836 /* there is a Tx antenna connected */
837 break; 837 break;
838 if (num_tx_chains == priv->hw_params.tx_chains_num && 838 if (num_tx_chains == hw_params(priv).tx_chains_num &&
839 data->disconn_array[i]) { 839 data->disconn_array[i]) {
840 /* 840 /*
841 * If all chains are disconnected 841 * If all chains are disconnected
@@ -852,12 +852,13 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
852 } 852 }
853 } 853 }
854 854
855 if (active_chains != priv->hw_params.valid_rx_ant && 855 if (active_chains != hw_params(priv).valid_rx_ant &&
856 active_chains != priv->chain_noise_data.active_chains) 856 active_chains != priv->chain_noise_data.active_chains)
857 IWL_DEBUG_CALIB(priv, 857 IWL_DEBUG_CALIB(priv,
858 "Detected that not all antennas are connected! " 858 "Detected that not all antennas are connected! "
859 "Connected: %#x, valid: %#x.\n", 859 "Connected: %#x, valid: %#x.\n",
860 active_chains, priv->hw_params.valid_rx_ant); 860 active_chains,
861 hw_params(priv).valid_rx_ant);
861 862
862 /* Save for use within RXON, TX, SCAN commands, etc. */ 863 /* Save for use within RXON, TX, SCAN commands, etc. */
863 data->active_chains = active_chains; 864 data->active_chains = active_chains;
@@ -1046,7 +1047,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
1046 priv->cfg->bt_params->advanced_bt_coexist) { 1047 priv->cfg->bt_params->advanced_bt_coexist) {
1047 /* Disable disconnected antenna algorithm for advanced 1048 /* Disable disconnected antenna algorithm for advanced
1048 bt coex, assuming valid antennas are connected */ 1049 bt coex, assuming valid antennas are connected */
1049 data->active_chains = priv->hw_params.valid_rx_ant; 1050 data->active_chains = hw_params(priv).valid_rx_ant;
1050 for (i = 0; i < NUM_RX_CHAINS; i++) 1051 for (i = 0; i < NUM_RX_CHAINS; i++)
1051 if (!(data->active_chains & (1<<i))) 1052 if (!(data->active_chains & (1<<i)))
1052 data->disconn_array[i] = 1; 1053 data->disconn_array[i] = 1;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index dd95f47854d4..048ccbae82f0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -770,12 +770,12 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
770 u16 rx_chain = 0; 770 u16 rx_chain = 0;
771 enum ieee80211_band band; 771 enum ieee80211_band band;
772 u8 n_probes = 0; 772 u8 n_probes = 0;
773 u8 rx_ant = priv->hw_params.valid_rx_ant; 773 u8 rx_ant = hw_params(priv).valid_rx_ant;
774 u8 rate; 774 u8 rate;
775 bool is_active = false; 775 bool is_active = false;
776 int chan_mod; 776 int chan_mod;
777 u8 active_chains; 777 u8 active_chains;
778 u8 scan_tx_antennas = priv->hw_params.valid_tx_ant; 778 u8 scan_tx_antennas = hw_params(priv).valid_tx_ant;
779 int ret; 779 int ret;
780 780
781 lockdep_assert_held(&priv->mutex); 781 lockdep_assert_held(&priv->mutex);
@@ -965,7 +965,8 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
965 } 965 }
966 966
967 /* MIMO is not used here, but value is required */ 967 /* MIMO is not used here, but value is required */
968 rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; 968 rx_chain |=
969 hw_params(priv).valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
969 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; 970 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
970 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; 971 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
971 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 972 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
@@ -1101,7 +1102,7 @@ int iwlagn_wait_tx_queue_empty(struct iwl_priv *priv)
1101 int ret = 0; 1102 int ret = 0;
1102 1103
1103 /* waiting for all the tx frames complete might take a while */ 1104 /* waiting for all the tx frames complete might take a while */
1104 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 1105 for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
1105 if (cnt == priv->cmd_queue) 1106 if (cnt == priv->cmd_queue)
1106 continue; 1107 continue;
1107 txq = &priv->txq[cnt]; 1108 txq = &priv->txq[cnt];
@@ -1786,7 +1787,7 @@ void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1786 if (priv->chain_noise_data.active_chains) 1787 if (priv->chain_noise_data.active_chains)
1787 active_chains = priv->chain_noise_data.active_chains; 1788 active_chains = priv->chain_noise_data.active_chains;
1788 else 1789 else
1789 active_chains = priv->hw_params.valid_rx_ant; 1790 active_chains = hw_params(priv).valid_rx_ant;
1790 1791
1791 if (priv->cfg->bt_params && 1792 if (priv->cfg->bt_params &&
1792 priv->cfg->bt_params->advanced_bt_coexist && 1793 priv->cfg->bt_params->advanced_bt_coexist &&
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 1fa438e20f0a..3ca6e553fcd2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -819,7 +819,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
819 819
820 if (num_of_ant(tbl->ant_type) > 1) 820 if (num_of_ant(tbl->ant_type) > 1)
821 tbl->ant_type = 821 tbl->ant_type =
822 first_antenna(priv->hw_params.valid_tx_ant); 822 first_antenna(hw_params(priv).valid_tx_ant);
823 823
824 tbl->is_ht40 = 0; 824 tbl->is_ht40 = 0;
825 tbl->is_SGI = 0; 825 tbl->is_SGI = 0;
@@ -1293,7 +1293,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1293 return -1; 1293 return -1;
1294 1294
1295 /* Need both Tx chains/antennas to support MIMO */ 1295 /* Need both Tx chains/antennas to support MIMO */
1296 if (priv->hw_params.tx_chains_num < 2) 1296 if (hw_params(priv).tx_chains_num < 2)
1297 return -1; 1297 return -1;
1298 1298
1299 IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); 1299 IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n");
@@ -1349,7 +1349,7 @@ static int rs_switch_to_mimo3(struct iwl_priv *priv,
1349 return -1; 1349 return -1;
1350 1350
1351 /* Need both Tx chains/antennas to support MIMO */ 1351 /* Need both Tx chains/antennas to support MIMO */
1352 if (priv->hw_params.tx_chains_num < 3) 1352 if (hw_params(priv).tx_chains_num < 3)
1353 return -1; 1353 return -1;
1354 1354
1355 IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n"); 1355 IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n");
@@ -1448,8 +1448,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1448 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1448 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1449 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1449 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1450 u8 start_action; 1450 u8 start_action;
1451 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1451 u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
1452 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1452 u8 tx_chains_num = hw_params(priv).tx_chains_num;
1453 int ret = 0; 1453 int ret = 0;
1454 u8 update_search_tbl_counter = 0; 1454 u8 update_search_tbl_counter = 0;
1455 1455
@@ -1459,14 +1459,16 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1459 break; 1459 break;
1460 case IWL_BT_COEX_TRAFFIC_LOAD_LOW: 1460 case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
1461 /* avoid antenna B unless MIMO */ 1461 /* avoid antenna B unless MIMO */
1462 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1462 valid_tx_ant =
1463 first_antenna(hw_params(priv).valid_tx_ant);
1463 if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2) 1464 if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2)
1464 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1465 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;
1465 break; 1466 break;
1466 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: 1467 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
1467 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1468 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1468 /* avoid antenna B and MIMO */ 1469 /* avoid antenna B and MIMO */
1469 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1470 valid_tx_ant =
1471 first_antenna(hw_params(priv).valid_tx_ant);
1470 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && 1472 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 &&
1471 tbl->action != IWL_LEGACY_SWITCH_SISO) 1473 tbl->action != IWL_LEGACY_SWITCH_SISO)
1472 tbl->action = IWL_LEGACY_SWITCH_SISO; 1474 tbl->action = IWL_LEGACY_SWITCH_SISO;
@@ -1489,7 +1491,8 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1489 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1491 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;
1490 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1492 else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1491 tbl->action = IWL_LEGACY_SWITCH_SISO; 1493 tbl->action = IWL_LEGACY_SWITCH_SISO;
1492 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1494 valid_tx_ant =
1495 first_antenna(hw_params(priv).valid_tx_ant);
1493 } 1496 }
1494 1497
1495 start_action = tbl->action; 1498 start_action = tbl->action;
@@ -1623,8 +1626,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1623 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1626 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1624 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1627 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1625 u8 start_action; 1628 u8 start_action;
1626 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1629 u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
1627 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1630 u8 tx_chains_num = hw_params(priv).tx_chains_num;
1628 u8 update_search_tbl_counter = 0; 1631 u8 update_search_tbl_counter = 0;
1629 int ret; 1632 int ret;
1630 1633
@@ -1634,14 +1637,16 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1634 break; 1637 break;
1635 case IWL_BT_COEX_TRAFFIC_LOAD_LOW: 1638 case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
1636 /* avoid antenna B unless MIMO */ 1639 /* avoid antenna B unless MIMO */
1637 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1640 valid_tx_ant =
1641 first_antenna(hw_params(priv).valid_tx_ant);
1638 if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) 1642 if (tbl->action == IWL_SISO_SWITCH_ANTENNA2)
1639 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1643 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1640 break; 1644 break;
1641 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: 1645 case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
1642 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: 1646 case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
1643 /* avoid antenna B and MIMO */ 1647 /* avoid antenna B and MIMO */
1644 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1648 valid_tx_ant =
1649 first_antenna(hw_params(priv).valid_tx_ant);
1645 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) 1650 if (tbl->action != IWL_SISO_SWITCH_ANTENNA1)
1646 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1651 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1647 break; 1652 break;
@@ -1658,7 +1663,8 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1658 1663
1659 /* configure as 1x1 if bt full concurrency */ 1664 /* configure as 1x1 if bt full concurrency */
1660 if (priv->bt_full_concurrent) { 1665 if (priv->bt_full_concurrent) {
1661 valid_tx_ant = first_antenna(priv->hw_params.valid_tx_ant); 1666 valid_tx_ant =
1667 first_antenna(hw_params(priv).valid_tx_ant);
1662 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) 1668 if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2)
1663 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1669 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
1664 } 1670 }
@@ -1794,8 +1800,8 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
1794 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1800 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1795 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1801 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1796 u8 start_action; 1802 u8 start_action;
1797 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1803 u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
1798 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1804 u8 tx_chains_num = hw_params(priv).tx_chains_num;
1799 u8 update_search_tbl_counter = 0; 1805 u8 update_search_tbl_counter = 0;
1800 int ret; 1806 int ret;
1801 1807
@@ -1964,8 +1970,8 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
1964 u32 sz = (sizeof(struct iwl_scale_tbl_info) - 1970 u32 sz = (sizeof(struct iwl_scale_tbl_info) -
1965 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); 1971 (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT));
1966 u8 start_action; 1972 u8 start_action;
1967 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1973 u8 valid_tx_ant = hw_params(priv).valid_tx_ant;
1968 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1974 u8 tx_chains_num = hw_params(priv).tx_chains_num;
1969 int ret; 1975 int ret;
1970 u8 update_search_tbl_counter = 0; 1976 u8 update_search_tbl_counter = 0;
1971 1977
@@ -2703,7 +2709,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2703 2709
2704 i = lq_sta->last_txrate_idx; 2710 i = lq_sta->last_txrate_idx;
2705 2711
2706 valid_tx_ant = priv->hw_params.valid_tx_ant; 2712 valid_tx_ant = hw_params(priv).valid_tx_ant;
2707 2713
2708 if (!lq_sta->search_better_tbl) 2714 if (!lq_sta->search_better_tbl)
2709 active_tbl = lq_sta->active_tbl; 2715 active_tbl = lq_sta->active_tbl;
@@ -2886,15 +2892,15 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2886 2892
2887 /* These values will be overridden later */ 2893 /* These values will be overridden later */
2888 lq_sta->lq.general_params.single_stream_ant_msk = 2894 lq_sta->lq.general_params.single_stream_ant_msk =
2889 first_antenna(priv->hw_params.valid_tx_ant); 2895 first_antenna(hw_params(priv).valid_tx_ant);
2890 lq_sta->lq.general_params.dual_stream_ant_msk = 2896 lq_sta->lq.general_params.dual_stream_ant_msk =
2891 priv->hw_params.valid_tx_ant & 2897 hw_params(priv).valid_tx_ant &
2892 ~first_antenna(priv->hw_params.valid_tx_ant); 2898 ~first_antenna(hw_params(priv).valid_tx_ant);
2893 if (!lq_sta->lq.general_params.dual_stream_ant_msk) { 2899 if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
2894 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; 2900 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
2895 } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { 2901 } else if (num_of_ant(hw_params(priv).valid_tx_ant) == 2) {
2896 lq_sta->lq.general_params.dual_stream_ant_msk = 2902 lq_sta->lq.general_params.dual_stream_ant_msk =
2897 priv->hw_params.valid_tx_ant; 2903 hw_params(priv).valid_tx_ant;
2898 } 2904 }
2899 2905
2900 /* as default allow aggregation for all tids */ 2906 /* as default allow aggregation for all tids */
@@ -2940,7 +2946,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2940 if (priv && priv->bt_full_concurrent) { 2946 if (priv && priv->bt_full_concurrent) {
2941 /* 1x1 only */ 2947 /* 1x1 only */
2942 tbl_type.ant_type = 2948 tbl_type.ant_type =
2943 first_antenna(priv->hw_params.valid_tx_ant); 2949 first_antenna(hw_params(priv).valid_tx_ant);
2944 } 2950 }
2945 2951
2946 /* How many times should we repeat the initial rate? */ 2952 /* How many times should we repeat the initial rate? */
@@ -2972,7 +2978,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
2972 if (priv->bt_full_concurrent) 2978 if (priv->bt_full_concurrent)
2973 valid_tx_ant = ANT_A; 2979 valid_tx_ant = ANT_A;
2974 else 2980 else
2975 valid_tx_ant = priv->hw_params.valid_tx_ant; 2981 valid_tx_ant = hw_params(priv).valid_tx_ant;
2976 } 2982 }
2977 2983
2978 /* Fill rest of rate table */ 2984 /* Fill rest of rate table */
@@ -3006,7 +3012,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
3006 if (priv && priv->bt_full_concurrent) { 3012 if (priv && priv->bt_full_concurrent) {
3007 /* 1x1 only */ 3013 /* 1x1 only */
3008 tbl_type.ant_type = 3014 tbl_type.ant_type =
3009 first_antenna(priv->hw_params.valid_tx_ant); 3015 first_antenna(hw_params(priv).valid_tx_ant);
3010 } 3016 }
3011 3017
3012 /* Indicate to uCode which entries might be MIMO. 3018 /* Indicate to uCode which entries might be MIMO.
@@ -3097,7 +3103,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
3097 u8 ant_sel_tx; 3103 u8 ant_sel_tx;
3098 3104
3099 priv = lq_sta->drv; 3105 priv = lq_sta->drv;
3100 valid_tx_ant = priv->hw_params.valid_tx_ant; 3106 valid_tx_ant = hw_params(priv).valid_tx_ant;
3101 if (lq_sta->dbg_fixed_rate) { 3107 if (lq_sta->dbg_fixed_rate) {
3102 ant_sel_tx = 3108 ant_sel_tx =
3103 ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) 3109 ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK)
@@ -3168,9 +3174,9 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
3168 desc += sprintf(buff+desc, "fixed rate 0x%X\n", 3174 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
3169 lq_sta->dbg_fixed_rate); 3175 lq_sta->dbg_fixed_rate);
3170 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", 3176 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
3171 (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", 3177 (hw_params(priv).valid_tx_ant & ANT_A) ? "ANT_A," : "",
3172 (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", 3178 (hw_params(priv).valid_tx_ant & ANT_B) ? "ANT_B," : "",
3173 (priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); 3179 (hw_params(priv).valid_tx_ant & ANT_C) ? "ANT_C" : "");
3174 desc += sprintf(buff+desc, "lq type %s\n", 3180 desc += sprintf(buff+desc, "lq type %s\n",
3175 (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); 3181 (is_legacy(tbl->lq_type)) ? "legacy" : "HT");
3176 if (is_Ht(tbl->lq_type)) { 3182 if (is_Ht(tbl->lq_type)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 37e624095e40..f894bfb43da4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -63,23 +63,23 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
63 if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) 63 if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE)
64 rate_flags |= RATE_MCS_CCK_MSK; 64 rate_flags |= RATE_MCS_CCK_MSK;
65 65
66 rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) << 66 rate_flags |= first_antenna(hw_params(priv).valid_tx_ant) <<
67 RATE_MCS_ANT_POS; 67 RATE_MCS_ANT_POS;
68 rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); 68 rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
69 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) 69 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
70 link_cmd->rs_table[i].rate_n_flags = rate_n_flags; 70 link_cmd->rs_table[i].rate_n_flags = rate_n_flags;
71 71
72 link_cmd->general_params.single_stream_ant_msk = 72 link_cmd->general_params.single_stream_ant_msk =
73 first_antenna(priv->hw_params.valid_tx_ant); 73 first_antenna(hw_params(priv).valid_tx_ant);
74 74
75 link_cmd->general_params.dual_stream_ant_msk = 75 link_cmd->general_params.dual_stream_ant_msk =
76 priv->hw_params.valid_tx_ant & 76 hw_params(priv).valid_tx_ant &
77 ~first_antenna(priv->hw_params.valid_tx_ant); 77 ~first_antenna(hw_params(priv).valid_tx_ant);
78 if (!link_cmd->general_params.dual_stream_ant_msk) { 78 if (!link_cmd->general_params.dual_stream_ant_msk) {
79 link_cmd->general_params.dual_stream_ant_msk = ANT_AB; 79 link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
80 } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { 80 } else if (num_of_ant(hw_params(priv).valid_tx_ant) == 2) {
81 link_cmd->general_params.dual_stream_ant_msk = 81 link_cmd->general_params.dual_stream_ant_msk =
82 priv->hw_params.valid_tx_ant; 82 hw_params(priv).valid_tx_ant;
83 } 83 }
84 84
85 link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; 85 link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 9bc26da62768..3e2a9040de1b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -260,10 +260,10 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
260 priv->bt_full_concurrent) { 260 priv->bt_full_concurrent) {
261 /* operated as 1x1 in full concurrency mode */ 261 /* operated as 1x1 in full concurrency mode */
262 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, 262 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
263 first_antenna(priv->hw_params.valid_tx_ant)); 263 first_antenna(hw_params(priv).valid_tx_ant));
264 } else 264 } else
265 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, 265 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
266 priv->hw_params.valid_tx_ant); 266 hw_params(priv).valid_tx_ant);
267 rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); 267 rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
268 268
269 /* Set the rate in the TX cmd */ 269 /* Set the rate in the TX cmd */
@@ -492,7 +492,7 @@ static int iwlagn_txq_ctx_activate_free(struct iwl_priv *priv)
492{ 492{
493 int txq_id; 493 int txq_id;
494 494
495 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 495 for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++)
496 if (!test_and_set_bit(txq_id, &priv->txq_ctx_active_msk)) 496 if (!test_and_set_bit(txq_id, &priv->txq_ctx_active_msk))
497 return txq_id; 497 return txq_id;
498 return -1; 498 return -1;
@@ -864,7 +864,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
864 * (in Tx queue's circular buffer) of first TFD/frame in window */ 864 * (in Tx queue's circular buffer) of first TFD/frame in window */
865 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 865 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
866 866
867 if (scd_flow >= priv->hw_params.max_txq_num) { 867 if (scd_flow >= hw_params(priv).max_txq_num) {
868 IWL_ERR(priv, 868 IWL_ERR(priv,
869 "BUG_ON scd_flow is bigger than number of queues\n"); 869 "BUG_ON scd_flow is bigger than number of queues\n");
870 return; 870 return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 637c5427e3d0..e8177fb7ae2c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -180,7 +180,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv)
180 rate = info->control.rates[0].idx; 180 rate = info->control.rates[0].idx;
181 181
182 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, 182 priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
183 priv->hw_params.valid_tx_ant); 183 hw_params(priv).valid_tx_ant);
184 rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant); 184 rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant);
185 185
186 /* In mac80211, rates for 5 GHz start at 0 */ 186 /* In mac80211, rates for 5 GHz start at 0 */
@@ -1149,25 +1149,25 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1149 pieces.init_data_size); 1149 pieces.init_data_size);
1150 1150
1151 /* Verify that uCode images will fit in card's SRAM */ 1151 /* Verify that uCode images will fit in card's SRAM */
1152 if (pieces.inst_size > priv->hw_params.max_inst_size) { 1152 if (pieces.inst_size > hw_params(priv).max_inst_size) {
1153 IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n", 1153 IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n",
1154 pieces.inst_size); 1154 pieces.inst_size);
1155 goto try_again; 1155 goto try_again;
1156 } 1156 }
1157 1157
1158 if (pieces.data_size > priv->hw_params.max_data_size) { 1158 if (pieces.data_size > hw_params(priv).max_data_size) {
1159 IWL_ERR(priv, "uCode data len %Zd too large to fit in\n", 1159 IWL_ERR(priv, "uCode data len %Zd too large to fit in\n",
1160 pieces.data_size); 1160 pieces.data_size);
1161 goto try_again; 1161 goto try_again;
1162 } 1162 }
1163 1163
1164 if (pieces.init_size > priv->hw_params.max_inst_size) { 1164 if (pieces.init_size > hw_params(priv).max_inst_size) {
1165 IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", 1165 IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n",
1166 pieces.init_size); 1166 pieces.init_size);
1167 goto try_again; 1167 goto try_again;
1168 } 1168 }
1169 1169
1170 if (pieces.init_data_size > priv->hw_params.max_data_size) { 1170 if (pieces.init_data_size > hw_params(priv).max_data_size) {
1171 IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n", 1171 IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n",
1172 pieces.init_data_size); 1172 pieces.init_data_size);
1173 goto try_again; 1173 goto try_again;
@@ -1681,9 +1681,9 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1681 1681
1682 if (priv->cfg->base_params->support_ct_kill_exit) { 1682 if (priv->cfg->base_params->support_ct_kill_exit) {
1683 adv_cmd.critical_temperature_enter = 1683 adv_cmd.critical_temperature_enter =
1684 cpu_to_le32(priv->hw_params.ct_kill_threshold); 1684 cpu_to_le32(hw_params(priv).ct_kill_threshold);
1685 adv_cmd.critical_temperature_exit = 1685 adv_cmd.critical_temperature_exit =
1686 cpu_to_le32(priv->hw_params.ct_kill_exit_threshold); 1686 cpu_to_le32(hw_params(priv).ct_kill_exit_threshold);
1687 1687
1688 ret = trans_send_cmd_pdu(&priv->trans, 1688 ret = trans_send_cmd_pdu(&priv->trans,
1689 REPLY_CT_KILL_CONFIG_CMD, 1689 REPLY_CT_KILL_CONFIG_CMD,
@@ -1692,14 +1692,13 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1692 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 1692 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
1693 else 1693 else
1694 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " 1694 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
1695 "succeeded, " 1695 "succeeded, critical temperature enter is %d,"
1696 "critical temperature enter is %d," 1696 "exit is %d\n",
1697 "exit is %d\n", 1697 hw_params(priv).ct_kill_threshold,
1698 priv->hw_params.ct_kill_threshold, 1698 hw_params(priv).ct_kill_exit_threshold);
1699 priv->hw_params.ct_kill_exit_threshold);
1700 } else { 1699 } else {
1701 cmd.critical_temperature_R = 1700 cmd.critical_temperature_R =
1702 cpu_to_le32(priv->hw_params.ct_kill_threshold); 1701 cpu_to_le32(hw_params(priv).ct_kill_threshold);
1703 1702
1704 ret = trans_send_cmd_pdu(&priv->trans, 1703 ret = trans_send_cmd_pdu(&priv->trans,
1705 REPLY_CT_KILL_CONFIG_CMD, 1704 REPLY_CT_KILL_CONFIG_CMD,
@@ -1708,9 +1707,9 @@ static void iwl_rf_kill_ct_config(struct iwl_priv *priv)
1708 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); 1707 IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
1709 else 1708 else
1710 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " 1709 IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
1711 "succeeded, " 1710 "succeeded, "
1712 "critical temperature is %d\n", 1711 "critical temperature is %d\n",
1713 priv->hw_params.ct_kill_threshold); 1712 hw_params(priv).ct_kill_threshold);
1714 } 1713 }
1715} 1714}
1716 1715
@@ -1808,8 +1807,9 @@ int iwl_alive_start(struct iwl_priv *priv)
1808 iwl_send_bt_config(priv); 1807 iwl_send_bt_config(priv);
1809 } 1808 }
1810 1809
1811 if (priv->hw_params.calib_rt_cfg) 1810 if (hw_params(priv).calib_rt_cfg)
1812 iwlagn_send_calib_cfg_rt(priv, priv->hw_params.calib_rt_cfg); 1811 iwlagn_send_calib_cfg_rt(priv,
1812 hw_params(priv).calib_rt_cfg);
1813 1813
1814 ieee80211_wake_queues(priv->hw); 1814 ieee80211_wake_queues(priv->hw);
1815 1815
@@ -3548,14 +3548,16 @@ static u32 iwl_hw_detect(struct iwl_priv *priv)
3548 3548
3549static int iwl_set_hw_params(struct iwl_priv *priv) 3549static int iwl_set_hw_params(struct iwl_priv *priv)
3550{ 3550{
3551 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; 3551 hw_params(priv).max_rxq_size = RX_QUEUE_SIZE;
3552 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; 3552 hw_params(priv).max_rxq_log = RX_QUEUE_SIZE_LOG;
3553 if (iwlagn_mod_params.amsdu_size_8K) 3553 if (iwlagn_mod_params.amsdu_size_8K)
3554 priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_8K); 3554 hw_params(priv).rx_page_order =
3555 get_order(IWL_RX_BUF_SIZE_8K);
3555 else 3556 else
3556 priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_4K); 3557 hw_params(priv).rx_page_order =
3558 get_order(IWL_RX_BUF_SIZE_4K);
3557 3559
3558 priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL; 3560 hw_params(priv).max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL;
3559 3561
3560 if (iwlagn_mod_params.disable_11n) 3562 if (iwlagn_mod_params.disable_11n)
3561 priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE; 3563 priv->cfg->sku &= ~EEPROM_SKU_CAP_11N_ENABLE;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 2b3d0526e965..2aeafa18579f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -55,8 +55,8 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv,
55 enum ieee80211_band band) 55 enum ieee80211_band band)
56{ 56{
57 u16 max_bit_rate = 0; 57 u16 max_bit_rate = 0;
58 u8 rx_chains_num = priv->hw_params.rx_chains_num; 58 u8 rx_chains_num = hw_params(priv).rx_chains_num;
59 u8 tx_chains_num = priv->hw_params.tx_chains_num; 59 u8 tx_chains_num = hw_params(priv).tx_chains_num;
60 60
61 ht_info->cap = 0; 61 ht_info->cap = 0;
62 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); 62 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
@@ -68,7 +68,7 @@ static void iwl_init_ht_hw_capab(const struct iwl_priv *priv,
68 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; 68 ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD;
69 ht_info->cap |= IEEE80211_HT_CAP_SGI_20; 69 ht_info->cap |= IEEE80211_HT_CAP_SGI_20;
70 max_bit_rate = MAX_BIT_RATE_20_MHZ; 70 max_bit_rate = MAX_BIT_RATE_20_MHZ;
71 if (priv->hw_params.ht40_channel & BIT(band)) { 71 if (hw_params(priv).ht40_channel & BIT(band)) {
72 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 72 ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
73 ht_info->cap |= IEEE80211_HT_CAP_SGI_40; 73 ht_info->cap |= IEEE80211_HT_CAP_SGI_40;
74 ht_info->mcs.rx_mask[4] = 0x01; 74 ht_info->mcs.rx_mask[4] = 0x01;
@@ -359,7 +359,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
359 beacon_int = le16_to_cpu(ctx->timing.beacon_interval); 359 beacon_int = le16_to_cpu(ctx->timing.beacon_interval);
360 } else { 360 } else {
361 beacon_int = iwl_adjust_beacon_interval(beacon_int, 361 beacon_int = iwl_adjust_beacon_interval(beacon_int,
362 priv->hw_params.max_beacon_itrvl * TIME_UNIT); 362 hw_params(priv).max_beacon_itrvl * TIME_UNIT);
363 ctx->timing.beacon_interval = cpu_to_le16(beacon_int); 363 ctx->timing.beacon_interval = cpu_to_le16(beacon_int);
364 } 364 }
365 365
@@ -1823,7 +1823,7 @@ void iwl_bg_watchdog(unsigned long data)
1823 1823
1824 /* monitor and check for other stuck queues */ 1824 /* monitor and check for other stuck queues */
1825 if (iwl_is_any_associated(priv)) { 1825 if (iwl_is_any_associated(priv)) {
1826 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 1826 for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
1827 /* skip as we already checked the command queue */ 1827 /* skip as we already checked the command queue */
1828 if (cnt == priv->cmd_queue) 1828 if (cnt == priv->cmd_queue)
1829 continue; 1829 continue;
@@ -1864,12 +1864,12 @@ u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval)
1864 1864
1865 quot = (usec / interval) & 1865 quot = (usec / interval) &
1866 (iwl_beacon_time_mask_high(priv, 1866 (iwl_beacon_time_mask_high(priv,
1867 priv->hw_params.beacon_time_tsf_bits) >> 1867 hw_params(priv).beacon_time_tsf_bits) >>
1868 priv->hw_params.beacon_time_tsf_bits); 1868 hw_params(priv).beacon_time_tsf_bits);
1869 rem = (usec % interval) & iwl_beacon_time_mask_low(priv, 1869 rem = (usec % interval) & iwl_beacon_time_mask_low(priv,
1870 priv->hw_params.beacon_time_tsf_bits); 1870 hw_params(priv).beacon_time_tsf_bits);
1871 1871
1872 return (quot << priv->hw_params.beacon_time_tsf_bits) + rem; 1872 return (quot << hw_params(priv).beacon_time_tsf_bits) + rem;
1873} 1873}
1874 1874
1875/* base is usually what we get from ucode with each received frame, 1875/* base is usually what we get from ucode with each received frame,
@@ -1879,22 +1879,22 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
1879 u32 addon, u32 beacon_interval) 1879 u32 addon, u32 beacon_interval)
1880{ 1880{
1881 u32 base_low = base & iwl_beacon_time_mask_low(priv, 1881 u32 base_low = base & iwl_beacon_time_mask_low(priv,
1882 priv->hw_params.beacon_time_tsf_bits); 1882 hw_params(priv).beacon_time_tsf_bits);
1883 u32 addon_low = addon & iwl_beacon_time_mask_low(priv, 1883 u32 addon_low = addon & iwl_beacon_time_mask_low(priv,
1884 priv->hw_params.beacon_time_tsf_bits); 1884 hw_params(priv).beacon_time_tsf_bits);
1885 u32 interval = beacon_interval * TIME_UNIT; 1885 u32 interval = beacon_interval * TIME_UNIT;
1886 u32 res = (base & iwl_beacon_time_mask_high(priv, 1886 u32 res = (base & iwl_beacon_time_mask_high(priv,
1887 priv->hw_params.beacon_time_tsf_bits)) + 1887 hw_params(priv).beacon_time_tsf_bits)) +
1888 (addon & iwl_beacon_time_mask_high(priv, 1888 (addon & iwl_beacon_time_mask_high(priv,
1889 priv->hw_params.beacon_time_tsf_bits)); 1889 hw_params(priv).beacon_time_tsf_bits));
1890 1890
1891 if (base_low > addon_low) 1891 if (base_low > addon_low)
1892 res += base_low - addon_low; 1892 res += base_low - addon_low;
1893 else if (base_low < addon_low) { 1893 else if (base_low < addon_low) {
1894 res += interval + base_low - addon_low; 1894 res += interval + base_low - addon_low;
1895 res += (1 << priv->hw_params.beacon_time_tsf_bits); 1895 res += (1 << hw_params(priv).beacon_time_tsf_bits);
1896 } else 1896 } else
1897 res += (1 << priv->hw_params.beacon_time_tsf_bits); 1897 res += (1 << hw_params(priv).beacon_time_tsf_bits);
1898 1898
1899 return cpu_to_le32(res); 1899 return cpu_to_le32(res);
1900} 1900}
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index c798c6805b66..43543e52d7b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -340,7 +340,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
340{ 340{
341 struct iwl_priv *priv = file->private_data; 341 struct iwl_priv *priv = file->private_data;
342 struct iwl_station_entry *station; 342 struct iwl_station_entry *station;
343 int max_sta = priv->hw_params.max_stations; 343 int max_sta = hw_params(priv).max_stations;
344 char *buf; 344 char *buf;
345 int i, j, pos = 0; 345 int i, j, pos = 0;
346 ssize_t ret; 346 ssize_t ret;
@@ -908,7 +908,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
908 return -ENOMEM; 908 return -ENOMEM;
909 } 909 }
910 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); 910 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
911 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 911 for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
912 txq = &priv->txq[cnt]; 912 txq = &priv->txq[cnt];
913 q = &txq->q; 913 q = &txq->q;
914 pos += scnprintf(buf + pos, bufsz - pos, 914 pos += scnprintf(buf + pos, bufsz - pos,
@@ -1006,7 +1006,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1006 if (!buf) 1006 if (!buf)
1007 return -ENOMEM; 1007 return -ENOMEM;
1008 1008
1009 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 1009 for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
1010 txq = &priv->txq[cnt]; 1010 txq = &priv->txq[cnt];
1011 q = &txq->q; 1011 q = &txq->q;
1012 pos += scnprintf(buf + pos, bufsz - pos, 1012 pos += scnprintf(buf + pos, bufsz - pos,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index e01caf7a1f12..57445c22fcbc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -648,54 +648,6 @@ struct iwl_sensitivity_ranges {
648#define CELSIUS_TO_KELVIN(x) ((x)+273) 648#define CELSIUS_TO_KELVIN(x) ((x)+273)
649 649
650 650
651/**
652 * struct iwl_hw_params
653 * @max_txq_num: Max # Tx queues supported
654 * @scd_bc_tbls_size: size of scheduler byte count tables
655 * @tfd_size: TFD size
656 * @tx/rx_chains_num: Number of TX/RX chains
657 * @valid_tx/rx_ant: usable antennas
658 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
659 * @max_rxq_log: Log-base-2 of max_rxq_size
660 * @rx_page_order: Rx buffer page order
661 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
662 * @max_stations:
663 * @ht40_channel: is 40MHz width possible in band 2.4
664 * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
665 * @sw_crypto: 0 for hw, 1 for sw
666 * @max_xxx_size: for ucode uses
667 * @ct_kill_threshold: temperature threshold
668 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
669 * @calib_init_cfg: setup initial calibrations for the hw
670 * @calib_rt_cfg: setup runtime calibrations for the hw
671 * @struct iwl_sensitivity_ranges: range of sensitivity values
672 */
673struct iwl_hw_params {
674 u8 max_txq_num;
675 u16 scd_bc_tbls_size;
676 u32 tfd_size;
677 u8 tx_chains_num;
678 u8 rx_chains_num;
679 u8 valid_tx_ant;
680 u8 valid_rx_ant;
681 u16 max_rxq_size;
682 u16 max_rxq_log;
683 u32 rx_page_order;
684 u8 max_stations;
685 u8 ht40_channel;
686 u8 max_beacon_itrvl; /* in 1024 ms */
687 u32 max_inst_size;
688 u32 max_data_size;
689 u32 ct_kill_threshold; /* value in hw-dependent units */
690 u32 ct_kill_exit_threshold; /* value in hw-dependent units */
691 /* for 1000, 6000 series and up */
692 u16 beacon_time_tsf_bits;
693 u32 calib_init_cfg;
694 u32 calib_rt_cfg;
695 const struct iwl_sensitivity_ranges *sens;
696};
697
698
699/****************************************************************************** 651/******************************************************************************
700 * 652 *
701 * Functions implemented in core module which are forward declared here 653 * Functions implemented in core module which are forward declared here
@@ -1480,8 +1432,6 @@ struct iwl_priv {
1480 struct iwl_rxon_context *cur_rssi_ctx; 1432 struct iwl_rxon_context *cur_rssi_ctx;
1481 bool bt_is_sco; 1433 bool bt_is_sco;
1482 1434
1483 struct iwl_hw_params hw_params;
1484
1485 u32 inta_mask; 1435 u32 inta_mask;
1486 1436
1487 struct workqueue_struct *workqueue; 1437 struct workqueue_struct *workqueue;
@@ -1639,11 +1589,11 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
1639 1589
1640static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) 1590static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
1641{ 1591{
1642 __free_pages(page, priv->hw_params.rx_page_order); 1592 __free_pages(page, hw_params(priv).rx_page_order);
1643} 1593}
1644 1594
1645static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) 1595static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
1646{ 1596{
1647 free_pages(page, priv->hw_params.rx_page_order); 1597 free_pages(page, hw_params(priv).rx_page_order);
1648} 1598}
1649#endif /* __iwl_dev_h__ */ 1599#endif /* __iwl_dev_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 2f267b8aabbb..40f6dd4decff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -217,7 +217,7 @@
217 ((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc) 217 ((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc)
218 218
219#define SCD_QUEUECHAIN_SEL_ALL(priv) \ 219#define SCD_QUEUECHAIN_SEL_ALL(priv) \
220 (((1<<(priv)->hw_params.max_txq_num) - 1) &\ 220 (((1<<hw_params(priv).max_txq_num) - 1) &\
221 (~(1<<(priv)->cmd_queue))) 221 (~(1<<(priv)->cmd_queue)))
222 222
223#define SCD_BASE (PRPH_BASE + 0xa02c00) 223#define SCD_BASE (PRPH_BASE + 0xa02c00)
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 28e59319f581..bddb2daf31bd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -343,7 +343,7 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
343 343
344void iwl_init_scan_params(struct iwl_priv *priv) 344void iwl_init_scan_params(struct iwl_priv *priv)
345{ 345{
346 u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; 346 u8 ant_idx = fls(hw_params(priv).valid_tx_ant) - 1;
347 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) 347 if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ])
348 priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; 348 priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx;
349 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) 349 if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ])
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index a7c0315472e9..483785c3fb04 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -66,6 +66,7 @@
66struct iwl_cfg; 66struct iwl_cfg;
67struct iwl_bus; 67struct iwl_bus;
68struct iwl_priv; 68struct iwl_priv;
69struct iwl_sensitivity_ranges;
69 70
70extern struct iwl_mod_params iwlagn_mod_params; 71extern struct iwl_mod_params iwlagn_mod_params;
71 72
@@ -91,12 +92,60 @@ struct iwl_mod_params {
91}; 92};
92 93
93/** 94/**
95 * struct iwl_hw_params
96 * @max_txq_num: Max # Tx queues supported
97 * @scd_bc_tbls_size: size of scheduler byte count tables
98 * @tfd_size: TFD size
99 * @tx/rx_chains_num: Number of TX/RX chains
100 * @valid_tx/rx_ant: usable antennas
101 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
102 * @max_rxq_log: Log-base-2 of max_rxq_size
103 * @rx_page_order: Rx buffer page order
104 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
105 * @max_stations:
106 * @ht40_channel: is 40MHz width possible in band 2.4
107 * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
108 * @sw_crypto: 0 for hw, 1 for sw
109 * @max_xxx_size: for ucode uses
110 * @ct_kill_threshold: temperature threshold
111 * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
112 * @calib_init_cfg: setup initial calibrations for the hw
113 * @calib_rt_cfg: setup runtime calibrations for the hw
114 * @struct iwl_sensitivity_ranges: range of sensitivity values
115 */
116struct iwl_hw_params {
117 u8 max_txq_num;
118 u16 scd_bc_tbls_size;
119 u32 tfd_size;
120 u8 tx_chains_num;
121 u8 rx_chains_num;
122 u8 valid_tx_ant;
123 u8 valid_rx_ant;
124 u16 max_rxq_size;
125 u16 max_rxq_log;
126 u32 rx_page_order;
127 u8 max_stations;
128 u8 ht40_channel;
129 u8 max_beacon_itrvl; /* in 1024 ms */
130 u32 max_inst_size;
131 u32 max_data_size;
132 u32 ct_kill_threshold; /* value in hw-dependent units */
133 u32 ct_kill_exit_threshold; /* value in hw-dependent units */
134 /* for 1000, 6000 series and up */
135 u16 beacon_time_tsf_bits;
136 u32 calib_init_cfg;
137 u32 calib_rt_cfg;
138 const struct iwl_sensitivity_ranges *sens;
139};
140
141/**
94 * struct iwl_shared - shared fields for all the layers of the driver 142 * struct iwl_shared - shared fields for all the layers of the driver
95 * 143 *
96 * @dbg_level_dev: dbg level set per device. Prevails on 144 * @dbg_level_dev: dbg level set per device. Prevails on
97 * iwlagn_mod_params.debug_level if set (!= 0) 145 * iwlagn_mod_params.debug_level if set (!= 0)
98 * @bus: pointer to the bus layer data 146 * @bus: pointer to the bus layer data
99 * @priv: pointer to the upper layer data 147 * @priv: pointer to the upper layer data
148 * @hw_params: see struct iwl_hw_params
100 */ 149 */
101struct iwl_shared { 150struct iwl_shared {
102#ifdef CONFIG_IWLWIFI_DEBUG 151#ifdef CONFIG_IWLWIFI_DEBUG
@@ -105,11 +154,13 @@ struct iwl_shared {
105 154
106 struct iwl_bus *bus; 155 struct iwl_bus *bus;
107 struct iwl_priv *priv; 156 struct iwl_priv *priv;
157 struct iwl_hw_params hw_params;
108}; 158};
109 159
110/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */ 160/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
111#define priv(_m) ((_m)->shrd->priv) 161#define priv(_m) ((_m)->shrd->priv)
112#define bus(_m) ((_m)->shrd->bus) 162#define bus(_m) ((_m)->shrd->bus)
163#define hw_params(_m) ((_m)->shrd->hw_params)
113 164
114#ifdef CONFIG_IWLWIFI_DEBUG 165#ifdef CONFIG_IWLWIFI_DEBUG
115/* 166/*
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 1ef3b7106ad5..b5b0ff3d8890 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -251,7 +251,8 @@ u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
251 else if (is_broadcast_ether_addr(addr)) 251 else if (is_broadcast_ether_addr(addr))
252 sta_id = ctx->bcast_sta_id; 252 sta_id = ctx->bcast_sta_id;
253 else 253 else
254 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) { 254 for (i = IWL_STA_ID;
255 i < hw_params(priv).max_stations; i++) {
255 if (!compare_ether_addr(priv->stations[i].sta.sta.addr, 256 if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
256 addr)) { 257 addr)) {
257 sta_id = i; 258 sta_id = i;
@@ -535,7 +536,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv,
535 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); 536 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n");
536 537
537 spin_lock_irqsave(&priv->sta_lock, flags_spin); 538 spin_lock_irqsave(&priv->sta_lock, flags_spin);
538 for (i = 0; i < priv->hw_params.max_stations; i++) { 539 for (i = 0; i < hw_params(priv).max_stations; i++) {
539 if (ctx && ctx->ctxid != priv->stations[i].ctxid) 540 if (ctx && ctx->ctxid != priv->stations[i].ctxid)
540 continue; 541 continue;
541 542
@@ -576,7 +577,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
576 577
577 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); 578 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n");
578 spin_lock_irqsave(&priv->sta_lock, flags_spin); 579 spin_lock_irqsave(&priv->sta_lock, flags_spin);
579 for (i = 0; i < priv->hw_params.max_stations; i++) { 580 for (i = 0; i < hw_params(priv).max_stations; i++) {
580 if (ctx->ctxid != priv->stations[i].ctxid) 581 if (ctx->ctxid != priv->stations[i].ctxid)
581 continue; 582 continue;
582 if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && 583 if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) &&
@@ -589,7 +590,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
589 } 590 }
590 } 591 }
591 592
592 for (i = 0; i < priv->hw_params.max_stations; i++) { 593 for (i = 0; i < hw_params(priv).max_stations; i++) {
593 if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { 594 if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) {
594 memcpy(&sta_cmd, &priv->stations[i].sta, 595 memcpy(&sta_cmd, &priv->stations[i].sta,
595 sizeof(struct iwl_addsta_cmd)); 596 sizeof(struct iwl_addsta_cmd));
@@ -686,7 +687,7 @@ void iwl_dealloc_bcast_stations(struct iwl_priv *priv)
686 int i; 687 int i;
687 688
688 spin_lock_irqsave(&priv->sta_lock, flags); 689 spin_lock_irqsave(&priv->sta_lock, flags);
689 for (i = 0; i < priv->hw_params.max_stations; i++) { 690 for (i = 0; i < hw_params(priv).max_stations; i++) {
690 if (!(priv->stations[i].used & IWL_STA_BCAST)) 691 if (!(priv->stations[i].used & IWL_STA_BCAST))
691 continue; 692 continue;
692 693
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index 846db8fdbf6c..52edd6a10c7a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -265,16 +265,17 @@ static void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
265 if (rxq->free_count > RX_LOW_WATERMARK) 265 if (rxq->free_count > RX_LOW_WATERMARK)
266 gfp_mask |= __GFP_NOWARN; 266 gfp_mask |= __GFP_NOWARN;
267 267
268 if (priv->hw_params.rx_page_order > 0) 268 if (hw_params(priv).rx_page_order > 0)
269 gfp_mask |= __GFP_COMP; 269 gfp_mask |= __GFP_COMP;
270 270
271 /* Alloc a new receive buffer */ 271 /* Alloc a new receive buffer */
272 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); 272 page = alloc_pages(gfp_mask,
273 hw_params(priv).rx_page_order);
273 if (!page) { 274 if (!page) {
274 if (net_ratelimit()) 275 if (net_ratelimit())
275 IWL_DEBUG_INFO(priv, "alloc_pages failed, " 276 IWL_DEBUG_INFO(priv, "alloc_pages failed, "
276 "order: %d\n", 277 "order: %d\n",
277 priv->hw_params.rx_page_order); 278 hw_params(priv).rx_page_order);
278 279
279 if ((rxq->free_count <= RX_LOW_WATERMARK) && 280 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
280 net_ratelimit()) 281 net_ratelimit())
@@ -293,7 +294,7 @@ static void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
293 294
294 if (list_empty(&rxq->rx_used)) { 295 if (list_empty(&rxq->rx_used)) {
295 spin_unlock_irqrestore(&rxq->lock, flags); 296 spin_unlock_irqrestore(&rxq->lock, flags);
296 __free_pages(page, priv->hw_params.rx_page_order); 297 __free_pages(page, hw_params(priv).rx_page_order);
297 return; 298 return;
298 } 299 }
299 element = rxq->rx_used.next; 300 element = rxq->rx_used.next;
@@ -306,7 +307,7 @@ static void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
306 rxb->page = page; 307 rxb->page = page;
307 /* Get physical address of the RB */ 308 /* Get physical address of the RB */
308 rxb->page_dma = dma_map_page(priv->bus->dev, page, 0, 309 rxb->page_dma = dma_map_page(priv->bus->dev, page, 0,
309 PAGE_SIZE << priv->hw_params.rx_page_order, 310 PAGE_SIZE << hw_params(priv).rx_page_order,
310 DMA_FROM_DEVICE); 311 DMA_FROM_DEVICE);
311 /* dma address must be no more than 36 bits */ 312 /* dma address must be no more than 36 bits */
312 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); 313 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
@@ -405,7 +406,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)
405 rxq->queue[i] = NULL; 406 rxq->queue[i] = NULL;
406 407
407 dma_unmap_page(priv->bus->dev, rxb->page_dma, 408 dma_unmap_page(priv->bus->dev, rxb->page_dma,
408 PAGE_SIZE << priv->hw_params.rx_page_order, 409 PAGE_SIZE << hw_params(priv).rx_page_order,
409 DMA_FROM_DEVICE); 410 DMA_FROM_DEVICE);
410 pkt = rxb_addr(rxb); 411 pkt = rxb_addr(rxb);
411 412
@@ -456,7 +457,8 @@ static void iwl_rx_handle(struct iwl_priv *priv)
456 spin_lock_irqsave(&rxq->lock, flags); 457 spin_lock_irqsave(&rxq->lock, flags);
457 if (rxb->page != NULL) { 458 if (rxb->page != NULL) {
458 rxb->page_dma = dma_map_page(priv->bus->dev, rxb->page, 459 rxb->page_dma = dma_map_page(priv->bus->dev, rxb->page,
459 0, PAGE_SIZE << priv->hw_params.rx_page_order, 460 0, PAGE_SIZE <<
461 hw_params(priv).rx_page_order,
460 DMA_FROM_DEVICE); 462 DMA_FROM_DEVICE);
461 list_add_tail(&rxb->list, &rxq->rx_free); 463 list_add_tail(&rxb->list, &rxq->rx_free);
462 rxq->free_count++; 464 rxq->free_count++;
@@ -610,7 +612,7 @@ void iwl_irq_tasklet(struct iwl_priv *priv)
610 if (inta & CSR_INT_BIT_WAKEUP) { 612 if (inta & CSR_INT_BIT_WAKEUP) {
611 IWL_DEBUG_ISR(priv, "Wakeup interrupt\n"); 613 IWL_DEBUG_ISR(priv, "Wakeup interrupt\n");
612 iwl_rx_queue_update_write_ptr(priv, &priv->rxq); 614 iwl_rx_queue_update_write_ptr(priv, &priv->rxq);
613 for (i = 0; i < priv->hw_params.max_txq_num; i++) 615 for (i = 0; i < hw_params(priv).max_txq_num; i++)
614 iwl_txq_update_write_ptr(priv, &priv->txq[i]); 616 iwl_txq_update_write_ptr(priv, &priv->txq[i]);
615 617
616 priv->isr_stats.wakeup++; 618 priv->isr_stats.wakeup++;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index e4a70fed8cf8..92128383cae7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -120,7 +120,7 @@ static void iwl_trans_rxq_free_rx_bufs(struct iwl_priv *priv)
120 * to an SKB, so we need to unmap and free potential storage */ 120 * to an SKB, so we need to unmap and free potential storage */
121 if (rxq->pool[i].page != NULL) { 121 if (rxq->pool[i].page != NULL) {
122 dma_unmap_page(priv->bus->dev, rxq->pool[i].page_dma, 122 dma_unmap_page(priv->bus->dev, rxq->pool[i].page_dma,
123 PAGE_SIZE << priv->hw_params.rx_page_order, 123 PAGE_SIZE << hw_params(priv).rx_page_order,
124 DMA_FROM_DEVICE); 124 DMA_FROM_DEVICE);
125 __iwl_free_pages(priv, rxq->pool[i].page); 125 __iwl_free_pages(priv, rxq->pool[i].page);
126 rxq->pool[i].page = NULL; 126 rxq->pool[i].page = NULL;
@@ -285,7 +285,7 @@ static inline void iwlagn_free_dma_ptr(struct iwl_priv *priv,
285static int iwl_trans_txq_alloc(struct iwl_priv *priv, struct iwl_tx_queue *txq, 285static int iwl_trans_txq_alloc(struct iwl_priv *priv, struct iwl_tx_queue *txq,
286 int slots_num, u32 txq_id) 286 int slots_num, u32 txq_id)
287{ 287{
288 size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; 288 size_t tfd_sz = hw_params(priv).tfd_size * TFD_QUEUE_SIZE_MAX;
289 int i; 289 int i;
290 290
291 if (WARN_ON(txq->meta || txq->cmd || txq->txb || txq->tfds)) 291 if (WARN_ON(txq->meta || txq->cmd || txq->txb || txq->tfds))
@@ -429,7 +429,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
429 429
430 /* De-alloc circular buffer of TFDs */ 430 /* De-alloc circular buffer of TFDs */
431 if (txq->q.n_bd) { 431 if (txq->q.n_bd) {
432 dma_free_coherent(dev, priv->hw_params.tfd_size * 432 dma_free_coherent(dev, hw_params(priv).tfd_size *
433 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 433 txq->q.n_bd, txq->tfds, txq->q.dma_addr);
434 memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr)); 434 memset(&txq->q.dma_addr, 0, sizeof(txq->q.dma_addr));
435 } 435 }
@@ -459,7 +459,8 @@ static void iwl_trans_tx_free(struct iwl_priv *priv)
459 459
460 /* Tx queues */ 460 /* Tx queues */
461 if (priv->txq) { 461 if (priv->txq) {
462 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 462 for (txq_id = 0;
463 txq_id < hw_params(priv).max_txq_num; txq_id++)
463 iwl_tx_queue_free(priv, txq_id); 464 iwl_tx_queue_free(priv, txq_id);
464 } 465 }
465 466
@@ -491,7 +492,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv)
491 } 492 }
492 493
493 ret = iwlagn_alloc_dma_ptr(priv, &priv->scd_bc_tbls, 494 ret = iwlagn_alloc_dma_ptr(priv, &priv->scd_bc_tbls,
494 priv->hw_params.scd_bc_tbls_size); 495 hw_params(priv).scd_bc_tbls_size);
495 if (ret) { 496 if (ret) {
496 IWL_ERR(priv, "Scheduler BC Table allocation failed\n"); 497 IWL_ERR(priv, "Scheduler BC Table allocation failed\n");
497 goto error; 498 goto error;
@@ -513,7 +514,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv)
513 } 514 }
514 515
515 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 516 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
516 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 517 for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++) {
517 slots_num = (txq_id == priv->cmd_queue) ? 518 slots_num = (txq_id == priv->cmd_queue) ?
518 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 519 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
519 ret = iwl_trans_txq_alloc(priv, &priv->txq[txq_id], slots_num, 520 ret = iwl_trans_txq_alloc(priv, &priv->txq[txq_id], slots_num,
@@ -556,7 +557,7 @@ static int iwl_tx_init(struct iwl_priv *priv)
556 spin_unlock_irqrestore(&priv->lock, flags); 557 spin_unlock_irqrestore(&priv->lock, flags);
557 558
558 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 559 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
559 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { 560 for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++) {
560 slots_num = (txq_id == priv->cmd_queue) ? 561 slots_num = (txq_id == priv->cmd_queue) ?
561 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 562 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
562 ret = iwl_trans_txq_init(priv, &priv->txq[txq_id], slots_num, 563 ret = iwl_trans_txq_init(priv, &priv->txq[txq_id], slots_num,
@@ -789,7 +790,8 @@ static void iwl_trans_tx_start(struct iwl_priv *priv)
789 a += 4) 790 a += 4)
790 iwl_write_targ_mem(priv, a, 0); 791 iwl_write_targ_mem(priv, a, 0);
791 for (; a < priv->scd_base_addr + 792 for (; a < priv->scd_base_addr +
792 SCD_TRANS_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) 793 SCD_TRANS_TBL_OFFSET_QUEUE(hw_params(priv).max_txq_num);
794 a += 4)
793 iwl_write_targ_mem(priv, a, 0); 795 iwl_write_targ_mem(priv, a, 0);
794 796
795 iwl_write_prph(priv, SCD_DRAM_BASE_ADDR, 797 iwl_write_prph(priv, SCD_DRAM_BASE_ADDR,
@@ -811,7 +813,7 @@ static void iwl_trans_tx_start(struct iwl_priv *priv)
811 iwl_write_prph(priv, SCD_AGGR_SEL, 0); 813 iwl_write_prph(priv, SCD_AGGR_SEL, 0);
812 814
813 /* initiate the queues */ 815 /* initiate the queues */
814 for (i = 0; i < priv->hw_params.max_txq_num; i++) { 816 for (i = 0; i < hw_params(priv).max_txq_num; i++) {
815 iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); 817 iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0);
816 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); 818 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
817 iwl_write_targ_mem(priv, priv->scd_base_addr + 819 iwl_write_targ_mem(priv, priv->scd_base_addr +
@@ -828,7 +830,7 @@ static void iwl_trans_tx_start(struct iwl_priv *priv)
828 } 830 }
829 831
830 iwl_write_prph(priv, SCD_INTERRUPT_MASK, 832 iwl_write_prph(priv, SCD_INTERRUPT_MASK,
831 IWL_MASK(0, priv->hw_params.max_txq_num)); 833 IWL_MASK(0, hw_params(priv).max_txq_num));
832 834
833 /* Activate all Tx DMA/FIFO channels */ 835 /* Activate all Tx DMA/FIFO channels */
834 iwl_trans_txq_set_sched(priv, IWL_MASK(0, 7)); 836 iwl_trans_txq_set_sched(priv, IWL_MASK(0, 7));
@@ -908,7 +910,7 @@ static int iwl_trans_tx_stop(struct iwl_priv *priv)
908 } 910 }
909 911
910 /* Unmap DMA from host system and free skb's */ 912 /* Unmap DMA from host system and free skb's */
911 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 913 for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++)
912 iwl_tx_queue_unmap(priv, txq_id); 914 iwl_tx_queue_unmap(priv, txq_id);
913 915
914 return 0; 916 return 0;