18c2ecf20Sopenharmony_ci/****************************************************************************** 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 48c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. 98c2ecf20Sopenharmony_ci * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 108c2ecf20Sopenharmony_ci * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 138c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 148c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 178c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 188c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 198c2ecf20Sopenharmony_ci * General Public License for more details. 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * The full GNU General Public License is included in this distribution 228c2ecf20Sopenharmony_ci * in the file called COPYING. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * Contact Information: 258c2ecf20Sopenharmony_ci * Intel Linux Wireless <linuxwifi@intel.com> 268c2ecf20Sopenharmony_ci * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * BSD LICENSE 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation. All rights reserved. 318c2ecf20Sopenharmony_ci * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 328c2ecf20Sopenharmony_ci * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 338c2ecf20Sopenharmony_ci * All rights reserved. 348c2ecf20Sopenharmony_ci * 358c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 368c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 378c2ecf20Sopenharmony_ci * are met: 388c2ecf20Sopenharmony_ci * 398c2ecf20Sopenharmony_ci * * Redistributions of source code must retain the above copyright 408c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 418c2ecf20Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 428c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 438c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 448c2ecf20Sopenharmony_ci * distribution. 458c2ecf20Sopenharmony_ci * * Neither the name Intel Corporation nor the names of its 468c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 478c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 488c2ecf20Sopenharmony_ci * 498c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 508c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 518c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 528c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 538c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 548c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 558c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 568c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 578c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 588c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 598c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 608c2ecf20Sopenharmony_ci * 618c2ecf20Sopenharmony_ci *****************************************************************************/ 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#ifndef __IWL_MVM_H__ 648c2ecf20Sopenharmony_ci#define __IWL_MVM_H__ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#include <linux/list.h> 678c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 688c2ecf20Sopenharmony_ci#include <linux/leds.h> 698c2ecf20Sopenharmony_ci#include <linux/in6.h> 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#ifdef CONFIG_THERMAL 728c2ecf20Sopenharmony_ci#include <linux/thermal.h> 738c2ecf20Sopenharmony_ci#endif 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#include "iwl-op-mode.h" 768c2ecf20Sopenharmony_ci#include "iwl-trans.h" 778c2ecf20Sopenharmony_ci#include "fw/notif-wait.h" 788c2ecf20Sopenharmony_ci#include "iwl-eeprom-parse.h" 798c2ecf20Sopenharmony_ci#include "fw/file.h" 808c2ecf20Sopenharmony_ci#include "iwl-config.h" 818c2ecf20Sopenharmony_ci#include "sta.h" 828c2ecf20Sopenharmony_ci#include "fw-api.h" 838c2ecf20Sopenharmony_ci#include "constants.h" 848c2ecf20Sopenharmony_ci#include "fw/runtime.h" 858c2ecf20Sopenharmony_ci#include "fw/dbg.h" 868c2ecf20Sopenharmony_ci#include "fw/acpi.h" 878c2ecf20Sopenharmony_ci#include "iwl-nvm-parse.h" 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#include <linux/average.h> 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define IWL_MVM_MAX_ADDRESSES 5 928c2ecf20Sopenharmony_ci/* RSSI offset for WkP */ 938c2ecf20Sopenharmony_ci#define IWL_RSSI_OFFSET 50 948c2ecf20Sopenharmony_ci#define IWL_MVM_MISSED_BEACONS_THRESHOLD 8 958c2ecf20Sopenharmony_ci#define IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG 16 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* A TimeUnit is 1024 microsecond */ 988c2ecf20Sopenharmony_ci#define MSEC_TO_TU(_msec) (_msec*1000/1024) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* For GO, this value represents the number of TUs before CSA "beacon 1018c2ecf20Sopenharmony_ci * 0" TBTT when the CSA time-event needs to be scheduled to start. It 1028c2ecf20Sopenharmony_ci * must be big enough to ensure that we switch in time. 1038c2ecf20Sopenharmony_ci */ 1048c2ecf20Sopenharmony_ci#define IWL_MVM_CHANNEL_SWITCH_TIME_GO 40 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* For client, this value represents the number of TUs before CSA 1078c2ecf20Sopenharmony_ci * "beacon 1" TBTT, instead. This is because we don't know when the 1088c2ecf20Sopenharmony_ci * GO/AP will be in the new channel, so we switch early enough. 1098c2ecf20Sopenharmony_ci */ 1108c2ecf20Sopenharmony_ci#define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 10 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* 1138c2ecf20Sopenharmony_ci * This value (in TUs) is used to fine tune the CSA NoA end time which should 1148c2ecf20Sopenharmony_ci * be just before "beacon 0" TBTT. 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ci#define IWL_MVM_CHANNEL_SWITCH_MARGIN 4 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* 1198c2ecf20Sopenharmony_ci * Number of beacons to transmit on a new channel until we unblock tx to 1208c2ecf20Sopenharmony_ci * the stations, even if we didn't identify them on a new channel 1218c2ecf20Sopenharmony_ci */ 1228c2ecf20Sopenharmony_ci#define IWL_MVM_CS_UNBLOCK_TX_TIMEOUT 3 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* offchannel queue towards mac80211 */ 1258c2ecf20Sopenharmony_ci#define IWL_MVM_OFFCHANNEL_QUEUE 0 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ciextern const struct ieee80211_ops iwl_mvm_hw_ops; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/** 1308c2ecf20Sopenharmony_ci * struct iwl_mvm_mod_params - module parameters for iwlmvm 1318c2ecf20Sopenharmony_ci * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted. 1328c2ecf20Sopenharmony_ci * We will register to mac80211 to have testmode working. The NIC must not 1338c2ecf20Sopenharmony_ci * be up'ed after the INIT fw asserted. This is useful to be able to use 1348c2ecf20Sopenharmony_ci * proprietary tools over testmode to debug the INIT fw. 1358c2ecf20Sopenharmony_ci * @power_scheme: one of enum iwl_power_scheme 1368c2ecf20Sopenharmony_ci */ 1378c2ecf20Sopenharmony_cistruct iwl_mvm_mod_params { 1388c2ecf20Sopenharmony_ci bool init_dbg; 1398c2ecf20Sopenharmony_ci int power_scheme; 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ciextern struct iwl_mvm_mod_params iwlmvm_mod_params; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cistruct iwl_mvm_phy_ctxt { 1448c2ecf20Sopenharmony_ci u16 id; 1458c2ecf20Sopenharmony_ci u16 color; 1468c2ecf20Sopenharmony_ci u32 ref; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci enum nl80211_chan_width width; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /* 1518c2ecf20Sopenharmony_ci * TODO: This should probably be removed. Currently here only for rate 1528c2ecf20Sopenharmony_ci * scaling algorithm 1538c2ecf20Sopenharmony_ci */ 1548c2ecf20Sopenharmony_ci struct ieee80211_channel *channel; 1558c2ecf20Sopenharmony_ci}; 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_cistruct iwl_mvm_time_event_data { 1588c2ecf20Sopenharmony_ci struct ieee80211_vif *vif; 1598c2ecf20Sopenharmony_ci struct list_head list; 1608c2ecf20Sopenharmony_ci unsigned long end_jiffies; 1618c2ecf20Sopenharmony_ci u32 duration; 1628c2ecf20Sopenharmony_ci bool running; 1638c2ecf20Sopenharmony_ci u32 uid; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci /* 1668c2ecf20Sopenharmony_ci * The access to the 'id' field must be done when the 1678c2ecf20Sopenharmony_ci * mvm->time_event_lock is held, as it value is used to indicate 1688c2ecf20Sopenharmony_ci * if the te is in the time event list or not (when id == TE_MAX) 1698c2ecf20Sopenharmony_ci */ 1708c2ecf20Sopenharmony_ci u32 id; 1718c2ecf20Sopenharmony_ci}; 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci /* Power management */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci/** 1768c2ecf20Sopenharmony_ci * enum iwl_power_scheme 1778c2ecf20Sopenharmony_ci * @IWL_POWER_LEVEL_CAM - Continuously Active Mode 1788c2ecf20Sopenharmony_ci * @IWL_POWER_LEVEL_BPS - Balanced Power Save (default) 1798c2ecf20Sopenharmony_ci * @IWL_POWER_LEVEL_LP - Low Power 1808c2ecf20Sopenharmony_ci */ 1818c2ecf20Sopenharmony_cienum iwl_power_scheme { 1828c2ecf20Sopenharmony_ci IWL_POWER_SCHEME_CAM = 1, 1838c2ecf20Sopenharmony_ci IWL_POWER_SCHEME_BPS, 1848c2ecf20Sopenharmony_ci IWL_POWER_SCHEME_LP 1858c2ecf20Sopenharmony_ci}; 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci#define IWL_CONN_MAX_LISTEN_INTERVAL 10 1888c2ecf20Sopenharmony_ci#define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 1918c2ecf20Sopenharmony_cienum iwl_dbgfs_pm_mask { 1928c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0), 1938c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1), 1948c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2), 1958c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3), 1968c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4), 1978c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_LPRX_ENA = BIT(6), 1988c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7), 1998c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8), 2008c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9), 2018c2ecf20Sopenharmony_ci MVM_DEBUGFS_PM_USE_PS_POLL = BIT(10), 2028c2ecf20Sopenharmony_ci}; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_cistruct iwl_dbgfs_pm { 2058c2ecf20Sopenharmony_ci u16 keep_alive_seconds; 2068c2ecf20Sopenharmony_ci u32 rx_data_timeout; 2078c2ecf20Sopenharmony_ci u32 tx_data_timeout; 2088c2ecf20Sopenharmony_ci bool skip_over_dtim; 2098c2ecf20Sopenharmony_ci u8 skip_dtim_periods; 2108c2ecf20Sopenharmony_ci bool lprx_ena; 2118c2ecf20Sopenharmony_ci u32 lprx_rssi_threshold; 2128c2ecf20Sopenharmony_ci bool snooze_ena; 2138c2ecf20Sopenharmony_ci bool uapsd_misbehaving; 2148c2ecf20Sopenharmony_ci bool use_ps_poll; 2158c2ecf20Sopenharmony_ci int mask; 2168c2ecf20Sopenharmony_ci}; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* beacon filtering */ 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_cienum iwl_dbgfs_bf_mask { 2218c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0), 2228c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1), 2238c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2), 2248c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3), 2258c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4), 2268c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5), 2278c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6), 2288c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7), 2298c2ecf20Sopenharmony_ci MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8), 2308c2ecf20Sopenharmony_ci MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9), 2318c2ecf20Sopenharmony_ci MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10), 2328c2ecf20Sopenharmony_ci}; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_cistruct iwl_dbgfs_bf { 2358c2ecf20Sopenharmony_ci u32 bf_energy_delta; 2368c2ecf20Sopenharmony_ci u32 bf_roaming_energy_delta; 2378c2ecf20Sopenharmony_ci u32 bf_roaming_state; 2388c2ecf20Sopenharmony_ci u32 bf_temp_threshold; 2398c2ecf20Sopenharmony_ci u32 bf_temp_fast_filter; 2408c2ecf20Sopenharmony_ci u32 bf_temp_slow_filter; 2418c2ecf20Sopenharmony_ci u32 bf_enable_beacon_filter; 2428c2ecf20Sopenharmony_ci u32 bf_debug_flag; 2438c2ecf20Sopenharmony_ci u32 bf_escape_timer; 2448c2ecf20Sopenharmony_ci u32 ba_escape_timer; 2458c2ecf20Sopenharmony_ci u32 ba_enable_beacon_abort; 2468c2ecf20Sopenharmony_ci int mask; 2478c2ecf20Sopenharmony_ci}; 2488c2ecf20Sopenharmony_ci#endif 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_cienum iwl_mvm_smps_type_request { 2518c2ecf20Sopenharmony_ci IWL_MVM_SMPS_REQ_BT_COEX, 2528c2ecf20Sopenharmony_ci IWL_MVM_SMPS_REQ_TT, 2538c2ecf20Sopenharmony_ci IWL_MVM_SMPS_REQ_PROT, 2548c2ecf20Sopenharmony_ci NUM_IWL_MVM_SMPS_REQ, 2558c2ecf20Sopenharmony_ci}; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_cienum iwl_bt_force_ant_mode { 2588c2ecf20Sopenharmony_ci BT_FORCE_ANT_DIS = 0, 2598c2ecf20Sopenharmony_ci BT_FORCE_ANT_AUTO, 2608c2ecf20Sopenharmony_ci BT_FORCE_ANT_BT, 2618c2ecf20Sopenharmony_ci BT_FORCE_ANT_WIFI, 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci BT_FORCE_ANT_MAX, 2648c2ecf20Sopenharmony_ci}; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci/** 2678c2ecf20Sopenharmony_ci * struct iwl_mvm_low_latency_force - low latency force mode set by debugfs 2688c2ecf20Sopenharmony_ci * @LOW_LATENCY_FORCE_UNSET: unset force mode 2698c2ecf20Sopenharmony_ci * @LOW_LATENCY_FORCE_ON: for low latency on 2708c2ecf20Sopenharmony_ci * @LOW_LATENCY_FORCE_OFF: for low latency off 2718c2ecf20Sopenharmony_ci * @NUM_LOW_LATENCY_FORCE: max num of modes 2728c2ecf20Sopenharmony_ci */ 2738c2ecf20Sopenharmony_cienum iwl_mvm_low_latency_force { 2748c2ecf20Sopenharmony_ci LOW_LATENCY_FORCE_UNSET, 2758c2ecf20Sopenharmony_ci LOW_LATENCY_FORCE_ON, 2768c2ecf20Sopenharmony_ci LOW_LATENCY_FORCE_OFF, 2778c2ecf20Sopenharmony_ci NUM_LOW_LATENCY_FORCE 2788c2ecf20Sopenharmony_ci}; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci/** 2818c2ecf20Sopenharmony_ci* struct iwl_mvm_low_latency_cause - low latency set causes 2828c2ecf20Sopenharmony_ci* @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected 2838c2ecf20Sopenharmony_ci* @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs 2848c2ecf20Sopenharmony_ci* @LOW_LATENCY_VCMD: low latency mode set from vendor command 2858c2ecf20Sopenharmony_ci* @LOW_LATENCY_VIF_TYPE: low latency mode set because of vif type (ap) 2868c2ecf20Sopenharmony_ci* @LOW_LATENCY_DEBUGFS_FORCE_ENABLE: indicate that force mode is enabled 2878c2ecf20Sopenharmony_ci* the actual set/unset is done with LOW_LATENCY_DEBUGFS_FORCE 2888c2ecf20Sopenharmony_ci* @LOW_LATENCY_DEBUGFS_FORCE: low latency force mode from debugfs 2898c2ecf20Sopenharmony_ci* set this with LOW_LATENCY_DEBUGFS_FORCE_ENABLE flag 2908c2ecf20Sopenharmony_ci* in low_latency. 2918c2ecf20Sopenharmony_ci*/ 2928c2ecf20Sopenharmony_cienum iwl_mvm_low_latency_cause { 2938c2ecf20Sopenharmony_ci LOW_LATENCY_TRAFFIC = BIT(0), 2948c2ecf20Sopenharmony_ci LOW_LATENCY_DEBUGFS = BIT(1), 2958c2ecf20Sopenharmony_ci LOW_LATENCY_VCMD = BIT(2), 2968c2ecf20Sopenharmony_ci LOW_LATENCY_VIF_TYPE = BIT(3), 2978c2ecf20Sopenharmony_ci LOW_LATENCY_DEBUGFS_FORCE_ENABLE = BIT(4), 2988c2ecf20Sopenharmony_ci LOW_LATENCY_DEBUGFS_FORCE = BIT(5), 2998c2ecf20Sopenharmony_ci}; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/** 3028c2ecf20Sopenharmony_ci* struct iwl_mvm_vif_bf_data - beacon filtering related data 3038c2ecf20Sopenharmony_ci* @bf_enabled: indicates if beacon filtering is enabled 3048c2ecf20Sopenharmony_ci* @ba_enabled: indicated if beacon abort is enabled 3058c2ecf20Sopenharmony_ci* @ave_beacon_signal: average beacon signal 3068c2ecf20Sopenharmony_ci* @last_cqm_event: rssi of the last cqm event 3078c2ecf20Sopenharmony_ci* @bt_coex_min_thold: minimum threshold for BT coex 3088c2ecf20Sopenharmony_ci* @bt_coex_max_thold: maximum threshold for BT coex 3098c2ecf20Sopenharmony_ci* @last_bt_coex_event: rssi of the last BT coex event 3108c2ecf20Sopenharmony_ci*/ 3118c2ecf20Sopenharmony_cistruct iwl_mvm_vif_bf_data { 3128c2ecf20Sopenharmony_ci bool bf_enabled; 3138c2ecf20Sopenharmony_ci bool ba_enabled; 3148c2ecf20Sopenharmony_ci int ave_beacon_signal; 3158c2ecf20Sopenharmony_ci int last_cqm_event; 3168c2ecf20Sopenharmony_ci int bt_coex_min_thold; 3178c2ecf20Sopenharmony_ci int bt_coex_max_thold; 3188c2ecf20Sopenharmony_ci int last_bt_coex_event; 3198c2ecf20Sopenharmony_ci}; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci/** 3228c2ecf20Sopenharmony_ci * struct iwl_probe_resp_data - data for NoA/CSA updates 3238c2ecf20Sopenharmony_ci * @rcu_head: used for freeing the data on update 3248c2ecf20Sopenharmony_ci * @notif: notification data 3258c2ecf20Sopenharmony_ci * @noa_len: length of NoA attribute, calculated from the notification 3268c2ecf20Sopenharmony_ci */ 3278c2ecf20Sopenharmony_cistruct iwl_probe_resp_data { 3288c2ecf20Sopenharmony_ci struct rcu_head rcu_head; 3298c2ecf20Sopenharmony_ci struct iwl_probe_resp_data_notif notif; 3308c2ecf20Sopenharmony_ci int noa_len; 3318c2ecf20Sopenharmony_ci}; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/** 3348c2ecf20Sopenharmony_ci * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context 3358c2ecf20Sopenharmony_ci * @id: between 0 and 3 3368c2ecf20Sopenharmony_ci * @color: to solve races upon MAC addition and removal 3378c2ecf20Sopenharmony_ci * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA 3388c2ecf20Sopenharmony_ci * @bssid: BSSID for this (client) interface 3398c2ecf20Sopenharmony_ci * @associated: indicates that we're currently associated, used only for 3408c2ecf20Sopenharmony_ci * managing the firmware state in iwl_mvm_bss_info_changed_station() 3418c2ecf20Sopenharmony_ci * @ap_assoc_sta_count: count of stations associated to us - valid only 3428c2ecf20Sopenharmony_ci * if VIF type is AP 3438c2ecf20Sopenharmony_ci * @uploaded: indicates the MAC context has been added to the device 3448c2ecf20Sopenharmony_ci * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface 3458c2ecf20Sopenharmony_ci * should get quota etc. 3468c2ecf20Sopenharmony_ci * @pm_enabled - Indicate if MAC power management is allowed 3478c2ecf20Sopenharmony_ci * @monitor_active: indicates that monitor context is configured, and that the 3488c2ecf20Sopenharmony_ci * interface should get quota etc. 3498c2ecf20Sopenharmony_ci * @low_latency: bit flags for low latency 3508c2ecf20Sopenharmony_ci * see enum &iwl_mvm_low_latency_cause for causes. 3518c2ecf20Sopenharmony_ci * @low_latency_actual: boolean, indicates low latency is set, 3528c2ecf20Sopenharmony_ci * as a result from low_latency bit flags and takes force into account. 3538c2ecf20Sopenharmony_ci * @ps_disabled: indicates that this interface requires PS to be disabled 3548c2ecf20Sopenharmony_ci * @queue_params: QoS params for this MAC 3558c2ecf20Sopenharmony_ci * @bcast_sta: station used for broadcast packets. Used by the following 3568c2ecf20Sopenharmony_ci * vifs: P2P_DEVICE, GO and AP. 3578c2ecf20Sopenharmony_ci * @beacon_skb: the skb used to hold the AP/GO beacon template 3588c2ecf20Sopenharmony_ci * @smps_requests: the SMPS requests of different parts of the driver, 3598c2ecf20Sopenharmony_ci * combined on update to yield the overall request to mac80211. 3608c2ecf20Sopenharmony_ci * @beacon_stats: beacon statistics, containing the # of received beacons, 3618c2ecf20Sopenharmony_ci * # of received beacons accumulated over FW restart, and the current 3628c2ecf20Sopenharmony_ci * average signal of beacons retrieved from the firmware 3638c2ecf20Sopenharmony_ci * @csa_failed: CSA failed to schedule time event, report an error later 3648c2ecf20Sopenharmony_ci * @features: hw features active for this vif 3658c2ecf20Sopenharmony_ci * @probe_resp_data: data from FW notification to store NOA and CSA related 3668c2ecf20Sopenharmony_ci * data to be inserted into probe response. 3678c2ecf20Sopenharmony_ci */ 3688c2ecf20Sopenharmony_cistruct iwl_mvm_vif { 3698c2ecf20Sopenharmony_ci struct iwl_mvm *mvm; 3708c2ecf20Sopenharmony_ci u16 id; 3718c2ecf20Sopenharmony_ci u16 color; 3728c2ecf20Sopenharmony_ci u8 ap_sta_id; 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci u8 bssid[ETH_ALEN]; 3758c2ecf20Sopenharmony_ci bool associated; 3768c2ecf20Sopenharmony_ci u8 ap_assoc_sta_count; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci u16 cab_queue; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci bool uploaded; 3818c2ecf20Sopenharmony_ci bool ap_ibss_active; 3828c2ecf20Sopenharmony_ci bool pm_enabled; 3838c2ecf20Sopenharmony_ci bool monitor_active; 3848c2ecf20Sopenharmony_ci u8 low_latency: 6; 3858c2ecf20Sopenharmony_ci u8 low_latency_actual: 1; 3868c2ecf20Sopenharmony_ci bool ps_disabled; 3878c2ecf20Sopenharmony_ci struct iwl_mvm_vif_bf_data bf_data; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci struct { 3908c2ecf20Sopenharmony_ci u32 num_beacons, accu_num_beacons; 3918c2ecf20Sopenharmony_ci u8 avg_signal; 3928c2ecf20Sopenharmony_ci } beacon_stats; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci u32 ap_beacon_time; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci enum iwl_tsf_id tsf_id; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci /* 3998c2ecf20Sopenharmony_ci * QoS data from mac80211, need to store this here 4008c2ecf20Sopenharmony_ci * as mac80211 has a separate callback but we need 4018c2ecf20Sopenharmony_ci * to have the data for the MAC context 4028c2ecf20Sopenharmony_ci */ 4038c2ecf20Sopenharmony_ci struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; 4048c2ecf20Sopenharmony_ci struct iwl_mvm_time_event_data time_event_data; 4058c2ecf20Sopenharmony_ci struct iwl_mvm_time_event_data hs_time_event_data; 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci struct iwl_mvm_int_sta bcast_sta; 4088c2ecf20Sopenharmony_ci struct iwl_mvm_int_sta mcast_sta; 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci /* 4118c2ecf20Sopenharmony_ci * Assigned while mac80211 has the interface in a channel context, 4128c2ecf20Sopenharmony_ci * or, for P2P Device, while it exists. 4138c2ecf20Sopenharmony_ci */ 4148c2ecf20Sopenharmony_ci struct iwl_mvm_phy_ctxt *phy_ctxt; 4158c2ecf20Sopenharmony_ci 4168c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 4178c2ecf20Sopenharmony_ci /* WoWLAN GTK rekey data */ 4188c2ecf20Sopenharmony_ci struct { 4198c2ecf20Sopenharmony_ci u8 kck[NL80211_KCK_EXT_LEN]; 4208c2ecf20Sopenharmony_ci u8 kek[NL80211_KEK_EXT_LEN]; 4218c2ecf20Sopenharmony_ci size_t kek_len; 4228c2ecf20Sopenharmony_ci size_t kck_len; 4238c2ecf20Sopenharmony_ci u32 akm; 4248c2ecf20Sopenharmony_ci __le64 replay_ctr; 4258c2ecf20Sopenharmony_ci bool valid; 4268c2ecf20Sopenharmony_ci } rekey_data; 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_ci int tx_key_idx; 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci bool seqno_valid; 4318c2ecf20Sopenharmony_ci u16 seqno; 4328c2ecf20Sopenharmony_ci#endif 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_IPV6) 4358c2ecf20Sopenharmony_ci /* IPv6 addresses for WoWLAN */ 4368c2ecf20Sopenharmony_ci struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX]; 4378c2ecf20Sopenharmony_ci unsigned long tentative_addrs[BITS_TO_LONGS(IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX)]; 4388c2ecf20Sopenharmony_ci int num_target_ipv6_addrs; 4398c2ecf20Sopenharmony_ci#endif 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 4428c2ecf20Sopenharmony_ci struct dentry *dbgfs_dir; 4438c2ecf20Sopenharmony_ci struct dentry *dbgfs_slink; 4448c2ecf20Sopenharmony_ci struct iwl_dbgfs_pm dbgfs_pm; 4458c2ecf20Sopenharmony_ci struct iwl_dbgfs_bf dbgfs_bf; 4468c2ecf20Sopenharmony_ci struct iwl_mac_power_cmd mac_pwr_cmd; 4478c2ecf20Sopenharmony_ci int dbgfs_quota_min; 4488c2ecf20Sopenharmony_ci#endif 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ]; 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci /* FW identified misbehaving AP */ 4538c2ecf20Sopenharmony_ci u8 uapsd_misbehaving_bssid[ETH_ALEN]; 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci struct delayed_work uapsd_nonagg_detected_wk; 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci /* Indicates that CSA countdown may be started */ 4588c2ecf20Sopenharmony_ci bool csa_countdown; 4598c2ecf20Sopenharmony_ci bool csa_failed; 4608c2ecf20Sopenharmony_ci u16 csa_target_freq; 4618c2ecf20Sopenharmony_ci u16 csa_count; 4628c2ecf20Sopenharmony_ci u16 csa_misbehave; 4638c2ecf20Sopenharmony_ci struct delayed_work csa_work; 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci /* Indicates that we are waiting for a beacon on a new channel */ 4668c2ecf20Sopenharmony_ci bool csa_bcn_pending; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci /* TCP Checksum Offload */ 4698c2ecf20Sopenharmony_ci netdev_features_t features; 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci struct iwl_probe_resp_data __rcu *probe_resp_data; 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci /* we can only have 2 GTK + 2 IGTK active at a time */ 4748c2ecf20Sopenharmony_ci struct ieee80211_key_conf *ap_early_keys[4]; 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci /* 26-tone RU OFDMA transmissions should be blocked */ 4778c2ecf20Sopenharmony_ci bool he_ru_2mhz_block; 4788c2ecf20Sopenharmony_ci}; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_vif * 4818c2ecf20Sopenharmony_ciiwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) 4828c2ecf20Sopenharmony_ci{ 4838c2ecf20Sopenharmony_ci if (!vif) 4848c2ecf20Sopenharmony_ci return NULL; 4858c2ecf20Sopenharmony_ci return (void *)vif->drv_priv; 4868c2ecf20Sopenharmony_ci} 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ciextern const u8 tid_to_mac80211_ac[]; 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci#define IWL_MVM_SCAN_STOPPING_SHIFT 8 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_cienum iwl_scan_status { 4938c2ecf20Sopenharmony_ci IWL_MVM_SCAN_REGULAR = BIT(0), 4948c2ecf20Sopenharmony_ci IWL_MVM_SCAN_SCHED = BIT(1), 4958c2ecf20Sopenharmony_ci IWL_MVM_SCAN_NETDETECT = BIT(2), 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8), 4988c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_SCHED = BIT(9), 4998c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10), 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci IWL_MVM_SCAN_REGULAR_MASK = IWL_MVM_SCAN_REGULAR | 5028c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_REGULAR, 5038c2ecf20Sopenharmony_ci IWL_MVM_SCAN_SCHED_MASK = IWL_MVM_SCAN_SCHED | 5048c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_SCHED, 5058c2ecf20Sopenharmony_ci IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT | 5068c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_NETDETECT, 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT, 5098c2ecf20Sopenharmony_ci IWL_MVM_SCAN_MASK = 0xff, 5108c2ecf20Sopenharmony_ci}; 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_cienum iwl_mvm_scan_type { 5138c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_NOT_SET, 5148c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_UNASSOC, 5158c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_WILD, 5168c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_MILD, 5178c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_FRAGMENTED, 5188c2ecf20Sopenharmony_ci IWL_SCAN_TYPE_FAST_BALANCE, 5198c2ecf20Sopenharmony_ci}; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cienum iwl_mvm_sched_scan_pass_all_states { 5228c2ecf20Sopenharmony_ci SCHED_SCAN_PASS_ALL_DISABLED, 5238c2ecf20Sopenharmony_ci SCHED_SCAN_PASS_ALL_ENABLED, 5248c2ecf20Sopenharmony_ci SCHED_SCAN_PASS_ALL_FOUND, 5258c2ecf20Sopenharmony_ci}; 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci/** 5288c2ecf20Sopenharmony_ci * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure 5298c2ecf20Sopenharmony_ci * @ct_kill_exit: worker to exit thermal kill 5308c2ecf20Sopenharmony_ci * @dynamic_smps: Is thermal throttling enabled dynamic_smps? 5318c2ecf20Sopenharmony_ci * @tx_backoff: The current thremal throttling tx backoff in uSec. 5328c2ecf20Sopenharmony_ci * @min_backoff: The minimal tx backoff due to power restrictions 5338c2ecf20Sopenharmony_ci * @params: Parameters to configure the thermal throttling algorithm. 5348c2ecf20Sopenharmony_ci * @throttle: Is thermal throttling is active? 5358c2ecf20Sopenharmony_ci */ 5368c2ecf20Sopenharmony_cistruct iwl_mvm_tt_mgmt { 5378c2ecf20Sopenharmony_ci struct delayed_work ct_kill_exit; 5388c2ecf20Sopenharmony_ci bool dynamic_smps; 5398c2ecf20Sopenharmony_ci u32 tx_backoff; 5408c2ecf20Sopenharmony_ci u32 min_backoff; 5418c2ecf20Sopenharmony_ci struct iwl_tt_params params; 5428c2ecf20Sopenharmony_ci bool throttle; 5438c2ecf20Sopenharmony_ci}; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#ifdef CONFIG_THERMAL 5468c2ecf20Sopenharmony_ci/** 5478c2ecf20Sopenharmony_ci *struct iwl_mvm_thermal_device - thermal zone related data 5488c2ecf20Sopenharmony_ci * @temp_trips: temperature thresholds for report 5498c2ecf20Sopenharmony_ci * @fw_trips_index: keep indexes to original array - temp_trips 5508c2ecf20Sopenharmony_ci * @tzone: thermal zone device data 5518c2ecf20Sopenharmony_ci*/ 5528c2ecf20Sopenharmony_cistruct iwl_mvm_thermal_device { 5538c2ecf20Sopenharmony_ci s16 temp_trips[IWL_MAX_DTS_TRIPS]; 5548c2ecf20Sopenharmony_ci u8 fw_trips_index[IWL_MAX_DTS_TRIPS]; 5558c2ecf20Sopenharmony_ci struct thermal_zone_device *tzone; 5568c2ecf20Sopenharmony_ci}; 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci/* 5598c2ecf20Sopenharmony_ci * struct iwl_mvm_cooling_device 5608c2ecf20Sopenharmony_ci * @cur_state: current state 5618c2ecf20Sopenharmony_ci * @cdev: struct thermal cooling device 5628c2ecf20Sopenharmony_ci */ 5638c2ecf20Sopenharmony_cistruct iwl_mvm_cooling_device { 5648c2ecf20Sopenharmony_ci u32 cur_state; 5658c2ecf20Sopenharmony_ci struct thermal_cooling_device *cdev; 5668c2ecf20Sopenharmony_ci}; 5678c2ecf20Sopenharmony_ci#endif 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci#define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_cistruct iwl_mvm_frame_stats { 5728c2ecf20Sopenharmony_ci u32 legacy_frames; 5738c2ecf20Sopenharmony_ci u32 ht_frames; 5748c2ecf20Sopenharmony_ci u32 vht_frames; 5758c2ecf20Sopenharmony_ci u32 bw_20_frames; 5768c2ecf20Sopenharmony_ci u32 bw_40_frames; 5778c2ecf20Sopenharmony_ci u32 bw_80_frames; 5788c2ecf20Sopenharmony_ci u32 bw_160_frames; 5798c2ecf20Sopenharmony_ci u32 sgi_frames; 5808c2ecf20Sopenharmony_ci u32 ngi_frames; 5818c2ecf20Sopenharmony_ci u32 siso_frames; 5828c2ecf20Sopenharmony_ci u32 mimo2_frames; 5838c2ecf20Sopenharmony_ci u32 agg_frames; 5848c2ecf20Sopenharmony_ci u32 ampdu_count; 5858c2ecf20Sopenharmony_ci u32 success_frames; 5868c2ecf20Sopenharmony_ci u32 fail_frames; 5878c2ecf20Sopenharmony_ci u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES]; 5888c2ecf20Sopenharmony_ci int last_frame_idx; 5898c2ecf20Sopenharmony_ci}; 5908c2ecf20Sopenharmony_ci 5918c2ecf20Sopenharmony_ci#define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff 5928c2ecf20Sopenharmony_ci#define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100 5938c2ecf20Sopenharmony_ci#define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200 5948c2ecf20Sopenharmony_ci 5958c2ecf20Sopenharmony_cienum iwl_mvm_tdls_cs_state { 5968c2ecf20Sopenharmony_ci IWL_MVM_TDLS_SW_IDLE = 0, 5978c2ecf20Sopenharmony_ci IWL_MVM_TDLS_SW_REQ_SENT, 5988c2ecf20Sopenharmony_ci IWL_MVM_TDLS_SW_RESP_RCVD, 5998c2ecf20Sopenharmony_ci IWL_MVM_TDLS_SW_REQ_RCVD, 6008c2ecf20Sopenharmony_ci IWL_MVM_TDLS_SW_ACTIVE, 6018c2ecf20Sopenharmony_ci}; 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_cienum iwl_mvm_traffic_load { 6048c2ecf20Sopenharmony_ci IWL_MVM_TRAFFIC_LOW, 6058c2ecf20Sopenharmony_ci IWL_MVM_TRAFFIC_MEDIUM, 6068c2ecf20Sopenharmony_ci IWL_MVM_TRAFFIC_HIGH, 6078c2ecf20Sopenharmony_ci}; 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ciDECLARE_EWMA(rate, 16, 16) 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_cistruct iwl_mvm_tcm_mac { 6128c2ecf20Sopenharmony_ci struct { 6138c2ecf20Sopenharmony_ci u32 pkts[IEEE80211_NUM_ACS]; 6148c2ecf20Sopenharmony_ci u32 airtime; 6158c2ecf20Sopenharmony_ci } tx; 6168c2ecf20Sopenharmony_ci struct { 6178c2ecf20Sopenharmony_ci u32 pkts[IEEE80211_NUM_ACS]; 6188c2ecf20Sopenharmony_ci u32 airtime; 6198c2ecf20Sopenharmony_ci u32 last_ampdu_ref; 6208c2ecf20Sopenharmony_ci } rx; 6218c2ecf20Sopenharmony_ci struct { 6228c2ecf20Sopenharmony_ci /* track AP's transfer in client mode */ 6238c2ecf20Sopenharmony_ci u64 rx_bytes; 6248c2ecf20Sopenharmony_ci struct ewma_rate rate; 6258c2ecf20Sopenharmony_ci bool detected; 6268c2ecf20Sopenharmony_ci } uapsd_nonagg_detect; 6278c2ecf20Sopenharmony_ci bool opened_rx_ba_sessions; 6288c2ecf20Sopenharmony_ci}; 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_cistruct iwl_mvm_tcm { 6318c2ecf20Sopenharmony_ci struct delayed_work work; 6328c2ecf20Sopenharmony_ci spinlock_t lock; /* used when time elapsed */ 6338c2ecf20Sopenharmony_ci unsigned long ts; /* timestamp when period ends */ 6348c2ecf20Sopenharmony_ci unsigned long ll_ts; 6358c2ecf20Sopenharmony_ci unsigned long uapsd_nonagg_ts; 6368c2ecf20Sopenharmony_ci bool paused; 6378c2ecf20Sopenharmony_ci struct iwl_mvm_tcm_mac data[NUM_MAC_INDEX_DRIVER]; 6388c2ecf20Sopenharmony_ci struct { 6398c2ecf20Sopenharmony_ci u32 elapsed; /* milliseconds for this TCM period */ 6408c2ecf20Sopenharmony_ci u32 airtime[NUM_MAC_INDEX_DRIVER]; 6418c2ecf20Sopenharmony_ci enum iwl_mvm_traffic_load load[NUM_MAC_INDEX_DRIVER]; 6428c2ecf20Sopenharmony_ci enum iwl_mvm_traffic_load band_load[NUM_NL80211_BANDS]; 6438c2ecf20Sopenharmony_ci enum iwl_mvm_traffic_load global_load; 6448c2ecf20Sopenharmony_ci bool low_latency[NUM_MAC_INDEX_DRIVER]; 6458c2ecf20Sopenharmony_ci bool change[NUM_MAC_INDEX_DRIVER]; 6468c2ecf20Sopenharmony_ci bool global_change; 6478c2ecf20Sopenharmony_ci } result; 6488c2ecf20Sopenharmony_ci}; 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci/** 6518c2ecf20Sopenharmony_ci * struct iwl_mvm_reorder_buffer - per ra/tid/queue reorder buffer 6528c2ecf20Sopenharmony_ci * @head_sn: reorder window head sn 6538c2ecf20Sopenharmony_ci * @num_stored: number of mpdus stored in the buffer 6548c2ecf20Sopenharmony_ci * @buf_size: the reorder buffer size as set by the last addba request 6558c2ecf20Sopenharmony_ci * @queue: queue of this reorder buffer 6568c2ecf20Sopenharmony_ci * @last_amsdu: track last ASMDU SN for duplication detection 6578c2ecf20Sopenharmony_ci * @last_sub_index: track ASMDU sub frame index for duplication detection 6588c2ecf20Sopenharmony_ci * @reorder_timer: timer for frames are in the reorder buffer. For AMSDU 6598c2ecf20Sopenharmony_ci * it is the time of last received sub-frame 6608c2ecf20Sopenharmony_ci * @removed: prevent timer re-arming 6618c2ecf20Sopenharmony_ci * @valid: reordering is valid for this queue 6628c2ecf20Sopenharmony_ci * @lock: protect reorder buffer internal state 6638c2ecf20Sopenharmony_ci * @mvm: mvm pointer, needed for frame timer context 6648c2ecf20Sopenharmony_ci * @consec_oldsn_drops: consecutive drops due to old SN 6658c2ecf20Sopenharmony_ci * @consec_oldsn_ampdu_gp2: A-MPDU GP2 timestamp to track 6668c2ecf20Sopenharmony_ci * when to apply old SN consecutive drop workaround 6678c2ecf20Sopenharmony_ci * @consec_oldsn_prev_drop: track whether or not an MPDU 6688c2ecf20Sopenharmony_ci * that was single/part of the previous A-MPDU was 6698c2ecf20Sopenharmony_ci * dropped due to old SN 6708c2ecf20Sopenharmony_ci */ 6718c2ecf20Sopenharmony_cistruct iwl_mvm_reorder_buffer { 6728c2ecf20Sopenharmony_ci u16 head_sn; 6738c2ecf20Sopenharmony_ci u16 num_stored; 6748c2ecf20Sopenharmony_ci u16 buf_size; 6758c2ecf20Sopenharmony_ci int queue; 6768c2ecf20Sopenharmony_ci u16 last_amsdu; 6778c2ecf20Sopenharmony_ci u8 last_sub_index; 6788c2ecf20Sopenharmony_ci struct timer_list reorder_timer; 6798c2ecf20Sopenharmony_ci bool removed; 6808c2ecf20Sopenharmony_ci bool valid; 6818c2ecf20Sopenharmony_ci spinlock_t lock; 6828c2ecf20Sopenharmony_ci struct iwl_mvm *mvm; 6838c2ecf20Sopenharmony_ci unsigned int consec_oldsn_drops; 6848c2ecf20Sopenharmony_ci u32 consec_oldsn_ampdu_gp2; 6858c2ecf20Sopenharmony_ci unsigned int consec_oldsn_prev_drop:1; 6868c2ecf20Sopenharmony_ci} ____cacheline_aligned_in_smp; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci/** 6898c2ecf20Sopenharmony_ci * struct _iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno 6908c2ecf20Sopenharmony_ci * @frames: list of skbs stored 6918c2ecf20Sopenharmony_ci * @reorder_time: time the packet was stored in the reorder buffer 6928c2ecf20Sopenharmony_ci */ 6938c2ecf20Sopenharmony_cistruct _iwl_mvm_reorder_buf_entry { 6948c2ecf20Sopenharmony_ci struct sk_buff_head frames; 6958c2ecf20Sopenharmony_ci unsigned long reorder_time; 6968c2ecf20Sopenharmony_ci}; 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ci/* make this indirection to get the aligned thing */ 6998c2ecf20Sopenharmony_cistruct iwl_mvm_reorder_buf_entry { 7008c2ecf20Sopenharmony_ci struct _iwl_mvm_reorder_buf_entry e; 7018c2ecf20Sopenharmony_ci} 7028c2ecf20Sopenharmony_ci#ifndef __CHECKER__ 7038c2ecf20Sopenharmony_ci/* sparse doesn't like this construct: "bad integer constant expression" */ 7048c2ecf20Sopenharmony_ci__aligned(roundup_pow_of_two(sizeof(struct _iwl_mvm_reorder_buf_entry))) 7058c2ecf20Sopenharmony_ci#endif 7068c2ecf20Sopenharmony_ci; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci/** 7098c2ecf20Sopenharmony_ci * struct iwl_mvm_baid_data - BA session data 7108c2ecf20Sopenharmony_ci * @sta_id: station id 7118c2ecf20Sopenharmony_ci * @tid: tid of the session 7128c2ecf20Sopenharmony_ci * @baid baid of the session 7138c2ecf20Sopenharmony_ci * @timeout: the timeout set in the addba request 7148c2ecf20Sopenharmony_ci * @entries_per_queue: # of buffers per queue, this actually gets 7158c2ecf20Sopenharmony_ci * aligned up to avoid cache line sharing between queues 7168c2ecf20Sopenharmony_ci * @last_rx: last rx jiffies, updated only if timeout passed from last update 7178c2ecf20Sopenharmony_ci * @session_timer: timer to check if BA session expired, runs at 2 * timeout 7188c2ecf20Sopenharmony_ci * @mvm: mvm pointer, needed for timer context 7198c2ecf20Sopenharmony_ci * @reorder_buf: reorder buffer, allocated per queue 7208c2ecf20Sopenharmony_ci * @reorder_buf_data: data 7218c2ecf20Sopenharmony_ci */ 7228c2ecf20Sopenharmony_cistruct iwl_mvm_baid_data { 7238c2ecf20Sopenharmony_ci struct rcu_head rcu_head; 7248c2ecf20Sopenharmony_ci u8 sta_id; 7258c2ecf20Sopenharmony_ci u8 tid; 7268c2ecf20Sopenharmony_ci u8 baid; 7278c2ecf20Sopenharmony_ci u16 timeout; 7288c2ecf20Sopenharmony_ci u16 entries_per_queue; 7298c2ecf20Sopenharmony_ci unsigned long last_rx; 7308c2ecf20Sopenharmony_ci struct timer_list session_timer; 7318c2ecf20Sopenharmony_ci struct iwl_mvm_baid_data __rcu **rcu_ptr; 7328c2ecf20Sopenharmony_ci struct iwl_mvm *mvm; 7338c2ecf20Sopenharmony_ci struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES]; 7348c2ecf20Sopenharmony_ci struct iwl_mvm_reorder_buf_entry entries[]; 7358c2ecf20Sopenharmony_ci}; 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_baid_data * 7388c2ecf20Sopenharmony_ciiwl_mvm_baid_data_from_reorder_buf(struct iwl_mvm_reorder_buffer *buf) 7398c2ecf20Sopenharmony_ci{ 7408c2ecf20Sopenharmony_ci return (void *)((u8 *)buf - 7418c2ecf20Sopenharmony_ci offsetof(struct iwl_mvm_baid_data, reorder_buf) - 7428c2ecf20Sopenharmony_ci sizeof(*buf) * buf->queue); 7438c2ecf20Sopenharmony_ci} 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_ci/* 7468c2ecf20Sopenharmony_ci * enum iwl_mvm_queue_status - queue status 7478c2ecf20Sopenharmony_ci * @IWL_MVM_QUEUE_FREE: the queue is not allocated nor reserved 7488c2ecf20Sopenharmony_ci * Basically, this means that this queue can be used for any purpose 7498c2ecf20Sopenharmony_ci * @IWL_MVM_QUEUE_RESERVED: queue is reserved but not yet in use 7508c2ecf20Sopenharmony_ci * This is the state of a queue that has been dedicated for some RATID 7518c2ecf20Sopenharmony_ci * (agg'd or not), but that hasn't yet gone through the actual enablement 7528c2ecf20Sopenharmony_ci * of iwl_mvm_enable_txq(), and therefore no traffic can go through it yet. 7538c2ecf20Sopenharmony_ci * Note that in this state there is no requirement to already know what TID 7548c2ecf20Sopenharmony_ci * should be used with this queue, it is just marked as a queue that will 7558c2ecf20Sopenharmony_ci * be used, and shouldn't be allocated to anyone else. 7568c2ecf20Sopenharmony_ci * @IWL_MVM_QUEUE_READY: queue is ready to be used 7578c2ecf20Sopenharmony_ci * This is the state of a queue that has been fully configured (including 7588c2ecf20Sopenharmony_ci * SCD pointers, etc), has a specific RA/TID assigned to it, and can be 7598c2ecf20Sopenharmony_ci * used to send traffic. 7608c2ecf20Sopenharmony_ci * @IWL_MVM_QUEUE_SHARED: queue is shared, or in a process of becoming shared 7618c2ecf20Sopenharmony_ci * This is a state in which a single queue serves more than one TID, all of 7628c2ecf20Sopenharmony_ci * which are not aggregated. Note that the queue is only associated to one 7638c2ecf20Sopenharmony_ci * RA. 7648c2ecf20Sopenharmony_ci */ 7658c2ecf20Sopenharmony_cienum iwl_mvm_queue_status { 7668c2ecf20Sopenharmony_ci IWL_MVM_QUEUE_FREE, 7678c2ecf20Sopenharmony_ci IWL_MVM_QUEUE_RESERVED, 7688c2ecf20Sopenharmony_ci IWL_MVM_QUEUE_READY, 7698c2ecf20Sopenharmony_ci IWL_MVM_QUEUE_SHARED, 7708c2ecf20Sopenharmony_ci}; 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_ci#define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ) 7738c2ecf20Sopenharmony_ci#define IWL_MVM_INVALID_QUEUE 0xFFFF 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_ci#define IWL_MVM_NUM_CIPHERS 10 7768c2ecf20Sopenharmony_ci 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_cistruct iwl_mvm_txq { 7798c2ecf20Sopenharmony_ci struct list_head list; 7808c2ecf20Sopenharmony_ci u16 txq_id; 7818c2ecf20Sopenharmony_ci atomic_t tx_request; 7828c2ecf20Sopenharmony_ci bool stopped; 7838c2ecf20Sopenharmony_ci}; 7848c2ecf20Sopenharmony_ci 7858c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_txq * 7868c2ecf20Sopenharmony_ciiwl_mvm_txq_from_mac80211(struct ieee80211_txq *txq) 7878c2ecf20Sopenharmony_ci{ 7888c2ecf20Sopenharmony_ci return (void *)txq->drv_priv; 7898c2ecf20Sopenharmony_ci} 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_txq * 7928c2ecf20Sopenharmony_ciiwl_mvm_txq_from_tid(struct ieee80211_sta *sta, u8 tid) 7938c2ecf20Sopenharmony_ci{ 7948c2ecf20Sopenharmony_ci if (tid == IWL_MAX_TID_COUNT) 7958c2ecf20Sopenharmony_ci tid = IEEE80211_NUM_TIDS; 7968c2ecf20Sopenharmony_ci 7978c2ecf20Sopenharmony_ci return (void *)sta->txq[tid]->drv_priv; 7988c2ecf20Sopenharmony_ci} 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_ci/** 8018c2ecf20Sopenharmony_ci * struct iwl_mvm_tvqm_txq_info - maps TVQM hw queue to tid 8028c2ecf20Sopenharmony_ci * 8038c2ecf20Sopenharmony_ci * @sta_id: sta id 8048c2ecf20Sopenharmony_ci * @txq_tid: txq tid 8058c2ecf20Sopenharmony_ci */ 8068c2ecf20Sopenharmony_cistruct iwl_mvm_tvqm_txq_info { 8078c2ecf20Sopenharmony_ci u8 sta_id; 8088c2ecf20Sopenharmony_ci u8 txq_tid; 8098c2ecf20Sopenharmony_ci}; 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_cistruct iwl_mvm_dqa_txq_info { 8128c2ecf20Sopenharmony_ci u8 ra_sta_id; /* The RA this queue is mapped to, if exists */ 8138c2ecf20Sopenharmony_ci bool reserved; /* Is this the TXQ reserved for a STA */ 8148c2ecf20Sopenharmony_ci u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */ 8158c2ecf20Sopenharmony_ci u8 txq_tid; /* The TID "owner" of this queue*/ 8168c2ecf20Sopenharmony_ci u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */ 8178c2ecf20Sopenharmony_ci /* Timestamp for inactivation per TID of this queue */ 8188c2ecf20Sopenharmony_ci unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1]; 8198c2ecf20Sopenharmony_ci enum iwl_mvm_queue_status status; 8208c2ecf20Sopenharmony_ci}; 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_cistruct iwl_mvm { 8238c2ecf20Sopenharmony_ci /* for logger access */ 8248c2ecf20Sopenharmony_ci struct device *dev; 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_ci struct iwl_trans *trans; 8278c2ecf20Sopenharmony_ci const struct iwl_fw *fw; 8288c2ecf20Sopenharmony_ci const struct iwl_cfg *cfg; 8298c2ecf20Sopenharmony_ci struct iwl_phy_db *phy_db; 8308c2ecf20Sopenharmony_ci struct ieee80211_hw *hw; 8318c2ecf20Sopenharmony_ci 8328c2ecf20Sopenharmony_ci /* for protecting access to iwl_mvm */ 8338c2ecf20Sopenharmony_ci struct mutex mutex; 8348c2ecf20Sopenharmony_ci struct list_head async_handlers_list; 8358c2ecf20Sopenharmony_ci spinlock_t async_handlers_lock; 8368c2ecf20Sopenharmony_ci struct work_struct async_handlers_wk; 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_ci struct work_struct roc_done_wk; 8398c2ecf20Sopenharmony_ci 8408c2ecf20Sopenharmony_ci unsigned long init_status; 8418c2ecf20Sopenharmony_ci 8428c2ecf20Sopenharmony_ci unsigned long status; 8438c2ecf20Sopenharmony_ci 8448c2ecf20Sopenharmony_ci u32 queue_sync_cookie; 8458c2ecf20Sopenharmony_ci atomic_t queue_sync_counter; 8468c2ecf20Sopenharmony_ci /* 8478c2ecf20Sopenharmony_ci * for beacon filtering - 8488c2ecf20Sopenharmony_ci * currently only one interface can be supported 8498c2ecf20Sopenharmony_ci */ 8508c2ecf20Sopenharmony_ci struct iwl_mvm_vif *bf_allowed_vif; 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_ci bool hw_registered; 8538c2ecf20Sopenharmony_ci bool rfkill_safe_init_done; 8548c2ecf20Sopenharmony_ci 8558c2ecf20Sopenharmony_ci u32 ampdu_ref; 8568c2ecf20Sopenharmony_ci bool ampdu_toggle; 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci struct iwl_notif_wait_data notif_wait; 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ci union { 8618c2ecf20Sopenharmony_ci struct mvm_statistics_rx_v3 rx_stats_v3; 8628c2ecf20Sopenharmony_ci struct mvm_statistics_rx rx_stats; 8638c2ecf20Sopenharmony_ci }; 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci struct { 8668c2ecf20Sopenharmony_ci u64 rx_time; 8678c2ecf20Sopenharmony_ci u64 tx_time; 8688c2ecf20Sopenharmony_ci u64 on_time_rf; 8698c2ecf20Sopenharmony_ci u64 on_time_scan; 8708c2ecf20Sopenharmony_ci } radio_stats, accu_radio_stats; 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci struct list_head add_stream_txqs; 8738c2ecf20Sopenharmony_ci union { 8748c2ecf20Sopenharmony_ci struct iwl_mvm_dqa_txq_info queue_info[IWL_MAX_HW_QUEUES]; 8758c2ecf20Sopenharmony_ci struct iwl_mvm_tvqm_txq_info tvqm_info[IWL_MAX_TVQM_QUEUES]; 8768c2ecf20Sopenharmony_ci }; 8778c2ecf20Sopenharmony_ci struct work_struct add_stream_wk; /* To add streams to queues */ 8788c2ecf20Sopenharmony_ci 8798c2ecf20Sopenharmony_ci const char *nvm_file_name; 8808c2ecf20Sopenharmony_ci struct iwl_nvm_data *nvm_data; 8818c2ecf20Sopenharmony_ci /* NVM sections */ 8828c2ecf20Sopenharmony_ci struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS]; 8838c2ecf20Sopenharmony_ci 8848c2ecf20Sopenharmony_ci struct iwl_fw_runtime fwrt; 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_ci /* EEPROM MAC addresses */ 8878c2ecf20Sopenharmony_ci struct mac_address addresses[IWL_MVM_MAX_ADDRESSES]; 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci /* data related to data path */ 8908c2ecf20Sopenharmony_ci struct iwl_rx_phy_info last_phy_info; 8918c2ecf20Sopenharmony_ci struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT_MAX]; 8928c2ecf20Sopenharmony_ci u8 rx_ba_sessions; 8938c2ecf20Sopenharmony_ci 8948c2ecf20Sopenharmony_ci /* configured by mac80211 */ 8958c2ecf20Sopenharmony_ci u32 rts_threshold; 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ci /* Scan status, cmd (pre-allocated) and auxiliary station */ 8988c2ecf20Sopenharmony_ci unsigned int scan_status; 8998c2ecf20Sopenharmony_ci void *scan_cmd; 9008c2ecf20Sopenharmony_ci struct iwl_mcast_filter_cmd *mcast_filter_cmd; 9018c2ecf20Sopenharmony_ci /* For CDB this is low band scan type, for non-CDB - type. */ 9028c2ecf20Sopenharmony_ci enum iwl_mvm_scan_type scan_type; 9038c2ecf20Sopenharmony_ci enum iwl_mvm_scan_type hb_scan_type; 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all; 9068c2ecf20Sopenharmony_ci struct delayed_work scan_timeout_dwork; 9078c2ecf20Sopenharmony_ci 9088c2ecf20Sopenharmony_ci /* max number of simultaneous scans the FW supports */ 9098c2ecf20Sopenharmony_ci unsigned int max_scans; 9108c2ecf20Sopenharmony_ci 9118c2ecf20Sopenharmony_ci /* UMAC scan tracking */ 9128c2ecf20Sopenharmony_ci u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS]; 9138c2ecf20Sopenharmony_ci 9148c2ecf20Sopenharmony_ci /* start time of last scan in TSF of the mac that requested the scan */ 9158c2ecf20Sopenharmony_ci u64 scan_start; 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_ci /* the vif that requested the current scan */ 9188c2ecf20Sopenharmony_ci struct iwl_mvm_vif *scan_vif; 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_ci /* rx chain antennas set through debugfs for the scan command */ 9218c2ecf20Sopenharmony_ci u8 scan_rx_ant; 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_BCAST_FILTERING 9248c2ecf20Sopenharmony_ci /* broadcast filters to configure for each associated station */ 9258c2ecf20Sopenharmony_ci const struct iwl_fw_bcast_filter *bcast_filters; 9268c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 9278c2ecf20Sopenharmony_ci struct { 9288c2ecf20Sopenharmony_ci bool override; 9298c2ecf20Sopenharmony_ci struct iwl_bcast_filter_cmd cmd; 9308c2ecf20Sopenharmony_ci } dbgfs_bcast_filtering; 9318c2ecf20Sopenharmony_ci#endif 9328c2ecf20Sopenharmony_ci#endif 9338c2ecf20Sopenharmony_ci 9348c2ecf20Sopenharmony_ci /* Internal station */ 9358c2ecf20Sopenharmony_ci struct iwl_mvm_int_sta aux_sta; 9368c2ecf20Sopenharmony_ci struct iwl_mvm_int_sta snif_sta; 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci bool last_ebs_successful; 9398c2ecf20Sopenharmony_ci 9408c2ecf20Sopenharmony_ci u8 scan_last_antenna_idx; /* to toggle TX between antennas */ 9418c2ecf20Sopenharmony_ci u8 mgmt_last_antenna_idx; 9428c2ecf20Sopenharmony_ci 9438c2ecf20Sopenharmony_ci /* last smart fifo state that was successfully sent to firmware */ 9448c2ecf20Sopenharmony_ci enum iwl_sf_state sf_state; 9458c2ecf20Sopenharmony_ci 9468c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 9478c2ecf20Sopenharmony_ci struct dentry *debugfs_dir; 9488c2ecf20Sopenharmony_ci u32 dbgfs_sram_offset, dbgfs_sram_len; 9498c2ecf20Sopenharmony_ci u32 dbgfs_prph_reg_addr; 9508c2ecf20Sopenharmony_ci bool disable_power_off; 9518c2ecf20Sopenharmony_ci bool disable_power_off_d3; 9528c2ecf20Sopenharmony_ci bool beacon_inject_active; 9538c2ecf20Sopenharmony_ci 9548c2ecf20Sopenharmony_ci bool scan_iter_notif_enabled; 9558c2ecf20Sopenharmony_ci 9568c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_hw_blob; 9578c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_sw_blob; 9588c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_calib_blob; 9598c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_prod_blob; 9608c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_phy_sku_blob; 9618c2ecf20Sopenharmony_ci struct debugfs_blob_wrapper nvm_reg_blob; 9628c2ecf20Sopenharmony_ci 9638c2ecf20Sopenharmony_ci struct iwl_mvm_frame_stats drv_rx_stats; 9648c2ecf20Sopenharmony_ci spinlock_t drv_stats_lock; 9658c2ecf20Sopenharmony_ci u16 dbgfs_rx_phyinfo; 9668c2ecf20Sopenharmony_ci#endif 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX]; 9698c2ecf20Sopenharmony_ci 9708c2ecf20Sopenharmony_ci struct list_head time_event_list; 9718c2ecf20Sopenharmony_ci spinlock_t time_event_lock; 9728c2ecf20Sopenharmony_ci 9738c2ecf20Sopenharmony_ci /* 9748c2ecf20Sopenharmony_ci * A bitmap indicating the index of the key in use. The firmware 9758c2ecf20Sopenharmony_ci * can hold 16 keys at most. Reflect this fact. 9768c2ecf20Sopenharmony_ci */ 9778c2ecf20Sopenharmony_ci unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)]; 9788c2ecf20Sopenharmony_ci u8 fw_key_deleted[STA_KEY_MAX_NUM]; 9798c2ecf20Sopenharmony_ci 9808c2ecf20Sopenharmony_ci u8 vif_count; 9818c2ecf20Sopenharmony_ci struct ieee80211_vif __rcu *vif_id_to_mac[NUM_MAC_INDEX_DRIVER]; 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci /* -1 for always, 0 for never, >0 for that many times */ 9848c2ecf20Sopenharmony_ci s8 fw_restart; 9858c2ecf20Sopenharmony_ci u8 *error_recovery_buf; 9868c2ecf20Sopenharmony_ci 9878c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_LEDS 9888c2ecf20Sopenharmony_ci struct led_classdev led; 9898c2ecf20Sopenharmony_ci#endif 9908c2ecf20Sopenharmony_ci 9918c2ecf20Sopenharmony_ci struct ieee80211_vif *p2p_device_vif; 9928c2ecf20Sopenharmony_ci 9938c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 9948c2ecf20Sopenharmony_ci struct wiphy_wowlan_support wowlan; 9958c2ecf20Sopenharmony_ci int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen; 9968c2ecf20Sopenharmony_ci 9978c2ecf20Sopenharmony_ci /* sched scan settings for net detect */ 9988c2ecf20Sopenharmony_ci struct ieee80211_scan_ies nd_ies; 9998c2ecf20Sopenharmony_ci struct cfg80211_match_set *nd_match_sets; 10008c2ecf20Sopenharmony_ci int n_nd_match_sets; 10018c2ecf20Sopenharmony_ci struct ieee80211_channel **nd_channels; 10028c2ecf20Sopenharmony_ci int n_nd_channels; 10038c2ecf20Sopenharmony_ci bool net_detect; 10048c2ecf20Sopenharmony_ci u8 offload_tid; 10058c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 10068c2ecf20Sopenharmony_ci bool d3_wake_sysassert; 10078c2ecf20Sopenharmony_ci bool d3_test_active; 10088c2ecf20Sopenharmony_ci u32 d3_test_pme_ptr; 10098c2ecf20Sopenharmony_ci struct ieee80211_vif *keep_vif; 10108c2ecf20Sopenharmony_ci u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */ 10118c2ecf20Sopenharmony_ci#endif 10128c2ecf20Sopenharmony_ci#endif 10138c2ecf20Sopenharmony_ci 10148c2ecf20Sopenharmony_ci wait_queue_head_t rx_sync_waitq; 10158c2ecf20Sopenharmony_ci 10168c2ecf20Sopenharmony_ci /* BT-Coex */ 10178c2ecf20Sopenharmony_ci struct iwl_bt_coex_profile_notif last_bt_notif; 10188c2ecf20Sopenharmony_ci struct iwl_bt_coex_ci_cmd last_bt_ci_cmd; 10198c2ecf20Sopenharmony_ci 10208c2ecf20Sopenharmony_ci u8 bt_tx_prio; 10218c2ecf20Sopenharmony_ci enum iwl_bt_force_ant_mode bt_force_ant_mode; 10228c2ecf20Sopenharmony_ci 10238c2ecf20Sopenharmony_ci /* Aux ROC */ 10248c2ecf20Sopenharmony_ci struct list_head aux_roc_te_list; 10258c2ecf20Sopenharmony_ci 10268c2ecf20Sopenharmony_ci /* Thermal Throttling and CTkill */ 10278c2ecf20Sopenharmony_ci struct iwl_mvm_tt_mgmt thermal_throttle; 10288c2ecf20Sopenharmony_ci#ifdef CONFIG_THERMAL 10298c2ecf20Sopenharmony_ci struct iwl_mvm_thermal_device tz_device; 10308c2ecf20Sopenharmony_ci struct iwl_mvm_cooling_device cooling_dev; 10318c2ecf20Sopenharmony_ci#endif 10328c2ecf20Sopenharmony_ci 10338c2ecf20Sopenharmony_ci s32 temperature; /* Celsius */ 10348c2ecf20Sopenharmony_ci /* 10358c2ecf20Sopenharmony_ci * Debug option to set the NIC temperature. This option makes the 10368c2ecf20Sopenharmony_ci * driver think this is the actual NIC temperature, and ignore the 10378c2ecf20Sopenharmony_ci * real temperature that is received from the fw 10388c2ecf20Sopenharmony_ci */ 10398c2ecf20Sopenharmony_ci bool temperature_test; /* Debug test temperature is enabled */ 10408c2ecf20Sopenharmony_ci 10418c2ecf20Sopenharmony_ci unsigned long bt_coex_last_tcm_ts; 10428c2ecf20Sopenharmony_ci struct iwl_mvm_tcm tcm; 10438c2ecf20Sopenharmony_ci 10448c2ecf20Sopenharmony_ci u8 uapsd_noagg_bssid_write_idx; 10458c2ecf20Sopenharmony_ci struct mac_address uapsd_noagg_bssids[IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM] 10468c2ecf20Sopenharmony_ci __aligned(2); 10478c2ecf20Sopenharmony_ci 10488c2ecf20Sopenharmony_ci struct iwl_time_quota_cmd last_quota_cmd; 10498c2ecf20Sopenharmony_ci 10508c2ecf20Sopenharmony_ci#ifdef CONFIG_NL80211_TESTMODE 10518c2ecf20Sopenharmony_ci u32 noa_duration; 10528c2ecf20Sopenharmony_ci struct ieee80211_vif *noa_vif; 10538c2ecf20Sopenharmony_ci#endif 10548c2ecf20Sopenharmony_ci 10558c2ecf20Sopenharmony_ci /* Tx queues */ 10568c2ecf20Sopenharmony_ci u16 aux_queue; 10578c2ecf20Sopenharmony_ci u16 snif_queue; 10588c2ecf20Sopenharmony_ci u16 probe_queue; 10598c2ecf20Sopenharmony_ci u16 p2p_dev_queue; 10608c2ecf20Sopenharmony_ci 10618c2ecf20Sopenharmony_ci /* Indicate if device power save is allowed */ 10628c2ecf20Sopenharmony_ci u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */ 10638c2ecf20Sopenharmony_ci /* Indicate if 32Khz external clock is valid */ 10648c2ecf20Sopenharmony_ci u32 ext_clock_valid; 10658c2ecf20Sopenharmony_ci 10668c2ecf20Sopenharmony_ci struct ieee80211_vif __rcu *csa_vif; 10678c2ecf20Sopenharmony_ci struct ieee80211_vif __rcu *csa_tx_blocked_vif; 10688c2ecf20Sopenharmony_ci u8 csa_tx_block_bcn_timeout; 10698c2ecf20Sopenharmony_ci 10708c2ecf20Sopenharmony_ci /* system time of last beacon (for AP/GO interface) */ 10718c2ecf20Sopenharmony_ci u32 ap_last_beacon_gp2; 10728c2ecf20Sopenharmony_ci 10738c2ecf20Sopenharmony_ci /* indicates that we transmitted the last beacon */ 10748c2ecf20Sopenharmony_ci bool ibss_manager; 10758c2ecf20Sopenharmony_ci 10768c2ecf20Sopenharmony_ci bool lar_regdom_set; 10778c2ecf20Sopenharmony_ci enum iwl_mcc_source mcc_src; 10788c2ecf20Sopenharmony_ci 10798c2ecf20Sopenharmony_ci /* TDLS channel switch data */ 10808c2ecf20Sopenharmony_ci struct { 10818c2ecf20Sopenharmony_ci struct delayed_work dwork; 10828c2ecf20Sopenharmony_ci enum iwl_mvm_tdls_cs_state state; 10838c2ecf20Sopenharmony_ci 10848c2ecf20Sopenharmony_ci /* 10858c2ecf20Sopenharmony_ci * Current cs sta - might be different from periodic cs peer 10868c2ecf20Sopenharmony_ci * station. Value is meaningless when the cs-state is idle. 10878c2ecf20Sopenharmony_ci */ 10888c2ecf20Sopenharmony_ci u8 cur_sta_id; 10898c2ecf20Sopenharmony_ci 10908c2ecf20Sopenharmony_ci /* TDLS periodic channel-switch peer */ 10918c2ecf20Sopenharmony_ci struct { 10928c2ecf20Sopenharmony_ci u8 sta_id; 10938c2ecf20Sopenharmony_ci u8 op_class; 10948c2ecf20Sopenharmony_ci bool initiator; /* are we the link initiator */ 10958c2ecf20Sopenharmony_ci struct cfg80211_chan_def chandef; 10968c2ecf20Sopenharmony_ci struct sk_buff *skb; /* ch sw template */ 10978c2ecf20Sopenharmony_ci u32 ch_sw_tm_ie; 10988c2ecf20Sopenharmony_ci 10998c2ecf20Sopenharmony_ci /* timestamp of last ch-sw request sent (GP2 time) */ 11008c2ecf20Sopenharmony_ci u32 sent_timestamp; 11018c2ecf20Sopenharmony_ci } peer; 11028c2ecf20Sopenharmony_ci } tdls_cs; 11038c2ecf20Sopenharmony_ci 11048c2ecf20Sopenharmony_ci 11058c2ecf20Sopenharmony_ci u32 ciphers[IWL_MVM_NUM_CIPHERS]; 11068c2ecf20Sopenharmony_ci struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; 11078c2ecf20Sopenharmony_ci 11088c2ecf20Sopenharmony_ci struct cfg80211_ftm_responder_stats ftm_resp_stats; 11098c2ecf20Sopenharmony_ci struct { 11108c2ecf20Sopenharmony_ci struct cfg80211_pmsr_request *req; 11118c2ecf20Sopenharmony_ci struct wireless_dev *req_wdev; 11128c2ecf20Sopenharmony_ci struct list_head loc_list; 11138c2ecf20Sopenharmony_ci int responses[IWL_MVM_TOF_MAX_APS]; 11148c2ecf20Sopenharmony_ci struct { 11158c2ecf20Sopenharmony_ci struct list_head resp; 11168c2ecf20Sopenharmony_ci } smooth; 11178c2ecf20Sopenharmony_ci struct list_head pasn_list; 11188c2ecf20Sopenharmony_ci } ftm_initiator; 11198c2ecf20Sopenharmony_ci 11208c2ecf20Sopenharmony_ci struct list_head resp_pasn_list; 11218c2ecf20Sopenharmony_ci 11228c2ecf20Sopenharmony_ci struct { 11238c2ecf20Sopenharmony_ci u8 d0i3_resp; 11248c2ecf20Sopenharmony_ci u8 range_resp; 11258c2ecf20Sopenharmony_ci } cmd_ver; 11268c2ecf20Sopenharmony_ci 11278c2ecf20Sopenharmony_ci struct ieee80211_vif *nan_vif; 11288c2ecf20Sopenharmony_ci#define IWL_MAX_BAID 32 11298c2ecf20Sopenharmony_ci struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID]; 11308c2ecf20Sopenharmony_ci 11318c2ecf20Sopenharmony_ci /* 11328c2ecf20Sopenharmony_ci * Drop beacons from other APs in AP mode when there are no connected 11338c2ecf20Sopenharmony_ci * clients. 11348c2ecf20Sopenharmony_ci */ 11358c2ecf20Sopenharmony_ci bool drop_bcn_ap_mode; 11368c2ecf20Sopenharmony_ci 11378c2ecf20Sopenharmony_ci struct delayed_work cs_tx_unblock_dwork; 11388c2ecf20Sopenharmony_ci 11398c2ecf20Sopenharmony_ci /* does a monitor vif exist (only one can exist hence bool) */ 11408c2ecf20Sopenharmony_ci bool monitor_on; 11418c2ecf20Sopenharmony_ci 11428c2ecf20Sopenharmony_ci /* sniffer data to include in radiotap */ 11438c2ecf20Sopenharmony_ci __le16 cur_aid; 11448c2ecf20Sopenharmony_ci u8 cur_bssid[ETH_ALEN]; 11458c2ecf20Sopenharmony_ci}; 11468c2ecf20Sopenharmony_ci 11478c2ecf20Sopenharmony_ci/* Extract MVM priv from op_mode and _hw */ 11488c2ecf20Sopenharmony_ci#define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \ 11498c2ecf20Sopenharmony_ci ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific) 11508c2ecf20Sopenharmony_ci 11518c2ecf20Sopenharmony_ci#define IWL_MAC80211_GET_MVM(_hw) \ 11528c2ecf20Sopenharmony_ci IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv)) 11538c2ecf20Sopenharmony_ci 11548c2ecf20Sopenharmony_ci/** 11558c2ecf20Sopenharmony_ci * enum iwl_mvm_status - MVM status bits 11568c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_HW_RFKILL: HW RF-kill is asserted 11578c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_HW_CTKILL: CT-kill is active 11588c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_ROC_RUNNING: remain-on-channel is running 11598c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested 11608c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active 11618c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running 11628c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running 11638c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_NEED_FLUSH_P2P: need to flush P2P bcast STA 11648c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_IN_D3: in D3 (or at least about to go into it) 11658c2ecf20Sopenharmony_ci * @IWL_MVM_STATUS_STARTING: starting mac, 11668c2ecf20Sopenharmony_ci * used to disable restart flow while in STARTING state 11678c2ecf20Sopenharmony_ci */ 11688c2ecf20Sopenharmony_cienum iwl_mvm_status { 11698c2ecf20Sopenharmony_ci IWL_MVM_STATUS_HW_RFKILL, 11708c2ecf20Sopenharmony_ci IWL_MVM_STATUS_HW_CTKILL, 11718c2ecf20Sopenharmony_ci IWL_MVM_STATUS_ROC_RUNNING, 11728c2ecf20Sopenharmony_ci IWL_MVM_STATUS_HW_RESTART_REQUESTED, 11738c2ecf20Sopenharmony_ci IWL_MVM_STATUS_IN_HW_RESTART, 11748c2ecf20Sopenharmony_ci IWL_MVM_STATUS_ROC_AUX_RUNNING, 11758c2ecf20Sopenharmony_ci IWL_MVM_STATUS_FIRMWARE_RUNNING, 11768c2ecf20Sopenharmony_ci IWL_MVM_STATUS_NEED_FLUSH_P2P, 11778c2ecf20Sopenharmony_ci IWL_MVM_STATUS_IN_D3, 11788c2ecf20Sopenharmony_ci IWL_MVM_STATUS_STARTING, 11798c2ecf20Sopenharmony_ci}; 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_ci/* Keep track of completed init configuration */ 11828c2ecf20Sopenharmony_cienum iwl_mvm_init_status { 11838c2ecf20Sopenharmony_ci IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0), 11848c2ecf20Sopenharmony_ci IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1), 11858c2ecf20Sopenharmony_ci}; 11868c2ecf20Sopenharmony_ci 11878c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm) 11888c2ecf20Sopenharmony_ci{ 11898c2ecf20Sopenharmony_ci return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) || 11908c2ecf20Sopenharmony_ci test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); 11918c2ecf20Sopenharmony_ci} 11928c2ecf20Sopenharmony_ci 11938c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm) 11948c2ecf20Sopenharmony_ci{ 11958c2ecf20Sopenharmony_ci return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); 11968c2ecf20Sopenharmony_ci} 11978c2ecf20Sopenharmony_ci 11988c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_firmware_running(struct iwl_mvm *mvm) 11998c2ecf20Sopenharmony_ci{ 12008c2ecf20Sopenharmony_ci return test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); 12018c2ecf20Sopenharmony_ci} 12028c2ecf20Sopenharmony_ci 12038c2ecf20Sopenharmony_ci/* Must be called with rcu_read_lock() held and it can only be 12048c2ecf20Sopenharmony_ci * released when mvmsta is not needed anymore. 12058c2ecf20Sopenharmony_ci */ 12068c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_sta * 12078c2ecf20Sopenharmony_ciiwl_mvm_sta_from_staid_rcu(struct iwl_mvm *mvm, u8 sta_id) 12088c2ecf20Sopenharmony_ci{ 12098c2ecf20Sopenharmony_ci struct ieee80211_sta *sta; 12108c2ecf20Sopenharmony_ci 12118c2ecf20Sopenharmony_ci if (sta_id >= mvm->fw->ucode_capa.num_stations) 12128c2ecf20Sopenharmony_ci return NULL; 12138c2ecf20Sopenharmony_ci 12148c2ecf20Sopenharmony_ci sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 12158c2ecf20Sopenharmony_ci 12168c2ecf20Sopenharmony_ci /* This can happen if the station has been removed right now */ 12178c2ecf20Sopenharmony_ci if (IS_ERR_OR_NULL(sta)) 12188c2ecf20Sopenharmony_ci return NULL; 12198c2ecf20Sopenharmony_ci 12208c2ecf20Sopenharmony_ci return iwl_mvm_sta_from_mac80211(sta); 12218c2ecf20Sopenharmony_ci} 12228c2ecf20Sopenharmony_ci 12238c2ecf20Sopenharmony_cistatic inline struct iwl_mvm_sta * 12248c2ecf20Sopenharmony_ciiwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id) 12258c2ecf20Sopenharmony_ci{ 12268c2ecf20Sopenharmony_ci struct ieee80211_sta *sta; 12278c2ecf20Sopenharmony_ci 12288c2ecf20Sopenharmony_ci if (sta_id >= mvm->fw->ucode_capa.num_stations) 12298c2ecf20Sopenharmony_ci return NULL; 12308c2ecf20Sopenharmony_ci 12318c2ecf20Sopenharmony_ci sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], 12328c2ecf20Sopenharmony_ci lockdep_is_held(&mvm->mutex)); 12338c2ecf20Sopenharmony_ci 12348c2ecf20Sopenharmony_ci /* This can happen if the station has been removed right now */ 12358c2ecf20Sopenharmony_ci if (IS_ERR_OR_NULL(sta)) 12368c2ecf20Sopenharmony_ci return NULL; 12378c2ecf20Sopenharmony_ci 12388c2ecf20Sopenharmony_ci return iwl_mvm_sta_from_mac80211(sta); 12398c2ecf20Sopenharmony_ci} 12408c2ecf20Sopenharmony_ci 12418c2ecf20Sopenharmony_cistatic inline struct ieee80211_vif * 12428c2ecf20Sopenharmony_ciiwl_mvm_rcu_dereference_vif_id(struct iwl_mvm *mvm, u8 vif_id, bool rcu) 12438c2ecf20Sopenharmony_ci{ 12448c2ecf20Sopenharmony_ci if (WARN_ON(vif_id >= ARRAY_SIZE(mvm->vif_id_to_mac))) 12458c2ecf20Sopenharmony_ci return NULL; 12468c2ecf20Sopenharmony_ci 12478c2ecf20Sopenharmony_ci if (rcu) 12488c2ecf20Sopenharmony_ci return rcu_dereference(mvm->vif_id_to_mac[vif_id]); 12498c2ecf20Sopenharmony_ci 12508c2ecf20Sopenharmony_ci return rcu_dereference_protected(mvm->vif_id_to_mac[vif_id], 12518c2ecf20Sopenharmony_ci lockdep_is_held(&mvm->mutex)); 12528c2ecf20Sopenharmony_ci} 12538c2ecf20Sopenharmony_ci 12548c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm) 12558c2ecf20Sopenharmony_ci{ 12568c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 12578c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_ADAPTIVE_DWELL); 12588c2ecf20Sopenharmony_ci} 12598c2ecf20Sopenharmony_ci 12608c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_adaptive_dwell_v2_supported(struct iwl_mvm *mvm) 12618c2ecf20Sopenharmony_ci{ 12628c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 12638c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2); 12648c2ecf20Sopenharmony_ci} 12658c2ecf20Sopenharmony_ci 12668c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_adwell_hb_ap_num_supported(struct iwl_mvm *mvm) 12678c2ecf20Sopenharmony_ci{ 12688c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 12698c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP); 12708c2ecf20Sopenharmony_ci} 12718c2ecf20Sopenharmony_ci 12728c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm) 12738c2ecf20Sopenharmony_ci{ 12748c2ecf20Sopenharmony_ci /* OCE should never be enabled for LMAC scan FWs */ 12758c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE); 12768c2ecf20Sopenharmony_ci} 12778c2ecf20Sopenharmony_ci 12788c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm) 12798c2ecf20Sopenharmony_ci{ 12808c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS); 12818c2ecf20Sopenharmony_ci} 12828c2ecf20Sopenharmony_ci 12838c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm) 12848c2ecf20Sopenharmony_ci{ 12858c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 12868c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF); 12878c2ecf20Sopenharmony_ci} 12888c2ecf20Sopenharmony_ci 12898c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue) 12908c2ecf20Sopenharmony_ci{ 12918c2ecf20Sopenharmony_ci return (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE) && 12928c2ecf20Sopenharmony_ci (queue <= IWL_MVM_DQA_MAX_DATA_QUEUE); 12938c2ecf20Sopenharmony_ci} 12948c2ecf20Sopenharmony_ci 12958c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_dqa_mgmt_queue(struct iwl_mvm *mvm, u8 queue) 12968c2ecf20Sopenharmony_ci{ 12978c2ecf20Sopenharmony_ci return (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) && 12988c2ecf20Sopenharmony_ci (queue <= IWL_MVM_DQA_MAX_MGMT_QUEUE); 12998c2ecf20Sopenharmony_ci} 13008c2ecf20Sopenharmony_ci 13018c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm) 13028c2ecf20Sopenharmony_ci{ 13038c2ecf20Sopenharmony_ci bool nvm_lar = mvm->nvm_data->lar_enabled; 13048c2ecf20Sopenharmony_ci bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa, 13058c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_LAR_SUPPORT); 13068c2ecf20Sopenharmony_ci 13078c2ecf20Sopenharmony_ci /* 13088c2ecf20Sopenharmony_ci * Enable LAR only if it is supported by the FW (TLV) && 13098c2ecf20Sopenharmony_ci * enabled in the NVM 13108c2ecf20Sopenharmony_ci */ 13118c2ecf20Sopenharmony_ci if (mvm->cfg->nvm_type == IWL_NVM_EXT) 13128c2ecf20Sopenharmony_ci return nvm_lar && tlv_lar; 13138c2ecf20Sopenharmony_ci else 13148c2ecf20Sopenharmony_ci return tlv_lar; 13158c2ecf20Sopenharmony_ci} 13168c2ecf20Sopenharmony_ci 13178c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm) 13188c2ecf20Sopenharmony_ci{ 13198c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 13208c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) || 13218c2ecf20Sopenharmony_ci fw_has_capa(&mvm->fw->ucode_capa, 13228c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC); 13238c2ecf20Sopenharmony_ci} 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm) 13268c2ecf20Sopenharmony_ci{ 13278c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13288c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_BT_COEX_RRC) && 13298c2ecf20Sopenharmony_ci IWL_MVM_BT_COEX_RRC; 13308c2ecf20Sopenharmony_ci} 13318c2ecf20Sopenharmony_ci 13328c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_csum_supported(struct iwl_mvm *mvm) 13338c2ecf20Sopenharmony_ci{ 13348c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13358c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_CSUM_SUPPORT) && 13368c2ecf20Sopenharmony_ci !IWL_MVM_HW_CSUM_DISABLE; 13378c2ecf20Sopenharmony_ci} 13388c2ecf20Sopenharmony_ci 13398c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm) 13408c2ecf20Sopenharmony_ci{ 13418c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13428c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT) && 13438c2ecf20Sopenharmony_ci IWL_MVM_BT_COEX_MPLUT; 13448c2ecf20Sopenharmony_ci} 13458c2ecf20Sopenharmony_ci 13468c2ecf20Sopenharmony_cistatic inline 13478c2ecf20Sopenharmony_cibool iwl_mvm_is_p2p_scm_uapsd_supported(struct iwl_mvm *mvm) 13488c2ecf20Sopenharmony_ci{ 13498c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13508c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD) && 13518c2ecf20Sopenharmony_ci !(iwlwifi_mod_params.uapsd_disable & 13528c2ecf20Sopenharmony_ci IWL_DISABLE_UAPSD_P2P_CLIENT); 13538c2ecf20Sopenharmony_ci} 13548c2ecf20Sopenharmony_ci 13558c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm) 13568c2ecf20Sopenharmony_ci{ 13578c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13588c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT); 13598c2ecf20Sopenharmony_ci} 13608c2ecf20Sopenharmony_ci 13618c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm) 13628c2ecf20Sopenharmony_ci{ 13638c2ecf20Sopenharmony_ci /* TODO - replace with TLV once defined */ 13648c2ecf20Sopenharmony_ci return mvm->trans->trans_cfg->use_tfh; 13658c2ecf20Sopenharmony_ci} 13668c2ecf20Sopenharmony_ci 13678c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm) 13688c2ecf20Sopenharmony_ci{ 13698c2ecf20Sopenharmony_ci /* TODO - better define this */ 13708c2ecf20Sopenharmony_ci return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; 13718c2ecf20Sopenharmony_ci} 13728c2ecf20Sopenharmony_ci 13738c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm) 13748c2ecf20Sopenharmony_ci{ 13758c2ecf20Sopenharmony_ci /* 13768c2ecf20Sopenharmony_ci * TODO: 13778c2ecf20Sopenharmony_ci * The issue of how to determine CDB APIs and usage is still not fully 13788c2ecf20Sopenharmony_ci * defined. 13798c2ecf20Sopenharmony_ci * There is a compilation for CDB and non-CDB FW, but there may 13808c2ecf20Sopenharmony_ci * be also runtime check. 13818c2ecf20Sopenharmony_ci * For now there is a TLV for checking compilation mode, but a 13828c2ecf20Sopenharmony_ci * runtime check will also have to be here - once defined. 13838c2ecf20Sopenharmony_ci */ 13848c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 13858c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_CDB_SUPPORT); 13868c2ecf20Sopenharmony_ci} 13878c2ecf20Sopenharmony_ci 13888c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_cdb_scan_api(struct iwl_mvm *mvm) 13898c2ecf20Sopenharmony_ci{ 13908c2ecf20Sopenharmony_ci /* 13918c2ecf20Sopenharmony_ci * TODO: should this be the same as iwl_mvm_is_cdb_supported()? 13928c2ecf20Sopenharmony_ci * but then there's a little bit of code in scan that won't make 13938c2ecf20Sopenharmony_ci * any sense... 13948c2ecf20Sopenharmony_ci */ 13958c2ecf20Sopenharmony_ci return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000; 13968c2ecf20Sopenharmony_ci} 13978c2ecf20Sopenharmony_ci 13988c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm) 13998c2ecf20Sopenharmony_ci{ 14008c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 14018c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER); 14028c2ecf20Sopenharmony_ci} 14038c2ecf20Sopenharmony_ci 14048c2ecf20Sopenharmony_ci 14058c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm) 14068c2ecf20Sopenharmony_ci{ 14078c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 14088c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG); 14098c2ecf20Sopenharmony_ci} 14108c2ecf20Sopenharmony_ci 14118c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_band_in_rx_supported(struct iwl_mvm *mvm) 14128c2ecf20Sopenharmony_ci{ 14138c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 14148c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_BAND_IN_RX_DATA); 14158c2ecf20Sopenharmony_ci} 14168c2ecf20Sopenharmony_ci 14178c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm) 14188c2ecf20Sopenharmony_ci{ 14198c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 14208c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_NEW_RX_STATS); 14218c2ecf20Sopenharmony_ci} 14228c2ecf20Sopenharmony_ci 14238c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_quota_low_latency(struct iwl_mvm *mvm) 14248c2ecf20Sopenharmony_ci{ 14258c2ecf20Sopenharmony_ci return fw_has_api(&mvm->fw->ucode_capa, 14268c2ecf20Sopenharmony_ci IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY); 14278c2ecf20Sopenharmony_ci} 14288c2ecf20Sopenharmony_ci 14298c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_tlc_offload(const struct iwl_mvm *mvm) 14308c2ecf20Sopenharmony_ci{ 14318c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 14328c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_TLC_OFFLOAD); 14338c2ecf20Sopenharmony_ci} 14348c2ecf20Sopenharmony_ci 14358c2ecf20Sopenharmony_cistatic inline struct agg_tx_status * 14368c2ecf20Sopenharmony_ciiwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp) 14378c2ecf20Sopenharmony_ci{ 14388c2ecf20Sopenharmony_ci if (iwl_mvm_has_new_tx_api(mvm)) 14398c2ecf20Sopenharmony_ci return &((struct iwl_mvm_tx_resp *)tx_resp)->status; 14408c2ecf20Sopenharmony_ci else 14418c2ecf20Sopenharmony_ci return ((struct iwl_mvm_tx_resp_v3 *)tx_resp)->status; 14428c2ecf20Sopenharmony_ci} 14438c2ecf20Sopenharmony_ci 14448c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm) 14458c2ecf20Sopenharmony_ci{ 14468c2ecf20Sopenharmony_ci /* these two TLV are redundant since the responsibility to CT-kill by 14478c2ecf20Sopenharmony_ci * FW happens only after we send at least one command of 14488c2ecf20Sopenharmony_ci * temperature THs report. 14498c2ecf20Sopenharmony_ci */ 14508c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 14518c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) && 14528c2ecf20Sopenharmony_ci fw_has_capa(&mvm->fw->ucode_capa, 14538c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT); 14548c2ecf20Sopenharmony_ci} 14558c2ecf20Sopenharmony_ci 14568c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm) 14578c2ecf20Sopenharmony_ci{ 14588c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 14598c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_CTDP_SUPPORT); 14608c2ecf20Sopenharmony_ci} 14618c2ecf20Sopenharmony_ci 14628c2ecf20Sopenharmony_ciextern const u8 iwl_mvm_ac_to_tx_fifo[]; 14638c2ecf20Sopenharmony_ciextern const u8 iwl_mvm_ac_to_gen2_tx_fifo[]; 14648c2ecf20Sopenharmony_ci 14658c2ecf20Sopenharmony_cistatic inline u8 iwl_mvm_mac_ac_to_tx_fifo(struct iwl_mvm *mvm, 14668c2ecf20Sopenharmony_ci enum ieee80211_ac_numbers ac) 14678c2ecf20Sopenharmony_ci{ 14688c2ecf20Sopenharmony_ci return iwl_mvm_has_new_tx_api(mvm) ? 14698c2ecf20Sopenharmony_ci iwl_mvm_ac_to_gen2_tx_fifo[ac] : iwl_mvm_ac_to_tx_fifo[ac]; 14708c2ecf20Sopenharmony_ci} 14718c2ecf20Sopenharmony_ci 14728c2ecf20Sopenharmony_cistruct iwl_rate_info { 14738c2ecf20Sopenharmony_ci u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ 14748c2ecf20Sopenharmony_ci u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ 14758c2ecf20Sopenharmony_ci u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ 14768c2ecf20Sopenharmony_ci u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ 14778c2ecf20Sopenharmony_ci u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ 14788c2ecf20Sopenharmony_ci}; 14798c2ecf20Sopenharmony_ci 14808c2ecf20Sopenharmony_civoid __iwl_mvm_mac_stop(struct iwl_mvm *mvm); 14818c2ecf20Sopenharmony_ciint __iwl_mvm_mac_start(struct iwl_mvm *mvm); 14828c2ecf20Sopenharmony_ci 14838c2ecf20Sopenharmony_ci/****************** 14848c2ecf20Sopenharmony_ci * MVM Methods 14858c2ecf20Sopenharmony_ci ******************/ 14868c2ecf20Sopenharmony_ci/* uCode */ 14878c2ecf20Sopenharmony_ciint iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm); 14888c2ecf20Sopenharmony_ci 14898c2ecf20Sopenharmony_ci/* Utils */ 14908c2ecf20Sopenharmony_ciint iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags, 14918c2ecf20Sopenharmony_ci enum nl80211_band band); 14928c2ecf20Sopenharmony_civoid iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags, 14938c2ecf20Sopenharmony_ci enum nl80211_band band, 14948c2ecf20Sopenharmony_ci struct ieee80211_tx_rate *r); 14958c2ecf20Sopenharmony_ciu8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx); 14968c2ecf20Sopenharmony_ciu8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac); 14978c2ecf20Sopenharmony_civoid iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm); 14988c2ecf20Sopenharmony_ciu8 first_antenna(u8 mask); 14998c2ecf20Sopenharmony_ciu8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); 15008c2ecf20Sopenharmony_civoid iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime); 15018c2ecf20Sopenharmony_ciu32 iwl_mvm_get_systime(struct iwl_mvm *mvm); 15028c2ecf20Sopenharmony_ci 15038c2ecf20Sopenharmony_ci/* Tx / Host Commands */ 15048c2ecf20Sopenharmony_ciint __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm, 15058c2ecf20Sopenharmony_ci struct iwl_host_cmd *cmd); 15068c2ecf20Sopenharmony_ciint __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id, 15078c2ecf20Sopenharmony_ci u32 flags, u16 len, const void *data); 15088c2ecf20Sopenharmony_ciint __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, 15098c2ecf20Sopenharmony_ci struct iwl_host_cmd *cmd, 15108c2ecf20Sopenharmony_ci u32 *status); 15118c2ecf20Sopenharmony_ciint __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, 15128c2ecf20Sopenharmony_ci u16 len, const void *data, 15138c2ecf20Sopenharmony_ci u32 *status); 15148c2ecf20Sopenharmony_ciint iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, 15158c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 15168c2ecf20Sopenharmony_ciint iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb); 15178c2ecf20Sopenharmony_civoid iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, 15188c2ecf20Sopenharmony_ci struct iwl_tx_cmd *tx_cmd, 15198c2ecf20Sopenharmony_ci struct ieee80211_tx_info *info, u8 sta_id); 15208c2ecf20Sopenharmony_civoid iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd, 15218c2ecf20Sopenharmony_ci struct ieee80211_tx_info *info, 15228c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, __le16 fc); 15238c2ecf20Sopenharmony_civoid iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq); 15248c2ecf20Sopenharmony_ciunsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm, 15258c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 15268c2ecf20Sopenharmony_ci unsigned int tid); 15278c2ecf20Sopenharmony_ci 15288c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUG 15298c2ecf20Sopenharmony_ciconst char *iwl_mvm_get_tx_fail_reason(u32 status); 15308c2ecf20Sopenharmony_ci#else 15318c2ecf20Sopenharmony_cistatic inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; } 15328c2ecf20Sopenharmony_ci#endif 15338c2ecf20Sopenharmony_ciint iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags); 15348c2ecf20Sopenharmony_ciint iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal); 15358c2ecf20Sopenharmony_ciint iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id, 15368c2ecf20Sopenharmony_ci u16 tids, u32 flags); 15378c2ecf20Sopenharmony_ci 15388c2ecf20Sopenharmony_civoid iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm); 15398c2ecf20Sopenharmony_ci 15408c2ecf20Sopenharmony_cistatic inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info, 15418c2ecf20Sopenharmony_ci struct iwl_tx_cmd *tx_cmd) 15428c2ecf20Sopenharmony_ci{ 15438c2ecf20Sopenharmony_ci struct ieee80211_key_conf *keyconf = info->control.hw_key; 15448c2ecf20Sopenharmony_ci 15458c2ecf20Sopenharmony_ci tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 15468c2ecf20Sopenharmony_ci memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); 15478c2ecf20Sopenharmony_ci} 15488c2ecf20Sopenharmony_ci 15498c2ecf20Sopenharmony_cistatic inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm) 15508c2ecf20Sopenharmony_ci{ 15518c2ecf20Sopenharmony_ci flush_work(&mvm->async_handlers_wk); 15528c2ecf20Sopenharmony_ci} 15538c2ecf20Sopenharmony_ci 15548c2ecf20Sopenharmony_ci/* Statistics */ 15558c2ecf20Sopenharmony_civoid iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, 15568c2ecf20Sopenharmony_ci struct iwl_rx_packet *pkt); 15578c2ecf20Sopenharmony_civoid iwl_mvm_rx_statistics(struct iwl_mvm *mvm, 15588c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 15598c2ecf20Sopenharmony_ciint iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear); 15608c2ecf20Sopenharmony_civoid iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm); 15618c2ecf20Sopenharmony_ci 15628c2ecf20Sopenharmony_ci/* NVM */ 15638c2ecf20Sopenharmony_ciint iwl_nvm_init(struct iwl_mvm *mvm); 15648c2ecf20Sopenharmony_ciint iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm); 15658c2ecf20Sopenharmony_ci 15668c2ecf20Sopenharmony_cistatic inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm) 15678c2ecf20Sopenharmony_ci{ 15688c2ecf20Sopenharmony_ci return mvm->nvm_data && mvm->nvm_data->valid_tx_ant ? 15698c2ecf20Sopenharmony_ci mvm->fw->valid_tx_ant & mvm->nvm_data->valid_tx_ant : 15708c2ecf20Sopenharmony_ci mvm->fw->valid_tx_ant; 15718c2ecf20Sopenharmony_ci} 15728c2ecf20Sopenharmony_ci 15738c2ecf20Sopenharmony_cistatic inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm) 15748c2ecf20Sopenharmony_ci{ 15758c2ecf20Sopenharmony_ci return mvm->nvm_data && mvm->nvm_data->valid_rx_ant ? 15768c2ecf20Sopenharmony_ci mvm->fw->valid_rx_ant & mvm->nvm_data->valid_rx_ant : 15778c2ecf20Sopenharmony_ci mvm->fw->valid_rx_ant; 15788c2ecf20Sopenharmony_ci} 15798c2ecf20Sopenharmony_ci 15808c2ecf20Sopenharmony_cistatic inline void iwl_mvm_toggle_tx_ant(struct iwl_mvm *mvm, u8 *ant) 15818c2ecf20Sopenharmony_ci{ 15828c2ecf20Sopenharmony_ci *ant = iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm), *ant); 15838c2ecf20Sopenharmony_ci} 15848c2ecf20Sopenharmony_ci 15858c2ecf20Sopenharmony_cistatic inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm) 15868c2ecf20Sopenharmony_ci{ 15878c2ecf20Sopenharmony_ci u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN | 15888c2ecf20Sopenharmony_ci FW_PHY_CFG_RX_CHAIN); 15898c2ecf20Sopenharmony_ci u32 valid_rx_ant = iwl_mvm_get_valid_rx_ant(mvm); 15908c2ecf20Sopenharmony_ci u32 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm); 15918c2ecf20Sopenharmony_ci 15928c2ecf20Sopenharmony_ci phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS | 15938c2ecf20Sopenharmony_ci valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS; 15948c2ecf20Sopenharmony_ci 15958c2ecf20Sopenharmony_ci return mvm->fw->phy_config & phy_config; 15968c2ecf20Sopenharmony_ci} 15978c2ecf20Sopenharmony_ci 15988c2ecf20Sopenharmony_ciint iwl_mvm_up(struct iwl_mvm *mvm); 15998c2ecf20Sopenharmony_ciint iwl_mvm_load_d3_fw(struct iwl_mvm *mvm); 16008c2ecf20Sopenharmony_ci 16018c2ecf20Sopenharmony_ciint iwl_mvm_mac_setup_register(struct iwl_mvm *mvm); 16028c2ecf20Sopenharmony_cibool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm, 16038c2ecf20Sopenharmony_ci struct iwl_bcast_filter_cmd *cmd); 16048c2ecf20Sopenharmony_ci 16058c2ecf20Sopenharmony_ci/* 16068c2ecf20Sopenharmony_ci * FW notifications / CMD responses handlers 16078c2ecf20Sopenharmony_ci * Convention: iwl_mvm_rx_<NAME OF THE CMD> 16088c2ecf20Sopenharmony_ci */ 16098c2ecf20Sopenharmony_civoid iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 16108c2ecf20Sopenharmony_civoid iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, 16118c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16128c2ecf20Sopenharmony_civoid iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, 16138c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb, int queue); 16148c2ecf20Sopenharmony_civoid iwl_mvm_rx_monitor_no_data(struct iwl_mvm *mvm, struct napi_struct *napi, 16158c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb, int queue); 16168c2ecf20Sopenharmony_civoid iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 16178c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb, int queue); 16188c2ecf20Sopenharmony_civoid iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 16198c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb, int queue); 16208c2ecf20Sopenharmony_ciint iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, 16218c2ecf20Sopenharmony_ci const u8 *data, u32 count, bool async); 16228c2ecf20Sopenharmony_civoid iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi, 16238c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb, int queue); 16248c2ecf20Sopenharmony_civoid iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 16258c2ecf20Sopenharmony_civoid iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, 16268c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16278c2ecf20Sopenharmony_civoid iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags); 16288c2ecf20Sopenharmony_civoid iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 16298c2ecf20Sopenharmony_civoid iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, 16308c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16318c2ecf20Sopenharmony_civoid iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 16328c2ecf20Sopenharmony_civoid iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, 16338c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16348c2ecf20Sopenharmony_civoid iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm, 16358c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16368c2ecf20Sopenharmony_civoid iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm, 16378c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16388c2ecf20Sopenharmony_ci 16398c2ecf20Sopenharmony_ci/* MVM PHY */ 16408c2ecf20Sopenharmony_ciint iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, 16418c2ecf20Sopenharmony_ci struct cfg80211_chan_def *chandef, 16428c2ecf20Sopenharmony_ci u8 chains_static, u8 chains_dynamic); 16438c2ecf20Sopenharmony_ciint iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, 16448c2ecf20Sopenharmony_ci struct cfg80211_chan_def *chandef, 16458c2ecf20Sopenharmony_ci u8 chains_static, u8 chains_dynamic); 16468c2ecf20Sopenharmony_civoid iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm, 16478c2ecf20Sopenharmony_ci struct iwl_mvm_phy_ctxt *ctxt); 16488c2ecf20Sopenharmony_civoid iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, 16498c2ecf20Sopenharmony_ci struct iwl_mvm_phy_ctxt *ctxt); 16508c2ecf20Sopenharmony_ciint iwl_mvm_phy_ctx_count(struct iwl_mvm *mvm); 16518c2ecf20Sopenharmony_ciu8 iwl_mvm_get_channel_width(struct cfg80211_chan_def *chandef); 16528c2ecf20Sopenharmony_ciu8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef); 16538c2ecf20Sopenharmony_ci 16548c2ecf20Sopenharmony_ci/* MAC (virtual interface) programming */ 16558c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 16568c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 16578c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 16588c2ecf20Sopenharmony_ci bool force_assoc_off, const u8 *bssid_override); 16598c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 16608c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, 16618c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 16628c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, 16638c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 16648c2ecf20Sopenharmony_ci struct sk_buff *beacon); 16658c2ecf20Sopenharmony_ciint iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, 16668c2ecf20Sopenharmony_ci struct sk_buff *beacon, 16678c2ecf20Sopenharmony_ci void *data, int len); 16688c2ecf20Sopenharmony_ciu8 iwl_mvm_mac_ctxt_get_lowest_rate(struct ieee80211_tx_info *info, 16698c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 16708c2ecf20Sopenharmony_civoid iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, 16718c2ecf20Sopenharmony_ci __le32 *tim_index, __le32 *tim_size, 16728c2ecf20Sopenharmony_ci u8 *beacon, u32 frame_size); 16738c2ecf20Sopenharmony_civoid iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, 16748c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16758c2ecf20Sopenharmony_civoid iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, 16768c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16778c2ecf20Sopenharmony_civoid iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm, 16788c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16798c2ecf20Sopenharmony_civoid iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm, 16808c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16818c2ecf20Sopenharmony_civoid iwl_mvm_sta_pm_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 16828c2ecf20Sopenharmony_civoid iwl_mvm_window_status_notif(struct iwl_mvm *mvm, 16838c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16848c2ecf20Sopenharmony_civoid iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm, 16858c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 16868c2ecf20Sopenharmony_civoid iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm, 16878c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16888c2ecf20Sopenharmony_civoid iwl_mvm_rx_missed_vap_notif(struct iwl_mvm *mvm, 16898c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16908c2ecf20Sopenharmony_civoid iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm, 16918c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 16928c2ecf20Sopenharmony_ci/* Bindings */ 16938c2ecf20Sopenharmony_ciint iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 16948c2ecf20Sopenharmony_ciint iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 16958c2ecf20Sopenharmony_ci 16968c2ecf20Sopenharmony_ci/* Quota management */ 16978c2ecf20Sopenharmony_cistatic inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm) 16988c2ecf20Sopenharmony_ci{ 16998c2ecf20Sopenharmony_ci return iwl_mvm_has_quota_low_latency(mvm) ? 17008c2ecf20Sopenharmony_ci sizeof(struct iwl_time_quota_cmd) : 17018c2ecf20Sopenharmony_ci sizeof(struct iwl_time_quota_cmd_v1); 17028c2ecf20Sopenharmony_ci} 17038c2ecf20Sopenharmony_ci 17048c2ecf20Sopenharmony_cistatic inline struct iwl_time_quota_data 17058c2ecf20Sopenharmony_ci*iwl_mvm_quota_cmd_get_quota(struct iwl_mvm *mvm, 17068c2ecf20Sopenharmony_ci struct iwl_time_quota_cmd *cmd, 17078c2ecf20Sopenharmony_ci int i) 17088c2ecf20Sopenharmony_ci{ 17098c2ecf20Sopenharmony_ci struct iwl_time_quota_data_v1 *quotas; 17108c2ecf20Sopenharmony_ci 17118c2ecf20Sopenharmony_ci if (iwl_mvm_has_quota_low_latency(mvm)) 17128c2ecf20Sopenharmony_ci return &cmd->quotas[i]; 17138c2ecf20Sopenharmony_ci 17148c2ecf20Sopenharmony_ci quotas = (struct iwl_time_quota_data_v1 *)cmd->quotas; 17158c2ecf20Sopenharmony_ci return (struct iwl_time_quota_data *)"as[i]; 17168c2ecf20Sopenharmony_ci} 17178c2ecf20Sopenharmony_ci 17188c2ecf20Sopenharmony_ciint iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload, 17198c2ecf20Sopenharmony_ci struct ieee80211_vif *disabled_vif); 17208c2ecf20Sopenharmony_ci 17218c2ecf20Sopenharmony_ci/* Scanning */ 17228c2ecf20Sopenharmony_ciint iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 17238c2ecf20Sopenharmony_ci struct cfg80211_scan_request *req, 17248c2ecf20Sopenharmony_ci struct ieee80211_scan_ies *ies); 17258c2ecf20Sopenharmony_ciint iwl_mvm_scan_size(struct iwl_mvm *mvm); 17268c2ecf20Sopenharmony_ciint iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); 17278c2ecf20Sopenharmony_ciint iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); 17288c2ecf20Sopenharmony_civoid iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); 17298c2ecf20Sopenharmony_civoid iwl_mvm_scan_timeout_wk(struct work_struct *work); 17308c2ecf20Sopenharmony_ci 17318c2ecf20Sopenharmony_ci/* Scheduled scan */ 17328c2ecf20Sopenharmony_civoid iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, 17338c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17348c2ecf20Sopenharmony_civoid iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm, 17358c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17368c2ecf20Sopenharmony_ciint iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, 17378c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 17388c2ecf20Sopenharmony_ci struct cfg80211_sched_scan_request *req, 17398c2ecf20Sopenharmony_ci struct ieee80211_scan_ies *ies, 17408c2ecf20Sopenharmony_ci int type); 17418c2ecf20Sopenharmony_civoid iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm, 17428c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17438c2ecf20Sopenharmony_ci 17448c2ecf20Sopenharmony_ci/* UMAC scan */ 17458c2ecf20Sopenharmony_ciint iwl_mvm_config_scan(struct iwl_mvm *mvm); 17468c2ecf20Sopenharmony_civoid iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, 17478c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17488c2ecf20Sopenharmony_civoid iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, 17498c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17508c2ecf20Sopenharmony_ci 17518c2ecf20Sopenharmony_ci/* MVM debugfs */ 17528c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 17538c2ecf20Sopenharmony_civoid iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir); 17548c2ecf20Sopenharmony_civoid iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 17558c2ecf20Sopenharmony_civoid iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 17568c2ecf20Sopenharmony_ci#else 17578c2ecf20Sopenharmony_cistatic inline void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, 17588c2ecf20Sopenharmony_ci struct dentry *dbgfs_dir) 17598c2ecf20Sopenharmony_ci{ 17608c2ecf20Sopenharmony_ci} 17618c2ecf20Sopenharmony_cistatic inline void 17628c2ecf20Sopenharmony_ciiwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 17638c2ecf20Sopenharmony_ci{ 17648c2ecf20Sopenharmony_ci} 17658c2ecf20Sopenharmony_cistatic inline void 17668c2ecf20Sopenharmony_ciiwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 17678c2ecf20Sopenharmony_ci{ 17688c2ecf20Sopenharmony_ci} 17698c2ecf20Sopenharmony_ci#endif /* CONFIG_IWLWIFI_DEBUGFS */ 17708c2ecf20Sopenharmony_ci 17718c2ecf20Sopenharmony_ci/* rate scaling */ 17728c2ecf20Sopenharmony_ciint iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq); 17738c2ecf20Sopenharmony_civoid iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg); 17748c2ecf20Sopenharmony_ciint rs_pretty_print_rate(char *buf, int bufsz, const u32 rate); 17758c2ecf20Sopenharmony_civoid rs_update_last_rssi(struct iwl_mvm *mvm, 17768c2ecf20Sopenharmony_ci struct iwl_mvm_sta *mvmsta, 17778c2ecf20Sopenharmony_ci struct ieee80211_rx_status *rx_status); 17788c2ecf20Sopenharmony_ci 17798c2ecf20Sopenharmony_ci/* power management */ 17808c2ecf20Sopenharmony_ciint iwl_mvm_power_update_device(struct iwl_mvm *mvm); 17818c2ecf20Sopenharmony_ciint iwl_mvm_power_update_mac(struct iwl_mvm *mvm); 17828c2ecf20Sopenharmony_ciint iwl_mvm_power_update_ps(struct iwl_mvm *mvm); 17838c2ecf20Sopenharmony_ciint iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 17848c2ecf20Sopenharmony_ci char *buf, int bufsz); 17858c2ecf20Sopenharmony_ci 17868c2ecf20Sopenharmony_civoid iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 17878c2ecf20Sopenharmony_civoid iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm, 17888c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 17898c2ecf20Sopenharmony_ci 17908c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_LEDS 17918c2ecf20Sopenharmony_ciint iwl_mvm_leds_init(struct iwl_mvm *mvm); 17928c2ecf20Sopenharmony_civoid iwl_mvm_leds_exit(struct iwl_mvm *mvm); 17938c2ecf20Sopenharmony_civoid iwl_mvm_leds_sync(struct iwl_mvm *mvm); 17948c2ecf20Sopenharmony_ci#else 17958c2ecf20Sopenharmony_cistatic inline int iwl_mvm_leds_init(struct iwl_mvm *mvm) 17968c2ecf20Sopenharmony_ci{ 17978c2ecf20Sopenharmony_ci return 0; 17988c2ecf20Sopenharmony_ci} 17998c2ecf20Sopenharmony_cistatic inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm) 18008c2ecf20Sopenharmony_ci{ 18018c2ecf20Sopenharmony_ci} 18028c2ecf20Sopenharmony_cistatic inline void iwl_mvm_leds_sync(struct iwl_mvm *mvm) 18038c2ecf20Sopenharmony_ci{ 18048c2ecf20Sopenharmony_ci} 18058c2ecf20Sopenharmony_ci#endif 18068c2ecf20Sopenharmony_ci 18078c2ecf20Sopenharmony_ci/* D3 (WoWLAN, NetDetect) */ 18088c2ecf20Sopenharmony_ciint iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); 18098c2ecf20Sopenharmony_ciint iwl_mvm_resume(struct ieee80211_hw *hw); 18108c2ecf20Sopenharmony_civoid iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled); 18118c2ecf20Sopenharmony_civoid iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, 18128c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 18138c2ecf20Sopenharmony_ci struct cfg80211_gtk_rekey_data *data); 18148c2ecf20Sopenharmony_civoid iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw, 18158c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 18168c2ecf20Sopenharmony_ci struct inet6_dev *idev); 18178c2ecf20Sopenharmony_civoid iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw, 18188c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, int idx); 18198c2ecf20Sopenharmony_ciextern const struct file_operations iwl_dbgfs_d3_test_ops; 18208c2ecf20Sopenharmony_cistruct iwl_wowlan_status *iwl_mvm_send_wowlan_get_status(struct iwl_mvm *mvm); 18218c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 18228c2ecf20Sopenharmony_civoid iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, 18238c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 18248c2ecf20Sopenharmony_ci#else 18258c2ecf20Sopenharmony_cistatic inline void 18268c2ecf20Sopenharmony_ciiwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 18278c2ecf20Sopenharmony_ci{ 18288c2ecf20Sopenharmony_ci} 18298c2ecf20Sopenharmony_ci#endif 18308c2ecf20Sopenharmony_civoid iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta, 18318c2ecf20Sopenharmony_ci struct iwl_wowlan_config_cmd *cmd); 18328c2ecf20Sopenharmony_ciint iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, 18338c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 18348c2ecf20Sopenharmony_ci bool disable_offloading, 18358c2ecf20Sopenharmony_ci bool offload_ns, 18368c2ecf20Sopenharmony_ci u32 cmd_flags); 18378c2ecf20Sopenharmony_ci 18388c2ecf20Sopenharmony_ci/* BT Coex */ 18398c2ecf20Sopenharmony_ciint iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm); 18408c2ecf20Sopenharmony_civoid iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, 18418c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 18428c2ecf20Sopenharmony_civoid iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 18438c2ecf20Sopenharmony_ci enum ieee80211_rssi_event_data); 18448c2ecf20Sopenharmony_civoid iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm); 18458c2ecf20Sopenharmony_ciu16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, 18468c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 18478c2ecf20Sopenharmony_cibool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, 18488c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 18498c2ecf20Sopenharmony_cibool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant); 18508c2ecf20Sopenharmony_cibool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm); 18518c2ecf20Sopenharmony_cibool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, 18528c2ecf20Sopenharmony_ci enum nl80211_band band); 18538c2ecf20Sopenharmony_ciu8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants); 18548c2ecf20Sopenharmony_ciu8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, 18558c2ecf20Sopenharmony_ci struct ieee80211_tx_info *info, u8 ac); 18568c2ecf20Sopenharmony_ci 18578c2ecf20Sopenharmony_ci/* beacon filtering */ 18588c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 18598c2ecf20Sopenharmony_civoid 18608c2ecf20Sopenharmony_ciiwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, 18618c2ecf20Sopenharmony_ci struct iwl_beacon_filter_cmd *cmd); 18628c2ecf20Sopenharmony_ci#else 18638c2ecf20Sopenharmony_cistatic inline void 18648c2ecf20Sopenharmony_ciiwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif, 18658c2ecf20Sopenharmony_ci struct iwl_beacon_filter_cmd *cmd) 18668c2ecf20Sopenharmony_ci{} 18678c2ecf20Sopenharmony_ci#endif 18688c2ecf20Sopenharmony_ciint iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm, 18698c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 18708c2ecf20Sopenharmony_ci u32 flags); 18718c2ecf20Sopenharmony_ciint iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, 18728c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 18738c2ecf20Sopenharmony_ci u32 flags); 18748c2ecf20Sopenharmony_ci/* SMPS */ 18758c2ecf20Sopenharmony_civoid iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 18768c2ecf20Sopenharmony_ci enum iwl_mvm_smps_type_request req_type, 18778c2ecf20Sopenharmony_ci enum ieee80211_smps_mode smps_request); 18788c2ecf20Sopenharmony_cibool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm); 18798c2ecf20Sopenharmony_ci 18808c2ecf20Sopenharmony_ci/* Low latency */ 18818c2ecf20Sopenharmony_ciint iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 18828c2ecf20Sopenharmony_ci bool low_latency, 18838c2ecf20Sopenharmony_ci enum iwl_mvm_low_latency_cause cause); 18848c2ecf20Sopenharmony_ci/* get SystemLowLatencyMode - only needed for beacon threshold? */ 18858c2ecf20Sopenharmony_cibool iwl_mvm_low_latency(struct iwl_mvm *mvm); 18868c2ecf20Sopenharmony_cibool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band); 18878c2ecf20Sopenharmony_civoid iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, bool low_latency, 18888c2ecf20Sopenharmony_ci u16 mac_id); 18898c2ecf20Sopenharmony_ci 18908c2ecf20Sopenharmony_ci/* get VMACLowLatencyMode */ 18918c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif) 18928c2ecf20Sopenharmony_ci{ 18938c2ecf20Sopenharmony_ci /* 18948c2ecf20Sopenharmony_ci * should this consider associated/active/... state? 18958c2ecf20Sopenharmony_ci * 18968c2ecf20Sopenharmony_ci * Normally low-latency should only be active on interfaces 18978c2ecf20Sopenharmony_ci * that are active, but at least with debugfs it can also be 18988c2ecf20Sopenharmony_ci * enabled on interfaces that aren't active. However, when 18998c2ecf20Sopenharmony_ci * interface aren't active then they aren't added into the 19008c2ecf20Sopenharmony_ci * binding, so this has no real impact. For now, just return 19018c2ecf20Sopenharmony_ci * the current desired low-latency state. 19028c2ecf20Sopenharmony_ci */ 19038c2ecf20Sopenharmony_ci return mvmvif->low_latency_actual; 19048c2ecf20Sopenharmony_ci} 19058c2ecf20Sopenharmony_ci 19068c2ecf20Sopenharmony_cistatic inline 19078c2ecf20Sopenharmony_civoid iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set, 19088c2ecf20Sopenharmony_ci enum iwl_mvm_low_latency_cause cause) 19098c2ecf20Sopenharmony_ci{ 19108c2ecf20Sopenharmony_ci u8 new_state; 19118c2ecf20Sopenharmony_ci 19128c2ecf20Sopenharmony_ci if (set) 19138c2ecf20Sopenharmony_ci mvmvif->low_latency |= cause; 19148c2ecf20Sopenharmony_ci else 19158c2ecf20Sopenharmony_ci mvmvif->low_latency &= ~cause; 19168c2ecf20Sopenharmony_ci 19178c2ecf20Sopenharmony_ci /* 19188c2ecf20Sopenharmony_ci * if LOW_LATENCY_DEBUGFS_FORCE_ENABLE is enabled no changes are 19198c2ecf20Sopenharmony_ci * allowed to actual mode. 19208c2ecf20Sopenharmony_ci */ 19218c2ecf20Sopenharmony_ci if (mvmvif->low_latency & LOW_LATENCY_DEBUGFS_FORCE_ENABLE && 19228c2ecf20Sopenharmony_ci cause != LOW_LATENCY_DEBUGFS_FORCE_ENABLE) 19238c2ecf20Sopenharmony_ci return; 19248c2ecf20Sopenharmony_ci 19258c2ecf20Sopenharmony_ci if (cause == LOW_LATENCY_DEBUGFS_FORCE_ENABLE && set) 19268c2ecf20Sopenharmony_ci /* 19278c2ecf20Sopenharmony_ci * We enter force state 19288c2ecf20Sopenharmony_ci */ 19298c2ecf20Sopenharmony_ci new_state = !!(mvmvif->low_latency & 19308c2ecf20Sopenharmony_ci LOW_LATENCY_DEBUGFS_FORCE); 19318c2ecf20Sopenharmony_ci else 19328c2ecf20Sopenharmony_ci /* 19338c2ecf20Sopenharmony_ci * Check if any other one set low latency 19348c2ecf20Sopenharmony_ci */ 19358c2ecf20Sopenharmony_ci new_state = !!(mvmvif->low_latency & 19368c2ecf20Sopenharmony_ci ~(LOW_LATENCY_DEBUGFS_FORCE_ENABLE | 19378c2ecf20Sopenharmony_ci LOW_LATENCY_DEBUGFS_FORCE)); 19388c2ecf20Sopenharmony_ci 19398c2ecf20Sopenharmony_ci mvmvif->low_latency_actual = new_state; 19408c2ecf20Sopenharmony_ci} 19418c2ecf20Sopenharmony_ci 19428c2ecf20Sopenharmony_ci/* Return a bitmask with all the hw supported queues, except for the 19438c2ecf20Sopenharmony_ci * command queue, which can't be flushed. 19448c2ecf20Sopenharmony_ci */ 19458c2ecf20Sopenharmony_cistatic inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm) 19468c2ecf20Sopenharmony_ci{ 19478c2ecf20Sopenharmony_ci return ((BIT(mvm->trans->trans_cfg->base_params->num_of_queues) - 1) & 19488c2ecf20Sopenharmony_ci ~BIT(IWL_MVM_DQA_CMD_QUEUE)); 19498c2ecf20Sopenharmony_ci} 19508c2ecf20Sopenharmony_ci 19518c2ecf20Sopenharmony_cistatic inline void iwl_mvm_stop_device(struct iwl_mvm *mvm) 19528c2ecf20Sopenharmony_ci{ 19538c2ecf20Sopenharmony_ci lockdep_assert_held(&mvm->mutex); 19548c2ecf20Sopenharmony_ci iwl_fw_cancel_timestamp(&mvm->fwrt); 19558c2ecf20Sopenharmony_ci clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); 19568c2ecf20Sopenharmony_ci iwl_fw_dbg_stop_sync(&mvm->fwrt); 19578c2ecf20Sopenharmony_ci iwl_trans_stop_device(mvm->trans); 19588c2ecf20Sopenharmony_ci iwl_free_fw_paging(&mvm->fwrt); 19598c2ecf20Sopenharmony_ci iwl_fw_dump_conf_clear(&mvm->fwrt); 19608c2ecf20Sopenharmony_ci} 19618c2ecf20Sopenharmony_ci 19628c2ecf20Sopenharmony_ci/* Re-configure the SCD for a queue that has already been configured */ 19638c2ecf20Sopenharmony_ciint iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id, 19648c2ecf20Sopenharmony_ci int tid, int frame_limit, u16 ssn); 19658c2ecf20Sopenharmony_ci 19668c2ecf20Sopenharmony_ci/* Thermal management and CT-kill */ 19678c2ecf20Sopenharmony_civoid iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff); 19688c2ecf20Sopenharmony_civoid iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp); 19698c2ecf20Sopenharmony_civoid iwl_mvm_temp_notif(struct iwl_mvm *mvm, 19708c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 19718c2ecf20Sopenharmony_civoid iwl_mvm_tt_handler(struct iwl_mvm *mvm); 19728c2ecf20Sopenharmony_civoid iwl_mvm_thermal_initialize(struct iwl_mvm *mvm, u32 min_backoff); 19738c2ecf20Sopenharmony_civoid iwl_mvm_thermal_exit(struct iwl_mvm *mvm); 19748c2ecf20Sopenharmony_civoid iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state); 19758c2ecf20Sopenharmony_ciint iwl_mvm_get_temp(struct iwl_mvm *mvm, s32 *temp); 19768c2ecf20Sopenharmony_civoid iwl_mvm_ct_kill_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 19778c2ecf20Sopenharmony_civoid iwl_mvm_enter_ctkill(struct iwl_mvm *mvm); 19788c2ecf20Sopenharmony_ciint iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm); 19798c2ecf20Sopenharmony_ciint iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget); 19808c2ecf20Sopenharmony_ci 19818c2ecf20Sopenharmony_ci/* Location Aware Regulatory */ 19828c2ecf20Sopenharmony_cistruct iwl_mcc_update_resp * 19838c2ecf20Sopenharmony_ciiwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2, 19848c2ecf20Sopenharmony_ci enum iwl_mcc_source src_id); 19858c2ecf20Sopenharmony_ciint iwl_mvm_init_mcc(struct iwl_mvm *mvm); 19868c2ecf20Sopenharmony_civoid iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm, 19878c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 19888c2ecf20Sopenharmony_cistruct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy, 19898c2ecf20Sopenharmony_ci const char *alpha2, 19908c2ecf20Sopenharmony_ci enum iwl_mcc_source src_id, 19918c2ecf20Sopenharmony_ci bool *changed); 19928c2ecf20Sopenharmony_cistruct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm, 19938c2ecf20Sopenharmony_ci bool *changed); 19948c2ecf20Sopenharmony_ciint iwl_mvm_init_fw_regd(struct iwl_mvm *mvm); 19958c2ecf20Sopenharmony_civoid iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm); 19968c2ecf20Sopenharmony_ci 19978c2ecf20Sopenharmony_ci/* smart fifo */ 19988c2ecf20Sopenharmony_ciint iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 19998c2ecf20Sopenharmony_ci bool added_vif); 20008c2ecf20Sopenharmony_ci 20018c2ecf20Sopenharmony_ci/* FTM responder */ 20028c2ecf20Sopenharmony_ciint iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 20038c2ecf20Sopenharmony_civoid iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm, 20048c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 20058c2ecf20Sopenharmony_civoid iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm, 20068c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 20078c2ecf20Sopenharmony_ciint iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm, 20088c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, u8 *addr); 20098c2ecf20Sopenharmony_ciint iwl_mvm_ftm_respoder_add_pasn_sta(struct iwl_mvm *mvm, 20108c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20118c2ecf20Sopenharmony_ci u8 *addr, u32 cipher, u8 *tk, u32 tk_len, 20128c2ecf20Sopenharmony_ci u8 *hltk, u32 hltk_len); 20138c2ecf20Sopenharmony_civoid iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm, 20148c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 20158c2ecf20Sopenharmony_ci 20168c2ecf20Sopenharmony_ci/* FTM initiator */ 20178c2ecf20Sopenharmony_civoid iwl_mvm_ftm_restart(struct iwl_mvm *mvm); 20188c2ecf20Sopenharmony_civoid iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, 20198c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 20208c2ecf20Sopenharmony_civoid iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, 20218c2ecf20Sopenharmony_ci struct iwl_rx_cmd_buffer *rxb); 20228c2ecf20Sopenharmony_ciint iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 20238c2ecf20Sopenharmony_ci struct cfg80211_pmsr_request *request); 20248c2ecf20Sopenharmony_civoid iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req); 20258c2ecf20Sopenharmony_civoid iwl_mvm_ftm_initiator_smooth_config(struct iwl_mvm *mvm); 20268c2ecf20Sopenharmony_civoid iwl_mvm_ftm_initiator_smooth_stop(struct iwl_mvm *mvm); 20278c2ecf20Sopenharmony_ciint iwl_mvm_ftm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 20288c2ecf20Sopenharmony_ci u8 *addr, u32 cipher, u8 *tk, u32 tk_len, 20298c2ecf20Sopenharmony_ci u8 *hltk, u32 hltk_len); 20308c2ecf20Sopenharmony_civoid iwl_mvm_ftm_remove_pasn_sta(struct iwl_mvm *mvm, u8 *addr); 20318c2ecf20Sopenharmony_ci 20328c2ecf20Sopenharmony_ci/* TDLS */ 20338c2ecf20Sopenharmony_ci 20348c2ecf20Sopenharmony_ci/* 20358c2ecf20Sopenharmony_ci * We use TID 4 (VI) as a FW-used-only TID when TDLS connections are present. 20368c2ecf20Sopenharmony_ci * This TID is marked as used vs the AP and all connected TDLS peers. 20378c2ecf20Sopenharmony_ci */ 20388c2ecf20Sopenharmony_ci#define IWL_MVM_TDLS_FW_TID 4 20398c2ecf20Sopenharmony_ci 20408c2ecf20Sopenharmony_ciint iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 20418c2ecf20Sopenharmony_civoid iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm); 20428c2ecf20Sopenharmony_civoid iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 20438c2ecf20Sopenharmony_ci bool sta_added); 20448c2ecf20Sopenharmony_civoid iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw, 20458c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 20468c2ecf20Sopenharmony_ciint iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw, 20478c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20488c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, u8 oper_class, 20498c2ecf20Sopenharmony_ci struct cfg80211_chan_def *chandef, 20508c2ecf20Sopenharmony_ci struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie); 20518c2ecf20Sopenharmony_civoid iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw, 20528c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20538c2ecf20Sopenharmony_ci struct ieee80211_tdls_ch_sw_params *params); 20548c2ecf20Sopenharmony_civoid iwl_mvm_tdls_cancel_channel_switch(struct ieee80211_hw *hw, 20558c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20568c2ecf20Sopenharmony_ci struct ieee80211_sta *sta); 20578c2ecf20Sopenharmony_civoid iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 20588c2ecf20Sopenharmony_civoid iwl_mvm_tdls_ch_switch_work(struct work_struct *work); 20598c2ecf20Sopenharmony_ci 20608c2ecf20Sopenharmony_civoid iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, 20618c2ecf20Sopenharmony_ci struct iwl_mvm_internal_rxq_notif *notif, 20628c2ecf20Sopenharmony_ci u32 size); 20638c2ecf20Sopenharmony_civoid iwl_mvm_reorder_timer_expired(struct timer_list *t); 20648c2ecf20Sopenharmony_cistruct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm); 20658c2ecf20Sopenharmony_cibool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm); 20668c2ecf20Sopenharmony_ci 20678c2ecf20Sopenharmony_ci#define MVM_TCM_PERIOD_MSEC 500 20688c2ecf20Sopenharmony_ci#define MVM_TCM_PERIOD (HZ * MVM_TCM_PERIOD_MSEC / 1000) 20698c2ecf20Sopenharmony_ci#define MVM_LL_PERIOD (10 * HZ) 20708c2ecf20Sopenharmony_civoid iwl_mvm_tcm_work(struct work_struct *work); 20718c2ecf20Sopenharmony_civoid iwl_mvm_recalc_tcm(struct iwl_mvm *mvm); 20728c2ecf20Sopenharmony_civoid iwl_mvm_pause_tcm(struct iwl_mvm *mvm, bool with_cancel); 20738c2ecf20Sopenharmony_civoid iwl_mvm_resume_tcm(struct iwl_mvm *mvm); 20748c2ecf20Sopenharmony_civoid iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 20758c2ecf20Sopenharmony_civoid iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 20768c2ecf20Sopenharmony_ciu8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed); 20778c2ecf20Sopenharmony_ci 20788c2ecf20Sopenharmony_civoid iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error); 20798c2ecf20Sopenharmony_ciunsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, 20808c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20818c2ecf20Sopenharmony_ci bool tdls, bool cmd_q); 20828c2ecf20Sopenharmony_civoid iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 20838c2ecf20Sopenharmony_ci const char *errmsg); 20848c2ecf20Sopenharmony_civoid iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm, 20858c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20868c2ecf20Sopenharmony_ci const struct ieee80211_sta *sta, 20878c2ecf20Sopenharmony_ci u16 tid); 20888c2ecf20Sopenharmony_ci 20898c2ecf20Sopenharmony_ciint iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b); 20908c2ecf20Sopenharmony_ciint iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm); 20918c2ecf20Sopenharmony_ciint iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm); 20928c2ecf20Sopenharmony_ci#ifdef CONFIG_IWLWIFI_DEBUGFS 20938c2ecf20Sopenharmony_civoid iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, 20948c2ecf20Sopenharmony_ci struct ieee80211_vif *vif, 20958c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, 20968c2ecf20Sopenharmony_ci struct dentry *dir); 20978c2ecf20Sopenharmony_ci#endif 20988c2ecf20Sopenharmony_ci 20998c2ecf20Sopenharmony_cistatic inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band) 21008c2ecf20Sopenharmony_ci{ 21018c2ecf20Sopenharmony_ci switch (band) { 21028c2ecf20Sopenharmony_ci case NL80211_BAND_2GHZ: 21038c2ecf20Sopenharmony_ci return PHY_BAND_24; 21048c2ecf20Sopenharmony_ci case NL80211_BAND_5GHZ: 21058c2ecf20Sopenharmony_ci return PHY_BAND_5; 21068c2ecf20Sopenharmony_ci default: 21078c2ecf20Sopenharmony_ci WARN_ONCE(1, "Unsupported band (%u)\n", band); 21088c2ecf20Sopenharmony_ci return PHY_BAND_5; 21098c2ecf20Sopenharmony_ci } 21108c2ecf20Sopenharmony_ci} 21118c2ecf20Sopenharmony_ci 21128c2ecf20Sopenharmony_ci/* Channel info utils */ 21138c2ecf20Sopenharmony_cistatic inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm) 21148c2ecf20Sopenharmony_ci{ 21158c2ecf20Sopenharmony_ci return fw_has_capa(&mvm->fw->ucode_capa, 21168c2ecf20Sopenharmony_ci IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS); 21178c2ecf20Sopenharmony_ci} 21188c2ecf20Sopenharmony_ci 21198c2ecf20Sopenharmony_cistatic inline void *iwl_mvm_chan_info_cmd_tail(struct iwl_mvm *mvm, 21208c2ecf20Sopenharmony_ci struct iwl_fw_channel_info *ci) 21218c2ecf20Sopenharmony_ci{ 21228c2ecf20Sopenharmony_ci return (u8 *)ci + (iwl_mvm_has_ultra_hb_channel(mvm) ? 21238c2ecf20Sopenharmony_ci sizeof(struct iwl_fw_channel_info) : 21248c2ecf20Sopenharmony_ci sizeof(struct iwl_fw_channel_info_v1)); 21258c2ecf20Sopenharmony_ci} 21268c2ecf20Sopenharmony_ci 21278c2ecf20Sopenharmony_cistatic inline size_t iwl_mvm_chan_info_padding(struct iwl_mvm *mvm) 21288c2ecf20Sopenharmony_ci{ 21298c2ecf20Sopenharmony_ci return iwl_mvm_has_ultra_hb_channel(mvm) ? 0 : 21308c2ecf20Sopenharmony_ci sizeof(struct iwl_fw_channel_info) - 21318c2ecf20Sopenharmony_ci sizeof(struct iwl_fw_channel_info_v1); 21328c2ecf20Sopenharmony_ci} 21338c2ecf20Sopenharmony_ci 21348c2ecf20Sopenharmony_cistatic inline void iwl_mvm_set_chan_info(struct iwl_mvm *mvm, 21358c2ecf20Sopenharmony_ci struct iwl_fw_channel_info *ci, 21368c2ecf20Sopenharmony_ci u32 chan, u8 band, u8 width, 21378c2ecf20Sopenharmony_ci u8 ctrl_pos) 21388c2ecf20Sopenharmony_ci{ 21398c2ecf20Sopenharmony_ci if (iwl_mvm_has_ultra_hb_channel(mvm)) { 21408c2ecf20Sopenharmony_ci ci->channel = cpu_to_le32(chan); 21418c2ecf20Sopenharmony_ci ci->band = band; 21428c2ecf20Sopenharmony_ci ci->width = width; 21438c2ecf20Sopenharmony_ci ci->ctrl_pos = ctrl_pos; 21448c2ecf20Sopenharmony_ci } else { 21458c2ecf20Sopenharmony_ci struct iwl_fw_channel_info_v1 *ci_v1 = 21468c2ecf20Sopenharmony_ci (struct iwl_fw_channel_info_v1 *)ci; 21478c2ecf20Sopenharmony_ci 21488c2ecf20Sopenharmony_ci ci_v1->channel = chan; 21498c2ecf20Sopenharmony_ci ci_v1->band = band; 21508c2ecf20Sopenharmony_ci ci_v1->width = width; 21518c2ecf20Sopenharmony_ci ci_v1->ctrl_pos = ctrl_pos; 21528c2ecf20Sopenharmony_ci } 21538c2ecf20Sopenharmony_ci} 21548c2ecf20Sopenharmony_ci 21558c2ecf20Sopenharmony_cistatic inline void 21568c2ecf20Sopenharmony_ciiwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm, 21578c2ecf20Sopenharmony_ci struct iwl_fw_channel_info *ci, 21588c2ecf20Sopenharmony_ci struct cfg80211_chan_def *chandef) 21598c2ecf20Sopenharmony_ci{ 21608c2ecf20Sopenharmony_ci enum nl80211_band band = chandef->chan->band; 21618c2ecf20Sopenharmony_ci 21628c2ecf20Sopenharmony_ci iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value, 21638c2ecf20Sopenharmony_ci iwl_mvm_phy_band_from_nl80211(band), 21648c2ecf20Sopenharmony_ci iwl_mvm_get_channel_width(chandef), 21658c2ecf20Sopenharmony_ci iwl_mvm_get_ctrl_pos(chandef)); 21668c2ecf20Sopenharmony_ci} 21678c2ecf20Sopenharmony_ci 21688c2ecf20Sopenharmony_cistatic inline int iwl_umac_scan_get_max_profiles(const struct iwl_fw *fw) 21698c2ecf20Sopenharmony_ci{ 21708c2ecf20Sopenharmony_ci u8 ver = iwl_fw_lookup_cmd_ver(fw, IWL_ALWAYS_LONG_GROUP, 21718c2ecf20Sopenharmony_ci SCAN_OFFLOAD_UPDATE_PROFILES_CMD, 21728c2ecf20Sopenharmony_ci IWL_FW_CMD_VER_UNKNOWN); 21738c2ecf20Sopenharmony_ci return (ver == IWL_FW_CMD_VER_UNKNOWN || ver < 3) ? 21748c2ecf20Sopenharmony_ci IWL_SCAN_MAX_PROFILES : IWL_SCAN_MAX_PROFILES_V2; 21758c2ecf20Sopenharmony_ci} 21768c2ecf20Sopenharmony_ci 21778c2ecf20Sopenharmony_cistatic inline 21788c2ecf20Sopenharmony_cienum iwl_location_cipher iwl_mvm_cipher_to_location_cipher(u32 cipher) 21798c2ecf20Sopenharmony_ci{ 21808c2ecf20Sopenharmony_ci switch (cipher) { 21818c2ecf20Sopenharmony_ci case WLAN_CIPHER_SUITE_CCMP: 21828c2ecf20Sopenharmony_ci return IWL_LOCATION_CIPHER_CCMP_128; 21838c2ecf20Sopenharmony_ci case WLAN_CIPHER_SUITE_GCMP: 21848c2ecf20Sopenharmony_ci return IWL_LOCATION_CIPHER_GCMP_128; 21858c2ecf20Sopenharmony_ci case WLAN_CIPHER_SUITE_GCMP_256: 21868c2ecf20Sopenharmony_ci return IWL_LOCATION_CIPHER_GCMP_256; 21878c2ecf20Sopenharmony_ci default: 21888c2ecf20Sopenharmony_ci return IWL_LOCATION_CIPHER_INVALID; 21898c2ecf20Sopenharmony_ci } 21908c2ecf20Sopenharmony_ci} 21918c2ecf20Sopenharmony_ci#endif /* __IWL_MVM_H__ */ 2192