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