mvm.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __IWL_MVM_H__
  64. #define __IWL_MVM_H__
  65. #include <linux/list.h>
  66. #include <linux/spinlock.h>
  67. #include <linux/leds.h>
  68. #include <linux/in6.h>
  69. #include "iwl-op-mode.h"
  70. #include "iwl-trans.h"
  71. #include "iwl-notif-wait.h"
  72. #include "iwl-eeprom-parse.h"
  73. #include "sta.h"
  74. #include "fw-api.h"
  75. #include "constants.h"
  76. #define IWL_INVALID_MAC80211_QUEUE 0xff
  77. #define IWL_MVM_MAX_ADDRESSES 5
  78. /* RSSI offset for WkP */
  79. #define IWL_RSSI_OFFSET 50
  80. #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8
  81. enum iwl_mvm_tx_fifo {
  82. IWL_MVM_TX_FIFO_BK = 0,
  83. IWL_MVM_TX_FIFO_BE,
  84. IWL_MVM_TX_FIFO_VI,
  85. IWL_MVM_TX_FIFO_VO,
  86. IWL_MVM_TX_FIFO_MCAST = 5,
  87. };
  88. extern const struct ieee80211_ops iwl_mvm_hw_ops;
  89. /**
  90. * struct iwl_mvm_mod_params - module parameters for iwlmvm
  91. * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted.
  92. * We will register to mac80211 to have testmode working. The NIC must not
  93. * be up'ed after the INIT fw asserted. This is useful to be able to use
  94. * proprietary tools over testmode to debug the INIT fw.
  95. * @power_scheme: CAM(Continuous Active Mode)-1, BPS(Balanced Power
  96. * Save)-2(default), LP(Low Power)-3
  97. */
  98. struct iwl_mvm_mod_params {
  99. bool init_dbg;
  100. int power_scheme;
  101. };
  102. extern struct iwl_mvm_mod_params iwlmvm_mod_params;
  103. struct iwl_mvm_phy_ctxt {
  104. u16 id;
  105. u16 color;
  106. u32 ref;
  107. /*
  108. * TODO: This should probably be removed. Currently here only for rate
  109. * scaling algorithm
  110. */
  111. struct ieee80211_channel *channel;
  112. };
  113. struct iwl_mvm_time_event_data {
  114. struct ieee80211_vif *vif;
  115. struct list_head list;
  116. unsigned long end_jiffies;
  117. u32 duration;
  118. bool running;
  119. u32 uid;
  120. /*
  121. * The access to the 'id' field must be done when the
  122. * mvm->time_event_lock is held, as it value is used to indicate
  123. * if the te is in the time event list or not (when id == TE_MAX)
  124. */
  125. u32 id;
  126. };
  127. /* Power management */
  128. /**
  129. * enum iwl_power_scheme
  130. * @IWL_POWER_LEVEL_CAM - Continuously Active Mode
  131. * @IWL_POWER_LEVEL_BPS - Balanced Power Save (default)
  132. * @IWL_POWER_LEVEL_LP - Low Power
  133. */
  134. enum iwl_power_scheme {
  135. IWL_POWER_SCHEME_CAM = 1,
  136. IWL_POWER_SCHEME_BPS,
  137. IWL_POWER_SCHEME_LP
  138. };
  139. #define IWL_CONN_MAX_LISTEN_INTERVAL 10
  140. #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\
  141. IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\
  142. IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\
  143. IEEE80211_WMM_IE_STA_QOSINFO_AC_BE)
  144. #define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_2
  145. #ifdef CONFIG_IWLWIFI_DEBUGFS
  146. enum iwl_dbgfs_pm_mask {
  147. MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0),
  148. MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1),
  149. MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2),
  150. MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3),
  151. MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4),
  152. MVM_DEBUGFS_PM_LPRX_ENA = BIT(6),
  153. MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7),
  154. MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8),
  155. MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9),
  156. };
  157. struct iwl_dbgfs_pm {
  158. u16 keep_alive_seconds;
  159. u32 rx_data_timeout;
  160. u32 tx_data_timeout;
  161. bool skip_over_dtim;
  162. u8 skip_dtim_periods;
  163. bool lprx_ena;
  164. u32 lprx_rssi_threshold;
  165. bool snooze_ena;
  166. bool uapsd_misbehaving;
  167. int mask;
  168. };
  169. /* beacon filtering */
  170. enum iwl_dbgfs_bf_mask {
  171. MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0),
  172. MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1),
  173. MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2),
  174. MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3),
  175. MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4),
  176. MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5),
  177. MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6),
  178. MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7),
  179. MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8),
  180. MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9),
  181. MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10),
  182. };
  183. struct iwl_dbgfs_bf {
  184. u32 bf_energy_delta;
  185. u32 bf_roaming_energy_delta;
  186. u32 bf_roaming_state;
  187. u32 bf_temp_threshold;
  188. u32 bf_temp_fast_filter;
  189. u32 bf_temp_slow_filter;
  190. u32 bf_enable_beacon_filter;
  191. u32 bf_debug_flag;
  192. u32 bf_escape_timer;
  193. u32 ba_escape_timer;
  194. u32 ba_enable_beacon_abort;
  195. int mask;
  196. };
  197. #endif
  198. enum iwl_mvm_smps_type_request {
  199. IWL_MVM_SMPS_REQ_BT_COEX,
  200. IWL_MVM_SMPS_REQ_TT,
  201. NUM_IWL_MVM_SMPS_REQ,
  202. };
  203. enum iwl_mvm_ref_type {
  204. IWL_MVM_REF_UCODE_DOWN,
  205. IWL_MVM_REF_SCAN,
  206. IWL_MVM_REF_ROC,
  207. IWL_MVM_REF_P2P_CLIENT,
  208. IWL_MVM_REF_AP_IBSS,
  209. IWL_MVM_REF_USER,
  210. IWL_MVM_REF_TX,
  211. IWL_MVM_REF_TX_AGG,
  212. IWL_MVM_REF_EXIT_WORK,
  213. IWL_MVM_REF_COUNT,
  214. };
  215. /**
  216. * struct iwl_mvm_vif_bf_data - beacon filtering related data
  217. * @bf_enabled: indicates if beacon filtering is enabled
  218. * @ba_enabled: indicated if beacon abort is enabled
  219. * @last_beacon_signal: last beacon rssi signal in dbm
  220. * @ave_beacon_signal: average beacon signal
  221. * @last_cqm_event: rssi of the last cqm event
  222. * @bt_coex_min_thold: minimum threshold for BT coex
  223. * @bt_coex_max_thold: maximum threshold for BT coex
  224. * @last_bt_coex_event: rssi of the last BT coex event
  225. */
  226. struct iwl_mvm_vif_bf_data {
  227. bool bf_enabled;
  228. bool ba_enabled;
  229. s8 ave_beacon_signal;
  230. s8 last_cqm_event;
  231. s8 bt_coex_min_thold;
  232. s8 bt_coex_max_thold;
  233. s8 last_bt_coex_event;
  234. };
  235. /**
  236. * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
  237. * @id: between 0 and 3
  238. * @color: to solve races upon MAC addition and removal
  239. * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA
  240. * @uploaded: indicates the MAC context has been added to the device
  241. * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface
  242. * should get quota etc.
  243. * @pm_enabled - Indicate if MAC power management is allowed
  244. * @monitor_active: indicates that monitor context is configured, and that the
  245. * interface should get quota etc.
  246. * @low_latency: indicates that this interface is in low-latency mode
  247. * (VMACLowLatencyMode)
  248. * @queue_params: QoS params for this MAC
  249. * @bcast_sta: station used for broadcast packets. Used by the following
  250. * vifs: P2P_DEVICE, GO and AP.
  251. * @beacon_skb: the skb used to hold the AP/GO beacon template
  252. * @smps_requests: the SMPS requests of differents parts of the driver,
  253. * combined on update to yield the overall request to mac80211.
  254. */
  255. struct iwl_mvm_vif {
  256. u16 id;
  257. u16 color;
  258. u8 ap_sta_id;
  259. bool uploaded;
  260. bool ap_ibss_active;
  261. bool pm_enabled;
  262. bool monitor_active;
  263. bool low_latency;
  264. struct iwl_mvm_vif_bf_data bf_data;
  265. u32 ap_beacon_time;
  266. enum iwl_tsf_id tsf_id;
  267. /*
  268. * QoS data from mac80211, need to store this here
  269. * as mac80211 has a separate callback but we need
  270. * to have the data for the MAC context
  271. */
  272. struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
  273. struct iwl_mvm_time_event_data time_event_data;
  274. struct iwl_mvm_int_sta bcast_sta;
  275. /*
  276. * Assigned while mac80211 has the interface in a channel context,
  277. * or, for P2P Device, while it exists.
  278. */
  279. struct iwl_mvm_phy_ctxt *phy_ctxt;
  280. #ifdef CONFIG_PM_SLEEP
  281. /* WoWLAN GTK rekey data */
  282. struct {
  283. u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
  284. __le64 replay_ctr;
  285. bool valid;
  286. } rekey_data;
  287. int tx_key_idx;
  288. bool seqno_valid;
  289. u16 seqno;
  290. #endif
  291. #if IS_ENABLED(CONFIG_IPV6)
  292. /* IPv6 addresses for WoWLAN */
  293. struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX];
  294. int num_target_ipv6_addrs;
  295. #endif
  296. #ifdef CONFIG_IWLWIFI_DEBUGFS
  297. struct iwl_mvm *mvm;
  298. struct dentry *dbgfs_dir;
  299. struct dentry *dbgfs_slink;
  300. struct iwl_dbgfs_pm dbgfs_pm;
  301. struct iwl_dbgfs_bf dbgfs_bf;
  302. struct iwl_mac_power_cmd mac_pwr_cmd;
  303. #endif
  304. enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];
  305. /* FW identified misbehaving AP */
  306. u8 uapsd_misbehaving_bssid[ETH_ALEN];
  307. };
  308. static inline struct iwl_mvm_vif *
  309. iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
  310. {
  311. return (void *)vif->drv_priv;
  312. }
  313. extern const u8 tid_to_mac80211_ac[];
  314. enum iwl_scan_status {
  315. IWL_MVM_SCAN_NONE,
  316. IWL_MVM_SCAN_OS,
  317. IWL_MVM_SCAN_SCHED,
  318. };
  319. /**
  320. * struct iwl_nvm_section - describes an NVM section in memory.
  321. *
  322. * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,
  323. * and saved for later use by the driver. Not all NVM sections are saved
  324. * this way, only the needed ones.
  325. */
  326. struct iwl_nvm_section {
  327. u16 length;
  328. const u8 *data;
  329. };
  330. /*
  331. * Tx-backoff threshold
  332. * @temperature: The threshold in Celsius
  333. * @backoff: The tx-backoff in uSec
  334. */
  335. struct iwl_tt_tx_backoff {
  336. s32 temperature;
  337. u32 backoff;
  338. };
  339. #define TT_TX_BACKOFF_SIZE 6
  340. /**
  341. * struct iwl_tt_params - thermal throttling parameters
  342. * @ct_kill_entry: CT Kill entry threshold
  343. * @ct_kill_exit: CT Kill exit threshold
  344. * @ct_kill_duration: The time intervals (in uSec) in which the driver needs
  345. * to checks whether to exit CT Kill.
  346. * @dynamic_smps_entry: Dynamic SMPS entry threshold
  347. * @dynamic_smps_exit: Dynamic SMPS exit threshold
  348. * @tx_protection_entry: TX protection entry threshold
  349. * @tx_protection_exit: TX protection exit threshold
  350. * @tx_backoff: Array of thresholds for tx-backoff , in ascending order.
  351. * @support_ct_kill: Support CT Kill?
  352. * @support_dynamic_smps: Support dynamic SMPS?
  353. * @support_tx_protection: Support tx protection?
  354. * @support_tx_backoff: Support tx-backoff?
  355. */
  356. struct iwl_tt_params {
  357. s32 ct_kill_entry;
  358. s32 ct_kill_exit;
  359. u32 ct_kill_duration;
  360. s32 dynamic_smps_entry;
  361. s32 dynamic_smps_exit;
  362. s32 tx_protection_entry;
  363. s32 tx_protection_exit;
  364. struct iwl_tt_tx_backoff tx_backoff[TT_TX_BACKOFF_SIZE];
  365. bool support_ct_kill;
  366. bool support_dynamic_smps;
  367. bool support_tx_protection;
  368. bool support_tx_backoff;
  369. };
  370. /**
  371. * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure
  372. * @ct_kill_exit: worker to exit thermal kill
  373. * @dynamic_smps: Is thermal throttling enabled dynamic_smps?
  374. * @tx_backoff: The current thremal throttling tx backoff in uSec.
  375. * @min_backoff: The minimal tx backoff due to power restrictions
  376. * @params: Parameters to configure the thermal throttling algorithm.
  377. * @throttle: Is thermal throttling is active?
  378. */
  379. struct iwl_mvm_tt_mgmt {
  380. struct delayed_work ct_kill_exit;
  381. bool dynamic_smps;
  382. u32 tx_backoff;
  383. u32 min_backoff;
  384. const struct iwl_tt_params *params;
  385. bool throttle;
  386. };
  387. #define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8
  388. struct iwl_mvm_frame_stats {
  389. u32 legacy_frames;
  390. u32 ht_frames;
  391. u32 vht_frames;
  392. u32 bw_20_frames;
  393. u32 bw_40_frames;
  394. u32 bw_80_frames;
  395. u32 bw_160_frames;
  396. u32 sgi_frames;
  397. u32 ngi_frames;
  398. u32 siso_frames;
  399. u32 mimo2_frames;
  400. u32 agg_frames;
  401. u32 ampdu_count;
  402. u32 success_frames;
  403. u32 fail_frames;
  404. u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES];
  405. int last_frame_idx;
  406. };
  407. enum {
  408. D0I3_DEFER_WAKEUP,
  409. D0I3_PENDING_WAKEUP,
  410. };
  411. struct iwl_mvm {
  412. /* for logger access */
  413. struct device *dev;
  414. struct iwl_trans *trans;
  415. const struct iwl_fw *fw;
  416. const struct iwl_cfg *cfg;
  417. struct iwl_phy_db *phy_db;
  418. struct ieee80211_hw *hw;
  419. /* for protecting access to iwl_mvm */
  420. struct mutex mutex;
  421. struct list_head async_handlers_list;
  422. spinlock_t async_handlers_lock;
  423. struct work_struct async_handlers_wk;
  424. struct work_struct roc_done_wk;
  425. unsigned long status;
  426. /*
  427. * for beacon filtering -
  428. * currently only one interface can be supported
  429. */
  430. struct iwl_mvm_vif *bf_allowed_vif;
  431. enum iwl_ucode_type cur_ucode;
  432. bool ucode_loaded;
  433. bool init_ucode_complete;
  434. u32 error_event_table;
  435. u32 log_event_table;
  436. u32 umac_error_event_table;
  437. bool support_umac_log;
  438. struct iwl_sf_region sf_space;
  439. u32 ampdu_ref;
  440. struct iwl_notif_wait_data notif_wait;
  441. struct mvm_statistics_rx rx_stats;
  442. unsigned long transport_queue_stop;
  443. u8 queue_to_mac80211[IWL_MAX_HW_QUEUES];
  444. atomic_t queue_stop_count[IWL_MAX_HW_QUEUES];
  445. const char *nvm_file_name;
  446. struct iwl_nvm_data *nvm_data;
  447. /* NVM sections */
  448. struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS];
  449. /* EEPROM MAC addresses */
  450. struct mac_address addresses[IWL_MVM_MAX_ADDRESSES];
  451. /* data related to data path */
  452. struct iwl_rx_phy_info last_phy_info;
  453. struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT];
  454. struct work_struct sta_drained_wk;
  455. unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
  456. atomic_t pending_frames[IWL_MVM_STATION_COUNT];
  457. u8 rx_ba_sessions;
  458. /* configured by mac80211 */
  459. u32 rts_threshold;
  460. /* Scan status, cmd (pre-allocated) and auxiliary station */
  461. enum iwl_scan_status scan_status;
  462. struct iwl_scan_cmd *scan_cmd;
  463. struct iwl_mcast_filter_cmd *mcast_filter_cmd;
  464. /* rx chain antennas set through debugfs for the scan command */
  465. u8 scan_rx_ant;
  466. #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
  467. /* broadcast filters to configure for each associated station */
  468. const struct iwl_fw_bcast_filter *bcast_filters;
  469. #ifdef CONFIG_IWLWIFI_DEBUGFS
  470. struct {
  471. u32 override; /* u32 for debugfs_create_bool */
  472. struct iwl_bcast_filter_cmd cmd;
  473. } dbgfs_bcast_filtering;
  474. #endif
  475. #endif
  476. /* Internal station */
  477. struct iwl_mvm_int_sta aux_sta;
  478. bool last_ebs_successful;
  479. u8 scan_last_antenna_idx; /* to toggle TX between antennas */
  480. u8 mgmt_last_antenna_idx;
  481. /* last smart fifo state that was successfully sent to firmware */
  482. enum iwl_sf_state sf_state;
  483. #ifdef CONFIG_IWLWIFI_DEBUGFS
  484. struct dentry *debugfs_dir;
  485. u32 dbgfs_sram_offset, dbgfs_sram_len;
  486. u32 dbgfs_prph_reg_addr;
  487. bool disable_power_off;
  488. bool disable_power_off_d3;
  489. struct debugfs_blob_wrapper nvm_hw_blob;
  490. struct debugfs_blob_wrapper nvm_sw_blob;
  491. struct debugfs_blob_wrapper nvm_calib_blob;
  492. struct debugfs_blob_wrapper nvm_prod_blob;
  493. struct iwl_mvm_frame_stats drv_rx_stats;
  494. spinlock_t drv_stats_lock;
  495. #endif
  496. struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];
  497. struct list_head time_event_list;
  498. spinlock_t time_event_lock;
  499. /*
  500. * A bitmap indicating the index of the key in use. The firmware
  501. * can hold 16 keys at most. Reflect this fact.
  502. */
  503. unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)];
  504. /* A bitmap of reference types taken by the driver. */
  505. unsigned long ref_bitmap[BITS_TO_LONGS(IWL_MVM_REF_COUNT)];
  506. u8 vif_count;
  507. /* -1 for always, 0 for never, >0 for that many times */
  508. s8 restart_fw;
  509. void *fw_error_dump;
  510. void *fw_error_sram;
  511. u32 fw_error_sram_len;
  512. u32 *fw_error_rxf;
  513. u32 fw_error_rxf_len;
  514. #ifdef CONFIG_IWLWIFI_LEDS
  515. struct led_classdev led;
  516. #endif
  517. struct ieee80211_vif *p2p_device_vif;
  518. #ifdef CONFIG_PM_SLEEP
  519. struct wiphy_wowlan_support wowlan;
  520. int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
  521. #ifdef CONFIG_IWLWIFI_DEBUGFS
  522. u32 d3_wake_sysassert; /* must be u32 for debugfs_create_bool */
  523. bool d3_test_active;
  524. bool store_d3_resume_sram;
  525. void *d3_resume_sram;
  526. u32 d3_test_pme_ptr;
  527. struct ieee80211_vif *keep_vif;
  528. #endif
  529. #endif
  530. /* d0i3 */
  531. u8 d0i3_ap_sta_id;
  532. bool d0i3_offloading;
  533. struct work_struct d0i3_exit_work;
  534. struct sk_buff_head d0i3_tx;
  535. /* protect d0i3_suspend_flags */
  536. struct mutex d0i3_suspend_mutex;
  537. unsigned long d0i3_suspend_flags;
  538. /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */
  539. spinlock_t d0i3_tx_lock;
  540. wait_queue_head_t d0i3_exit_waitq;
  541. /* BT-Coex */
  542. u8 bt_kill_msk;
  543. struct iwl_bt_coex_profile_notif last_bt_notif;
  544. struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
  545. u32 last_ant_isol;
  546. u8 last_corun_lut;
  547. u8 bt_tx_prio;
  548. /* Thermal Throttling and CTkill */
  549. struct iwl_mvm_tt_mgmt thermal_throttle;
  550. s32 temperature; /* Celsius */
  551. #ifdef CONFIG_NL80211_TESTMODE
  552. u32 noa_duration;
  553. struct ieee80211_vif *noa_vif;
  554. #endif
  555. /* Tx queues */
  556. u8 aux_queue;
  557. u8 first_agg_queue;
  558. u8 last_agg_queue;
  559. /* Indicate if device power save is allowed */
  560. bool ps_disabled;
  561. struct ieee80211_vif *csa_vif;
  562. };
  563. /* Extract MVM priv from op_mode and _hw */
  564. #define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \
  565. ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific)
  566. #define IWL_MAC80211_GET_MVM(_hw) \
  567. IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv))
  568. enum iwl_mvm_status {
  569. IWL_MVM_STATUS_HW_RFKILL,
  570. IWL_MVM_STATUS_HW_CTKILL,
  571. IWL_MVM_STATUS_ROC_RUNNING,
  572. IWL_MVM_STATUS_IN_HW_RESTART,
  573. IWL_MVM_STATUS_IN_D0I3,
  574. };
  575. static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
  576. {
  577. return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) ||
  578. test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
  579. }
  580. static inline struct iwl_mvm_sta *
  581. iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id)
  582. {
  583. struct ieee80211_sta *sta;
  584. if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
  585. return NULL;
  586. sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
  587. lockdep_is_held(&mvm->mutex));
  588. /* This can happen if the station has been removed right now */
  589. if (IS_ERR_OR_NULL(sta))
  590. return NULL;
  591. return iwl_mvm_sta_from_mac80211(sta);
  592. }
  593. static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm)
  594. {
  595. return mvm->trans->cfg->d0i3 &&
  596. (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_D0I3_SUPPORT);
  597. }
  598. extern const u8 iwl_mvm_ac_to_tx_fifo[];
  599. struct iwl_rate_info {
  600. u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
  601. u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
  602. u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */
  603. u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */
  604. u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */
  605. };
  606. /******************
  607. * MVM Methods
  608. ******************/
  609. /* uCode */
  610. int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
  611. /* Utils */
  612. int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
  613. enum ieee80211_band band);
  614. void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
  615. enum ieee80211_band band,
  616. struct ieee80211_tx_rate *r);
  617. u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
  618. void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
  619. #ifdef CONFIG_IWLWIFI_DEBUGFS
  620. void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
  621. void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm);
  622. void iwl_mvm_fw_error_rxf_dump(struct iwl_mvm *mvm);
  623. #endif
  624. u8 first_antenna(u8 mask);
  625. u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
  626. /* Tx / Host Commands */
  627. int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
  628. struct iwl_host_cmd *cmd);
  629. int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u8 id,
  630. u32 flags, u16 len, const void *data);
  631. int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm,
  632. struct iwl_host_cmd *cmd,
  633. u32 *status);
  634. int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u8 id,
  635. u16 len, const void *data,
  636. u32 *status);
  637. int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
  638. struct ieee80211_sta *sta);
  639. int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb);
  640. #ifdef CONFIG_IWLWIFI_DEBUG
  641. const char *iwl_mvm_get_tx_fail_reason(u32 status);
  642. #else
  643. static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
  644. #endif
  645. int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync);
  646. void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
  647. static inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm)
  648. {
  649. flush_work(&mvm->async_handlers_wk);
  650. }
  651. /* Statistics */
  652. int iwl_mvm_rx_reply_statistics(struct iwl_mvm *mvm,
  653. struct iwl_rx_cmd_buffer *rxb,
  654. struct iwl_device_cmd *cmd);
  655. int iwl_mvm_rx_statistics(struct iwl_mvm *mvm,
  656. struct iwl_rx_cmd_buffer *rxb,
  657. struct iwl_device_cmd *cmd);
  658. /* NVM */
  659. int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic);
  660. int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);
  661. int iwl_mvm_up(struct iwl_mvm *mvm);
  662. int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);
  663. int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm);
  664. bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
  665. struct iwl_bcast_filter_cmd *cmd);
  666. /*
  667. * FW notifications / CMD responses handlers
  668. * Convention: iwl_mvm_rx_<NAME OF THE CMD>
  669. */
  670. int iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  671. struct iwl_device_cmd *cmd);
  672. int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  673. struct iwl_device_cmd *cmd);
  674. int iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  675. struct iwl_device_cmd *cmd);
  676. int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  677. struct iwl_device_cmd *cmd);
  678. int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  679. struct iwl_device_cmd *cmd);
  680. int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
  681. struct iwl_rx_cmd_buffer *rxb,
  682. struct iwl_device_cmd *cmd);
  683. int iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  684. struct iwl_device_cmd *cmd);
  685. int iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
  686. struct iwl_rx_cmd_buffer *rxb,
  687. struct iwl_device_cmd *cmd);
  688. int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  689. struct iwl_device_cmd *cmd);
  690. /* MVM PHY */
  691. int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  692. struct cfg80211_chan_def *chandef,
  693. u8 chains_static, u8 chains_dynamic);
  694. int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  695. struct cfg80211_chan_def *chandef,
  696. u8 chains_static, u8 chains_dynamic);
  697. void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm,
  698. struct iwl_mvm_phy_ctxt *ctxt);
  699. void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm,
  700. struct iwl_mvm_phy_ctxt *ctxt);
  701. /* MAC (virtual interface) programming */
  702. int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  703. void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  704. int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  705. int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  706. bool force_assoc_off);
  707. int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  708. u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
  709. struct ieee80211_vif *vif);
  710. int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
  711. struct ieee80211_vif *vif);
  712. int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
  713. struct iwl_rx_cmd_buffer *rxb,
  714. struct iwl_device_cmd *cmd);
  715. int iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
  716. struct iwl_rx_cmd_buffer *rxb,
  717. struct iwl_device_cmd *cmd);
  718. void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,
  719. struct ieee80211_vif *vif);
  720. /* Bindings */
  721. int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  722. int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  723. /* Quota management */
  724. int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif);
  725. /* Scanning */
  726. int iwl_mvm_scan_request(struct iwl_mvm *mvm,
  727. struct ieee80211_vif *vif,
  728. struct cfg80211_scan_request *req);
  729. int iwl_mvm_rx_scan_response(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  730. struct iwl_device_cmd *cmd);
  731. int iwl_mvm_rx_scan_complete(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  732. struct iwl_device_cmd *cmd);
  733. int iwl_mvm_cancel_scan(struct iwl_mvm *mvm);
  734. /* Scheduled scan */
  735. int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm *mvm,
  736. struct iwl_rx_cmd_buffer *rxb,
  737. struct iwl_device_cmd *cmd);
  738. int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm,
  739. struct ieee80211_vif *vif,
  740. struct cfg80211_sched_scan_request *req,
  741. struct ieee80211_sched_scan_ies *ies);
  742. int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
  743. struct cfg80211_sched_scan_request *req);
  744. int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
  745. struct cfg80211_sched_scan_request *req);
  746. int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify);
  747. int iwl_mvm_rx_sched_scan_results(struct iwl_mvm *mvm,
  748. struct iwl_rx_cmd_buffer *rxb,
  749. struct iwl_device_cmd *cmd);
  750. /* MVM debugfs */
  751. #ifdef CONFIG_IWLWIFI_DEBUGFS
  752. int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir);
  753. void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  754. void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  755. #else
  756. static inline int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm,
  757. struct dentry *dbgfs_dir)
  758. {
  759. return 0;
  760. }
  761. static inline void
  762. iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  763. {
  764. }
  765. static inline void
  766. iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  767. {
  768. }
  769. #endif /* CONFIG_IWLWIFI_DEBUGFS */
  770. /* rate scaling */
  771. int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init);
  772. void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm,
  773. struct iwl_mvm_frame_stats *stats,
  774. u32 rate, bool agg);
  775. int rs_pretty_print_rate(char *buf, const u32 rate);
  776. /* power management */
  777. int iwl_mvm_power_update_device(struct iwl_mvm *mvm);
  778. int iwl_mvm_power_update_mac(struct iwl_mvm *mvm);
  779. int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  780. char *buf, int bufsz);
  781. void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  782. int iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm,
  783. struct iwl_rx_cmd_buffer *rxb,
  784. struct iwl_device_cmd *cmd);
  785. #ifdef CONFIG_IWLWIFI_LEDS
  786. int iwl_mvm_leds_init(struct iwl_mvm *mvm);
  787. void iwl_mvm_leds_exit(struct iwl_mvm *mvm);
  788. #else
  789. static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm)
  790. {
  791. return 0;
  792. }
  793. static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm)
  794. {
  795. }
  796. #endif
  797. /* D3 (WoWLAN, NetDetect) */
  798. int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
  799. int iwl_mvm_resume(struct ieee80211_hw *hw);
  800. void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled);
  801. void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
  802. struct ieee80211_vif *vif,
  803. struct cfg80211_gtk_rekey_data *data);
  804. void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw,
  805. struct ieee80211_vif *vif,
  806. struct inet6_dev *idev);
  807. void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,
  808. struct ieee80211_vif *vif, int idx);
  809. extern const struct file_operations iwl_dbgfs_d3_test_ops;
  810. #ifdef CONFIG_PM_SLEEP
  811. void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,
  812. struct ieee80211_vif *vif);
  813. #else
  814. static inline void
  815. iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  816. {
  817. }
  818. #endif
  819. void iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta,
  820. struct iwl_wowlan_config_cmd_v2 *cmd);
  821. int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
  822. struct ieee80211_vif *vif,
  823. bool disable_offloading,
  824. u32 cmd_flags);
  825. /* D0i3 */
  826. void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  827. void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  828. void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq);
  829. int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm);
  830. /* BT Coex */
  831. int iwl_send_bt_init_conf(struct iwl_mvm *mvm);
  832. int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
  833. struct iwl_rx_cmd_buffer *rxb,
  834. struct iwl_device_cmd *cmd);
  835. void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  836. enum ieee80211_rssi_event rssi_event);
  837. void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);
  838. u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
  839. struct ieee80211_sta *sta);
  840. bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
  841. struct ieee80211_sta *sta);
  842. bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
  843. enum ieee80211_band band);
  844. u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
  845. struct ieee80211_tx_info *info, u8 ac);
  846. enum iwl_bt_kill_msk {
  847. BT_KILL_MSK_DEFAULT,
  848. BT_KILL_MSK_SCO_HID_A2DP,
  849. BT_KILL_MSK_REDUCED_TXPOW,
  850. BT_KILL_MSK_MAX,
  851. };
  852. extern const u32 iwl_bt_ack_kill_msk[BT_KILL_MSK_MAX];
  853. extern const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX];
  854. /* beacon filtering */
  855. #ifdef CONFIG_IWLWIFI_DEBUGFS
  856. void
  857. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  858. struct iwl_beacon_filter_cmd *cmd);
  859. #else
  860. static inline void
  861. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  862. struct iwl_beacon_filter_cmd *cmd)
  863. {}
  864. #endif
  865. int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
  866. struct ieee80211_vif *vif,
  867. bool enable, u32 flags);
  868. int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
  869. struct ieee80211_vif *vif,
  870. u32 flags);
  871. int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
  872. struct ieee80211_vif *vif,
  873. u32 flags);
  874. /* SMPS */
  875. void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  876. enum iwl_mvm_smps_type_request req_type,
  877. enum ieee80211_smps_mode smps_request);
  878. bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm);
  879. /* Low latency */
  880. int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  881. bool value);
  882. /* get SystemLowLatencyMode - only needed for beacon threshold? */
  883. bool iwl_mvm_low_latency(struct iwl_mvm *mvm);
  884. /* get VMACLowLatencyMode */
  885. static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
  886. {
  887. /*
  888. * should this consider associated/active/... state?
  889. *
  890. * Normally low-latency should only be active on interfaces
  891. * that are active, but at least with debugfs it can also be
  892. * enabled on interfaces that aren't active. However, when
  893. * interface aren't active then they aren't added into the
  894. * binding, so this has no real impact. For now, just return
  895. * the current desired low-latency state.
  896. */
  897. return mvmvif->low_latency;
  898. }
  899. /* Assoc status */
  900. bool iwl_mvm_is_idle(struct iwl_mvm *mvm);
  901. /* Thermal management and CT-kill */
  902. void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);
  903. void iwl_mvm_tt_handler(struct iwl_mvm *mvm);
  904. void iwl_mvm_tt_initialize(struct iwl_mvm *mvm, u32 min_backoff);
  905. void iwl_mvm_tt_exit(struct iwl_mvm *mvm);
  906. void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
  907. /* smart fifo */
  908. int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  909. bool added_vif);
  910. #endif /* __IWL_MVM_H__ */