/* SPDX-License-Identifier: GPL-2.0-only */ /****************************************************************************** * * Copyright(c) 2003 - 2014, 2020, 2023 Intel Corporation. All rights reserved. *****************************************************************************/ /* * Please use this file (dev.h) for driver implementation definitions. * Please use commands.h for uCode API definitions. */ #ifndef __iwl_dev_h__ #define __iwl_dev_h__ #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/wait.h> #include <linux/leds.h> #include <linux/slab.h> #include <linux/mutex.h> #include "fw/img.h" #include "iwl-nvm-utils.h" #include "iwl-csr.h" #include "iwl-debug.h" #include "iwl-agn-hw.h" #include "iwl-op-mode.h" #include "fw/notif-wait.h" #include "iwl-trans.h" #include "led.h" #include "power.h" #include "rs.h" #include "tt.h" /* CT-KILL constants */ #define CT_KILL_THRESHOLD_LEGACY … #define CT_KILL_THRESHOLD … #define CT_KILL_EXIT_THRESHOLD … /* Default noise level to report when noise measurement is not available. * This may be because we're: * 1) Not associated no beacon statistics being sent to driver) * 2) Scanning (noise measurement does not apply to associated channel) * Use default noise value of -127 ... this is below the range of measurable * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user. * Also, -127 works better than 0 when averaging frames with/without * noise info (e.g. averaging might be done in app); measured dBm values are * always negative ... using a negative value as the default keeps all * averages within an s8's (used in some apps) range of negative values. */ #define IWL_NOISE_MEAS_NOT_AVAILABLE … /* * RTS threshold here is total size [2347] minus 4 FCS bytes * Per spec: * a value of 0 means RTS on all data/management packets * a value > max MSDU size means no RTS * else RTS for data/management frames where MPDU is larger * than RTS value. */ #define DEFAULT_RTS_THRESHOLD … #define MIN_RTS_THRESHOLD … #define MAX_RTS_THRESHOLD … #define MAX_MSDU_SIZE … #define MAX_MPDU_SIZE … #define DEFAULT_BEACON_INTERVAL … #define DEFAULT_SHORT_RETRY_LIMIT … #define DEFAULT_LONG_RETRY_LIMIT … #define IWL_NUM_SCAN_RATES … #define IEEE80211_DATA_LEN … #define IEEE80211_4ADDR_LEN … #define IEEE80211_HLEN … #define IEEE80211_FRAME_LEN … #define SUP_RATE_11A_MAX_NUM_CHANNELS … #define SUP_RATE_11B_MAX_NUM_CHANNELS … #define SUP_RATE_11G_MAX_NUM_CHANNELS … #define IWL_SUPPORTED_RATES_IE_LEN … #define IWL_INVALID_RATE … #define IWL_INVALID_VALUE … iwl_ht_rate_supp; struct iwl_ht_config { … }; /* QoS structures */ struct iwl_qos_info { … }; /** * enum iwl_agg_state * * The state machine of the BA agreement establishment / tear down. * These states relate to a specific RA / TID. * * @IWL_AGG_OFF: aggregation is not used * @IWL_AGG_STARTING: aggregation are starting (between start and oper) * @IWL_AGG_ON: aggregation session is up * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the * HW queue to be empty from packets for this RA /TID. * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the * HW queue to be empty from packets for this RA /TID. */ enum iwl_agg_state { … }; /** * struct iwl_ht_agg - aggregation state machine * * This structs holds the states for the BA agreement establishment and tear * down. It also holds the state during the BA session itself. This struct is * duplicated for each RA / TID. * * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the * Tx response (REPLY_TX), and the block ack notification * (REPLY_COMPRESSED_BA). * @state: state of the BA agreement establishment / tear down. * @txq_id: Tx queue used by the BA session * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or * the first packet to be sent in legacy HW queue in Tx AGG stop flow. * Basically when next_reclaimed reaches ssn, we can tell mac80211 that * we are ready to finish the Tx AGG stop / start flow. * @wait_for_ba: Expect block-ack before next Tx reply */ struct iwl_ht_agg { … }; /** * struct iwl_tid_data - one for each RA / TID * * This structs holds the states for each RA / TID. * * @seq_number: the next WiFi sequence number to use * @next_reclaimed: the WiFi sequence number of the next packet to be acked. * This is basically (last acked packet++). * @agg: aggregation state machine */ struct iwl_tid_data { … }; /* * Structure should be accessed with sta_lock held. When station addition * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock * held. */ struct iwl_station_entry { … }; /* * iwl_station_priv: Driver's private station information * * When mac80211 creates a station it reserves some space (hw->sta_data_size) * in the structure for use by driver. This structure is places in that * space. */ struct iwl_station_priv { … }; /* * struct iwl_vif_priv - driver's private per-interface information * * When mac80211 allocates a virtual interface, it can allocate * space for us to put data into. */ struct iwl_vif_priv { … }; struct iwl_sensitivity_ranges { … }; /****************************************************************************** * * Functions implemented in core module which are forward declared here * for use by iwl-[4-5].c * * NOTE: The implementation of these functions are not hardware specific * which is why they are in the core module files. * * Naming convention -- * iwl_ <-- Is part of iwlwifi * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) * ****************************************************************************/ void iwl_update_chain_flags(struct iwl_priv *priv); extern const u8 iwl_bcast_addr[ETH_ALEN]; #define IWL_OPERATION_MODE_AUTO … #define IWL_OPERATION_MODE_HT_ONLY … #define IWL_OPERATION_MODE_MIXED … #define IWL_OPERATION_MODE_20MHZ … #define TX_POWER_IWL_ILLEGAL_VOLTAGE … /* Sensitivity and chain noise calibration */ #define INITIALIZATION_VALUE … #define IWL_CAL_NUM_BEACONS … #define MAXIMUM_ALLOWED_PATHLOSS … #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE … #define MAX_FA_OFDM … #define MIN_FA_OFDM … #define MAX_FA_CCK … #define MIN_FA_CCK … #define AUTO_CORR_STEP_OFDM … #define AUTO_CORR_STEP_CCK … #define AUTO_CORR_MAX_TH_CCK … #define NRG_DIFF … #define NRG_STEP_CCK … #define NRG_MARGIN … #define MAX_NUMBER_CCK_NO_FA … #define AUTO_CORR_CCK_MIN_VAL_DEF … #define CHAIN_A … #define CHAIN_B … #define CHAIN_C … #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL … #define ALL_BAND_FILTER … #define IN_BAND_FILTER … #define MIN_AVERAGE_NOISE_MAX_VALUE … #define NRG_NUM_PREV_STAT_L … #define NUM_RX_CHAINS … enum iwlagn_false_alarm_state { … }; enum iwlagn_chain_noise_state { … }; /* Sensitivity calib data */ struct iwl_sensitivity_data { … }; /* Chain noise (differential Rx gain) calib data */ struct iwl_chain_noise_data { … }; enum { … }; /* reply_tx_statistics (for _agn devices) */ struct reply_tx_error_statistics { … }; /* reply_agg_tx_statistics (for _agn devices) */ struct reply_agg_tx_error_statistics { … }; /* * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds * to perform continuous uCode event logging operation if enabled */ #define UCODE_TRACE_PERIOD … /* * iwl_event_log: current uCode event log position * * @ucode_trace: enable/disable ucode continuous trace timer * @num_wraps: how many times the event buffer wraps * @next_entry: the entry just before the next one that uCode would fill * @non_wraps_count: counter for no wrap detected when dump ucode events * @wraps_once_count: counter for wrap once detected when dump ucode events * @wraps_more_count: counter for wrap more than once detected * when dump ucode events */ struct iwl_event_log { … }; #define IWL_DELAY_NEXT_FORCE_RF_RESET … /* BT Antenna Coupling Threshold (dB) */ #define IWL_BT_ANTENNA_COUPLING_THRESHOLD … /* Firmware reload counter and Timestamp */ #define IWL_MIN_RELOAD_DURATION … #define IWL_MAX_CONTINUE_RELOAD_CNT … struct iwl_rf_reset { … }; enum iwl_rxon_context_id { … }; /* extend beacon time format bit shifting */ /* * for _agn devices * bits 31:22 - extended * bits 21:0 - interval */ #define IWLAGN_EXT_BEACON_TIME_POS … struct iwl_rxon_context { … }; enum iwl_scan_type { … }; /** * struct iwl_hw_params * * Holds the module parameters * * @tx_chains_num: Number of TX chains * @rx_chains_num: Number of RX chains * @ct_kill_threshold: temperature threshold - in hw dependent unit * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit * relevant for 1000, 6000 and up * @struct iwl_sensitivity_ranges: range of sensitivity values * @use_rts_for_aggregation: use rts/cts protection for HT traffic * @sens: sensitivity ranges pointer */ struct iwl_hw_params { … }; /** * struct iwl_dvm_bt_params - DVM specific BT (coex) parameters * @advanced_bt_coexist: support advanced bt coexist * @bt_init_traffic_load: specify initial bt traffic load * @bt_prio_boost: default bt priority boost value * @agg_time_limit: maximum number of uSec in aggregation * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode * @bt_session_2: indicates version 2 of the BT command is used */ struct iwl_dvm_bt_params { … }; /** * struct iwl_dvm_cfg - DVM firmware specific device configuration * @set_hw_params: set hardware parameters * @set_channel_switch: send channel switch command * @nic_config: apply device specific configuration * @temperature: read temperature * @adv_thermal_throttle: support advance thermal throttle * @support_ct_kill_exit: support ct kill exit condition * @plcp_delta_threshold: plcp error rate threshold used to trigger * radio tuning when there is a high receiving plcp error rate * @chain_noise_scale: default chain noise scale used for gain computation * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up * @no_idle_support: do not support idle mode * @bt_params: pointer to BT parameters * @need_temp_offset_calib: need to perform temperature offset calibration * @no_xtal_calib: some devices do not need crystal calibration data, * don't send it to those * @temp_offset_v2: support v2 of temperature offset calibration * @adv_pm: advanced power management */ struct iwl_dvm_cfg { … }; struct iwl_wipan_noa_data { … }; /* Calibration disabling bit mask */ enum { … }; #define IWL_OP_MODE_GET_DVM(_iwl_op_mode) … #define IWL_MAC80211_GET_DVM(_hw) … struct iwl_priv { … }; /*iwl_priv */ static inline struct iwl_rxon_context * iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) { … } #define for_each_context(priv, ctx) … static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) { … } static inline int iwl_is_associated(struct iwl_priv *priv, enum iwl_rxon_context_id ctxid) { … } static inline int iwl_is_any_associated(struct iwl_priv *priv) { … } #endif /* __iwl_dev_h__ */