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