diff options
author | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-06-14 07:20:18 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-06-14 07:44:49 -0400 |
commit | d987dd137bac8dca9b0015763d3106f48bb8a596 (patch) | |
tree | ef887505b3c904c548d58ec9bb6f4970a0877042 /drivers/net/wireless/iwlwifi/dvm/dev.h | |
parent | c85251f8562095cd6fd63ae786354283c5318303 (diff) | |
parent | 211c17aaee644bb808fbdeef547ac99db92c01ed (diff) |
Merge remote branch 'wireless-next/master' into ath6kl-next
Conflicts:
drivers/net/wireless/ath/ath6kl/cfg80211.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm/dev.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/dev.h | 935 |
1 files changed, 935 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h new file mode 100644 index 000000000000..4620b657948a --- /dev/null +++ b/drivers/net/wireless/iwlwifi/dvm/dev.h | |||
@@ -0,0 +1,935 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of version 2 of the GNU General Public License as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Intel Linux Wireless <ilw@linux.intel.com> | ||
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
24 | * | ||
25 | *****************************************************************************/ | ||
26 | /* | ||
27 | * Please use this file (dev.h) for driver implementation definitions. | ||
28 | * Please use commands.h for uCode API definitions. | ||
29 | */ | ||
30 | |||
31 | #ifndef __iwl_dev_h__ | ||
32 | #define __iwl_dev_h__ | ||
33 | |||
34 | #include <linux/interrupt.h> | ||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/wait.h> | ||
37 | #include <linux/leds.h> | ||
38 | #include <linux/slab.h> | ||
39 | #include <linux/mutex.h> | ||
40 | |||
41 | #include "iwl-fw.h" | ||
42 | #include "iwl-eeprom-parse.h" | ||
43 | #include "iwl-csr.h" | ||
44 | #include "iwl-debug.h" | ||
45 | #include "iwl-agn-hw.h" | ||
46 | #include "iwl-op-mode.h" | ||
47 | #include "iwl-notif-wait.h" | ||
48 | #include "iwl-trans.h" | ||
49 | |||
50 | #include "led.h" | ||
51 | #include "power.h" | ||
52 | #include "rs.h" | ||
53 | #include "tt.h" | ||
54 | |||
55 | #include "iwl-test.h" | ||
56 | |||
57 | /* CT-KILL constants */ | ||
58 | #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ | ||
59 | #define CT_KILL_THRESHOLD 114 /* in Celsius */ | ||
60 | #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */ | ||
61 | |||
62 | /* Default noise level to report when noise measurement is not available. | ||
63 | * This may be because we're: | ||
64 | * 1) Not associated no beacon statistics being sent to driver) | ||
65 | * 2) Scanning (noise measurement does not apply to associated channel) | ||
66 | * Use default noise value of -127 ... this is below the range of measurable | ||
67 | * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user. | ||
68 | * Also, -127 works better than 0 when averaging frames with/without | ||
69 | * noise info (e.g. averaging might be done in app); measured dBm values are | ||
70 | * always negative ... using a negative value as the default keeps all | ||
71 | * averages within an s8's (used in some apps) range of negative values. */ | ||
72 | #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) | ||
73 | |||
74 | /* | ||
75 | * RTS threshold here is total size [2347] minus 4 FCS bytes | ||
76 | * Per spec: | ||
77 | * a value of 0 means RTS on all data/management packets | ||
78 | * a value > max MSDU size means no RTS | ||
79 | * else RTS for data/management frames where MPDU is larger | ||
80 | * than RTS value. | ||
81 | */ | ||
82 | #define DEFAULT_RTS_THRESHOLD 2347U | ||
83 | #define MIN_RTS_THRESHOLD 0U | ||
84 | #define MAX_RTS_THRESHOLD 2347U | ||
85 | #define MAX_MSDU_SIZE 2304U | ||
86 | #define MAX_MPDU_SIZE 2346U | ||
87 | #define DEFAULT_BEACON_INTERVAL 200U | ||
88 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | ||
89 | #define DEFAULT_LONG_RETRY_LIMIT 4U | ||
90 | |||
91 | #define IWL_NUM_SCAN_RATES (2) | ||
92 | |||
93 | /* | ||
94 | * Minimum number of queues. MAX_NUM is defined in hw specific files. | ||
95 | * Set the minimum to accommodate | ||
96 | * - 4 standard TX queues | ||
97 | * - the command queue | ||
98 | * - 4 PAN TX queues | ||
99 | * - the PAN multicast queue, and | ||
100 | * - the AUX (TX during scan dwell) queue. | ||
101 | */ | ||
102 | #define IWL_MIN_NUM_QUEUES 11 | ||
103 | |||
104 | /* | ||
105 | * Command queue depends on iPAN support. | ||
106 | */ | ||
107 | #define IWL_DEFAULT_CMD_QUEUE_NUM 4 | ||
108 | #define IWL_IPAN_CMD_QUEUE_NUM 9 | ||
109 | |||
110 | #define IEEE80211_DATA_LEN 2304 | ||
111 | #define IEEE80211_4ADDR_LEN 30 | ||
112 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
113 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
114 | |||
115 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 | ||
116 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 | ||
117 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 | ||
118 | |||
119 | #define IWL_SUPPORTED_RATES_IE_LEN 8 | ||
120 | |||
121 | #define IWL_INVALID_RATE 0xFF | ||
122 | #define IWL_INVALID_VALUE -1 | ||
123 | |||
124 | union iwl_ht_rate_supp { | ||
125 | u16 rates; | ||
126 | struct { | ||
127 | u8 siso_rate; | ||
128 | u8 mimo_rate; | ||
129 | }; | ||
130 | }; | ||
131 | |||
132 | struct iwl_ht_config { | ||
133 | bool single_chain_sufficient; | ||
134 | enum ieee80211_smps_mode smps; /* current smps mode */ | ||
135 | }; | ||
136 | |||
137 | /* QoS structures */ | ||
138 | struct iwl_qos_info { | ||
139 | int qos_active; | ||
140 | struct iwl_qosparam_cmd def_qos_parm; | ||
141 | }; | ||
142 | |||
143 | /** | ||
144 | * enum iwl_agg_state | ||
145 | * | ||
146 | * The state machine of the BA agreement establishment / tear down. | ||
147 | * These states relate to a specific RA / TID. | ||
148 | * | ||
149 | * @IWL_AGG_OFF: aggregation is not used | ||
150 | * @IWL_AGG_STARTING: aggregation are starting (between start and oper) | ||
151 | * @IWL_AGG_ON: aggregation session is up | ||
152 | * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the | ||
153 | * HW queue to be empty from packets for this RA /TID. | ||
154 | * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the | ||
155 | * HW queue to be empty from packets for this RA /TID. | ||
156 | */ | ||
157 | enum iwl_agg_state { | ||
158 | IWL_AGG_OFF = 0, | ||
159 | IWL_AGG_STARTING, | ||
160 | IWL_AGG_ON, | ||
161 | IWL_EMPTYING_HW_QUEUE_ADDBA, | ||
162 | IWL_EMPTYING_HW_QUEUE_DELBA, | ||
163 | }; | ||
164 | |||
165 | /** | ||
166 | * struct iwl_ht_agg - aggregation state machine | ||
167 | |||
168 | * This structs holds the states for the BA agreement establishment and tear | ||
169 | * down. It also holds the state during the BA session itself. This struct is | ||
170 | * duplicated for each RA / TID. | ||
171 | |||
172 | * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the | ||
173 | * Tx response (REPLY_TX), and the block ack notification | ||
174 | * (REPLY_COMPRESSED_BA). | ||
175 | * @state: state of the BA agreement establishment / tear down. | ||
176 | * @txq_id: Tx queue used by the BA session | ||
177 | * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or | ||
178 | * the first packet to be sent in legacy HW queue in Tx AGG stop flow. | ||
179 | * Basically when next_reclaimed reaches ssn, we can tell mac80211 that | ||
180 | * we are ready to finish the Tx AGG stop / start flow. | ||
181 | * @wait_for_ba: Expect block-ack before next Tx reply | ||
182 | */ | ||
183 | struct iwl_ht_agg { | ||
184 | u32 rate_n_flags; | ||
185 | enum iwl_agg_state state; | ||
186 | u16 txq_id; | ||
187 | u16 ssn; | ||
188 | bool wait_for_ba; | ||
189 | }; | ||
190 | |||
191 | /** | ||
192 | * struct iwl_tid_data - one for each RA / TID | ||
193 | |||
194 | * This structs holds the states for each RA / TID. | ||
195 | |||
196 | * @seq_number: the next WiFi sequence number to use | ||
197 | * @next_reclaimed: the WiFi sequence number of the next packet to be acked. | ||
198 | * This is basically (last acked packet++). | ||
199 | * @agg: aggregation state machine | ||
200 | */ | ||
201 | struct iwl_tid_data { | ||
202 | u16 seq_number; | ||
203 | u16 next_reclaimed; | ||
204 | struct iwl_ht_agg agg; | ||
205 | }; | ||
206 | |||
207 | /* | ||
208 | * Structure should be accessed with sta_lock held. When station addition | ||
209 | * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only | ||
210 | * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock | ||
211 | * held. | ||
212 | */ | ||
213 | struct iwl_station_entry { | ||
214 | struct iwl_addsta_cmd sta; | ||
215 | u8 used, ctxid; | ||
216 | struct iwl_link_quality_cmd *lq; | ||
217 | }; | ||
218 | |||
219 | /* | ||
220 | * iwl_station_priv: Driver's private station information | ||
221 | * | ||
222 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | ||
223 | * in the structure for use by driver. This structure is places in that | ||
224 | * space. | ||
225 | */ | ||
226 | struct iwl_station_priv { | ||
227 | struct iwl_rxon_context *ctx; | ||
228 | struct iwl_lq_sta lq_sta; | ||
229 | atomic_t pending_frames; | ||
230 | bool client; | ||
231 | bool asleep; | ||
232 | u8 max_agg_bufsize; | ||
233 | u8 sta_id; | ||
234 | }; | ||
235 | |||
236 | /** | ||
237 | * struct iwl_vif_priv - driver's private per-interface information | ||
238 | * | ||
239 | * When mac80211 allocates a virtual interface, it can allocate | ||
240 | * space for us to put data into. | ||
241 | */ | ||
242 | struct iwl_vif_priv { | ||
243 | struct iwl_rxon_context *ctx; | ||
244 | u8 ibss_bssid_sta_id; | ||
245 | }; | ||
246 | |||
247 | struct iwl_sensitivity_ranges { | ||
248 | u16 min_nrg_cck; | ||
249 | |||
250 | u16 nrg_th_cck; | ||
251 | u16 nrg_th_ofdm; | ||
252 | |||
253 | u16 auto_corr_min_ofdm; | ||
254 | u16 auto_corr_min_ofdm_mrc; | ||
255 | u16 auto_corr_min_ofdm_x1; | ||
256 | u16 auto_corr_min_ofdm_mrc_x1; | ||
257 | |||
258 | u16 auto_corr_max_ofdm; | ||
259 | u16 auto_corr_max_ofdm_mrc; | ||
260 | u16 auto_corr_max_ofdm_x1; | ||
261 | u16 auto_corr_max_ofdm_mrc_x1; | ||
262 | |||
263 | u16 auto_corr_max_cck; | ||
264 | u16 auto_corr_max_cck_mrc; | ||
265 | u16 auto_corr_min_cck; | ||
266 | u16 auto_corr_min_cck_mrc; | ||
267 | |||
268 | u16 barker_corr_th_min; | ||
269 | u16 barker_corr_th_min_mrc; | ||
270 | u16 nrg_th_cca; | ||
271 | }; | ||
272 | |||
273 | |||
274 | #define KELVIN_TO_CELSIUS(x) ((x)-273) | ||
275 | #define CELSIUS_TO_KELVIN(x) ((x)+273) | ||
276 | |||
277 | |||
278 | /****************************************************************************** | ||
279 | * | ||
280 | * Functions implemented in core module which are forward declared here | ||
281 | * for use by iwl-[4-5].c | ||
282 | * | ||
283 | * NOTE: The implementation of these functions are not hardware specific | ||
284 | * which is why they are in the core module files. | ||
285 | * | ||
286 | * Naming convention -- | ||
287 | * iwl_ <-- Is part of iwlwifi | ||
288 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | ||
289 | * | ||
290 | ****************************************************************************/ | ||
291 | extern void iwl_update_chain_flags(struct iwl_priv *priv); | ||
292 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | ||
293 | |||
294 | #define IWL_OPERATION_MODE_AUTO 0 | ||
295 | #define IWL_OPERATION_MODE_HT_ONLY 1 | ||
296 | #define IWL_OPERATION_MODE_MIXED 2 | ||
297 | #define IWL_OPERATION_MODE_20MHZ 3 | ||
298 | |||
299 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 | ||
300 | |||
301 | /* Sensitivity and chain noise calibration */ | ||
302 | #define INITIALIZATION_VALUE 0xFFFF | ||
303 | #define IWL_CAL_NUM_BEACONS 16 | ||
304 | #define MAXIMUM_ALLOWED_PATHLOSS 15 | ||
305 | |||
306 | #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 | ||
307 | |||
308 | #define MAX_FA_OFDM 50 | ||
309 | #define MIN_FA_OFDM 5 | ||
310 | #define MAX_FA_CCK 50 | ||
311 | #define MIN_FA_CCK 5 | ||
312 | |||
313 | #define AUTO_CORR_STEP_OFDM 1 | ||
314 | |||
315 | #define AUTO_CORR_STEP_CCK 3 | ||
316 | #define AUTO_CORR_MAX_TH_CCK 160 | ||
317 | |||
318 | #define NRG_DIFF 2 | ||
319 | #define NRG_STEP_CCK 2 | ||
320 | #define NRG_MARGIN 8 | ||
321 | #define MAX_NUMBER_CCK_NO_FA 100 | ||
322 | |||
323 | #define AUTO_CORR_CCK_MIN_VAL_DEF (125) | ||
324 | |||
325 | #define CHAIN_A 0 | ||
326 | #define CHAIN_B 1 | ||
327 | #define CHAIN_C 2 | ||
328 | #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4 | ||
329 | #define ALL_BAND_FILTER 0xFF00 | ||
330 | #define IN_BAND_FILTER 0xFF | ||
331 | #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF | ||
332 | |||
333 | #define NRG_NUM_PREV_STAT_L 20 | ||
334 | #define NUM_RX_CHAINS 3 | ||
335 | |||
336 | enum iwlagn_false_alarm_state { | ||
337 | IWL_FA_TOO_MANY = 0, | ||
338 | IWL_FA_TOO_FEW = 1, | ||
339 | IWL_FA_GOOD_RANGE = 2, | ||
340 | }; | ||
341 | |||
342 | enum iwlagn_chain_noise_state { | ||
343 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ | ||
344 | IWL_CHAIN_NOISE_ACCUMULATE, | ||
345 | IWL_CHAIN_NOISE_CALIBRATED, | ||
346 | IWL_CHAIN_NOISE_DONE, | ||
347 | }; | ||
348 | |||
349 | /* Sensitivity calib data */ | ||
350 | struct iwl_sensitivity_data { | ||
351 | u32 auto_corr_ofdm; | ||
352 | u32 auto_corr_ofdm_mrc; | ||
353 | u32 auto_corr_ofdm_x1; | ||
354 | u32 auto_corr_ofdm_mrc_x1; | ||
355 | u32 auto_corr_cck; | ||
356 | u32 auto_corr_cck_mrc; | ||
357 | |||
358 | u32 last_bad_plcp_cnt_ofdm; | ||
359 | u32 last_fa_cnt_ofdm; | ||
360 | u32 last_bad_plcp_cnt_cck; | ||
361 | u32 last_fa_cnt_cck; | ||
362 | |||
363 | u32 nrg_curr_state; | ||
364 | u32 nrg_prev_state; | ||
365 | u32 nrg_value[10]; | ||
366 | u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L]; | ||
367 | u32 nrg_silence_ref; | ||
368 | u32 nrg_energy_idx; | ||
369 | u32 nrg_silence_idx; | ||
370 | u32 nrg_th_cck; | ||
371 | s32 nrg_auto_corr_silence_diff; | ||
372 | u32 num_in_cck_no_fa; | ||
373 | u32 nrg_th_ofdm; | ||
374 | |||
375 | u16 barker_corr_th_min; | ||
376 | u16 barker_corr_th_min_mrc; | ||
377 | u16 nrg_th_cca; | ||
378 | }; | ||
379 | |||
380 | /* Chain noise (differential Rx gain) calib data */ | ||
381 | struct iwl_chain_noise_data { | ||
382 | u32 active_chains; | ||
383 | u32 chain_noise_a; | ||
384 | u32 chain_noise_b; | ||
385 | u32 chain_noise_c; | ||
386 | u32 chain_signal_a; | ||
387 | u32 chain_signal_b; | ||
388 | u32 chain_signal_c; | ||
389 | u16 beacon_count; | ||
390 | u8 disconn_array[NUM_RX_CHAINS]; | ||
391 | u8 delta_gain_code[NUM_RX_CHAINS]; | ||
392 | u8 radio_write; | ||
393 | u8 state; | ||
394 | }; | ||
395 | |||
396 | enum { | ||
397 | MEASUREMENT_READY = (1 << 0), | ||
398 | MEASUREMENT_ACTIVE = (1 << 1), | ||
399 | }; | ||
400 | |||
401 | /* reply_tx_statistics (for _agn devices) */ | ||
402 | struct reply_tx_error_statistics { | ||
403 | u32 pp_delay; | ||
404 | u32 pp_few_bytes; | ||
405 | u32 pp_bt_prio; | ||
406 | u32 pp_quiet_period; | ||
407 | u32 pp_calc_ttak; | ||
408 | u32 int_crossed_retry; | ||
409 | u32 short_limit; | ||
410 | u32 long_limit; | ||
411 | u32 fifo_underrun; | ||
412 | u32 drain_flow; | ||
413 | u32 rfkill_flush; | ||
414 | u32 life_expire; | ||
415 | u32 dest_ps; | ||
416 | u32 host_abort; | ||
417 | u32 bt_retry; | ||
418 | u32 sta_invalid; | ||
419 | u32 frag_drop; | ||
420 | u32 tid_disable; | ||
421 | u32 fifo_flush; | ||
422 | u32 insuff_cf_poll; | ||
423 | u32 fail_hw_drop; | ||
424 | u32 sta_color_mismatch; | ||
425 | u32 unknown; | ||
426 | }; | ||
427 | |||
428 | /* reply_agg_tx_statistics (for _agn devices) */ | ||
429 | struct reply_agg_tx_error_statistics { | ||
430 | u32 underrun; | ||
431 | u32 bt_prio; | ||
432 | u32 few_bytes; | ||
433 | u32 abort; | ||
434 | u32 last_sent_ttl; | ||
435 | u32 last_sent_try; | ||
436 | u32 last_sent_bt_kill; | ||
437 | u32 scd_query; | ||
438 | u32 bad_crc32; | ||
439 | u32 response; | ||
440 | u32 dump_tx; | ||
441 | u32 delay_tx; | ||
442 | u32 unknown; | ||
443 | }; | ||
444 | |||
445 | /* | ||
446 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | ||
447 | * to perform continuous uCode event logging operation if enabled | ||
448 | */ | ||
449 | #define UCODE_TRACE_PERIOD (10) | ||
450 | |||
451 | /* | ||
452 | * iwl_event_log: current uCode event log position | ||
453 | * | ||
454 | * @ucode_trace: enable/disable ucode continuous trace timer | ||
455 | * @num_wraps: how many times the event buffer wraps | ||
456 | * @next_entry: the entry just before the next one that uCode would fill | ||
457 | * @non_wraps_count: counter for no wrap detected when dump ucode events | ||
458 | * @wraps_once_count: counter for wrap once detected when dump ucode events | ||
459 | * @wraps_more_count: counter for wrap more than once detected | ||
460 | * when dump ucode events | ||
461 | */ | ||
462 | struct iwl_event_log { | ||
463 | bool ucode_trace; | ||
464 | u32 num_wraps; | ||
465 | u32 next_entry; | ||
466 | int non_wraps_count; | ||
467 | int wraps_once_count; | ||
468 | int wraps_more_count; | ||
469 | }; | ||
470 | |||
471 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) | ||
472 | |||
473 | /* BT Antenna Coupling Threshold (dB) */ | ||
474 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) | ||
475 | |||
476 | /* Firmware reload counter and Timestamp */ | ||
477 | #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */ | ||
478 | #define IWL_MAX_CONTINUE_RELOAD_CNT 4 | ||
479 | |||
480 | |||
481 | struct iwl_rf_reset { | ||
482 | int reset_request_count; | ||
483 | int reset_success_count; | ||
484 | int reset_reject_count; | ||
485 | unsigned long last_reset_jiffies; | ||
486 | }; | ||
487 | |||
488 | enum iwl_rxon_context_id { | ||
489 | IWL_RXON_CTX_BSS, | ||
490 | IWL_RXON_CTX_PAN, | ||
491 | |||
492 | NUM_IWL_RXON_CTX | ||
493 | }; | ||
494 | |||
495 | /* extend beacon time format bit shifting */ | ||
496 | /* | ||
497 | * for _agn devices | ||
498 | * bits 31:22 - extended | ||
499 | * bits 21:0 - interval | ||
500 | */ | ||
501 | #define IWLAGN_EXT_BEACON_TIME_POS 22 | ||
502 | |||
503 | struct iwl_rxon_context { | ||
504 | struct ieee80211_vif *vif; | ||
505 | |||
506 | u8 mcast_queue; | ||
507 | u8 ac_to_queue[IEEE80211_NUM_ACS]; | ||
508 | u8 ac_to_fifo[IEEE80211_NUM_ACS]; | ||
509 | |||
510 | /* | ||
511 | * We could use the vif to indicate active, but we | ||
512 | * also need it to be active during disabling when | ||
513 | * we already removed the vif for type setting. | ||
514 | */ | ||
515 | bool always_active, is_active; | ||
516 | |||
517 | bool ht_need_multiple_chains; | ||
518 | |||
519 | enum iwl_rxon_context_id ctxid; | ||
520 | |||
521 | u32 interface_modes, exclusive_interface_modes; | ||
522 | u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; | ||
523 | |||
524 | /* | ||
525 | * We declare this const so it can only be | ||
526 | * changed via explicit cast within the | ||
527 | * routines that actually update the physical | ||
528 | * hardware. | ||
529 | */ | ||
530 | const struct iwl_rxon_cmd active; | ||
531 | struct iwl_rxon_cmd staging; | ||
532 | |||
533 | struct iwl_rxon_time_cmd timing; | ||
534 | |||
535 | struct iwl_qos_info qos_data; | ||
536 | |||
537 | u8 bcast_sta_id, ap_sta_id; | ||
538 | |||
539 | u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd; | ||
540 | u8 qos_cmd; | ||
541 | u8 wep_key_cmd; | ||
542 | |||
543 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; | ||
544 | u8 key_mapping_keys; | ||
545 | |||
546 | __le32 station_flags; | ||
547 | |||
548 | int beacon_int; | ||
549 | |||
550 | struct { | ||
551 | bool non_gf_sta_present; | ||
552 | u8 protection; | ||
553 | bool enabled, is_40mhz; | ||
554 | u8 extension_chan_offset; | ||
555 | } ht; | ||
556 | }; | ||
557 | |||
558 | enum iwl_scan_type { | ||
559 | IWL_SCAN_NORMAL, | ||
560 | IWL_SCAN_RADIO_RESET, | ||
561 | IWL_SCAN_ROC, | ||
562 | }; | ||
563 | |||
564 | /** | ||
565 | * struct iwl_hw_params | ||
566 | * | ||
567 | * Holds the module parameters | ||
568 | * | ||
569 | * @tx_chains_num: Number of TX chains | ||
570 | * @rx_chains_num: Number of RX chains | ||
571 | * @sku: sku read from EEPROM | ||
572 | * @ct_kill_threshold: temperature threshold - in hw dependent unit | ||
573 | * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit | ||
574 | * relevant for 1000, 6000 and up | ||
575 | * @struct iwl_sensitivity_ranges: range of sensitivity values | ||
576 | * @use_rts_for_aggregation: use rts/cts protection for HT traffic | ||
577 | */ | ||
578 | struct iwl_hw_params { | ||
579 | u8 tx_chains_num; | ||
580 | u8 rx_chains_num; | ||
581 | bool use_rts_for_aggregation; | ||
582 | u16 sku; | ||
583 | u32 ct_kill_threshold; | ||
584 | u32 ct_kill_exit_threshold; | ||
585 | |||
586 | const struct iwl_sensitivity_ranges *sens; | ||
587 | }; | ||
588 | |||
589 | struct iwl_lib_ops { | ||
590 | /* set hw dependent parameters */ | ||
591 | void (*set_hw_params)(struct iwl_priv *priv); | ||
592 | int (*set_channel_switch)(struct iwl_priv *priv, | ||
593 | struct ieee80211_channel_switch *ch_switch); | ||
594 | /* device specific configuration */ | ||
595 | void (*nic_config)(struct iwl_priv *priv); | ||
596 | |||
597 | /* temperature */ | ||
598 | void (*temperature)(struct iwl_priv *priv); | ||
599 | }; | ||
600 | |||
601 | struct iwl_wipan_noa_data { | ||
602 | struct rcu_head rcu_head; | ||
603 | u32 length; | ||
604 | u8 data[]; | ||
605 | }; | ||
606 | |||
607 | /* Calibration disabling bit mask */ | ||
608 | enum { | ||
609 | IWL_CALIB_ENABLE_ALL = 0, | ||
610 | |||
611 | IWL_SENSITIVITY_CALIB_DISABLED = BIT(0), | ||
612 | IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1), | ||
613 | IWL_TX_POWER_CALIB_DISABLED = BIT(2), | ||
614 | |||
615 | IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF, | ||
616 | }; | ||
617 | |||
618 | #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \ | ||
619 | ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific)) | ||
620 | |||
621 | #define IWL_MAC80211_GET_DVM(_hw) \ | ||
622 | ((struct iwl_priv *) ((struct iwl_op_mode *) \ | ||
623 | (_hw)->priv)->op_mode_specific) | ||
624 | |||
625 | struct iwl_priv { | ||
626 | |||
627 | struct iwl_trans *trans; | ||
628 | struct device *dev; /* for debug prints only */ | ||
629 | const struct iwl_cfg *cfg; | ||
630 | const struct iwl_fw *fw; | ||
631 | const struct iwl_lib_ops *lib; | ||
632 | unsigned long status; | ||
633 | |||
634 | spinlock_t sta_lock; | ||
635 | struct mutex mutex; | ||
636 | |||
637 | unsigned long transport_queue_stop; | ||
638 | bool passive_no_rx; | ||
639 | #define IWL_INVALID_MAC80211_QUEUE 0xff | ||
640 | u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; | ||
641 | atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; | ||
642 | |||
643 | unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; | ||
644 | |||
645 | /* ieee device used by generic ieee processing code */ | ||
646 | struct ieee80211_hw *hw; | ||
647 | |||
648 | struct list_head calib_results; | ||
649 | |||
650 | struct workqueue_struct *workqueue; | ||
651 | |||
652 | struct iwl_hw_params hw_params; | ||
653 | |||
654 | enum ieee80211_band band; | ||
655 | u8 valid_contexts; | ||
656 | |||
657 | int (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, | ||
658 | struct iwl_rx_cmd_buffer *rxb, | ||
659 | struct iwl_device_cmd *cmd); | ||
660 | |||
661 | struct iwl_notif_wait_data notif_wait; | ||
662 | |||
663 | /* spectrum measurement report caching */ | ||
664 | struct iwl_spectrum_notification measure_report; | ||
665 | u8 measurement_status; | ||
666 | |||
667 | #define IWL_OWNERSHIP_DRIVER 0 | ||
668 | #define IWL_OWNERSHIP_TM 1 | ||
669 | u8 ucode_owner; | ||
670 | |||
671 | /* ucode beacon time */ | ||
672 | u32 ucode_beacon_time; | ||
673 | int missed_beacon_threshold; | ||
674 | |||
675 | /* track IBSS manager (last beacon) status */ | ||
676 | u32 ibss_manager; | ||
677 | |||
678 | /* jiffies when last recovery from statistics was performed */ | ||
679 | unsigned long rx_statistics_jiffies; | ||
680 | |||
681 | /*counters */ | ||
682 | u32 rx_handlers_stats[REPLY_MAX]; | ||
683 | |||
684 | /* rf reset */ | ||
685 | struct iwl_rf_reset rf_reset; | ||
686 | |||
687 | /* firmware reload counter and timestamp */ | ||
688 | unsigned long reload_jiffies; | ||
689 | int reload_count; | ||
690 | bool ucode_loaded; | ||
691 | bool init_ucode_run; /* Don't run init uCode again */ | ||
692 | |||
693 | u8 plcp_delta_threshold; | ||
694 | |||
695 | /* thermal calibration */ | ||
696 | s32 temperature; /* Celsius */ | ||
697 | s32 last_temperature; | ||
698 | |||
699 | struct iwl_wipan_noa_data __rcu *noa_data; | ||
700 | |||
701 | /* Scan related variables */ | ||
702 | unsigned long scan_start; | ||
703 | unsigned long scan_start_tsf; | ||
704 | void *scan_cmd; | ||
705 | enum ieee80211_band scan_band; | ||
706 | struct cfg80211_scan_request *scan_request; | ||
707 | struct ieee80211_vif *scan_vif; | ||
708 | enum iwl_scan_type scan_type; | ||
709 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; | ||
710 | u8 mgmt_tx_ant; | ||
711 | |||
712 | /* max number of station keys */ | ||
713 | u8 sta_key_max_num; | ||
714 | |||
715 | bool new_scan_threshold_behaviour; | ||
716 | |||
717 | bool wowlan; | ||
718 | |||
719 | /* EEPROM MAC addresses */ | ||
720 | struct mac_address addresses[2]; | ||
721 | |||
722 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | ||
723 | |||
724 | __le16 switch_channel; | ||
725 | |||
726 | u8 start_calib; | ||
727 | struct iwl_sensitivity_data sensitivity_data; | ||
728 | struct iwl_chain_noise_data chain_noise_data; | ||
729 | __le16 sensitivity_tbl[HD_TABLE_SIZE]; | ||
730 | __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES]; | ||
731 | |||
732 | struct iwl_ht_config current_ht_config; | ||
733 | |||
734 | /* Rate scaling data */ | ||
735 | u8 retry_rate; | ||
736 | |||
737 | int activity_timer_active; | ||
738 | |||
739 | struct iwl_power_mgr power_data; | ||
740 | struct iwl_tt_mgmt thermal_throttle; | ||
741 | |||
742 | /* station table variables */ | ||
743 | int num_stations; | ||
744 | struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; | ||
745 | unsigned long ucode_key_table; | ||
746 | struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; | ||
747 | atomic_t num_aux_in_flight; | ||
748 | |||
749 | u8 mac80211_registered; | ||
750 | |||
751 | /* Indication if ieee80211_ops->open has been called */ | ||
752 | u8 is_open; | ||
753 | |||
754 | enum nl80211_iftype iw_mode; | ||
755 | |||
756 | /* Last Rx'd beacon timestamp */ | ||
757 | u64 timestamp; | ||
758 | |||
759 | struct { | ||
760 | __le32 flag; | ||
761 | struct statistics_general_common common; | ||
762 | struct statistics_rx_non_phy rx_non_phy; | ||
763 | struct statistics_rx_phy rx_ofdm; | ||
764 | struct statistics_rx_ht_phy rx_ofdm_ht; | ||
765 | struct statistics_rx_phy rx_cck; | ||
766 | struct statistics_tx tx; | ||
767 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
768 | struct statistics_bt_activity bt_activity; | ||
769 | __le32 num_bt_kills, accum_num_bt_kills; | ||
770 | #endif | ||
771 | spinlock_t lock; | ||
772 | } statistics; | ||
773 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
774 | struct { | ||
775 | struct statistics_general_common common; | ||
776 | struct statistics_rx_non_phy rx_non_phy; | ||
777 | struct statistics_rx_phy rx_ofdm; | ||
778 | struct statistics_rx_ht_phy rx_ofdm_ht; | ||
779 | struct statistics_rx_phy rx_cck; | ||
780 | struct statistics_tx tx; | ||
781 | struct statistics_bt_activity bt_activity; | ||
782 | } accum_stats, delta_stats, max_delta_stats; | ||
783 | #endif | ||
784 | |||
785 | /* | ||
786 | * reporting the number of tids has AGG on. 0 means | ||
787 | * no AGGREGATION | ||
788 | */ | ||
789 | u8 agg_tids_count; | ||
790 | |||
791 | struct iwl_rx_phy_res last_phy_res; | ||
792 | bool last_phy_res_valid; | ||
793 | |||
794 | /* | ||
795 | * chain noise reset and gain commands are the | ||
796 | * two extra calibration commands follows the standard | ||
797 | * phy calibration commands | ||
798 | */ | ||
799 | u8 phy_calib_chain_noise_reset_cmd; | ||
800 | u8 phy_calib_chain_noise_gain_cmd; | ||
801 | |||
802 | /* counts reply_tx error */ | ||
803 | struct reply_tx_error_statistics reply_tx_stats; | ||
804 | struct reply_agg_tx_error_statistics reply_agg_tx_stats; | ||
805 | |||
806 | /* remain-on-channel offload support */ | ||
807 | struct ieee80211_channel *hw_roc_channel; | ||
808 | struct delayed_work hw_roc_disable_work; | ||
809 | enum nl80211_channel_type hw_roc_chantype; | ||
810 | int hw_roc_duration; | ||
811 | bool hw_roc_setup, hw_roc_start_notified; | ||
812 | |||
813 | /* bt coex */ | ||
814 | u8 bt_enable_flag; | ||
815 | u8 bt_status; | ||
816 | u8 bt_traffic_load, last_bt_traffic_load; | ||
817 | bool bt_ch_announce; | ||
818 | bool bt_full_concurrent; | ||
819 | bool bt_ant_couple_ok; | ||
820 | __le32 kill_ack_mask; | ||
821 | __le32 kill_cts_mask; | ||
822 | __le16 bt_valid; | ||
823 | bool reduced_txpower; | ||
824 | u16 bt_on_thresh; | ||
825 | u16 bt_duration; | ||
826 | u16 dynamic_frag_thresh; | ||
827 | u8 bt_ci_compliance; | ||
828 | struct work_struct bt_traffic_change_work; | ||
829 | bool bt_enable_pspoll; | ||
830 | struct iwl_rxon_context *cur_rssi_ctx; | ||
831 | bool bt_is_sco; | ||
832 | |||
833 | struct work_struct restart; | ||
834 | struct work_struct scan_completed; | ||
835 | struct work_struct abort_scan; | ||
836 | |||
837 | struct work_struct beacon_update; | ||
838 | struct iwl_rxon_context *beacon_ctx; | ||
839 | struct sk_buff *beacon_skb; | ||
840 | void *beacon_cmd; | ||
841 | |||
842 | struct work_struct tt_work; | ||
843 | struct work_struct ct_enter; | ||
844 | struct work_struct ct_exit; | ||
845 | struct work_struct start_internal_scan; | ||
846 | struct work_struct tx_flush; | ||
847 | struct work_struct bt_full_concurrency; | ||
848 | struct work_struct bt_runtime_config; | ||
849 | |||
850 | struct delayed_work scan_check; | ||
851 | |||
852 | /* TX Power settings */ | ||
853 | s8 tx_power_user_lmt; | ||
854 | s8 tx_power_next; | ||
855 | |||
856 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
857 | /* debugfs */ | ||
858 | struct dentry *debugfs_dir; | ||
859 | u32 dbgfs_sram_offset, dbgfs_sram_len; | ||
860 | bool disable_ht40; | ||
861 | void *wowlan_sram; | ||
862 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | ||
863 | |||
864 | struct iwl_eeprom_data *eeprom_data; | ||
865 | /* eeprom blob for debugfs/testmode */ | ||
866 | u8 *eeprom_blob; | ||
867 | size_t eeprom_blob_size; | ||
868 | |||
869 | struct work_struct txpower_work; | ||
870 | u32 calib_disabled; | ||
871 | struct work_struct run_time_calib_work; | ||
872 | struct timer_list statistics_periodic; | ||
873 | struct timer_list ucode_trace; | ||
874 | |||
875 | struct iwl_event_log event_log; | ||
876 | |||
877 | struct led_classdev led; | ||
878 | unsigned long blink_on, blink_off; | ||
879 | bool led_registered; | ||
880 | |||
881 | #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE | ||
882 | struct iwl_test tst; | ||
883 | u32 tm_fixed_rate; | ||
884 | #endif | ||
885 | |||
886 | /* WoWLAN GTK rekey data */ | ||
887 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; | ||
888 | __le64 replay_ctr; | ||
889 | __le16 last_seq_ctl; | ||
890 | bool have_rekey_data; | ||
891 | |||
892 | /* device_pointers: pointers to ucode event tables */ | ||
893 | struct { | ||
894 | u32 error_event_table; | ||
895 | u32 log_event_table; | ||
896 | } device_pointers; | ||
897 | |||
898 | /* indicator of loaded ucode image */ | ||
899 | enum iwl_ucode_type cur_ucode; | ||
900 | }; /*iwl_priv */ | ||
901 | |||
902 | static inline struct iwl_rxon_context * | ||
903 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) | ||
904 | { | ||
905 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
906 | |||
907 | return vif_priv->ctx; | ||
908 | } | ||
909 | |||
910 | #define for_each_context(priv, ctx) \ | ||
911 | for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ | ||
912 | ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ | ||
913 | if (priv->valid_contexts & BIT(ctx->ctxid)) | ||
914 | |||
915 | static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) | ||
916 | { | ||
917 | return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; | ||
918 | } | ||
919 | |||
920 | static inline int iwl_is_associated(struct iwl_priv *priv, | ||
921 | enum iwl_rxon_context_id ctxid) | ||
922 | { | ||
923 | return iwl_is_associated_ctx(&priv->contexts[ctxid]); | ||
924 | } | ||
925 | |||
926 | static inline int iwl_is_any_associated(struct iwl_priv *priv) | ||
927 | { | ||
928 | struct iwl_rxon_context *ctx; | ||
929 | for_each_context(priv, ctx) | ||
930 | if (iwl_is_associated_ctx(ctx)) | ||
931 | return true; | ||
932 | return false; | ||
933 | } | ||
934 | |||
935 | #endif /* __iwl_dev_h__ */ | ||