mvm.h 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929
  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. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  24. * USA
  25. *
  26. * The full GNU General Public License is included in this distribution
  27. * in the file called COPYING.
  28. *
  29. * Contact Information:
  30. * Intel Linux Wireless <linuxwifi@intel.com>
  31. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  32. *
  33. * BSD LICENSE
  34. *
  35. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  36. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  37. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  38. * All rights reserved.
  39. *
  40. * Redistribution and use in source and binary forms, with or without
  41. * modification, are permitted provided that the following conditions
  42. * are met:
  43. *
  44. * * Redistributions of source code must retain the above copyright
  45. * notice, this list of conditions and the following disclaimer.
  46. * * Redistributions in binary form must reproduce the above copyright
  47. * notice, this list of conditions and the following disclaimer in
  48. * the documentation and/or other materials provided with the
  49. * distribution.
  50. * * Neither the name Intel Corporation nor the names of its
  51. * contributors may be used to endorse or promote products derived
  52. * from this software without specific prior written permission.
  53. *
  54. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  55. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  56. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  57. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  58. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  59. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  60. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  61. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  62. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  63. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  64. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  65. *
  66. *****************************************************************************/
  67. #ifndef __IWL_MVM_H__
  68. #define __IWL_MVM_H__
  69. #include <linux/list.h>
  70. #include <linux/spinlock.h>
  71. #include <linux/leds.h>
  72. #include <linux/in6.h>
  73. #ifdef CONFIG_THERMAL
  74. #include <linux/thermal.h>
  75. #endif
  76. #include "iwl-op-mode.h"
  77. #include "iwl-trans.h"
  78. #include "fw/notif-wait.h"
  79. #include "iwl-eeprom-parse.h"
  80. #include "fw/file.h"
  81. #include "iwl-config.h"
  82. #include "sta.h"
  83. #include "fw-api.h"
  84. #include "constants.h"
  85. #include "tof.h"
  86. #include "fw/runtime.h"
  87. #include "fw/dbg.h"
  88. #include "fw/acpi.h"
  89. #include "fw/debugfs.h"
  90. #define IWL_MVM_MAX_ADDRESSES 5
  91. /* RSSI offset for WkP */
  92. #define IWL_RSSI_OFFSET 50
  93. #define IWL_MVM_MISSED_BEACONS_THRESHOLD 8
  94. /* A TimeUnit is 1024 microsecond */
  95. #define MSEC_TO_TU(_msec) (_msec*1000/1024)
  96. /* For GO, this value represents the number of TUs before CSA "beacon
  97. * 0" TBTT when the CSA time-event needs to be scheduled to start. It
  98. * must be big enough to ensure that we switch in time.
  99. */
  100. #define IWL_MVM_CHANNEL_SWITCH_TIME_GO 40
  101. /* For client, this value represents the number of TUs before CSA
  102. * "beacon 1" TBTT, instead. This is because we don't know when the
  103. * GO/AP will be in the new channel, so we switch early enough.
  104. */
  105. #define IWL_MVM_CHANNEL_SWITCH_TIME_CLIENT 10
  106. /*
  107. * This value (in TUs) is used to fine tune the CSA NoA end time which should
  108. * be just before "beacon 0" TBTT.
  109. */
  110. #define IWL_MVM_CHANNEL_SWITCH_MARGIN 4
  111. /*
  112. * Number of beacons to transmit on a new channel until we unblock tx to
  113. * the stations, even if we didn't identify them on a new channel
  114. */
  115. #define IWL_MVM_CS_UNBLOCK_TX_TIMEOUT 3
  116. /* offchannel queue towards mac80211 */
  117. #define IWL_MVM_OFFCHANNEL_QUEUE 0
  118. extern const struct ieee80211_ops iwl_mvm_hw_ops;
  119. /**
  120. * struct iwl_mvm_mod_params - module parameters for iwlmvm
  121. * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted.
  122. * We will register to mac80211 to have testmode working. The NIC must not
  123. * be up'ed after the INIT fw asserted. This is useful to be able to use
  124. * proprietary tools over testmode to debug the INIT fw.
  125. * @tfd_q_hang_detect: enabled the detection of hung transmit queues
  126. * @power_scheme: one of enum iwl_power_scheme
  127. */
  128. struct iwl_mvm_mod_params {
  129. bool init_dbg;
  130. bool tfd_q_hang_detect;
  131. int power_scheme;
  132. };
  133. extern struct iwl_mvm_mod_params iwlmvm_mod_params;
  134. struct iwl_mvm_phy_ctxt {
  135. u16 id;
  136. u16 color;
  137. u32 ref;
  138. enum nl80211_chan_width width;
  139. /*
  140. * TODO: This should probably be removed. Currently here only for rate
  141. * scaling algorithm
  142. */
  143. struct ieee80211_channel *channel;
  144. };
  145. struct iwl_mvm_time_event_data {
  146. struct ieee80211_vif *vif;
  147. struct list_head list;
  148. unsigned long end_jiffies;
  149. u32 duration;
  150. bool running;
  151. u32 uid;
  152. /*
  153. * The access to the 'id' field must be done when the
  154. * mvm->time_event_lock is held, as it value is used to indicate
  155. * if the te is in the time event list or not (when id == TE_MAX)
  156. */
  157. u32 id;
  158. };
  159. /* Power management */
  160. /**
  161. * enum iwl_power_scheme
  162. * @IWL_POWER_LEVEL_CAM - Continuously Active Mode
  163. * @IWL_POWER_LEVEL_BPS - Balanced Power Save (default)
  164. * @IWL_POWER_LEVEL_LP - Low Power
  165. */
  166. enum iwl_power_scheme {
  167. IWL_POWER_SCHEME_CAM = 1,
  168. IWL_POWER_SCHEME_BPS,
  169. IWL_POWER_SCHEME_LP
  170. };
  171. #define IWL_CONN_MAX_LISTEN_INTERVAL 10
  172. #define IWL_UAPSD_MAX_SP IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
  173. #ifdef CONFIG_IWLWIFI_DEBUGFS
  174. enum iwl_dbgfs_pm_mask {
  175. MVM_DEBUGFS_PM_KEEP_ALIVE = BIT(0),
  176. MVM_DEBUGFS_PM_SKIP_OVER_DTIM = BIT(1),
  177. MVM_DEBUGFS_PM_SKIP_DTIM_PERIODS = BIT(2),
  178. MVM_DEBUGFS_PM_RX_DATA_TIMEOUT = BIT(3),
  179. MVM_DEBUGFS_PM_TX_DATA_TIMEOUT = BIT(4),
  180. MVM_DEBUGFS_PM_LPRX_ENA = BIT(6),
  181. MVM_DEBUGFS_PM_LPRX_RSSI_THRESHOLD = BIT(7),
  182. MVM_DEBUGFS_PM_SNOOZE_ENABLE = BIT(8),
  183. MVM_DEBUGFS_PM_UAPSD_MISBEHAVING = BIT(9),
  184. MVM_DEBUGFS_PM_USE_PS_POLL = BIT(10),
  185. };
  186. struct iwl_dbgfs_pm {
  187. u16 keep_alive_seconds;
  188. u32 rx_data_timeout;
  189. u32 tx_data_timeout;
  190. bool skip_over_dtim;
  191. u8 skip_dtim_periods;
  192. bool lprx_ena;
  193. u32 lprx_rssi_threshold;
  194. bool snooze_ena;
  195. bool uapsd_misbehaving;
  196. bool use_ps_poll;
  197. int mask;
  198. };
  199. /* beacon filtering */
  200. enum iwl_dbgfs_bf_mask {
  201. MVM_DEBUGFS_BF_ENERGY_DELTA = BIT(0),
  202. MVM_DEBUGFS_BF_ROAMING_ENERGY_DELTA = BIT(1),
  203. MVM_DEBUGFS_BF_ROAMING_STATE = BIT(2),
  204. MVM_DEBUGFS_BF_TEMP_THRESHOLD = BIT(3),
  205. MVM_DEBUGFS_BF_TEMP_FAST_FILTER = BIT(4),
  206. MVM_DEBUGFS_BF_TEMP_SLOW_FILTER = BIT(5),
  207. MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER = BIT(6),
  208. MVM_DEBUGFS_BF_DEBUG_FLAG = BIT(7),
  209. MVM_DEBUGFS_BF_ESCAPE_TIMER = BIT(8),
  210. MVM_DEBUGFS_BA_ESCAPE_TIMER = BIT(9),
  211. MVM_DEBUGFS_BA_ENABLE_BEACON_ABORT = BIT(10),
  212. };
  213. struct iwl_dbgfs_bf {
  214. u32 bf_energy_delta;
  215. u32 bf_roaming_energy_delta;
  216. u32 bf_roaming_state;
  217. u32 bf_temp_threshold;
  218. u32 bf_temp_fast_filter;
  219. u32 bf_temp_slow_filter;
  220. u32 bf_enable_beacon_filter;
  221. u32 bf_debug_flag;
  222. u32 bf_escape_timer;
  223. u32 ba_escape_timer;
  224. u32 ba_enable_beacon_abort;
  225. int mask;
  226. };
  227. #endif
  228. enum iwl_mvm_smps_type_request {
  229. IWL_MVM_SMPS_REQ_BT_COEX,
  230. IWL_MVM_SMPS_REQ_TT,
  231. IWL_MVM_SMPS_REQ_PROT,
  232. NUM_IWL_MVM_SMPS_REQ,
  233. };
  234. enum iwl_mvm_ref_type {
  235. IWL_MVM_REF_UCODE_DOWN,
  236. IWL_MVM_REF_SCAN,
  237. IWL_MVM_REF_ROC,
  238. IWL_MVM_REF_ROC_AUX,
  239. IWL_MVM_REF_P2P_CLIENT,
  240. IWL_MVM_REF_AP_IBSS,
  241. IWL_MVM_REF_USER,
  242. IWL_MVM_REF_TX,
  243. IWL_MVM_REF_TX_AGG,
  244. IWL_MVM_REF_ADD_IF,
  245. IWL_MVM_REF_START_AP,
  246. IWL_MVM_REF_BSS_CHANGED,
  247. IWL_MVM_REF_PREPARE_TX,
  248. IWL_MVM_REF_PROTECT_TDLS,
  249. IWL_MVM_REF_CHECK_CTKILL,
  250. IWL_MVM_REF_PRPH_READ,
  251. IWL_MVM_REF_PRPH_WRITE,
  252. IWL_MVM_REF_NMI,
  253. IWL_MVM_REF_TM_CMD,
  254. IWL_MVM_REF_EXIT_WORK,
  255. IWL_MVM_REF_PROTECT_CSA,
  256. IWL_MVM_REF_FW_DBG_COLLECT,
  257. IWL_MVM_REF_INIT_UCODE,
  258. IWL_MVM_REF_SENDING_CMD,
  259. IWL_MVM_REF_RX,
  260. /* update debugfs.c when changing this */
  261. IWL_MVM_REF_COUNT,
  262. };
  263. enum iwl_bt_force_ant_mode {
  264. BT_FORCE_ANT_DIS = 0,
  265. BT_FORCE_ANT_AUTO,
  266. BT_FORCE_ANT_BT,
  267. BT_FORCE_ANT_WIFI,
  268. BT_FORCE_ANT_MAX,
  269. };
  270. /**
  271. * struct iwl_mvm_low_latency_cause - low latency set causes
  272. * @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected
  273. * @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs
  274. * @LOW_LATENCY_VCMD: low latency mode set from vendor command
  275. */
  276. enum iwl_mvm_low_latency_cause {
  277. LOW_LATENCY_TRAFFIC = BIT(0),
  278. LOW_LATENCY_DEBUGFS = BIT(1),
  279. LOW_LATENCY_VCMD = BIT(2),
  280. };
  281. /**
  282. * struct iwl_mvm_vif_bf_data - beacon filtering related data
  283. * @bf_enabled: indicates if beacon filtering is enabled
  284. * @ba_enabled: indicated if beacon abort is enabled
  285. * @ave_beacon_signal: average beacon signal
  286. * @last_cqm_event: rssi of the last cqm event
  287. * @bt_coex_min_thold: minimum threshold for BT coex
  288. * @bt_coex_max_thold: maximum threshold for BT coex
  289. * @last_bt_coex_event: rssi of the last BT coex event
  290. */
  291. struct iwl_mvm_vif_bf_data {
  292. bool bf_enabled;
  293. bool ba_enabled;
  294. int ave_beacon_signal;
  295. int last_cqm_event;
  296. int bt_coex_min_thold;
  297. int bt_coex_max_thold;
  298. int last_bt_coex_event;
  299. };
  300. /**
  301. * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
  302. * @id: between 0 and 3
  303. * @color: to solve races upon MAC addition and removal
  304. * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA
  305. * @bssid: BSSID for this (client) interface
  306. * @associated: indicates that we're currently associated, used only for
  307. * managing the firmware state in iwl_mvm_bss_info_changed_station()
  308. * @ap_assoc_sta_count: count of stations associated to us - valid only
  309. * if VIF type is AP
  310. * @uploaded: indicates the MAC context has been added to the device
  311. * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface
  312. * should get quota etc.
  313. * @pm_enabled - Indicate if MAC power management is allowed
  314. * @monitor_active: indicates that monitor context is configured, and that the
  315. * interface should get quota etc.
  316. * @low_latency: indicates low latency is set, see
  317. * enum &iwl_mvm_low_latency_cause for causes.
  318. * @ps_disabled: indicates that this interface requires PS to be disabled
  319. * @queue_params: QoS params for this MAC
  320. * @bcast_sta: station used for broadcast packets. Used by the following
  321. * vifs: P2P_DEVICE, GO and AP.
  322. * @beacon_skb: the skb used to hold the AP/GO beacon template
  323. * @smps_requests: the SMPS requests of different parts of the driver,
  324. * combined on update to yield the overall request to mac80211.
  325. * @beacon_stats: beacon statistics, containing the # of received beacons,
  326. * # of received beacons accumulated over FW restart, and the current
  327. * average signal of beacons retrieved from the firmware
  328. * @csa_failed: CSA failed to schedule time event, report an error later
  329. * @features: hw features active for this vif
  330. */
  331. struct iwl_mvm_vif {
  332. struct iwl_mvm *mvm;
  333. u16 id;
  334. u16 color;
  335. u8 ap_sta_id;
  336. u8 bssid[ETH_ALEN];
  337. bool associated;
  338. u8 ap_assoc_sta_count;
  339. u16 cab_queue;
  340. bool uploaded;
  341. bool ap_ibss_active;
  342. bool pm_enabled;
  343. bool monitor_active;
  344. u8 low_latency;
  345. bool ps_disabled;
  346. struct iwl_mvm_vif_bf_data bf_data;
  347. struct {
  348. u32 num_beacons, accu_num_beacons;
  349. u8 avg_signal;
  350. } beacon_stats;
  351. u32 ap_beacon_time;
  352. enum iwl_tsf_id tsf_id;
  353. /*
  354. * QoS data from mac80211, need to store this here
  355. * as mac80211 has a separate callback but we need
  356. * to have the data for the MAC context
  357. */
  358. struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
  359. struct iwl_mvm_time_event_data time_event_data;
  360. struct iwl_mvm_time_event_data hs_time_event_data;
  361. struct iwl_mvm_int_sta bcast_sta;
  362. struct iwl_mvm_int_sta mcast_sta;
  363. /*
  364. * Assigned while mac80211 has the interface in a channel context,
  365. * or, for P2P Device, while it exists.
  366. */
  367. struct iwl_mvm_phy_ctxt *phy_ctxt;
  368. #ifdef CONFIG_PM
  369. /* WoWLAN GTK rekey data */
  370. struct {
  371. u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN];
  372. __le64 replay_ctr;
  373. bool valid;
  374. } rekey_data;
  375. int tx_key_idx;
  376. bool seqno_valid;
  377. u16 seqno;
  378. #endif
  379. #if IS_ENABLED(CONFIG_IPV6)
  380. /* IPv6 addresses for WoWLAN */
  381. struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX];
  382. unsigned long tentative_addrs[BITS_TO_LONGS(IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX)];
  383. int num_target_ipv6_addrs;
  384. #endif
  385. #ifdef CONFIG_IWLWIFI_DEBUGFS
  386. struct dentry *dbgfs_dir;
  387. struct dentry *dbgfs_slink;
  388. struct iwl_dbgfs_pm dbgfs_pm;
  389. struct iwl_dbgfs_bf dbgfs_bf;
  390. struct iwl_mac_power_cmd mac_pwr_cmd;
  391. int dbgfs_quota_min;
  392. #endif
  393. enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];
  394. /* FW identified misbehaving AP */
  395. u8 uapsd_misbehaving_bssid[ETH_ALEN];
  396. /* Indicates that CSA countdown may be started */
  397. bool csa_countdown;
  398. bool csa_failed;
  399. u16 csa_target_freq;
  400. /* Indicates that we are waiting for a beacon on a new channel */
  401. bool csa_bcn_pending;
  402. /* TCP Checksum Offload */
  403. netdev_features_t features;
  404. };
  405. static inline struct iwl_mvm_vif *
  406. iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
  407. {
  408. if (!vif)
  409. return NULL;
  410. return (void *)vif->drv_priv;
  411. }
  412. extern const u8 tid_to_mac80211_ac[];
  413. #define IWL_MVM_SCAN_STOPPING_SHIFT 8
  414. enum iwl_scan_status {
  415. IWL_MVM_SCAN_REGULAR = BIT(0),
  416. IWL_MVM_SCAN_SCHED = BIT(1),
  417. IWL_MVM_SCAN_NETDETECT = BIT(2),
  418. IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8),
  419. IWL_MVM_SCAN_STOPPING_SCHED = BIT(9),
  420. IWL_MVM_SCAN_STOPPING_NETDETECT = BIT(10),
  421. IWL_MVM_SCAN_REGULAR_MASK = IWL_MVM_SCAN_REGULAR |
  422. IWL_MVM_SCAN_STOPPING_REGULAR,
  423. IWL_MVM_SCAN_SCHED_MASK = IWL_MVM_SCAN_SCHED |
  424. IWL_MVM_SCAN_STOPPING_SCHED,
  425. IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT |
  426. IWL_MVM_SCAN_STOPPING_NETDETECT,
  427. IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT,
  428. IWL_MVM_SCAN_MASK = 0xff,
  429. };
  430. enum iwl_mvm_scan_type {
  431. IWL_SCAN_TYPE_NOT_SET,
  432. IWL_SCAN_TYPE_UNASSOC,
  433. IWL_SCAN_TYPE_WILD,
  434. IWL_SCAN_TYPE_MILD,
  435. IWL_SCAN_TYPE_FRAGMENTED,
  436. };
  437. enum iwl_mvm_sched_scan_pass_all_states {
  438. SCHED_SCAN_PASS_ALL_DISABLED,
  439. SCHED_SCAN_PASS_ALL_ENABLED,
  440. SCHED_SCAN_PASS_ALL_FOUND,
  441. };
  442. /**
  443. * struct iwl_nvm_section - describes an NVM section in memory.
  444. *
  445. * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD,
  446. * and saved for later use by the driver. Not all NVM sections are saved
  447. * this way, only the needed ones.
  448. */
  449. struct iwl_nvm_section {
  450. u16 length;
  451. const u8 *data;
  452. };
  453. /**
  454. * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure
  455. * @ct_kill_exit: worker to exit thermal kill
  456. * @dynamic_smps: Is thermal throttling enabled dynamic_smps?
  457. * @tx_backoff: The current thremal throttling tx backoff in uSec.
  458. * @min_backoff: The minimal tx backoff due to power restrictions
  459. * @params: Parameters to configure the thermal throttling algorithm.
  460. * @throttle: Is thermal throttling is active?
  461. */
  462. struct iwl_mvm_tt_mgmt {
  463. struct delayed_work ct_kill_exit;
  464. bool dynamic_smps;
  465. u32 tx_backoff;
  466. u32 min_backoff;
  467. struct iwl_tt_params params;
  468. bool throttle;
  469. };
  470. #ifdef CONFIG_THERMAL
  471. /**
  472. *struct iwl_mvm_thermal_device - thermal zone related data
  473. * @temp_trips: temperature thresholds for report
  474. * @fw_trips_index: keep indexes to original array - temp_trips
  475. * @tzone: thermal zone device data
  476. */
  477. struct iwl_mvm_thermal_device {
  478. s16 temp_trips[IWL_MAX_DTS_TRIPS];
  479. u8 fw_trips_index[IWL_MAX_DTS_TRIPS];
  480. struct thermal_zone_device *tzone;
  481. };
  482. /*
  483. * struct iwl_mvm_cooling_device
  484. * @cur_state: current state
  485. * @cdev: struct thermal cooling device
  486. */
  487. struct iwl_mvm_cooling_device {
  488. u32 cur_state;
  489. struct thermal_cooling_device *cdev;
  490. };
  491. #endif
  492. #define IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES 8
  493. struct iwl_mvm_frame_stats {
  494. u32 legacy_frames;
  495. u32 ht_frames;
  496. u32 vht_frames;
  497. u32 bw_20_frames;
  498. u32 bw_40_frames;
  499. u32 bw_80_frames;
  500. u32 bw_160_frames;
  501. u32 sgi_frames;
  502. u32 ngi_frames;
  503. u32 siso_frames;
  504. u32 mimo2_frames;
  505. u32 agg_frames;
  506. u32 ampdu_count;
  507. u32 success_frames;
  508. u32 fail_frames;
  509. u32 last_rates[IWL_MVM_NUM_LAST_FRAMES_UCODE_RATES];
  510. int last_frame_idx;
  511. };
  512. enum {
  513. D0I3_DEFER_WAKEUP,
  514. D0I3_PENDING_WAKEUP,
  515. };
  516. #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff
  517. #define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100
  518. #define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200
  519. enum iwl_mvm_tdls_cs_state {
  520. IWL_MVM_TDLS_SW_IDLE = 0,
  521. IWL_MVM_TDLS_SW_REQ_SENT,
  522. IWL_MVM_TDLS_SW_RESP_RCVD,
  523. IWL_MVM_TDLS_SW_REQ_RCVD,
  524. IWL_MVM_TDLS_SW_ACTIVE,
  525. };
  526. /**
  527. * struct iwl_mvm_reorder_buffer - per ra/tid/queue reorder buffer
  528. * @head_sn: reorder window head sn
  529. * @num_stored: number of mpdus stored in the buffer
  530. * @buf_size: the reorder buffer size as set by the last addba request
  531. * @queue: queue of this reorder buffer
  532. * @last_amsdu: track last ASMDU SN for duplication detection
  533. * @last_sub_index: track ASMDU sub frame index for duplication detection
  534. * @reorder_timer: timer for frames are in the reorder buffer. For AMSDU
  535. * it is the time of last received sub-frame
  536. * @removed: prevent timer re-arming
  537. * @valid: reordering is valid for this queue
  538. * @lock: protect reorder buffer internal state
  539. * @mvm: mvm pointer, needed for frame timer context
  540. */
  541. struct iwl_mvm_reorder_buffer {
  542. u16 head_sn;
  543. u16 num_stored;
  544. u8 buf_size;
  545. int queue;
  546. u16 last_amsdu;
  547. u8 last_sub_index;
  548. struct timer_list reorder_timer;
  549. bool removed;
  550. bool valid;
  551. spinlock_t lock;
  552. struct iwl_mvm *mvm;
  553. } ____cacheline_aligned_in_smp;
  554. /**
  555. * struct _iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno
  556. * @frames: list of skbs stored
  557. * @reorder_time: time the packet was stored in the reorder buffer
  558. */
  559. struct _iwl_mvm_reorder_buf_entry {
  560. struct sk_buff_head frames;
  561. unsigned long reorder_time;
  562. };
  563. /* make this indirection to get the aligned thing */
  564. struct iwl_mvm_reorder_buf_entry {
  565. struct _iwl_mvm_reorder_buf_entry e;
  566. }
  567. #ifndef __CHECKER__
  568. /* sparse doesn't like this construct: "bad integer constant expression" */
  569. __aligned(roundup_pow_of_two(sizeof(struct _iwl_mvm_reorder_buf_entry)))
  570. #endif
  571. ;
  572. /**
  573. * struct iwl_mvm_baid_data - BA session data
  574. * @sta_id: station id
  575. * @tid: tid of the session
  576. * @baid baid of the session
  577. * @timeout: the timeout set in the addba request
  578. * @entries_per_queue: # of buffers per queue, this actually gets
  579. * aligned up to avoid cache line sharing between queues
  580. * @last_rx: last rx jiffies, updated only if timeout passed from last update
  581. * @session_timer: timer to check if BA session expired, runs at 2 * timeout
  582. * @mvm: mvm pointer, needed for timer context
  583. * @reorder_buf: reorder buffer, allocated per queue
  584. * @reorder_buf_data: data
  585. */
  586. struct iwl_mvm_baid_data {
  587. struct rcu_head rcu_head;
  588. u8 sta_id;
  589. u8 tid;
  590. u8 baid;
  591. u16 timeout;
  592. u16 entries_per_queue;
  593. unsigned long last_rx;
  594. struct timer_list session_timer;
  595. struct iwl_mvm_baid_data __rcu **rcu_ptr;
  596. struct iwl_mvm *mvm;
  597. struct iwl_mvm_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES];
  598. struct iwl_mvm_reorder_buf_entry entries[];
  599. };
  600. static inline struct iwl_mvm_baid_data *
  601. iwl_mvm_baid_data_from_reorder_buf(struct iwl_mvm_reorder_buffer *buf)
  602. {
  603. return (void *)((u8 *)buf -
  604. offsetof(struct iwl_mvm_baid_data, reorder_buf) -
  605. sizeof(*buf) * buf->queue);
  606. }
  607. /*
  608. * enum iwl_mvm_queue_status - queue status
  609. * @IWL_MVM_QUEUE_FREE: the queue is not allocated nor reserved
  610. * Basically, this means that this queue can be used for any purpose
  611. * @IWL_MVM_QUEUE_RESERVED: queue is reserved but not yet in use
  612. * This is the state of a queue that has been dedicated for some RATID
  613. * (agg'd or not), but that hasn't yet gone through the actual enablement
  614. * of iwl_mvm_enable_txq(), and therefore no traffic can go through it yet.
  615. * Note that in this state there is no requirement to already know what TID
  616. * should be used with this queue, it is just marked as a queue that will
  617. * be used, and shouldn't be allocated to anyone else.
  618. * @IWL_MVM_QUEUE_READY: queue is ready to be used
  619. * This is the state of a queue that has been fully configured (including
  620. * SCD pointers, etc), has a specific RA/TID assigned to it, and can be
  621. * used to send traffic.
  622. * @IWL_MVM_QUEUE_SHARED: queue is shared, or in a process of becoming shared
  623. * This is a state in which a single queue serves more than one TID, all of
  624. * which are not aggregated. Note that the queue is only associated to one
  625. * RA.
  626. * @IWL_MVM_QUEUE_INACTIVE: queue is allocated but no traffic on it
  627. * This is a state of a queue that has had traffic on it, but during the
  628. * last %IWL_MVM_DQA_QUEUE_TIMEOUT time period there has been no traffic on
  629. * it. In this state, when a new queue is needed to be allocated but no
  630. * such free queue exists, an inactive queue might be freed and given to
  631. * the new RA/TID.
  632. * @IWL_MVM_QUEUE_RECONFIGURING: queue is being reconfigured
  633. * This is the state of a queue that has had traffic pass through it, but
  634. * needs to be reconfigured for some reason, e.g. the queue needs to
  635. * become unshared and aggregations re-enabled on.
  636. */
  637. enum iwl_mvm_queue_status {
  638. IWL_MVM_QUEUE_FREE,
  639. IWL_MVM_QUEUE_RESERVED,
  640. IWL_MVM_QUEUE_READY,
  641. IWL_MVM_QUEUE_SHARED,
  642. IWL_MVM_QUEUE_INACTIVE,
  643. IWL_MVM_QUEUE_RECONFIGURING,
  644. };
  645. #define IWL_MVM_DQA_QUEUE_TIMEOUT (5 * HZ)
  646. #define IWL_MVM_INVALID_QUEUE 0xFFFF
  647. #define IWL_MVM_NUM_CIPHERS 10
  648. struct iwl_mvm_sar_profile {
  649. bool enabled;
  650. u8 table[ACPI_SAR_TABLE_SIZE];
  651. };
  652. struct iwl_mvm_geo_profile {
  653. u8 values[ACPI_GEO_TABLE_SIZE];
  654. };
  655. struct iwl_mvm {
  656. /* for logger access */
  657. struct device *dev;
  658. struct iwl_trans *trans;
  659. const struct iwl_fw *fw;
  660. const struct iwl_cfg *cfg;
  661. struct iwl_phy_db *phy_db;
  662. struct ieee80211_hw *hw;
  663. /* for protecting access to iwl_mvm */
  664. struct mutex mutex;
  665. struct list_head async_handlers_list;
  666. spinlock_t async_handlers_lock;
  667. struct work_struct async_handlers_wk;
  668. struct work_struct roc_done_wk;
  669. unsigned long init_status;
  670. unsigned long status;
  671. u32 queue_sync_cookie;
  672. atomic_t queue_sync_counter;
  673. /*
  674. * for beacon filtering -
  675. * currently only one interface can be supported
  676. */
  677. struct iwl_mvm_vif *bf_allowed_vif;
  678. bool hw_registered;
  679. bool calibrating;
  680. u32 error_event_table[2];
  681. u32 log_event_table;
  682. u32 umac_error_event_table;
  683. bool support_umac_log;
  684. u32 ampdu_ref;
  685. bool ampdu_toggle;
  686. struct iwl_notif_wait_data notif_wait;
  687. union {
  688. struct mvm_statistics_rx_v3 rx_stats_v3;
  689. struct mvm_statistics_rx rx_stats;
  690. };
  691. struct {
  692. u64 rx_time;
  693. u64 tx_time;
  694. u64 on_time_rf;
  695. u64 on_time_scan;
  696. } radio_stats, accu_radio_stats;
  697. u16 hw_queue_to_mac80211[IWL_MAX_TVQM_QUEUES];
  698. struct {
  699. u8 hw_queue_refcount;
  700. u8 ra_sta_id; /* The RA this queue is mapped to, if exists */
  701. bool reserved; /* Is this the TXQ reserved for a STA */
  702. u8 mac80211_ac; /* The mac80211 AC this queue is mapped to */
  703. u8 txq_tid; /* The TID "owner" of this queue*/
  704. u16 tid_bitmap; /* Bitmap of the TIDs mapped to this queue */
  705. /* Timestamp for inactivation per TID of this queue */
  706. unsigned long last_frame_time[IWL_MAX_TID_COUNT + 1];
  707. enum iwl_mvm_queue_status status;
  708. } queue_info[IWL_MAX_HW_QUEUES];
  709. spinlock_t queue_info_lock; /* For syncing queue mgmt operations */
  710. struct work_struct add_stream_wk; /* To add streams to queues */
  711. atomic_t mac80211_queue_stop_count[IEEE80211_MAX_QUEUES];
  712. const char *nvm_file_name;
  713. struct iwl_nvm_data *nvm_data;
  714. /* NVM sections */
  715. struct iwl_nvm_section nvm_sections[NVM_MAX_NUM_SECTIONS];
  716. struct iwl_fw_runtime fwrt;
  717. /* EEPROM MAC addresses */
  718. struct mac_address addresses[IWL_MVM_MAX_ADDRESSES];
  719. /* data related to data path */
  720. struct iwl_rx_phy_info last_phy_info;
  721. struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT];
  722. unsigned long sta_deferred_frames[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
  723. u8 rx_ba_sessions;
  724. /* configured by mac80211 */
  725. u32 rts_threshold;
  726. /* Scan status, cmd (pre-allocated) and auxiliary station */
  727. unsigned int scan_status;
  728. void *scan_cmd;
  729. struct iwl_mcast_filter_cmd *mcast_filter_cmd;
  730. enum iwl_mvm_scan_type scan_type;
  731. enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all;
  732. struct delayed_work scan_timeout_dwork;
  733. /* max number of simultaneous scans the FW supports */
  734. unsigned int max_scans;
  735. /* UMAC scan tracking */
  736. u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS];
  737. /* start time of last scan in TSF of the mac that requested the scan */
  738. u64 scan_start;
  739. /* the vif that requested the current scan */
  740. struct iwl_mvm_vif *scan_vif;
  741. /* rx chain antennas set through debugfs for the scan command */
  742. u8 scan_rx_ant;
  743. #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
  744. /* broadcast filters to configure for each associated station */
  745. const struct iwl_fw_bcast_filter *bcast_filters;
  746. #ifdef CONFIG_IWLWIFI_DEBUGFS
  747. struct {
  748. bool override;
  749. struct iwl_bcast_filter_cmd cmd;
  750. } dbgfs_bcast_filtering;
  751. #endif
  752. #endif
  753. /* Internal station */
  754. struct iwl_mvm_int_sta aux_sta;
  755. struct iwl_mvm_int_sta snif_sta;
  756. bool last_ebs_successful;
  757. u8 scan_last_antenna_idx; /* to toggle TX between antennas */
  758. u8 mgmt_last_antenna_idx;
  759. /* last smart fifo state that was successfully sent to firmware */
  760. enum iwl_sf_state sf_state;
  761. #ifdef CONFIG_IWLWIFI_DEBUGFS
  762. struct dentry *debugfs_dir;
  763. u32 dbgfs_sram_offset, dbgfs_sram_len;
  764. u32 dbgfs_prph_reg_addr;
  765. bool disable_power_off;
  766. bool disable_power_off_d3;
  767. bool scan_iter_notif_enabled;
  768. struct debugfs_blob_wrapper nvm_hw_blob;
  769. struct debugfs_blob_wrapper nvm_sw_blob;
  770. struct debugfs_blob_wrapper nvm_calib_blob;
  771. struct debugfs_blob_wrapper nvm_prod_blob;
  772. struct debugfs_blob_wrapper nvm_phy_sku_blob;
  773. struct iwl_mvm_frame_stats drv_rx_stats;
  774. spinlock_t drv_stats_lock;
  775. u16 dbgfs_rx_phyinfo;
  776. #endif
  777. struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX];
  778. struct list_head time_event_list;
  779. spinlock_t time_event_lock;
  780. /*
  781. * A bitmap indicating the index of the key in use. The firmware
  782. * can hold 16 keys at most. Reflect this fact.
  783. */
  784. unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)];
  785. u8 fw_key_deleted[STA_KEY_MAX_NUM];
  786. /* references taken by the driver and spinlock protecting them */
  787. spinlock_t refs_lock;
  788. u8 refs[IWL_MVM_REF_COUNT];
  789. u8 vif_count;
  790. /* -1 for always, 0 for never, >0 for that many times */
  791. s8 fw_restart;
  792. #ifdef CONFIG_IWLWIFI_LEDS
  793. struct led_classdev led;
  794. #endif
  795. struct ieee80211_vif *p2p_device_vif;
  796. #ifdef CONFIG_PM
  797. struct wiphy_wowlan_support wowlan;
  798. int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
  799. /* sched scan settings for net detect */
  800. struct ieee80211_scan_ies nd_ies;
  801. struct cfg80211_match_set *nd_match_sets;
  802. int n_nd_match_sets;
  803. struct ieee80211_channel **nd_channels;
  804. int n_nd_channels;
  805. bool net_detect;
  806. #ifdef CONFIG_IWLWIFI_DEBUGFS
  807. bool d3_wake_sysassert;
  808. bool d3_test_active;
  809. bool store_d3_resume_sram;
  810. void *d3_resume_sram;
  811. u32 d3_test_pme_ptr;
  812. struct ieee80211_vif *keep_vif;
  813. u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */
  814. #endif
  815. #endif
  816. /* d0i3 */
  817. u8 d0i3_ap_sta_id;
  818. bool d0i3_offloading;
  819. struct work_struct d0i3_exit_work;
  820. struct sk_buff_head d0i3_tx;
  821. /* protect d0i3_suspend_flags */
  822. struct mutex d0i3_suspend_mutex;
  823. unsigned long d0i3_suspend_flags;
  824. /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */
  825. spinlock_t d0i3_tx_lock;
  826. wait_queue_head_t d0i3_exit_waitq;
  827. wait_queue_head_t rx_sync_waitq;
  828. /* BT-Coex */
  829. struct iwl_bt_coex_profile_notif last_bt_notif;
  830. struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
  831. u8 bt_tx_prio;
  832. enum iwl_bt_force_ant_mode bt_force_ant_mode;
  833. /* Aux ROC */
  834. struct list_head aux_roc_te_list;
  835. /* Thermal Throttling and CTkill */
  836. struct iwl_mvm_tt_mgmt thermal_throttle;
  837. #ifdef CONFIG_THERMAL
  838. struct iwl_mvm_thermal_device tz_device;
  839. struct iwl_mvm_cooling_device cooling_dev;
  840. #endif
  841. s32 temperature; /* Celsius */
  842. /*
  843. * Debug option to set the NIC temperature. This option makes the
  844. * driver think this is the actual NIC temperature, and ignore the
  845. * real temperature that is received from the fw
  846. */
  847. bool temperature_test; /* Debug test temperature is enabled */
  848. struct iwl_time_quota_cmd last_quota_cmd;
  849. #ifdef CONFIG_NL80211_TESTMODE
  850. u32 noa_duration;
  851. struct ieee80211_vif *noa_vif;
  852. #endif
  853. /* Tx queues */
  854. u16 aux_queue;
  855. u16 snif_queue;
  856. u16 probe_queue;
  857. u16 p2p_dev_queue;
  858. /* Indicate if device power save is allowed */
  859. u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */
  860. unsigned int max_amsdu_len; /* used for debugfs only */
  861. struct ieee80211_vif __rcu *csa_vif;
  862. struct ieee80211_vif __rcu *csa_tx_blocked_vif;
  863. u8 csa_tx_block_bcn_timeout;
  864. /* system time of last beacon (for AP/GO interface) */
  865. u32 ap_last_beacon_gp2;
  866. /* indicates that we transmitted the last beacon */
  867. bool ibss_manager;
  868. bool lar_regdom_set;
  869. enum iwl_mcc_source mcc_src;
  870. /* TDLS channel switch data */
  871. struct {
  872. struct delayed_work dwork;
  873. enum iwl_mvm_tdls_cs_state state;
  874. /*
  875. * Current cs sta - might be different from periodic cs peer
  876. * station. Value is meaningless when the cs-state is idle.
  877. */
  878. u8 cur_sta_id;
  879. /* TDLS periodic channel-switch peer */
  880. struct {
  881. u8 sta_id;
  882. u8 op_class;
  883. bool initiator; /* are we the link initiator */
  884. struct cfg80211_chan_def chandef;
  885. struct sk_buff *skb; /* ch sw template */
  886. u32 ch_sw_tm_ie;
  887. /* timestamp of last ch-sw request sent (GP2 time) */
  888. u32 sent_timestamp;
  889. } peer;
  890. } tdls_cs;
  891. u32 ciphers[IWL_MVM_NUM_CIPHERS];
  892. struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS];
  893. struct iwl_mvm_tof_data tof_data;
  894. struct ieee80211_vif *nan_vif;
  895. #define IWL_MAX_BAID 32
  896. struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID];
  897. /*
  898. * Drop beacons from other APs in AP mode when there are no connected
  899. * clients.
  900. */
  901. bool drop_bcn_ap_mode;
  902. struct delayed_work cs_tx_unblock_dwork;
  903. /* does a monitor vif exist (only one can exist hence bool) */
  904. bool monitor_on;
  905. #ifdef CONFIG_ACPI
  906. struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM];
  907. struct iwl_mvm_geo_profile geo_profiles[ACPI_NUM_GEO_PROFILES];
  908. #endif
  909. };
  910. /* Extract MVM priv from op_mode and _hw */
  911. #define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \
  912. ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific)
  913. #define IWL_MAC80211_GET_MVM(_hw) \
  914. IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv))
  915. /**
  916. * enum iwl_mvm_status - MVM status bits
  917. * @IWL_MVM_STATUS_HW_RFKILL: HW RF-kill is asserted
  918. * @IWL_MVM_STATUS_HW_CTKILL: CT-kill is active
  919. * @IWL_MVM_STATUS_ROC_RUNNING: remain-on-channel is running
  920. * @IWL_MVM_STATUS_HW_RESTART_REQUESTED: HW restart was requested
  921. * @IWL_MVM_STATUS_IN_HW_RESTART: HW restart is active
  922. * @IWL_MVM_STATUS_IN_D0I3: NIC is in D0i3
  923. * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running
  924. * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done
  925. * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running
  926. * @IWL_MVM_STATUS_NEED_FLUSH_P2P: need to flush P2P bcast STA
  927. */
  928. enum iwl_mvm_status {
  929. IWL_MVM_STATUS_HW_RFKILL,
  930. IWL_MVM_STATUS_HW_CTKILL,
  931. IWL_MVM_STATUS_ROC_RUNNING,
  932. IWL_MVM_STATUS_HW_RESTART_REQUESTED,
  933. IWL_MVM_STATUS_IN_HW_RESTART,
  934. IWL_MVM_STATUS_IN_D0I3,
  935. IWL_MVM_STATUS_ROC_AUX_RUNNING,
  936. IWL_MVM_STATUS_D3_RECONFIG,
  937. IWL_MVM_STATUS_FIRMWARE_RUNNING,
  938. IWL_MVM_STATUS_NEED_FLUSH_P2P,
  939. };
  940. /* Keep track of completed init configuration */
  941. enum iwl_mvm_init_status {
  942. IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0),
  943. IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1),
  944. IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE = BIT(2),
  945. IWL_MVM_INIT_STATUS_TOF_INIT_COMPLETE = BIT(3),
  946. };
  947. static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
  948. {
  949. return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) ||
  950. test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
  951. }
  952. static inline bool iwl_mvm_is_radio_hw_killed(struct iwl_mvm *mvm)
  953. {
  954. return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status);
  955. }
  956. static inline bool iwl_mvm_firmware_running(struct iwl_mvm *mvm)
  957. {
  958. return test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
  959. }
  960. /* Must be called with rcu_read_lock() held and it can only be
  961. * released when mvmsta is not needed anymore.
  962. */
  963. static inline struct iwl_mvm_sta *
  964. iwl_mvm_sta_from_staid_rcu(struct iwl_mvm *mvm, u8 sta_id)
  965. {
  966. struct ieee80211_sta *sta;
  967. if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
  968. return NULL;
  969. sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
  970. /* This can happen if the station has been removed right now */
  971. if (IS_ERR_OR_NULL(sta))
  972. return NULL;
  973. return iwl_mvm_sta_from_mac80211(sta);
  974. }
  975. static inline struct iwl_mvm_sta *
  976. iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id)
  977. {
  978. struct ieee80211_sta *sta;
  979. if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
  980. return NULL;
  981. sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
  982. lockdep_is_held(&mvm->mutex));
  983. /* This can happen if the station has been removed right now */
  984. if (IS_ERR_OR_NULL(sta))
  985. return NULL;
  986. return iwl_mvm_sta_from_mac80211(sta);
  987. }
  988. static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm)
  989. {
  990. return !iwlwifi_mod_params.d0i3_disable &&
  991. fw_has_capa(&mvm->fw->ucode_capa,
  992. IWL_UCODE_TLV_CAPA_D0I3_SUPPORT);
  993. }
  994. static inline bool iwl_mvm_is_adaptive_dwell_supported(struct iwl_mvm *mvm)
  995. {
  996. return fw_has_api(&mvm->fw->ucode_capa,
  997. IWL_UCODE_TLV_API_ADAPTIVE_DWELL);
  998. }
  999. static inline bool iwl_mvm_is_adaptive_dwell_v2_supported(struct iwl_mvm *mvm)
  1000. {
  1001. return fw_has_api(&mvm->fw->ucode_capa,
  1002. IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2);
  1003. }
  1004. static inline bool iwl_mvm_is_oce_supported(struct iwl_mvm *mvm)
  1005. {
  1006. /* OCE should never be enabled for LMAC scan FWs */
  1007. return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_OCE);
  1008. }
  1009. static inline bool iwl_mvm_enter_d0i3_on_suspend(struct iwl_mvm *mvm)
  1010. {
  1011. /* For now we only use this mode to differentiate between
  1012. * slave transports, which handle D0i3 entry in suspend by
  1013. * themselves in conjunction with runtime PM D0i3. So, this
  1014. * function is used to check whether we need to do anything
  1015. * when entering suspend or if the transport layer has already
  1016. * done it.
  1017. */
  1018. return (mvm->trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3) &&
  1019. (mvm->trans->runtime_pm_mode != IWL_PLAT_PM_MODE_D0I3);
  1020. }
  1021. static inline bool iwl_mvm_is_dqa_data_queue(struct iwl_mvm *mvm, u8 queue)
  1022. {
  1023. return (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE) &&
  1024. (queue <= IWL_MVM_DQA_MAX_DATA_QUEUE);
  1025. }
  1026. static inline bool iwl_mvm_is_dqa_mgmt_queue(struct iwl_mvm *mvm, u8 queue)
  1027. {
  1028. return (queue >= IWL_MVM_DQA_MIN_MGMT_QUEUE) &&
  1029. (queue <= IWL_MVM_DQA_MAX_MGMT_QUEUE);
  1030. }
  1031. static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
  1032. {
  1033. bool nvm_lar = mvm->nvm_data->lar_enabled;
  1034. bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
  1035. IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
  1036. if (iwlwifi_mod_params.lar_disable)
  1037. return false;
  1038. /*
  1039. * Enable LAR only if it is supported by the FW (TLV) &&
  1040. * enabled in the NVM
  1041. */
  1042. if (mvm->cfg->nvm_type == IWL_NVM_EXT)
  1043. return nvm_lar && tlv_lar;
  1044. else
  1045. return tlv_lar;
  1046. }
  1047. static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm)
  1048. {
  1049. return fw_has_api(&mvm->fw->ucode_capa,
  1050. IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
  1051. fw_has_capa(&mvm->fw->ucode_capa,
  1052. IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC);
  1053. }
  1054. static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm)
  1055. {
  1056. return fw_has_capa(&mvm->fw->ucode_capa,
  1057. IWL_UCODE_TLV_CAPA_BT_COEX_RRC) &&
  1058. IWL_MVM_BT_COEX_RRC;
  1059. }
  1060. static inline bool iwl_mvm_is_csum_supported(struct iwl_mvm *mvm)
  1061. {
  1062. return fw_has_capa(&mvm->fw->ucode_capa,
  1063. IWL_UCODE_TLV_CAPA_CSUM_SUPPORT) &&
  1064. !IWL_MVM_HW_CSUM_DISABLE;
  1065. }
  1066. static inline bool iwl_mvm_is_mplut_supported(struct iwl_mvm *mvm)
  1067. {
  1068. return fw_has_capa(&mvm->fw->ucode_capa,
  1069. IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT) &&
  1070. IWL_MVM_BT_COEX_MPLUT;
  1071. }
  1072. static inline
  1073. bool iwl_mvm_is_p2p_scm_uapsd_supported(struct iwl_mvm *mvm)
  1074. {
  1075. return fw_has_capa(&mvm->fw->ucode_capa,
  1076. IWL_UCODE_TLV_CAPA_P2P_SCM_UAPSD) &&
  1077. !(iwlwifi_mod_params.uapsd_disable &
  1078. IWL_DISABLE_UAPSD_P2P_CLIENT);
  1079. }
  1080. static inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm)
  1081. {
  1082. return fw_has_capa(&mvm->fw->ucode_capa,
  1083. IWL_UCODE_TLV_CAPA_MULTI_QUEUE_RX_SUPPORT);
  1084. }
  1085. static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm)
  1086. {
  1087. /* TODO - replace with TLV once defined */
  1088. return mvm->trans->cfg->use_tfh;
  1089. }
  1090. static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm)
  1091. {
  1092. /* TODO - better define this */
  1093. return mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000;
  1094. }
  1095. static inline bool iwl_mvm_is_cdb_supported(struct iwl_mvm *mvm)
  1096. {
  1097. /*
  1098. * TODO:
  1099. * The issue of how to determine CDB APIs and usage is still not fully
  1100. * defined.
  1101. * There is a compilation for CDB and non-CDB FW, but there may
  1102. * be also runtime check.
  1103. * For now there is a TLV for checking compilation mode, but a
  1104. * runtime check will also have to be here - once defined.
  1105. */
  1106. return fw_has_capa(&mvm->fw->ucode_capa,
  1107. IWL_UCODE_TLV_CAPA_CDB_SUPPORT);
  1108. }
  1109. static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)
  1110. {
  1111. return fw_has_api(&mvm->fw->ucode_capa,
  1112. IWL_UCODE_TLV_API_NEW_RX_STATS);
  1113. }
  1114. static inline bool iwl_mvm_has_quota_low_latency(struct iwl_mvm *mvm)
  1115. {
  1116. return fw_has_api(&mvm->fw->ucode_capa,
  1117. IWL_UCODE_TLV_API_QUOTA_LOW_LATENCY);
  1118. }
  1119. static inline bool iwl_mvm_has_tlc_offload(const struct iwl_mvm *mvm)
  1120. {
  1121. return fw_has_capa(&mvm->fw->ucode_capa,
  1122. IWL_UCODE_TLV_CAPA_TLC_OFFLOAD);
  1123. }
  1124. static inline struct agg_tx_status *
  1125. iwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp)
  1126. {
  1127. if (iwl_mvm_has_new_tx_api(mvm))
  1128. return &((struct iwl_mvm_tx_resp *)tx_resp)->status;
  1129. else
  1130. return ((struct iwl_mvm_tx_resp_v3 *)tx_resp)->status;
  1131. }
  1132. static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm)
  1133. {
  1134. #ifdef CONFIG_THERMAL
  1135. /* these two TLV are redundant since the responsibility to CT-kill by
  1136. * FW happens only after we send at least one command of
  1137. * temperature THs report.
  1138. */
  1139. return fw_has_capa(&mvm->fw->ucode_capa,
  1140. IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) &&
  1141. fw_has_capa(&mvm->fw->ucode_capa,
  1142. IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT);
  1143. #else /* CONFIG_THERMAL */
  1144. return false;
  1145. #endif /* CONFIG_THERMAL */
  1146. }
  1147. static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm)
  1148. {
  1149. return fw_has_capa(&mvm->fw->ucode_capa,
  1150. IWL_UCODE_TLV_CAPA_CTDP_SUPPORT);
  1151. }
  1152. extern const u8 iwl_mvm_ac_to_tx_fifo[];
  1153. extern const u8 iwl_mvm_ac_to_gen2_tx_fifo[];
  1154. static inline u8 iwl_mvm_mac_ac_to_tx_fifo(struct iwl_mvm *mvm,
  1155. enum ieee80211_ac_numbers ac)
  1156. {
  1157. return iwl_mvm_has_new_tx_api(mvm) ?
  1158. iwl_mvm_ac_to_gen2_tx_fifo[ac] : iwl_mvm_ac_to_tx_fifo[ac];
  1159. }
  1160. struct iwl_rate_info {
  1161. u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */
  1162. u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */
  1163. u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */
  1164. u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */
  1165. u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */
  1166. };
  1167. void __iwl_mvm_mac_stop(struct iwl_mvm *mvm);
  1168. int __iwl_mvm_mac_start(struct iwl_mvm *mvm);
  1169. /******************
  1170. * MVM Methods
  1171. ******************/
  1172. /* uCode */
  1173. int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
  1174. /* Utils */
  1175. int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
  1176. enum nl80211_band band);
  1177. void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
  1178. enum nl80211_band band,
  1179. struct ieee80211_tx_rate *r);
  1180. u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
  1181. void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
  1182. u8 first_antenna(u8 mask);
  1183. u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
  1184. void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime);
  1185. /* Tx / Host Commands */
  1186. int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
  1187. struct iwl_host_cmd *cmd);
  1188. int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id,
  1189. u32 flags, u16 len, const void *data);
  1190. int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm,
  1191. struct iwl_host_cmd *cmd,
  1192. u32 *status);
  1193. int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id,
  1194. u16 len, const void *data,
  1195. u32 *status);
  1196. int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
  1197. struct ieee80211_sta *sta);
  1198. int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb);
  1199. void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
  1200. struct iwl_tx_cmd *tx_cmd,
  1201. struct ieee80211_tx_info *info, u8 sta_id);
  1202. void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
  1203. struct ieee80211_tx_info *info,
  1204. struct ieee80211_sta *sta, __le16 fc);
  1205. #ifdef CONFIG_IWLWIFI_DEBUG
  1206. const char *iwl_mvm_get_tx_fail_reason(u32 status);
  1207. #else
  1208. static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
  1209. #endif
  1210. int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
  1211. int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags);
  1212. int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id,
  1213. u16 tids, u32 flags);
  1214. void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
  1215. static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info,
  1216. struct iwl_tx_cmd *tx_cmd)
  1217. {
  1218. struct ieee80211_key_conf *keyconf = info->control.hw_key;
  1219. tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
  1220. memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
  1221. }
  1222. static inline void iwl_mvm_wait_for_async_handlers(struct iwl_mvm *mvm)
  1223. {
  1224. flush_work(&mvm->async_handlers_wk);
  1225. }
  1226. /* Statistics */
  1227. void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
  1228. struct iwl_rx_packet *pkt);
  1229. void iwl_mvm_rx_statistics(struct iwl_mvm *mvm,
  1230. struct iwl_rx_cmd_buffer *rxb);
  1231. int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear);
  1232. void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm);
  1233. /* NVM */
  1234. int iwl_nvm_init(struct iwl_mvm *mvm);
  1235. int iwl_mvm_load_nvm_to_nic(struct iwl_mvm *mvm);
  1236. int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm);
  1237. static inline u8 iwl_mvm_get_valid_tx_ant(struct iwl_mvm *mvm)
  1238. {
  1239. return mvm->nvm_data && mvm->nvm_data->valid_tx_ant ?
  1240. mvm->fw->valid_tx_ant & mvm->nvm_data->valid_tx_ant :
  1241. mvm->fw->valid_tx_ant;
  1242. }
  1243. static inline u8 iwl_mvm_get_valid_rx_ant(struct iwl_mvm *mvm)
  1244. {
  1245. return mvm->nvm_data && mvm->nvm_data->valid_rx_ant ?
  1246. mvm->fw->valid_rx_ant & mvm->nvm_data->valid_rx_ant :
  1247. mvm->fw->valid_rx_ant;
  1248. }
  1249. static inline u32 iwl_mvm_get_phy_config(struct iwl_mvm *mvm)
  1250. {
  1251. u32 phy_config = ~(FW_PHY_CFG_TX_CHAIN |
  1252. FW_PHY_CFG_RX_CHAIN);
  1253. u32 valid_rx_ant = iwl_mvm_get_valid_rx_ant(mvm);
  1254. u32 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm);
  1255. phy_config |= valid_tx_ant << FW_PHY_CFG_TX_CHAIN_POS |
  1256. valid_rx_ant << FW_PHY_CFG_RX_CHAIN_POS;
  1257. return mvm->fw->phy_config & phy_config;
  1258. }
  1259. int iwl_mvm_up(struct iwl_mvm *mvm);
  1260. int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);
  1261. int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm);
  1262. bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
  1263. struct iwl_bcast_filter_cmd *cmd);
  1264. /*
  1265. * FW notifications / CMD responses handlers
  1266. * Convention: iwl_mvm_rx_<NAME OF THE CMD>
  1267. */
  1268. void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1269. void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
  1270. struct iwl_rx_cmd_buffer *rxb);
  1271. void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
  1272. struct iwl_rx_cmd_buffer *rxb, int queue);
  1273. void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,
  1274. struct iwl_rx_cmd_buffer *rxb, int queue);
  1275. int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
  1276. const u8 *data, u32 count);
  1277. void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
  1278. int queue);
  1279. void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1280. void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,
  1281. struct iwl_rx_cmd_buffer *rxb);
  1282. void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1283. void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
  1284. struct iwl_rx_cmd_buffer *rxb);
  1285. void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1286. void iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm,
  1287. struct iwl_rx_cmd_buffer *rxb);
  1288. void iwl_mvm_rx_mfuart_notif(struct iwl_mvm *mvm,
  1289. struct iwl_rx_cmd_buffer *rxb);
  1290. void iwl_mvm_rx_shared_mem_cfg_notif(struct iwl_mvm *mvm,
  1291. struct iwl_rx_cmd_buffer *rxb);
  1292. /* MVM PHY */
  1293. int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  1294. struct cfg80211_chan_def *chandef,
  1295. u8 chains_static, u8 chains_dynamic);
  1296. int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
  1297. struct cfg80211_chan_def *chandef,
  1298. u8 chains_static, u8 chains_dynamic);
  1299. void iwl_mvm_phy_ctxt_ref(struct iwl_mvm *mvm,
  1300. struct iwl_mvm_phy_ctxt *ctxt);
  1301. void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm,
  1302. struct iwl_mvm_phy_ctxt *ctxt);
  1303. int iwl_mvm_phy_ctx_count(struct iwl_mvm *mvm);
  1304. u8 iwl_mvm_get_channel_width(struct cfg80211_chan_def *chandef);
  1305. u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef);
  1306. /* MAC (virtual interface) programming */
  1307. int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1308. int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1309. int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1310. bool force_assoc_off, const u8 *bssid_override);
  1311. int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1312. u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif);
  1313. int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
  1314. struct ieee80211_vif *vif);
  1315. void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
  1316. struct iwl_rx_cmd_buffer *rxb);
  1317. void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
  1318. struct iwl_rx_cmd_buffer *rxb);
  1319. void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
  1320. struct iwl_rx_cmd_buffer *rxb);
  1321. void iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm,
  1322. struct iwl_rx_cmd_buffer *rxb);
  1323. void iwl_mvm_sta_pm_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1324. void iwl_mvm_window_status_notif(struct iwl_mvm *mvm,
  1325. struct iwl_rx_cmd_buffer *rxb);
  1326. void iwl_mvm_mac_ctxt_recalc_tsf_id(struct iwl_mvm *mvm,
  1327. struct ieee80211_vif *vif);
  1328. unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm *mvm,
  1329. struct ieee80211_vif *exclude_vif);
  1330. void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm,
  1331. struct iwl_rx_cmd_buffer *rxb);
  1332. /* Bindings */
  1333. int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1334. int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1335. /* Quota management */
  1336. static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm)
  1337. {
  1338. return iwl_mvm_has_quota_low_latency(mvm) ?
  1339. sizeof(struct iwl_time_quota_cmd) :
  1340. sizeof(struct iwl_time_quota_cmd_v1);
  1341. }
  1342. static inline struct iwl_time_quota_data
  1343. *iwl_mvm_quota_cmd_get_quota(struct iwl_mvm *mvm,
  1344. struct iwl_time_quota_cmd *cmd,
  1345. int i)
  1346. {
  1347. struct iwl_time_quota_data_v1 *quotas;
  1348. if (iwl_mvm_has_quota_low_latency(mvm))
  1349. return &cmd->quotas[i];
  1350. quotas = (struct iwl_time_quota_data_v1 *)cmd->quotas;
  1351. return (struct iwl_time_quota_data *)&quotas[i];
  1352. }
  1353. int iwl_mvm_update_quotas(struct iwl_mvm *mvm, bool force_upload,
  1354. struct ieee80211_vif *disabled_vif);
  1355. /* Scanning */
  1356. int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1357. struct cfg80211_scan_request *req,
  1358. struct ieee80211_scan_ies *ies);
  1359. int iwl_mvm_scan_size(struct iwl_mvm *mvm);
  1360. int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);
  1361. int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
  1362. void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
  1363. void iwl_mvm_scan_timeout_wk(struct work_struct *work);
  1364. /* Scheduled scan */
  1365. void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
  1366. struct iwl_rx_cmd_buffer *rxb);
  1367. void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm,
  1368. struct iwl_rx_cmd_buffer *rxb);
  1369. int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
  1370. struct ieee80211_vif *vif,
  1371. struct cfg80211_sched_scan_request *req,
  1372. struct ieee80211_scan_ies *ies,
  1373. int type);
  1374. void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,
  1375. struct iwl_rx_cmd_buffer *rxb);
  1376. /* UMAC scan */
  1377. int iwl_mvm_config_scan(struct iwl_mvm *mvm);
  1378. void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
  1379. struct iwl_rx_cmd_buffer *rxb);
  1380. void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
  1381. struct iwl_rx_cmd_buffer *rxb);
  1382. /* MVM debugfs */
  1383. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1384. int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir);
  1385. void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1386. void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1387. #else
  1388. static inline int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm,
  1389. struct dentry *dbgfs_dir)
  1390. {
  1391. return 0;
  1392. }
  1393. static inline void
  1394. iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1395. {
  1396. }
  1397. static inline void
  1398. iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1399. {
  1400. }
  1401. #endif /* CONFIG_IWLWIFI_DEBUGFS */
  1402. /* rate scaling */
  1403. int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init);
  1404. void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg);
  1405. int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate);
  1406. void rs_update_last_rssi(struct iwl_mvm *mvm,
  1407. struct iwl_mvm_sta *mvmsta,
  1408. struct ieee80211_rx_status *rx_status);
  1409. /* power management */
  1410. int iwl_mvm_power_update_device(struct iwl_mvm *mvm);
  1411. int iwl_mvm_power_update_mac(struct iwl_mvm *mvm);
  1412. int iwl_mvm_power_update_ps(struct iwl_mvm *mvm);
  1413. int iwl_mvm_power_mac_dbgfs_read(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1414. char *buf, int bufsz);
  1415. void iwl_mvm_power_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1416. void iwl_mvm_power_uapsd_misbehaving_ap_notif(struct iwl_mvm *mvm,
  1417. struct iwl_rx_cmd_buffer *rxb);
  1418. #ifdef CONFIG_IWLWIFI_LEDS
  1419. int iwl_mvm_leds_init(struct iwl_mvm *mvm);
  1420. void iwl_mvm_leds_exit(struct iwl_mvm *mvm);
  1421. void iwl_mvm_leds_sync(struct iwl_mvm *mvm);
  1422. #else
  1423. static inline int iwl_mvm_leds_init(struct iwl_mvm *mvm)
  1424. {
  1425. return 0;
  1426. }
  1427. static inline void iwl_mvm_leds_exit(struct iwl_mvm *mvm)
  1428. {
  1429. }
  1430. static inline void iwl_mvm_leds_sync(struct iwl_mvm *mvm)
  1431. {
  1432. }
  1433. #endif
  1434. /* D3 (WoWLAN, NetDetect) */
  1435. int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
  1436. int iwl_mvm_resume(struct ieee80211_hw *hw);
  1437. void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled);
  1438. void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
  1439. struct ieee80211_vif *vif,
  1440. struct cfg80211_gtk_rekey_data *data);
  1441. void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw,
  1442. struct ieee80211_vif *vif,
  1443. struct inet6_dev *idev);
  1444. void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw,
  1445. struct ieee80211_vif *vif, int idx);
  1446. extern const struct file_operations iwl_dbgfs_d3_test_ops;
  1447. #ifdef CONFIG_PM
  1448. int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
  1449. struct ieee80211_vif *vif,
  1450. bool host_awake,
  1451. u32 cmd_flags);
  1452. void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm,
  1453. struct ieee80211_vif *vif,
  1454. struct iwl_wowlan_status *status);
  1455. void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm,
  1456. struct ieee80211_vif *vif);
  1457. #else
  1458. static inline int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
  1459. struct ieee80211_vif *vif,
  1460. bool host_awake,
  1461. u32 cmd_flags)
  1462. {
  1463. return 0;
  1464. }
  1465. static inline void iwl_mvm_d0i3_update_keys(struct iwl_mvm *mvm,
  1466. struct ieee80211_vif *vif,
  1467. struct iwl_wowlan_status *status)
  1468. {
  1469. }
  1470. static inline void
  1471. iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
  1472. {
  1473. }
  1474. #endif
  1475. void iwl_mvm_set_wowlan_qos_seq(struct iwl_mvm_sta *mvm_ap_sta,
  1476. struct iwl_wowlan_config_cmd *cmd);
  1477. int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm,
  1478. struct ieee80211_vif *vif,
  1479. bool disable_offloading,
  1480. bool offload_ns,
  1481. u32 cmd_flags);
  1482. /* D0i3 */
  1483. void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1484. void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1485. int iwl_mvm_ref_sync(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type);
  1486. bool iwl_mvm_ref_taken(struct iwl_mvm *mvm);
  1487. void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq);
  1488. int iwl_mvm_enter_d0i3(struct iwl_op_mode *op_mode);
  1489. int iwl_mvm_exit_d0i3(struct iwl_op_mode *op_mode);
  1490. int _iwl_mvm_exit_d0i3(struct iwl_mvm *mvm);
  1491. /* BT Coex */
  1492. int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm);
  1493. void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
  1494. struct iwl_rx_cmd_buffer *rxb);
  1495. void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1496. enum ieee80211_rssi_event_data);
  1497. void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);
  1498. u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
  1499. struct ieee80211_sta *sta);
  1500. bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
  1501. struct ieee80211_sta *sta);
  1502. bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant);
  1503. bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm);
  1504. bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
  1505. enum nl80211_band band);
  1506. u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
  1507. struct ieee80211_tx_info *info, u8 ac);
  1508. /* beacon filtering */
  1509. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1510. void
  1511. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  1512. struct iwl_beacon_filter_cmd *cmd);
  1513. #else
  1514. static inline void
  1515. iwl_mvm_beacon_filter_debugfs_parameters(struct ieee80211_vif *vif,
  1516. struct iwl_beacon_filter_cmd *cmd)
  1517. {}
  1518. #endif
  1519. int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
  1520. struct ieee80211_vif *vif,
  1521. bool enable, u32 flags);
  1522. int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
  1523. struct ieee80211_vif *vif,
  1524. u32 flags);
  1525. int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
  1526. struct ieee80211_vif *vif,
  1527. u32 flags);
  1528. /* SMPS */
  1529. void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1530. enum iwl_mvm_smps_type_request req_type,
  1531. enum ieee80211_smps_mode smps_request);
  1532. bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm);
  1533. /* Low latency */
  1534. int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1535. bool low_latency,
  1536. enum iwl_mvm_low_latency_cause cause);
  1537. /* get SystemLowLatencyMode - only needed for beacon threshold? */
  1538. bool iwl_mvm_low_latency(struct iwl_mvm *mvm);
  1539. /* get VMACLowLatencyMode */
  1540. static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
  1541. {
  1542. /*
  1543. * should this consider associated/active/... state?
  1544. *
  1545. * Normally low-latency should only be active on interfaces
  1546. * that are active, but at least with debugfs it can also be
  1547. * enabled on interfaces that aren't active. However, when
  1548. * interface aren't active then they aren't added into the
  1549. * binding, so this has no real impact. For now, just return
  1550. * the current desired low-latency state.
  1551. */
  1552. return mvmvif->low_latency;
  1553. }
  1554. static inline
  1555. void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set,
  1556. enum iwl_mvm_low_latency_cause cause)
  1557. {
  1558. if (set)
  1559. mvmvif->low_latency |= cause;
  1560. else
  1561. mvmvif->low_latency &= ~cause;
  1562. }
  1563. /* hw scheduler queue config */
  1564. bool iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  1565. u16 ssn, const struct iwl_trans_txq_scd_cfg *cfg,
  1566. unsigned int wdg_timeout);
  1567. int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm, int mac80211_queue,
  1568. u8 sta_id, u8 tid, unsigned int timeout);
  1569. int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
  1570. u8 tid, u8 flags);
  1571. int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq);
  1572. /* Return a bitmask with all the hw supported queues, except for the
  1573. * command queue, which can't be flushed.
  1574. */
  1575. static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm)
  1576. {
  1577. return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) &
  1578. ~BIT(IWL_MVM_DQA_CMD_QUEUE));
  1579. }
  1580. static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
  1581. {
  1582. iwl_fw_cancel_timestamp(&mvm->fwrt);
  1583. iwl_free_fw_paging(&mvm->fwrt);
  1584. clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
  1585. iwl_fw_dump_conf_clear(&mvm->fwrt);
  1586. iwl_trans_stop_device(mvm->trans);
  1587. }
  1588. /* Stop/start all mac queues in a given bitmap */
  1589. void iwl_mvm_start_mac_queues(struct iwl_mvm *mvm, unsigned long mq);
  1590. void iwl_mvm_stop_mac_queues(struct iwl_mvm *mvm, unsigned long mq);
  1591. /* Re-configure the SCD for a queue that has already been configured */
  1592. int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id,
  1593. int tid, int frame_limit, u16 ssn);
  1594. /* Thermal management and CT-kill */
  1595. void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);
  1596. void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp);
  1597. void iwl_mvm_temp_notif(struct iwl_mvm *mvm,
  1598. struct iwl_rx_cmd_buffer *rxb);
  1599. void iwl_mvm_tt_handler(struct iwl_mvm *mvm);
  1600. void iwl_mvm_thermal_initialize(struct iwl_mvm *mvm, u32 min_backoff);
  1601. void iwl_mvm_thermal_exit(struct iwl_mvm *mvm);
  1602. void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
  1603. int iwl_mvm_get_temp(struct iwl_mvm *mvm, s32 *temp);
  1604. void iwl_mvm_ct_kill_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1605. void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm);
  1606. int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm);
  1607. int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget);
  1608. /* Location Aware Regulatory */
  1609. struct iwl_mcc_update_resp *
  1610. iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
  1611. enum iwl_mcc_source src_id);
  1612. int iwl_mvm_init_mcc(struct iwl_mvm *mvm);
  1613. void iwl_mvm_rx_chub_update_mcc(struct iwl_mvm *mvm,
  1614. struct iwl_rx_cmd_buffer *rxb);
  1615. struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
  1616. const char *alpha2,
  1617. enum iwl_mcc_source src_id,
  1618. bool *changed);
  1619. struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
  1620. bool *changed);
  1621. int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm);
  1622. void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);
  1623. /* smart fifo */
  1624. int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1625. bool added_vif);
  1626. /* TDLS */
  1627. /*
  1628. * We use TID 4 (VI) as a FW-used-only TID when TDLS connections are present.
  1629. * This TID is marked as used vs the AP and all connected TDLS peers.
  1630. */
  1631. #define IWL_MVM_TDLS_FW_TID 4
  1632. int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  1633. void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm);
  1634. void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1635. bool sta_added);
  1636. void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
  1637. struct ieee80211_vif *vif);
  1638. int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,
  1639. struct ieee80211_vif *vif,
  1640. struct ieee80211_sta *sta, u8 oper_class,
  1641. struct cfg80211_chan_def *chandef,
  1642. struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
  1643. void iwl_mvm_tdls_recv_channel_switch(struct ieee80211_hw *hw,
  1644. struct ieee80211_vif *vif,
  1645. struct ieee80211_tdls_ch_sw_params *params);
  1646. void iwl_mvm_tdls_cancel_channel_switch(struct ieee80211_hw *hw,
  1647. struct ieee80211_vif *vif,
  1648. struct ieee80211_sta *sta);
  1649. void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
  1650. void iwl_mvm_tdls_ch_switch_work(struct work_struct *work);
  1651. void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
  1652. struct iwl_mvm_internal_rxq_notif *notif,
  1653. u32 size);
  1654. void iwl_mvm_reorder_timer_expired(struct timer_list *t);
  1655. struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
  1656. bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm);
  1657. void iwl_mvm_inactivity_check(struct iwl_mvm *mvm);
  1658. void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
  1659. unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
  1660. struct ieee80211_vif *vif,
  1661. bool tdls, bool cmd_q);
  1662. void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  1663. const char *errmsg);
  1664. void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm,
  1665. struct ieee80211_vif *vif,
  1666. const struct ieee80211_sta *sta,
  1667. u16 tid);
  1668. int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b);
  1669. int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);
  1670. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1671. void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
  1672. struct ieee80211_vif *vif,
  1673. struct ieee80211_sta *sta,
  1674. struct dentry *dir);
  1675. #endif
  1676. #endif /* __IWL_MVM_H__ */