sta.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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 - 2014 Intel Mobile Communications GmbH
  10. * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
  11. * Copyright(c) 2018 Intel Corporation
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of version 2 of the GNU General Public License as
  15. * published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * General Public License for more details.
  21. *
  22. * The full GNU General Public License is included in this distribution
  23. * in the file called COPYING.
  24. *
  25. * Contact Information:
  26. * Intel Linux Wireless <linuxwifi@intel.com>
  27. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  28. *
  29. * BSD LICENSE
  30. *
  31. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  32. * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  33. * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
  34. * Copyright(c) 2018 Intel Corporation
  35. * All rights reserved.
  36. *
  37. * Redistribution and use in source and binary forms, with or without
  38. * modification, are permitted provided that the following conditions
  39. * are met:
  40. *
  41. * * Redistributions of source code must retain the above copyright
  42. * notice, this list of conditions and the following disclaimer.
  43. * * Redistributions in binary form must reproduce the above copyright
  44. * notice, this list of conditions and the following disclaimer in
  45. * the documentation and/or other materials provided with the
  46. * distribution.
  47. * * Neither the name Intel Corporation nor the names of its
  48. * contributors may be used to endorse or promote products derived
  49. * from this software without specific prior written permission.
  50. *
  51. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  52. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  53. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  54. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  55. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  56. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  57. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  58. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  59. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  60. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  61. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  62. *
  63. *****************************************************************************/
  64. #ifndef __sta_h__
  65. #define __sta_h__
  66. #include <linux/spinlock.h>
  67. #include <net/mac80211.h>
  68. #include <linux/wait.h>
  69. #include "iwl-trans.h" /* for IWL_MAX_TID_COUNT */
  70. #include "fw-api.h" /* IWL_MVM_STATION_COUNT */
  71. #include "rs.h"
  72. struct iwl_mvm;
  73. struct iwl_mvm_vif;
  74. /**
  75. * DOC: DQA - Dynamic Queue Allocation -introduction
  76. *
  77. * Dynamic Queue Allocation (AKA "DQA") is a feature implemented in iwlwifi
  78. * driver to allow dynamic allocation of queues on-demand, rather than allocate
  79. * them statically ahead of time. Ideally, we would like to allocate one queue
  80. * per RA/TID, thus allowing an AP - for example - to send BE traffic to STA2
  81. * even if it also needs to send traffic to a sleeping STA1, without being
  82. * blocked by the sleeping station.
  83. *
  84. * Although the queues in DQA mode are dynamically allocated, there are still
  85. * some queues that are statically allocated:
  86. * TXQ #0 - command queue
  87. * TXQ #1 - aux frames
  88. * TXQ #2 - P2P device frames
  89. * TXQ #3 - P2P GO/SoftAP GCAST/BCAST frames
  90. * TXQ #4 - BSS DATA frames queue
  91. * TXQ #5-8 - Non-QoS and MGMT frames queue pool
  92. * TXQ #9 - P2P GO/SoftAP probe responses
  93. * TXQ #10-31 - DATA frames queue pool
  94. * The queues are dynamically taken from either the MGMT frames queue pool or
  95. * the DATA frames one. See the %iwl_mvm_dqa_txq for more information on every
  96. * queue.
  97. *
  98. * When a frame for a previously unseen RA/TID comes in, it needs to be deferred
  99. * until a queue is allocated for it, and only then can be TXed. Therefore, it
  100. * is placed into %iwl_mvm_tid_data.deferred_tx_frames, and a worker called
  101. * %mvm->add_stream_wk later allocates the queues and TXes the deferred frames.
  102. *
  103. * For convenience, MGMT is considered as if it has TID=8, and go to the MGMT
  104. * queues in the pool. If there is no longer a free MGMT queue to allocate, a
  105. * queue will be allocated from the DATA pool instead. Since QoS NDPs can create
  106. * a problem for aggregations, they too will use a MGMT queue.
  107. *
  108. * When adding a STA, a DATA queue is reserved for it so that it can TX from
  109. * it. If no such free queue exists for reserving, the STA addition will fail.
  110. *
  111. * If the DATA queue pool gets exhausted, no new STA will be accepted, and if a
  112. * new RA/TID comes in for an existing STA, one of the STA's queues will become
  113. * shared and will serve more than the single TID (but always for the same RA!).
  114. *
  115. * When a RA/TID needs to become aggregated, no new queue is required to be
  116. * allocated, only mark the queue as aggregated via the ADD_STA command. Note,
  117. * however, that a shared queue cannot be aggregated, and only after the other
  118. * TIDs become inactive and are removed - only then can the queue be
  119. * reconfigured and become aggregated.
  120. *
  121. * When removing a station, its queues are returned to the pool for reuse. Here
  122. * we also need to make sure that we are synced with the worker thread that TXes
  123. * the deferred frames so we don't get into a situation where the queues are
  124. * removed and then the worker puts deferred frames onto the released queues or
  125. * tries to allocate new queues for a STA we don't need anymore.
  126. */
  127. /**
  128. * DOC: station table - introduction
  129. *
  130. * The station table is a list of data structure that reprensent the stations.
  131. * In STA/P2P client mode, the driver will hold one station for the AP/ GO.
  132. * In GO/AP mode, the driver will have as many stations as associated clients.
  133. * All these stations are reflected in the fw's station table. The driver
  134. * keeps the fw's station table up to date with the ADD_STA command. Stations
  135. * can be removed by the REMOVE_STA command.
  136. *
  137. * All the data related to a station is held in the structure %iwl_mvm_sta
  138. * which is embed in the mac80211's %ieee80211_sta (in the drv_priv) area.
  139. * This data includes the index of the station in the fw, per tid information
  140. * (sequence numbers, Block-ack state machine, etc...). The stations are
  141. * created and deleted by the %sta_state callback from %ieee80211_ops.
  142. *
  143. * The driver holds a map: %fw_id_to_mac_id that allows to fetch a
  144. * %ieee80211_sta (and the %iwl_mvm_sta embedded into it) based on a fw
  145. * station index. That way, the driver is able to get the tid related data in
  146. * O(1) in time sensitive paths (Tx / Tx response / BA notification). These
  147. * paths are triggered by the fw, and the driver needs to get a pointer to the
  148. * %ieee80211 structure. This map helps to get that pointer quickly.
  149. */
  150. /**
  151. * DOC: station table - locking
  152. *
  153. * As stated before, the station is created / deleted by mac80211's %sta_state
  154. * callback from %ieee80211_ops which can sleep. The next paragraph explains
  155. * the locking of a single stations, the next ones relates to the station
  156. * table.
  157. *
  158. * The station holds the sequence number per tid. So this data needs to be
  159. * accessed in the Tx path (which is softIRQ). It also holds the Block-Ack
  160. * information (the state machine / and the logic that checks if the queues
  161. * were drained), so it also needs to be accessible from the Tx response flow.
  162. * In short, the station needs to be access from sleepable context as well as
  163. * from tasklets, so the station itself needs a spinlock.
  164. *
  165. * The writers of %fw_id_to_mac_id map are serialized by the global mutex of
  166. * the mvm op_mode. This is possible since %sta_state can sleep.
  167. * The pointers in this map are RCU protected, hence we won't replace the
  168. * station while we have Tx / Tx response / BA notification running.
  169. *
  170. * If a station is deleted while it still has packets in its A-MPDU queues,
  171. * then the reclaim flow will notice that there is no station in the map for
  172. * sta_id and it will dump the responses.
  173. */
  174. /**
  175. * DOC: station table - internal stations
  176. *
  177. * The FW needs a few internal stations that are not reflected in
  178. * mac80211, such as broadcast station in AP / GO mode, or AUX sta for
  179. * scanning and P2P device (during the GO negotiation).
  180. * For these kind of stations we have %iwl_mvm_int_sta struct which holds the
  181. * data relevant for them from both %iwl_mvm_sta and %ieee80211_sta.
  182. * Usually the data for these stations is static, so no locking is required,
  183. * and no TID data as this is also not needed.
  184. * One thing to note, is that these stations have an ID in the fw, but not
  185. * in mac80211. In order to "reserve" them a sta_id in %fw_id_to_mac_id
  186. * we fill ERR_PTR(EINVAL) in this mapping and all other dereferencing of
  187. * pointers from this mapping need to check that the value is not error
  188. * or NULL.
  189. *
  190. * Currently there is only one auxiliary station for scanning, initialized
  191. * on init.
  192. */
  193. /**
  194. * DOC: station table - AP Station in STA mode
  195. *
  196. * %iwl_mvm_vif includes the index of the AP station in the fw's STA table:
  197. * %ap_sta_id. To get the point to the corresponding %ieee80211_sta,
  198. * &fw_id_to_mac_id can be used. Due to the way the fw works, we must not remove
  199. * the AP station from the fw before setting the MAC context as unassociated.
  200. * Hence, %fw_id_to_mac_id[%ap_sta_id] will be NULLed when the AP station is
  201. * removed by mac80211, but the station won't be removed in the fw until the
  202. * VIF is set as unassociated. Then, %ap_sta_id will be invalidated.
  203. */
  204. /**
  205. * DOC: station table - Drain vs. Flush
  206. *
  207. * Flush means that all the frames in the SCD queue are dumped regardless the
  208. * station to which they were sent. We do that when we disassociate and before
  209. * we remove the STA of the AP. The flush can be done synchronously against the
  210. * fw.
  211. * Drain means that the fw will drop all the frames sent to a specific station.
  212. * This is useful when a client (if we are IBSS / GO or AP) disassociates.
  213. */
  214. /**
  215. * DOC: station table - fw restart
  216. *
  217. * When the fw asserts, or we have any other issue that requires to reset the
  218. * driver, we require mac80211 to reconfigure the driver. Since the private
  219. * data of the stations is embed in mac80211's %ieee80211_sta, that data will
  220. * not be zeroed and needs to be reinitialized manually.
  221. * %IWL_MVM_STATUS_IN_HW_RESTART is set during restart and that will hint us
  222. * that we must not allocate a new sta_id but reuse the previous one. This
  223. * means that the stations being re-added after the reset will have the same
  224. * place in the fw as before the reset. We do need to zero the %fw_id_to_mac_id
  225. * map, since the stations aren't in the fw any more. Internal stations that
  226. * are not added by mac80211 will be re-added in the init flow that is called
  227. * after the restart: mac80211 call's %iwl_mvm_mac_start which calls to
  228. * %iwl_mvm_up.
  229. */
  230. /**
  231. * DOC: AP mode - PS
  232. *
  233. * When a station is asleep, the fw will set it as "asleep". All frames on
  234. * shared queues (i.e. non-aggregation queues) to that station will be dropped
  235. * by the fw (%TX_STATUS_FAIL_DEST_PS failure code).
  236. *
  237. * AMPDUs are in a separate queue that is stopped by the fw. We just need to
  238. * let mac80211 know when there are frames in these queues so that it can
  239. * properly handle trigger frames.
  240. *
  241. * When a trigger frame is received, mac80211 tells the driver to send frames
  242. * from the AMPDU queues or sends frames to non-aggregation queues itself,
  243. * depending on which ACs are delivery-enabled and what TID has frames to
  244. * transmit. Note that mac80211 has all the knowledge since all the non-agg
  245. * frames are buffered / filtered, and the driver tells mac80211 about agg
  246. * frames). The driver needs to tell the fw to let frames out even if the
  247. * station is asleep. This is done by %iwl_mvm_sta_modify_sleep_tx_count.
  248. *
  249. * When we receive a frame from that station with PM bit unset, the driver
  250. * needs to let the fw know that this station isn't asleep any more. This is
  251. * done by %iwl_mvm_sta_modify_ps_wake in response to mac80211 signaling the
  252. * station's wakeup.
  253. *
  254. * For a GO, the Service Period might be cut short due to an absence period
  255. * of the GO. In this (and all other cases) the firmware notifies us with the
  256. * EOSP_NOTIFICATION, and we notify mac80211 of that. Further frames that we
  257. * already sent to the device will be rejected again.
  258. *
  259. * See also "AP support for powersaving clients" in mac80211.h.
  260. */
  261. /**
  262. * enum iwl_mvm_agg_state
  263. *
  264. * The state machine of the BA agreement establishment / tear down.
  265. * These states relate to a specific RA / TID.
  266. *
  267. * @IWL_AGG_OFF: aggregation is not used
  268. * @IWL_AGG_QUEUED: aggregation start work has been queued
  269. * @IWL_AGG_STARTING: aggregation are starting (between start and oper)
  270. * @IWL_AGG_ON: aggregation session is up
  271. * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
  272. * HW queue to be empty from packets for this RA /TID.
  273. * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
  274. * HW queue to be empty from packets for this RA /TID.
  275. */
  276. enum iwl_mvm_agg_state {
  277. IWL_AGG_OFF = 0,
  278. IWL_AGG_QUEUED,
  279. IWL_AGG_STARTING,
  280. IWL_AGG_ON,
  281. IWL_EMPTYING_HW_QUEUE_ADDBA,
  282. IWL_EMPTYING_HW_QUEUE_DELBA,
  283. };
  284. /**
  285. * struct iwl_mvm_tid_data - holds the states for each RA / TID
  286. * @deferred_tx_frames: deferred TX frames for this RA/TID
  287. * @seq_number: the next WiFi sequence number to use
  288. * @next_reclaimed: the WiFi sequence number of the next packet to be acked.
  289. * This is basically (last acked packet++).
  290. * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
  291. * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA).
  292. * @lq_color: the color of the LQ command as it appears in tx response.
  293. * @amsdu_in_ampdu_allowed: true if A-MSDU in A-MPDU is allowed.
  294. * @state: state of the BA agreement establishment / tear down.
  295. * @txq_id: Tx queue used by the BA session / DQA
  296. * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
  297. * the first packet to be sent in legacy HW queue in Tx AGG stop flow.
  298. * Basically when next_reclaimed reaches ssn, we can tell mac80211 that
  299. * we are ready to finish the Tx AGG stop / start flow.
  300. * @tx_time: medium time consumed by this A-MPDU
  301. * @is_tid_active: has this TID sent traffic in the last
  302. * %IWL_MVM_DQA_QUEUE_TIMEOUT time period. If %txq_id is invalid, this
  303. * field should be ignored.
  304. * @tpt_meas_start: time of the throughput measurements start, is reset every HZ
  305. * @tx_count_last: number of frames transmitted during the last second
  306. * @tx_count: counts the number of frames transmitted since the last reset of
  307. * tpt_meas_start
  308. */
  309. struct iwl_mvm_tid_data {
  310. struct sk_buff_head deferred_tx_frames;
  311. u16 seq_number;
  312. u16 next_reclaimed;
  313. /* The rest is Tx AGG related */
  314. u32 rate_n_flags;
  315. u8 lq_color;
  316. bool amsdu_in_ampdu_allowed;
  317. enum iwl_mvm_agg_state state;
  318. u16 txq_id;
  319. u16 ssn;
  320. u16 tx_time;
  321. bool is_tid_active;
  322. unsigned long tpt_meas_start;
  323. u32 tx_count_last;
  324. u32 tx_count;
  325. };
  326. struct iwl_mvm_key_pn {
  327. struct rcu_head rcu_head;
  328. struct {
  329. u8 pn[IWL_MAX_TID_COUNT][IEEE80211_CCMP_PN_LEN];
  330. } ____cacheline_aligned_in_smp q[];
  331. };
  332. struct iwl_mvm_delba_data {
  333. u32 baid;
  334. } __packed;
  335. struct iwl_mvm_delba_notif {
  336. struct iwl_mvm_internal_rxq_notif metadata;
  337. struct iwl_mvm_delba_data delba;
  338. } __packed;
  339. /**
  340. * struct iwl_mvm_rxq_dup_data - per station per rx queue data
  341. * @last_seq: last sequence per tid for duplicate packet detection
  342. * @last_sub_frame: last subframe packet
  343. */
  344. struct iwl_mvm_rxq_dup_data {
  345. __le16 last_seq[IWL_MAX_TID_COUNT + 1];
  346. u8 last_sub_frame[IWL_MAX_TID_COUNT + 1];
  347. } ____cacheline_aligned_in_smp;
  348. /**
  349. * struct iwl_mvm_sta - representation of a station in the driver
  350. * @sta_id: the index of the station in the fw (will be replaced by id_n_color)
  351. * @tfd_queue_msk: the tfd queues used by the station
  352. * @mac_id_n_color: the MAC context this station is linked to
  353. * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for
  354. * tid.
  355. * @max_agg_bufsize: the maximal size of the AGG buffer for this station
  356. * @sta_type: station type
  357. * @sta_state: station state according to enum %ieee80211_sta_state
  358. * @bt_reduced_txpower: is reduced tx power enabled for this station
  359. * @next_status_eosp: the next reclaimed packet is a PS-Poll response and
  360. * we need to signal the EOSP
  361. * @lock: lock to protect the whole struct. Since %tid_data is access from Tx
  362. * and from Tx response flow, it needs a spinlock.
  363. * @tid_data: per tid data + mgmt. Look at %iwl_mvm_tid_data.
  364. * @tid_to_baid: a simple map of TID to baid
  365. * @lq_sta: holds rate scaling data, either for the case when RS is done in
  366. * the driver - %rs_drv or in the FW - %rs_fw.
  367. * @reserved_queue: the queue reserved for this STA for DQA purposes
  368. * Every STA has is given one reserved queue to allow it to operate. If no
  369. * such queue can be guaranteed, the STA addition will fail.
  370. * @tx_protection: reference counter for controlling the Tx protection.
  371. * @tt_tx_protection: is thermal throttling enable Tx protection?
  372. * @disable_tx: is tx to this STA disabled?
  373. * @amsdu_enabled: bitmap of TX AMSDU allowed TIDs.
  374. * In case TLC offload is not active it is either 0xFFFF or 0.
  375. * @max_amsdu_len: max AMSDU length
  376. * @agg_tids: bitmap of tids whose status is operational aggregated (IWL_AGG_ON)
  377. * @sleep_tx_count: the number of frames that we told the firmware to let out
  378. * even when that station is asleep. This is useful in case the queue
  379. * gets empty before all the frames were sent, which can happen when
  380. * we are sending frames from an AMPDU queue and there was a hole in
  381. * the BA window. To be used for UAPSD only.
  382. * @ptk_pn: per-queue PTK PN data structures
  383. * @dup_data: per queue duplicate packet detection data
  384. * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID
  385. *
  386. * When mac80211 creates a station it reserves some space (hw->sta_data_size)
  387. * in the structure for use by driver. This structure is placed in that
  388. * space.
  389. *
  390. */
  391. struct iwl_mvm_sta {
  392. u32 sta_id;
  393. u32 tfd_queue_msk;
  394. u32 mac_id_n_color;
  395. u16 tid_disable_agg;
  396. u8 max_agg_bufsize;
  397. enum iwl_sta_type sta_type;
  398. enum ieee80211_sta_state sta_state;
  399. bool bt_reduced_txpower;
  400. bool next_status_eosp;
  401. spinlock_t lock;
  402. struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT + 1];
  403. u8 tid_to_baid[IWL_MAX_TID_COUNT];
  404. union {
  405. struct iwl_lq_sta_rs_fw rs_fw;
  406. struct iwl_lq_sta rs_drv;
  407. } lq_sta;
  408. struct ieee80211_vif *vif;
  409. struct iwl_mvm_key_pn __rcu *ptk_pn[4];
  410. struct iwl_mvm_rxq_dup_data *dup_data;
  411. u16 deferred_traffic_tid_map;
  412. u8 reserved_queue;
  413. /* Temporary, until the new TLC will control the Tx protection */
  414. s8 tx_protection;
  415. bool tt_tx_protection;
  416. bool disable_tx;
  417. u16 amsdu_enabled;
  418. u16 max_amsdu_len;
  419. bool sleeping;
  420. u8 agg_tids;
  421. u8 sleep_tx_count;
  422. u8 avg_energy;
  423. };
  424. u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data);
  425. static inline struct iwl_mvm_sta *
  426. iwl_mvm_sta_from_mac80211(struct ieee80211_sta *sta)
  427. {
  428. return (void *)sta->drv_priv;
  429. }
  430. /**
  431. * struct iwl_mvm_int_sta - representation of an internal station (auxiliary or
  432. * broadcast)
  433. * @sta_id: the index of the station in the fw (will be replaced by id_n_color)
  434. * @type: station type
  435. * @tfd_queue_msk: the tfd queues used by the station
  436. */
  437. struct iwl_mvm_int_sta {
  438. u32 sta_id;
  439. enum iwl_sta_type type;
  440. u32 tfd_queue_msk;
  441. };
  442. /**
  443. * Send the STA info to the FW.
  444. *
  445. * @mvm: the iwl_mvm* to use
  446. * @sta: the STA
  447. * @update: this is true if the FW is being updated about a STA it already knows
  448. * about. Otherwise (if this is a new STA), this should be false.
  449. * @flags: if update==true, this marks what is being changed via ORs of values
  450. * from enum iwl_sta_modify_flag. Otherwise, this is ignored.
  451. */
  452. int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
  453. bool update, unsigned int flags);
  454. int iwl_mvm_add_sta(struct iwl_mvm *mvm,
  455. struct ieee80211_vif *vif,
  456. struct ieee80211_sta *sta);
  457. static inline int iwl_mvm_update_sta(struct iwl_mvm *mvm,
  458. struct ieee80211_vif *vif,
  459. struct ieee80211_sta *sta)
  460. {
  461. return iwl_mvm_sta_send_to_fw(mvm, sta, true, 0);
  462. }
  463. int iwl_mvm_wait_sta_queues_empty(struct iwl_mvm *mvm,
  464. struct iwl_mvm_sta *mvm_sta);
  465. int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
  466. struct ieee80211_vif *vif,
  467. struct ieee80211_sta *sta);
  468. int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm,
  469. struct ieee80211_vif *vif,
  470. u8 sta_id);
  471. int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
  472. struct ieee80211_vif *vif,
  473. struct ieee80211_sta *sta,
  474. struct ieee80211_key_conf *keyconf,
  475. u8 key_offset);
  476. int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm,
  477. struct ieee80211_vif *vif,
  478. struct ieee80211_sta *sta,
  479. struct ieee80211_key_conf *keyconf);
  480. void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
  481. struct ieee80211_vif *vif,
  482. struct ieee80211_key_conf *keyconf,
  483. struct ieee80211_sta *sta, u32 iv32,
  484. u16 *phase1key);
  485. void iwl_mvm_rx_eosp_notif(struct iwl_mvm *mvm,
  486. struct iwl_rx_cmd_buffer *rxb);
  487. /* AMPDU */
  488. int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
  489. int tid, u16 ssn, bool start, u8 buf_size, u16 timeout);
  490. int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  491. struct ieee80211_sta *sta, u16 tid, u16 *ssn);
  492. int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  493. struct ieee80211_sta *sta, u16 tid, u8 buf_size,
  494. bool amsdu);
  495. int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  496. struct ieee80211_sta *sta, u16 tid);
  497. int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
  498. struct ieee80211_sta *sta, u16 tid);
  499. int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
  500. int tid, u8 queue, bool start);
  501. int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm);
  502. void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm);
  503. int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  504. int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  505. int iwl_mvm_add_p2p_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  506. int iwl_mvm_send_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  507. int iwl_mvm_rm_p2p_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  508. int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  509. int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  510. int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm,
  511. struct iwl_mvm_int_sta *sta,
  512. u32 qmask, enum nl80211_iftype iftype,
  513. enum iwl_sta_type type);
  514. void iwl_mvm_dealloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  515. void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta);
  516. int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  517. int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  518. void iwl_mvm_dealloc_snif_sta(struct iwl_mvm *mvm);
  519. void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm,
  520. struct ieee80211_sta *sta);
  521. void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm,
  522. struct ieee80211_sta *sta,
  523. enum ieee80211_frame_release_type reason,
  524. u16 cnt, u16 tids, bool more_data,
  525. bool single_sta_queue);
  526. int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
  527. bool drain);
  528. void iwl_mvm_sta_modify_disable_tx(struct iwl_mvm *mvm,
  529. struct iwl_mvm_sta *mvmsta, bool disable);
  530. void iwl_mvm_sta_modify_disable_tx_ap(struct iwl_mvm *mvm,
  531. struct ieee80211_sta *sta,
  532. bool disable);
  533. void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
  534. struct iwl_mvm_vif *mvmvif,
  535. bool disable);
  536. void iwl_mvm_csa_client_absent(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
  537. void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk);
  538. int iwl_mvm_scd_queue_redirect(struct iwl_mvm *mvm, int queue, int tid,
  539. int ac, int ssn, unsigned int wdg_timeout,
  540. bool force);
  541. #endif /* __sta_h__ */