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"
55 /* CT-KILL constants */
56 #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
57 #define CT_KILL_THRESHOLD 114 /* in Celsius */
58 #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */
60 /* Default noise level to report when noise measurement is not available.
61 * This may be because we're:
62 * 1) Not associated no beacon statistics being sent to driver)
63 * 2) Scanning (noise measurement does not apply to associated channel)
64 * Use default noise value of -127 ... this is below the range of measurable
65 * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user.
66 * Also, -127 works better than 0 when averaging frames with/without
67 * noise info (e.g. averaging might be done in app); measured dBm values are
68 * always negative ... using a negative value as the default keeps all
69 * averages within an s8's (used in some apps) range of negative values. */
70 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
73 * RTS threshold here is total size [2347] minus 4 FCS bytes
75 * a value of 0 means RTS on all data/management packets
76 * a value > max MSDU size means no RTS
77 * else RTS for data/management frames where MPDU is larger
80 #define DEFAULT_RTS_THRESHOLD 2347U
81 #define MIN_RTS_THRESHOLD 0U
82 #define MAX_RTS_THRESHOLD 2347U
83 #define MAX_MSDU_SIZE 2304U
84 #define MAX_MPDU_SIZE 2346U
85 #define DEFAULT_BEACON_INTERVAL 200U
86 #define DEFAULT_SHORT_RETRY_LIMIT 7U
87 #define DEFAULT_LONG_RETRY_LIMIT 4U
89 #define IWL_NUM_SCAN_RATES (2)
92 #define IEEE80211_DATA_LEN 2304
93 #define IEEE80211_4ADDR_LEN 30
94 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
95 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
97 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
98 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
99 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
101 #define IWL_SUPPORTED_RATES_IE_LEN 8
103 #define IWL_INVALID_RATE 0xFF
104 #define IWL_INVALID_VALUE -1
106 union iwl_ht_rate_supp
{
114 struct iwl_ht_config
{
115 bool single_chain_sufficient
;
116 enum ieee80211_smps_mode smps
; /* current smps mode */
120 struct iwl_qos_info
{
122 struct iwl_qosparam_cmd def_qos_parm
;
128 * The state machine of the BA agreement establishment / tear down.
129 * These states relate to a specific RA / TID.
131 * @IWL_AGG_OFF: aggregation is not used
132 * @IWL_AGG_STARTING: aggregation are starting (between start and oper)
133 * @IWL_AGG_ON: aggregation session is up
134 * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
135 * HW queue to be empty from packets for this RA /TID.
136 * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
137 * HW queue to be empty from packets for this RA /TID.
143 IWL_EMPTYING_HW_QUEUE_ADDBA
,
144 IWL_EMPTYING_HW_QUEUE_DELBA
,
148 * struct iwl_ht_agg - aggregation state machine
150 * This structs holds the states for the BA agreement establishment and tear
151 * down. It also holds the state during the BA session itself. This struct is
152 * duplicated for each RA / TID.
154 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
155 * Tx response (REPLY_TX), and the block ack notification
156 * (REPLY_COMPRESSED_BA).
157 * @state: state of the BA agreement establishment / tear down.
158 * @txq_id: Tx queue used by the BA session
159 * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
160 * the first packet to be sent in legacy HW queue in Tx AGG stop flow.
161 * Basically when next_reclaimed reaches ssn, we can tell mac80211 that
162 * we are ready to finish the Tx AGG stop / start flow.
163 * @wait_for_ba: Expect block-ack before next Tx reply
167 enum iwl_agg_state state
;
174 * struct iwl_tid_data - one for each RA / TID
176 * This structs holds the states for each RA / TID.
178 * @seq_number: the next WiFi sequence number to use
179 * @next_reclaimed: the WiFi sequence number of the next packet to be acked.
180 * This is basically (last acked packet++).
181 * @agg: aggregation state machine
183 struct iwl_tid_data
{
186 struct iwl_ht_agg agg
;
190 * Structure should be accessed with sta_lock held. When station addition
191 * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only
192 * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock
195 struct iwl_station_entry
{
196 struct iwl_addsta_cmd sta
;
198 struct iwl_link_quality_cmd
*lq
;
202 * iwl_station_priv: Driver's private station information
204 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
205 * in the structure for use by driver. This structure is places in that
208 struct iwl_station_priv
{
209 struct iwl_rxon_context
*ctx
;
210 struct iwl_lq_sta lq_sta
;
211 atomic_t pending_frames
;
219 * struct iwl_vif_priv - driver's private per-interface information
221 * When mac80211 allocates a virtual interface, it can allocate
222 * space for us to put data into.
224 struct iwl_vif_priv
{
225 struct iwl_rxon_context
*ctx
;
226 u8 ibss_bssid_sta_id
;
229 struct iwl_sensitivity_ranges
{
235 u16 auto_corr_min_ofdm
;
236 u16 auto_corr_min_ofdm_mrc
;
237 u16 auto_corr_min_ofdm_x1
;
238 u16 auto_corr_min_ofdm_mrc_x1
;
240 u16 auto_corr_max_ofdm
;
241 u16 auto_corr_max_ofdm_mrc
;
242 u16 auto_corr_max_ofdm_x1
;
243 u16 auto_corr_max_ofdm_mrc_x1
;
245 u16 auto_corr_max_cck
;
246 u16 auto_corr_max_cck_mrc
;
247 u16 auto_corr_min_cck
;
248 u16 auto_corr_min_cck_mrc
;
250 u16 barker_corr_th_min
;
251 u16 barker_corr_th_min_mrc
;
256 #define KELVIN_TO_CELSIUS(x) ((x)-273)
257 #define CELSIUS_TO_KELVIN(x) ((x)+273)
260 /******************************************************************************
262 * Functions implemented in core module which are forward declared here
263 * for use by iwl-[4-5].c
265 * NOTE: The implementation of these functions are not hardware specific
266 * which is why they are in the core module files.
268 * Naming convention --
269 * iwl_ <-- Is part of iwlwifi
270 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
272 ****************************************************************************/
273 extern void iwl_update_chain_flags(struct iwl_priv
*priv
);
274 extern const u8 iwl_bcast_addr
[ETH_ALEN
];
276 #define IWL_OPERATION_MODE_AUTO 0
277 #define IWL_OPERATION_MODE_HT_ONLY 1
278 #define IWL_OPERATION_MODE_MIXED 2
279 #define IWL_OPERATION_MODE_20MHZ 3
281 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
283 /* Sensitivity and chain noise calibration */
284 #define INITIALIZATION_VALUE 0xFFFF
285 #define IWL_CAL_NUM_BEACONS 16
286 #define MAXIMUM_ALLOWED_PATHLOSS 15
288 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
290 #define MAX_FA_OFDM 50
291 #define MIN_FA_OFDM 5
292 #define MAX_FA_CCK 50
295 #define AUTO_CORR_STEP_OFDM 1
297 #define AUTO_CORR_STEP_CCK 3
298 #define AUTO_CORR_MAX_TH_CCK 160
301 #define NRG_STEP_CCK 2
303 #define MAX_NUMBER_CCK_NO_FA 100
305 #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
310 #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
311 #define ALL_BAND_FILTER 0xFF00
312 #define IN_BAND_FILTER 0xFF
313 #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
315 #define NRG_NUM_PREV_STAT_L 20
316 #define NUM_RX_CHAINS 3
318 enum iwlagn_false_alarm_state
{
321 IWL_FA_GOOD_RANGE
= 2,
324 enum iwlagn_chain_noise_state
{
325 IWL_CHAIN_NOISE_ALIVE
= 0, /* must be 0 */
326 IWL_CHAIN_NOISE_ACCUMULATE
,
327 IWL_CHAIN_NOISE_CALIBRATED
,
328 IWL_CHAIN_NOISE_DONE
,
331 /* Sensitivity calib data */
332 struct iwl_sensitivity_data
{
334 u32 auto_corr_ofdm_mrc
;
335 u32 auto_corr_ofdm_x1
;
336 u32 auto_corr_ofdm_mrc_x1
;
338 u32 auto_corr_cck_mrc
;
340 u32 last_bad_plcp_cnt_ofdm
;
341 u32 last_fa_cnt_ofdm
;
342 u32 last_bad_plcp_cnt_cck
;
348 u8 nrg_silence_rssi
[NRG_NUM_PREV_STAT_L
];
353 s32 nrg_auto_corr_silence_diff
;
354 u32 num_in_cck_no_fa
;
357 u16 barker_corr_th_min
;
358 u16 barker_corr_th_min_mrc
;
362 /* Chain noise (differential Rx gain) calib data */
363 struct iwl_chain_noise_data
{
372 u8 disconn_array
[NUM_RX_CHAINS
];
373 u8 delta_gain_code
[NUM_RX_CHAINS
];
379 MEASUREMENT_READY
= (1 << 0),
380 MEASUREMENT_ACTIVE
= (1 << 1),
383 /* reply_tx_statistics (for _agn devices) */
384 struct reply_tx_error_statistics
{
390 u32 int_crossed_retry
;
406 u32 sta_color_mismatch
;
410 /* reply_agg_tx_statistics (for _agn devices) */
411 struct reply_agg_tx_error_statistics
{
418 u32 last_sent_bt_kill
;
428 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
429 * to perform continuous uCode event logging operation if enabled
431 #define UCODE_TRACE_PERIOD (10)
434 * iwl_event_log: current uCode event log position
436 * @ucode_trace: enable/disable ucode continuous trace timer
437 * @num_wraps: how many times the event buffer wraps
438 * @next_entry: the entry just before the next one that uCode would fill
439 * @non_wraps_count: counter for no wrap detected when dump ucode events
440 * @wraps_once_count: counter for wrap once detected when dump ucode events
441 * @wraps_more_count: counter for wrap more than once detected
442 * when dump ucode events
444 struct iwl_event_log
{
449 int wraps_once_count
;
450 int wraps_more_count
;
453 #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
455 /* BT Antenna Coupling Threshold (dB) */
456 #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
458 /* Firmware reload counter and Timestamp */
459 #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */
460 #define IWL_MAX_CONTINUE_RELOAD_CNT 4
463 struct iwl_rf_reset
{
464 int reset_request_count
;
465 int reset_success_count
;
466 int reset_reject_count
;
467 unsigned long last_reset_jiffies
;
470 enum iwl_rxon_context_id
{
477 /* extend beacon time format bit shifting */
480 * bits 31:22 - extended
481 * bits 21:0 - interval
483 #define IWLAGN_EXT_BEACON_TIME_POS 22
485 struct iwl_rxon_context
{
486 struct ieee80211_vif
*vif
;
489 u8 ac_to_queue
[IEEE80211_NUM_ACS
];
490 u8 ac_to_fifo
[IEEE80211_NUM_ACS
];
493 * We could use the vif to indicate active, but we
494 * also need it to be active during disabling when
495 * we already removed the vif for type setting.
497 bool always_active
, is_active
;
499 bool ht_need_multiple_chains
;
501 enum iwl_rxon_context_id ctxid
;
503 u32 interface_modes
, exclusive_interface_modes
;
504 u8 unused_devtype
, ap_devtype
, ibss_devtype
, station_devtype
;
507 * We declare this const so it can only be
508 * changed via explicit cast within the
509 * routines that actually update the physical
512 const struct iwl_rxon_cmd active
;
513 struct iwl_rxon_cmd staging
;
515 struct iwl_rxon_time_cmd timing
;
517 struct iwl_qos_info qos_data
;
519 u8 bcast_sta_id
, ap_sta_id
;
521 u8 rxon_cmd
, rxon_assoc_cmd
, rxon_timing_cmd
;
525 struct iwl_wep_key wep_keys
[WEP_KEYS_MAX
];
528 __le32 station_flags
;
533 bool non_gf_sta_present
;
535 bool enabled
, is_40mhz
;
536 u8 extension_chan_offset
;
542 IWL_SCAN_RADIO_RESET
,
547 * struct iwl_hw_params
549 * Holds the module parameters
551 * @tx_chains_num: Number of TX chains
552 * @rx_chains_num: Number of RX chains
553 * @ct_kill_threshold: temperature threshold - in hw dependent unit
554 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
555 * relevant for 1000, 6000 and up
556 * @struct iwl_sensitivity_ranges: range of sensitivity values
557 * @use_rts_for_aggregation: use rts/cts protection for HT traffic
559 struct iwl_hw_params
{
562 bool use_rts_for_aggregation
;
563 u32 ct_kill_threshold
;
564 u32 ct_kill_exit_threshold
;
566 const struct iwl_sensitivity_ranges
*sens
;
570 * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters
571 * @advanced_bt_coexist: support advanced bt coexist
572 * @bt_init_traffic_load: specify initial bt traffic load
573 * @bt_prio_boost: default bt priority boost value
574 * @agg_time_limit: maximum number of uSec in aggregation
575 * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
577 struct iwl_dvm_bt_params
{
578 bool advanced_bt_coexist
;
579 u8 bt_init_traffic_load
;
587 * struct iwl_dvm_cfg - DVM firmware specific device configuration
588 * @set_hw_params: set hardware parameters
589 * @set_channel_switch: send channel switch command
590 * @nic_config: apply device specific configuration
591 * @temperature: read temperature
592 * @adv_thermal_throttle: support advance thermal throttle
593 * @support_ct_kill_exit: support ct kill exit condition
594 * @plcp_delta_threshold: plcp error rate threshold used to trigger
595 * radio tuning when there is a high receiving plcp error rate
596 * @chain_noise_scale: default chain noise scale used for gain computation
597 * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
598 * @no_idle_support: do not support idle mode
599 * @bt_params: pointer to BT parameters
600 * @need_temp_offset_calib: need to perform temperature offset calibration
601 * @no_xtal_calib: some devices do not need crystal calibration data,
602 * don't send it to those
603 * @temp_offset_v2: support v2 of temperature offset calibration
604 * @adv_pm: advanced power management
607 void (*set_hw_params
)(struct iwl_priv
*priv
);
608 int (*set_channel_switch
)(struct iwl_priv
*priv
,
609 struct ieee80211_channel_switch
*ch_switch
);
610 void (*nic_config
)(struct iwl_priv
*priv
);
611 void (*temperature
)(struct iwl_priv
*priv
);
613 const struct iwl_dvm_bt_params
*bt_params
;
614 s32 chain_noise_scale
;
615 u8 plcp_delta_threshold
;
616 bool adv_thermal_throttle
;
617 bool support_ct_kill_exit
;
619 bool no_idle_support
;
620 bool need_temp_offset_calib
;
626 struct iwl_wipan_noa_data
{
627 struct rcu_head rcu_head
;
632 /* Calibration disabling bit mask */
634 IWL_CALIB_ENABLE_ALL
= 0,
636 IWL_SENSITIVITY_CALIB_DISABLED
= BIT(0),
637 IWL_CHAIN_NOISE_CALIB_DISABLED
= BIT(1),
638 IWL_TX_POWER_CALIB_DISABLED
= BIT(2),
640 IWL_CALIB_DISABLE_ALL
= 0xFFFFFFFF,
643 #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
644 ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
646 #define IWL_MAC80211_GET_DVM(_hw) \
647 ((struct iwl_priv *) ((struct iwl_op_mode *) \
648 (_hw)->priv)->op_mode_specific)
652 struct iwl_trans
*trans
;
653 struct device
*dev
; /* for debug prints only */
654 const struct iwl_cfg
*cfg
;
655 const struct iwl_fw
*fw
;
656 const struct iwl_dvm_cfg
*lib
;
657 unsigned long status
;
662 unsigned long transport_queue_stop
;
664 #define IWL_INVALID_MAC80211_QUEUE 0xff
665 u8 queue_to_mac80211
[IWL_MAX_HW_QUEUES
];
666 atomic_t queue_stop_count
[IWL_MAX_HW_QUEUES
];
668 unsigned long agg_q_alloc
[BITS_TO_LONGS(IWL_MAX_HW_QUEUES
)];
670 /* ieee device used by generic ieee processing code */
671 struct ieee80211_hw
*hw
;
673 struct list_head calib_results
;
675 struct workqueue_struct
*workqueue
;
677 struct iwl_hw_params hw_params
;
679 enum ieee80211_band band
;
682 int (*rx_handlers
[REPLY_MAX
])(struct iwl_priv
*priv
,
683 struct iwl_rx_cmd_buffer
*rxb
,
684 struct iwl_device_cmd
*cmd
);
686 struct iwl_notif_wait_data notif_wait
;
688 /* spectrum measurement report caching */
689 struct iwl_spectrum_notification measure_report
;
690 u8 measurement_status
;
692 /* ucode beacon time */
693 u32 ucode_beacon_time
;
694 int missed_beacon_threshold
;
696 /* track IBSS manager (last beacon) status */
699 /* jiffies when last recovery from statistics was performed */
700 unsigned long rx_statistics_jiffies
;
703 u32 rx_handlers_stats
[REPLY_MAX
];
706 struct iwl_rf_reset rf_reset
;
708 /* firmware reload counter and timestamp */
709 unsigned long reload_jiffies
;
712 bool init_ucode_run
; /* Don't run init uCode again */
714 u8 plcp_delta_threshold
;
716 /* thermal calibration */
717 s32 temperature
; /* Celsius */
718 s32 last_temperature
;
720 struct iwl_wipan_noa_data __rcu
*noa_data
;
722 /* Scan related variables */
723 unsigned long scan_start
;
724 unsigned long scan_start_tsf
;
726 enum ieee80211_band scan_band
;
727 struct cfg80211_scan_request
*scan_request
;
728 struct ieee80211_vif
*scan_vif
;
729 enum iwl_scan_type scan_type
;
730 u8 scan_tx_ant
[IEEE80211_NUM_BANDS
];
733 /* max number of station keys */
736 bool new_scan_threshold_behaviour
;
740 /* EEPROM MAC addresses */
741 struct mac_address addresses
[2];
743 struct iwl_rxon_context contexts
[NUM_IWL_RXON_CTX
];
745 __le16 switch_channel
;
748 struct iwl_sensitivity_data sensitivity_data
;
749 struct iwl_chain_noise_data chain_noise_data
;
750 __le16 sensitivity_tbl
[HD_TABLE_SIZE
];
751 __le16 enhance_sensitivity_tbl
[ENHANCE_HD_TABLE_ENTRIES
];
753 struct iwl_ht_config current_ht_config
;
755 /* Rate scaling data */
758 int activity_timer_active
;
760 struct iwl_power_mgr power_data
;
761 struct iwl_tt_mgmt thermal_throttle
;
763 /* station table variables */
765 struct iwl_station_entry stations
[IWLAGN_STATION_COUNT
];
766 unsigned long ucode_key_table
;
767 struct iwl_tid_data tid_data
[IWLAGN_STATION_COUNT
][IWL_MAX_TID_COUNT
];
768 atomic_t num_aux_in_flight
;
770 u8 mac80211_registered
;
772 /* Indication if ieee80211_ops->open has been called */
775 enum nl80211_iftype iw_mode
;
777 /* Last Rx'd beacon timestamp */
782 struct statistics_general_common common
;
783 struct statistics_rx_non_phy rx_non_phy
;
784 struct statistics_rx_phy rx_ofdm
;
785 struct statistics_rx_ht_phy rx_ofdm_ht
;
786 struct statistics_rx_phy rx_cck
;
787 struct statistics_tx tx
;
788 #ifdef CONFIG_IWLWIFI_DEBUGFS
789 struct statistics_bt_activity bt_activity
;
790 __le32 num_bt_kills
, accum_num_bt_kills
;
794 #ifdef CONFIG_IWLWIFI_DEBUGFS
796 struct statistics_general_common common
;
797 struct statistics_rx_non_phy rx_non_phy
;
798 struct statistics_rx_phy rx_ofdm
;
799 struct statistics_rx_ht_phy rx_ofdm_ht
;
800 struct statistics_rx_phy rx_cck
;
801 struct statistics_tx tx
;
802 struct statistics_bt_activity bt_activity
;
803 } accum_stats
, delta_stats
, max_delta_stats
;
807 * reporting the number of tids has AGG on. 0 means
812 struct iwl_rx_phy_res last_phy_res
;
814 bool last_phy_res_valid
;
817 * chain noise reset and gain commands are the
818 * two extra calibration commands follows the standard
819 * phy calibration commands
821 u8 phy_calib_chain_noise_reset_cmd
;
822 u8 phy_calib_chain_noise_gain_cmd
;
824 /* counts reply_tx error */
825 struct reply_tx_error_statistics reply_tx_stats
;
826 struct reply_agg_tx_error_statistics reply_agg_tx_stats
;
828 /* remain-on-channel offload support */
829 struct ieee80211_channel
*hw_roc_channel
;
830 struct delayed_work hw_roc_disable_work
;
832 bool hw_roc_setup
, hw_roc_start_notified
;
837 u8 bt_traffic_load
, last_bt_traffic_load
;
839 bool bt_full_concurrent
;
840 bool bt_ant_couple_ok
;
841 __le32 kill_ack_mask
;
842 __le32 kill_cts_mask
;
844 bool reduced_txpower
;
847 u16 dynamic_frag_thresh
;
849 struct work_struct bt_traffic_change_work
;
850 bool bt_enable_pspoll
;
851 struct iwl_rxon_context
*cur_rssi_ctx
;
854 struct work_struct restart
;
855 struct work_struct scan_completed
;
856 struct work_struct abort_scan
;
858 struct work_struct beacon_update
;
859 struct iwl_rxon_context
*beacon_ctx
;
860 struct sk_buff
*beacon_skb
;
863 struct work_struct tt_work
;
864 struct work_struct ct_enter
;
865 struct work_struct ct_exit
;
866 struct work_struct start_internal_scan
;
867 struct work_struct tx_flush
;
868 struct work_struct bt_full_concurrency
;
869 struct work_struct bt_runtime_config
;
871 struct delayed_work scan_check
;
873 /* TX Power settings */
874 s8 tx_power_user_lmt
;
877 #ifdef CONFIG_IWLWIFI_DEBUGFS
879 struct dentry
*debugfs_dir
;
880 u32 dbgfs_sram_offset
, dbgfs_sram_len
;
883 #endif /* CONFIG_IWLWIFI_DEBUGFS */
885 struct iwl_nvm_data
*nvm_data
;
886 /* eeprom blob for debugfs */
888 size_t eeprom_blob_size
;
890 struct work_struct txpower_work
;
892 struct work_struct run_time_calib_work
;
893 struct timer_list statistics_periodic
;
894 struct timer_list ucode_trace
;
896 struct iwl_event_log event_log
;
898 struct led_classdev led
;
899 unsigned long blink_on
, blink_off
;
902 /* WoWLAN GTK rekey data */
903 u8 kck
[NL80211_KCK_LEN
], kek
[NL80211_KEK_LEN
];
906 bool have_rekey_data
;
907 #ifdef CONFIG_PM_SLEEP
908 struct wiphy_wowlan_support wowlan_support
;
911 /* device_pointers: pointers to ucode event tables */
913 u32 error_event_table
;
917 /* indicator of loaded ucode image */
918 enum iwl_ucode_type cur_ucode
;
921 static inline struct iwl_rxon_context
*
922 iwl_rxon_ctx_from_vif(struct ieee80211_vif
*vif
)
924 struct iwl_vif_priv
*vif_priv
= (void *)vif
->drv_priv
;
926 return vif_priv
->ctx
;
929 #define for_each_context(priv, ctx) \
930 for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
931 ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
932 if (priv->valid_contexts & BIT(ctx->ctxid))
934 static inline int iwl_is_associated_ctx(struct iwl_rxon_context
*ctx
)
936 return (ctx
->active
.filter_flags
& RXON_FILTER_ASSOC_MSK
) ? 1 : 0;
939 static inline int iwl_is_associated(struct iwl_priv
*priv
,
940 enum iwl_rxon_context_id ctxid
)
942 return iwl_is_associated_ctx(&priv
->contexts
[ctxid
]);
945 static inline int iwl_is_any_associated(struct iwl_priv
*priv
)
947 struct iwl_rxon_context
*ctx
;
948 for_each_context(priv
, ctx
)
949 if (iwl_is_associated_ctx(ctx
))
954 #endif /* __iwl_dev_h__ */