1 /******************************************************************************
3 * Copyright(c) 2003 - 2014 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 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
17 * Contact Information:
18 * Intel Linux Wireless <linuxwifi@intel.com>
19 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
21 *****************************************************************************/
23 * Please use this file (dev.h) for driver implementation definitions.
24 * Please use commands.h for uCode API definitions.
30 #include <linux/interrupt.h>
31 #include <linux/kernel.h>
32 #include <linux/wait.h>
33 #include <linux/leds.h>
34 #include <linux/slab.h>
35 #include <linux/mutex.h>
38 #include "iwl-eeprom-parse.h"
40 #include "iwl-debug.h"
41 #include "iwl-agn-hw.h"
42 #include "iwl-op-mode.h"
43 #include "fw/notif-wait.h"
44 #include "iwl-trans.h"
51 /* CT-KILL constants */
52 #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
53 #define CT_KILL_THRESHOLD 114 /* in Celsius */
54 #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */
56 /* Default noise level to report when noise measurement is not available.
57 * This may be because we're:
58 * 1) Not associated no beacon statistics being sent to driver)
59 * 2) Scanning (noise measurement does not apply to associated channel)
60 * Use default noise value of -127 ... this is below the range of measurable
61 * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user.
62 * Also, -127 works better than 0 when averaging frames with/without
63 * noise info (e.g. averaging might be done in app); measured dBm values are
64 * always negative ... using a negative value as the default keeps all
65 * averages within an s8's (used in some apps) range of negative values. */
66 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
69 * RTS threshold here is total size [2347] minus 4 FCS bytes
71 * a value of 0 means RTS on all data/management packets
72 * a value > max MSDU size means no RTS
73 * else RTS for data/management frames where MPDU is larger
76 #define DEFAULT_RTS_THRESHOLD 2347U
77 #define MIN_RTS_THRESHOLD 0U
78 #define MAX_RTS_THRESHOLD 2347U
79 #define MAX_MSDU_SIZE 2304U
80 #define MAX_MPDU_SIZE 2346U
81 #define DEFAULT_BEACON_INTERVAL 200U
82 #define DEFAULT_SHORT_RETRY_LIMIT 7U
83 #define DEFAULT_LONG_RETRY_LIMIT 4U
85 #define IWL_NUM_SCAN_RATES (2)
88 #define IEEE80211_DATA_LEN 2304
89 #define IEEE80211_4ADDR_LEN 30
90 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
91 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
93 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
94 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
95 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
97 #define IWL_SUPPORTED_RATES_IE_LEN 8
99 #define IWL_INVALID_RATE 0xFF
100 #define IWL_INVALID_VALUE -1
102 union iwl_ht_rate_supp {
110 struct iwl_ht_config {
111 bool single_chain_sufficient;
112 enum ieee80211_smps_mode smps; /* current smps mode */
116 struct iwl_qos_info {
118 struct iwl_qosparam_cmd def_qos_parm;
124 * The state machine of the BA agreement establishment / tear down.
125 * These states relate to a specific RA / TID.
127 * @IWL_AGG_OFF: aggregation is not used
128 * @IWL_AGG_STARTING: aggregation are starting (between start and oper)
129 * @IWL_AGG_ON: aggregation session is up
130 * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
131 * HW queue to be empty from packets for this RA /TID.
132 * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
133 * HW queue to be empty from packets for this RA /TID.
139 IWL_EMPTYING_HW_QUEUE_ADDBA,
140 IWL_EMPTYING_HW_QUEUE_DELBA,
144 * struct iwl_ht_agg - aggregation state machine
146 * This structs holds the states for the BA agreement establishment and tear
147 * down. It also holds the state during the BA session itself. This struct is
148 * duplicated for each RA / TID.
150 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
151 * Tx response (REPLY_TX), and the block ack notification
152 * (REPLY_COMPRESSED_BA).
153 * @state: state of the BA agreement establishment / tear down.
154 * @txq_id: Tx queue used by the BA session
155 * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
156 * the first packet to be sent in legacy HW queue in Tx AGG stop flow.
157 * Basically when next_reclaimed reaches ssn, we can tell mac80211 that
158 * we are ready to finish the Tx AGG stop / start flow.
159 * @wait_for_ba: Expect block-ack before next Tx reply
163 enum iwl_agg_state state;
170 * struct iwl_tid_data - one for each RA / TID
172 * This structs holds the states for each RA / TID.
174 * @seq_number: the next WiFi sequence number to use
175 * @next_reclaimed: the WiFi sequence number of the next packet to be acked.
176 * This is basically (last acked packet++).
177 * @agg: aggregation state machine
179 struct iwl_tid_data {
182 struct iwl_ht_agg agg;
186 * Structure should be accessed with sta_lock held. When station addition
187 * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only
188 * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock
191 struct iwl_station_entry {
192 struct iwl_addsta_cmd sta;
194 struct iwl_link_quality_cmd *lq;
198 * iwl_station_priv: Driver's private station information
200 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
201 * in the structure for use by driver. This structure is places in that
204 struct iwl_station_priv {
205 struct iwl_rxon_context *ctx;
206 struct iwl_lq_sta lq_sta;
207 atomic_t pending_frames;
215 * struct iwl_vif_priv - driver's private per-interface information
217 * When mac80211 allocates a virtual interface, it can allocate
218 * space for us to put data into.
220 struct iwl_vif_priv {
221 struct iwl_rxon_context *ctx;
222 u8 ibss_bssid_sta_id;
225 struct iwl_sensitivity_ranges {
231 u16 auto_corr_min_ofdm;
232 u16 auto_corr_min_ofdm_mrc;
233 u16 auto_corr_min_ofdm_x1;
234 u16 auto_corr_min_ofdm_mrc_x1;
236 u16 auto_corr_max_ofdm;
237 u16 auto_corr_max_ofdm_mrc;
238 u16 auto_corr_max_ofdm_x1;
239 u16 auto_corr_max_ofdm_mrc_x1;
241 u16 auto_corr_max_cck;
242 u16 auto_corr_max_cck_mrc;
243 u16 auto_corr_min_cck;
244 u16 auto_corr_min_cck_mrc;
246 u16 barker_corr_th_min;
247 u16 barker_corr_th_min_mrc;
252 #define KELVIN_TO_CELSIUS(x) ((x)-273)
253 #define CELSIUS_TO_KELVIN(x) ((x)+273)
256 /******************************************************************************
258 * Functions implemented in core module which are forward declared here
259 * for use by iwl-[4-5].c
261 * NOTE: The implementation of these functions are not hardware specific
262 * which is why they are in the core module files.
264 * Naming convention --
265 * iwl_ <-- Is part of iwlwifi
266 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
268 ****************************************************************************/
269 void iwl_update_chain_flags(struct iwl_priv *priv);
270 extern const u8 iwl_bcast_addr[ETH_ALEN];
272 #define IWL_OPERATION_MODE_AUTO 0
273 #define IWL_OPERATION_MODE_HT_ONLY 1
274 #define IWL_OPERATION_MODE_MIXED 2
275 #define IWL_OPERATION_MODE_20MHZ 3
277 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
279 /* Sensitivity and chain noise calibration */
280 #define INITIALIZATION_VALUE 0xFFFF
281 #define IWL_CAL_NUM_BEACONS 16
282 #define MAXIMUM_ALLOWED_PATHLOSS 15
284 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
286 #define MAX_FA_OFDM 50
287 #define MIN_FA_OFDM 5
288 #define MAX_FA_CCK 50
291 #define AUTO_CORR_STEP_OFDM 1
293 #define AUTO_CORR_STEP_CCK 3
294 #define AUTO_CORR_MAX_TH_CCK 160
297 #define NRG_STEP_CCK 2
299 #define MAX_NUMBER_CCK_NO_FA 100
301 #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
306 #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
307 #define ALL_BAND_FILTER 0xFF00
308 #define IN_BAND_FILTER 0xFF
309 #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
311 #define NRG_NUM_PREV_STAT_L 20
312 #define NUM_RX_CHAINS 3
314 enum iwlagn_false_alarm_state {
317 IWL_FA_GOOD_RANGE = 2,
320 enum iwlagn_chain_noise_state {
321 IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
322 IWL_CHAIN_NOISE_ACCUMULATE,
323 IWL_CHAIN_NOISE_CALIBRATED,
324 IWL_CHAIN_NOISE_DONE,
327 /* Sensitivity calib data */
328 struct iwl_sensitivity_data {
330 u32 auto_corr_ofdm_mrc;
331 u32 auto_corr_ofdm_x1;
332 u32 auto_corr_ofdm_mrc_x1;
334 u32 auto_corr_cck_mrc;
336 u32 last_bad_plcp_cnt_ofdm;
337 u32 last_fa_cnt_ofdm;
338 u32 last_bad_plcp_cnt_cck;
344 u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L];
349 s32 nrg_auto_corr_silence_diff;
350 u32 num_in_cck_no_fa;
353 u16 barker_corr_th_min;
354 u16 barker_corr_th_min_mrc;
358 /* Chain noise (differential Rx gain) calib data */
359 struct iwl_chain_noise_data {
368 u8 disconn_array[NUM_RX_CHAINS];
369 u8 delta_gain_code[NUM_RX_CHAINS];
375 MEASUREMENT_READY = (1 << 0),
376 MEASUREMENT_ACTIVE = (1 << 1),
379 /* reply_tx_statistics (for _agn devices) */
380 struct reply_tx_error_statistics {
386 u32 int_crossed_retry;
402 u32 sta_color_mismatch;
406 /* reply_agg_tx_statistics (for _agn devices) */
407 struct reply_agg_tx_error_statistics {
414 u32 last_sent_bt_kill;
424 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
425 * to perform continuous uCode event logging operation if enabled
427 #define UCODE_TRACE_PERIOD (10)
430 * iwl_event_log: current uCode event log position
432 * @ucode_trace: enable/disable ucode continuous trace timer
433 * @num_wraps: how many times the event buffer wraps
434 * @next_entry: the entry just before the next one that uCode would fill
435 * @non_wraps_count: counter for no wrap detected when dump ucode events
436 * @wraps_once_count: counter for wrap once detected when dump ucode events
437 * @wraps_more_count: counter for wrap more than once detected
438 * when dump ucode events
440 struct iwl_event_log {
445 int wraps_once_count;
446 int wraps_more_count;
449 #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
451 /* BT Antenna Coupling Threshold (dB) */
452 #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
454 /* Firmware reload counter and Timestamp */
455 #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */
456 #define IWL_MAX_CONTINUE_RELOAD_CNT 4
459 struct iwl_rf_reset {
460 int reset_request_count;
461 int reset_success_count;
462 int reset_reject_count;
463 unsigned long last_reset_jiffies;
466 enum iwl_rxon_context_id {
473 /* extend beacon time format bit shifting */
476 * bits 31:22 - extended
477 * bits 21:0 - interval
479 #define IWLAGN_EXT_BEACON_TIME_POS 22
481 struct iwl_rxon_context {
482 struct ieee80211_vif *vif;
485 u8 ac_to_queue[IEEE80211_NUM_ACS];
486 u8 ac_to_fifo[IEEE80211_NUM_ACS];
489 * We could use the vif to indicate active, but we
490 * also need it to be active during disabling when
491 * we already removed the vif for type setting.
493 bool always_active, is_active;
495 bool ht_need_multiple_chains;
497 enum iwl_rxon_context_id ctxid;
499 u32 interface_modes, exclusive_interface_modes;
500 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype;
503 * We declare this const so it can only be
504 * changed via explicit cast within the
505 * routines that actually update the physical
508 const struct iwl_rxon_cmd active;
509 struct iwl_rxon_cmd staging;
511 struct iwl_rxon_time_cmd timing;
513 struct iwl_qos_info qos_data;
515 u8 bcast_sta_id, ap_sta_id;
517 u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
521 struct iwl_wep_key wep_keys[WEP_KEYS_MAX];
524 __le32 station_flags;
529 bool non_gf_sta_present;
531 bool enabled, is_40mhz;
532 u8 extension_chan_offset;
538 IWL_SCAN_RADIO_RESET,
542 * struct iwl_hw_params
544 * Holds the module parameters
546 * @tx_chains_num: Number of TX chains
547 * @rx_chains_num: Number of RX chains
548 * @ct_kill_threshold: temperature threshold - in hw dependent unit
549 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
550 * relevant for 1000, 6000 and up
551 * @struct iwl_sensitivity_ranges: range of sensitivity values
552 * @use_rts_for_aggregation: use rts/cts protection for HT traffic
554 struct iwl_hw_params {
557 bool use_rts_for_aggregation;
558 u32 ct_kill_threshold;
559 u32 ct_kill_exit_threshold;
561 const struct iwl_sensitivity_ranges *sens;
565 * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters
566 * @advanced_bt_coexist: support advanced bt coexist
567 * @bt_init_traffic_load: specify initial bt traffic load
568 * @bt_prio_boost: default bt priority boost value
569 * @agg_time_limit: maximum number of uSec in aggregation
570 * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
572 struct iwl_dvm_bt_params {
573 bool advanced_bt_coexist;
574 u8 bt_init_traffic_load;
582 * struct iwl_dvm_cfg - DVM firmware specific device configuration
583 * @set_hw_params: set hardware parameters
584 * @set_channel_switch: send channel switch command
585 * @nic_config: apply device specific configuration
586 * @temperature: read temperature
587 * @adv_thermal_throttle: support advance thermal throttle
588 * @support_ct_kill_exit: support ct kill exit condition
589 * @plcp_delta_threshold: plcp error rate threshold used to trigger
590 * radio tuning when there is a high receiving plcp error rate
591 * @chain_noise_scale: default chain noise scale used for gain computation
592 * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
593 * @no_idle_support: do not support idle mode
594 * @bt_params: pointer to BT parameters
595 * @need_temp_offset_calib: need to perform temperature offset calibration
596 * @no_xtal_calib: some devices do not need crystal calibration data,
597 * don't send it to those
598 * @temp_offset_v2: support v2 of temperature offset calibration
599 * @adv_pm: advanced power management
602 void (*set_hw_params)(struct iwl_priv *priv);
603 int (*set_channel_switch)(struct iwl_priv *priv,
604 struct ieee80211_channel_switch *ch_switch);
605 void (*nic_config)(struct iwl_priv *priv);
606 void (*temperature)(struct iwl_priv *priv);
608 const struct iwl_dvm_bt_params *bt_params;
609 s32 chain_noise_scale;
610 u8 plcp_delta_threshold;
611 bool adv_thermal_throttle;
612 bool support_ct_kill_exit;
614 bool no_idle_support;
615 bool need_temp_offset_calib;
621 struct iwl_wipan_noa_data {
622 struct rcu_head rcu_head;
627 /* Calibration disabling bit mask */
629 IWL_CALIB_ENABLE_ALL = 0,
631 IWL_SENSITIVITY_CALIB_DISABLED = BIT(0),
632 IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1),
633 IWL_TX_POWER_CALIB_DISABLED = BIT(2),
635 IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF,
638 #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
639 ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
641 #define IWL_MAC80211_GET_DVM(_hw) \
642 ((struct iwl_priv *) ((struct iwl_op_mode *) \
643 (_hw)->priv)->op_mode_specific)
647 struct iwl_trans *trans;
648 struct device *dev; /* for debug prints only */
649 const struct iwl_cfg *cfg;
650 const struct iwl_fw *fw;
651 const struct iwl_dvm_cfg *lib;
652 unsigned long status;
657 unsigned long transport_queue_stop;
659 #define IWL_INVALID_MAC80211_QUEUE 0xff
660 u8 queue_to_mac80211[IWL_MAX_HW_QUEUES];
661 atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
663 unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
665 /* ieee device used by generic ieee processing code */
666 struct ieee80211_hw *hw;
668 struct napi_struct *napi;
670 struct list_head calib_results;
672 struct workqueue_struct *workqueue;
674 struct iwl_hw_params hw_params;
676 enum nl80211_band band;
679 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
680 struct iwl_rx_cmd_buffer *rxb);
682 struct iwl_notif_wait_data notif_wait;
684 /* spectrum measurement report caching */
685 struct iwl_spectrum_notification measure_report;
686 u8 measurement_status;
688 /* ucode beacon time */
689 u32 ucode_beacon_time;
690 int missed_beacon_threshold;
692 /* track IBSS manager (last beacon) status */
695 /* jiffies when last recovery from statistics was performed */
696 unsigned long rx_statistics_jiffies;
699 u32 rx_handlers_stats[REPLY_MAX];
702 struct iwl_rf_reset rf_reset;
704 /* firmware reload counter and timestamp */
705 unsigned long reload_jiffies;
709 u8 plcp_delta_threshold;
711 /* thermal calibration */
712 s32 temperature; /* Celsius */
713 s32 last_temperature;
715 struct iwl_wipan_noa_data __rcu *noa_data;
717 /* Scan related variables */
718 unsigned long scan_start;
719 unsigned long scan_start_tsf;
721 enum nl80211_band scan_band;
722 struct cfg80211_scan_request *scan_request;
723 struct ieee80211_vif *scan_vif;
724 enum iwl_scan_type scan_type;
725 u8 scan_tx_ant[NUM_NL80211_BANDS];
728 /* max number of station keys */
731 bool new_scan_threshold_behaviour;
735 /* EEPROM MAC addresses */
736 struct mac_address addresses[2];
738 struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
740 __le16 switch_channel;
743 struct iwl_sensitivity_data sensitivity_data;
744 struct iwl_chain_noise_data chain_noise_data;
745 __le16 sensitivity_tbl[HD_TABLE_SIZE];
746 __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES];
748 struct iwl_ht_config current_ht_config;
750 /* Rate scaling data */
753 int activity_timer_active;
755 struct iwl_power_mgr power_data;
756 struct iwl_tt_mgmt thermal_throttle;
758 /* station table variables */
760 struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
761 unsigned long ucode_key_table;
762 struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
763 atomic_t num_aux_in_flight;
765 u8 mac80211_registered;
767 /* Indication if ieee80211_ops->open has been called */
770 enum nl80211_iftype iw_mode;
772 /* Last Rx'd beacon timestamp */
777 struct statistics_general_common common;
778 struct statistics_rx_non_phy rx_non_phy;
779 struct statistics_rx_phy rx_ofdm;
780 struct statistics_rx_ht_phy rx_ofdm_ht;
781 struct statistics_rx_phy rx_cck;
782 struct statistics_tx tx;
783 #ifdef CONFIG_IWLWIFI_DEBUGFS
784 struct statistics_bt_activity bt_activity;
785 __le32 num_bt_kills, accum_num_bt_kills;
789 #ifdef CONFIG_IWLWIFI_DEBUGFS
791 struct statistics_general_common common;
792 struct statistics_rx_non_phy rx_non_phy;
793 struct statistics_rx_phy rx_ofdm;
794 struct statistics_rx_ht_phy rx_ofdm_ht;
795 struct statistics_rx_phy rx_cck;
796 struct statistics_tx tx;
797 struct statistics_bt_activity bt_activity;
798 } accum_stats, delta_stats, max_delta_stats;
802 * reporting the number of tids has AGG on. 0 means
807 struct iwl_rx_phy_res last_phy_res;
809 bool last_phy_res_valid;
812 * chain noise reset and gain commands are the
813 * two extra calibration commands follows the standard
814 * phy calibration commands
816 u8 phy_calib_chain_noise_reset_cmd;
817 u8 phy_calib_chain_noise_gain_cmd;
819 /* counts reply_tx error */
820 struct reply_tx_error_statistics reply_tx_stats;
821 struct reply_agg_tx_error_statistics reply_agg_tx_stats;
826 u8 bt_traffic_load, last_bt_traffic_load;
828 bool bt_full_concurrent;
829 bool bt_ant_couple_ok;
830 __le32 kill_ack_mask;
831 __le32 kill_cts_mask;
833 bool reduced_txpower;
836 u16 dynamic_frag_thresh;
838 struct work_struct bt_traffic_change_work;
839 bool bt_enable_pspoll;
840 struct iwl_rxon_context *cur_rssi_ctx;
843 struct work_struct restart;
844 struct work_struct scan_completed;
845 struct work_struct abort_scan;
847 struct work_struct beacon_update;
848 struct iwl_rxon_context *beacon_ctx;
849 struct sk_buff *beacon_skb;
852 struct work_struct tt_work;
853 struct work_struct ct_enter;
854 struct work_struct ct_exit;
855 struct work_struct start_internal_scan;
856 struct work_struct tx_flush;
857 struct work_struct bt_full_concurrency;
858 struct work_struct bt_runtime_config;
860 struct delayed_work scan_check;
862 /* TX Power settings */
863 s8 tx_power_user_lmt;
866 #ifdef CONFIG_IWLWIFI_DEBUGFS
868 struct dentry *debugfs_dir;
869 u32 dbgfs_sram_offset, dbgfs_sram_len;
872 #endif /* CONFIG_IWLWIFI_DEBUGFS */
874 struct iwl_nvm_data *nvm_data;
875 /* eeprom blob for debugfs */
877 size_t eeprom_blob_size;
879 struct work_struct txpower_work;
881 struct work_struct run_time_calib_work;
882 struct timer_list statistics_periodic;
883 struct timer_list ucode_trace;
885 struct iwl_event_log event_log;
887 #ifdef CONFIG_IWLWIFI_LEDS
888 struct led_classdev led;
889 unsigned long blink_on, blink_off;
893 /* WoWLAN GTK rekey data */
894 u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
897 bool have_rekey_data;
898 #ifdef CONFIG_PM_SLEEP
899 struct wiphy_wowlan_support wowlan_support;
902 /* device_pointers: pointers to ucode event tables */
904 u32 error_event_table;
908 /* indicator of loaded ucode image */
909 enum iwl_ucode_type cur_ucode;
912 static inline struct iwl_rxon_context *
913 iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)
915 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
917 return vif_priv->ctx;
920 #define for_each_context(priv, ctx) \
921 for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
922 ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
923 if (priv->valid_contexts & BIT(ctx->ctxid))
925 static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
927 return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
930 static inline int iwl_is_associated(struct iwl_priv *priv,
931 enum iwl_rxon_context_id ctxid)
933 return iwl_is_associated_ctx(&priv->contexts[ctxid]);
936 static inline int iwl_is_any_associated(struct iwl_priv *priv)
938 struct iwl_rxon_context *ctx;
939 for_each_context(priv, ctx)
940 if (iwl_is_associated_ctx(ctx))
945 #endif /* __iwl_dev_h__ */