diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-dev.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 730 |
1 files changed, 429 insertions, 301 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 2e97cd2fa98a..c8de236c141b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 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 | 6 | * under the terms of version 2 of the GNU General Public License as |
@@ -26,7 +26,6 @@ | |||
26 | /* | 26 | /* |
27 | * Please use this file (iwl-dev.h) for driver implementation definitions. | 27 | * Please use this file (iwl-dev.h) for driver implementation definitions. |
28 | * Please use iwl-commands.h for uCode API definitions. | 28 | * Please use iwl-commands.h for uCode API definitions. |
29 | * Please use iwl-4965-hw.h for hardware-related definitions. | ||
30 | */ | 29 | */ |
31 | 30 | ||
32 | #ifndef __iwl_dev_h__ | 31 | #ifndef __iwl_dev_h__ |
@@ -34,6 +33,8 @@ | |||
34 | 33 | ||
35 | #include <linux/pci.h> /* for struct pci_device_id */ | 34 | #include <linux/pci.h> /* for struct pci_device_id */ |
36 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
36 | #include <linux/wait.h> | ||
37 | #include <linux/leds.h> | ||
37 | #include <net/ieee80211_radiotap.h> | 38 | #include <net/ieee80211_radiotap.h> |
38 | 39 | ||
39 | #include "iwl-eeprom.h" | 40 | #include "iwl-eeprom.h" |
@@ -41,12 +42,11 @@ | |||
41 | #include "iwl-prph.h" | 42 | #include "iwl-prph.h" |
42 | #include "iwl-fh.h" | 43 | #include "iwl-fh.h" |
43 | #include "iwl-debug.h" | 44 | #include "iwl-debug.h" |
44 | #include "iwl-4965-hw.h" | ||
45 | #include "iwl-3945-hw.h" | ||
46 | #include "iwl-agn-hw.h" | 45 | #include "iwl-agn-hw.h" |
47 | #include "iwl-led.h" | 46 | #include "iwl-led.h" |
48 | #include "iwl-power.h" | 47 | #include "iwl-power.h" |
49 | #include "iwl-agn-rs.h" | 48 | #include "iwl-agn-rs.h" |
49 | #include "iwl-agn-tt.h" | ||
50 | 50 | ||
51 | struct iwl_tx_queue; | 51 | struct iwl_tx_queue; |
52 | 52 | ||
@@ -81,7 +81,7 @@ struct iwl_tx_queue; | |||
81 | #define MAX_RTS_THRESHOLD 2347U | 81 | #define MAX_RTS_THRESHOLD 2347U |
82 | #define MAX_MSDU_SIZE 2304U | 82 | #define MAX_MSDU_SIZE 2304U |
83 | #define MAX_MPDU_SIZE 2346U | 83 | #define MAX_MPDU_SIZE 2346U |
84 | #define DEFAULT_BEACON_INTERVAL 100U | 84 | #define DEFAULT_BEACON_INTERVAL 200U |
85 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | 85 | #define DEFAULT_SHORT_RETRY_LIMIT 7U |
86 | #define DEFAULT_LONG_RETRY_LIMIT 4U | 86 | #define DEFAULT_LONG_RETRY_LIMIT 4U |
87 | 87 | ||
@@ -110,8 +110,6 @@ struct iwl_cmd_meta { | |||
110 | struct iwl_device_cmd *cmd, | 110 | struct iwl_device_cmd *cmd, |
111 | struct iwl_rx_packet *pkt); | 111 | struct iwl_rx_packet *pkt); |
112 | 112 | ||
113 | /* The CMD_SIZE_HUGE flag bit indicates that the command | ||
114 | * structure is stored at the end of the shared queue memory. */ | ||
115 | u32 flags; | 113 | u32 flags; |
116 | 114 | ||
117 | DEFINE_DMA_UNMAP_ADDR(mapping); | 115 | DEFINE_DMA_UNMAP_ADDR(mapping); |
@@ -121,16 +119,29 @@ struct iwl_cmd_meta { | |||
121 | /* | 119 | /* |
122 | * Generic queue structure | 120 | * Generic queue structure |
123 | * | 121 | * |
124 | * Contains common data for Rx and Tx queues | 122 | * Contains common data for Rx and Tx queues. |
123 | * | ||
124 | * Note the difference between n_bd and n_window: the hardware | ||
125 | * always assumes 256 descriptors, so n_bd is always 256 (unless | ||
126 | * there might be HW changes in the future). For the normal TX | ||
127 | * queues, n_window, which is the size of the software queue data | ||
128 | * is also 256; however, for the command queue, n_window is only | ||
129 | * 32 since we don't need so many commands pending. Since the HW | ||
130 | * still uses 256 BDs for DMA though, n_bd stays 256. As a result, | ||
131 | * the software buffers (in the variables @meta, @txb in struct | ||
132 | * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds | ||
133 | * in the same struct) have 256. | ||
134 | * This means that we end up with the following: | ||
135 | * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 | | ||
136 | * SW entries: | 0 | ... | 31 | | ||
137 | * where N is a number between 0 and 7. This means that the SW | ||
138 | * data is a window overlayed over the HW queue. | ||
125 | */ | 139 | */ |
126 | struct iwl_queue { | 140 | struct iwl_queue { |
127 | int n_bd; /* number of BDs in this queue */ | 141 | int n_bd; /* number of BDs in this queue */ |
128 | int write_ptr; /* 1-st empty entry (index) host_w*/ | 142 | int write_ptr; /* 1-st empty entry (index) host_w*/ |
129 | int read_ptr; /* last used entry (index) host_r*/ | 143 | int read_ptr; /* last used entry (index) host_r*/ |
130 | /* use for monitoring and recovering the stuck queue */ | 144 | /* use for monitoring and recovering the stuck queue */ |
131 | int last_read_ptr; /* storing the last read_ptr */ | ||
132 | /* number of time read_ptr and last_read_ptr are the same */ | ||
133 | u8 repeat_same_read_ptr; | ||
134 | dma_addr_t dma_addr; /* physical addr for BD's */ | 145 | dma_addr_t dma_addr; /* physical addr for BD's */ |
135 | int n_window; /* safe queue window */ | 146 | int n_window; /* safe queue window */ |
136 | u32 id; | 147 | u32 id; |
@@ -138,11 +149,12 @@ struct iwl_queue { | |||
138 | * space more than this */ | 149 | * space more than this */ |
139 | int high_mark; /* high watermark, stop queue if free | 150 | int high_mark; /* high watermark, stop queue if free |
140 | * space less than this */ | 151 | * space less than this */ |
141 | } __packed; | 152 | }; |
142 | 153 | ||
143 | /* One for each TFD */ | 154 | /* One for each TFD */ |
144 | struct iwl_tx_info { | 155 | struct iwl_tx_info { |
145 | struct sk_buff *skb; | 156 | struct sk_buff *skb; |
157 | struct iwl_rxon_context *ctx; | ||
146 | }; | 158 | }; |
147 | 159 | ||
148 | /** | 160 | /** |
@@ -153,6 +165,7 @@ struct iwl_tx_info { | |||
153 | * @meta: array of meta data for each command/tx buffer | 165 | * @meta: array of meta data for each command/tx buffer |
154 | * @dma_addr_cmd: physical address of cmd/tx buffer array | 166 | * @dma_addr_cmd: physical address of cmd/tx buffer array |
155 | * @txb: array of per-TFD driver data | 167 | * @txb: array of per-TFD driver data |
168 | * @time_stamp: time (in jiffies) of last read_ptr change | ||
156 | * @need_update: indicates need to update read/write index | 169 | * @need_update: indicates need to update read/write index |
157 | * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled | 170 | * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled |
158 | * | 171 | * |
@@ -164,10 +177,11 @@ struct iwl_tx_info { | |||
164 | 177 | ||
165 | struct iwl_tx_queue { | 178 | struct iwl_tx_queue { |
166 | struct iwl_queue q; | 179 | struct iwl_queue q; |
167 | void *tfds; | 180 | struct iwl_tfd *tfds; |
168 | struct iwl_device_cmd **cmd; | 181 | struct iwl_device_cmd **cmd; |
169 | struct iwl_cmd_meta *meta; | 182 | struct iwl_cmd_meta *meta; |
170 | struct iwl_tx_info *txb; | 183 | struct iwl_tx_info *txb; |
184 | unsigned long time_stamp; | ||
171 | u8 need_update; | 185 | u8 need_update; |
172 | u8 sched_retry; | 186 | u8 sched_retry; |
173 | u8 active; | 187 | u8 active; |
@@ -176,53 +190,12 @@ struct iwl_tx_queue { | |||
176 | 190 | ||
177 | #define IWL_NUM_SCAN_RATES (2) | 191 | #define IWL_NUM_SCAN_RATES (2) |
178 | 192 | ||
179 | struct iwl4965_channel_tgd_info { | ||
180 | u8 type; | ||
181 | s8 max_power; | ||
182 | }; | ||
183 | |||
184 | struct iwl4965_channel_tgh_info { | ||
185 | s64 last_radar_time; | ||
186 | }; | ||
187 | |||
188 | #define IWL4965_MAX_RATE (33) | ||
189 | |||
190 | struct iwl3945_clip_group { | ||
191 | /* maximum power level to prevent clipping for each rate, derived by | ||
192 | * us from this band's saturation power in EEPROM */ | ||
193 | const s8 clip_powers[IWL_MAX_RATES]; | ||
194 | }; | ||
195 | |||
196 | /* current Tx power values to use, one for each rate for each channel. | ||
197 | * requested power is limited by: | ||
198 | * -- regulatory EEPROM limits for this channel | ||
199 | * -- hardware capabilities (clip-powers) | ||
200 | * -- spectrum management | ||
201 | * -- user preference (e.g. iwconfig) | ||
202 | * when requested power is set, base power index must also be set. */ | ||
203 | struct iwl3945_channel_power_info { | ||
204 | struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ | ||
205 | s8 power_table_index; /* actual (compenst'd) index into gain table */ | ||
206 | s8 base_power_index; /* gain index for power at factory temp. */ | ||
207 | s8 requested_power; /* power (dBm) requested for this chnl/rate */ | ||
208 | }; | ||
209 | |||
210 | /* current scan Tx power values to use, one for each scan rate for each | ||
211 | * channel. */ | ||
212 | struct iwl3945_scan_power_info { | ||
213 | struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */ | ||
214 | s8 power_table_index; /* actual (compenst'd) index into gain table */ | ||
215 | s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ | ||
216 | }; | ||
217 | |||
218 | /* | 193 | /* |
219 | * One for each channel, holds all channel setup data | 194 | * One for each channel, holds all channel setup data |
220 | * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant | 195 | * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant |
221 | * with one another! | 196 | * with one another! |
222 | */ | 197 | */ |
223 | struct iwl_channel_info { | 198 | struct iwl_channel_info { |
224 | struct iwl4965_channel_tgd_info tgd; | ||
225 | struct iwl4965_channel_tgh_info tgh; | ||
226 | struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ | 199 | struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */ |
227 | struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for | 200 | struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for |
228 | * HT40 channel */ | 201 | * HT40 channel */ |
@@ -242,20 +215,16 @@ struct iwl_channel_info { | |||
242 | s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ | 215 | s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ |
243 | u8 ht40_flags; /* flags copied from EEPROM */ | 216 | u8 ht40_flags; /* flags copied from EEPROM */ |
244 | u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */ | 217 | u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */ |
245 | |||
246 | /* Radio/DSP gain settings for each "normal" data Tx rate. | ||
247 | * These include, in addition to RF and DSP gain, a few fields for | ||
248 | * remembering/modifying gain settings (indexes). */ | ||
249 | struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE]; | ||
250 | |||
251 | /* Radio/DSP gain settings for each scan rate, for directed scans. */ | ||
252 | struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES]; | ||
253 | }; | 218 | }; |
254 | 219 | ||
255 | #define IWL_TX_FIFO_BK 0 | 220 | #define IWL_TX_FIFO_BK 0 /* shared */ |
256 | #define IWL_TX_FIFO_BE 1 | 221 | #define IWL_TX_FIFO_BE 1 |
257 | #define IWL_TX_FIFO_VI 2 | 222 | #define IWL_TX_FIFO_VI 2 /* shared */ |
258 | #define IWL_TX_FIFO_VO 3 | 223 | #define IWL_TX_FIFO_VO 3 |
224 | #define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK | ||
225 | #define IWL_TX_FIFO_BE_IPAN 4 | ||
226 | #define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI | ||
227 | #define IWL_TX_FIFO_VO_IPAN 5 | ||
259 | #define IWL_TX_FIFO_UNUSED -1 | 228 | #define IWL_TX_FIFO_UNUSED -1 |
260 | 229 | ||
261 | /* Minimum number of queues. MAX_NUM is defined in hw specific files. | 230 | /* Minimum number of queues. MAX_NUM is defined in hw specific files. |
@@ -264,33 +233,23 @@ struct iwl_channel_info { | |||
264 | #define IWL_MIN_NUM_QUEUES 10 | 233 | #define IWL_MIN_NUM_QUEUES 10 |
265 | 234 | ||
266 | /* | 235 | /* |
267 | * Queue #4 is the command queue for 3945/4965/5x00/1000/6x00, | 236 | * Command queue depends on iPAN support. |
268 | * the driver maps it into the appropriate device FIFO for the | ||
269 | * uCode. | ||
270 | */ | 237 | */ |
271 | #define IWL_CMD_QUEUE_NUM 4 | 238 | #define IWL_DEFAULT_CMD_QUEUE_NUM 4 |
272 | 239 | #define IWL_IPAN_CMD_QUEUE_NUM 9 | |
273 | /* Power management (not Tx power) structures */ | ||
274 | 240 | ||
275 | enum iwl_pwr_src { | 241 | /* |
276 | IWL_PWR_SRC_VMAIN, | 242 | * This queue number is required for proper operation |
277 | IWL_PWR_SRC_VAUX, | 243 | * because the ucode will stop/start the scheduler as |
278 | }; | 244 | * required. |
245 | */ | ||
246 | #define IWL_IPAN_MCAST_QUEUE 8 | ||
279 | 247 | ||
280 | #define IEEE80211_DATA_LEN 2304 | 248 | #define IEEE80211_DATA_LEN 2304 |
281 | #define IEEE80211_4ADDR_LEN 30 | 249 | #define IEEE80211_4ADDR_LEN 30 |
282 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | 250 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) |
283 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | 251 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) |
284 | 252 | ||
285 | struct iwl_frame { | ||
286 | union { | ||
287 | struct ieee80211_hdr frame; | ||
288 | struct iwl_tx_beacon_cmd beacon; | ||
289 | u8 raw[IEEE80211_FRAME_LEN]; | ||
290 | u8 cmd[360]; | ||
291 | } u; | ||
292 | struct list_head list; | ||
293 | }; | ||
294 | 253 | ||
295 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | 254 | #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) |
296 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | 255 | #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) |
@@ -300,9 +259,9 @@ enum { | |||
300 | CMD_SYNC = 0, | 259 | CMD_SYNC = 0, |
301 | CMD_SIZE_NORMAL = 0, | 260 | CMD_SIZE_NORMAL = 0, |
302 | CMD_NO_SKB = 0, | 261 | CMD_NO_SKB = 0, |
303 | CMD_SIZE_HUGE = (1 << 0), | ||
304 | CMD_ASYNC = (1 << 1), | 262 | CMD_ASYNC = (1 << 1), |
305 | CMD_WANT_SKB = (1 << 2), | 263 | CMD_WANT_SKB = (1 << 2), |
264 | CMD_MAPPED = (1 << 3), | ||
306 | }; | 265 | }; |
307 | 266 | ||
308 | #define DEF_CMD_PAYLOAD_SIZE 320 | 267 | #define DEF_CMD_PAYLOAD_SIZE 320 |
@@ -311,8 +270,8 @@ enum { | |||
311 | * struct iwl_device_cmd | 270 | * struct iwl_device_cmd |
312 | * | 271 | * |
313 | * For allocation of the command and tx queues, this establishes the overall | 272 | * For allocation of the command and tx queues, this establishes the overall |
314 | * size of the largest command we send to uCode, except for a scan command | 273 | * size of the largest command we send to uCode, except for commands that |
315 | * (which is relatively huge; space is allocated separately). | 274 | * aren't fully copied and use other TFD space. |
316 | */ | 275 | */ |
317 | struct iwl_device_cmd { | 276 | struct iwl_device_cmd { |
318 | struct iwl_cmd_header hdr; /* uCode API */ | 277 | struct iwl_cmd_header hdr; /* uCode API */ |
@@ -329,15 +288,21 @@ struct iwl_device_cmd { | |||
329 | 288 | ||
330 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) | 289 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) |
331 | 290 | ||
291 | #define IWL_MAX_CMD_TFDS 2 | ||
292 | |||
293 | enum iwl_hcmd_dataflag { | ||
294 | IWL_HCMD_DFL_NOCOPY = BIT(0), | ||
295 | }; | ||
332 | 296 | ||
333 | struct iwl_host_cmd { | 297 | struct iwl_host_cmd { |
334 | const void *data; | 298 | const void *data[IWL_MAX_CMD_TFDS]; |
335 | unsigned long reply_page; | 299 | unsigned long reply_page; |
336 | void (*callback)(struct iwl_priv *priv, | 300 | void (*callback)(struct iwl_priv *priv, |
337 | struct iwl_device_cmd *cmd, | 301 | struct iwl_device_cmd *cmd, |
338 | struct iwl_rx_packet *pkt); | 302 | struct iwl_rx_packet *pkt); |
339 | u32 flags; | 303 | u32 flags; |
340 | u16 len; | 304 | u16 len[IWL_MAX_CMD_TFDS]; |
305 | u8 dataflags[IWL_MAX_CMD_TFDS]; | ||
341 | u8 id; | 306 | u8 id; |
342 | }; | 307 | }; |
343 | 308 | ||
@@ -410,6 +375,7 @@ struct iwl_ht_agg { | |||
410 | #define IWL_EMPTYING_HW_QUEUE_ADDBA 2 | 375 | #define IWL_EMPTYING_HW_QUEUE_ADDBA 2 |
411 | #define IWL_EMPTYING_HW_QUEUE_DELBA 3 | 376 | #define IWL_EMPTYING_HW_QUEUE_DELBA 3 |
412 | u8 state; | 377 | u8 state; |
378 | u8 tx_fifo; | ||
413 | }; | 379 | }; |
414 | 380 | ||
415 | 381 | ||
@@ -420,7 +386,7 @@ struct iwl_tid_data { | |||
420 | }; | 386 | }; |
421 | 387 | ||
422 | struct iwl_hw_key { | 388 | struct iwl_hw_key { |
423 | enum ieee80211_key_alg alg; | 389 | u32 cipher; |
424 | int keylen; | 390 | int keylen; |
425 | u8 keyidx; | 391 | u8 keyidx; |
426 | u8 key[32]; | 392 | u8 key[32]; |
@@ -434,7 +400,13 @@ union iwl_ht_rate_supp { | |||
434 | }; | 400 | }; |
435 | }; | 401 | }; |
436 | 402 | ||
437 | #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) | 403 | #define CFG_HT_RX_AMPDU_FACTOR_8K (0x0) |
404 | #define CFG_HT_RX_AMPDU_FACTOR_16K (0x1) | ||
405 | #define CFG_HT_RX_AMPDU_FACTOR_32K (0x2) | ||
406 | #define CFG_HT_RX_AMPDU_FACTOR_64K (0x3) | ||
407 | #define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K | ||
408 | #define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K | ||
409 | #define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K | ||
438 | 410 | ||
439 | /* | 411 | /* |
440 | * Maximal MPDU density for TX aggregation | 412 | * Maximal MPDU density for TX aggregation |
@@ -443,19 +415,17 @@ union iwl_ht_rate_supp { | |||
443 | * 6 - 8us density | 415 | * 6 - 8us density |
444 | * 7 - 16us density | 416 | * 7 - 16us density |
445 | */ | 417 | */ |
418 | #define CFG_HT_MPDU_DENSITY_2USEC (0x4) | ||
446 | #define CFG_HT_MPDU_DENSITY_4USEC (0x5) | 419 | #define CFG_HT_MPDU_DENSITY_4USEC (0x5) |
420 | #define CFG_HT_MPDU_DENSITY_8USEC (0x6) | ||
421 | #define CFG_HT_MPDU_DENSITY_16USEC (0x7) | ||
447 | #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC | 422 | #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC |
423 | #define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC | ||
424 | #define CFG_HT_MPDU_DENSITY_MIN (0x1) | ||
448 | 425 | ||
449 | struct iwl_ht_config { | 426 | struct iwl_ht_config { |
450 | /* self configuration data */ | ||
451 | bool is_ht; | ||
452 | bool is_40mhz; | ||
453 | bool single_chain_sufficient; | 427 | bool single_chain_sufficient; |
454 | enum ieee80211_smps_mode smps; /* current smps mode */ | 428 | enum ieee80211_smps_mode smps; /* current smps mode */ |
455 | /* BSS related data */ | ||
456 | u8 extension_chan_offset; | ||
457 | u8 ht_protection; | ||
458 | u8 non_GF_STA_present; | ||
459 | }; | 429 | }; |
460 | 430 | ||
461 | /* QoS structures */ | 431 | /* QoS structures */ |
@@ -473,12 +443,13 @@ struct iwl_qos_info { | |||
473 | struct iwl_station_entry { | 443 | struct iwl_station_entry { |
474 | struct iwl_addsta_cmd sta; | 444 | struct iwl_addsta_cmd sta; |
475 | struct iwl_tid_data tid[MAX_TID_COUNT]; | 445 | struct iwl_tid_data tid[MAX_TID_COUNT]; |
476 | u8 used; | 446 | u8 used, ctxid; |
477 | struct iwl_hw_key keyinfo; | 447 | struct iwl_hw_key keyinfo; |
478 | struct iwl_link_quality_cmd *lq; | 448 | struct iwl_link_quality_cmd *lq; |
479 | }; | 449 | }; |
480 | 450 | ||
481 | struct iwl_station_priv_common { | 451 | struct iwl_station_priv_common { |
452 | struct iwl_rxon_context *ctx; | ||
482 | u8 sta_id; | 453 | u8 sta_id; |
483 | }; | 454 | }; |
484 | 455 | ||
@@ -488,9 +459,6 @@ struct iwl_station_priv_common { | |||
488 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 459 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
489 | * in the structure for use by driver. This structure is places in that | 460 | * in the structure for use by driver. This structure is places in that |
490 | * space. | 461 | * space. |
491 | * | ||
492 | * The common struct MUST be first because it is shared between | ||
493 | * 3945 and agn! | ||
494 | */ | 462 | */ |
495 | struct iwl_station_priv { | 463 | struct iwl_station_priv { |
496 | struct iwl_station_priv_common common; | 464 | struct iwl_station_priv_common common; |
@@ -498,6 +466,7 @@ struct iwl_station_priv { | |||
498 | atomic_t pending_frames; | 466 | atomic_t pending_frames; |
499 | bool client; | 467 | bool client; |
500 | bool asleep; | 468 | bool asleep; |
469 | u8 max_agg_bufsize; | ||
501 | }; | 470 | }; |
502 | 471 | ||
503 | /** | 472 | /** |
@@ -507,6 +476,7 @@ struct iwl_station_priv { | |||
507 | * space for us to put data into. | 476 | * space for us to put data into. |
508 | */ | 477 | */ |
509 | struct iwl_vif_priv { | 478 | struct iwl_vif_priv { |
479 | struct iwl_rxon_context *ctx; | ||
510 | u8 ibss_bssid_sta_id; | 480 | u8 ibss_bssid_sta_id; |
511 | }; | 481 | }; |
512 | 482 | ||
@@ -517,6 +487,10 @@ struct fw_desc { | |||
517 | u32 len; /* bytes */ | 487 | u32 len; /* bytes */ |
518 | }; | 488 | }; |
519 | 489 | ||
490 | struct fw_img { | ||
491 | struct fw_desc code, data; | ||
492 | }; | ||
493 | |||
520 | /* v1/v2 uCode file layout */ | 494 | /* v1/v2 uCode file layout */ |
521 | struct iwl_ucode_header { | 495 | struct iwl_ucode_header { |
522 | __le32 ver; /* major/minor/API/serial */ | 496 | __le32 ver; /* major/minor/API/serial */ |
@@ -564,6 +538,7 @@ enum iwl_ucode_tlv_type { | |||
564 | IWL_UCODE_TLV_INIT_DATA = 4, | 538 | IWL_UCODE_TLV_INIT_DATA = 4, |
565 | IWL_UCODE_TLV_BOOT = 5, | 539 | IWL_UCODE_TLV_BOOT = 5, |
566 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ | 540 | IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ |
541 | IWL_UCODE_TLV_PAN = 7, | ||
567 | IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, | 542 | IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, |
568 | IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, | 543 | IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, |
569 | IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, | 544 | IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, |
@@ -572,6 +547,22 @@ enum iwl_ucode_tlv_type { | |||
572 | IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, | 547 | IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, |
573 | IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, | 548 | IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, |
574 | IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, | 549 | IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, |
550 | /* 16 and 17 reserved for future use */ | ||
551 | IWL_UCODE_TLV_FLAGS = 18, | ||
552 | }; | ||
553 | |||
554 | /** | ||
555 | * enum iwl_ucode_tlv_flag - ucode API flags | ||
556 | * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously | ||
557 | * was a separate TLV but moved here to save space. | ||
558 | * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID, | ||
559 | * treats good CRC threshold as a boolean | ||
560 | * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). | ||
561 | */ | ||
562 | enum iwl_ucode_tlv_flag { | ||
563 | IWL_UCODE_TLV_FLAGS_PAN = BIT(0), | ||
564 | IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1), | ||
565 | IWL_UCODE_TLV_FLAGS_MFP = BIT(2), | ||
575 | }; | 566 | }; |
576 | 567 | ||
577 | struct iwl_ucode_tlv { | 568 | struct iwl_ucode_tlv { |
@@ -605,14 +596,6 @@ struct iwl_tlv_ucode_header { | |||
605 | u8 data[0]; | 596 | u8 data[0]; |
606 | }; | 597 | }; |
607 | 598 | ||
608 | struct iwl4965_ibss_seq { | ||
609 | u8 mac[ETH_ALEN]; | ||
610 | u16 seq_num; | ||
611 | u16 frag_num; | ||
612 | unsigned long packet_time; | ||
613 | struct list_head list; | ||
614 | }; | ||
615 | |||
616 | struct iwl_sensitivity_ranges { | 599 | struct iwl_sensitivity_ranges { |
617 | u16 min_nrg_cck; | 600 | u16 min_nrg_cck; |
618 | u16 max_nrg_cck; | 601 | u16 max_nrg_cck; |
@@ -658,7 +641,6 @@ struct iwl_sensitivity_ranges { | |||
658 | * @rx_page_order: Rx buffer page order | 641 | * @rx_page_order: Rx buffer page order |
659 | * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR | 642 | * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR |
660 | * @max_stations: | 643 | * @max_stations: |
661 | * @bcast_sta_id: | ||
662 | * @ht40_channel: is 40MHz width possible in band 2.4 | 644 | * @ht40_channel: is 40MHz width possible in band 2.4 |
663 | * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) | 645 | * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) |
664 | * @sw_crypto: 0 for hw, 1 for sw | 646 | * @sw_crypto: 0 for hw, 1 for sw |
@@ -666,6 +648,7 @@ struct iwl_sensitivity_ranges { | |||
666 | * @ct_kill_threshold: temperature threshold | 648 | * @ct_kill_threshold: temperature threshold |
667 | * @beacon_time_tsf_bits: number of valid tsf bits for beacon time | 649 | * @beacon_time_tsf_bits: number of valid tsf bits for beacon time |
668 | * @calib_init_cfg: setup initial calibrations for the hw | 650 | * @calib_init_cfg: setup initial calibrations for the hw |
651 | * @calib_rt_cfg: setup runtime calibrations for the hw | ||
669 | * @struct iwl_sensitivity_ranges: range of sensitivity values | 652 | * @struct iwl_sensitivity_ranges: range of sensitivity values |
670 | */ | 653 | */ |
671 | struct iwl_hw_params { | 654 | struct iwl_hw_params { |
@@ -682,17 +665,16 @@ struct iwl_hw_params { | |||
682 | u32 rx_page_order; | 665 | u32 rx_page_order; |
683 | u32 rx_wrt_ptr_reg; | 666 | u32 rx_wrt_ptr_reg; |
684 | u8 max_stations; | 667 | u8 max_stations; |
685 | u8 bcast_sta_id; | ||
686 | u8 ht40_channel; | 668 | u8 ht40_channel; |
687 | u8 max_beacon_itrvl; /* in 1024 ms */ | 669 | u8 max_beacon_itrvl; /* in 1024 ms */ |
688 | u32 max_inst_size; | 670 | u32 max_inst_size; |
689 | u32 max_data_size; | 671 | u32 max_data_size; |
690 | u32 max_bsm_size; | ||
691 | u32 ct_kill_threshold; /* value in hw-dependent units */ | 672 | u32 ct_kill_threshold; /* value in hw-dependent units */ |
692 | u32 ct_kill_exit_threshold; /* value in hw-dependent units */ | 673 | u32 ct_kill_exit_threshold; /* value in hw-dependent units */ |
693 | /* for 1000, 6000 series and up */ | 674 | /* for 1000, 6000 series and up */ |
694 | u16 beacon_time_tsf_bits; | 675 | u16 beacon_time_tsf_bits; |
695 | u32 calib_init_cfg; | 676 | u32 calib_init_cfg; |
677 | u32 calib_rt_cfg; | ||
696 | const struct iwl_sensitivity_ranges *sens; | 678 | const struct iwl_sensitivity_ranges *sens; |
697 | }; | 679 | }; |
698 | 680 | ||
@@ -708,12 +690,9 @@ struct iwl_hw_params { | |||
708 | * Naming convention -- | 690 | * Naming convention -- |
709 | * iwl_ <-- Is part of iwlwifi | 691 | * iwl_ <-- Is part of iwlwifi |
710 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) | 692 | * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) |
711 | * iwl4965_bg_ <-- Called from work queue context | ||
712 | * iwl4965_mac_ <-- mac80211 callback | ||
713 | * | 693 | * |
714 | ****************************************************************************/ | 694 | ****************************************************************************/ |
715 | extern void iwl_update_chain_flags(struct iwl_priv *priv); | 695 | extern void iwl_update_chain_flags(struct iwl_priv *priv); |
716 | extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); | ||
717 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | 696 | extern const u8 iwl_bcast_addr[ETH_ALEN]; |
718 | extern int iwl_rxq_stop(struct iwl_priv *priv); | 697 | extern int iwl_rxq_stop(struct iwl_priv *priv); |
719 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); | 698 | extern void iwl_txq_ctx_stop(struct iwl_priv *priv); |
@@ -726,17 +705,8 @@ static inline int iwl_queue_used(const struct iwl_queue *q, int i) | |||
726 | } | 705 | } |
727 | 706 | ||
728 | 707 | ||
729 | static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) | 708 | static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) |
730 | { | 709 | { |
731 | /* | ||
732 | * This is for init calibration result and scan command which | ||
733 | * required buffer > TFD_MAX_PAYLOAD_SIZE, | ||
734 | * the big buffer at end of command array | ||
735 | */ | ||
736 | if (is_huge) | ||
737 | return q->n_window; /* must be power of 2 */ | ||
738 | |||
739 | /* Otherwise, use normal size buffers */ | ||
740 | return index & (q->n_window - 1); | 710 | return index & (q->n_window - 1); |
741 | } | 711 | } |
742 | 712 | ||
@@ -759,7 +729,6 @@ struct iwl_dma_ptr { | |||
759 | 729 | ||
760 | /* Sensitivity and chain noise calibration */ | 730 | /* Sensitivity and chain noise calibration */ |
761 | #define INITIALIZATION_VALUE 0xFFFF | 731 | #define INITIALIZATION_VALUE 0xFFFF |
762 | #define IWL4965_CAL_NUM_BEACONS 20 | ||
763 | #define IWL_CAL_NUM_BEACONS 16 | 732 | #define IWL_CAL_NUM_BEACONS 16 |
764 | #define MAXIMUM_ALLOWED_PATHLOSS 15 | 733 | #define MAXIMUM_ALLOWED_PATHLOSS 15 |
765 | 734 | ||
@@ -793,24 +762,19 @@ struct iwl_dma_ptr { | |||
793 | #define NRG_NUM_PREV_STAT_L 20 | 762 | #define NRG_NUM_PREV_STAT_L 20 |
794 | #define NUM_RX_CHAINS 3 | 763 | #define NUM_RX_CHAINS 3 |
795 | 764 | ||
796 | enum iwl4965_false_alarm_state { | 765 | enum iwlagn_false_alarm_state { |
797 | IWL_FA_TOO_MANY = 0, | 766 | IWL_FA_TOO_MANY = 0, |
798 | IWL_FA_TOO_FEW = 1, | 767 | IWL_FA_TOO_FEW = 1, |
799 | IWL_FA_GOOD_RANGE = 2, | 768 | IWL_FA_GOOD_RANGE = 2, |
800 | }; | 769 | }; |
801 | 770 | ||
802 | enum iwl4965_chain_noise_state { | 771 | enum iwlagn_chain_noise_state { |
803 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ | 772 | IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ |
804 | IWL_CHAIN_NOISE_ACCUMULATE, | 773 | IWL_CHAIN_NOISE_ACCUMULATE, |
805 | IWL_CHAIN_NOISE_CALIBRATED, | 774 | IWL_CHAIN_NOISE_CALIBRATED, |
806 | IWL_CHAIN_NOISE_DONE, | 775 | IWL_CHAIN_NOISE_DONE, |
807 | }; | 776 | }; |
808 | 777 | ||
809 | enum iwl4965_calib_enabled_state { | ||
810 | IWL_CALIB_DISABLED = 0, /* must be 0 */ | ||
811 | IWL_CALIB_ENABLED = 1, | ||
812 | }; | ||
813 | |||
814 | 778 | ||
815 | /* | 779 | /* |
816 | * enum iwl_calib | 780 | * enum iwl_calib |
@@ -824,6 +788,7 @@ enum iwl_calib { | |||
824 | IWL_CALIB_TX_IQ, | 788 | IWL_CALIB_TX_IQ, |
825 | IWL_CALIB_TX_IQ_PERD, | 789 | IWL_CALIB_TX_IQ_PERD, |
826 | IWL_CALIB_BASE_BAND, | 790 | IWL_CALIB_BASE_BAND, |
791 | IWL_CALIB_TEMP_OFFSET, | ||
827 | IWL_CALIB_MAX | 792 | IWL_CALIB_MAX |
828 | }; | 793 | }; |
829 | 794 | ||
@@ -833,12 +798,6 @@ struct iwl_calib_result { | |||
833 | size_t buf_len; | 798 | size_t buf_len; |
834 | }; | 799 | }; |
835 | 800 | ||
836 | enum ucode_type { | ||
837 | UCODE_NONE = 0, | ||
838 | UCODE_INIT, | ||
839 | UCODE_RT | ||
840 | }; | ||
841 | |||
842 | /* Sensitivity calib data */ | 801 | /* Sensitivity calib data */ |
843 | struct iwl_sensitivity_data { | 802 | struct iwl_sensitivity_data { |
844 | u32 auto_corr_ofdm; | 803 | u32 auto_corr_ofdm; |
@@ -928,7 +887,7 @@ enum iwl_pa_type { | |||
928 | struct isr_statistics { | 887 | struct isr_statistics { |
929 | u32 hw; | 888 | u32 hw; |
930 | u32 sw; | 889 | u32 sw; |
931 | u32 sw_err; | 890 | u32 err_code; |
932 | u32 sch; | 891 | u32 sch; |
933 | u32 alive; | 892 | u32 alive; |
934 | u32 rfkill; | 893 | u32 rfkill; |
@@ -940,7 +899,50 @@ struct isr_statistics { | |||
940 | u32 unhandled; | 899 | u32 unhandled; |
941 | }; | 900 | }; |
942 | 901 | ||
943 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 902 | /* reply_tx_statistics (for _agn devices) */ |
903 | struct reply_tx_error_statistics { | ||
904 | u32 pp_delay; | ||
905 | u32 pp_few_bytes; | ||
906 | u32 pp_bt_prio; | ||
907 | u32 pp_quiet_period; | ||
908 | u32 pp_calc_ttak; | ||
909 | u32 int_crossed_retry; | ||
910 | u32 short_limit; | ||
911 | u32 long_limit; | ||
912 | u32 fifo_underrun; | ||
913 | u32 drain_flow; | ||
914 | u32 rfkill_flush; | ||
915 | u32 life_expire; | ||
916 | u32 dest_ps; | ||
917 | u32 host_abort; | ||
918 | u32 bt_retry; | ||
919 | u32 sta_invalid; | ||
920 | u32 frag_drop; | ||
921 | u32 tid_disable; | ||
922 | u32 fifo_flush; | ||
923 | u32 insuff_cf_poll; | ||
924 | u32 fail_hw_drop; | ||
925 | u32 sta_color_mismatch; | ||
926 | u32 unknown; | ||
927 | }; | ||
928 | |||
929 | /* reply_agg_tx_statistics (for _agn devices) */ | ||
930 | struct reply_agg_tx_error_statistics { | ||
931 | u32 underrun; | ||
932 | u32 bt_prio; | ||
933 | u32 few_bytes; | ||
934 | u32 abort; | ||
935 | u32 last_sent_ttl; | ||
936 | u32 last_sent_try; | ||
937 | u32 last_sent_bt_kill; | ||
938 | u32 scd_query; | ||
939 | u32 bad_crc32; | ||
940 | u32 response; | ||
941 | u32 dump_tx; | ||
942 | u32 delay_tx; | ||
943 | u32 unknown; | ||
944 | }; | ||
945 | |||
944 | /* management statistics */ | 946 | /* management statistics */ |
945 | enum iwl_mgmt_stats { | 947 | enum iwl_mgmt_stats { |
946 | MANAGEMENT_ASSOC_REQ = 0, | 948 | MANAGEMENT_ASSOC_REQ = 0, |
@@ -971,26 +973,12 @@ enum iwl_ctrl_stats { | |||
971 | }; | 973 | }; |
972 | 974 | ||
973 | struct traffic_stats { | 975 | struct traffic_stats { |
976 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
974 | u32 mgmt[MANAGEMENT_MAX]; | 977 | u32 mgmt[MANAGEMENT_MAX]; |
975 | u32 ctrl[CONTROL_MAX]; | 978 | u32 ctrl[CONTROL_MAX]; |
976 | u32 data_cnt; | 979 | u32 data_cnt; |
977 | u64 data_bytes; | 980 | u64 data_bytes; |
978 | }; | ||
979 | #else | ||
980 | struct traffic_stats { | ||
981 | u64 data_bytes; | ||
982 | }; | ||
983 | #endif | 981 | #endif |
984 | |||
985 | /* | ||
986 | * iwl_switch_rxon: "channel switch" structure | ||
987 | * | ||
988 | * @ switch_in_progress: channel switch in progress | ||
989 | * @ channel: new channel | ||
990 | */ | ||
991 | struct iwl_switch_rxon { | ||
992 | bool switch_in_progress; | ||
993 | __le16 channel; | ||
994 | }; | 982 | }; |
995 | 983 | ||
996 | /* | 984 | /* |
@@ -1048,11 +1036,18 @@ struct iwl_event_log { | |||
1048 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) | 1036 | #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) |
1049 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) | 1037 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) |
1050 | 1038 | ||
1051 | /* timer constants use to monitor and recover stuck tx queues in mSecs */ | 1039 | /* TX queue watchdog timeouts in mSecs */ |
1052 | #define IWL_DEF_MONITORING_PERIOD (1000) | 1040 | #define IWL_DEF_WD_TIMEOUT (2000) |
1053 | #define IWL_LONG_MONITORING_PERIOD (5000) | 1041 | #define IWL_LONG_WD_TIMEOUT (10000) |
1054 | #define IWL_ONE_HUNDRED_MSECS (100) | 1042 | #define IWL_MAX_WD_TIMEOUT (120000) |
1055 | #define IWL_SIXTY_SECS (60000) | 1043 | |
1044 | /* BT Antenna Coupling Threshold (dB) */ | ||
1045 | #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) | ||
1046 | |||
1047 | /* Firmware reload counter and Timestamp */ | ||
1048 | #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */ | ||
1049 | #define IWL_MAX_CONTINUE_RELOAD_CNT 4 | ||
1050 | |||
1056 | 1051 | ||
1057 | enum iwl_reset { | 1052 | enum iwl_reset { |
1058 | IWL_RF_RESET = 0, | 1053 | IWL_RF_RESET = 0, |
@@ -1070,18 +1065,117 @@ struct iwl_force_reset { | |||
1070 | 1065 | ||
1071 | /* extend beacon time format bit shifting */ | 1066 | /* extend beacon time format bit shifting */ |
1072 | /* | 1067 | /* |
1073 | * for _3945 devices | ||
1074 | * bits 31:24 - extended | ||
1075 | * bits 23:0 - interval | ||
1076 | */ | ||
1077 | #define IWL3945_EXT_BEACON_TIME_POS 24 | ||
1078 | /* | ||
1079 | * for _agn devices | 1068 | * for _agn devices |
1080 | * bits 31:22 - extended | 1069 | * bits 31:22 - extended |
1081 | * bits 21:0 - interval | 1070 | * bits 21:0 - interval |
1082 | */ | 1071 | */ |
1083 | #define IWLAGN_EXT_BEACON_TIME_POS 22 | 1072 | #define IWLAGN_EXT_BEACON_TIME_POS 22 |
1084 | 1073 | ||
1074 | /** | ||
1075 | * struct iwl_notification_wait - notification wait entry | ||
1076 | * @list: list head for global list | ||
1077 | * @fn: function called with the notification | ||
1078 | * @cmd: command ID | ||
1079 | * | ||
1080 | * This structure is not used directly, to wait for a | ||
1081 | * notification declare it on the stack, and call | ||
1082 | * iwlagn_init_notification_wait() with appropriate | ||
1083 | * parameters. Then do whatever will cause the ucode | ||
1084 | * to notify the driver, and to wait for that then | ||
1085 | * call iwlagn_wait_notification(). | ||
1086 | * | ||
1087 | * Each notification is one-shot. If at some point we | ||
1088 | * need to support multi-shot notifications (which | ||
1089 | * can't be allocated on the stack) we need to modify | ||
1090 | * the code for them. | ||
1091 | */ | ||
1092 | struct iwl_notification_wait { | ||
1093 | struct list_head list; | ||
1094 | |||
1095 | void (*fn)(struct iwl_priv *priv, struct iwl_rx_packet *pkt, | ||
1096 | void *data); | ||
1097 | void *fn_data; | ||
1098 | |||
1099 | u8 cmd; | ||
1100 | bool triggered, aborted; | ||
1101 | }; | ||
1102 | |||
1103 | enum iwl_rxon_context_id { | ||
1104 | IWL_RXON_CTX_BSS, | ||
1105 | IWL_RXON_CTX_PAN, | ||
1106 | |||
1107 | NUM_IWL_RXON_CTX | ||
1108 | }; | ||
1109 | |||
1110 | struct iwl_rxon_context { | ||
1111 | struct ieee80211_vif *vif; | ||
1112 | |||
1113 | const u8 *ac_to_fifo; | ||
1114 | const u8 *ac_to_queue; | ||
1115 | u8 mcast_queue; | ||
1116 | |||
1117 | /* | ||
1118 | * We could use the vif to indicate active, but we | ||
1119 | * also need it to be active during disabling when | ||
1120 | * we already removed the vif for type setting. | ||
1121 | */ | ||
1122 | bool always_active, is_active; | ||
1123 | |||
1124 | bool ht_need_multiple_chains; | ||
1125 | |||
1126 | enum iwl_rxon_context_id ctxid; | ||
1127 | |||
1128 | u32 interface_modes, exclusive_interface_modes; | ||
1129 | u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; | ||
1130 | |||
1131 | /* | ||
1132 | * We declare this const so it can only be | ||
1133 | * changed via explicit cast within the | ||
1134 | * routines that actually update the physical | ||
1135 | * hardware. | ||
1136 | */ | ||
1137 | const struct iwl_rxon_cmd active; | ||
1138 | struct iwl_rxon_cmd staging; | ||
1139 | |||
1140 | struct iwl_rxon_time_cmd timing; | ||
1141 | |||
1142 | struct iwl_qos_info qos_data; | ||
1143 | |||
1144 | u8 bcast_sta_id, ap_sta_id; | ||
1145 | |||
1146 | u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd; | ||
1147 | u8 qos_cmd; | ||
1148 | u8 wep_key_cmd; | ||
1149 | |||
1150 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; | ||
1151 | u8 key_mapping_keys; | ||
1152 | |||
1153 | __le32 station_flags; | ||
1154 | |||
1155 | struct { | ||
1156 | bool non_gf_sta_present; | ||
1157 | u8 protection; | ||
1158 | bool enabled, is_40mhz; | ||
1159 | u8 extension_chan_offset; | ||
1160 | } ht; | ||
1161 | |||
1162 | bool last_tx_rejected; | ||
1163 | }; | ||
1164 | |||
1165 | enum iwl_scan_type { | ||
1166 | IWL_SCAN_NORMAL, | ||
1167 | IWL_SCAN_RADIO_RESET, | ||
1168 | IWL_SCAN_OFFCH_TX, | ||
1169 | }; | ||
1170 | |||
1171 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL | ||
1172 | struct iwl_testmode_trace { | ||
1173 | u8 *cpu_addr; | ||
1174 | u8 *trace_addr; | ||
1175 | dma_addr_t dma_addr; | ||
1176 | bool trace_enabled; | ||
1177 | }; | ||
1178 | #endif | ||
1085 | struct iwl_priv { | 1179 | struct iwl_priv { |
1086 | 1180 | ||
1087 | /* ieee device used by generic ieee processing code */ | 1181 | /* ieee device used by generic ieee processing code */ |
@@ -1090,13 +1184,10 @@ struct iwl_priv { | |||
1090 | struct ieee80211_rate *ieee_rates; | 1184 | struct ieee80211_rate *ieee_rates; |
1091 | struct iwl_cfg *cfg; | 1185 | struct iwl_cfg *cfg; |
1092 | 1186 | ||
1093 | /* temporary frame storage list */ | ||
1094 | struct list_head free_frames; | ||
1095 | int frames_count; | ||
1096 | |||
1097 | enum ieee80211_band band; | 1187 | enum ieee80211_band band; |
1098 | int alloc_rxb_page; | ||
1099 | 1188 | ||
1189 | void (*pre_rx_handler)(struct iwl_priv *priv, | ||
1190 | struct iwl_rx_mem_buffer *rxb); | ||
1100 | void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, | 1191 | void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, |
1101 | struct iwl_rx_mem_buffer *rxb); | 1192 | struct iwl_rx_mem_buffer *rxb); |
1102 | 1193 | ||
@@ -1110,12 +1201,19 @@ struct iwl_priv { | |||
1110 | u32 ucode_beacon_time; | 1201 | u32 ucode_beacon_time; |
1111 | int missed_beacon_threshold; | 1202 | int missed_beacon_threshold; |
1112 | 1203 | ||
1113 | /* storing the jiffies when the plcp error rate is received */ | 1204 | /* track IBSS manager (last beacon) status */ |
1114 | unsigned long plcp_jiffies; | 1205 | u32 ibss_manager; |
1206 | |||
1207 | /* jiffies when last recovery from statistics was performed */ | ||
1208 | unsigned long rx_statistics_jiffies; | ||
1115 | 1209 | ||
1116 | /* force reset */ | 1210 | /* force reset */ |
1117 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; | 1211 | struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET]; |
1118 | 1212 | ||
1213 | /* firmware reload counter and timestamp */ | ||
1214 | unsigned long reload_jiffies; | ||
1215 | int reload_count; | ||
1216 | |||
1119 | /* we allocate array of iwl_channel_info for NIC's valid channels. | 1217 | /* we allocate array of iwl_channel_info for NIC's valid channels. |
1120 | * Access via channel # using indirect index array */ | 1218 | * Access via channel # using indirect index array */ |
1121 | struct iwl_channel_info *channel_info; /* channel info array */ | 1219 | struct iwl_channel_info *channel_info; /* channel info array */ |
@@ -1135,7 +1233,7 @@ struct iwl_priv { | |||
1135 | enum ieee80211_band scan_band; | 1233 | enum ieee80211_band scan_band; |
1136 | struct cfg80211_scan_request *scan_request; | 1234 | struct cfg80211_scan_request *scan_request; |
1137 | struct ieee80211_vif *scan_vif; | 1235 | struct ieee80211_vif *scan_vif; |
1138 | bool is_internal_short_scan; | 1236 | enum iwl_scan_type scan_type; |
1139 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; | 1237 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; |
1140 | u8 mgmt_tx_ant; | 1238 | u8 mgmt_tx_ant; |
1141 | 1239 | ||
@@ -1144,16 +1242,23 @@ struct iwl_priv { | |||
1144 | spinlock_t hcmd_lock; /* protect hcmd */ | 1242 | spinlock_t hcmd_lock; /* protect hcmd */ |
1145 | spinlock_t reg_lock; /* protect hw register access */ | 1243 | spinlock_t reg_lock; /* protect hw register access */ |
1146 | struct mutex mutex; | 1244 | struct mutex mutex; |
1147 | struct mutex sync_cmd_mutex; /* enable serialization of sync commands */ | ||
1148 | 1245 | ||
1149 | /* basic pci-network driver stuff */ | 1246 | /* basic pci-network driver stuff */ |
1150 | struct pci_dev *pci_dev; | 1247 | struct pci_dev *pci_dev; |
1151 | 1248 | ||
1152 | /* pci hardware address support */ | 1249 | /* pci hardware address support */ |
1153 | void __iomem *hw_base; | 1250 | void __iomem *hw_base; |
1154 | u32 hw_rev; | 1251 | |
1155 | u32 hw_wa_rev; | 1252 | /* microcode/device supports multiple contexts */ |
1156 | u8 rev_id; | 1253 | u8 valid_contexts; |
1254 | |||
1255 | /* command queue number */ | ||
1256 | u8 cmd_queue; | ||
1257 | |||
1258 | /* max number of station keys */ | ||
1259 | u8 sta_key_max_num; | ||
1260 | |||
1261 | bool new_scan_threshold_behaviour; | ||
1157 | 1262 | ||
1158 | /* EEPROM MAC addresses */ | 1263 | /* EEPROM MAC addresses */ |
1159 | struct mac_address addresses[2]; | 1264 | struct mac_address addresses[2]; |
@@ -1162,37 +1267,21 @@ struct iwl_priv { | |||
1162 | int fw_index; /* firmware we're trying to load */ | 1267 | int fw_index; /* firmware we're trying to load */ |
1163 | u32 ucode_ver; /* version of ucode, copy of | 1268 | u32 ucode_ver; /* version of ucode, copy of |
1164 | iwl_ucode.ver */ | 1269 | iwl_ucode.ver */ |
1165 | struct fw_desc ucode_code; /* runtime inst */ | 1270 | struct fw_img ucode_rt; |
1166 | struct fw_desc ucode_data; /* runtime data original */ | 1271 | struct fw_img ucode_init; |
1167 | struct fw_desc ucode_data_backup; /* runtime data save/restore */ | 1272 | |
1168 | struct fw_desc ucode_init; /* initialization inst */ | 1273 | enum iwlagn_ucode_subtype ucode_type; |
1169 | struct fw_desc ucode_init_data; /* initialization data */ | ||
1170 | struct fw_desc ucode_boot; /* bootstrap inst */ | ||
1171 | enum ucode_type ucode_type; | ||
1172 | u8 ucode_write_complete; /* the image write is complete */ | 1274 | u8 ucode_write_complete; /* the image write is complete */ |
1173 | char firmware_name[25]; | 1275 | char firmware_name[25]; |
1174 | 1276 | ||
1277 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | ||
1175 | 1278 | ||
1176 | struct iwl_rxon_time_cmd rxon_timing; | 1279 | __le16 switch_channel; |
1177 | |||
1178 | /* We declare this const so it can only be | ||
1179 | * changed via explicit cast within the | ||
1180 | * routines that actually update the physical | ||
1181 | * hardware */ | ||
1182 | const struct iwl_rxon_cmd active_rxon; | ||
1183 | struct iwl_rxon_cmd staging_rxon; | ||
1184 | |||
1185 | struct iwl_switch_rxon switch_rxon; | ||
1186 | |||
1187 | /* 1st responses from initialize and runtime uCode images. | ||
1188 | * _agn's initialize alive response contains some calibration data. */ | ||
1189 | struct iwl_init_alive_resp card_alive_init; | ||
1190 | struct iwl_alive_resp card_alive; | ||
1191 | 1280 | ||
1192 | unsigned long last_blink_time; | 1281 | struct { |
1193 | u8 last_blink_rate; | 1282 | u32 error_event_table; |
1194 | u8 allow_blinking; | 1283 | u32 log_event_table; |
1195 | u64 led_tpt; | 1284 | } device_pointers; |
1196 | 1285 | ||
1197 | u16 active_rate; | 1286 | u16 active_rate; |
1198 | 1287 | ||
@@ -1233,17 +1322,12 @@ struct iwl_priv { | |||
1233 | struct iwl_power_mgr power_data; | 1322 | struct iwl_power_mgr power_data; |
1234 | struct iwl_tt_mgmt thermal_throttle; | 1323 | struct iwl_tt_mgmt thermal_throttle; |
1235 | 1324 | ||
1236 | /* context information */ | ||
1237 | u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ | ||
1238 | |||
1239 | /* station table variables */ | 1325 | /* station table variables */ |
1240 | 1326 | ||
1241 | /* Note: if lock and sta_lock are needed, lock must be acquired first */ | 1327 | /* Note: if lock and sta_lock are needed, lock must be acquired first */ |
1242 | spinlock_t sta_lock; | 1328 | spinlock_t sta_lock; |
1243 | int num_stations; | 1329 | int num_stations; |
1244 | struct iwl_station_entry stations[IWL_STATION_COUNT]; | 1330 | struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; |
1245 | struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; /* protected by mutex */ | ||
1246 | u8 key_mapping_key; | ||
1247 | unsigned long ucode_key_table; | 1331 | unsigned long ucode_key_table; |
1248 | 1332 | ||
1249 | /* queue refcounts */ | 1333 | /* queue refcounts */ |
@@ -1264,119 +1348,134 @@ struct iwl_priv { | |||
1264 | 1348 | ||
1265 | enum nl80211_iftype iw_mode; | 1349 | enum nl80211_iftype iw_mode; |
1266 | 1350 | ||
1267 | struct sk_buff *ibss_beacon; | ||
1268 | |||
1269 | /* Last Rx'd beacon timestamp */ | 1351 | /* Last Rx'd beacon timestamp */ |
1270 | u64 timestamp; | 1352 | u64 timestamp; |
1271 | struct ieee80211_vif *vif; | ||
1272 | |||
1273 | union { | ||
1274 | #if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) | ||
1275 | struct { | ||
1276 | void *shared_virt; | ||
1277 | dma_addr_t shared_phys; | ||
1278 | |||
1279 | struct delayed_work thermal_periodic; | ||
1280 | struct delayed_work rfkill_poll; | ||
1281 | 1353 | ||
1282 | struct iwl3945_notif_statistics statistics; | 1354 | struct { |
1355 | __le32 flag; | ||
1356 | struct statistics_general_common common; | ||
1357 | struct statistics_rx_non_phy rx_non_phy; | ||
1358 | struct statistics_rx_phy rx_ofdm; | ||
1359 | struct statistics_rx_ht_phy rx_ofdm_ht; | ||
1360 | struct statistics_rx_phy rx_cck; | ||
1361 | struct statistics_tx tx; | ||
1283 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1362 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1284 | struct iwl3945_notif_statistics accum_statistics; | 1363 | struct statistics_bt_activity bt_activity; |
1285 | struct iwl3945_notif_statistics delta_statistics; | 1364 | __le32 num_bt_kills, accum_num_bt_kills; |
1286 | struct iwl3945_notif_statistics max_delta; | ||
1287 | #endif | 1365 | #endif |
1288 | 1366 | } statistics; | |
1289 | u32 sta_supp_rates; | ||
1290 | int last_rx_rssi; /* From Rx packet statistics */ | ||
1291 | |||
1292 | /* Rx'd packet timing information */ | ||
1293 | u32 last_beacon_time; | ||
1294 | u64 last_tsf; | ||
1295 | |||
1296 | /* | ||
1297 | * each calibration channel group in the | ||
1298 | * EEPROM has a derived clip setting for | ||
1299 | * each rate. | ||
1300 | */ | ||
1301 | const struct iwl3945_clip_group clip_groups[5]; | ||
1302 | |||
1303 | } _3945; | ||
1304 | #endif | ||
1305 | #if defined(CONFIG_IWLAGN) || defined(CONFIG_IWLAGN_MODULE) | ||
1306 | struct { | ||
1307 | /* INT ICT Table */ | ||
1308 | __le32 *ict_tbl; | ||
1309 | void *ict_tbl_vir; | ||
1310 | dma_addr_t ict_tbl_dma; | ||
1311 | dma_addr_t aligned_ict_tbl_dma; | ||
1312 | int ict_index; | ||
1313 | u32 inta; | ||
1314 | bool use_ict; | ||
1315 | /* | ||
1316 | * reporting the number of tids has AGG on. 0 means | ||
1317 | * no AGGREGATION | ||
1318 | */ | ||
1319 | u8 agg_tids_count; | ||
1320 | |||
1321 | struct iwl_rx_phy_res last_phy_res; | ||
1322 | bool last_phy_res_valid; | ||
1323 | |||
1324 | struct completion firmware_loading_complete; | ||
1325 | |||
1326 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; | ||
1327 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; | ||
1328 | |||
1329 | /* | ||
1330 | * chain noise reset and gain commands are the | ||
1331 | * two extra calibration commands follows the standard | ||
1332 | * phy calibration commands | ||
1333 | */ | ||
1334 | u8 phy_calib_chain_noise_reset_cmd; | ||
1335 | u8 phy_calib_chain_noise_gain_cmd; | ||
1336 | |||
1337 | struct iwl_notif_statistics statistics; | ||
1338 | struct iwl_bt_notif_statistics statistics_bt; | ||
1339 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1367 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1340 | struct iwl_notif_statistics accum_statistics; | 1368 | struct { |
1341 | struct iwl_notif_statistics delta_statistics; | 1369 | struct statistics_general_common common; |
1342 | struct iwl_notif_statistics max_delta; | 1370 | struct statistics_rx_non_phy rx_non_phy; |
1343 | struct iwl_bt_notif_statistics accum_statistics_bt; | 1371 | struct statistics_rx_phy rx_ofdm; |
1344 | struct iwl_bt_notif_statistics delta_statistics_bt; | 1372 | struct statistics_rx_ht_phy rx_ofdm_ht; |
1345 | struct iwl_bt_notif_statistics max_delta_bt; | 1373 | struct statistics_rx_phy rx_cck; |
1346 | #endif | 1374 | struct statistics_tx tx; |
1347 | } _agn; | 1375 | struct statistics_bt_activity bt_activity; |
1376 | } accum_stats, delta_stats, max_delta_stats; | ||
1348 | #endif | 1377 | #endif |
1349 | }; | 1378 | |
1379 | struct { | ||
1380 | /* INT ICT Table */ | ||
1381 | __le32 *ict_tbl; | ||
1382 | void *ict_tbl_vir; | ||
1383 | dma_addr_t ict_tbl_dma; | ||
1384 | dma_addr_t aligned_ict_tbl_dma; | ||
1385 | int ict_index; | ||
1386 | u32 inta; | ||
1387 | bool use_ict; | ||
1388 | /* | ||
1389 | * reporting the number of tids has AGG on. 0 means | ||
1390 | * no AGGREGATION | ||
1391 | */ | ||
1392 | u8 agg_tids_count; | ||
1393 | |||
1394 | struct iwl_rx_phy_res last_phy_res; | ||
1395 | bool last_phy_res_valid; | ||
1396 | |||
1397 | struct completion firmware_loading_complete; | ||
1398 | |||
1399 | u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; | ||
1400 | u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; | ||
1401 | |||
1402 | /* | ||
1403 | * chain noise reset and gain commands are the | ||
1404 | * two extra calibration commands follows the standard | ||
1405 | * phy calibration commands | ||
1406 | */ | ||
1407 | u8 phy_calib_chain_noise_reset_cmd; | ||
1408 | u8 phy_calib_chain_noise_gain_cmd; | ||
1409 | |||
1410 | /* counts reply_tx error */ | ||
1411 | struct reply_tx_error_statistics reply_tx_stats; | ||
1412 | struct reply_agg_tx_error_statistics reply_agg_tx_stats; | ||
1413 | /* notification wait support */ | ||
1414 | struct list_head notif_waits; | ||
1415 | spinlock_t notif_wait_lock; | ||
1416 | wait_queue_head_t notif_waitq; | ||
1417 | |||
1418 | /* remain-on-channel offload support */ | ||
1419 | struct ieee80211_channel *hw_roc_channel; | ||
1420 | struct delayed_work hw_roc_work; | ||
1421 | enum nl80211_channel_type hw_roc_chantype; | ||
1422 | int hw_roc_duration; | ||
1423 | bool hw_roc_setup; | ||
1424 | |||
1425 | struct sk_buff *offchan_tx_skb; | ||
1426 | int offchan_tx_timeout; | ||
1427 | struct ieee80211_channel *offchan_tx_chan; | ||
1428 | } _agn; | ||
1429 | |||
1430 | /* bt coex */ | ||
1431 | u8 bt_enable_flag; | ||
1432 | u8 bt_status; | ||
1433 | u8 bt_traffic_load, last_bt_traffic_load; | ||
1434 | bool bt_ch_announce; | ||
1435 | bool bt_full_concurrent; | ||
1436 | bool bt_ant_couple_ok; | ||
1437 | __le32 kill_ack_mask; | ||
1438 | __le32 kill_cts_mask; | ||
1439 | __le16 bt_valid; | ||
1440 | u16 bt_on_thresh; | ||
1441 | u16 bt_duration; | ||
1442 | u16 dynamic_frag_thresh; | ||
1443 | u8 bt_ci_compliance; | ||
1444 | struct work_struct bt_traffic_change_work; | ||
1350 | 1445 | ||
1351 | struct iwl_hw_params hw_params; | 1446 | struct iwl_hw_params hw_params; |
1352 | 1447 | ||
1353 | u32 inta_mask; | 1448 | u32 inta_mask; |
1354 | 1449 | ||
1355 | struct iwl_qos_info qos_data; | ||
1356 | |||
1357 | struct workqueue_struct *workqueue; | 1450 | struct workqueue_struct *workqueue; |
1358 | 1451 | ||
1359 | struct work_struct restart; | 1452 | struct work_struct restart; |
1360 | struct work_struct scan_completed; | 1453 | struct work_struct scan_completed; |
1361 | struct work_struct rx_replenish; | 1454 | struct work_struct rx_replenish; |
1362 | struct work_struct abort_scan; | 1455 | struct work_struct abort_scan; |
1456 | |||
1363 | struct work_struct beacon_update; | 1457 | struct work_struct beacon_update; |
1458 | struct iwl_rxon_context *beacon_ctx; | ||
1459 | struct sk_buff *beacon_skb; | ||
1460 | void *beacon_cmd; | ||
1461 | |||
1364 | struct work_struct tt_work; | 1462 | struct work_struct tt_work; |
1365 | struct work_struct ct_enter; | 1463 | struct work_struct ct_enter; |
1366 | struct work_struct ct_exit; | 1464 | struct work_struct ct_exit; |
1367 | struct work_struct start_internal_scan; | 1465 | struct work_struct start_internal_scan; |
1368 | struct work_struct tx_flush; | 1466 | struct work_struct tx_flush; |
1467 | struct work_struct bt_full_concurrency; | ||
1468 | struct work_struct bt_runtime_config; | ||
1369 | 1469 | ||
1370 | struct tasklet_struct irq_tasklet; | 1470 | struct tasklet_struct irq_tasklet; |
1371 | 1471 | ||
1372 | struct delayed_work init_alive_start; | ||
1373 | struct delayed_work alive_start; | ||
1374 | struct delayed_work scan_check; | 1472 | struct delayed_work scan_check; |
1375 | 1473 | ||
1376 | /* TX Power */ | 1474 | /* TX Power */ |
1377 | s8 tx_power_user_lmt; | 1475 | s8 tx_power_user_lmt; |
1378 | s8 tx_power_device_lmt; | 1476 | s8 tx_power_device_lmt; |
1379 | s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */ | 1477 | s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */ |
1478 | s8 tx_power_next; | ||
1380 | 1479 | ||
1381 | 1480 | ||
1382 | #ifdef CONFIG_IWLWIFI_DEBUG | 1481 | #ifdef CONFIG_IWLWIFI_DEBUG |
@@ -1398,14 +1497,21 @@ struct iwl_priv { | |||
1398 | struct work_struct txpower_work; | 1497 | struct work_struct txpower_work; |
1399 | u32 disable_sens_cal; | 1498 | u32 disable_sens_cal; |
1400 | u32 disable_chain_noise_cal; | 1499 | u32 disable_chain_noise_cal; |
1401 | u32 disable_tx_power_cal; | ||
1402 | struct work_struct run_time_calib_work; | 1500 | struct work_struct run_time_calib_work; |
1403 | struct timer_list statistics_periodic; | 1501 | struct timer_list statistics_periodic; |
1404 | struct timer_list ucode_trace; | 1502 | struct timer_list ucode_trace; |
1405 | struct timer_list monitor_recover; | 1503 | struct timer_list watchdog; |
1406 | bool hw_ready; | ||
1407 | 1504 | ||
1408 | struct iwl_event_log event_log; | 1505 | struct iwl_event_log event_log; |
1506 | |||
1507 | struct led_classdev led; | ||
1508 | unsigned long blink_on, blink_off; | ||
1509 | bool led_registered; | ||
1510 | #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL | ||
1511 | struct iwl_testmode_trace testmode_trace; | ||
1512 | #endif | ||
1513 | u32 dbg_fixed_rate; | ||
1514 | |||
1409 | }; /*iwl_priv */ | 1515 | }; /*iwl_priv */ |
1410 | 1516 | ||
1411 | static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) | 1517 | static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) |
@@ -1419,7 +1525,6 @@ static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) | |||
1419 | } | 1525 | } |
1420 | 1526 | ||
1421 | #ifdef CONFIG_IWLWIFI_DEBUG | 1527 | #ifdef CONFIG_IWLWIFI_DEBUG |
1422 | const char *iwl_get_tx_fail_reason(u32 status); | ||
1423 | /* | 1528 | /* |
1424 | * iwl_get_debug_level: Return active debug level for device | 1529 | * iwl_get_debug_level: Return active debug level for device |
1425 | * | 1530 | * |
@@ -1435,8 +1540,6 @@ static inline u32 iwl_get_debug_level(struct iwl_priv *priv) | |||
1435 | return iwl_debug_level; | 1540 | return iwl_debug_level; |
1436 | } | 1541 | } |
1437 | #else | 1542 | #else |
1438 | static inline const char *iwl_get_tx_fail_reason(u32 status) { return ""; } | ||
1439 | |||
1440 | static inline u32 iwl_get_debug_level(struct iwl_priv *priv) | 1543 | static inline u32 iwl_get_debug_level(struct iwl_priv *priv) |
1441 | { | 1544 | { |
1442 | return iwl_debug_level; | 1545 | return iwl_debug_level; |
@@ -1453,10 +1556,37 @@ static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv, | |||
1453 | return NULL; | 1556 | return NULL; |
1454 | } | 1557 | } |
1455 | 1558 | ||
1559 | static inline struct iwl_rxon_context * | ||
1560 | iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) | ||
1561 | { | ||
1562 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | ||
1563 | |||
1564 | return vif_priv->ctx; | ||
1565 | } | ||
1566 | |||
1567 | #define for_each_context(priv, ctx) \ | ||
1568 | for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ | ||
1569 | ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ | ||
1570 | if (priv->valid_contexts & BIT(ctx->ctxid)) | ||
1571 | |||
1572 | static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) | ||
1573 | { | ||
1574 | return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; | ||
1575 | } | ||
1576 | |||
1577 | static inline int iwl_is_associated(struct iwl_priv *priv, | ||
1578 | enum iwl_rxon_context_id ctxid) | ||
1579 | { | ||
1580 | return iwl_is_associated_ctx(&priv->contexts[ctxid]); | ||
1581 | } | ||
1456 | 1582 | ||
1457 | static inline int iwl_is_associated(struct iwl_priv *priv) | 1583 | static inline int iwl_is_any_associated(struct iwl_priv *priv) |
1458 | { | 1584 | { |
1459 | return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; | 1585 | struct iwl_rxon_context *ctx; |
1586 | for_each_context(priv, ctx) | ||
1587 | if (iwl_is_associated_ctx(ctx)) | ||
1588 | return true; | ||
1589 | return false; | ||
1460 | } | 1590 | } |
1461 | 1591 | ||
1462 | static inline int is_channel_valid(const struct iwl_channel_info *ch_info) | 1592 | static inline int is_channel_valid(const struct iwl_channel_info *ch_info) |
@@ -1494,12 +1624,10 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) | |||
1494 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) | 1624 | static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page) |
1495 | { | 1625 | { |
1496 | __free_pages(page, priv->hw_params.rx_page_order); | 1626 | __free_pages(page, priv->hw_params.rx_page_order); |
1497 | priv->alloc_rxb_page--; | ||
1498 | } | 1627 | } |
1499 | 1628 | ||
1500 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) | 1629 | static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page) |
1501 | { | 1630 | { |
1502 | free_pages(page, priv->hw_params.rx_page_order); | 1631 | free_pages(page, priv->hw_params.rx_page_order); |
1503 | priv->alloc_rxb_page--; | ||
1504 | } | 1632 | } |
1505 | #endif /* __iwl_dev_h__ */ | 1633 | #endif /* __iwl_dev_h__ */ |