]>
Commit | Line | Data |
---|---|---|
b481de9c ZY |
1 | /****************************************************************************** |
2 | * | |
901069c7 | 3 | * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. |
b481de9c ZY |
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: | |
759ef89f | 22 | * Intel Linux Wireless <ilw@linux.intel.com> |
b481de9c ZY |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
24 | * | |
25 | *****************************************************************************/ | |
fcd427bb | 26 | /* |
3e0d4cb1 | 27 | * Please use this file (iwl-dev.h) for driver implementation definitions. |
5a36ba0e | 28 | * Please use iwl-commands.h for uCode API definitions. |
fcd427bb BC |
29 | */ |
30 | ||
be1f3ab6 EG |
31 | #ifndef __iwl_dev_h__ |
32 | #define __iwl_dev_h__ | |
b481de9c | 33 | |
a6b7a407 | 34 | #include <linux/interrupt.h> |
5d08cd1d | 35 | #include <linux/kernel.h> |
7194207c | 36 | #include <linux/wait.h> |
5ed540ae | 37 | #include <linux/leds.h> |
dfa2bdba | 38 | #include <linux/slab.h> |
5d08cd1d CH |
39 | #include <net/ieee80211_radiotap.h> |
40 | ||
6bc913bd | 41 | #include "iwl-eeprom.h" |
6f83eaa1 | 42 | #include "iwl-csr.h" |
5d08cd1d | 43 | #include "iwl-prph.h" |
0a6857e7 | 44 | #include "iwl-debug.h" |
b744cb79 | 45 | #include "iwl-agn-hw.h" |
ab53d8af | 46 | #include "iwl-led.h" |
5da4b55f | 47 | #include "iwl-power.h" |
e227ceac | 48 | #include "iwl-agn-rs.h" |
0975cc8f | 49 | #include "iwl-agn-tt.h" |
d5934110 | 50 | #include "iwl-bus.h" |
41c50542 | 51 | #include "iwl-trans.h" |
48f20d35 | 52 | #include "iwl-shared.h" |
5d08cd1d | 53 | |
672639de WYG |
54 | struct iwl_tx_queue; |
55 | ||
099b40b7 | 56 | /* CT-KILL constants */ |
672639de WYG |
57 | #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ |
58 | #define CT_KILL_THRESHOLD 114 /* in Celsius */ | |
59 | #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */ | |
4bf775cd | 60 | |
5d08cd1d CH |
61 | /* Default noise level to report when noise measurement is not available. |
62 | * This may be because we're: | |
63 | * 1) Not associated (4965, no beacon statistics being sent to driver) | |
64 | * 2) Scanning (noise measurement does not apply to associated channel) | |
65 | * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) | |
66 | * Use default noise value of -127 ... this is below the range of measurable | |
67 | * Rx dBm for either 3945 or 4965, 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 | ||
5d08cd1d CH |
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 | |
51b7ef05 | 87 | #define DEFAULT_BEACON_INTERVAL 200U |
5d08cd1d CH |
88 | #define DEFAULT_SHORT_RETRY_LIMIT 7U |
89 | #define DEFAULT_LONG_RETRY_LIMIT 4U | |
90 | ||
5d08cd1d CH |
91 | #define IWL_NUM_SCAN_RATES (2) |
92 | ||
5d08cd1d CH |
93 | /* |
94 | * One for each channel, holds all channel setup data | |
95 | * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant | |
96 | * with one another! | |
97 | */ | |
bf85ea4f | 98 | struct iwl_channel_info { |
073d3f5f | 99 | struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ |
7aafef1c WYG |
100 | struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for |
101 | * HT40 channel */ | |
5d08cd1d CH |
102 | |
103 | u8 channel; /* channel number */ | |
104 | u8 flags; /* flags copied from EEPROM */ | |
105 | s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ | |
fcd427bb | 106 | s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) limit */ |
5d08cd1d CH |
107 | s8 min_power; /* always 0 */ |
108 | s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ | |
109 | ||
110 | u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ | |
111 | u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ | |
8318d78a | 112 | enum ieee80211_band band; |
5d08cd1d | 113 | |
7aafef1c WYG |
114 | /* HT40 channel info */ |
115 | s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ | |
7aafef1c WYG |
116 | u8 ht40_flags; /* flags copied from EEPROM */ |
117 | u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */ | |
5d08cd1d CH |
118 | }; |
119 | ||
72c04ce0 JB |
120 | /* |
121 | * Minimum number of queues. MAX_NUM is defined in hw specific files. | |
122 | * Set the minimum to accommodate | |
123 | * - 4 standard TX queues | |
124 | * - the command queue | |
125 | * - 4 PAN TX queues | |
126 | * - the PAN multicast queue, and | |
127 | * - the AUX (TX during scan dwell) queue. | |
128 | */ | |
129 | #define IWL_MIN_NUM_QUEUES 11 | |
5d08cd1d | 130 | |
bd35f150 | 131 | /* |
13bb9483 | 132 | * Command queue depends on iPAN support. |
bd35f150 | 133 | */ |
13bb9483 JB |
134 | #define IWL_DEFAULT_CMD_QUEUE_NUM 4 |
135 | #define IWL_IPAN_CMD_QUEUE_NUM 9 | |
bd35f150 | 136 | |
5d08cd1d CH |
137 | #define IEEE80211_DATA_LEN 2304 |
138 | #define IEEE80211_4ADDR_LEN 30 | |
139 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | |
140 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | |
141 | ||
5d08cd1d CH |
142 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
143 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 | |
144 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 | |
145 | ||
5d08cd1d CH |
146 | #define IWL_SUPPORTED_RATES_IE_LEN 8 |
147 | ||
5d08cd1d CH |
148 | #define IWL_INVALID_RATE 0xFF |
149 | #define IWL_INVALID_VALUE -1 | |
150 | ||
a78fe754 | 151 | union iwl_ht_rate_supp { |
5d08cd1d CH |
152 | u16 rates; |
153 | struct { | |
154 | u8 siso_rate; | |
155 | u8 mimo_rate; | |
156 | }; | |
157 | }; | |
158 | ||
172c1d11 WYG |
159 | #define CFG_HT_RX_AMPDU_FACTOR_8K (0x0) |
160 | #define CFG_HT_RX_AMPDU_FACTOR_16K (0x1) | |
161 | #define CFG_HT_RX_AMPDU_FACTOR_32K (0x2) | |
162 | #define CFG_HT_RX_AMPDU_FACTOR_64K (0x3) | |
163 | #define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K | |
164 | #define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K | |
165 | #define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K | |
bcc693a1 WYG |
166 | |
167 | /* | |
168 | * Maximal MPDU density for TX aggregation | |
169 | * 4 - 2us density | |
170 | * 5 - 4us density | |
171 | * 6 - 8us density | |
172 | * 7 - 16us density | |
173 | */ | |
172c1d11 | 174 | #define CFG_HT_MPDU_DENSITY_2USEC (0x4) |
bcc693a1 | 175 | #define CFG_HT_MPDU_DENSITY_4USEC (0x5) |
172c1d11 WYG |
176 | #define CFG_HT_MPDU_DENSITY_8USEC (0x6) |
177 | #define CFG_HT_MPDU_DENSITY_16USEC (0x7) | |
bcc693a1 | 178 | #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC |
172c1d11 WYG |
179 | #define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC |
180 | #define CFG_HT_MPDU_DENSITY_MIN (0x1) | |
5d08cd1d | 181 | |
fad95bf5 | 182 | struct iwl_ht_config { |
02bb1bea | 183 | bool single_chain_sufficient; |
ba37a3d0 | 184 | enum ieee80211_smps_mode smps; /* current smps mode */ |
5d08cd1d | 185 | }; |
5d08cd1d | 186 | |
5d08cd1d | 187 | /* QoS structures */ |
1ff50bda | 188 | struct iwl_qos_info { |
5d08cd1d | 189 | int qos_active; |
1ff50bda | 190 | struct iwl_qosparam_cmd def_qos_parm; |
5d08cd1d | 191 | }; |
5d08cd1d | 192 | |
fe6b23dd RC |
193 | /* |
194 | * Structure should be accessed with sta_lock held. When station addition | |
195 | * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only | |
196 | * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock | |
197 | * held. | |
198 | */ | |
6def9761 | 199 | struct iwl_station_entry { |
133636de | 200 | struct iwl_addsta_cmd sta; |
dcef732c | 201 | u8 used, ctxid; |
fe6b23dd | 202 | struct iwl_link_quality_cmd *lq; |
5d08cd1d CH |
203 | }; |
204 | ||
8d9698b3 RC |
205 | /* |
206 | * iwl_station_priv: Driver's private station information | |
207 | * | |
208 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | |
209 | * in the structure for use by driver. This structure is places in that | |
210 | * space. | |
8d9698b3 RC |
211 | */ |
212 | struct iwl_station_priv { | |
c6892906 | 213 | struct iwl_rxon_context *ctx; |
8d9698b3 | 214 | struct iwl_lq_sta lq_sta; |
6ab10ff8 JB |
215 | atomic_t pending_frames; |
216 | bool client; | |
217 | bool asleep; | |
7b090687 | 218 | u8 max_agg_bufsize; |
c6892906 | 219 | u8 sta_id; |
8d9698b3 RC |
220 | }; |
221 | ||
fd1af15d JB |
222 | /** |
223 | * struct iwl_vif_priv - driver's private per-interface information | |
224 | * | |
225 | * When mac80211 allocates a virtual interface, it can allocate | |
226 | * space for us to put data into. | |
227 | */ | |
228 | struct iwl_vif_priv { | |
246ed355 | 229 | struct iwl_rxon_context *ctx; |
fd1af15d JB |
230 | u8 ibss_bssid_sta_id; |
231 | }; | |
232 | ||
dd7a2509 | 233 | /* v1/v2 uCode file layout */ |
cc0f555d JS |
234 | struct iwl_ucode_header { |
235 | __le32 ver; /* major/minor/API/serial */ | |
236 | union { | |
237 | struct { | |
238 | __le32 inst_size; /* bytes of runtime code */ | |
239 | __le32 data_size; /* bytes of runtime data */ | |
240 | __le32 init_size; /* bytes of init code */ | |
241 | __le32 init_data_size; /* bytes of init data */ | |
242 | __le32 boot_size; /* bytes of bootstrap code */ | |
243 | u8 data[0]; /* in same order as sizes */ | |
244 | } v1; | |
245 | struct { | |
246 | __le32 build; /* build number */ | |
247 | __le32 inst_size; /* bytes of runtime code */ | |
248 | __le32 data_size; /* bytes of runtime data */ | |
249 | __le32 init_size; /* bytes of init code */ | |
250 | __le32 init_data_size; /* bytes of init data */ | |
251 | __le32 boot_size; /* bytes of bootstrap code */ | |
252 | u8 data[0]; /* in same order as sizes */ | |
253 | } v2; | |
254 | } u; | |
5d08cd1d CH |
255 | }; |
256 | ||
dd7a2509 JB |
257 | /* |
258 | * new TLV uCode file layout | |
259 | * | |
260 | * The new TLV file format contains TLVs, that each specify | |
261 | * some piece of data. To facilitate "groups", for example | |
262 | * different instruction image with different capabilities, | |
263 | * bundled with the same init image, an alternative mechanism | |
264 | * is provided: | |
265 | * When the alternative field is 0, that means that the item | |
266 | * is always valid. When it is non-zero, then it is only | |
267 | * valid in conjunction with items of the same alternative, | |
268 | * in which case the driver (user) selects one alternative | |
269 | * to use. | |
270 | */ | |
271 | ||
272 | enum iwl_ucode_tlv_type { | |
273 | IWL_UCODE_TLV_INVALID = 0, /* unused */ | |
274 | IWL_UCODE_TLV_INST = 1, | |
275 | IWL_UCODE_TLV_DATA = 2, | |
276 | IWL_UCODE_TLV_INIT = 3, | |
277 | IWL_UCODE_TLV_INIT_DATA = 4, | |
278 | IWL_UCODE_TLV_BOOT = 5, | |
279 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ | |
ece9c4ee | 280 | IWL_UCODE_TLV_PAN = 7, |
b2e640d4 JB |
281 | IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, |
282 | IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, | |
283 | IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, | |
284 | IWL_UCODE_TLV_INIT_EVTLOG_PTR = 11, | |
285 | IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, | |
286 | IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, | |
c8312fac | 287 | IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, |
6a822d06 | 288 | IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, |
c8ac61cf JB |
289 | IWL_UCODE_TLV_WOWLAN_INST = 16, |
290 | IWL_UCODE_TLV_WOWLAN_DATA = 17, | |
3997ff39 JB |
291 | IWL_UCODE_TLV_FLAGS = 18, |
292 | }; | |
293 | ||
294 | /** | |
295 | * enum iwl_ucode_tlv_flag - ucode API flags | |
296 | * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously | |
297 | * was a separate TLV but moved here to save space. | |
d2690c0d JB |
298 | * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID, |
299 | * treats good CRC threshold as a boolean | |
3997ff39 | 300 | * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). |
c6baf7fb | 301 | * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. |
3997ff39 JB |
302 | */ |
303 | enum iwl_ucode_tlv_flag { | |
304 | IWL_UCODE_TLV_FLAGS_PAN = BIT(0), | |
d2690c0d | 305 | IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1), |
3997ff39 | 306 | IWL_UCODE_TLV_FLAGS_MFP = BIT(2), |
c6baf7fb | 307 | IWL_UCODE_TLV_FLAGS_P2P = BIT(3), |
dd7a2509 JB |
308 | }; |
309 | ||
310 | struct iwl_ucode_tlv { | |
311 | __le16 type; /* see above */ | |
312 | __le16 alternative; /* see comment */ | |
313 | __le32 length; /* not including type/length fields */ | |
314 | u8 data[0]; | |
ba2d3587 | 315 | } __packed; |
dd7a2509 JB |
316 | |
317 | #define IWL_TLV_UCODE_MAGIC 0x0a4c5749 | |
318 | ||
319 | struct iwl_tlv_ucode_header { | |
320 | /* | |
321 | * The TLV style ucode header is distinguished from | |
322 | * the v1/v2 style header by first four bytes being | |
323 | * zero, as such is an invalid combination of | |
324 | * major/minor/API/serial versions. | |
325 | */ | |
326 | __le32 zero; | |
327 | __le32 magic; | |
328 | u8 human_readable[64]; | |
329 | __le32 ver; /* major/minor/API/serial */ | |
330 | __le32 build; | |
331 | __le64 alternatives; /* bitmask of valid alternatives */ | |
332 | /* | |
333 | * The data contained herein has a TLV layout, | |
334 | * see above for the TLV header and types. | |
335 | * Note that each TLV is padded to a length | |
336 | * that is a multiple of 4 for alignment. | |
337 | */ | |
338 | u8 data[0]; | |
339 | }; | |
340 | ||
f0832f13 EG |
341 | struct iwl_sensitivity_ranges { |
342 | u16 min_nrg_cck; | |
343 | u16 max_nrg_cck; | |
344 | ||
345 | u16 nrg_th_cck; | |
346 | u16 nrg_th_ofdm; | |
347 | ||
348 | u16 auto_corr_min_ofdm; | |
349 | u16 auto_corr_min_ofdm_mrc; | |
350 | u16 auto_corr_min_ofdm_x1; | |
351 | u16 auto_corr_min_ofdm_mrc_x1; | |
352 | ||
353 | u16 auto_corr_max_ofdm; | |
354 | u16 auto_corr_max_ofdm_mrc; | |
355 | u16 auto_corr_max_ofdm_x1; | |
356 | u16 auto_corr_max_ofdm_mrc_x1; | |
357 | ||
358 | u16 auto_corr_max_cck; | |
359 | u16 auto_corr_max_cck_mrc; | |
360 | u16 auto_corr_min_cck; | |
361 | u16 auto_corr_min_cck_mrc; | |
55036d66 WYG |
362 | |
363 | u16 barker_corr_th_min; | |
364 | u16 barker_corr_th_min_mrc; | |
365 | u16 nrg_th_cca; | |
f0832f13 EG |
366 | }; |
367 | ||
099b40b7 | 368 | |
b5047f78 TW |
369 | #define KELVIN_TO_CELSIUS(x) ((x)-273) |
370 | #define CELSIUS_TO_KELVIN(x) ((x)+273) | |
371 | ||
372 | ||
5d08cd1d CH |
373 | /****************************************************************************** |
374 | * | |
a33c2f47 EG |
375 | * Functions implemented in core module which are forward declared here |
376 | * for use by iwl-[4-5].c | |
5d08cd1d | 377 | * |
a33c2f47 EG |
378 | * NOTE: The implementation of these functions are not hardware specific |
379 | * which is why they are in the core module files. | |
5d08cd1d CH |
380 | * |
381 | * Naming convention -- | |
a33c2f47 | 382 | * iwl_ <-- Is part of iwlwifi |
5d08cd1d | 383 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) |
5d08cd1d CH |
384 | * |
385 | ****************************************************************************/ | |
5b9f8cd3 | 386 | extern void iwl_update_chain_flags(struct iwl_priv *priv); |
a33c2f47 | 387 | extern const u8 iwl_bcast_addr[ETH_ALEN]; |
fd4abac5 | 388 | |
b481de9c ZY |
389 | #define IWL_OPERATION_MODE_AUTO 0 |
390 | #define IWL_OPERATION_MODE_HT_ONLY 1 | |
391 | #define IWL_OPERATION_MODE_MIXED 2 | |
392 | #define IWL_OPERATION_MODE_20MHZ 3 | |
393 | ||
b481de9c | 394 | #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 |
b481de9c | 395 | |
b481de9c | 396 | /* Sensitivity and chain noise calibration */ |
b481de9c | 397 | #define INITIALIZATION_VALUE 0xFFFF |
d8c07e7a | 398 | #define IWL_CAL_NUM_BEACONS 16 |
b481de9c ZY |
399 | #define MAXIMUM_ALLOWED_PATHLOSS 15 |
400 | ||
b481de9c ZY |
401 | #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 |
402 | ||
403 | #define MAX_FA_OFDM 50 | |
404 | #define MIN_FA_OFDM 5 | |
405 | #define MAX_FA_CCK 50 | |
406 | #define MIN_FA_CCK 5 | |
407 | ||
b481de9c ZY |
408 | #define AUTO_CORR_STEP_OFDM 1 |
409 | ||
b481de9c ZY |
410 | #define AUTO_CORR_STEP_CCK 3 |
411 | #define AUTO_CORR_MAX_TH_CCK 160 | |
412 | ||
b481de9c ZY |
413 | #define NRG_DIFF 2 |
414 | #define NRG_STEP_CCK 2 | |
415 | #define NRG_MARGIN 8 | |
416 | #define MAX_NUMBER_CCK_NO_FA 100 | |
417 | ||
418 | #define AUTO_CORR_CCK_MIN_VAL_DEF (125) | |
419 | ||
420 | #define CHAIN_A 0 | |
421 | #define CHAIN_B 1 | |
422 | #define CHAIN_C 2 | |
423 | #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4 | |
424 | #define ALL_BAND_FILTER 0xFF00 | |
425 | #define IN_BAND_FILTER 0xFF | |
426 | #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF | |
427 | ||
3195cdb7 TW |
428 | #define NRG_NUM_PREV_STAT_L 20 |
429 | #define NUM_RX_CHAINS 3 | |
430 | ||
3240cab3 | 431 | enum iwlagn_false_alarm_state { |
b481de9c ZY |
432 | IWL_FA_TOO_MANY = 0, |
433 | IWL_FA_TOO_FEW = 1, | |
434 | IWL_FA_GOOD_RANGE = 2, | |
435 | }; | |
436 | ||
3240cab3 | 437 | enum iwlagn_chain_noise_state { |
b481de9c | 438 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ |
04816448 GE |
439 | IWL_CHAIN_NOISE_ACCUMULATE, |
440 | IWL_CHAIN_NOISE_CALIBRATED, | |
441 | IWL_CHAIN_NOISE_DONE, | |
b481de9c ZY |
442 | }; |
443 | ||
f69f42a6 | 444 | |
6e21f2c1 TW |
445 | /* Opaque calibration results */ |
446 | struct iwl_calib_result { | |
80e83da7 JB |
447 | struct list_head list; |
448 | size_t cmd_len; | |
449 | struct iwl_calib_hdr hdr; | |
450 | /* data follows */ | |
7c616cba TW |
451 | }; |
452 | ||
b481de9c | 453 | /* Sensitivity calib data */ |
f0832f13 | 454 | struct iwl_sensitivity_data { |
b481de9c ZY |
455 | u32 auto_corr_ofdm; |
456 | u32 auto_corr_ofdm_mrc; | |
457 | u32 auto_corr_ofdm_x1; | |
458 | u32 auto_corr_ofdm_mrc_x1; | |
459 | u32 auto_corr_cck; | |
460 | u32 auto_corr_cck_mrc; | |
461 | ||
462 | u32 last_bad_plcp_cnt_ofdm; | |
463 | u32 last_fa_cnt_ofdm; | |
464 | u32 last_bad_plcp_cnt_cck; | |
465 | u32 last_fa_cnt_cck; | |
466 | ||
467 | u32 nrg_curr_state; | |
468 | u32 nrg_prev_state; | |
469 | u32 nrg_value[10]; | |
470 | u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L]; | |
471 | u32 nrg_silence_ref; | |
472 | u32 nrg_energy_idx; | |
473 | u32 nrg_silence_idx; | |
474 | u32 nrg_th_cck; | |
475 | s32 nrg_auto_corr_silence_diff; | |
476 | u32 num_in_cck_no_fa; | |
477 | u32 nrg_th_ofdm; | |
55036d66 WYG |
478 | |
479 | u16 barker_corr_th_min; | |
480 | u16 barker_corr_th_min_mrc; | |
481 | u16 nrg_th_cca; | |
b481de9c ZY |
482 | }; |
483 | ||
484 | /* Chain noise (differential Rx gain) calib data */ | |
f0832f13 | 485 | struct iwl_chain_noise_data { |
04816448 | 486 | u32 active_chains; |
b481de9c ZY |
487 | u32 chain_noise_a; |
488 | u32 chain_noise_b; | |
489 | u32 chain_noise_c; | |
490 | u32 chain_signal_a; | |
491 | u32 chain_signal_b; | |
492 | u32 chain_signal_c; | |
04816448 | 493 | u16 beacon_count; |
b481de9c ZY |
494 | u8 disconn_array[NUM_RX_CHAINS]; |
495 | u8 delta_gain_code[NUM_RX_CHAINS]; | |
496 | u8 radio_write; | |
04816448 | 497 | u8 state; |
b481de9c ZY |
498 | }; |
499 | ||
abceddb4 BC |
500 | #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ |
501 | #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ | |
b481de9c | 502 | |
5d08cd1d CH |
503 | enum { |
504 | MEASUREMENT_READY = (1 << 0), | |
505 | MEASUREMENT_ACTIVE = (1 << 1), | |
506 | }; | |
507 | ||
0848e297 WYG |
508 | enum iwl_nvm_type { |
509 | NVM_DEVICE_TYPE_EEPROM = 0, | |
510 | NVM_DEVICE_TYPE_OTP, | |
511 | }; | |
512 | ||
415e4993 WYG |
513 | /* |
514 | * Two types of OTP memory access modes | |
515 | * IWL_OTP_ACCESS_ABSOLUTE - absolute address mode, | |
516 | * based on physical memory addressing | |
517 | * IWL_OTP_ACCESS_RELATIVE - relative address mode, | |
518 | * based on logical memory addressing | |
519 | */ | |
520 | enum iwl_access_mode { | |
521 | IWL_OTP_ACCESS_ABSOLUTE, | |
522 | IWL_OTP_ACCESS_RELATIVE, | |
523 | }; | |
65b7998a WYG |
524 | |
525 | /** | |
526 | * enum iwl_pa_type - Power Amplifier type | |
527 | * @IWL_PA_SYSTEM: based on uCode configuration | |
65b7998a WYG |
528 | * @IWL_PA_INTERNAL: use Internal only |
529 | */ | |
530 | enum iwl_pa_type { | |
531 | IWL_PA_SYSTEM = 0, | |
740e7f51 | 532 | IWL_PA_INTERNAL = 1, |
65b7998a WYG |
533 | }; |
534 | ||
91835ba4 WYG |
535 | /* reply_tx_statistics (for _agn devices) */ |
536 | struct reply_tx_error_statistics { | |
537 | u32 pp_delay; | |
538 | u32 pp_few_bytes; | |
539 | u32 pp_bt_prio; | |
540 | u32 pp_quiet_period; | |
541 | u32 pp_calc_ttak; | |
542 | u32 int_crossed_retry; | |
543 | u32 short_limit; | |
544 | u32 long_limit; | |
545 | u32 fifo_underrun; | |
546 | u32 drain_flow; | |
547 | u32 rfkill_flush; | |
548 | u32 life_expire; | |
549 | u32 dest_ps; | |
550 | u32 host_abort; | |
551 | u32 bt_retry; | |
552 | u32 sta_invalid; | |
553 | u32 frag_drop; | |
554 | u32 tid_disable; | |
555 | u32 fifo_flush; | |
556 | u32 insuff_cf_poll; | |
557 | u32 fail_hw_drop; | |
558 | u32 sta_color_mismatch; | |
559 | u32 unknown; | |
560 | }; | |
561 | ||
814665fe WYG |
562 | /* reply_agg_tx_statistics (for _agn devices) */ |
563 | struct reply_agg_tx_error_statistics { | |
564 | u32 underrun; | |
565 | u32 bt_prio; | |
566 | u32 few_bytes; | |
567 | u32 abort; | |
568 | u32 last_sent_ttl; | |
569 | u32 last_sent_try; | |
570 | u32 last_sent_bt_kill; | |
571 | u32 scd_query; | |
572 | u32 bad_crc32; | |
573 | u32 response; | |
574 | u32 dump_tx; | |
575 | u32 delay_tx; | |
576 | u32 unknown; | |
577 | }; | |
578 | ||
22fdf3c9 WYG |
579 | /* management statistics */ |
580 | enum iwl_mgmt_stats { | |
581 | MANAGEMENT_ASSOC_REQ = 0, | |
582 | MANAGEMENT_ASSOC_RESP, | |
583 | MANAGEMENT_REASSOC_REQ, | |
584 | MANAGEMENT_REASSOC_RESP, | |
585 | MANAGEMENT_PROBE_REQ, | |
586 | MANAGEMENT_PROBE_RESP, | |
587 | MANAGEMENT_BEACON, | |
588 | MANAGEMENT_ATIM, | |
589 | MANAGEMENT_DISASSOC, | |
590 | MANAGEMENT_AUTH, | |
591 | MANAGEMENT_DEAUTH, | |
592 | MANAGEMENT_ACTION, | |
593 | MANAGEMENT_MAX, | |
594 | }; | |
595 | /* control statistics */ | |
596 | enum iwl_ctrl_stats { | |
597 | CONTROL_BACK_REQ = 0, | |
598 | CONTROL_BACK, | |
599 | CONTROL_PSPOLL, | |
600 | CONTROL_RTS, | |
601 | CONTROL_CTS, | |
602 | CONTROL_ACK, | |
603 | CONTROL_CFEND, | |
604 | CONTROL_CFENDACK, | |
605 | CONTROL_MAX, | |
606 | }; | |
607 | ||
608 | struct traffic_stats { | |
5ed540ae | 609 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
22fdf3c9 WYG |
610 | u32 mgmt[MANAGEMENT_MAX]; |
611 | u32 ctrl[CONTROL_MAX]; | |
612 | u32 data_cnt; | |
613 | u64 data_bytes; | |
22fdf3c9 | 614 | #endif |
5ed540ae | 615 | }; |
22fdf3c9 | 616 | |
a9e1cb6a WYG |
617 | /* |
618 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | |
619 | * to perform continuous uCode event logging operation if enabled | |
620 | */ | |
621 | #define UCODE_TRACE_PERIOD (100) | |
622 | ||
623 | /* | |
624 | * iwl_event_log: current uCode event log position | |
625 | * | |
626 | * @ucode_trace: enable/disable ucode continuous trace timer | |
627 | * @num_wraps: how many times the event buffer wraps | |
628 | * @next_entry: the entry just before the next one that uCode would fill | |
629 | * @non_wraps_count: counter for no wrap detected when dump ucode events | |
630 | * @wraps_once_count: counter for wrap once detected when dump ucode events | |
631 | * @wraps_more_count: counter for wrap more than once detected | |
632 | * when dump ucode events | |
633 | */ | |
634 | struct iwl_event_log { | |
635 | bool ucode_trace; | |
636 | u32 num_wraps; | |
637 | u32 next_entry; | |
638 | int non_wraps_count; | |
639 | int wraps_once_count; | |
640 | int wraps_more_count; | |
641 | }; | |
642 | ||
3e4fb5fa TAN |
643 | /* |
644 | * This is the threshold value of plcp error rate per 100mSecs. It is | |
645 | * used to set and check for the validity of plcp_delta. | |
646 | */ | |
680788ac | 647 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (1) |
3e4fb5fa TAN |
648 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50) |
649 | #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100) | |
6c3872e1 | 650 | #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200) |
3e4fb5fa | 651 | #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255) |
680788ac | 652 | #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE (0) |
3e4fb5fa | 653 | |
8a472da4 WYG |
654 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) |
655 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) | |
656 | ||
22de94de SG |
657 | /* TX queue watchdog timeouts in mSecs */ |
658 | #define IWL_DEF_WD_TIMEOUT (2000) | |
659 | #define IWL_LONG_WD_TIMEOUT (10000) | |
660 | #define IWL_MAX_WD_TIMEOUT (120000) | |
b74e31a9 | 661 | |
bee008b7 WYG |
662 | /* BT Antenna Coupling Threshold (dB) */ |
663 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) | |
664 | ||
491bc292 WYG |
665 | /* Firmware reload counter and Timestamp */ |
666 | #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */ | |
667 | #define IWL_MAX_CONTINUE_RELOAD_CNT 4 | |
668 | ||
669 | ||
a93e7973 WYG |
670 | enum iwl_reset { |
671 | IWL_RF_RESET = 0, | |
672 | IWL_FW_RESET, | |
8a472da4 WYG |
673 | IWL_MAX_FORCE_RESET, |
674 | }; | |
675 | ||
676 | struct iwl_force_reset { | |
677 | int reset_request_count; | |
678 | int reset_success_count; | |
679 | int reset_reject_count; | |
680 | unsigned long reset_duration; | |
681 | unsigned long last_force_reset_jiffies; | |
a93e7973 WYG |
682 | }; |
683 | ||
a0ee74cf | 684 | /* extend beacon time format bit shifting */ |
a0ee74cf WYG |
685 | /* |
686 | * for _agn devices | |
687 | * bits 31:22 - extended | |
688 | * bits 21:0 - interval | |
689 | */ | |
690 | #define IWLAGN_EXT_BEACON_TIME_POS 22 | |
691 | ||
7194207c JB |
692 | /** |
693 | * struct iwl_notification_wait - notification wait entry | |
694 | * @list: list head for global list | |
695 | * @fn: function called with the notification | |
696 | * @cmd: command ID | |
697 | * | |
698 | * This structure is not used directly, to wait for a | |
699 | * notification declare it on the stack, and call | |
700 | * iwlagn_init_notification_wait() with appropriate | |
701 | * parameters. Then do whatever will cause the ucode | |
702 | * to notify the driver, and to wait for that then | |
703 | * call iwlagn_wait_notification(). | |
704 | * | |
705 | * Each notification is one-shot. If at some point we | |
706 | * need to support multi-shot notifications (which | |
707 | * can't be allocated on the stack) we need to modify | |
708 | * the code for them. | |
709 | */ | |
710 | struct iwl_notification_wait { | |
711 | struct list_head list; | |
712 | ||
09f18afe JB |
713 | void (*fn)(struct iwl_priv *priv, struct iwl_rx_packet *pkt, |
714 | void *data); | |
715 | void *fn_data; | |
7194207c JB |
716 | |
717 | u8 cmd; | |
e74fe233 | 718 | bool triggered, aborted; |
7194207c JB |
719 | }; |
720 | ||
246ed355 | 721 | struct iwl_rxon_context { |
8bd413e6 | 722 | struct ieee80211_vif *vif; |
e72f368b | 723 | |
763cc3bf JB |
724 | /* |
725 | * We could use the vif to indicate active, but we | |
726 | * also need it to be active during disabling when | |
727 | * we already removed the vif for type setting. | |
728 | */ | |
729 | bool always_active, is_active; | |
730 | ||
2295c66b JB |
731 | bool ht_need_multiple_chains; |
732 | ||
246ed355 | 733 | enum iwl_rxon_context_id ctxid; |
d0fe478c JB |
734 | |
735 | u32 interface_modes, exclusive_interface_modes; | |
736 | u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; | |
737 | ||
246ed355 JB |
738 | /* |
739 | * We declare this const so it can only be | |
740 | * changed via explicit cast within the | |
741 | * routines that actually update the physical | |
742 | * hardware. | |
743 | */ | |
744 | const struct iwl_rxon_cmd active; | |
745 | struct iwl_rxon_cmd staging; | |
746 | ||
747 | struct iwl_rxon_time_cmd timing; | |
a194e324 | 748 | |
8dfdb9d5 JB |
749 | struct iwl_qos_info qos_data; |
750 | ||
2995bafa | 751 | u8 bcast_sta_id, ap_sta_id; |
8f2d3d2a JB |
752 | |
753 | u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd; | |
8dfdb9d5 | 754 | u8 qos_cmd; |
c10afb6e JB |
755 | u8 wep_key_cmd; |
756 | ||
757 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; | |
758 | u8 key_mapping_keys; | |
770e13bd JB |
759 | |
760 | __le32 station_flags; | |
7e6a5886 | 761 | |
bbb05cb5 JB |
762 | int beacon_int; |
763 | ||
7e6a5886 JB |
764 | struct { |
765 | bool non_gf_sta_present; | |
766 | u8 protection; | |
767 | bool enabled, is_40mhz; | |
768 | u8 extension_chan_offset; | |
769 | } ht; | |
68b99311 | 770 | |
debcf734 JB |
771 | u8 bssid[ETH_ALEN]; |
772 | bool preauth_bssid; | |
773 | ||
68b99311 | 774 | bool last_tx_rejected; |
246ed355 JB |
775 | }; |
776 | ||
266af4c7 JB |
777 | enum iwl_scan_type { |
778 | IWL_SCAN_NORMAL, | |
779 | IWL_SCAN_RADIO_RESET, | |
c6baf7fb | 780 | IWL_SCAN_ROC, |
266af4c7 JB |
781 | }; |
782 | ||
7a4e5281 WYG |
783 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL |
784 | struct iwl_testmode_trace { | |
49b72100 WYG |
785 | u32 buff_size; |
786 | u32 total_size; | |
eb64dca0 | 787 | u32 num_chunks; |
7a4e5281 WYG |
788 | u8 *cpu_addr; |
789 | u8 *trace_addr; | |
790 | dma_addr_t dma_addr; | |
791 | bool trace_enabled; | |
792 | }; | |
158969a2 HK |
793 | struct iwl_testmode_sram { |
794 | u32 buff_size; | |
795 | u32 num_chunks; | |
796 | u8 *buff_addr; | |
797 | bool sram_readed; | |
798 | }; | |
7a4e5281 | 799 | #endif |
a48709c5 | 800 | |
79d3eef8 JB |
801 | struct iwl_wipan_noa_data { |
802 | struct rcu_head rcu_head; | |
803 | u32 length; | |
804 | u8 data[]; | |
805 | }; | |
806 | ||
c79dd5b5 | 807 | struct iwl_priv { |
5d08cd1d | 808 | |
cac988a6 EG |
809 | /*data shared among all the driver's layers */ |
810 | struct iwl_shared _shrd; | |
811 | struct iwl_shared *shrd; | |
812 | ||
5d08cd1d CH |
813 | /* ieee device used by generic ieee processing code */ |
814 | struct ieee80211_hw *hw; | |
815 | struct ieee80211_channel *ieee_channels; | |
816 | struct ieee80211_rate *ieee_rates; | |
dfa2bdba | 817 | struct kmem_cache *tx_cmd_pool; |
82b9a121 | 818 | struct iwl_cfg *cfg; |
5d08cd1d | 819 | |
8318d78a | 820 | enum ieee80211_band band; |
5d08cd1d | 821 | |
4613e72d CK |
822 | void (*pre_rx_handler)(struct iwl_priv *priv, |
823 | struct iwl_rx_mem_buffer *rxb); | |
247c61d6 EG |
824 | int (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, |
825 | struct iwl_rx_mem_buffer *rxb, | |
826 | struct iwl_device_cmd *cmd); | |
5d08cd1d | 827 | |
8318d78a | 828 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
5d08cd1d | 829 | |
5d08cd1d | 830 | /* spectrum measurement report caching */ |
2aa6ab86 | 831 | struct iwl_spectrum_notification measure_report; |
5d08cd1d | 832 | u8 measurement_status; |
81963d68 | 833 | |
5d08cd1d CH |
834 | /* ucode beacon time */ |
835 | u32 ucode_beacon_time; | |
a13d276f | 836 | int missed_beacon_threshold; |
5d08cd1d | 837 | |
a85d7cca JB |
838 | /* track IBSS manager (last beacon) status */ |
839 | u32 ibss_manager; | |
840 | ||
410f2bb3 SG |
841 | /* jiffies when last recovery from statistics was performed */ |
842 | unsigned long rx_statistics_jiffies; | |
3e4fb5fa | 843 | |
1f7b6172 EG |
844 | /*counters */ |
845 | u32 rx_handlers_stats[REPLY_MAX]; | |
846 | ||
a93e7973 | 847 | /* force reset */ |
8a472da4 | 848 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; |
a93e7973 | 849 | |
491bc292 WYG |
850 | /* firmware reload counter and timestamp */ |
851 | unsigned long reload_jiffies; | |
852 | int reload_count; | |
853 | ||
5a2a780c | 854 | /* we allocate array of iwl_channel_info for NIC's valid channels. |
5d08cd1d | 855 | * Access via channel # using indirect index array */ |
bf85ea4f | 856 | struct iwl_channel_info *channel_info; /* channel info array */ |
5d08cd1d CH |
857 | u8 channel_count; /* # of channels */ |
858 | ||
5d08cd1d | 859 | /* thermal calibration */ |
02883562 | 860 | s32 temperature; /* Celsius */ |
5d08cd1d CH |
861 | s32 last_temperature; |
862 | ||
7c616cba | 863 | /* init calibration results */ |
80e83da7 | 864 | struct list_head calib_results; |
7c616cba | 865 | |
79d3eef8 JB |
866 | struct iwl_wipan_noa_data __rcu *noa_data; |
867 | ||
5d08cd1d | 868 | /* Scan related variables */ |
5d08cd1d | 869 | unsigned long scan_start; |
5d08cd1d | 870 | unsigned long scan_start_tsf; |
811ecc99 | 871 | void *scan_cmd; |
00700ee0 | 872 | enum ieee80211_band scan_band; |
1ecf9fc1 | 873 | struct cfg80211_scan_request *scan_request; |
f84b29ec | 874 | struct ieee80211_vif *scan_vif; |
266af4c7 | 875 | enum iwl_scan_type scan_type; |
76eff18b TW |
876 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; |
877 | u8 mgmt_tx_ant; | |
5d08cd1d | 878 | |
c10afb6e JB |
879 | /* max number of station keys */ |
880 | u8 sta_key_max_num; | |
881 | ||
d2690c0d JB |
882 | bool new_scan_threshold_behaviour; |
883 | ||
c6fa17ed WYG |
884 | /* EEPROM MAC addresses */ |
885 | struct mac_address addresses[2]; | |
886 | ||
5d08cd1d | 887 | /* uCode images, save to reload in case of failure */ |
b08dfd04 | 888 | int fw_index; /* firmware we're trying to load */ |
c02b3acd CR |
889 | u32 ucode_ver; /* version of ucode, copy of |
890 | iwl_ucode.ver */ | |
e98a1939 | 891 | |
de7f5f92 | 892 | enum iwl_ucode_type ucode_type; |
b08dfd04 | 893 | char firmware_name[25]; |
5d08cd1d | 894 | |
246ed355 | 895 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; |
5d08cd1d | 896 | |
6f213ff1 | 897 | __le16 switch_channel; |
0924e519 | 898 | |
d7d5783c JB |
899 | struct { |
900 | u32 error_event_table; | |
901 | u32 log_event_table; | |
902 | } device_pointers; | |
5d08cd1d | 903 | |
5d08cd1d | 904 | u16 active_rate; |
5d08cd1d | 905 | |
5d08cd1d | 906 | u8 start_calib; |
f0832f13 EG |
907 | struct iwl_sensitivity_data sensitivity_data; |
908 | struct iwl_chain_noise_data chain_noise_data; | |
c8312fac | 909 | bool enhance_sensitivity_table; |
5d08cd1d | 910 | __le16 sensitivity_tbl[HD_TABLE_SIZE]; |
c8312fac | 911 | __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES]; |
5d08cd1d | 912 | |
fad95bf5 | 913 | struct iwl_ht_config current_ht_config; |
5d08cd1d | 914 | |
5d08cd1d | 915 | /* Rate scaling data */ |
5d08cd1d CH |
916 | u8 retry_rate; |
917 | ||
5d08cd1d CH |
918 | int activity_timer_active; |
919 | ||
19758bef | 920 | /* counts mgmt, ctl, and data packets */ |
22fdf3c9 WYG |
921 | struct traffic_stats tx_stats; |
922 | struct traffic_stats rx_stats; | |
19758bef | 923 | |
5da4b55f | 924 | struct iwl_power_mgr power_data; |
3ad3b92a | 925 | struct iwl_tt_mgmt thermal_throttle; |
5d08cd1d | 926 | |
9c5ac091 | 927 | /* station table variables */ |
5d08cd1d | 928 | int num_stations; |
3240cab3 | 929 | struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; |
80fb47a1 | 930 | unsigned long ucode_key_table; |
5d08cd1d | 931 | |
859cfb0a EG |
932 | u8 mac80211_registered; |
933 | ||
5d08cd1d | 934 | /* Indication if ieee80211_ops->open has been called */ |
69dc5d9d | 935 | u8 is_open; |
5d08cd1d | 936 | |
af6b8ee3 | 937 | /* eeprom -- this is in the card's little endian byte order */ |
073d3f5f TW |
938 | u8 *eeprom; |
939 | struct iwl_eeprom_calib_info *calib_info; | |
5d08cd1d | 940 | |
05c914fe | 941 | enum nl80211_iftype iw_mode; |
5d08cd1d | 942 | |
5d08cd1d | 943 | /* Last Rx'd beacon timestamp */ |
3109ece1 | 944 | u64 timestamp; |
5d08cd1d | 945 | |
0da0e5bf JB |
946 | struct { |
947 | __le32 flag; | |
948 | struct statistics_general_common common; | |
949 | struct statistics_rx_non_phy rx_non_phy; | |
950 | struct statistics_rx_phy rx_ofdm; | |
951 | struct statistics_rx_ht_phy rx_ofdm_ht; | |
952 | struct statistics_rx_phy rx_cck; | |
953 | struct statistics_tx tx; | |
954 | #ifdef CONFIG_IWLWIFI_DEBUGFS | |
955 | struct statistics_bt_activity bt_activity; | |
956 | __le32 num_bt_kills, accum_num_bt_kills; | |
957 | #endif | |
958 | } statistics; | |
959 | #ifdef CONFIG_IWLWIFI_DEBUGFS | |
960 | struct { | |
961 | struct statistics_general_common common; | |
962 | struct statistics_rx_non_phy rx_non_phy; | |
963 | struct statistics_rx_phy rx_ofdm; | |
964 | struct statistics_rx_ht_phy rx_ofdm_ht; | |
965 | struct statistics_rx_phy rx_cck; | |
966 | struct statistics_tx tx; | |
967 | struct statistics_bt_activity bt_activity; | |
968 | } accum_stats, delta_stats, max_delta_stats; | |
969 | #endif | |
970 | ||
898ed67b WYG |
971 | /* |
972 | * reporting the number of tids has AGG on. 0 means | |
973 | * no AGGREGATION | |
974 | */ | |
975 | u8 agg_tids_count; | |
976 | ||
977 | struct iwl_rx_phy_res last_phy_res; | |
978 | bool last_phy_res_valid; | |
979 | ||
980 | struct completion firmware_loading_complete; | |
981 | ||
982 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; | |
983 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; | |
984 | ||
985 | /* | |
986 | * chain noise reset and gain commands are the | |
987 | * two extra calibration commands follows the standard | |
988 | * phy calibration commands | |
989 | */ | |
990 | u8 phy_calib_chain_noise_reset_cmd; | |
991 | u8 phy_calib_chain_noise_gain_cmd; | |
992 | ||
993 | /* counts reply_tx error */ | |
994 | struct reply_tx_error_statistics reply_tx_stats; | |
995 | struct reply_agg_tx_error_statistics reply_agg_tx_stats; | |
996 | /* notification wait support */ | |
997 | struct list_head notif_waits; | |
998 | spinlock_t notif_wait_lock; | |
999 | wait_queue_head_t notif_waitq; | |
1000 | ||
1001 | /* remain-on-channel offload support */ | |
1002 | struct ieee80211_channel *hw_roc_channel; | |
c6baf7fb | 1003 | struct delayed_work hw_roc_disable_work; |
898ed67b WYG |
1004 | enum nl80211_channel_type hw_roc_chantype; |
1005 | int hw_roc_duration; | |
390808db | 1006 | bool hw_roc_setup, hw_roc_start_notified; |
898ed67b | 1007 | |
22bf59a0 | 1008 | /* bt coex */ |
f21dd005 | 1009 | u8 bt_enable_flag; |
da5dbb97 | 1010 | u8 bt_status; |
66e863a5 | 1011 | u8 bt_traffic_load, last_bt_traffic_load; |
f37837c9 | 1012 | bool bt_ch_announce; |
bee008b7 WYG |
1013 | bool bt_full_concurrent; |
1014 | bool bt_ant_couple_ok; | |
fbba9410 WYG |
1015 | __le32 kill_ack_mask; |
1016 | __le32 kill_cts_mask; | |
1017 | __le16 bt_valid; | |
22bf59a0 WYG |
1018 | u16 bt_on_thresh; |
1019 | u16 bt_duration; | |
1020 | u16 dynamic_frag_thresh; | |
bee008b7 | 1021 | u8 bt_ci_compliance; |
9e4afc21 | 1022 | struct work_struct bt_traffic_change_work; |
207ecc5e MV |
1023 | bool bt_enable_pspoll; |
1024 | struct iwl_rxon_context *cur_rssi_ctx; | |
1025 | bool bt_is_sco; | |
9e4afc21 | 1026 | |
5d08cd1d | 1027 | struct work_struct restart; |
5d08cd1d | 1028 | struct work_struct scan_completed; |
5d08cd1d | 1029 | struct work_struct abort_scan; |
12e934dc | 1030 | |
5d08cd1d | 1031 | struct work_struct beacon_update; |
76d04815 | 1032 | struct iwl_rxon_context *beacon_ctx; |
12e934dc | 1033 | struct sk_buff *beacon_skb; |
4ce7cc2b | 1034 | void *beacon_cmd; |
76d04815 | 1035 | |
a28027cd WYG |
1036 | struct work_struct tt_work; |
1037 | struct work_struct ct_enter; | |
1038 | struct work_struct ct_exit; | |
88be0264 | 1039 | struct work_struct start_internal_scan; |
65550636 | 1040 | struct work_struct tx_flush; |
bee008b7 | 1041 | struct work_struct bt_full_concurrency; |
fbba9410 | 1042 | struct work_struct bt_runtime_config; |
5d08cd1d | 1043 | |
5d08cd1d | 1044 | struct delayed_work scan_check; |
4a8a4322 | 1045 | |
630fe9b6 TW |
1046 | /* TX Power */ |
1047 | s8 tx_power_user_lmt; | |
dc1b0973 | 1048 | s8 tx_power_device_lmt; |
ae16fc3c | 1049 | s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */ |
a25a66ac | 1050 | s8 tx_power_next; |
5d08cd1d | 1051 | |
712b6cf5 TW |
1052 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1053 | /* debugfs */ | |
20594eb0 WYG |
1054 | u16 tx_traffic_idx; |
1055 | u16 rx_traffic_idx; | |
1056 | u8 *tx_traffic; | |
1057 | u8 *rx_traffic; | |
4c84a8f1 JB |
1058 | struct dentry *debugfs_dir; |
1059 | u32 dbgfs_sram_offset, dbgfs_sram_len; | |
d73e4923 | 1060 | bool disable_ht40; |
c8ac61cf | 1061 | void *wowlan_sram; |
712b6cf5 | 1062 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
5d08cd1d CH |
1063 | |
1064 | struct work_struct txpower_work; | |
445c2dff TW |
1065 | u32 disable_sens_cal; |
1066 | u32 disable_chain_noise_cal; | |
16e727e8 | 1067 | struct work_struct run_time_calib_work; |
5d08cd1d | 1068 | struct timer_list statistics_periodic; |
a9e1cb6a | 1069 | struct timer_list ucode_trace; |
22de94de | 1070 | struct timer_list watchdog; |
a9e1cb6a WYG |
1071 | |
1072 | struct iwl_event_log event_log; | |
5ed540ae WYG |
1073 | |
1074 | struct led_classdev led; | |
1075 | unsigned long blink_on, blink_off; | |
1076 | bool led_registered; | |
7a4e5281 WYG |
1077 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL |
1078 | struct iwl_testmode_trace testmode_trace; | |
158969a2 | 1079 | struct iwl_testmode_sram testmode_sram; |
4e308119 | 1080 | u32 tm_fixed_rate; |
c10e2c10 | 1081 | #endif |
6489854b | 1082 | |
c8ac61cf JB |
1083 | /* WoWLAN GTK rekey data */ |
1084 | u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; | |
1085 | __le64 replay_ctr; | |
1086 | __le16 last_seq_ctl; | |
1087 | bool have_rekey_data; | |
c79dd5b5 | 1088 | }; /*iwl_priv */ |
5d08cd1d | 1089 | |
48f20d35 EG |
1090 | extern struct iwl_mod_params iwlagn_mod_params; |
1091 | ||
246ed355 JB |
1092 | static inline struct iwl_rxon_context * |
1093 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) | |
1094 | { | |
1095 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | |
1096 | ||
1097 | return vif_priv->ctx; | |
1098 | } | |
1099 | ||
1100 | #define for_each_context(priv, ctx) \ | |
1101 | for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ | |
1102 | ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ | |
7a10e3e4 | 1103 | if (priv->shrd->valid_contexts & BIT(ctx->ctxid)) |
246ed355 | 1104 | |
054ec924 | 1105 | static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) |
246ed355 | 1106 | { |
054ec924 | 1107 | return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; |
246ed355 JB |
1108 | } |
1109 | ||
054ec924 JB |
1110 | static inline int iwl_is_associated(struct iwl_priv *priv, |
1111 | enum iwl_rxon_context_id ctxid) | |
246ed355 | 1112 | { |
054ec924 | 1113 | return iwl_is_associated_ctx(&priv->contexts[ctxid]); |
246ed355 | 1114 | } |
a332f8d6 | 1115 | |
054ec924 | 1116 | static inline int iwl_is_any_associated(struct iwl_priv *priv) |
5d08cd1d | 1117 | { |
054ec924 JB |
1118 | struct iwl_rxon_context *ctx; |
1119 | for_each_context(priv, ctx) | |
1120 | if (iwl_is_associated_ctx(ctx)) | |
1121 | return true; | |
1122 | return false; | |
5d08cd1d CH |
1123 | } |
1124 | ||
bf85ea4f | 1125 | static inline int is_channel_valid(const struct iwl_channel_info *ch_info) |
5d08cd1d CH |
1126 | { |
1127 | if (ch_info == NULL) | |
1128 | return 0; | |
1129 | return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; | |
1130 | } | |
1131 | ||
bf85ea4f | 1132 | static inline int is_channel_radar(const struct iwl_channel_info *ch_info) |
5d08cd1d CH |
1133 | { |
1134 | return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; | |
1135 | } | |
1136 | ||
bf85ea4f | 1137 | static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info) |
5d08cd1d | 1138 | { |
8318d78a | 1139 | return ch_info->band == IEEE80211_BAND_5GHZ; |
5d08cd1d CH |
1140 | } |
1141 | ||
bf85ea4f | 1142 | static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info) |
5d08cd1d | 1143 | { |
8318d78a | 1144 | return ch_info->band == IEEE80211_BAND_2GHZ; |
5d08cd1d CH |
1145 | } |
1146 | ||
bf85ea4f | 1147 | static inline int is_channel_passive(const struct iwl_channel_info *ch) |
5d08cd1d CH |
1148 | { |
1149 | return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; | |
1150 | } | |
1151 | ||
bf85ea4f | 1152 | static inline int is_channel_ibss(const struct iwl_channel_info *ch) |
5d08cd1d CH |
1153 | { |
1154 | return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; | |
1155 | } | |
1156 | ||
be1f3ab6 | 1157 | #endif /* __iwl_dev_h__ */ |