1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
4 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
7 * Intel Linux Wireless <linuxwifi@intel.com>
8 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
10 *****************************************************************************/
12 * Please use this file (dev.h) for driver implementation definitions.
13 * Please use commands.h for uCode API definitions.
19 #include <linux/interrupt.h>
20 #include <linux/kernel.h>
21 #include <linux/wait.h>
22 #include <linux/leds.h>
23 #include <linux/slab.h>
24 #include <linux/mutex.h>
27 #include "iwl-eeprom-parse.h"
29 #include "iwl-debug.h"
30 #include "iwl-agn-hw.h"
31 #include "iwl-op-mode.h"
32 #include "fw/notif-wait.h"
33 #include "iwl-trans.h"
40 /* CT-KILL constants */
41 #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
42 #define CT_KILL_THRESHOLD 114 /* in Celsius */
43 #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */
45 /* Default noise level to report when noise measurement is not available.
46 * This may be because we're:
47 * 1) Not associated no beacon statistics being sent to driver)
48 * 2) Scanning (noise measurement does not apply to associated channel)
49 * Use default noise value of -127 ... this is below the range of measurable
50 * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user.
51 * Also, -127 works better than 0 when averaging frames with/without
52 * noise info (e.g. averaging might be done in app); measured dBm values are
53 * always negative ... using a negative value as the default keeps all
54 * averages within an s8's (used in some apps) range of negative values. */
55 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
58 * RTS threshold here is total size [2347] minus 4 FCS bytes
60 * a value of 0 means RTS on all data/management packets
61 * a value > max MSDU size means no RTS
62 * else RTS for data/management frames where MPDU is larger
65 #define DEFAULT_RTS_THRESHOLD 2347U
66 #define MIN_RTS_THRESHOLD 0U
67 #define MAX_RTS_THRESHOLD 2347U
68 #define MAX_MSDU_SIZE 2304U
69 #define MAX_MPDU_SIZE 2346U
70 #define DEFAULT_BEACON_INTERVAL 200U
71 #define DEFAULT_SHORT_RETRY_LIMIT 7U
72 #define DEFAULT_LONG_RETRY_LIMIT 4U
74 #define IWL_NUM_SCAN_RATES (2)
77 #define IEEE80211_DATA_LEN 2304
78 #define IEEE80211_4ADDR_LEN 30
79 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
80 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
82 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
83 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
84 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
86 #define IWL_SUPPORTED_RATES_IE_LEN 8
88 #define IWL_INVALID_RATE 0xFF
89 #define IWL_INVALID_VALUE -1
91 union iwl_ht_rate_supp
{
99 struct iwl_ht_config
{
100 bool single_chain_sufficient
;
101 enum ieee80211_smps_mode smps
; /* current smps mode */
105 struct iwl_qos_info
{
107 struct iwl_qosparam_cmd def_qos_parm
;
113 * The state machine of the BA agreement establishment / tear down.
114 * These states relate to a specific RA / TID.
116 * @IWL_AGG_OFF: aggregation is not used
117 * @IWL_AGG_STARTING: aggregation are starting (between start and oper)
118 * @IWL_AGG_ON: aggregation session is up
119 * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
120 * HW queue to be empty from packets for this RA /TID.
121 * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
122 * HW queue to be empty from packets for this RA /TID.
128 IWL_EMPTYING_HW_QUEUE_ADDBA
,
129 IWL_EMPTYING_HW_QUEUE_DELBA
,
133 * struct iwl_ht_agg - aggregation state machine
135 * This structs holds the states for the BA agreement establishment and tear
136 * down. It also holds the state during the BA session itself. This struct is
137 * duplicated for each RA / TID.
139 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
140 * Tx response (REPLY_TX), and the block ack notification
141 * (REPLY_COMPRESSED_BA).
142 * @state: state of the BA agreement establishment / tear down.
143 * @txq_id: Tx queue used by the BA session
144 * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
145 * the first packet to be sent in legacy HW queue in Tx AGG stop flow.
146 * Basically when next_reclaimed reaches ssn, we can tell mac80211 that
147 * we are ready to finish the Tx AGG stop / start flow.
148 * @wait_for_ba: Expect block-ack before next Tx reply
152 enum iwl_agg_state state
;
159 * struct iwl_tid_data - one for each RA / TID
161 * This structs holds the states for each RA / TID.
163 * @seq_number: the next WiFi sequence number to use
164 * @next_reclaimed: the WiFi sequence number of the next packet to be acked.
165 * This is basically (last acked packet++).
166 * @agg: aggregation state machine
168 struct iwl_tid_data
{
171 struct iwl_ht_agg agg
;
175 * Structure should be accessed with sta_lock held. When station addition
176 * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only
177 * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock
180 struct iwl_station_entry
{
181 struct iwl_addsta_cmd sta
;
183 struct iwl_link_quality_cmd
*lq
;
187 * iwl_station_priv: Driver's private station information
189 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
190 * in the structure for use by driver. This structure is places in that
193 struct iwl_station_priv
{
194 struct iwl_rxon_context
*ctx
;
195 struct iwl_lq_sta lq_sta
;
196 atomic_t pending_frames
;
204 * struct iwl_vif_priv - driver's private per-interface information
206 * When mac80211 allocates a virtual interface, it can allocate
207 * space for us to put data into.
209 struct iwl_vif_priv
{
210 struct iwl_rxon_context
*ctx
;
211 u8 ibss_bssid_sta_id
;
214 struct iwl_sensitivity_ranges
{
220 u16 auto_corr_min_ofdm
;
221 u16 auto_corr_min_ofdm_mrc
;
222 u16 auto_corr_min_ofdm_x1
;
223 u16 auto_corr_min_ofdm_mrc_x1
;
225 u16 auto_corr_max_ofdm
;
226 u16 auto_corr_max_ofdm_mrc
;
227 u16 auto_corr_max_ofdm_x1
;
228 u16 auto_corr_max_ofdm_mrc_x1
;
230 u16 auto_corr_max_cck
;
231 u16 auto_corr_max_cck_mrc
;
232 u16 auto_corr_min_cck
;
233 u16 auto_corr_min_cck_mrc
;
235 u16 barker_corr_th_min
;
236 u16 barker_corr_th_min_mrc
;
240 /******************************************************************************
242 * Functions implemented in core module which are forward declared here
243 * for use by iwl-[4-5].c
245 * NOTE: The implementation of these functions are not hardware specific
246 * which is why they are in the core module files.
248 * Naming convention --
249 * iwl_ <-- Is part of iwlwifi
250 * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
252 ****************************************************************************/
253 void iwl_update_chain_flags(struct iwl_priv
*priv
);
254 extern const u8 iwl_bcast_addr
[ETH_ALEN
];
256 #define IWL_OPERATION_MODE_AUTO 0
257 #define IWL_OPERATION_MODE_HT_ONLY 1
258 #define IWL_OPERATION_MODE_MIXED 2
259 #define IWL_OPERATION_MODE_20MHZ 3
261 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
263 /* Sensitivity and chain noise calibration */
264 #define INITIALIZATION_VALUE 0xFFFF
265 #define IWL_CAL_NUM_BEACONS 16
266 #define MAXIMUM_ALLOWED_PATHLOSS 15
268 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
270 #define MAX_FA_OFDM 50
271 #define MIN_FA_OFDM 5
272 #define MAX_FA_CCK 50
275 #define AUTO_CORR_STEP_OFDM 1
277 #define AUTO_CORR_STEP_CCK 3
278 #define AUTO_CORR_MAX_TH_CCK 160
281 #define NRG_STEP_CCK 2
283 #define MAX_NUMBER_CCK_NO_FA 100
285 #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
290 #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
291 #define ALL_BAND_FILTER 0xFF00
292 #define IN_BAND_FILTER 0xFF
293 #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
295 #define NRG_NUM_PREV_STAT_L 20
296 #define NUM_RX_CHAINS 3
298 enum iwlagn_false_alarm_state
{
301 IWL_FA_GOOD_RANGE
= 2,
304 enum iwlagn_chain_noise_state
{
305 IWL_CHAIN_NOISE_ALIVE
= 0, /* must be 0 */
306 IWL_CHAIN_NOISE_ACCUMULATE
,
307 IWL_CHAIN_NOISE_CALIBRATED
,
308 IWL_CHAIN_NOISE_DONE
,
311 /* Sensitivity calib data */
312 struct iwl_sensitivity_data
{
314 u32 auto_corr_ofdm_mrc
;
315 u32 auto_corr_ofdm_x1
;
316 u32 auto_corr_ofdm_mrc_x1
;
318 u32 auto_corr_cck_mrc
;
320 u32 last_bad_plcp_cnt_ofdm
;
321 u32 last_fa_cnt_ofdm
;
322 u32 last_bad_plcp_cnt_cck
;
328 u8 nrg_silence_rssi
[NRG_NUM_PREV_STAT_L
];
333 s32 nrg_auto_corr_silence_diff
;
334 u32 num_in_cck_no_fa
;
337 u16 barker_corr_th_min
;
338 u16 barker_corr_th_min_mrc
;
342 /* Chain noise (differential Rx gain) calib data */
343 struct iwl_chain_noise_data
{
352 u8 disconn_array
[NUM_RX_CHAINS
];
353 u8 delta_gain_code
[NUM_RX_CHAINS
];
359 MEASUREMENT_READY
= (1 << 0),
360 MEASUREMENT_ACTIVE
= (1 << 1),
363 /* reply_tx_statistics (for _agn devices) */
364 struct reply_tx_error_statistics
{
370 u32 int_crossed_retry
;
386 u32 sta_color_mismatch
;
390 /* reply_agg_tx_statistics (for _agn devices) */
391 struct reply_agg_tx_error_statistics
{
398 u32 last_sent_bt_kill
;
408 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
409 * to perform continuous uCode event logging operation if enabled
411 #define UCODE_TRACE_PERIOD (10)
414 * iwl_event_log: current uCode event log position
416 * @ucode_trace: enable/disable ucode continuous trace timer
417 * @num_wraps: how many times the event buffer wraps
418 * @next_entry: the entry just before the next one that uCode would fill
419 * @non_wraps_count: counter for no wrap detected when dump ucode events
420 * @wraps_once_count: counter for wrap once detected when dump ucode events
421 * @wraps_more_count: counter for wrap more than once detected
422 * when dump ucode events
424 struct iwl_event_log
{
429 int wraps_once_count
;
430 int wraps_more_count
;
433 #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
435 /* BT Antenna Coupling Threshold (dB) */
436 #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
438 /* Firmware reload counter and Timestamp */
439 #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */
440 #define IWL_MAX_CONTINUE_RELOAD_CNT 4
443 struct iwl_rf_reset
{
444 int reset_request_count
;
445 int reset_success_count
;
446 int reset_reject_count
;
447 unsigned long last_reset_jiffies
;
450 enum iwl_rxon_context_id
{
457 /* extend beacon time format bit shifting */
460 * bits 31:22 - extended
461 * bits 21:0 - interval
463 #define IWLAGN_EXT_BEACON_TIME_POS 22
465 struct iwl_rxon_context
{
466 struct ieee80211_vif
*vif
;
469 u8 ac_to_queue
[IEEE80211_NUM_ACS
];
470 u8 ac_to_fifo
[IEEE80211_NUM_ACS
];
473 * We could use the vif to indicate active, but we
474 * also need it to be active during disabling when
475 * we already removed the vif for type setting.
477 bool always_active
, is_active
;
479 bool ht_need_multiple_chains
;
481 enum iwl_rxon_context_id ctxid
;
483 u32 interface_modes
, exclusive_interface_modes
;
484 u8 unused_devtype
, ap_devtype
, ibss_devtype
, station_devtype
;
487 * We declare this const so it can only be
488 * changed via explicit cast within the
489 * routines that actually update the physical
492 const struct iwl_rxon_cmd active
;
493 struct iwl_rxon_cmd staging
;
495 struct iwl_rxon_time_cmd timing
;
497 struct iwl_qos_info qos_data
;
499 u8 bcast_sta_id
, ap_sta_id
;
501 u8 rxon_cmd
, rxon_assoc_cmd
, rxon_timing_cmd
;
505 struct iwl_wep_key wep_keys
[WEP_KEYS_MAX
];
508 __le32 station_flags
;
513 bool non_gf_sta_present
;
515 bool enabled
, is_40mhz
;
516 u8 extension_chan_offset
;
522 IWL_SCAN_RADIO_RESET
,
526 * struct iwl_hw_params
528 * Holds the module parameters
530 * @tx_chains_num: Number of TX chains
531 * @rx_chains_num: Number of RX chains
532 * @ct_kill_threshold: temperature threshold - in hw dependent unit
533 * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit
534 * relevant for 1000, 6000 and up
535 * @struct iwl_sensitivity_ranges: range of sensitivity values
536 * @use_rts_for_aggregation: use rts/cts protection for HT traffic
538 struct iwl_hw_params
{
541 bool use_rts_for_aggregation
;
542 u32 ct_kill_threshold
;
543 u32 ct_kill_exit_threshold
;
545 const struct iwl_sensitivity_ranges
*sens
;
549 * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters
550 * @advanced_bt_coexist: support advanced bt coexist
551 * @bt_init_traffic_load: specify initial bt traffic load
552 * @bt_prio_boost: default bt priority boost value
553 * @agg_time_limit: maximum number of uSec in aggregation
554 * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode
556 struct iwl_dvm_bt_params
{
557 bool advanced_bt_coexist
;
558 u8 bt_init_traffic_load
;
566 * struct iwl_dvm_cfg - DVM firmware specific device configuration
567 * @set_hw_params: set hardware parameters
568 * @set_channel_switch: send channel switch command
569 * @nic_config: apply device specific configuration
570 * @temperature: read temperature
571 * @adv_thermal_throttle: support advance thermal throttle
572 * @support_ct_kill_exit: support ct kill exit condition
573 * @plcp_delta_threshold: plcp error rate threshold used to trigger
574 * radio tuning when there is a high receiving plcp error rate
575 * @chain_noise_scale: default chain noise scale used for gain computation
576 * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up
577 * @no_idle_support: do not support idle mode
578 * @bt_params: pointer to BT parameters
579 * @need_temp_offset_calib: need to perform temperature offset calibration
580 * @no_xtal_calib: some devices do not need crystal calibration data,
581 * don't send it to those
582 * @temp_offset_v2: support v2 of temperature offset calibration
583 * @adv_pm: advanced power management
586 void (*set_hw_params
)(struct iwl_priv
*priv
);
587 int (*set_channel_switch
)(struct iwl_priv
*priv
,
588 struct ieee80211_channel_switch
*ch_switch
);
589 void (*nic_config
)(struct iwl_priv
*priv
);
590 void (*temperature
)(struct iwl_priv
*priv
);
592 const struct iwl_dvm_bt_params
*bt_params
;
593 s32 chain_noise_scale
;
594 u8 plcp_delta_threshold
;
595 bool adv_thermal_throttle
;
596 bool support_ct_kill_exit
;
598 bool no_idle_support
;
599 bool need_temp_offset_calib
;
605 struct iwl_wipan_noa_data
{
606 struct rcu_head rcu_head
;
611 /* Calibration disabling bit mask */
613 IWL_CALIB_ENABLE_ALL
= 0,
615 IWL_SENSITIVITY_CALIB_DISABLED
= BIT(0),
616 IWL_CHAIN_NOISE_CALIB_DISABLED
= BIT(1),
617 IWL_TX_POWER_CALIB_DISABLED
= BIT(2),
619 IWL_CALIB_DISABLE_ALL
= 0xFFFFFFFF,
622 #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \
623 ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific))
625 #define IWL_MAC80211_GET_DVM(_hw) \
626 ((struct iwl_priv *) ((struct iwl_op_mode *) \
627 (_hw)->priv)->op_mode_specific)
631 struct iwl_trans
*trans
;
632 struct device
*dev
; /* for debug prints only */
633 const struct iwl_cfg
*cfg
;
634 const struct iwl_fw
*fw
;
635 const struct iwl_dvm_cfg
*lib
;
636 unsigned long status
;
641 unsigned long transport_queue_stop
;
643 #define IWL_INVALID_MAC80211_QUEUE 0xff
644 u8 queue_to_mac80211
[IWL_MAX_HW_QUEUES
];
645 atomic_t queue_stop_count
[IWL_MAX_HW_QUEUES
];
647 unsigned long agg_q_alloc
[BITS_TO_LONGS(IWL_MAX_HW_QUEUES
)];
649 /* ieee device used by generic ieee processing code */
650 struct ieee80211_hw
*hw
;
652 struct napi_struct
*napi
;
654 struct list_head calib_results
;
656 struct workqueue_struct
*workqueue
;
658 struct iwl_hw_params hw_params
;
660 enum nl80211_band band
;
663 void (*rx_handlers
[REPLY_MAX
])(struct iwl_priv
*priv
,
664 struct iwl_rx_cmd_buffer
*rxb
);
666 struct iwl_notif_wait_data notif_wait
;
668 /* spectrum measurement report caching */
669 struct iwl_spectrum_notification measure_report
;
670 u8 measurement_status
;
672 /* ucode beacon time */
673 u32 ucode_beacon_time
;
674 int missed_beacon_threshold
;
676 /* track IBSS manager (last beacon) status */
679 /* jiffies when last recovery from statistics was performed */
680 unsigned long rx_statistics_jiffies
;
683 u32 rx_handlers_stats
[REPLY_MAX
];
686 struct iwl_rf_reset rf_reset
;
688 /* firmware reload counter and timestamp */
689 unsigned long reload_jiffies
;
693 u8 plcp_delta_threshold
;
695 /* thermal calibration */
696 s32 temperature
; /* Celsius */
697 s32 last_temperature
;
699 struct iwl_wipan_noa_data __rcu
*noa_data
;
701 /* Scan related variables */
702 unsigned long scan_start
;
703 unsigned long scan_start_tsf
;
705 enum nl80211_band scan_band
;
706 struct cfg80211_scan_request
*scan_request
;
707 struct ieee80211_vif
*scan_vif
;
708 enum iwl_scan_type scan_type
;
709 u8 scan_tx_ant
[NUM_NL80211_BANDS
];
712 /* max number of station keys */
715 bool new_scan_threshold_behaviour
;
719 /* EEPROM MAC addresses */
720 struct mac_address addresses
[2];
722 struct iwl_rxon_context contexts
[NUM_IWL_RXON_CTX
];
724 __le16 switch_channel
;
727 struct iwl_sensitivity_data sensitivity_data
;
728 struct iwl_chain_noise_data chain_noise_data
;
729 __le16 sensitivity_tbl
[HD_TABLE_SIZE
];
730 __le16 enhance_sensitivity_tbl
[ENHANCE_HD_TABLE_ENTRIES
];
732 struct iwl_ht_config current_ht_config
;
734 /* Rate scaling data */
737 int activity_timer_active
;
739 struct iwl_power_mgr power_data
;
740 struct iwl_tt_mgmt thermal_throttle
;
742 /* station table variables */
744 struct iwl_station_entry stations
[IWLAGN_STATION_COUNT
];
745 unsigned long ucode_key_table
;
746 struct iwl_tid_data tid_data
[IWLAGN_STATION_COUNT
][IWL_MAX_TID_COUNT
];
747 atomic_t num_aux_in_flight
;
749 u8 mac80211_registered
;
751 /* Indication if ieee80211_ops->open has been called */
754 enum nl80211_iftype iw_mode
;
756 /* Last Rx'd beacon timestamp */
761 struct statistics_general_common common
;
762 struct statistics_rx_non_phy rx_non_phy
;
763 struct statistics_rx_phy rx_ofdm
;
764 struct statistics_rx_ht_phy rx_ofdm_ht
;
765 struct statistics_rx_phy rx_cck
;
766 struct statistics_tx tx
;
767 #ifdef CONFIG_IWLWIFI_DEBUGFS
768 struct statistics_bt_activity bt_activity
;
769 __le32 num_bt_kills
, accum_num_bt_kills
;
773 #ifdef CONFIG_IWLWIFI_DEBUGFS
775 struct statistics_general_common common
;
776 struct statistics_rx_non_phy rx_non_phy
;
777 struct statistics_rx_phy rx_ofdm
;
778 struct statistics_rx_ht_phy rx_ofdm_ht
;
779 struct statistics_rx_phy rx_cck
;
780 struct statistics_tx tx
;
781 struct statistics_bt_activity bt_activity
;
782 } accum_stats
, delta_stats
, max_delta_stats
;
786 * reporting the number of tids has AGG on. 0 means
791 struct iwl_rx_phy_res last_phy_res
;
793 bool last_phy_res_valid
;
796 * chain noise reset and gain commands are the
797 * two extra calibration commands follows the standard
798 * phy calibration commands
800 u8 phy_calib_chain_noise_reset_cmd
;
801 u8 phy_calib_chain_noise_gain_cmd
;
803 /* counts reply_tx error */
804 struct reply_tx_error_statistics reply_tx_stats
;
805 struct reply_agg_tx_error_statistics reply_agg_tx_stats
;
810 u8 bt_traffic_load
, last_bt_traffic_load
;
812 bool bt_full_concurrent
;
813 bool bt_ant_couple_ok
;
814 __le32 kill_ack_mask
;
815 __le32 kill_cts_mask
;
817 bool reduced_txpower
;
820 u16 dynamic_frag_thresh
;
822 struct work_struct bt_traffic_change_work
;
823 bool bt_enable_pspoll
;
824 struct iwl_rxon_context
*cur_rssi_ctx
;
827 struct work_struct restart
;
828 struct work_struct scan_completed
;
829 struct work_struct abort_scan
;
831 struct work_struct beacon_update
;
832 struct iwl_rxon_context
*beacon_ctx
;
833 struct sk_buff
*beacon_skb
;
836 struct work_struct tt_work
;
837 struct work_struct ct_enter
;
838 struct work_struct ct_exit
;
839 struct work_struct start_internal_scan
;
840 struct work_struct tx_flush
;
841 struct work_struct bt_full_concurrency
;
842 struct work_struct bt_runtime_config
;
844 struct delayed_work scan_check
;
846 /* TX Power settings */
847 s8 tx_power_user_lmt
;
850 #ifdef CONFIG_IWLWIFI_DEBUGFS
852 struct dentry
*debugfs_dir
;
853 u32 dbgfs_sram_offset
, dbgfs_sram_len
;
856 #endif /* CONFIG_IWLWIFI_DEBUGFS */
858 struct iwl_nvm_data
*nvm_data
;
859 /* eeprom blob for debugfs */
861 size_t eeprom_blob_size
;
863 struct work_struct txpower_work
;
865 struct work_struct run_time_calib_work
;
866 struct timer_list statistics_periodic
;
867 struct timer_list ucode_trace
;
869 struct iwl_event_log event_log
;
871 #ifdef CONFIG_IWLWIFI_LEDS
872 struct led_classdev led
;
873 unsigned long blink_on
, blink_off
;
877 /* WoWLAN GTK rekey data */
878 u8 kck
[NL80211_KCK_LEN
], kek
[NL80211_KEK_LEN
];
881 bool have_rekey_data
;
882 #ifdef CONFIG_PM_SLEEP
883 struct wiphy_wowlan_support wowlan_support
;
886 /* device_pointers: pointers to ucode event tables */
888 u32 error_event_table
;
892 /* indicator of loaded ucode image */
893 enum iwl_ucode_type cur_ucode
;
896 static inline struct iwl_rxon_context
*
897 iwl_rxon_ctx_from_vif(struct ieee80211_vif
*vif
)
899 struct iwl_vif_priv
*vif_priv
= (void *)vif
->drv_priv
;
901 return vif_priv
->ctx
;
904 #define for_each_context(priv, ctx) \
905 for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
906 ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
907 if (priv->valid_contexts & BIT(ctx->ctxid))
909 static inline int iwl_is_associated_ctx(struct iwl_rxon_context
*ctx
)
911 return (ctx
->active
.filter_flags
& RXON_FILTER_ASSOC_MSK
) ? 1 : 0;
914 static inline int iwl_is_associated(struct iwl_priv
*priv
,
915 enum iwl_rxon_context_id ctxid
)
917 return iwl_is_associated_ctx(&priv
->contexts
[ctxid
]);
920 static inline int iwl_is_any_associated(struct iwl_priv
*priv
)
922 struct iwl_rxon_context
*ctx
;
923 for_each_context(priv
, ctx
)
924 if (iwl_is_associated_ctx(ctx
))
929 #endif /* __iwl_dev_h__ */