1 /******************************************************************************
3 * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved.
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.
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
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
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * Intel Linux Wireless <ilw@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 *****************************************************************************/
27 * Please use this file (dev.h) for driver implementation definitions.
28 * Please use commands.h for uCode API definitions.
34 #include <linux/interrupt.h>
35 #include <linux/kernel.h>
36 #include <linux/wait.h>
37 #include <linux/leds.h>
38 #include <linux/slab.h>
39 #include <linux/mutex.h>
42 #include "iwl-eeprom-parse.h"
44 #include "iwl-debug.h"
45 #include "iwl-agn-hw.h"
46 #include "iwl-op-mode.h"
47 #include "iwl-notif-wait.h"
48 #include "iwl-trans.h"
57 /* CT-KILL constants */
58 #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
59 #define CT_KILL_THRESHOLD 114 /* in Celsius */
60 #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */
62 /* Default noise level to report when noise measurement is not available.
63 * This may be because we're:
64 * 1) Not associated no beacon statistics being sent to driver)
65 * 2) Scanning (noise measurement does not apply to associated channel)
66 * Use default noise value of -127 ... this is below the range of measurable
67 * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user.
68 * Also, -127 works better than 0 when averaging frames with/without
69 * noise info (e.g. averaging might be done in app); measured dBm values are
70 * always negative ... using a negative value as the default keeps all
71 * averages within an s8's (used in some apps) range of negative values. */
72 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
75 * RTS threshold here is total size [2347] minus 4 FCS bytes
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
82 #define DEFAULT_RTS_THRESHOLD 2347U
83 #define MIN_RTS_THRESHOLD 0U
84 #define MAX_RTS_THRESHOLD 2347U
85 #define MAX_MSDU_SIZE 2304U
86 #define MAX_MPDU_SIZE 2346U
87 #define DEFAULT_BEACON_INTERVAL 200U
88 #define DEFAULT_SHORT_RETRY_LIMIT 7U
89 #define DEFAULT_LONG_RETRY_LIMIT 4U
91 #define IWL_NUM_SCAN_RATES (2)
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)
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
103 #define IWL_SUPPORTED_RATES_IE_LEN 8
105 #define IWL_INVALID_RATE 0xFF
106 #define IWL_INVALID_VALUE -1
108 union iwl_ht_rate_supp {
116 struct iwl_ht_config {
117 bool single_chain_sufficient;
118 enum ieee80211_smps_mode smps; /* current smps mode */
122 struct iwl_qos_info {
124 struct iwl_qosparam_cmd def_qos_parm;
130 * The state machine of the BA agreement establishment / tear down.
131 * These states relate to a specific RA / TID.
133 * @IWL_AGG_OFF: aggregation is not used
134 * @IWL_AGG_STARTING: aggregation are starting (between start and oper)
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.
145 IWL_EMPTYING_HW_QUEUE_ADDBA,
146 IWL_EMPTYING_HW_QUEUE_DELBA,
150 * struct iwl_ht_agg - aggregation state machine
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.
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.
160 * @txq_id: Tx queue used by the BA session
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
169 enum iwl_agg_state state;
176 * struct iwl_tid_data - one for each RA / TID
178 * This structs holds the states for each RA / TID.
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
185 struct iwl_tid_data {
188 struct iwl_ht_agg agg;
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
197 struct iwl_station_entry {
198 struct iwl_addsta_cmd sta;
200 struct iwl_link_quality_cmd *lq;
204 * iwl_station_priv: Driver's private station information
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
210 struct iwl_station_priv {
211 struct iwl_rxon_context *ctx;
212 struct iwl_lq_sta lq_sta;
213 atomic_t pending_frames;
221 * struct iwl_vif_priv - driver's private per-interface information
223 * When mac80211 allocates a virtual interface, it can allocate
224 * space for us to put data into.
226 struct iwl_vif_priv {
227 struct iwl_rxon_context *ctx;
228 u8 ibss_bssid_sta_id;
231 struct iwl_sensitivity_ranges {
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;
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;
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;
252 u16 barker_corr_th_min;
253 u16 barker_corr_th_min_mrc;
258 #define KELVIN_TO_CELSIUS(x) ((x)-273)
259 #define CELSIUS_TO_KELVIN(x) ((x)+273)
262 /******************************************************************************
264 * Functions implemented in core module which are forward declared here
265 * for use by iwl-[4-5].c
267 * NOTE: The implementation of these functions are not hardware specific
268 * which is why they are in the core module files.
270 * Naming convention --
271 * iwl_ <-- Is part of iwlwifi
272 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
274 ****************************************************************************/
275 extern void iwl_update_chain_flags(struct iwl_priv *priv);
276 extern const u8 iwl_bcast_addr[ETH_ALEN];
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
283 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
285 /* Sensitivity and chain noise calibration */
286 #define INITIALIZATION_VALUE 0xFFFF
287 #define IWL_CAL_NUM_BEACONS 16
288 #define MAXIMUM_ALLOWED_PATHLOSS 15
290 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
292 #define MAX_FA_OFDM 50
293 #define MIN_FA_OFDM 5
294 #define MAX_FA_CCK 50
297 #define AUTO_CORR_STEP_OFDM 1
299 #define AUTO_CORR_STEP_CCK 3
300 #define AUTO_CORR_MAX_TH_CCK 160
303 #define NRG_STEP_CCK 2
305 #define MAX_NUMBER_CCK_NO_FA 100
307 #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
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
317 #define NRG_NUM_PREV_STAT_L 20
318 #define NUM_RX_CHAINS 3
320 enum iwlagn_false_alarm_state {
323 IWL_FA_GOOD_RANGE = 2,
326 enum iwlagn_chain_noise_state {
327 IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
328 IWL_CHAIN_NOISE_ACCUMULATE,
329 IWL_CHAIN_NOISE_CALIBRATED,
330 IWL_CHAIN_NOISE_DONE,
333 /* Sensitivity calib data */
334 struct iwl_sensitivity_data {
336 u32 auto_corr_ofdm_mrc;
337 u32 auto_corr_ofdm_x1;
338 u32 auto_corr_ofdm_mrc_x1;
340 u32 auto_corr_cck_mrc;
342 u32 last_bad_plcp_cnt_ofdm;
343 u32 last_fa_cnt_ofdm;
344 u32 last_bad_plcp_cnt_cck;
350 u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L];
355 s32 nrg_auto_corr_silence_diff;
356 u32 num_in_cck_no_fa;
359 u16 barker_corr_th_min;
360 u16 barker_corr_th_min_mrc;
364 /* Chain noise (differential Rx gain) calib data */
365 struct iwl_chain_noise_data {
374 u8 disconn_array[NUM_RX_CHAINS];
375 u8 delta_gain_code[NUM_RX_CHAINS];
381 MEASUREMENT_READY = (1 << 0),
382 MEASUREMENT_ACTIVE = (1 << 1),
385 /* reply_tx_statistics (for _agn devices) */
386 struct reply_tx_error_statistics {
392 u32 int_crossed_retry;
408 u32 sta_color_mismatch;
412 /* reply_agg_tx_statistics (for _agn devices) */
413 struct reply_agg_tx_error_statistics {
420 u32 last_sent_bt_kill;
430 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
431 * to perform continuous uCode event logging operation if enabled
433 #define UCODE_TRACE_PERIOD (10)
436 * iwl_event_log: current uCode event log position
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
446 struct iwl_event_log {
451 int wraps_once_count;
452 int wraps_more_count;
455 #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
457 /* BT Antenna Coupling Threshold (dB) */
458 #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
460 /* Firmware reload counter and Timestamp */
461 #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */
462 #define IWL_MAX_CONTINUE_RELOAD_CNT 4
465 struct iwl_rf_reset {
466 int reset_request_count;
467 int reset_success_count;
468 int reset_reject_count;
469 unsigned long last_reset_jiffies;
472 enum iwl_rxon_context_id {
479 /* extend beacon time format bit shifting */
482 * bits 31:22 - extended
483 * bits 21:0 - interval
485 #define IWLAGN_EXT_BEACON_TIME_POS 22
487 struct iwl_rxon_context {
488 struct ieee80211_vif *vif;
491 u8 ac_to_queue[IEEE80211_NUM_ACS];
492 u8 ac_to_fifo[IEEE80211_NUM_ACS];
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.
499 bool always_active, is_active;
501 bool ht_need_multiple_chains;
503 enum iwl_rxon_context_id ctxid;
505 u32 interface_modes, exclusive_interface_modes;
506 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype;
509 * We declare this const so it can only be
510 * changed via explicit cast within the
511 * routines that actually update the physical
514 const struct iwl_rxon_cmd active;
515 struct iwl_rxon_cmd staging;
517 struct iwl_rxon_time_cmd timing;
519 struct iwl_qos_info qos_data;
521 u8 bcast_sta_id, ap_sta_id;
523 u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
527 struct iwl_wep_key wep_keys[WEP_KEYS_MAX];
530 __le32 station_flags;
535 bool non_gf_sta_present;
537 bool enabled, is_40mhz;
538 u8 extension_chan_offset;
544 IWL_SCAN_RADIO_RESET,
549 * struct iwl_hw_params
551 * Holds the module parameters
553 * @tx_chains_num: Number of TX chains
554 * @rx_chains_num: Number of RX chains
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
561 struct iwl_hw_params {
564 bool use_rts_for_aggregation;
565 u32 ct_kill_threshold;
566 u32 ct_kill_exit_threshold;
568 const struct iwl_sensitivity_ranges *sens;
572 * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters
573 * @advanced_bt_coexist: support advanced bt coexist
574 * @bt_init_traffic_load: specify initial bt traffic load
575 * @bt_prio_boost: default bt priority boost value
576 * @agg_time_limit: maximum number of uSec in aggregation
577 * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
579 struct iwl_dvm_bt_params {
580 bool advanced_bt_coexist;
581 u8 bt_init_traffic_load;
589 * struct iwl_dvm_cfg - DVM firmware specific device configuration
590 * @set_hw_params: set hardware parameters
591 * @set_channel_switch: send channel switch command
592 * @nic_config: apply device specific configuration
593 * @temperature: read temperature
594 * @adv_thermal_throttle: support advance thermal throttle
595 * @support_ct_kill_exit: support ct kill exit condition
596 * @plcp_delta_threshold: plcp error rate threshold used to trigger
597 * radio tuning when there is a high receiving plcp error rate
598 * @chain_noise_scale: default chain noise scale used for gain computation
599 * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
600 * @no_idle_support: do not support idle mode
601 * @bt_params: pointer to BT parameters
602 * @need_temp_offset_calib: need to perform temperature offset calibration
603 * @no_xtal_calib: some devices do not need crystal calibration data,
604 * don't send it to those
605 * @temp_offset_v2: support v2 of temperature offset calibration
606 * @adv_pm: advanced power management
609 void (*set_hw_params)(struct iwl_priv *priv);
610 int (*set_channel_switch)(struct iwl_priv *priv,
611 struct ieee80211_channel_switch *ch_switch);
612 void (*nic_config)(struct iwl_priv *priv);
613 void (*temperature)(struct iwl_priv *priv);
615 const struct iwl_dvm_bt_params *bt_params;
616 s32 chain_noise_scale;
617 u8 plcp_delta_threshold;
618 bool adv_thermal_throttle;
619 bool support_ct_kill_exit;
621 bool no_idle_support;
622 bool need_temp_offset_calib;
628 struct iwl_wipan_noa_data {
629 struct rcu_head rcu_head;
634 /* Calibration disabling bit mask */
636 IWL_CALIB_ENABLE_ALL = 0,
638 IWL_SENSITIVITY_CALIB_DISABLED = BIT(0),
639 IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1),
640 IWL_TX_POWER_CALIB_DISABLED = BIT(2),
642 IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF,
645 #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
646 ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
648 #define IWL_MAC80211_GET_DVM(_hw) \
649 ((struct iwl_priv *) ((struct iwl_op_mode *) \
650 (_hw)->priv)->op_mode_specific)
654 struct iwl_trans *trans;
655 struct device *dev; /* for debug prints only */
656 const struct iwl_cfg *cfg;
657 const struct iwl_fw *fw;
658 const struct iwl_dvm_cfg *lib;
659 unsigned long status;
664 unsigned long transport_queue_stop;
666 #define IWL_INVALID_MAC80211_QUEUE 0xff
667 u8 queue_to_mac80211[IWL_MAX_HW_QUEUES];
668 atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
670 unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
672 /* ieee device used by generic ieee processing code */
673 struct ieee80211_hw *hw;
675 struct list_head calib_results;
677 struct workqueue_struct *workqueue;
679 struct iwl_hw_params hw_params;
681 enum ieee80211_band band;
684 int (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
685 struct iwl_rx_cmd_buffer *rxb,
686 struct iwl_device_cmd *cmd);
688 struct iwl_notif_wait_data notif_wait;
690 /* spectrum measurement report caching */
691 struct iwl_spectrum_notification measure_report;
692 u8 measurement_status;
694 #define IWL_OWNERSHIP_DRIVER 0
695 #define IWL_OWNERSHIP_TM 1
698 /* ucode beacon time */
699 u32 ucode_beacon_time;
700 int missed_beacon_threshold;
702 /* track IBSS manager (last beacon) status */
705 /* jiffies when last recovery from statistics was performed */
706 unsigned long rx_statistics_jiffies;
709 u32 rx_handlers_stats[REPLY_MAX];
712 struct iwl_rf_reset rf_reset;
714 /* firmware reload counter and timestamp */
715 unsigned long reload_jiffies;
718 bool init_ucode_run; /* Don't run init uCode again */
720 u8 plcp_delta_threshold;
722 /* thermal calibration */
723 s32 temperature; /* Celsius */
724 s32 last_temperature;
726 struct iwl_wipan_noa_data __rcu *noa_data;
728 /* Scan related variables */
729 unsigned long scan_start;
730 unsigned long scan_start_tsf;
732 enum ieee80211_band scan_band;
733 struct cfg80211_scan_request *scan_request;
734 struct ieee80211_vif *scan_vif;
735 enum iwl_scan_type scan_type;
736 u8 scan_tx_ant[IEEE80211_NUM_BANDS];
739 /* max number of station keys */
742 bool new_scan_threshold_behaviour;
746 /* EEPROM MAC addresses */
747 struct mac_address addresses[2];
749 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
751 __le16 switch_channel;
754 struct iwl_sensitivity_data sensitivity_data;
755 struct iwl_chain_noise_data chain_noise_data;
756 __le16 sensitivity_tbl[HD_TABLE_SIZE];
757 __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES];
759 struct iwl_ht_config current_ht_config;
761 /* Rate scaling data */
764 int activity_timer_active;
766 struct iwl_power_mgr power_data;
767 struct iwl_tt_mgmt thermal_throttle;
769 /* station table variables */
771 struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
772 unsigned long ucode_key_table;
773 struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
774 atomic_t num_aux_in_flight;
776 u8 mac80211_registered;
778 /* Indication if ieee80211_ops->open has been called */
781 enum nl80211_iftype iw_mode;
783 /* Last Rx'd beacon timestamp */
788 struct statistics_general_common common;
789 struct statistics_rx_non_phy rx_non_phy;
790 struct statistics_rx_phy rx_ofdm;
791 struct statistics_rx_ht_phy rx_ofdm_ht;
792 struct statistics_rx_phy rx_cck;
793 struct statistics_tx tx;
794 #ifdef CONFIG_IWLWIFI_DEBUGFS
795 struct statistics_bt_activity bt_activity;
796 __le32 num_bt_kills, accum_num_bt_kills;
800 #ifdef CONFIG_IWLWIFI_DEBUGFS
802 struct statistics_general_common common;
803 struct statistics_rx_non_phy rx_non_phy;
804 struct statistics_rx_phy rx_ofdm;
805 struct statistics_rx_ht_phy rx_ofdm_ht;
806 struct statistics_rx_phy rx_cck;
807 struct statistics_tx tx;
808 struct statistics_bt_activity bt_activity;
809 } accum_stats, delta_stats, max_delta_stats;
813 * reporting the number of tids has AGG on. 0 means
818 struct iwl_rx_phy_res last_phy_res;
820 bool last_phy_res_valid;
823 * chain noise reset and gain commands are the
824 * two extra calibration commands follows the standard
825 * phy calibration commands
827 u8 phy_calib_chain_noise_reset_cmd;
828 u8 phy_calib_chain_noise_gain_cmd;
830 /* counts reply_tx error */
831 struct reply_tx_error_statistics reply_tx_stats;
832 struct reply_agg_tx_error_statistics reply_agg_tx_stats;
834 /* remain-on-channel offload support */
835 struct ieee80211_channel *hw_roc_channel;
836 struct delayed_work hw_roc_disable_work;
838 bool hw_roc_setup, hw_roc_start_notified;
843 u8 bt_traffic_load, last_bt_traffic_load;
845 bool bt_full_concurrent;
846 bool bt_ant_couple_ok;
847 __le32 kill_ack_mask;
848 __le32 kill_cts_mask;
850 bool reduced_txpower;
853 u16 dynamic_frag_thresh;
855 struct work_struct bt_traffic_change_work;
856 bool bt_enable_pspoll;
857 struct iwl_rxon_context *cur_rssi_ctx;
860 struct work_struct restart;
861 struct work_struct scan_completed;
862 struct work_struct abort_scan;
864 struct work_struct beacon_update;
865 struct iwl_rxon_context *beacon_ctx;
866 struct sk_buff *beacon_skb;
869 struct work_struct tt_work;
870 struct work_struct ct_enter;
871 struct work_struct ct_exit;
872 struct work_struct start_internal_scan;
873 struct work_struct tx_flush;
874 struct work_struct bt_full_concurrency;
875 struct work_struct bt_runtime_config;
877 struct delayed_work scan_check;
879 /* TX Power settings */
880 s8 tx_power_user_lmt;
883 #ifdef CONFIG_IWLWIFI_DEBUGFS
885 struct dentry *debugfs_dir;
886 u32 dbgfs_sram_offset, dbgfs_sram_len;
889 #endif /* CONFIG_IWLWIFI_DEBUGFS */
891 struct iwl_nvm_data *nvm_data;
892 /* eeprom blob for debugfs/testmode */
894 size_t eeprom_blob_size;
896 struct work_struct txpower_work;
898 struct work_struct run_time_calib_work;
899 struct timer_list statistics_periodic;
900 struct timer_list ucode_trace;
902 struct iwl_event_log event_log;
904 struct led_classdev led;
905 unsigned long blink_on, blink_off;
908 #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE
913 /* WoWLAN GTK rekey data */
914 u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
917 bool have_rekey_data;
919 /* device_pointers: pointers to ucode event tables */
921 u32 error_event_table;
925 /* indicator of loaded ucode image */
926 enum iwl_ucode_type cur_ucode;
929 static inline struct iwl_rxon_context *
930 iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)
932 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
934 return vif_priv->ctx;
937 #define for_each_context(priv, ctx) \
938 for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
939 ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
940 if (priv->valid_contexts & BIT(ctx->ctxid))
942 static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
944 return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
947 static inline int iwl_is_associated(struct iwl_priv *priv,
948 enum iwl_rxon_context_id ctxid)
950 return iwl_is_associated_ctx(&priv->contexts[ctxid]);
953 static inline int iwl_is_any_associated(struct iwl_priv *priv)
955 struct iwl_rxon_context *ctx;
956 for_each_context(priv, ctx)
957 if (iwl_is_associated_ctx(ctx))
962 #endif /* __iwl_dev_h__ */