mvm.h 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489
  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. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  23. * USA
  24. *
  25. * The full GNU General Public License is included in this distribution
  26. * in the file called COPYING.
  27. *
  28. * Contact Information:
  29. * Intel Linux Wireless <ilw@linux.intel.com>
  30. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  31. *
  32. * BSD LICENSE
  33. *
  34. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  36. * All rights reserved.
  37. *
  38. * Redistribution and use in source and binary forms, with or without
  39. * modification, are permitted provided that the following conditions
  40. * are met:
  41. *
  42. * * Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * * Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in
  46. * the documentation and/or other materials provided with the
  47. * distribution.
  48. * * Neither the name Intel Corporation nor the names of its
  49. * contributors may be used to endorse or promote products derived
  50. * from this software without specific prior written permission.
  51. *
  52. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  53. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  54. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  55. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  56. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  57. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  58. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  59. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  60. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  61. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  62. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  63. *
  64. *****************************************************************************/
  65. #ifndef __IWL_MVM_H__
  66. #define __IWL_MVM_H__
  67. #include <linux/list.h>
  68. #include <linux/spinlock.h>
  69. #include <linux/leds.h>
  70. #include <linux/in6.h>
  71. #include "iwl-op-mode.h"
  72. #include "iwl-trans.h"
  73. #include "iwl-notif-wait.h"
  74. #include "iwl-eeprom-parse.h"
  75. #include "iwl-fw-file.h"
  76. #include "iwl-config.h"
  77. #include "sta.h"
  78. #include "fw-api.h"
  79. #include "constants.h"
  80. #include "tof.h"
  81. #define IWL_MVM_MAX_ADDRESSES 5
  82. /* RSSI offset for WkP */
  83. #define IWL_RSSI_OFFSET 50
  84. #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8
  85. /* A TimeUnit is 1024 microsecond */
  86. #define MSEC_TO_TU(_msec) (_msec*1000/1024)
  87. /* For GO, this value represents the number of TUs before CSA "beacon
  88. * 0" TBTT when the CSA time-event needs to be scheduled to start. It
  89. * must be big enough to ensure that we switch in time.
  90. */
  91. #define IWL_MVM_CHANNEL_SWITCH_TIME_GO 40
  92. /* For client, this value represents the number of TUs before CSA
  93. * "beacon 1" TBTT, instead. This is because we don't know when the
  94. * GO/AP will be in the new channel, so we switch early enough.
  95. */
  96. #define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 10
  97. /*
  98. * This value (in TUs) is used to fine tune the CSA NoA end time which should
  99. * be just before "beacon 0" TBTT.
  100. */
  101. #define IWL_MVM_CHANNEL_SWITCH_MARGIN 4
  102. /*
  103. * Number of beacons to transmit on a new channel until we unblock tx to
  104. * the stations, even if we didn't identify them on a new channel
  105. */
  106. #define IWL_MVM_CS_UNBLOCK_TX_TIMEOUT 3
  107. extern const struct ieee80211_ops iwl_mvm_hw_ops;
  108. /**
  109. * struct iwl_mvm_mod_params - module parameters for iwlmvm
  110. * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted.
  111. * We will register to mac80211 to have testmode working. The NIC must not
  112. * be up'ed after the INIT fw asserted. This is useful to be able to use
  113. * proprietary tools over testmode to debug the INIT fw.
  114. * @tfd_q_hang_detect: enabled the detection of hung transmit queues
  115. * @power_scheme: one of enum iwl_power_scheme
  116. */
  117. struct iwl_mvm_mod_params {
  118. bool init_dbg;
  119. bool tfd_q_hang_detect;
  120. int power_scheme;
  121. };
  122. extern struct iwl_mvm_mod_params iwlmvm_mod_params;
  123. /**
  124. * struct iwl_mvm_dump_ptrs - set of pointers needed for the fw-error-dump
  125. *
  126. * @op_mode_ptr: pointer to the buffer coming from the mvm op_mode
  127. * @trans_ptr: pointer to struct %iwl_trans_dump_data which contains the
  128. * transport's data.
  129. * @trans_len: length of the valid data in trans_ptr
  130. * @op_mode_len: length of the valid data in op_mode_ptr
  131. */
  132. struct iwl_mvm_dump_ptrs {
  133. struct iwl_trans_dump_data *trans_ptr;
  134. void *op_mode_ptr;
  135. u32 op_mode_len;
  136. };
  137. /**
  138. * struct iwl_mvm_dump_desc - describes the dump
  139. * @len: length of trig_desc->data
  140. * @trig_desc: the description of the dump
  141. */
  142. struct iwl_mvm_dump_desc {
  143. size_t len;
  144. /* must be last */
  145. struct iwl_fw_error_dump_trigger_desc trig_desc;
  146. };
  147. extern struct iwl_mvm_dump_desc iwl_mvm_dump_desc_assert;
  148. struct iwl_mvm_phy_ctxt {
  149. u16 id;
  150. u16 color;
  151. u32 ref;
  152. /*
  153. * TODO: This should probably be removed. Currently here only for rate
  154. * scaling algorithm
  155. */
  156. struct ieee80211_channel *channel;
  157. };
  158. struct iwl_mvm_time_event_data {
  159. struct ieee80211_vif *vif;
  160. struct list_head list;
  161. unsigned long end_jiffies;
  162. u32 duration;
  163. bool running;
  164. u32 uid;
  165. /*
  166. * The access to the 'id' field must be done when the
  167. * mvm->time_event_lock is held, as it value is used to indicate
  168. * if the te is in the time event list or not (when id == TE_MAX)
  169. */
  170. u32 id;
  171. };
  172. /* Power management */
  173. /**
  174. * enum iwl_power_scheme
  175. * @IWL_POWER_LEVEL_CAM - Continuously Active Mode
  176. * @IWL_POWER_LEVEL_BPS - Balanced Power Save (default)
  177. * @IWL_POWER_LEVEL_LP - Low Power
  178. */
  179. enum iwl_power_scheme {
  180. IWL_POWER_SCHEME_CAM = 1,
  181. IWL_POWER_SCHEME_BPS,
  182. IWL_POWER_SCHEME_LP
  183. };
  184. #define IWL_CONN_MAX_LISTEN_INTERVAL 10
  185. #define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_2
  186. #ifdef CONFIG_IWLWIFI_DEBUGFS
  187. enum iwl_dbgfs_pm_mask {
  188. MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0),
  189. MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1),
  190. MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2),
  191. MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3),
  192. MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4),
  193. MVM_DEBUGFS_PM_LPRX_ENA = BIT(6),
  194. MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7),
  195. MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8),
  196. MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9),
  197. MVM_DEBUGFS_PM_USE_PS_POLL = BIT(10),
  198. };
  199. struct iwl_dbgfs_pm {
  200. u16 keep_alive_seconds;
  201. u32 rx_data_timeout;
  202. u32 tx_data_timeout;
  203. bool skip_over_dtim;
  204. u8 skip_dtim_periods;
  205. bool lprx_ena;
  206. u32 lprx_rssi_threshold;
  207. bool snooze_ena;
  208. bool uapsd_misbehaving;
  209. bool use_ps_poll;
  210. int mask;
  211. };
  212. /* beacon filtering */
  213. enum iwl_dbgfs_bf_mask {
  214. MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0),
  215. MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1),
  216. MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2),
  217. MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3),
  218. MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4),
  219. MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5),
  220. MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6),
  221. MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7),
  222. MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8),
  223. MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9),
  224. MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10),
  225. };
  226. struct iwl_dbgfs_bf {
  227. u32 bf_energy_delta;
  228. u32 bf_roaming_energy_delta;
  229. u32 bf_roaming_state;
  230. u32 bf_temp_threshold;
  231. u32 bf_temp_fast_filter;
  232. u32 bf_temp_slow_filter;
  233. u32 bf_enable_beacon_filter;
  234. u32 bf_debug_flag;
  235. u32 bf_escape_timer;
  236. u32 ba_escape_timer;
  237. u32 ba_enable_beacon_abort;
  238. int mask;
  239. };
  240. #endif
  241. enum iwl_mvm_smps_type_request {
  242. IWL_MVM_SMPS_REQ_BT_COEX,
  243. IWL_MVM_SMPS_REQ_TT,
  244. IWL_MVM_SMPS_REQ_PROT,
  245. NUM_IWL_MVM_SMPS_REQ,
  246. };
  247. enum iwl_mvm_ref_type {
  248. IWL_MVM_REF_UCODE_DOWN,
  249. IWL_MVM_REF_SCAN,
  250. IWL_MVM_REF_ROC,
  251. IWL_MVM_REF_ROC_AUX,
  252. IWL_MVM_REF_P2P_CLIENT,
  253. IWL_MVM_REF_AP_IBSS,
  254. IWL_MVM_REF_USER,
  255. IWL_MVM_REF_TX,
  256. IWL_MVM_REF_TX_AGG,
  257. IWL_MVM_REF_ADD_IF,
  258. IWL_MVM_REF_START_AP,
  259. IWL_MVM_REF_BSS_CHANGED,
  260. IWL_MVM_REF_PREPARE_TX,
  261. IWL_MVM_REF_PROTECT_TDLS,
  262. IWL_MVM_REF_CHECK_CTKILL,
  263. IWL_MVM_REF_PRPH_READ,
  264. IWL_MVM_REF_PRPH_WRITE,
  265. IWL_MVM_REF_NMI,
  266. IWL_MVM_REF_TM_CMD,
  267. IWL_MVM_REF_EXIT_WORK,
  268. IWL_MVM_REF_PROTECT_CSA,
  269. IWL_MVM_REF_FW_DBG_COLLECT,
  270. /* update debugfs.c when changing this */
  271. IWL_MVM_REF_COUNT,
  272. };
  273. enum iwl_bt_force_ant_mode {
  274. BT_FORCE_ANT_DIS = 0,
  275. BT_FORCE_ANT_AUTO,
  276. BT_FORCE_ANT_BT,
  277. BT_FORCE_ANT_WIFI,
  278. BT_FORCE_ANT_MAX,
  279. };
  280. /**
  281. * struct iwl_mvm_vif_bf_data - beacon filtering related data
  282. * @bf_enabled: indicates if beacon filtering is enabled
  283. * @ba_enabled: indicated if beacon abort is enabled
  284. * @ave_beacon_signal: average beacon signal
  285. * @last_cqm_event: rssi of the last cqm event
  286. * @bt_coex_min_thold: minimum threshold for BT coex
  287. * @bt_coex_max_thold: maximum threshold for BT coex
  288. * @last_bt_coex_event: rssi of the last BT coex event
  289. */
  290. struct iwl_mvm_vif_bf_data {
  291. bool bf_enabled;
  292. bool ba_enabled;
  293. int ave_beacon_signal;
  294. int last_cqm_event;
  295. int bt_coex_min_thold;
  296. int bt_coex_max_thold;
  297. int last_bt_coex_event;
  298. };
  299. /**
  300. * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
  301. * @id: between 0 and 3
  302. * @color: to solve races upon MAC addition and removal
  303. * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA
  304. * @bssid: BSSID for this (client) interface
  305. * @associated: indicates that we're currently associated, used only for
  306. * managing the firmware state in iwl_mvm_bss_info_changed_station()
  307. * @ap_assoc_sta_count: count of stations associated to us - valid only
  308. * if VIF type is AP
  309. * @uploaded: indicates the MAC context has been added to the device
  310. * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface
  311. * should get quota etc.
  312. * @pm_enabled - Indicate if MAC power management is allowed
  313. * @monitor_active: indicates that monitor context is configured, and that the
  314. * interface should get quota etc.
  315. * @low_latency: indicates that this interface is in low-latency mode
  316. * (VMACLowLatencyMode)
  317. * @ps_disabled: indicates that this interface requires PS to be disabled
  318. * @queue_params: QoS params for this MAC
  319. * @bcast_sta: station used for broadcast packets. Used by the following
  320. * vifs: P2P_DEVICE, GO and AP.
  321. * @beacon_skb: the skb used to hold the AP/GO beacon template
  322. * @smps_requests: the SMPS requests of different parts of the driver,
  323. * combined on update to yield the overall request to mac80211.
  324. * @beacon_stats: beacon statistics, containing the # of received beacons,
  325. * # of received beacons accumulated over FW restart, and the current
  326. * average signal of beacons retrieved from the firmware
  327. * @csa_failed: CSA failed to schedule time event, report an error later
  328. * @features: hw features active for this vif
  329. */
  330. struct iwl_mvm_vif {
  331. struct iwl_mvm *mvm;
  332. u16 id;
  333. u16 color;
  334. u8 ap_sta_id;
  335. u8 bssid[ETH_ALEN];
  336. bool associated;
  337. u8 ap_assoc_sta_count;
  338. bool uploaded;
  339. bool ap_ibss_active;
  340. bool pm_enabled;
  341. bool monitor_active;
  342. bool low_latency;
  343. bool ps_disabled;
  344. struct iwl_mvm_vif_bf_data bf_data;
  345. struct {
  346. u32 num_beacons, accu_num_beacons;
  347. u8 avg_signal;
  348. } beacon_stats;
  349. u32 ap_beacon_time;
  350. enum iwl_tsf_id tsf_id;
  351. /*
  352. * QoS data from mac80211, need to store this here
  353. * as mac80211 has a separate callback but we need
  354. * to have the data for the MAC context
  355. */
  356. struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
  357. struct iwl_mvm_time_event_data time_event_data;
  358. struct iwl_mvm_time_event_data hs_time_event_data;
  359. struct iwl_mvm_int_sta bcast_sta;
  360. /*
  361. * Assigned while mac80211 has the interface in a channel context,
  362. * or, for P2P Device, while it exists.
  363. */
  364. struct iwl_mvm_phy_ctxt *phy_ctxt;
  365. #ifdef CONFIG_PM_SLEEP
  366. /* WoWLAN GTK rekey data */
  367. struct {
  368. u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
  369. __le64 replay_ctr;
  370. bool valid;
  371. } rekey_data;
  372. int tx_key_idx;
  373. bool seqno_valid;
  374. u16 seqno;
  375. #endif
  376. #if IS_ENABLED(CONFIG_IPV6)
  377. /* IPv6 addresses for WoWLAN */
  378. struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX];
  379. int num_target_ipv6_addrs;
  380. #endif
  381. #ifdef CONFIG_IWLWIFI_DEBUGFS
  382. struct dentry *dbgfs_dir;
  383. struct dentry *dbgfs_slink;
  384. struct iwl_dbgfs_pm dbgfs_pm;
  385. struct iwl_dbgfs_bf dbgfs_bf;
  386. struct iwl_mac_power_cmd mac_pwr_cmd;
  387. #endif
  388. enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];
  389. /* FW identified misbehaving AP */
  390. u8 uapsd_misbehaving_bssid[ETH_ALEN];
  391. /* Indicates that CSA countdown may be started */
  392. bool csa_countdown;
  393. bool csa_failed;
  394. /* TCP Checksum Offload */
  395. netdev_features_t features;
  396. };
  397. static inline struct iwl_mvm_vif *
  398. iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
  399. {
  400. return (void *)vif->drv_priv;
  401. }
  402. extern const u8 tid_to_mac80211_ac[];
  403. #define IWL_MVM_SCAN_STOPPING_SHIFT 8
  404. enum iwl_scan_status {
  405. IWL_MVM_SCAN_REGULAR = BIT(0),
  406. IWL_MVM_SCAN_SCHED = BIT(1),
  407. IWL_MVM_SCAN_NETDETECT = BIT(2),
  408. IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8),
  409. IWL_MVM_SCAN_STOPPING_SCHED = BIT(9),
  410. IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10),
  411. IWL_MVM_SCAN_REGULAR_MASK = IWL_MVM_SCAN_REGULAR |
  412. IWL_MVM_SCAN_STOPPING_REGULAR,
  413. IWL_MVM_SCAN_SCHED_MASK = IWL_MVM_SCAN_SCHED |
  414. IWL_MVM_SCAN_STOPPING_SCHED,
  415. IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT |
  416. IWL_MVM_SCAN_STOPPING_NETDETECT,
  417. IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT,
  418. IWL_MVM_SCAN_MASK = 0xff,
  419. };
  420. /**
  421. * struct iwl_nvm_section - describes an NVM section in memory.
  422. *
  423. * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,
  424. * and saved for later use by the driver. Not all NVM sections are saved
  425. * this way, only the needed ones.
  426. */
  427. struct iwl_nvm_section {
  428. u16 length;
  429. const u8 *data;
  430. };
  431. /**
  432. * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure
  433. * @ct_kill_exit: worker to exit thermal kill
  434. * @dynamic_smps: Is thermal throttling enabled dynamic_smps?
  435. * @tx_backoff: The current thremal throttling tx backoff in uSec.
  436. * @min_backoff: The minimal tx backoff due to power restrictions
  437. * @params: Parameters to configure the thermal throttling algorithm.
  438. * @throttle: Is thermal throttling is active?
  439. */
  440. struct iwl_mvm_tt_mgmt {
  441. struct delayed_work ct_kill_exit;
  442. bool dynamic_smps;
  443. u32 tx_backoff;
  444. u32 min_backoff;
  445. struct iwl_tt_params params;
  446. bool throttle;
  447. };
  448. #define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8
  449. struct iwl_mvm_frame_stats {
  450. u32 legacy_frames;
  451. u32 ht_frames;
  452. u32 vht_frames;
  453. u32 bw_20_frames;
  454. u32 bw_40_frames;
  455. u32 bw_80_frames;
  456. u32 bw_160_frames;
  457. u32 sgi_frames;
  458. u32 ngi_frames;
  459. u32 siso_frames;
  460. u32 mimo2_frames;
  461. u32 agg_frames;
  462. u32 ampdu_count;
  463. u32 success_frames;
  464. u32 fail_frames;
  465. u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES];
  466. int last_frame_idx;
  467. };
  468. enum {
  469. D0I3_DEFER_WAKEUP,
  470. D0I3_PENDING_WAKEUP,
  471. };
  472. #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff
  473. #define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100
  474. #define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200
  475. enum iwl_mvm_tdls_cs_state {
  476. IWL_MVM_TDLS_SW_IDLE = 0,
  477. IWL_MVM_TDLS_SW_REQ_SENT,
  478. IWL_MVM_TDLS_SW_RESP_RCVD,
  479. IWL_MVM_TDLS_SW_REQ_RCVD,
  480. IWL_MVM_TDLS_SW_ACTIVE,
  481. };
  482. struct iwl_mvm_shared_mem_cfg {
  483. u32 shared_mem_addr;
  484. u32 shared_mem_size;
  485. u32 sample_buff_addr;
  486. u32 sample_buff_size;
  487. u32 txfifo_addr;
  488. u32 txfifo_size[TX_FIFO_MAX_NUM];
  489. u32 rxfifo_size[RX_FIFO_MAX_NUM];
  490. u32 page_buff_addr;
  491. u32 page_buff_size;
  492. };
  493. struct iwl_mvm {
  494. /* for logger access */
  495. struct device *dev;
  496. struct iwl_trans *trans;
  497. const struct iwl_fw *fw;
  498. const struct iwl_cfg *cfg;
  499. struct iwl_phy_db *phy_db;
  500. struct ieee80211_hw *hw;
  501. /* for protecting access to iwl_mvm */
  502. struct mutex mutex;
  503. struct list_head async_handlers_list;
  504. spinlock_t async_handlers_lock;
  505. struct work_struct async_handlers_wk;
  506. struct work_struct roc_done_wk;
  507. unsigned long status;
  508. /*
  509. * for beacon filtering -
  510. * currently only one interface can be supported
  511. */
  512. struct iwl_mvm_vif *bf_allowed_vif;
  513. enum iwl_ucode_type cur_ucode;
  514. bool ucode_loaded;
  515. bool calibrating;
  516. u32 error_event_table;
  517. u32 log_event_table;
  518. u32 umac_error_event_table;
  519. bool support_umac_log;
  520. struct iwl_sf_region sf_space;
  521. u32 ampdu_ref;
  522. struct iwl_notif_wait_data notif_wait;
  523. struct mvm_statistics_rx rx_stats;
  524. struct {
  525. u64 rx_time;
  526. u64 tx_time;
  527. u64 on_time_rf;
  528. u64 on_time_scan;
  529. } radio_stats, accu_radio_stats;
  530. struct {
  531. /* Map to HW queue */
  532. u32 hw_queue_to_mac80211;
  533. u8 hw_queue_refcount;
  534. bool setup_reserved;
  535. u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */
  536. } queue_info[IWL_MAX_HW_QUEUES];
  537. spinlock_t queue_info_lock; /* For syncing queue mgmt operations */
  538. atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES];
  539. const char *nvm_file_name;
  540. struct iwl_nvm_data *nvm_data;
  541. /* NVM sections */
  542. struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS];
  543. /* Paging section */
  544. struct iwl_fw_paging fw_paging_db[NUM_OF_FW_PAGING_BLOCKS];
  545. u16 num_of_paging_blk;
  546. u16 num_of_pages_in_last_blk;
  547. /* EEPROM MAC addresses */
  548. struct mac_address addresses[IWL_MVM_MAX_ADDRESSES];
  549. /* data related to data path */
  550. struct iwl_rx_phy_info last_phy_info;
  551. struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT];
  552. struct work_struct sta_drained_wk;
  553. unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
  554. atomic_t pending_frames[IWL_MVM_STATION_COUNT];
  555. u32 tfd_drained[IWL_MVM_STATION_COUNT];
  556. u8 rx_ba_sessions;
  557. /* configured by mac80211 */
  558. u32 rts_threshold;
  559. /* Scan status, cmd (pre-allocated) and auxiliary station */
  560. unsigned int scan_status;
  561. void *scan_cmd;
  562. struct iwl_mcast_filter_cmd *mcast_filter_cmd;
  563. bool scan_fragmented;
  564. /* max number of simultaneous scans the FW supports */
  565. unsigned int max_scans;
  566. /* UMAC scan tracking */
  567. u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS];
  568. /* rx chain antennas set through debugfs for the scan command */
  569. u8 scan_rx_ant;
  570. #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
  571. /* broadcast filters to configure for each associated station */
  572. const struct iwl_fw_bcast_filter *bcast_filters;
  573. #ifdef CONFIG_IWLWIFI_DEBUGFS
  574. struct {
  575. bool override;
  576. struct iwl_bcast_filter_cmd cmd;
  577. } dbgfs_bcast_filtering;
  578. #endif
  579. #endif
  580. /* Internal station */
  581. struct iwl_mvm_int_sta aux_sta;
  582. bool last_ebs_successful;
  583. u8 scan_last_antenna_idx; /* to toggle TX between antennas */
  584. u8 mgmt_last_antenna_idx;
  585. /* last smart fifo state that was successfully sent to firmware */
  586. enum iwl_sf_state sf_state;
  587. #ifdef CONFIG_IWLWIFI_DEBUGFS
  588. struct dentry *debugfs_dir;
  589. u32 dbgfs_sram_offset, dbgfs_sram_len;
  590. u32 dbgfs_prph_reg_addr;
  591. bool disable_power_off;
  592. bool disable_power_off_d3;
  593. bool scan_iter_notif_enabled;
  594. struct debugfs_blob_wrapper nvm_hw_blob;
  595. struct debugfs_blob_wrapper nvm_sw_blob;
  596. struct debugfs_blob_wrapper nvm_calib_blob;
  597. struct debugfs_blob_wrapper nvm_prod_blob;
  598. struct debugfs_blob_wrapper nvm_phy_sku_blob;
  599. struct iwl_mvm_frame_stats drv_rx_stats;
  600. spinlock_t drv_stats_lock;
  601. u16 dbgfs_rx_phyinfo;
  602. #endif
  603. struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];
  604. struct list_head time_event_list;
  605. spinlock_t time_event_lock;
  606. /*
  607. * A bitmap indicating the index of the key in use. The firmware
  608. * can hold 16 keys at most. Reflect this fact.
  609. */
  610. unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)];
  611. u8 fw_key_deleted[STA_KEY_MAX_NUM];
  612. /* references taken by the driver and spinlock protecting them */
  613. spinlock_t refs_lock;
  614. u8 refs[IWL_MVM_REF_COUNT];
  615. u8 vif_count;
  616. /* -1 for always, 0 for never, >0 for that many times */
  617. s8 restart_fw;
  618. u8 fw_dbg_conf;
  619. struct delayed_work fw_dump_wk;
  620. struct iwl_mvm_dump_desc *fw_dump_desc;
  621. struct iwl_fw_dbg_trigger_tlv *fw_dump_trig;
  622. #ifdef CONFIG_IWLWIFI_LEDS
  623. struct led_classdev led;
  624. #endif
  625. struct ieee80211_vif *p2p_device_vif;
  626. #ifdef CONFIG_PM_SLEEP
  627. struct wiphy_wowlan_support wowlan;
  628. int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
  629. /* sched scan settings for net detect */
  630. struct ieee80211_scan_ies nd_ies;
  631. struct cfg80211_match_set *nd_match_sets;
  632. int n_nd_match_sets;
  633. struct ieee80211_channel **nd_channels;
  634. int n_nd_channels;
  635. bool net_detect;
  636. #ifdef CONFIG_IWLWIFI_DEBUGFS
  637. bool d3_wake_sysassert;
  638. bool d3_test_active;
  639. bool store_d3_resume_sram;
  640. void *d3_resume_sram;
  641. u32 d3_test_pme_ptr;
  642. struct ieee80211_vif *keep_vif;
  643. u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */
  644. #endif
  645. #endif
  646. /* d0i3 */
  647. u8 d0i3_ap_sta_id;
  648. bool d0i3_offloading;
  649. struct work_struct d0i3_exit_work;
  650. struct sk_buff_head d0i3_tx;
  651. /* protect d0i3_suspend_flags */
  652. struct mutex d0i3_suspend_mutex;
  653. unsigned long d0i3_suspend_flags;
  654. /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */
  655. spinlock_t d0i3_tx_lock;
  656. wait_queue_head_t d0i3_exit_waitq;
  657. /* BT-Coex */
  658. u8 bt_ack_kill_msk[NUM_PHY_CTX];
  659. u8 bt_cts_kill_msk[NUM_PHY_CTX];
  660. struct iwl_bt_coex_profile_notif_old last_bt_notif_old;
  661. struct iwl_bt_coex_ci_cmd_old last_bt_ci_cmd_old;
  662. struct iwl_bt_coex_profile_notif last_bt_notif;
  663. struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
  664. u32 last_ant_isol;
  665. u8 last_corun_lut;
  666. u8 bt_tx_prio;
  667. enum iwl_bt_force_ant_mode bt_force_ant_mode;
  668. /* Aux ROC */
  669. struct list_head aux_roc_te_list;
  670. /* Thermal Throttling and CTkill */
  671. struct iwl_mvm_tt_mgmt thermal_throttle;
  672. s32 temperature; /* Celsius */
  673. /*
  674. * Debug option to set the NIC temperature. This option makes the
  675. * driver think this is the actual NIC temperature, and ignore the
  676. * real temperature that is received from the fw
  677. */
  678. bool temperature_test; /* Debug test temperature is enabled */
  679. struct iwl_time_quota_cmd last_quota_cmd;
  680. #ifdef CONFIG_NL80211_TESTMODE
  681. u32 noa_duration;
  682. struct ieee80211_vif *noa_vif;
  683. #endif
  684. /* Tx queues */
  685. u8 aux_queue;
  686. u8 first_agg_queue;
  687. u8 last_agg_queue;
  688. /* Indicate if device power save is allowed */
  689. u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */
  690. struct ieee80211_vif __rcu *csa_vif;
  691. struct ieee80211_vif __rcu *csa_tx_blocked_vif;
  692. u8 csa_tx_block_bcn_timeout;
  693. /* system time of last beacon (for AP/GO interface) */
  694. u32 ap_last_beacon_gp2;
  695. bool lar_regdom_set;
  696. enum iwl_mcc_source mcc_src;
  697. /* TDLS channel switch data */
  698. struct {
  699. struct delayed_work dwork;
  700. enum iwl_mvm_tdls_cs_state state;
  701. /*
  702. * Current cs sta - might be different from periodic cs peer
  703. * station. Value is meaningless when the cs-state is idle.
  704. */
  705. u8 cur_sta_id;
  706. /* TDLS periodic channel-switch peer */
  707. struct {
  708. u8 sta_id;
  709. u8 op_class;
  710. bool initiator; /* are we the link initiator */
  711. struct cfg80211_chan_def chandef;
  712. struct sk_buff *skb; /* ch sw template */
  713. u32 ch_sw_tm_ie;
  714. /* timestamp of last ch-sw request sent (GP2 time) */
  715. u32 sent_timestamp;
  716. } peer;
  717. } tdls_cs;
  718. struct iwl_mvm_shared_mem_cfg shared_mem_cfg;
  719. u32 ciphers[6];
  720. struct iwl_mvm_tof_data tof_data;
  721. };
  722. /* Extract MVM priv from op_mode and _hw */
  723. #define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \
  724. ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific)
  725. #define IWL_MAC80211_GET_MVM(_hw) \
  726. IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv))
  727. enum iwl_mvm_status {
  728. IWL_MVM_STATUS_HW_RFKILL,
  729. IWL_MVM_STATUS_HW_CTKILL,
  730. IWL_MVM_STATUS_ROC_RUNNING,
  731. IWL_MVM_STATUS_IN_HW_RESTART,
  732. IWL_MVM_STATUS_IN_D0I3,
  733. IWL_MVM_STATUS_ROC_AUX_RUNNING,
  734. IWL_MVM_STATUS_D3_RECONFIG,
  735. IWL_MVM_STATUS_DUMPING_FW_LOG,
  736. };
  737. static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
  738. {
  739. return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) ||
  740. test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
  741. }
  742. static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
  743. {
  744. return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
  745. }
  746. /* Must be called with rcu_read_lock() held and it can only be
  747. * released when mvmsta is not needed anymore.
  748. */
  749. static inline struct iwl_mvm_sta *
  750. iwl_mvm_sta_from_staid_rcu(struct iwl_mvm *mvm, u8 sta_id)
  751. {
  752. struct ieee80211_sta *sta;
  753. if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
  754. return NULL;
  755. sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
  756. /* This can happen if the station has been removed right now */
  757. if (IS_ERR_OR_NULL(sta))
  758. return NULL;
  759. return iwl_mvm_sta_from_mac80211(sta);
  760. }
  761. static inline struct iwl_mvm_sta *
  762. iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id)
  763. {
  764. struct ieee80211_sta *sta;
  765. if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
  766. return NULL;
  767. sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
  768. lockdep_is_held(&mvm->mutex));
  769. /* This can happen if the station has been removed right now */
  770. if (IS_ERR_OR_NULL(sta))
  771. return NULL;
  772. return iwl_mvm_sta_from_mac80211(sta);
  773. }
  774. static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm)
  775. {
  776. return !iwlwifi_mod_params.d0i3_disable &&
  777. fw_has_capa(&mvm->fw->ucode_capa,
  778. IWL_UCODE_TLV_CAPA_D0I3_SUPPORT);
  779. }
  780. static inline bool iwl_mvm_is_dqa_supported(struct iwl_mvm *mvm)
  781. {
  782. return fw_has_capa(&mvm->fw->ucode_capa,
  783. IWL_UCODE_TLV_CAPA_DQA_SUPPORT);
  784. }
  785. static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
  786. {
  787. bool nvm_lar = mvm->nvm_data->lar_enabled;
  788. bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
  789. IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
  790. if (iwlwifi_mod_params.lar_disable)
  791. return false;
  792. /*
  793. * Enable LAR only if it is supported by the FW (TLV) &&
  794. * enabled in the NVM
  795. */
  796. if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_8000)
  797. return nvm_lar && tlv_lar;
  798. else
  799. return tlv_lar;
  800. }
  801. static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm)
  802. {
  803. return fw_has_api(&mvm->fw->ucode_capa,
  804. IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
  805. fw_has_capa(&mvm->fw->ucode_capa,
  806. IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC);
  807. }
  808. static inline bool iwl_mvm_bt_is_plcr_supported(struct iwl_mvm *mvm)
  809. {
  810. return fw_has_capa(&mvm->fw->ucode_capa,
  811. IWL_UCODE_TLV_CAPA_BT_COEX_PLCR) &&
  812. IWL_MVM_BT_COEX_CORUNNING;
  813. }
  814. static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm)
  815. {
  816. return fw_has_capa(&mvm->fw->ucode_capa,
  817. IWL_UCODE_TLV_CAPA_BT_COEX_RRC) &&
  818. IWL_MVM_BT_COEX_RRC;
  819. }
  820. static inline bool iwl_mvm_is_csum_supported(struct iwl_mvm *mvm)
  821. {
  822. return fw_has_capa(&mvm->fw->ucode_capa,
  823. IWL_UCODE_TLV_CAPA_CSUM_SUPPORT);
  824. }
  825. static inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm)
  826. {
  827. return fw_has_capa(&mvm->fw->ucode_capa,
  828. IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT) &&
  829. IWL_MVM_BT_COEX_MPLUT;
  830. }
  831. static inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm)
  832. {
  833. /* firmware flag isn't defined yet */
  834. return false;
  835. }
  836. extern const u8 iwl_mvm_ac_to_tx_fifo[];
  837. struct iwl_rate_info {
  838. u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
  839. u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
  840. u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */
  841. u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */
  842. u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */
  843. };
  844. void __iwl_mvm_mac_stop(struct iwl_mvm *mvm);
  845. int __iwl_mvm_mac_start(struct iwl_mvm *mvm);
  846. /******************
  847. * MVM Methods
  848. ******************/
  849. /* uCode */
  850. int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
  851. /* Utils */
  852. int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
  853. enum ieee80211_band band);
  854. void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
  855. enum ieee80211_band band,
  856. struct ieee80211_tx_rate *r);
  857. u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
  858. void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
  859. u8 first_antenna(u8 mask);
  860. u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
  861. /* Tx / Host Commands */
  862. int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
  863. struct iwl_host_cmd *cmd);
  864. int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id,
  865. u32 flags, u16 len, const void *data);
  866. int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm,
  867. struct iwl_host_cmd *cmd,
  868. u32 *status);
  869. int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id,
  870. u16 len, const void *data,
  871. u32 *status);
  872. int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
  873. struct ieee80211_sta *sta);
  874. int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb);
  875. void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
  876. struct iwl_tx_cmd *tx_cmd,
  877. struct ieee80211_tx_info *info, u8 sta_id);
  878. void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
  879. struct ieee80211_tx_info *info,
  880. struct ieee80211_sta *sta, __le16 fc);
  881. #ifdef CONFIG_IWLWIFI_DEBUG
  882. const char *iwl_mvm_get_tx_fail_reason(u32 status);
  883. #else
  884. static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
  885. #endif
  886. int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
  887. void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
  888. static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info,
  889. struct iwl_tx_cmd *tx_cmd)
  890. {
  891. struct ieee80211_key_conf *keyconf = info->control.hw_key;
  892. tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
  893. memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
  894. if (info->flags & IEEE80211_TX_CTL_AMPDU)
  895. tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_CCMP_AGG);
  896. }
  897. static inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm)
  898. {
  899. flush_work(&mvm->async_handlers_wk);
  900. }
  901. /* Statistics */
  902. void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
  903. struct iwl_rx_packet *pkt);
  904. void iwl_mvm_rx_statistics(struct iwl_mvm *mvm,
  905. struct iwl_rx_cmd_buffer *rxb);
  906. int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear);
  907. void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm);
  908. /* NVM */
  909. int iwl_nvm_init(struct iwl_mvm *mvm, bool read_nvm_from_nic);
  910. int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);
  911. static inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm)
  912. {
  913. return mvm->nvm_data && mvm->nvm_data->valid_tx_ant ?
  914. mvm->fw->valid_tx_ant & mvm->nvm_data->valid_tx_ant :
  915. mvm->fw->valid_tx_ant;
  916. }
  917. static inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm)
  918. {
  919. return mvm->nvm_data && mvm->nvm_data->valid_rx_ant ?
  920. mvm->fw->valid_rx_ant & mvm->nvm_data->valid_rx_ant :
  921. mvm->fw->valid_rx_ant;
  922. }
  923. static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm)
  924. {
  925. u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN |
  926. FW_PHY_CFG_RX_CHAIN);
  927. u32 valid_rx_ant = iwl_mvm_get_valid_rx_ant(mvm);
  928. u32 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm);
  929. phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS |
  930. valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS;
  931. return mvm->fw->phy_config & phy_config;
  932. }
  933. int iwl_mvm_up(struct iwl_mvm *mvm);
  934. int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);
  935. int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm);
  936. bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
  937. struct iwl_bcast_filter_cmd *cmd);
  938. /*
  939. * FW notifications / CMD responses handlers
  940. * Convention: iwl_mvm_rx_<NAME OF THE CMD>
  941. */
  942. void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  943. void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
  944. struct iwl_rx_cmd_buffer *rxb);
  945. void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  946. void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  947. void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
  948. struct iwl_rx_cmd_buffer *rxb);
  949. void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  950. void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
  951. struct iwl_rx_cmd_buffer *rxb);
  952. void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,
  953. struct iwl_rx_cmd_buffer *rxb);
  954. void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm,
  955. struct iwl_rx_cmd_buffer *rxb);
  956. /* MVM PHY */
  957. int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  958. struct cfg80211_chan_def *chandef,
  959. u8 chains_static, u8 chains_dynamic);
  960. int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  961. struct cfg80211_chan_def *chandef,
  962. u8 chains_static, u8 chains_dynamic);
  963. void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm,
  964. struct iwl_mvm_phy_ctxt *ctxt);
  965. void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm,
  966. struct iwl_mvm_phy_ctxt *ctxt);
  967. int iwl_mvm_phy_ctx_count(struct iwl_mvm *mvm);
  968. u8 iwl_mvm_get_channel_width(struct cfg80211_chan_def *chandef);
  969. u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef);
  970. /* MAC (virtual interface) programming */
  971. int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  972. void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  973. int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  974. int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  975. bool force_assoc_off, const u8 *bssid_override);
  976. int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  977. u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif);
  978. int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
  979. struct ieee80211_vif *vif);
  980. void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
  981. struct iwl_rx_cmd_buffer *rxb);
  982. void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
  983. struct iwl_rx_cmd_buffer *rxb);
  984. void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,
  985. struct ieee80211_vif *vif);
  986. unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm,
  987. struct ieee80211_vif *exclude_vif);
  988. /* Bindings */
  989. int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  990. int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  991. /* Quota management */
  992. int iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload,
  993. struct ieee80211_vif *disabled_vif);
  994. /* Scanning */
  995. int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  996. struct cfg80211_scan_request *req,
  997. struct ieee80211_scan_ies *ies);
  998. int iwl_mvm_scan_size(struct iwl_mvm *mvm);
  999. int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);
  1000. int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
  1001. void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
  1002. /* Scheduled scan */
  1003. void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
  1004. struct iwl_rx_cmd_buffer *rxb);
  1005. void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm,
  1006. struct iwl_rx_cmd_buffer *rxb);
  1007. int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
  1008. struct ieee80211_vif *vif,
  1009. struct cfg80211_sched_scan_request *req,
  1010. struct ieee80211_scan_ies *ies,
  1011. int type);
  1012. void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,
  1013. struct iwl_rx_cmd_buffer *rxb);
  1014. /* UMAC scan */
  1015. int iwl_mvm_config_scan(struct iwl_mvm *mvm);
  1016. void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
  1017. struct iwl_rx_cmd_buffer *rxb);
  1018. void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
  1019. struct iwl_rx_cmd_buffer *rxb);
  1020. /* MVM debugfs */
  1021. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1022. int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir);
  1023. void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1024. void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1025. #else
  1026. static inline int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm,
  1027. struct dentry *dbgfs_dir)
  1028. {
  1029. return 0;
  1030. }
  1031. static inline void
  1032. iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1033. {
  1034. }
  1035. static inline void
  1036. iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1037. {
  1038. }
  1039. #endif /* CONFIG_IWLWIFI_DEBUGFS */
  1040. /* rate scaling */
  1041. int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init);
  1042. void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg);
  1043. int rs_pretty_print_rate(char *buf, const u32 rate);
  1044. void rs_update_last_rssi(struct iwl_mvm *mvm,
  1045. struct iwl_lq_sta *lq_sta,
  1046. struct ieee80211_rx_status *rx_status);
  1047. /* power management */
  1048. int iwl_mvm_power_update_device(struct iwl_mvm *mvm);
  1049. int iwl_mvm_power_update_mac(struct iwl_mvm *mvm);
  1050. int iwl_mvm_power_update_ps(struct iwl_mvm *mvm);
  1051. int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1052. char *buf, int bufsz);
  1053. void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1054. void iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm,
  1055. struct iwl_rx_cmd_buffer *rxb);
  1056. #ifdef CONFIG_IWLWIFI_LEDS
  1057. int iwl_mvm_leds_init(struct iwl_mvm *mvm);
  1058. void iwl_mvm_leds_exit(struct iwl_mvm *mvm);
  1059. #else
  1060. static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm)
  1061. {
  1062. return 0;
  1063. }
  1064. static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm)
  1065. {
  1066. }
  1067. #endif
  1068. /* D3 (WoWLAN, NetDetect) */
  1069. int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
  1070. int iwl_mvm_resume(struct ieee80211_hw *hw);
  1071. void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled);
  1072. void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
  1073. struct ieee80211_vif *vif,
  1074. struct cfg80211_gtk_rekey_data *data);
  1075. void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw,
  1076. struct ieee80211_vif *vif,
  1077. struct inet6_dev *idev);
  1078. void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,
  1079. struct ieee80211_vif *vif, int idx);
  1080. extern const struct file_operations iwl_dbgfs_d3_test_ops;
  1081. #ifdef CONFIG_PM_SLEEP
  1082. void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,
  1083. struct ieee80211_vif *vif);
  1084. #else
  1085. static inline void
  1086. iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1087. {
  1088. }
  1089. #endif
  1090. void iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta,
  1091. struct iwl_wowlan_config_cmd *cmd);
  1092. int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
  1093. struct ieee80211_vif *vif,
  1094. bool disable_offloading,
  1095. u32 cmd_flags);
  1096. /* D0i3 */
  1097. void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1098. void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1099. int iwl_mvm_ref_sync(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1100. bool iwl_mvm_ref_taken(struct iwl_mvm *mvm);
  1101. void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq);
  1102. int iwl_mvm_enter_d0i3(struct iwl_op_mode *op_mode);
  1103. int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode);
  1104. int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm);
  1105. /* BT Coex */
  1106. int iwl_send_bt_init_conf(struct iwl_mvm *mvm);
  1107. void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
  1108. struct iwl_rx_cmd_buffer *rxb);
  1109. void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1110. enum ieee80211_rssi_event_data);
  1111. void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);
  1112. u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
  1113. struct ieee80211_sta *sta);
  1114. bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
  1115. struct ieee80211_sta *sta);
  1116. bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant);
  1117. bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm);
  1118. bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
  1119. enum ieee80211_band band);
  1120. u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
  1121. struct ieee80211_tx_info *info, u8 ac);
  1122. bool iwl_mvm_bt_coex_is_shared_ant_avail_old(struct iwl_mvm *mvm);
  1123. void iwl_mvm_bt_coex_vif_change_old(struct iwl_mvm *mvm);
  1124. int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm);
  1125. void iwl_mvm_rx_bt_coex_notif_old(struct iwl_mvm *mvm,
  1126. struct iwl_rx_cmd_buffer *rxb);
  1127. void iwl_mvm_bt_rssi_event_old(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1128. enum ieee80211_rssi_event_data);
  1129. u16 iwl_mvm_coex_agg_time_limit_old(struct iwl_mvm *mvm,
  1130. struct ieee80211_sta *sta);
  1131. bool iwl_mvm_bt_coex_is_mimo_allowed_old(struct iwl_mvm *mvm,
  1132. struct ieee80211_sta *sta);
  1133. bool iwl_mvm_bt_coex_is_tpc_allowed_old(struct iwl_mvm *mvm,
  1134. enum ieee80211_band band);
  1135. void iwl_mvm_rx_ant_coupling_notif_old(struct iwl_mvm *mvm,
  1136. struct iwl_rx_cmd_buffer *rxb);
  1137. /* beacon filtering */
  1138. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1139. void
  1140. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  1141. struct iwl_beacon_filter_cmd *cmd);
  1142. #else
  1143. static inline void
  1144. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  1145. struct iwl_beacon_filter_cmd *cmd)
  1146. {}
  1147. #endif
  1148. int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
  1149. struct ieee80211_vif *vif,
  1150. bool enable, u32 flags);
  1151. int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
  1152. struct ieee80211_vif *vif,
  1153. u32 flags);
  1154. int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
  1155. struct ieee80211_vif *vif,
  1156. u32 flags);
  1157. /* SMPS */
  1158. void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1159. enum iwl_mvm_smps_type_request req_type,
  1160. enum ieee80211_smps_mode smps_request);
  1161. bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm);
  1162. /* Low latency */
  1163. int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1164. bool value);
  1165. /* get SystemLowLatencyMode - only needed for beacon threshold? */
  1166. bool iwl_mvm_low_latency(struct iwl_mvm *mvm);
  1167. /* get VMACLowLatencyMode */
  1168. static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
  1169. {
  1170. /*
  1171. * should this consider associated/active/... state?
  1172. *
  1173. * Normally low-latency should only be active on interfaces
  1174. * that are active, but at least with debugfs it can also be
  1175. * enabled on interfaces that aren't active. However, when
  1176. * interface aren't active then they aren't added into the
  1177. * binding, so this has no real impact. For now, just return
  1178. * the current desired low-latency state.
  1179. */
  1180. return mvmvif->low_latency;
  1181. }
  1182. /* hw scheduler queue config */
  1183. void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  1184. u16 ssn, const struct iwl_trans_txq_scd_cfg *cfg,
  1185. unsigned int wdg_timeout);
  1186. /*
  1187. * Disable a TXQ.
  1188. * Note that in non-DQA mode the %mac80211_queue and %tid params are ignored.
  1189. */
  1190. void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  1191. u8 tid, u8 flags);
  1192. int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 minq, u8 maxq);
  1193. /* Return a bitmask with all the hw supported queues, except for the
  1194. * command queue, which can't be flushed.
  1195. */
  1196. static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)
  1197. {
  1198. return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) &
  1199. ~BIT(IWL_MVM_CMD_QUEUE));
  1200. }
  1201. static inline
  1202. void iwl_mvm_enable_ac_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  1203. u8 fifo, u16 ssn, unsigned int wdg_timeout)
  1204. {
  1205. struct iwl_trans_txq_scd_cfg cfg = {
  1206. .fifo = fifo,
  1207. .tid = IWL_MAX_TID_COUNT,
  1208. .aggregate = false,
  1209. .frame_limit = IWL_FRAME_LIMIT,
  1210. };
  1211. iwl_mvm_enable_txq(mvm, queue, mac80211_queue, ssn, &cfg, wdg_timeout);
  1212. }
  1213. static inline void iwl_mvm_enable_agg_txq(struct iwl_mvm *mvm, int queue,
  1214. int mac80211_queue, int fifo,
  1215. int sta_id, int tid, int frame_limit,
  1216. u16 ssn, unsigned int wdg_timeout)
  1217. {
  1218. struct iwl_trans_txq_scd_cfg cfg = {
  1219. .fifo = fifo,
  1220. .sta_id = sta_id,
  1221. .tid = tid,
  1222. .frame_limit = frame_limit,
  1223. .aggregate = true,
  1224. };
  1225. iwl_mvm_enable_txq(mvm, queue, mac80211_queue, ssn, &cfg, wdg_timeout);
  1226. }
  1227. /* Thermal management and CT-kill */
  1228. void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);
  1229. void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp);
  1230. void iwl_mvm_temp_notif(struct iwl_mvm *mvm,
  1231. struct iwl_rx_cmd_buffer *rxb);
  1232. void iwl_mvm_tt_handler(struct iwl_mvm *mvm);
  1233. void iwl_mvm_tt_initialize(struct iwl_mvm *mvm, u32 min_backoff);
  1234. void iwl_mvm_tt_exit(struct iwl_mvm *mvm);
  1235. void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
  1236. int iwl_mvm_get_temp(struct iwl_mvm *mvm);
  1237. /* Location Aware Regulatory */
  1238. struct iwl_mcc_update_resp *
  1239. iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
  1240. enum iwl_mcc_source src_id);
  1241. int iwl_mvm_init_mcc(struct iwl_mvm *mvm);
  1242. void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,
  1243. struct iwl_rx_cmd_buffer *rxb);
  1244. struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
  1245. const char *alpha2,
  1246. enum iwl_mcc_source src_id,
  1247. bool *changed);
  1248. struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
  1249. bool *changed);
  1250. int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm);
  1251. void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);
  1252. /* smart fifo */
  1253. int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1254. bool added_vif);
  1255. /* TDLS */
  1256. /*
  1257. * We use TID 4 (VI) as a FW-used-only TID when TDLS connections are present.
  1258. * This TID is marked as used vs the AP and all connected TDLS peers.
  1259. */
  1260. #define IWL_MVM_TDLS_FW_TID 4
  1261. int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1262. void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm);
  1263. void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1264. bool sta_added);
  1265. void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
  1266. struct ieee80211_vif *vif);
  1267. int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,
  1268. struct ieee80211_vif *vif,
  1269. struct ieee80211_sta *sta, u8 oper_class,
  1270. struct cfg80211_chan_def *chandef,
  1271. struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
  1272. void iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw,
  1273. struct ieee80211_vif *vif,
  1274. struct ieee80211_tdls_ch_sw_params *params);
  1275. void iwl_mvm_tdls_cancel_channel_switch(struct ieee80211_hw *hw,
  1276. struct ieee80211_vif *vif,
  1277. struct ieee80211_sta *sta);
  1278. void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1279. void iwl_mvm_tdls_ch_switch_work(struct work_struct *work);
  1280. struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
  1281. void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
  1282. unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
  1283. struct ieee80211_vif *vif,
  1284. bool tdls, bool cmd_q);
  1285. void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1286. const char *errmsg);
  1287. #endif /* __IWL_MVM_H__ */