Path: blob/main/sys/contrib/dev/iwlwifi/mvm/mvm.h
106846 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2012-2014, 2018-2025 Intel Corporation3* Copyright (C) 2013-2015 Intel Mobile Communications GmbH4* Copyright (C) 2016-2017 Intel Deutschland GmbH5*/6#ifndef __IWL_MVM_H__7#define __IWL_MVM_H__89#include <linux/list.h>10#include <linux/spinlock.h>11#include <linux/cleanup.h>12#ifdef CONFIG_IWLWIFI_LEDS13#include <linux/leds.h>14#endif15#include <linux/in6.h>1617#ifdef CONFIG_THERMAL18#include <linux/thermal.h>19#endif2021#include <linux/ptp_clock_kernel.h>2223#include <linux/ktime.h>2425#include "iwl-op-mode.h"26#include "iwl-trans.h"27#include "fw/notif-wait.h"28#include "iwl-nvm-utils.h"29#include "fw/file.h"30#include "iwl-config.h"31#include "sta.h"32#include "fw-api.h"33#include "constants.h"34#include "fw/runtime.h"35#include "fw/dbg.h"36#include "fw/acpi.h"37#include "mei/iwl-mei.h"38#include "iwl-nvm-parse.h"3940#include <linux/average.h>41#if defined(__FreeBSD__)42#include <net/if_inet6.h>43#endif4445#define IWL_MVM_MAX_ADDRESSES 546/* RSSI offset for WkP */47#define IWL_RSSI_OFFSET 5048#define IWL_MVM_MISSED_BEACONS_SINCE_RX_THOLD 449#define IWL_MVM_MISSED_BEACONS_THRESHOLD 850#define IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG 195152/* A TimeUnit is 1024 microsecond */53#define MSEC_TO_TU(_msec) (_msec*1000/1024)5455/* For GO, this value represents the number of TUs before CSA "beacon56* 0" TBTT when the CSA time-event needs to be scheduled to start. It57* must be big enough to ensure that we switch in time.58*/59#define IWL_MVM_CHANNEL_SWITCH_TIME_GO 406061/* For client, this value represents the number of TUs before CSA62* "beacon 1" TBTT, instead. This is because we don't know when the63* GO/AP will be in the new channel, so we switch early enough.64*/65#define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 106667/*68* This value (in TUs) is used to fine tune the CSA NoA end time which should69* be just before "beacon 0" TBTT.70*/71#define IWL_MVM_CHANNEL_SWITCH_MARGIN 47273/*74* Number of beacons to transmit on a new channel until we unblock tx to75* the stations, even if we didn't identify them on a new channel76*/77#define IWL_MVM_CS_UNBLOCK_TX_TIMEOUT 37879/* offchannel queue towards mac80211 */80#define IWL_MVM_OFFCHANNEL_QUEUE 08182/* invalid value for FW link id */83#define IWL_MVM_FW_LINK_ID_INVALID 0xff8485extern const struct ieee80211_ops iwl_mvm_hw_ops;86extern const struct ieee80211_ops iwl_mvm_mld_hw_ops;8788/**89* struct iwl_mvm_mod_params - module parameters for iwlmvm90* @power_scheme: one of enum iwl_power_scheme91*/92struct iwl_mvm_mod_params {93int power_scheme;94};95extern struct iwl_mvm_mod_params iwlmvm_mod_params;9697struct iwl_mvm_phy_ctxt {98u16 id;99u16 color;100u32 ref;101102enum nl80211_chan_width width;103104struct ieee80211_channel *channel;105106/* track for RLC config command */107u32 center_freq1;108bool rlc_disabled;109u32 channel_load_by_us;110u32 channel_load_not_by_us;111};112113struct iwl_mvm_time_event_data {114struct ieee80211_vif *vif;115struct list_head list;116unsigned long end_jiffies;117u32 duration;118bool running;119u32 uid;120121/*122* The access to the 'id' field must be done when the123* mvm->time_event_lock is held, as it value is used to indicate124* if the te is in the time event list or not (when id == TE_MAX)125*/126u32 id;127s8 link_id;128};129130/* Power management */131132/**133* enum iwl_power_scheme - iwl power schemes134* @IWL_POWER_SCHEME_CAM: Continuously Active Mode135* @IWL_POWER_SCHEME_BPS: Balanced Power Save (default)136* @IWL_POWER_SCHEME_LP: Low Power137*/138enum iwl_power_scheme {139IWL_POWER_SCHEME_CAM = 1,140IWL_POWER_SCHEME_BPS,141IWL_POWER_SCHEME_LP142};143144#define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL145146#ifdef CONFIG_IWLWIFI_DEBUGFS147enum iwl_dbgfs_pm_mask {148MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0),149MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1),150MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2),151MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3),152MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4),153MVM_DEBUGFS_PM_LPRX_ENA = BIT(6),154MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7),155MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8),156MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9),157MVM_DEBUGFS_PM_USE_PS_POLL = BIT(10),158};159160struct iwl_dbgfs_pm {161u16 keep_alive_seconds;162u32 rx_data_timeout;163u32 tx_data_timeout;164bool skip_over_dtim;165u8 skip_dtim_periods;166bool lprx_ena;167u32 lprx_rssi_threshold;168bool snooze_ena;169bool uapsd_misbehaving;170bool use_ps_poll;171int mask;172};173174/* beacon filtering */175176enum iwl_dbgfs_bf_mask {177MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0),178MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1),179MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2),180MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3),181MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4),182MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5),183MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6),184MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7),185MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8),186MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9),187MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10),188};189190struct iwl_dbgfs_bf {191u32 bf_energy_delta;192u32 bf_roaming_energy_delta;193u32 bf_roaming_state;194u32 bf_temp_threshold;195u32 bf_temp_fast_filter;196u32 bf_temp_slow_filter;197u32 bf_enable_beacon_filter;198u32 bf_debug_flag;199u32 bf_escape_timer;200u32 ba_escape_timer;201u32 ba_enable_beacon_abort;202int mask;203};204#endif205206enum iwl_mvm_smps_type_request {207IWL_MVM_SMPS_REQ_BT_COEX,208IWL_MVM_SMPS_REQ_TT,209IWL_MVM_SMPS_REQ_PROT,210IWL_MVM_SMPS_REQ_FW,211NUM_IWL_MVM_SMPS_REQ,212};213214enum iwl_bt_force_ant_mode {215BT_FORCE_ANT_DIS = 0,216BT_FORCE_ANT_AUTO,217BT_FORCE_ANT_BT,218BT_FORCE_ANT_WIFI,219220BT_FORCE_ANT_MAX,221};222223/**224* enum iwl_mvm_low_latency_force - low latency force mode set by debugfs225* @LOW_LATENCY_FORCE_UNSET: unset force mode226* @LOW_LATENCY_FORCE_ON: for low latency on227* @LOW_LATENCY_FORCE_OFF: for low latency off228* @NUM_LOW_LATENCY_FORCE: max num of modes229*/230enum iwl_mvm_low_latency_force {231LOW_LATENCY_FORCE_UNSET,232LOW_LATENCY_FORCE_ON,233LOW_LATENCY_FORCE_OFF,234NUM_LOW_LATENCY_FORCE235};236237/**238* enum iwl_mvm_low_latency_cause - low latency set causes239* @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected240* @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs241* @LOW_LATENCY_VCMD: low latency mode set from vendor command242* @LOW_LATENCY_VIF_TYPE: low latency mode set because of vif type (ap)243* @LOW_LATENCY_DEBUGFS_FORCE_ENABLE: indicate that force mode is enabled244* the actual set/unset is done with LOW_LATENCY_DEBUGFS_FORCE245* @LOW_LATENCY_DEBUGFS_FORCE: low latency force mode from debugfs246* set this with LOW_LATENCY_DEBUGFS_FORCE_ENABLE flag247* in low_latency.248*/249enum iwl_mvm_low_latency_cause {250LOW_LATENCY_TRAFFIC = BIT(0),251LOW_LATENCY_DEBUGFS = BIT(1),252LOW_LATENCY_VCMD = BIT(2),253LOW_LATENCY_VIF_TYPE = BIT(3),254LOW_LATENCY_DEBUGFS_FORCE_ENABLE = BIT(4),255LOW_LATENCY_DEBUGFS_FORCE = BIT(5),256};257258/**259* struct iwl_mvm_link_bf_data - beacon filtering related data260* @ave_beacon_signal: average beacon signal261* @last_cqm_event: rssi of the last cqm event262* @bt_coex_min_thold: minimum threshold for BT coex263* @bt_coex_max_thold: maximum threshold for BT coex264* @last_bt_coex_event: rssi of the last BT coex event265*/266struct iwl_mvm_link_bf_data {267int ave_beacon_signal;268int last_cqm_event;269int bt_coex_min_thold;270int bt_coex_max_thold;271int last_bt_coex_event;272};273274/**275* struct iwl_probe_resp_data - data for NoA/CSA updates276* @rcu_head: used for freeing the data on update277* @notif: notification data278* @noa_len: length of NoA attribute, calculated from the notification279*/280struct iwl_probe_resp_data {281struct rcu_head rcu_head;282struct iwl_probe_resp_data_notif notif;283int noa_len;284};285286/**287* struct iwl_mvm_vif_link_info - per link data in Virtual Interface288* @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA289* @fw_link_id: the id of the link according to the FW API290* @bssid: BSSID for this (client) interface291* @bcast_sta: station used for broadcast packets. Used by the following292* vifs: P2P_DEVICE, GO and AP.293* @beacon_stats: beacon statistics, containing the # of received beacons,294* # of received beacons accumulated over FW restart, and the current295* average signal of beacons retrieved from the firmware296* @smps_requests: the SMPS requests of different parts of the driver,297* combined on update to yield the overall request to mac80211.298* @probe_resp_data: data from FW notification to store NOA and CSA related299* data to be inserted into probe response.300* @he_ru_2mhz_block: 26-tone RU OFDMA transmissions should be blocked301* @queue_params: QoS params for this MAC302* @mgmt_queue: queue number for unbufferable management frames303* @igtk: the current IGTK programmed into the firmware304* @active: indicates the link is active in FW (for sanity checking)305* @cab_queue: content-after-beacon (multicast) queue306* @listen_lmac: indicates this link is allocated to the listen LMAC307* @csa_block_tx: we got CSA with mode=1308* @mcast_sta: multicast station309* @phy_ctxt: phy context allocated to this link, if any310* @bf_data: beacon filtering data311* @average_beacon_energy: average beacon energy for beacons received during312* client connections313*/314struct iwl_mvm_vif_link_info {315u8 bssid[ETH_ALEN];316u8 ap_sta_id;317u8 fw_link_id;318319struct iwl_mvm_int_sta bcast_sta;320struct iwl_mvm_int_sta mcast_sta;321322struct {323u32 num_beacons, accu_num_beacons;324u8 avg_signal;325} beacon_stats;326327enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];328struct iwl_probe_resp_data __rcu *probe_resp_data;329330struct ieee80211_key_conf *igtk;331332bool he_ru_2mhz_block;333bool active;334bool listen_lmac;335bool csa_block_tx;336337u16 cab_queue;338/* Assigned while mac80211 has the link in a channel context,339* or, for P2P Device, while it exists.340*/341struct iwl_mvm_phy_ctxt *phy_ctxt;342/* QoS data from mac80211, need to store this here343* as mac80211 has a separate callback but we need344* to have the data for the MAC context345*/346struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];347348u16 mgmt_queue;349350struct iwl_mvm_link_bf_data bf_data;351u32 average_beacon_energy;352};353354/**355* enum iwl_mvm_esr_state - defines reasons for which the EMLSR is exited or356* blocked.357* The low 16 bits are used for blocking reasons, and the 16 higher bits358* are used for exit reasons.359* For the blocking reasons - use iwl_mvm_(un)block_esr(), and for the exit360* reasons - use iwl_mvm_exit_esr().361*362* Note: new reasons shall be added to HANDLE_ESR_REASONS as well (for logs)363*364* @IWL_MVM_ESR_BLOCKED_PREVENTION: Prevent EMLSR to avoid entering and exiting365* in a loop.366* @IWL_MVM_ESR_BLOCKED_WOWLAN: WOWLAN is preventing the enablement of EMLSR367* @IWL_MVM_ESR_BLOCKED_TPT: block EMLSR when there is not enough traffic368* @IWL_MVM_ESR_BLOCKED_FW: FW didn't recommended/forced exit from EMLSR369* @IWL_MVM_ESR_BLOCKED_NON_BSS: An active non-BSS interface's link is370* preventing EMLSR371* @IWL_MVM_ESR_BLOCKED_ROC: remain-on-channel is preventing EMLSR372* @IWL_MVM_ESR_BLOCKED_TMP_NON_BSS: An expected active non-BSS interface's link373* is preventing EMLSR. This is a temporary blocking that is set when there374* is an indication that a non-BSS interface is to be added.375* @IWL_MVM_ESR_EXIT_MISSED_BEACON: exited EMLSR due to missed beacons376* @IWL_MVM_ESR_EXIT_LOW_RSSI: link is deactivated/not allowed for EMLSR377* due to low RSSI.378* @IWL_MVM_ESR_EXIT_COEX: link is deactivated/not allowed for EMLSR379* due to BT Coex.380* @IWL_MVM_ESR_EXIT_BANDWIDTH: Bandwidths of primary and secondry links381* preventing the enablement of EMLSR382* @IWL_MVM_ESR_EXIT_CSA: CSA happened, so exit EMLSR383* @IWL_MVM_ESR_EXIT_LINK_USAGE: Exit EMLSR due to low tpt on secondary link384*/385enum iwl_mvm_esr_state {386IWL_MVM_ESR_BLOCKED_PREVENTION = 0x1,387IWL_MVM_ESR_BLOCKED_WOWLAN = 0x2,388IWL_MVM_ESR_BLOCKED_TPT = 0x4,389IWL_MVM_ESR_BLOCKED_FW = 0x8,390IWL_MVM_ESR_BLOCKED_NON_BSS = 0x10,391IWL_MVM_ESR_BLOCKED_ROC = 0x20,392IWL_MVM_ESR_BLOCKED_TMP_NON_BSS = 0x40,393IWL_MVM_ESR_EXIT_MISSED_BEACON = 0x10000,394IWL_MVM_ESR_EXIT_LOW_RSSI = 0x20000,395IWL_MVM_ESR_EXIT_COEX = 0x40000,396IWL_MVM_ESR_EXIT_BANDWIDTH = 0x80000,397IWL_MVM_ESR_EXIT_CSA = 0x100000,398IWL_MVM_ESR_EXIT_LINK_USAGE = 0x200000,399};400401#define IWL_MVM_BLOCK_ESR_REASONS 0xffff402403const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state);404405/**406* struct iwl_mvm_esr_exit - details of the last exit from EMLSR mode.407* @reason: The reason for the last exit from EMLSR.408* &iwl_mvm_prevent_esr_reasons. Will be 0 before exiting EMLSR.409* @ts: the time stamp of the last time we existed EMLSR.410*/411struct iwl_mvm_esr_exit {412unsigned long ts;413enum iwl_mvm_esr_state reason;414};415416/**417* struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context418* @mvm: pointer back to the mvm struct419* @id: between 0 and 3420* @color: to solve races upon MAC addition and removal421* @associated: indicates that we're currently associated, used only for422* managing the firmware state in iwl_mvm_bss_info_changed_station()423* @ap_assoc_sta_count: count of stations associated to us - valid only424* if VIF type is AP425* @uploaded: indicates the MAC context has been added to the device426* @ap_ibss_active: indicates that AP/IBSS is configured and that the interface427* should get quota etc.428* @pm_enabled - indicate if MAC power management is allowed429* @monitor_active: indicates that monitor context is configured, and that the430* interface should get quota etc.431* @low_latency: bit flags for low latency432* see enum &iwl_mvm_low_latency_cause for causes.433* @low_latency_actual: boolean, indicates low latency is set,434* as a result from low_latency bit flags and takes force into account.435* @authorized: indicates the AP station was set to authorized436* @ps_disabled: indicates that this interface requires PS to be disabled437* @csa_countdown: indicates that CSA countdown may be started438* @csa_failed: CSA failed to schedule time event, report an error later439* @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel440* @csa_blocks_tx: CSA is blocking TX441* @features: hw features active for this vif442* @max_tx_op: max TXOP in usecs for all ACs, zero for no limit.443* @ap_beacon_time: AP beacon time for synchronisation (on older FW)444* @bf_enabled: indicates if beacon filtering is enabled445* @ba_enabled: indicated if beacon abort is enabled446* @bcn_prot: beacon protection data (keys; FIXME: needs to be per link)447* @deflink: default link data for use in non-MLO448* @link: link data for each link in MLO449* @esr_active: indicates eSR mode is active450* @esr_disable_reason: a bitmap of &enum iwl_mvm_esr_state451* @pm_enabled: indicates powersave is enabled452* @link_selection_res: bitmap of active links as it was decided in the last453* link selection. Valid only for a MLO vif after assoc. 0 if there wasn't454* any link selection yet.455* @link_selection_primary: primary link selected by link selection456* @primary_link: primary link in eSR. Valid only for an associated MLD vif,457* and in eSR mode. Valid only for a STA.458* @last_esr_exit: Details of the last exit from EMLSR.459* @exit_same_reason_count: The number of times we exited due to the specified460* @last_esr_exit::reason, only counting exits due to461* &IWL_MVM_ESR_PREVENT_REASONS.462* @prevent_esr_done_wk: work that should be done when esr prevention ends.463* @mlo_int_scan_wk: work for the internal MLO scan.464* @unblock_esr_tpt_wk: work for unblocking EMLSR when tpt is high enough.465* @unblock_esr_tmp_non_bss_wk: work for removing the466* IWL_MVM_ESR_BLOCKED_TMP_NON_BSS blocking for EMLSR.467* @roc_activity: currently running ROC activity for this vif (or468* ROC_NUM_ACTIVITIES if no activity is running).469* @session_prot_connection_loss: the connection was lost due to session470* protection ending without receiving a beacon, so we need to now471* protect the deauth separately472* @ap_early_keys: The firmware cannot install keys before stations etc.,473* but higher layers work differently, so we store the keys here for474* later installation.475* @ap_sta: pointer to the AP STA data structure476* @csa_count: CSA counter (old CSA implementation w/o firmware)477* @csa_misbehave: CSA AP misbehaviour flag (old implementation)478* @csa_target_freq: CSA target channel frequency (old implementation)479* @csa_work: CSA work (old implementation)480* @dbgfs_bf: beamforming debugfs data481* @dbgfs_dir: debugfs directory for this vif482* @dbgfs_pm: power management debugfs data483* @dbgfs_quota_min: debugfs value for minimal quota484* @dbgfs_slink: debugfs symlink for this interface485* @ftm_unprotected: unprotected FTM debugfs override486* @hs_time_event_data: hotspot/AUX ROC time event data487* @mac_pwr_cmd: debugfs override for MAC power command488* @target_ipv6_addrs: IPv6 addresses on this interface for offload489* @num_target_ipv6_addrs: number of @target_ipv6_addrs490* @tentative_addrs: bitmap of tentative IPv6 addresses in @target_ipv6_addrs491* @rekey_data: rekeying data for WoWLAN GTK rekey offload492* @seqno: storage for seqno for older firmware D0/D3 transition493* @seqno_valid: indicates @seqno is valid494* @time_event_data: session protection time event data495* @tsf_id: the TSF resource ID assigned in firmware (for firmware needing that)496* @tx_key_idx: WEP transmit key index for D3497* @uapsd_misbehaving_ap_addr: MLD address/BSSID of U-APSD misbehaving AP, to498* not use U-APSD on reconnection499* @uapsd_nonagg_detected_wk: worker for handling detection of no aggregation500* in U-APSD501*/502struct iwl_mvm_vif {503struct iwl_mvm *mvm;504u16 id;505u16 color;506507bool associated;508u8 ap_assoc_sta_count;509bool uploaded;510bool ap_ibss_active;511bool pm_enabled;512bool monitor_active;513bool esr_active;514bool session_prot_connection_loss;515516u8 low_latency: 6;517u8 low_latency_actual: 1;518519u8 authorized:1;520bool ps_disabled;521522u32 esr_disable_reason;523u32 ap_beacon_time;524bool bf_enabled;525bool ba_enabled;526527#ifdef CONFIG_PM_SLEEP528/* WoWLAN GTK rekey data */529struct {530u8 kck[NL80211_KCK_EXT_LEN];531u8 kek[NL80211_KEK_EXT_LEN];532size_t kek_len;533size_t kck_len;534u32 akm;535__le64 replay_ctr;536bool valid;537} rekey_data;538539int tx_key_idx;540541bool seqno_valid;542u16 seqno;543#endif544545#if IS_ENABLED(CONFIG_IPV6)546/* IPv6 addresses for WoWLAN */547struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX];548unsigned long tentative_addrs[BITS_TO_LONGS(IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX)];549int num_target_ipv6_addrs;550#endif551552#ifdef CONFIG_IWLWIFI_DEBUGFS553struct dentry *dbgfs_dir;554struct dentry *dbgfs_slink;555struct iwl_dbgfs_pm dbgfs_pm;556struct iwl_dbgfs_bf dbgfs_bf;557struct iwl_mac_power_cmd mac_pwr_cmd;558int dbgfs_quota_min;559bool ftm_unprotected;560#endif561562/* FW identified misbehaving AP */563u8 uapsd_misbehaving_ap_addr[ETH_ALEN] __aligned(2);564struct delayed_work uapsd_nonagg_detected_wk;565566bool csa_countdown;567bool csa_failed;568bool csa_bcn_pending;569bool csa_blocks_tx;570u16 csa_target_freq;571u16 csa_count;572u16 csa_misbehave;573struct delayed_work csa_work;574575enum iwl_tsf_id tsf_id;576577struct iwl_mvm_time_event_data time_event_data;578struct iwl_mvm_time_event_data hs_time_event_data;579enum iwl_roc_activity roc_activity;580581/* TCP Checksum Offload */582netdev_features_t features;583584struct ieee80211_sta *ap_sta;585586/* we can only have 2 GTK + 2 IGTK active at a time */587struct ieee80211_key_conf *ap_early_keys[4];588589struct {590struct ieee80211_key_conf __rcu *keys[2];591} bcn_prot;592593u16 max_tx_op;594595u16 link_selection_res;596u8 link_selection_primary;597u8 primary_link;598struct iwl_mvm_esr_exit last_esr_exit;599u8 exit_same_reason_count;600struct wiphy_delayed_work prevent_esr_done_wk;601struct wiphy_delayed_work mlo_int_scan_wk;602struct wiphy_work unblock_esr_tpt_wk;603struct wiphy_delayed_work unblock_esr_tmp_non_bss_wk;604605struct iwl_mvm_vif_link_info deflink;606struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS];607};608609#define for_each_mvm_vif_valid_link(mvm_vif, link_id) \610for (link_id = 0; \611link_id < ARRAY_SIZE((mvm_vif)->link); \612link_id++) \613if ((mvm_vif)->link[link_id])614615static inline struct iwl_mvm_vif *616iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)617{618return (void *)vif->drv_priv;619}620621extern const u8 tid_to_mac80211_ac[];622623#define IWL_MVM_SCAN_STOPPING_SHIFT 8624625enum iwl_scan_status {626IWL_MVM_SCAN_REGULAR = BIT(0),627IWL_MVM_SCAN_SCHED = BIT(1),628IWL_MVM_SCAN_NETDETECT = BIT(2),629IWL_MVM_SCAN_INT_MLO = BIT(3),630631IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8),632IWL_MVM_SCAN_STOPPING_SCHED = BIT(9),633IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10),634IWL_MVM_SCAN_STOPPING_INT_MLO = BIT(11),635636IWL_MVM_SCAN_REGULAR_MASK = IWL_MVM_SCAN_REGULAR |637IWL_MVM_SCAN_STOPPING_REGULAR,638IWL_MVM_SCAN_SCHED_MASK = IWL_MVM_SCAN_SCHED |639IWL_MVM_SCAN_STOPPING_SCHED,640IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT |641IWL_MVM_SCAN_STOPPING_NETDETECT,642IWL_MVM_SCAN_INT_MLO_MASK = IWL_MVM_SCAN_INT_MLO |643IWL_MVM_SCAN_STOPPING_INT_MLO,644645IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT,646IWL_MVM_SCAN_MASK = 0xff,647};648649enum iwl_mvm_scan_type {650IWL_SCAN_TYPE_NOT_SET,651IWL_SCAN_TYPE_UNASSOC,652IWL_SCAN_TYPE_WILD,653IWL_SCAN_TYPE_MILD,654IWL_SCAN_TYPE_FRAGMENTED,655IWL_SCAN_TYPE_FAST_BALANCE,656};657658enum iwl_mvm_sched_scan_pass_all_states {659SCHED_SCAN_PASS_ALL_DISABLED,660SCHED_SCAN_PASS_ALL_ENABLED,661SCHED_SCAN_PASS_ALL_FOUND,662};663664/**665* struct iwl_mvm_tt_mgmt - Thermal Throttling Management structure666* @ct_kill_exit: worker to exit thermal kill667* @dynamic_smps: Is thermal throttling enabled dynamic_smps?668* @tx_backoff: The current thremal throttling tx backoff in uSec.669* @min_backoff: The minimal tx backoff due to power restrictions670* @params: Parameters to configure the thermal throttling algorithm.671* @throttle: Is thermal throttling is active?672* @power_budget_mw: maximum cTDP power budget as defined for this system and673* device674*/675struct iwl_mvm_tt_mgmt {676struct delayed_work ct_kill_exit;677bool dynamic_smps;678u32 tx_backoff;679u32 min_backoff;680struct iwl_tt_params params;681bool throttle;682683u32 power_budget_mw;684};685686#ifdef CONFIG_THERMAL687/**688* struct iwl_mvm_thermal_device - thermal zone related data689* @trips: temperature thresholds for report690* @tzone: thermal zone device data691*/692struct iwl_mvm_thermal_device {693struct thermal_trip trips[IWL_MAX_DTS_TRIPS];694struct thermal_zone_device *tzone;695};696697/*698* struct iwl_mvm_cooling_device699* @cur_state: current state700* @cdev: struct thermal cooling device701*/702struct iwl_mvm_cooling_device {703u32 cur_state;704struct thermal_cooling_device *cdev;705};706#endif707708#define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8709710struct iwl_mvm_frame_stats {711u32 legacy_frames;712u32 ht_frames;713u32 vht_frames;714u32 bw_20_frames;715u32 bw_40_frames;716u32 bw_80_frames;717u32 bw_160_frames;718u32 sgi_frames;719u32 ngi_frames;720u32 siso_frames;721u32 mimo2_frames;722u32 agg_frames;723u32 ampdu_count;724u32 success_frames;725u32 fail_frames;726u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES];727int last_frame_idx;728};729730#define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff731#define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100732#define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200733734enum iwl_mvm_tdls_cs_state {735IWL_MVM_TDLS_SW_IDLE = 0,736IWL_MVM_TDLS_SW_REQ_SENT,737IWL_MVM_TDLS_SW_RESP_RCVD,738IWL_MVM_TDLS_SW_REQ_RCVD,739IWL_MVM_TDLS_SW_ACTIVE,740};741742enum iwl_mvm_traffic_load {743IWL_MVM_TRAFFIC_LOW,744IWL_MVM_TRAFFIC_MEDIUM,745IWL_MVM_TRAFFIC_HIGH,746};747748DECLARE_EWMA(rate, 16, 16)749750struct iwl_mvm_tcm_mac {751struct {752u32 pkts[IEEE80211_NUM_ACS];753u32 airtime;754} tx;755struct {756u32 pkts[IEEE80211_NUM_ACS];757u32 airtime;758u32 last_ampdu_ref;759} rx;760struct {761/* track AP's transfer in client mode */762u64 rx_bytes;763struct ewma_rate rate;764bool detected;765} uapsd_nonagg_detect;766bool opened_rx_ba_sessions;767};768769struct iwl_mvm_tcm {770struct delayed_work work;771spinlock_t lock; /* used when time elapsed */772unsigned long ts; /* timestamp when period ends */773unsigned long ll_ts;774unsigned long uapsd_nonagg_ts;775bool paused;776struct iwl_mvm_tcm_mac data[NUM_MAC_INDEX_DRIVER];777struct {778u32 elapsed; /* milliseconds for this TCM period */779u32 airtime[NUM_MAC_INDEX_DRIVER];780enum iwl_mvm_traffic_load load[NUM_MAC_INDEX_DRIVER];781enum iwl_mvm_traffic_load band_load[NUM_NL80211_BANDS];782enum iwl_mvm_traffic_load global_load;783bool low_latency[NUM_MAC_INDEX_DRIVER];784bool change[NUM_MAC_INDEX_DRIVER];785} result;786};787788/**789* struct iwl_mvm_reorder_buffer - per ra/tid/queue reorder buffer790* @head_sn: reorder window head sn791* @num_stored: number of mpdus stored in the buffer792* @queue: queue of this reorder buffer793* @valid: reordering is valid for this queue794* @lock: protect reorder buffer internal state795*/796struct iwl_mvm_reorder_buffer {797u16 head_sn;798u16 num_stored;799int queue;800bool valid;801spinlock_t lock;802} ____cacheline_aligned_in_smp;803804/**805* struct iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno806* @frames: list of skbs stored807*/808struct iwl_mvm_reorder_buf_entry {809struct sk_buff_head frames;810}811#ifndef __CHECKER__812/* sparse doesn't like this construct: "bad integer constant expression" */813__aligned(roundup_pow_of_two(sizeof(struct sk_buff_head)))814#endif815;816817/**818* struct iwl_mvm_baid_data - BA session data819* @sta_mask: current station mask for the BAID820* @tid: tid of the session821* @baid: baid of the session822* @timeout: the timeout set in the addba request823* @buf_size: the reorder buffer size as set by the last addba request824* @entries_per_queue: # of buffers per queue, this actually gets825* aligned up to avoid cache line sharing between queues826* @last_rx: last rx jiffies, updated only if timeout passed from last update827* @session_timer: timer to check if BA session expired, runs at 2 * timeout828* @rcu_ptr: BA data RCU protected access829* @rcu_head: RCU head for freeing this data830* @mvm: mvm pointer, needed for timer context831* @reorder_buf: reorder buffer, allocated per queue832* @entries: data833*/834struct iwl_mvm_baid_data {835struct rcu_head rcu_head;836u32 sta_mask;837u8 tid;838u8 baid;839u16 timeout;840u16 buf_size;841u16 entries_per_queue;842unsigned long last_rx;843struct timer_list session_timer;844struct iwl_mvm_baid_data __rcu **rcu_ptr;845struct iwl_mvm *mvm;846struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES];847struct iwl_mvm_reorder_buf_entry entries[] ____cacheline_aligned_in_smp;848};849850static inline struct iwl_mvm_baid_data *851iwl_mvm_baid_data_from_reorder_buf(struct iwl_mvm_reorder_buffer *buf)852{853return (void *)((u8 *)buf -854offsetof(struct iwl_mvm_baid_data, reorder_buf) -855sizeof(*buf) * buf->queue);856}857858/*859* enum iwl_mvm_queue_status - queue status860* @IWL_MVM_QUEUE_FREE: the queue is not allocated nor reserved861* Basically, this means that this queue can be used for any purpose862* @IWL_MVM_QUEUE_RESERVED: queue is reserved but not yet in use863* This is the state of a queue that has been dedicated for some RATID864* (agg'd or not), but that hasn't yet gone through the actual enablement865* of iwl_mvm_enable_txq(), and therefore no traffic can go through it yet.866* Note that in this state there is no requirement to already know what TID867* should be used with this queue, it is just marked as a queue that will868* be used, and shouldn't be allocated to anyone else.869* @IWL_MVM_QUEUE_READY: queue is ready to be used870* This is the state of a queue that has been fully configured (including871* SCD pointers, etc), has a specific RA/TID assigned to it, and can be872* used to send traffic.873* @IWL_MVM_QUEUE_SHARED: queue is shared, or in a process of becoming shared874* This is a state in which a single queue serves more than one TID, all of875* which are not aggregated. Note that the queue is only associated to one876* RA.877*/878enum iwl_mvm_queue_status {879IWL_MVM_QUEUE_FREE,880IWL_MVM_QUEUE_RESERVED,881IWL_MVM_QUEUE_READY,882IWL_MVM_QUEUE_SHARED,883};884885#define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ)886#define IWL_MVM_INVALID_QUEUE 0xFFFF887888#define IWL_MVM_NUM_CIPHERS 10889890891struct iwl_mvm_txq {892struct list_head list;893u16 txq_id;894atomic_t tx_request;895#define IWL_MVM_TXQ_STATE_READY 0896#define IWL_MVM_TXQ_STATE_STOP_FULL 1897#define IWL_MVM_TXQ_STATE_STOP_REDIRECT 2898#define IWL_MVM_TXQ_STATE_STOP_AP_CSA 3899unsigned long state;900};901902static inline struct iwl_mvm_txq *903iwl_mvm_txq_from_mac80211(struct ieee80211_txq *txq)904{905return (void *)txq->drv_priv;906}907908static inline struct iwl_mvm_txq *909iwl_mvm_txq_from_tid(struct ieee80211_sta *sta, u8 tid)910{911if (tid == IWL_MAX_TID_COUNT)912tid = IEEE80211_NUM_TIDS;913914return (void *)sta->txq[tid]->drv_priv;915}916917/**918* struct iwl_mvm_tvqm_txq_info - maps TVQM hw queue to tid919*920* @sta_id: sta id921* @txq_tid: txq tid922*/923struct iwl_mvm_tvqm_txq_info {924u8 sta_id;925u8 txq_tid;926};927928struct iwl_mvm_dqa_txq_info {929u8 ra_sta_id; /* The RA this queue is mapped to, if exists */930bool reserved; /* Is this the TXQ reserved for a STA */931u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */932u8 txq_tid; /* The TID "owner" of this queue*/933u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */934/* Timestamp for inactivation per TID of this queue */935unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1];936enum iwl_mvm_queue_status status;937};938939struct ptp_data {940struct ptp_clock *ptp_clock;941struct ptp_clock_info ptp_clock_info;942943struct delayed_work dwork;944945/* The last GP2 reading from the hw */946u32 last_gp2;947948/* number of wraparounds since scale_update_adj_time_ns */949u32 wrap_counter;950951/* GP2 time when the scale was last updated */952u32 scale_update_gp2;953954/* Adjusted time when the scale was last updated in nanoseconds */955u64 scale_update_adj_time_ns;956957/* clock frequency offset, scaled to 65536000000 */958u64 scaled_freq;959960/* Delta between hardware clock and ptp clock in nanoseconds */961s64 delta;962};963964struct iwl_time_sync_data {965struct sk_buff_head frame_list;966u8 peer_addr[ETH_ALEN];967bool active;968};969970struct iwl_mei_scan_filter {971bool is_mei_limited_scan;972struct sk_buff_head scan_res;973struct work_struct scan_work;974};975976/**977* struct iwl_mvm_acs_survey_channel - per-channel survey information978*979* Stripped down version of &struct survey_info.980*981* @time: time in ms the radio was on the channel982* @time_busy: time in ms the channel was sensed busy983* @time_tx: time in ms spent transmitting data984* @time_rx: time in ms spent receiving data985* @noise: channel noise in dBm986*/987struct iwl_mvm_acs_survey_channel {988u32 time;989u32 time_busy;990u32 time_tx;991u32 time_rx;992s8 noise;993};994995struct iwl_mvm_acs_survey {996struct iwl_mvm_acs_survey_channel *bands[NUM_NL80211_BANDS];997998/* Overall number of channels */999int n_channels;10001001/* Storage space for per-channel information follows */1002struct iwl_mvm_acs_survey_channel channels[] __counted_by(n_channels);1003};10041005struct iwl_mvm {1006/* for logger access */1007struct device *dev;10081009struct iwl_trans *trans;1010const struct iwl_fw *fw;1011const struct iwl_rf_cfg *cfg;1012struct iwl_phy_db *phy_db;1013struct ieee80211_hw *hw;10141015/* for protecting access to iwl_mvm */1016struct mutex mutex;1017struct list_head async_handlers_list;1018spinlock_t async_handlers_lock;1019struct work_struct async_handlers_wk;10201021/* For async rx handlers that require the wiphy lock */1022struct wiphy_work async_handlers_wiphy_wk;10231024struct wiphy_work trig_link_selection_wk;10251026struct work_struct roc_done_wk;10271028unsigned long init_status;10291030unsigned long status;10311032u32 queue_sync_cookie;1033unsigned long queue_sync_state;1034/*1035* for beacon filtering -1036* currently only one interface can be supported1037*/1038struct iwl_mvm_vif *bf_allowed_vif;10391040bool hw_registered;1041bool rfkill_safe_init_done;10421043u8 cca_40mhz_workaround;10441045u8 fw_rates_ver;10461047u32 ampdu_ref;1048bool ampdu_toggle;10491050struct iwl_notif_wait_data notif_wait;10511052union {1053struct mvm_statistics_rx_v3 rx_stats_v3;1054struct mvm_statistics_rx rx_stats;1055};10561057struct {1058u64 rx_time;1059u64 tx_time;1060u64 on_time_rf;1061u64 on_time_scan;1062} radio_stats, accu_radio_stats;10631064struct list_head add_stream_txqs;1065union {1066struct iwl_mvm_dqa_txq_info queue_info[IWL_MAX_HW_QUEUES];1067struct iwl_mvm_tvqm_txq_info tvqm_info[IWL_MAX_TVQM_QUEUES];1068};1069struct work_struct add_stream_wk; /* To add streams to queues */1070spinlock_t add_stream_lock;10711072const char *nvm_file_name;1073struct iwl_nvm_data *nvm_data;1074struct iwl_mei_nvm *mei_nvm_data;1075struct iwl_mvm_csme_conn_info __rcu *csme_conn_info;1076bool mei_rfkill_blocked;1077bool mei_registered;1078struct work_struct sap_connected_wk;10791080/*1081* NVM built based on the SAP data but that we can't free even after1082* we get ownership because it contains the cfg80211's channel.1083*/1084struct iwl_nvm_data *temp_nvm_data;10851086/* NVM sections */1087struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS];10881089struct iwl_fw_runtime fwrt;10901091/* EEPROM MAC addresses */1092struct mac_address addresses[IWL_MVM_MAX_ADDRESSES];10931094/* data related to data path */1095struct iwl_rx_phy_info last_phy_info;1096struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_STATION_COUNT_MAX];1097/* note: fw_id_to_link_sta must be protected by wiphy and mvm mutexes */1098struct ieee80211_link_sta __rcu *fw_id_to_link_sta[IWL_STATION_COUNT_MAX];1099u8 rx_ba_sessions;11001101/* configured by mac80211 */1102u32 rts_threshold;11031104/* Scan status, cmd (pre-allocated) and auxiliary station */1105unsigned int scan_status;1106size_t scan_cmd_size;1107void *scan_cmd;1108struct iwl_mcast_filter_cmd *mcast_filter_cmd;1109/* For CDB this is low band scan type, for non-CDB - type. */1110enum iwl_mvm_scan_type scan_type;1111enum iwl_mvm_scan_type hb_scan_type;11121113enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all;1114struct delayed_work scan_timeout_dwork;11151116/* max number of simultaneous scans the FW supports */1117unsigned int max_scans;11181119/* UMAC scan tracking */1120u32 scan_uid_status[IWL_MAX_UMAC_SCANS];11211122/* start time of last scan in TSF of the mac that requested the scan */1123u64 scan_start;11241125/* the vif that requested the current scan */1126struct iwl_mvm_vif *scan_vif;1127u8 scan_link_id;11281129/* rx chain antennas set through debugfs for the scan command */1130u8 scan_rx_ant;11311132/* Internal station */1133struct iwl_mvm_int_sta aux_sta;1134struct iwl_mvm_int_sta snif_sta;11351136bool last_ebs_successful;11371138u8 scan_last_antenna_idx; /* to toggle TX between antennas */1139u8 mgmt_last_antenna_idx;11401141u8 set_tx_ant;1142u8 set_rx_ant;11431144/* last smart fifo state that was successfully sent to firmware */1145enum iwl_sf_state sf_state;11461147/*1148* Leave this pointer outside the ifdef below so that it can be1149* assigned without ifdef in the source code.1150*/1151struct dentry *debugfs_dir;1152#ifdef CONFIG_IWLWIFI_DEBUGFS1153u32 dbgfs_sram_offset, dbgfs_sram_len;1154u32 dbgfs_prph_reg_addr;1155bool disable_power_off;1156bool disable_power_off_d3;1157bool beacon_inject_active;11581159bool scan_iter_notif_enabled;11601161struct debugfs_blob_wrapper nvm_hw_blob;1162struct debugfs_blob_wrapper nvm_sw_blob;1163struct debugfs_blob_wrapper nvm_calib_blob;1164struct debugfs_blob_wrapper nvm_prod_blob;1165struct debugfs_blob_wrapper nvm_phy_sku_blob;1166struct debugfs_blob_wrapper nvm_reg_blob;11671168struct iwl_mvm_frame_stats drv_rx_stats;1169spinlock_t drv_stats_lock;1170u16 dbgfs_rx_phyinfo;1171#endif11721173struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];11741175struct list_head time_event_list;1176spinlock_t time_event_lock;11771178/*1179* A bitmap indicating the index of the key in use. The firmware1180* can hold 16 keys at most. Reflect this fact.1181*/1182unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)];1183u8 fw_key_deleted[STA_KEY_MAX_NUM];11841185struct ieee80211_vif __rcu *vif_id_to_mac[NUM_MAC_INDEX_DRIVER];11861187u8 *error_recovery_buf;11881189#ifdef CONFIG_IWLWIFI_LEDS1190struct led_classdev led;1191#endif11921193struct ieee80211_vif *p2p_device_vif;11941195#ifdef CONFIG_PM_SLEEP1196struct wiphy_wowlan_support wowlan;1197int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;11981199/* sched scan settings for net detect */1200struct ieee80211_scan_ies nd_ies;1201struct cfg80211_match_set *nd_match_sets;1202int n_nd_match_sets;1203struct ieee80211_channel **nd_channels;1204int n_nd_channels;1205bool net_detect;1206bool fast_resume;1207u8 offload_tid;1208#ifdef CONFIG_IWLWIFI_DEBUGFS1209bool d3_wake_sysassert;1210bool d3_test_active;1211u32 d3_test_pme_ptr;1212struct ieee80211_vif *keep_vif;1213u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */1214#endif1215#endif12161217wait_queue_head_t rx_sync_waitq;12181219/* BT-Coex - only one of those will be used */1220union {1221struct iwl_bt_coex_prof_old_notif last_bt_notif;1222struct iwl_bt_coex_profile_notif last_bt_wifi_loss;1223};1224struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;12251226u8 bt_tx_prio;1227enum iwl_bt_force_ant_mode bt_force_ant_mode;12281229/* Aux ROC */1230struct list_head aux_roc_te_list;12311232/* Thermal Throttling and CTkill */1233struct iwl_mvm_tt_mgmt thermal_throttle;1234#ifdef CONFIG_THERMAL1235struct iwl_mvm_thermal_device tz_device;1236struct iwl_mvm_cooling_device cooling_dev;1237#endif12381239s32 temperature; /* Celsius */1240/*1241* Debug option to set the NIC temperature. This option makes the1242* driver think this is the actual NIC temperature, and ignore the1243* real temperature that is received from the fw1244*/1245bool temperature_test; /* Debug test temperature is enabled */12461247bool fw_static_smps_request;12481249unsigned long bt_coex_last_tcm_ts;1250struct iwl_mvm_tcm tcm;12511252u8 uapsd_noagg_bssid_write_idx;1253struct mac_address uapsd_noagg_bssids[IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM]1254__aligned(2);12551256struct iwl_time_quota_cmd last_quota_cmd;12571258/* Tx queues */1259u16 aux_queue;1260u16 snif_queue;1261u16 probe_queue;1262u16 p2p_dev_queue;12631264/* Indicate if device power save is allowed */1265u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */1266/* Indicate if 32Khz external clock is valid */1267u32 ext_clock_valid;12681269/* This vif used by CSME to send / receive traffic */1270struct ieee80211_vif *csme_vif;1271struct ieee80211_vif __rcu *csa_vif;1272struct ieee80211_vif __rcu *csa_tx_blocked_vif;1273u8 csa_tx_block_bcn_timeout;12741275/* system time of last beacon (for AP/GO interface) */1276u32 ap_last_beacon_gp2;12771278/* indicates that we transmitted the last beacon */1279bool ibss_manager;12801281bool lar_regdom_set;1282enum iwl_mcc_source mcc_src;12831284/* TDLS channel switch data */1285struct {1286struct delayed_work dwork;1287enum iwl_mvm_tdls_cs_state state;12881289/*1290* Current cs sta - might be different from periodic cs peer1291* station. Value is meaningless when the cs-state is idle.1292*/1293u8 cur_sta_id;12941295/* TDLS periodic channel-switch peer */1296struct {1297u8 sta_id;1298u8 op_class;1299bool initiator; /* are we the link initiator */1300struct cfg80211_chan_def chandef;1301struct sk_buff *skb; /* ch sw template */1302u32 ch_sw_tm_ie;13031304/* timestamp of last ch-sw request sent (GP2 time) */1305u32 sent_timestamp;1306} peer;1307} tdls_cs;130813091310u32 ciphers[IWL_MVM_NUM_CIPHERS];13111312struct cfg80211_ftm_responder_stats ftm_resp_stats;1313struct {1314struct cfg80211_pmsr_request *req;1315struct wireless_dev *req_wdev;1316struct list_head loc_list;1317int responses[IWL_TOF_MAX_APS];1318struct {1319struct list_head resp;1320} smooth;1321struct list_head pasn_list;1322} ftm_initiator;13231324struct list_head resp_pasn_list;13251326struct ptp_data ptp_data;13271328struct {1329u8 range_resp;1330} cmd_ver;13311332struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID];13331334/*1335* Drop beacons from other APs in AP mode when there are no connected1336* clients.1337*/1338bool drop_bcn_ap_mode;13391340struct delayed_work cs_tx_unblock_dwork;13411342/* does a monitor vif exist (only one can exist hence bool) */1343bool monitor_on;1344/*1345* primary channel position relative to he whole bandwidth,1346* in steps of 80 MHz1347*/1348u8 monitor_p80;13491350/* sniffer data to include in radiotap */1351__le16 cur_aid;1352u8 cur_bssid[ETH_ALEN];13531354/* report rx timestamp in ptp clock time */1355bool rx_ts_ptp;13561357unsigned long last_6ghz_passive_scan_jiffies;1358unsigned long last_reset_or_resume_time_jiffies;13591360bool sta_remove_requires_queue_remove;1361bool mld_api_is_used;13621363/*1364* Indicates that firmware will do a product reset (and then1365* therefore fail to load) when we start it (due to OTP burn),1366* if so don't dump errors etc. since this is expected.1367*/1368bool fw_product_reset;13691370struct iwl_time_sync_data time_sync;13711372struct iwl_mei_scan_filter mei_scan_filter;13731374struct iwl_mvm_acs_survey *acs_survey;13751376bool statistics_clear;1377};13781379/* Extract MVM priv from op_mode and _hw */1380#define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \1381((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific)13821383#define IWL_MAC80211_GET_MVM(_hw) \1384IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv))13851386DEFINE_GUARD(mvm, struct iwl_mvm *, mutex_lock(&_T->mutex), mutex_unlock(&_T->mutex))13871388/**1389* enum iwl_mvm_status - MVM status bits1390* @IWL_MVM_STATUS_HW_RFKILL: HW RF-kill is asserted1391* @IWL_MVM_STATUS_HW_CTKILL: CT-kill is active1392* @IWL_MVM_STATUS_ROC_P2P_RUNNING: remain-on-channel on P2P is running (when1393* P2P is not over AUX)1394* @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested1395* @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active1396* @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running1397* @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running1398* @IWL_MVM_STATUS_IN_D3: in D3 (or at least about to go into it)1399* @IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE: suppress one error log1400* if this is set, when intentionally triggered1401*/1402enum iwl_mvm_status {1403IWL_MVM_STATUS_HW_RFKILL,1404IWL_MVM_STATUS_HW_CTKILL,1405IWL_MVM_STATUS_ROC_P2P_RUNNING,1406IWL_MVM_STATUS_HW_RESTART_REQUESTED,1407IWL_MVM_STATUS_IN_HW_RESTART,1408IWL_MVM_STATUS_ROC_AUX_RUNNING,1409IWL_MVM_STATUS_FIRMWARE_RUNNING,1410IWL_MVM_STATUS_IN_D3,1411IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE,1412};14131414struct iwl_mvm_csme_conn_info {1415struct rcu_head rcu_head;1416struct iwl_mei_conn_info conn_info;1417};14181419/* Keep track of completed init configuration */1420enum iwl_mvm_init_status {1421IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0),1422IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1),1423};14241425static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)1426{1427return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) ||1428test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);1429}14301431static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)1432{1433return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);1434}14351436static inline bool iwl_mvm_firmware_running(struct iwl_mvm *mvm)1437{1438return test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);1439}14401441/* Must be called with rcu_read_lock() held and it can only be1442* released when mvmsta is not needed anymore.1443*/1444static inline struct iwl_mvm_sta *1445iwl_mvm_sta_from_staid_rcu(struct iwl_mvm *mvm, u8 sta_id)1446{1447struct ieee80211_sta *sta;14481449if (sta_id >= mvm->fw->ucode_capa.num_stations)1450return NULL;14511452sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);14531454/* This can happen if the station has been removed right now */1455if (IS_ERR_OR_NULL(sta))1456return NULL;14571458return iwl_mvm_sta_from_mac80211(sta);1459}14601461static inline struct iwl_mvm_sta *1462iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id)1463{1464struct ieee80211_sta *sta;14651466if (sta_id >= mvm->fw->ucode_capa.num_stations)1467return NULL;14681469sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],1470lockdep_is_held(&mvm->mutex));14711472/* This can happen if the station has been removed right now */1473if (IS_ERR_OR_NULL(sta))1474return NULL;14751476return iwl_mvm_sta_from_mac80211(sta);1477}14781479static inline struct ieee80211_vif *1480iwl_mvm_rcu_dereference_vif_id(struct iwl_mvm *mvm, u8 vif_id, bool rcu)1481{1482if (WARN_ON(vif_id >= ARRAY_SIZE(mvm->vif_id_to_mac)))1483return NULL;14841485if (rcu)1486return rcu_dereference(mvm->vif_id_to_mac[vif_id]);14871488return rcu_dereference_protected(mvm->vif_id_to_mac[vif_id],1489lockdep_is_held(&mvm->mutex));1490}14911492static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm)1493{1494return fw_has_api(&mvm->fw->ucode_capa,1495IWL_UCODE_TLV_API_ADAPTIVE_DWELL);1496}14971498static inline bool iwl_mvm_is_adaptive_dwell_v2_supported(struct iwl_mvm *mvm)1499{1500return fw_has_api(&mvm->fw->ucode_capa,1501IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2);1502}15031504static inline bool iwl_mvm_is_adwell_hb_ap_num_supported(struct iwl_mvm *mvm)1505{1506return fw_has_api(&mvm->fw->ucode_capa,1507IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP);1508}15091510static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm)1511{1512/* OCE should never be enabled for LMAC scan FWs */1513return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE);1514}15151516static inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm)1517{1518return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS);1519}15201521static inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm)1522{1523return fw_has_api(&mvm->fw->ucode_capa,1524IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF);1525}15261527static inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue)1528{1529return (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE) &&1530(queue <= IWL_MVM_DQA_MAX_DATA_QUEUE);1531}15321533static inline bool iwl_mvm_is_dqa_mgmt_queue(struct iwl_mvm *mvm, u8 queue)1534{1535return (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) &&1536(queue <= IWL_MVM_DQA_MAX_MGMT_QUEUE);1537}15381539static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)1540{1541bool nvm_lar = mvm->nvm_data->lar_enabled;1542bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,1543IWL_UCODE_TLV_CAPA_LAR_SUPPORT);15441545/*1546* Enable LAR only if it is supported by the FW (TLV) &&1547* enabled in the NVM1548*/1549if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT)1550return nvm_lar && tlv_lar;1551else1552return tlv_lar;1553}15541555static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm)1556{1557return fw_has_api(&mvm->fw->ucode_capa,1558IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) ||1559fw_has_capa(&mvm->fw->ucode_capa,1560IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC);1561}15621563static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm)1564{1565return fw_has_capa(&mvm->fw->ucode_capa,1566IWL_UCODE_TLV_CAPA_BT_COEX_RRC) &&1567IWL_MVM_BT_COEX_RRC;1568}15691570static inline bool iwl_mvm_is_csum_supported(struct iwl_mvm *mvm)1571{1572return fw_has_capa(&mvm->fw->ucode_capa,1573IWL_UCODE_TLV_CAPA_CSUM_SUPPORT);1574}15751576static inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm)1577{1578return fw_has_capa(&mvm->fw->ucode_capa,1579IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT) &&1580IWL_MVM_BT_COEX_MPLUT;1581}15821583static inline1584bool iwl_mvm_is_p2p_scm_uapsd_supported(struct iwl_mvm *mvm)1585{1586return fw_has_capa(&mvm->fw->ucode_capa,1587IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD) &&1588!(iwlwifi_mod_params.uapsd_disable &1589IWL_DISABLE_UAPSD_P2P_CLIENT);1590}15911592static inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm)1593{1594return fw_has_capa(&mvm->fw->ucode_capa,1595IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT);1596}15971598static inline bool iwl_mvm_has_mld_api(const struct iwl_fw *fw)1599{1600return fw_has_capa(&fw->ucode_capa,1601IWL_UCODE_TLV_CAPA_MLD_API_SUPPORT);1602}16031604static inline bool iwl_mvm_has_new_station_api(const struct iwl_fw *fw)1605{1606return iwl_mvm_has_mld_api(fw) ||1607iwl_fw_lookup_cmd_ver(fw, ADD_STA, 0) >= 12;1608}16091610static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm)1611{1612/* TODO - replace with TLV once defined */1613return mvm->trans->mac_cfg->gen2;1614}16151616static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm)1617{1618/* TODO - better define this */1619return mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_22000;1620}16211622static inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm)1623{1624/*1625* TODO:1626* The issue of how to determine CDB APIs and usage is still not fully1627* defined.1628* There is a compilation for CDB and non-CDB FW, but there may1629* be also runtime check.1630* For now there is a TLV for checking compilation mode, but a1631* runtime check will also have to be here - once defined.1632*/1633return fw_has_capa(&mvm->fw->ucode_capa,1634IWL_UCODE_TLV_CAPA_CDB_SUPPORT);1635}16361637static inline bool iwl_mvm_cdb_scan_api(struct iwl_mvm *mvm)1638{1639/*1640* TODO: should this be the same as iwl_mvm_is_cdb_supported()?1641* but then there's a little bit of code in scan that won't make1642* any sense...1643*/1644return mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_22000;1645}16461647static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm)1648{1649return fw_has_api(&mvm->fw->ucode_capa,1650IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);1651}165216531654static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm)1655{1656return fw_has_api(&mvm->fw->ucode_capa,1657IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG);1658}16591660static inline bool iwl_mvm_is_band_in_rx_supported(struct iwl_mvm *mvm)1661{1662return fw_has_api(&mvm->fw->ucode_capa,1663IWL_UCODE_TLV_API_BAND_IN_RX_DATA);1664}16651666static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)1667{1668return fw_has_api(&mvm->fw->ucode_capa,1669IWL_UCODE_TLV_API_NEW_RX_STATS);1670}16711672static inline bool iwl_mvm_has_quota_low_latency(struct iwl_mvm *mvm)1673{1674return fw_has_api(&mvm->fw->ucode_capa,1675IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY);1676}16771678static inline bool iwl_mvm_has_no_host_disable_tx(struct iwl_mvm *mvm)1679{1680return fw_has_api(&mvm->fw->ucode_capa,1681IWL_UCODE_TLV_API_NO_HOST_DISABLE_TX);1682}16831684static inline bool iwl_mvm_has_tlc_offload(const struct iwl_mvm *mvm)1685{1686return fw_has_capa(&mvm->fw->ucode_capa,1687IWL_UCODE_TLV_CAPA_TLC_OFFLOAD);1688}16891690static inline struct agg_tx_status *1691iwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp)1692{1693if (iwl_mvm_has_new_tx_api(mvm))1694return &((struct iwl_tx_resp *)tx_resp)->status;1695else1696return ((struct iwl_tx_resp_v3 *)tx_resp)->status;1697}16981699static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm)1700{1701/* these two TLV are redundant since the responsibility to CT-kill by1702* FW happens only after we send at least one command of1703* temperature THs report.1704*/1705return fw_has_capa(&mvm->fw->ucode_capa,1706IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) &&1707fw_has_capa(&mvm->fw->ucode_capa,1708IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT);1709}17101711static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm)1712{1713return fw_has_capa(&mvm->fw->ucode_capa,1714IWL_UCODE_TLV_CAPA_CTDP_SUPPORT);1715}17161717static inline bool iwl_mvm_is_esr_supported(struct iwl_trans *trans)1718{1719if (CSR_HW_RFID_IS_CDB(trans->info.hw_rf_id))1720return false;17211722switch (CSR_HW_RFID_TYPE(trans->info.hw_rf_id)) {1723case IWL_CFG_RF_TYPE_FM:1724/* Step A doesn't support eSR */1725return CSR_HW_RFID_STEP(trans->info.hw_rf_id);1726case IWL_CFG_RF_TYPE_WH:1727case IWL_CFG_RF_TYPE_PE:1728return true;1729default:1730return false;1731}1732}17331734static inline int iwl_mvm_max_active_links(struct iwl_mvm *mvm,1735struct ieee80211_vif *vif)1736{1737struct iwl_trans *trans = mvm->fwrt.trans;17381739if (vif->type == NL80211_IFTYPE_AP)1740return mvm->fw->ucode_capa.num_beacons;17411742/* Check if HW supports eSR or STR */1743if (iwl_mvm_is_esr_supported(trans) ||1744(CSR_HW_RFID_TYPE(trans->info.hw_rf_id) == IWL_CFG_RF_TYPE_FM &&1745CSR_HW_RFID_IS_CDB(trans->info.hw_rf_id)))1746return IWL_FW_MAX_ACTIVE_LINKS_NUM;17471748return 1;1749}17501751extern const u8 iwl_mvm_ac_to_tx_fifo[];1752extern const u8 iwl_mvm_ac_to_gen2_tx_fifo[];1753extern const u8 iwl_mvm_ac_to_bz_tx_fifo[];17541755static inline u8 iwl_mvm_mac_ac_to_tx_fifo(struct iwl_mvm *mvm,1756enum ieee80211_ac_numbers ac)1757{1758if (mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)1759return iwl_mvm_ac_to_bz_tx_fifo[ac];1760if (iwl_mvm_has_new_tx_api(mvm))1761return iwl_mvm_ac_to_gen2_tx_fifo[ac];1762return iwl_mvm_ac_to_tx_fifo[ac];1763}17641765static inline bool iwl_mvm_has_rlc_offload(struct iwl_mvm *mvm)1766{1767return iwl_fw_lookup_cmd_ver(mvm->fw,1768WIDE_ID(DATA_PATH_GROUP, RLC_CONFIG_CMD),17690) >= 3;1770}17711772struct iwl_rate_info {1773u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */1774u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */1775u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */1776u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */1777u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */1778};17791780void __iwl_mvm_mac_stop(struct iwl_mvm *mvm, bool suspend);1781int __iwl_mvm_mac_start(struct iwl_mvm *mvm);17821783/******************1784* MVM Methods1785******************/1786/* uCode */1787int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm);17881789/* Utils */1790int iwl_mvm_legacy_hw_idx_to_mac80211_idx(u32 rate_n_flags,1791enum nl80211_band band);1792int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,1793enum nl80211_band band);1794void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,1795enum nl80211_band band,1796struct ieee80211_tx_rate *r);1797u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx);1798u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac);1799bool iwl_mvm_is_nic_ack_enabled(struct iwl_mvm *mvm, struct ieee80211_vif *vif);18001801static inline void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)1802{1803iwl_fwrt_dump_error_logs(&mvm->fwrt);1804}18051806u8 first_antenna(u8 mask);1807u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);1808void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, u32 *gp2,1809u64 *boottime, ktime_t *realtime);1810u32 iwl_mvm_get_systime(struct iwl_mvm *mvm);18111812/* Tx / Host Commands */1813int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,1814struct iwl_host_cmd *cmd);1815int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id,1816u32 flags, u16 len, const void *data);1817int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm,1818struct iwl_host_cmd *cmd,1819u32 *status);1820int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id,1821u16 len, const void *data,1822u32 *status);1823int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb,1824struct ieee80211_sta *sta);1825int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb);1826void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,1827struct iwl_tx_cmd_v6_params *tx_cmd_params,1828struct ieee80211_tx_info *info, u8 sta_id);1829void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,1830struct iwl_tx_cmd_v6_params *tx_cmd_params,1831struct ieee80211_tx_info *info,1832struct ieee80211_sta *sta, __le16 fc);1833void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq);1834unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm,1835struct ieee80211_sta *sta,1836unsigned int tid);18371838#ifdef CONFIG_IWLWIFI_DEBUG1839const char *iwl_mvm_get_tx_fail_reason(u32 status);1840#else1841static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }1842#endif1843int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk);1844int iwl_mvm_flush_sta(struct iwl_mvm *mvm, u32 sta_id, u32 tfd_queue_mask);1845int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, u16 tids);18461847/* Utils to extract sta related data */1848__le32 iwl_mvm_get_sta_htc_flags(struct ieee80211_sta *sta,1849struct ieee80211_link_sta *link_sta);1850u8 iwl_mvm_get_sta_uapsd_acs(struct ieee80211_sta *sta);1851u32 iwl_mvm_get_sta_ampdu_dens(struct ieee80211_link_sta *link_sta,1852struct ieee80211_bss_conf *link_conf,1853u32 *_agg_size);1854int iwl_mvm_set_sta_pkt_ext(struct iwl_mvm *mvm,1855struct ieee80211_link_sta *link_sta,1856struct iwl_he_pkt_ext_v2 *pkt_ext);18571858void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);18591860static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info,1861struct iwl_tx_cmd_v6_params *tx_cmd_params)1862{1863struct ieee80211_key_conf *keyconf = info->control.hw_key;18641865tx_cmd_params->sec_ctl = TX_CMD_SEC_CCM;1866memcpy(tx_cmd_params->key, keyconf->key, keyconf->keylen);1867}18681869static inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm)1870{1871flush_work(&mvm->async_handlers_wk);1872}18731874/* Statistics */1875void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm,1876struct iwl_rx_cmd_buffer *rxb);1877void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm,1878struct iwl_rx_cmd_buffer *rxb);1879static inline void1880iwl_mvm_handle_rx_system_end_stats_notif(struct iwl_mvm *mvm,1881struct iwl_rx_cmd_buffer *rxb)1882{1883}18841885void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,1886struct iwl_rx_packet *pkt);1887void iwl_mvm_rx_statistics(struct iwl_mvm *mvm,1888struct iwl_rx_cmd_buffer *rxb);1889int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear);1890int iwl_mvm_request_periodic_system_statistics(struct iwl_mvm *mvm,1891bool enable);1892void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm);18931894/* NVM */1895int iwl_nvm_init(struct iwl_mvm *mvm);1896int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);18971898static inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm)1899{1900u8 tx_ant = mvm->fw->valid_tx_ant;19011902if (mvm->nvm_data && mvm->nvm_data->valid_tx_ant)1903tx_ant &= mvm->nvm_data->valid_tx_ant;19041905if (mvm->set_tx_ant)1906tx_ant &= mvm->set_tx_ant;19071908return tx_ant;1909}19101911static inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm)1912{1913u8 rx_ant = mvm->fw->valid_rx_ant;19141915if (mvm->nvm_data && mvm->nvm_data->valid_rx_ant)1916rx_ant &= mvm->nvm_data->valid_rx_ant;19171918if (mvm->set_rx_ant)1919rx_ant &= mvm->set_rx_ant;19201921return rx_ant;19221923}19241925static inline void iwl_mvm_toggle_tx_ant(struct iwl_mvm *mvm, u8 *ant)1926{1927*ant = iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm), *ant);1928}19291930static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm)1931{1932u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN |1933FW_PHY_CFG_RX_CHAIN);1934u32 valid_rx_ant = iwl_mvm_get_valid_rx_ant(mvm);1935u32 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm);19361937phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS |1938valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS;19391940return mvm->fw->phy_config & phy_config;1941}19421943int iwl_mvm_up(struct iwl_mvm *mvm);1944int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);19451946int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm);19471948void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif);19491950/*1951* FW notifications / CMD responses handlers1952* Convention: iwl_mvm_rx_<NAME OF THE CMD>1953*/1954void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode,1955struct napi_struct *napi,1956struct iwl_rx_cmd_buffer *rxb);1957void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);1958void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,1959struct iwl_rx_cmd_buffer *rxb);1960void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,1961struct iwl_rx_cmd_buffer *rxb, int queue);1962void iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi,1963struct iwl_rx_cmd_buffer *rxb, int queue);1964void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,1965struct iwl_rx_cmd_buffer *rxb, int queue);1966void iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,1967struct iwl_rx_cmd_buffer *rxb, int queue);1968void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi,1969struct iwl_rx_cmd_buffer *rxb, int queue);1970void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);1971void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,1972struct iwl_rx_cmd_buffer *rxb);1973void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags);1974void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);1975void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,1976struct iwl_rx_cmd_buffer *rxb);1977void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);1978void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,1979struct iwl_rx_cmd_buffer *rxb);1980void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm,1981struct iwl_rx_cmd_buffer *rxb);19821983/* MVM PHY */1984struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm);1985int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,1986const struct cfg80211_chan_def *chandef,1987const struct cfg80211_chan_def *ap,1988u8 chains_static, u8 chains_dynamic);1989int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,1990const struct cfg80211_chan_def *chandef,1991const struct cfg80211_chan_def *ap,1992u8 chains_static, u8 chains_dynamic);1993void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm,1994struct iwl_mvm_phy_ctxt *ctxt);1995void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm,1996struct iwl_mvm_phy_ctxt *ctxt);1997int iwl_mvm_phy_ctx_count(struct iwl_mvm *mvm);1998u8 iwl_mvm_get_channel_width(const struct cfg80211_chan_def *chandef);1999u8 iwl_mvm_get_ctrl_pos(const struct cfg80211_chan_def *chandef);2000int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,2001u8 chains_static, u8 chains_dynamic);20022003/* MAC (virtual interface) programming */20042005void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,2006struct ieee80211_vif *vif);2007void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2008struct iwl_mvm_vif_link_info *link_info,2009__le32 *cck_rates, __le32 *ofdm_rates);2010void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,2011struct ieee80211_vif *vif,2012struct ieee80211_bss_conf *link_conf,2013__le32 *protection_flags, u32 ht_flag,2014u32 tgg_flag);2015void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2016struct ieee80211_bss_conf *link_conf,2017struct iwl_ac_qos *ac, __le32 *qos_flags);2018bool iwl_mvm_set_fw_mu_edca_params(struct iwl_mvm *mvm,2019const struct iwl_mvm_vif_link_info *link_info,2020struct iwl_he_backoff_conf *trig_based_txf);2021void iwl_mvm_set_fw_dtim_tbtt(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2022struct ieee80211_bss_conf *link_conf,2023__le64 *dtim_tsf, __le32 *dtim_time,2024__le32 *assoc_beacon_arrive_time);2025__le32 iwl_mac_ctxt_p2p_dev_has_extended_disc(struct iwl_mvm *mvm,2026struct ieee80211_vif *vif);2027void iwl_mvm_mac_ctxt_cmd_ap_set_filter_flags(struct iwl_mvm *mvm,2028struct iwl_mvm_vif *mvmvif,2029__le32 *filter_flags,2030int accept_probe_req_flag,2031int accept_beacon_flag);2032int iwl_mvm_get_mac_type(struct ieee80211_vif *vif);2033__le32 iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwin(struct iwl_mvm *mvm,2034struct ieee80211_vif *vif);2035u32 iwl_mvm_mac_ctxt_cmd_sta_get_twt_policy(struct iwl_mvm *mvm,2036struct ieee80211_vif *vif);2037int iwl_mvm_mld_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2038int iwl_mvm_mld_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2039bool force_assoc_off);2040int iwl_mvm_mld_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2041int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2042int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2043int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2044bool force_assoc_off, const u8 *bssid_override);2045int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2046int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,2047struct ieee80211_vif *vif,2048struct ieee80211_bss_conf *link_conf);2049int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm,2050struct sk_buff *beacon,2051void *data, int len);2052u8 iwl_mvm_mac_ctxt_get_beacon_rate(struct iwl_mvm *mvm,2053struct ieee80211_tx_info *info,2054struct ieee80211_vif *vif);2055u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm,2056struct ieee80211_tx_info *info,2057struct ieee80211_vif *vif);2058u16 iwl_mvm_mac_ctxt_get_beacon_flags(const struct iwl_fw *fw,2059u8 rate_idx);2060void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,2061__le32 *tim_index, __le32 *tim_size,2062u8 *beacon, u32 frame_size);2063void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,2064struct iwl_rx_cmd_buffer *rxb);2065void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,2066struct iwl_rx_cmd_buffer *rxb);2067void iwl_mvm_rx_missed_beacons_notif_legacy(struct iwl_mvm *mvm,2068struct iwl_rx_cmd_buffer *rxb);2069void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,2070struct iwl_rx_cmd_buffer *rxb);2071void iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm,2072struct iwl_rx_cmd_buffer *rxb);2073void iwl_mvm_sta_pm_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);2074void iwl_mvm_window_status_notif(struct iwl_mvm *mvm,2075struct iwl_rx_cmd_buffer *rxb);2076void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,2077struct ieee80211_vif *vif);2078void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm,2079struct iwl_rx_cmd_buffer *rxb);2080void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,2081struct iwl_rx_cmd_buffer *rxb);2082void iwl_mvm_channel_switch_error_notif(struct iwl_mvm *mvm,2083struct iwl_rx_cmd_buffer *rxb);2084void iwl_mvm_rx_beacon_filter_notif(struct iwl_mvm *mvm,2085struct iwl_rx_cmd_buffer *rxb);20862087/* Bindings */2088int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2089int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2090u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band);20912092/* Links */2093void iwl_mvm_init_link(struct iwl_mvm_vif_link_info *link);2094void iwl_mvm_set_link_fw_id(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2095struct ieee80211_bss_conf *link_conf);2096int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2097struct ieee80211_bss_conf *link_conf);2098int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2099struct ieee80211_bss_conf *link_conf,2100u32 changes, bool active);2101int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2102struct ieee80211_bss_conf *link_conf);2103int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2104struct ieee80211_bss_conf *link_conf);21052106void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2107u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif);2108u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id);21092110struct iwl_mvm_link_sel_data {2111u8 link_id;2112const struct cfg80211_chan_def *chandef;2113s32 signal;2114u16 grade;2115};21162117#if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)2118unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf);2119bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif,2120const struct iwl_mvm_link_sel_data *a,2121const struct iwl_mvm_link_sel_data *b);21222123s8 iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif);21242125extern const struct iwl_hcmd_arr iwl_mvm_groups[];2126extern const unsigned int iwl_mvm_groups_size;2127#endif21282129/* AP and IBSS */2130bool iwl_mvm_start_ap_ibss_common(struct ieee80211_hw *hw,2131struct ieee80211_vif *vif, int *ret);2132void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm,2133struct ieee80211_vif *vif);21342135/* BSS Info */2136void iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm,2137struct ieee80211_vif *vif,2138struct ieee80211_bss_conf *link_conf,2139u64 changes);2140void iwl_mvm_bss_info_changed_station_assoc(struct iwl_mvm *mvm,2141struct ieee80211_vif *vif,2142u64 changes);21432144/* ROC */2145/**2146* struct iwl_mvm_roc_ops - callbacks for the remain_on_channel()2147*2148* Since the only difference between both MLD and2149* non-MLD versions of remain_on_channel() is these function calls,2150* each version will send its specific function calls to2151* %iwl_mvm_roc_common().2152*2153* @add_aux_sta_for_hs20: pointer to the function that adds an aux sta2154* for Hot Spot 2.02155* @link: For a P2P Device interface, pointer to a function that links the2156* MAC/Link to the PHY context2157*/2158struct iwl_mvm_roc_ops {2159int (*add_aux_sta_for_hs20)(struct iwl_mvm *mvm, u32 lmac_id);2160int (*link)(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2161};21622163int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2164struct ieee80211_channel *channel, int duration,2165enum ieee80211_roc_type type,2166const struct iwl_mvm_roc_ops *ops);2167int iwl_mvm_cancel_roc(struct ieee80211_hw *hw,2168struct ieee80211_vif *vif);2169/*Session Protection */2170void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2171u32 duration_override, unsigned int link_id);21722173/* Quota management */2174static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm)2175{2176return iwl_mvm_has_quota_low_latency(mvm) ?2177sizeof(struct iwl_time_quota_cmd) :2178sizeof(struct iwl_time_quota_cmd_v1);2179}21802181static inline struct iwl_time_quota_data2182*iwl_mvm_quota_cmd_get_quota(struct iwl_mvm *mvm,2183struct iwl_time_quota_cmd *cmd,2184int i)2185{2186struct iwl_time_quota_data_v1 *quotas;21872188if (iwl_mvm_has_quota_low_latency(mvm))2189return &cmd->quotas[i];21902191quotas = (struct iwl_time_quota_data_v1 *)cmd->quotas;2192return (struct iwl_time_quota_data *)"as[i];2193}21942195int iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload,2196struct ieee80211_vif *disabled_vif);21972198/* Scanning */2199int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2200struct cfg80211_scan_request *req,2201struct ieee80211_scan_ies *ies);2202size_t iwl_mvm_scan_size(struct iwl_mvm *mvm);2203int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);22042205int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);2206void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);2207void iwl_mvm_scan_timeout_wk(struct work_struct *work);2208int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2209void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm,2210struct iwl_rx_cmd_buffer *rxb);22112212/* Scheduled scan */2213void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,2214struct iwl_rx_cmd_buffer *rxb);2215void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm,2216struct iwl_rx_cmd_buffer *rxb);2217int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,2218struct ieee80211_vif *vif,2219struct cfg80211_sched_scan_request *req,2220struct ieee80211_scan_ies *ies,2221int type);2222void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,2223struct iwl_rx_cmd_buffer *rxb);22242225/* UMAC scan */2226int iwl_mvm_config_scan(struct iwl_mvm *mvm);2227void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,2228struct iwl_rx_cmd_buffer *rxb);2229void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,2230struct iwl_rx_cmd_buffer *rxb);22312232/* MVM debugfs */2233#ifdef CONFIG_IWLWIFI_DEBUGFS2234void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm);2235void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif);2236void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2237void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2238#else2239static inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm)2240{2241}2242static inline void2243iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)2244{2245}2246static inline void2247iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)2248{2249}2250#endif /* CONFIG_IWLWIFI_DEBUGFS */22512252/* rate scaling */2253int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq);2254void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg);2255int rs_pretty_print_rate_v1(char *buf, int bufsz, const u32 rate);2256void rs_update_last_rssi(struct iwl_mvm *mvm,2257struct iwl_mvm_sta *mvmsta,2258struct ieee80211_rx_status *rx_status);22592260/* power management */2261int iwl_mvm_power_update_device(struct iwl_mvm *mvm);2262int iwl_mvm_power_update_mac(struct iwl_mvm *mvm);2263int iwl_mvm_power_update_ps(struct iwl_mvm *mvm);2264int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2265char *buf, int bufsz);22662267void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2268void iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm,2269struct iwl_rx_cmd_buffer *rxb);22702271#ifdef CONFIG_IWLWIFI_LEDS2272int iwl_mvm_leds_init(struct iwl_mvm *mvm);2273void iwl_mvm_leds_exit(struct iwl_mvm *mvm);2274void iwl_mvm_leds_sync(struct iwl_mvm *mvm);2275#else2276static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm)2277{2278return 0;2279}2280static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm)2281{2282}2283static inline void iwl_mvm_leds_sync(struct iwl_mvm *mvm)2284{2285}2286#endif22872288/* D3 (WoWLAN, NetDetect) */2289int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);2290int iwl_mvm_resume(struct ieee80211_hw *hw);2291void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled);2292void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,2293struct ieee80211_vif *vif,2294struct cfg80211_gtk_rekey_data *data);2295void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw,2296struct ieee80211_vif *vif,2297struct inet6_dev *idev);2298void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,2299struct ieee80211_vif *vif, int idx);2300extern const struct file_operations iwl_dbgfs_d3_test_ops;2301#ifdef CONFIG_PM_SLEEP2302void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,2303struct ieee80211_vif *vif);2304void iwl_mvm_fast_suspend(struct iwl_mvm *mvm);2305int iwl_mvm_fast_resume(struct iwl_mvm *mvm);2306#else2307static inline void2308iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)2309{2310}23112312static inline void iwl_mvm_fast_suspend(struct iwl_mvm *mvm)2313{2314}23152316static inline int iwl_mvm_fast_resume(struct iwl_mvm *mvm)2317{2318return 0;2319}2320#endif2321void iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta,2322struct iwl_wowlan_config_cmd_v6 *cmd);2323int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,2324struct ieee80211_vif *vif,2325bool disable_offloading,2326bool offload_ns,2327u32 cmd_flags,2328u8 sta_id);23292330/* BT Coex */2331int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm);2332void iwl_mvm_rx_bt_coex_old_notif(struct iwl_mvm *mvm,2333struct iwl_rx_cmd_buffer *rxb);2334void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,2335struct iwl_rx_cmd_buffer *rxb);2336void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2337enum ieee80211_rssi_event_data);2338void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);2339u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,2340struct ieee80211_sta *sta);2341bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,2342struct ieee80211_sta *sta);2343bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant);2344bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm);2345bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,2346enum nl80211_band band);2347u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants);2348u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,2349struct ieee80211_tx_info *info, u8 ac);23502351/* beacon filtering */2352#ifdef CONFIG_IWLWIFI_DEBUGFS2353void2354iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,2355struct iwl_beacon_filter_cmd *cmd);2356#else2357static inline void2358iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,2359struct iwl_beacon_filter_cmd *cmd)2360{}2361#endif2362int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,2363struct ieee80211_vif *vif);2364int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,2365struct ieee80211_vif *vif);2366/* SMPS */2367void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2368enum iwl_mvm_smps_type_request req_type,2369enum ieee80211_smps_mode smps_request,2370unsigned int link_id);2371void2372iwl_mvm_update_smps_on_active_links(struct iwl_mvm *mvm,2373struct ieee80211_vif *vif,2374enum iwl_mvm_smps_type_request req_type,2375enum ieee80211_smps_mode smps_request);2376bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm,2377struct iwl_mvm_phy_ctxt *ctxt);2378void iwl_mvm_update_link_smps(struct ieee80211_vif *vif,2379struct ieee80211_bss_conf *link_conf);23802381/* Low latency */2382int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2383bool low_latency,2384enum iwl_mvm_low_latency_cause cause);2385/* get SystemLowLatencyMode - only needed for beacon threshold? */2386bool iwl_mvm_low_latency(struct iwl_mvm *mvm);2387bool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band);2388void iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, bool low_latency,2389u16 mac_id);23902391/* get VMACLowLatencyMode */2392static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)2393{2394/*2395* should this consider associated/active/... state?2396*2397* Normally low-latency should only be active on interfaces2398* that are active, but at least with debugfs it can also be2399* enabled on interfaces that aren't active. However, when2400* interface aren't active then they aren't added into the2401* binding, so this has no real impact. For now, just return2402* the current desired low-latency state.2403*/2404return mvmvif->low_latency_actual;2405}24062407static inline2408void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set,2409enum iwl_mvm_low_latency_cause cause)2410{2411u8 new_state;24122413if (set)2414mvmvif->low_latency |= cause;2415else2416mvmvif->low_latency &= ~cause;24172418/*2419* if LOW_LATENCY_DEBUGFS_FORCE_ENABLE is enabled no changes are2420* allowed to actual mode.2421*/2422if (mvmvif->low_latency & LOW_LATENCY_DEBUGFS_FORCE_ENABLE &&2423cause != LOW_LATENCY_DEBUGFS_FORCE_ENABLE)2424return;24252426if (cause == LOW_LATENCY_DEBUGFS_FORCE_ENABLE && set)2427/*2428* We enter force state2429*/2430new_state = !!(mvmvif->low_latency &2431LOW_LATENCY_DEBUGFS_FORCE);2432else2433/*2434* Check if any other one set low latency2435*/2436new_state = !!(mvmvif->low_latency &2437~(LOW_LATENCY_DEBUGFS_FORCE_ENABLE |2438LOW_LATENCY_DEBUGFS_FORCE));24392440mvmvif->low_latency_actual = new_state;2441}24422443/* Return a bitmask with all the hw supported queues, except for the2444* command queue, which can't be flushed.2445*/2446static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)2447{2448return ((BIT(mvm->trans->mac_cfg->base->num_of_queues) - 1) &2449~BIT(IWL_MVM_DQA_CMD_QUEUE));2450}24512452void iwl_mvm_stop_device(struct iwl_mvm *mvm);24532454/* Thermal management and CT-kill */2455void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);2456void iwl_mvm_temp_notif(struct iwl_mvm *mvm,2457struct iwl_rx_cmd_buffer *rxb);2458void iwl_mvm_tt_handler(struct iwl_mvm *mvm);2459void iwl_mvm_thermal_initialize(struct iwl_mvm *mvm, u32 min_backoff);2460void iwl_mvm_thermal_exit(struct iwl_mvm *mvm);2461void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);2462int iwl_mvm_get_temp(struct iwl_mvm *mvm, s32 *temp);2463void iwl_mvm_ct_kill_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);2464void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm);2465int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm);2466int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget);24672468#if IS_ENABLED(CONFIG_IWLMEI)24692470/* vendor commands */2471void iwl_mvm_vendor_cmds_register(struct iwl_mvm *mvm);24722473#else24742475static inline void iwl_mvm_vendor_cmds_register(struct iwl_mvm *mvm) {}24762477#endif24782479/* Location Aware Regulatory */2480struct iwl_mcc_update_resp_v8 *2481iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,2482enum iwl_mcc_source src_id);2483int iwl_mvm_init_mcc(struct iwl_mvm *mvm);2484void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,2485struct iwl_rx_cmd_buffer *rxb);2486struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,2487const char *alpha2,2488enum iwl_mcc_source src_id,2489bool *changed);2490struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,2491bool *changed);2492int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync);2493void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);24942495/* smart fifo */2496int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2497bool added_vif);24982499/* FTM responder */2500int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2501struct ieee80211_bss_conf *bss_conf);2502void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,2503struct ieee80211_vif *vif,2504struct ieee80211_bss_conf *bss_conf);2505void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,2506struct iwl_rx_cmd_buffer *rxb);2507void iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm,2508struct ieee80211_vif *vif);25092510/* FTM initiator */2511void iwl_mvm_ftm_restart(struct iwl_mvm *mvm);2512void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm,2513struct iwl_rx_cmd_buffer *rxb);2514void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm,2515struct iwl_rx_cmd_buffer *rxb);2516int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2517struct cfg80211_pmsr_request *request);2518void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req);2519void iwl_mvm_ftm_initiator_smooth_config(struct iwl_mvm *mvm);2520void iwl_mvm_ftm_initiator_smooth_stop(struct iwl_mvm *mvm);25212522/* TDLS */25232524/*2525* We use TID 4 (VI) as a FW-used-only TID when TDLS connections are present.2526* This TID is marked as used vs the AP and all connected TDLS peers.2527*/2528#define IWL_MVM_TDLS_FW_TID 425292530int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2531void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm);2532void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2533bool sta_added);2534void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,2535struct ieee80211_vif *vif,2536unsigned int link_id);2537int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,2538struct ieee80211_vif *vif,2539struct ieee80211_sta *sta, u8 oper_class,2540struct cfg80211_chan_def *chandef,2541struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);2542void iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw,2543struct ieee80211_vif *vif,2544struct ieee80211_tdls_ch_sw_params *params);2545void iwl_mvm_tdls_cancel_channel_switch(struct ieee80211_hw *hw,2546struct ieee80211_vif *vif,2547struct ieee80211_sta *sta);2548void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);2549void iwl_mvm_tdls_ch_switch_work(struct work_struct *work);25502551void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,2552enum iwl_mvm_rxq_notif_type type,2553bool sync,2554const void *data, u32 size);2555struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);2556struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid);2557bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm);25582559#define MVM_TCM_PERIOD_MSEC 5002560#define MVM_TCM_PERIOD (HZ * MVM_TCM_PERIOD_MSEC / 1000)2561#define MVM_LL_PERIOD (10 * HZ)2562void iwl_mvm_tcm_work(struct work_struct *work);2563void iwl_mvm_recalc_tcm(struct iwl_mvm *mvm);2564void iwl_mvm_pause_tcm(struct iwl_mvm *mvm, bool with_cancel);2565void iwl_mvm_resume_tcm(struct iwl_mvm *mvm);2566void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2567void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2568u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed);25692570unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,2571struct ieee80211_vif *vif);2572void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2573const char *errmsg);2574void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm,2575struct ieee80211_vif *vif,2576const struct ieee80211_sta *sta,2577u16 tid);2578void iwl_mvm_mei_scan_filter_init(struct iwl_mei_scan_filter *mei_scan_filter);25792580void iwl_mvm_ptp_init(struct iwl_mvm *mvm);2581void iwl_mvm_ptp_remove(struct iwl_mvm *mvm);2582u64 iwl_mvm_ptp_get_adj_time(struct iwl_mvm *mvm, u64 base_time);2583int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b);2584int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);2585int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm);2586void iwl_mvm_get_bios_tables(struct iwl_mvm *mvm);2587#ifdef CONFIG_IWLWIFI_DEBUGFS2588void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,2589struct ieee80211_vif *vif,2590struct ieee80211_link_sta *link_sta,2591struct dentry *dir);2592void iwl_mvm_link_add_debugfs(struct ieee80211_hw *hw,2593struct ieee80211_vif *vif,2594struct ieee80211_bss_conf *link_conf,2595struct dentry *dir);2596#endif25972598/* new MLD related APIs */2599int iwl_mvm_sec_key_add(struct iwl_mvm *mvm,2600struct ieee80211_vif *vif,2601struct ieee80211_sta *sta,2602struct ieee80211_key_conf *keyconf);2603int iwl_mvm_sec_key_del(struct iwl_mvm *mvm,2604struct ieee80211_vif *vif,2605struct ieee80211_sta *sta,2606struct ieee80211_key_conf *keyconf);2607int iwl_mvm_sec_key_del_pasn(struct iwl_mvm *mvm,2608struct ieee80211_vif *vif,2609u32 sta_mask,2610struct ieee80211_key_conf *keyconf);2611void iwl_mvm_sec_key_remove_ap(struct iwl_mvm *mvm,2612struct ieee80211_vif *vif,2613struct iwl_mvm_vif_link_info *link,2614unsigned int link_id);2615int iwl_mvm_mld_update_sta_keys(struct iwl_mvm *mvm,2616struct ieee80211_vif *vif,2617struct ieee80211_sta *sta,2618u32 old_sta_mask,2619u32 new_sta_mask);2620int iwl_mvm_mld_send_key(struct iwl_mvm *mvm, u32 sta_mask, u32 key_flags,2621struct ieee80211_key_conf *keyconf);2622u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm,2623struct ieee80211_vif *vif,2624struct ieee80211_sta *sta,2625struct ieee80211_key_conf *keyconf);26262627bool iwl_rfi_supported(struct iwl_mvm *mvm);2628int iwl_rfi_send_config_cmd(struct iwl_mvm *mvm,2629struct iwl_rfi_lut_entry *rfi_table);2630struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm);2631void iwl_rfi_deactivate_notif_handler(struct iwl_mvm *mvm,2632struct iwl_rx_cmd_buffer *rxb);26332634static inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band)2635{2636switch (band) {2637case NL80211_BAND_2GHZ:2638return PHY_BAND_24;2639case NL80211_BAND_5GHZ:2640return PHY_BAND_5;2641case NL80211_BAND_6GHZ:2642return PHY_BAND_6;2643default:2644WARN_ONCE(1, "Unsupported band (%u)\n", band);2645return PHY_BAND_5;2646}2647}26482649static inline u8 iwl_mvm_nl80211_band_from_phy(u8 phy_band)2650{2651switch (phy_band) {2652case PHY_BAND_24:2653return NL80211_BAND_2GHZ;2654case PHY_BAND_5:2655return NL80211_BAND_5GHZ;2656case PHY_BAND_6:2657return NL80211_BAND_6GHZ;2658default:2659WARN_ONCE(1, "Unsupported phy band (%u)\n", phy_band);2660return NL80211_BAND_5GHZ;2661}2662}26632664/* Channel Switch */2665void iwl_mvm_channel_switch_disconnect_wk(struct work_struct *wk);2666int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,2667struct ieee80211_vif *vif,2668struct ieee80211_bss_conf *link);26692670/* Channel Context */2671/**2672* struct iwl_mvm_switch_vif_chanctx_ops - callbacks for switch_vif_chanctx()2673*2674* Since the only difference between both MLD and2675* non-MLD versions of switch_vif_chanctx() is these function calls,2676* each version will send its specific function calls to2677* %iwl_mvm_switch_vif_chanctx_common().2678*2679* @__assign_vif_chanctx: pointer to the function that assigns a chanctx to2680* a given vif2681* @__unassign_vif_chanctx: pointer to the function that unassigns a chanctx to2682* a given vif2683*/2684struct iwl_mvm_switch_vif_chanctx_ops {2685int (*__assign_vif_chanctx)(struct iwl_mvm *mvm,2686struct ieee80211_vif *vif,2687struct ieee80211_bss_conf *link_conf,2688struct ieee80211_chanctx_conf *ctx,2689bool switching_chanctx);2690void (*__unassign_vif_chanctx)(struct iwl_mvm *mvm,2691struct ieee80211_vif *vif,2692struct ieee80211_bss_conf *link_conf,2693struct ieee80211_chanctx_conf *ctx,2694bool switching_chanctx);2695};26962697int2698iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw,2699struct ieee80211_vif_chanctx_switch *vifs,2700int n_vifs,2701enum ieee80211_chanctx_switch_mode mode,2702const struct iwl_mvm_switch_vif_chanctx_ops *ops);27032704/* Channel info utils */2705static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm)2706{2707return fw_has_capa(&mvm->fw->ucode_capa,2708IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS);2709}27102711static inline void *iwl_mvm_chan_info_cmd_tail(struct iwl_mvm *mvm,2712struct iwl_fw_channel_info *ci)2713{2714return (u8 *)ci + (iwl_mvm_has_ultra_hb_channel(mvm) ?2715sizeof(struct iwl_fw_channel_info) :2716sizeof(struct iwl_fw_channel_info_v1));2717}27182719static inline size_t iwl_mvm_chan_info_padding(struct iwl_mvm *mvm)2720{2721return iwl_mvm_has_ultra_hb_channel(mvm) ? 0 :2722sizeof(struct iwl_fw_channel_info) -2723sizeof(struct iwl_fw_channel_info_v1);2724}27252726static inline void iwl_mvm_set_chan_info(struct iwl_mvm *mvm,2727struct iwl_fw_channel_info *ci,2728u32 chan, u8 band, u8 width,2729u8 ctrl_pos)2730{2731if (iwl_mvm_has_ultra_hb_channel(mvm)) {2732ci->channel = cpu_to_le32(chan);2733ci->band = band;2734ci->width = width;2735ci->ctrl_pos = ctrl_pos;2736} else {2737struct iwl_fw_channel_info_v1 *ci_v1 =2738(struct iwl_fw_channel_info_v1 *)ci;27392740ci_v1->channel = chan;2741ci_v1->band = band;2742ci_v1->width = width;2743ci_v1->ctrl_pos = ctrl_pos;2744}2745}27462747static inline void2748iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm,2749struct iwl_fw_channel_info *ci,2750const struct cfg80211_chan_def *chandef)2751{2752enum nl80211_band band = chandef->chan->band;27532754iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value,2755iwl_mvm_phy_band_from_nl80211(band),2756iwl_mvm_get_channel_width(chandef),2757iwl_mvm_get_ctrl_pos(chandef));2758}27592760static inline int iwl_umac_scan_get_max_profiles(const struct iwl_fw *fw)2761{2762u8 ver = iwl_fw_lookup_cmd_ver(fw, SCAN_OFFLOAD_UPDATE_PROFILES_CMD,2763IWL_FW_CMD_VER_UNKNOWN);2764return (ver == IWL_FW_CMD_VER_UNKNOWN || ver < 3) ?2765IWL_SCAN_MAX_PROFILES : IWL_SCAN_MAX_PROFILES_V2;2766}27672768static inline2769enum iwl_location_cipher iwl_mvm_cipher_to_location_cipher(u32 cipher)2770{2771switch (cipher) {2772case WLAN_CIPHER_SUITE_CCMP:2773return IWL_LOCATION_CIPHER_CCMP_128;2774case WLAN_CIPHER_SUITE_GCMP:2775return IWL_LOCATION_CIPHER_GCMP_128;2776case WLAN_CIPHER_SUITE_GCMP_256:2777return IWL_LOCATION_CIPHER_GCMP_256;2778default:2779return IWL_LOCATION_CIPHER_INVALID;2780}2781}27822783struct iwl_mvm_csme_conn_info *iwl_mvm_get_csme_conn_info(struct iwl_mvm *mvm);2784static inline int iwl_mvm_mei_get_ownership(struct iwl_mvm *mvm)2785{2786if (mvm->mei_registered)2787return iwl_mei_get_ownership();2788return 0;2789}27902791static inline void iwl_mvm_mei_tx_copy_to_csme(struct iwl_mvm *mvm,2792struct sk_buff *skb,2793unsigned int ivlen)2794{2795if (mvm->mei_registered)2796iwl_mei_tx_copy_to_csme(skb, ivlen);2797}27982799static inline void iwl_mvm_mei_host_disassociated(struct iwl_mvm *mvm)2800{2801if (mvm->mei_registered)2802iwl_mei_host_disassociated();2803}28042805static inline void iwl_mvm_mei_device_state(struct iwl_mvm *mvm, bool up)2806{2807if (mvm->mei_registered)2808iwl_mei_device_state(up);2809}28102811static inline void iwl_mvm_mei_set_sw_rfkill_state(struct iwl_mvm *mvm)2812{2813bool sw_rfkill =2814mvm->hw_registered ? rfkill_soft_blocked(mvm->hw->wiphy->rfkill) : false;28152816if (mvm->mei_registered)2817iwl_mei_set_rfkill_state(iwl_mvm_is_radio_killed(mvm),2818sw_rfkill);2819}28202821static inline bool iwl_mvm_has_p2p_over_aux(struct iwl_mvm *mvm)2822{2823u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, ROC_CMD);28242825return iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 0) >= 4;2826}28272828static inline bool iwl_mvm_mei_filter_scan(struct iwl_mvm *mvm,2829struct sk_buff *skb)2830{2831struct ieee80211_mgmt *mgmt = (void *)skb->data;28322833if (mvm->mei_scan_filter.is_mei_limited_scan &&2834(ieee80211_is_probe_resp(mgmt->frame_control) ||2835ieee80211_is_beacon(mgmt->frame_control))) {2836skb_queue_tail(&mvm->mei_scan_filter.scan_res, skb);2837schedule_work(&mvm->mei_scan_filter.scan_work);2838return true;2839}28402841return false;2842}28432844void iwl_mvm_send_roaming_forbidden_event(struct iwl_mvm *mvm,2845struct ieee80211_vif *vif,2846bool forbidden);28472848/* Callbacks for ieee80211_ops */2849void iwl_mvm_mac_tx(struct ieee80211_hw *hw,2850struct ieee80211_tx_control *control, struct sk_buff *skb);2851void iwl_mvm_mac_wake_tx_queue(struct ieee80211_hw *hw,2852struct ieee80211_txq *txq);28532854int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,2855struct ieee80211_vif *vif,2856struct ieee80211_ampdu_params *params);2857int iwl_mvm_op_get_antenna(struct ieee80211_hw *hw, int radio_idx, u32 *tx_ant,2858u32 *rx_ant);2859int iwl_mvm_op_set_antenna(struct ieee80211_hw *hw, int radio_idx, u32 tx_ant,2860u32 rx_ant);2861int iwl_mvm_mac_start(struct ieee80211_hw *hw);2862void iwl_mvm_mac_reconfig_complete(struct ieee80211_hw *hw,2863enum ieee80211_reconfig_type reconfig_type);2864void iwl_mvm_mac_stop(struct ieee80211_hw *hw, bool suspend);2865static inline int iwl_mvm_mac_config(struct ieee80211_hw *hw, int radio_idx,2866u32 changed)2867{2868return 0;2869}28702871u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw,2872struct netdev_hw_addr_list *mc_list);28732874void iwl_mvm_configure_filter(struct ieee80211_hw *hw,2875unsigned int changed_flags,2876unsigned int *total_flags, u64 multicast);2877int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2878struct ieee80211_scan_request *hw_req);2879void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw,2880struct ieee80211_vif *vif);2881void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw,2882struct ieee80211_vif *vif,2883struct ieee80211_sta *sta);2884void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2885enum sta_notify_cmd cmd,2886struct ieee80211_sta *sta);2887void2888iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,2889struct ieee80211_sta *sta, u16 tids,2890int num_frames,2891enum ieee80211_frame_release_type reason,2892bool more_data);2893void2894iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw,2895struct ieee80211_sta *sta, u16 tids,2896int num_frames,2897enum ieee80211_frame_release_type reason,2898bool more_data);2899int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx,2900u32 value);2901void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2902struct ieee80211_link_sta *link_sta, u32 changed);2903void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,2904struct ieee80211_vif *vif,2905struct ieee80211_prep_tx_info *info);2906void iwl_mvm_mac_mgd_complete_tx(struct ieee80211_hw *hw,2907struct ieee80211_vif *vif,2908struct ieee80211_prep_tx_info *info);2909void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2910u32 queues, bool drop);2911void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2912struct ieee80211_sta *sta);2913int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw,2914struct ieee80211_vif *vif,2915struct cfg80211_sched_scan_request *req,2916struct ieee80211_scan_ies *ies);2917int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,2918struct ieee80211_vif *vif);2919int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,2920struct ieee80211_vif *vif, struct ieee80211_sta *sta,2921struct ieee80211_key_conf *key);2922void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw,2923struct ieee80211_vif *vif,2924struct ieee80211_key_conf *keyconf,2925struct ieee80211_sta *sta,2926u32 iv32, u16 *phase1key);2927int iwl_mvm_add_chanctx(struct ieee80211_hw *hw,2928struct ieee80211_chanctx_conf *ctx);2929void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,2930struct ieee80211_chanctx_conf *ctx);2931void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,2932struct ieee80211_chanctx_conf *ctx, u32 changed);2933int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw);2934void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2935struct ieee80211_channel_switch *chsw);2936int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm,2937struct ieee80211_vif *vif,2938struct ieee80211_channel_switch *chsw);2939void iwl_mvm_abort_channel_switch(struct ieee80211_hw *hw,2940struct ieee80211_vif *vif,2941struct ieee80211_bss_conf *link_conf);2942void iwl_mvm_channel_switch_rx_beacon(struct ieee80211_hw *hw,2943struct ieee80211_vif *vif,2944struct ieee80211_channel_switch *chsw);2945void iwl_mvm_mac_event_callback(struct ieee80211_hw *hw,2946struct ieee80211_vif *vif,2947const struct ieee80211_event *event);2948void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw);2949int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw,2950struct ieee80211_vif *vif,2951void *data, int len);2952int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,2953struct survey_info *survey);2954void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,2955struct ieee80211_vif *vif,2956struct ieee80211_sta *sta,2957struct station_info *sinfo);2958int2959iwl_mvm_mac_get_ftm_responder_stats(struct ieee80211_hw *hw,2960struct ieee80211_vif *vif,2961struct cfg80211_ftm_responder_stats *stats);2962int iwl_mvm_start_pmsr(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2963struct cfg80211_pmsr_request *request);2964void iwl_mvm_abort_pmsr(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2965struct cfg80211_pmsr_request *request);29662967bool iwl_mvm_have_links_same_channel(struct iwl_mvm_vif *vif1,2968struct iwl_mvm_vif *vif2);2969bool iwl_mvm_vif_is_active(struct iwl_mvm_vif *mvmvif);2970int iwl_mvm_set_tx_power(struct iwl_mvm *mvm,2971struct ieee80211_bss_conf *bss_conf,2972s16 tx_power);2973int iwl_mvm_set_hw_timestamp(struct ieee80211_hw *hw,2974struct ieee80211_vif *vif,2975struct cfg80211_set_hw_timestamp *hwts);2976int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2977bool iwl_mvm_enable_fils(struct iwl_mvm *mvm,2978struct ieee80211_vif *vif,2979struct ieee80211_chanctx_conf *ctx);29802981struct cfg80211_chan_def *2982iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx);29832984void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif,2985u32 duration_ms,2986u32 *duration_tu,2987u32 *delay);2988int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm,2989struct ieee80211_channel *channel,2990struct ieee80211_vif *vif,2991int duration, enum iwl_roc_activity activity);29922993/* EMLSR */2994bool iwl_mvm_vif_has_esr_cap(struct iwl_mvm *mvm, struct ieee80211_vif *vif);2995void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2996enum iwl_mvm_esr_state reason,2997u8 link_to_keep);2998int iwl_mvm_block_esr_sync(struct iwl_mvm *mvm, struct ieee80211_vif *vif,2999enum iwl_mvm_esr_state reason);3000void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,3001enum iwl_mvm_esr_state reason);3002void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,3003enum iwl_mvm_esr_state reason,3004u8 link_to_keep);3005s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm,3006const struct cfg80211_chan_def *chandef,3007bool low);3008void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,3009struct ieee80211_vif *vif,3010int link_id);3011bool3012iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,3013struct ieee80211_vif *vif,3014s32 link_rssi,3015bool primary);3016int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,3017unsigned int link_id, bool active);30183019void3020iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm,3021struct ieee80211_vif *vif,3022struct ieee80211_bss_conf *bss_conf,3023bool is_ap);30243025void iwl_mvm_smps_workaround(struct iwl_mvm *mvm, struct ieee80211_vif *vif,3026bool update);30273028/* rate_n_flags conversion */3029u32 iwl_mvm_v3_rate_from_fw(__le32 rate, u8 rate_ver);3030__le32 iwl_mvm_v3_rate_to_fw(u32 rate, u8 rate_ver);30313032#endif /* __IWL_MVM_H__ */303330343035