rx.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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) 2015 - 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. * The full GNU General Public License is included in this distribution
  22. * in the file called COPYING.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <linuxwifi@intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. * BSD LICENSE
  29. *
  30. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  31. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  32. * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
  33. * All rights reserved.
  34. *
  35. * Redistribution and use in source and binary forms, with or without
  36. * modification, are permitted provided that the following conditions
  37. * are met:
  38. *
  39. * * Redistributions of source code must retain the above copyright
  40. * notice, this list of conditions and the following disclaimer.
  41. * * Redistributions in binary form must reproduce the above copyright
  42. * notice, this list of conditions and the following disclaimer in
  43. * the documentation and/or other materials provided with the
  44. * distribution.
  45. * * Neither the name Intel Corporation nor the names of its
  46. * contributors may be used to endorse or promote products derived
  47. * from this software without specific prior written permission.
  48. *
  49. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  50. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  51. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  52. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  53. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  54. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  55. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  56. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  57. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  58. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  59. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. *
  61. *****************************************************************************/
  62. #ifndef __iwl_fw_api_rx_h__
  63. #define __iwl_fw_api_rx_h__
  64. /* API for pre-9000 hardware */
  65. #define IWL_RX_INFO_PHY_CNT 8
  66. #define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
  67. #define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
  68. #define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
  69. #define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
  70. #define IWL_RX_INFO_ENERGY_ANT_A_POS 0
  71. #define IWL_RX_INFO_ENERGY_ANT_B_POS 8
  72. #define IWL_RX_INFO_ENERGY_ANT_C_POS 16
  73. enum iwl_mac_context_info {
  74. MAC_CONTEXT_INFO_NONE,
  75. MAC_CONTEXT_INFO_GSCAN,
  76. };
  77. /**
  78. * struct iwl_rx_phy_info - phy info
  79. * (REPLY_RX_PHY_CMD = 0xc0)
  80. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  81. * @cfg_phy_cnt: configurable DSP phy data byte count
  82. * @stat_id: configurable DSP phy data set ID
  83. * @reserved1: reserved
  84. * @system_timestamp: GP2 at on air rise
  85. * @timestamp: TSF at on air rise
  86. * @beacon_time_stamp: beacon at on-air rise
  87. * @phy_flags: general phy flags: band, modulation, ...
  88. * @channel: channel number
  89. * @non_cfg_phy: for various implementations of non_cfg_phy
  90. * @rate_n_flags: RATE_MCS_*
  91. * @byte_count: frame's byte-count
  92. * @frame_time: frame's time on the air, based on byte count and frame rate
  93. * calculation
  94. * @mac_active_msk: what MACs were active when the frame was received
  95. * @mac_context_info: additional info on the context in which the frame was
  96. * received as defined in &enum iwl_mac_context_info
  97. *
  98. * Before each Rx, the device sends this data. It contains PHY information
  99. * about the reception of the packet.
  100. */
  101. struct iwl_rx_phy_info {
  102. u8 non_cfg_phy_cnt;
  103. u8 cfg_phy_cnt;
  104. u8 stat_id;
  105. u8 reserved1;
  106. __le32 system_timestamp;
  107. __le64 timestamp;
  108. __le32 beacon_time_stamp;
  109. __le16 phy_flags;
  110. __le16 channel;
  111. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  112. __le32 rate_n_flags;
  113. __le32 byte_count;
  114. u8 mac_active_msk;
  115. u8 mac_context_info;
  116. __le16 frame_time;
  117. } __packed;
  118. /*
  119. * TCP offload Rx assist info
  120. *
  121. * bits 0:3 - reserved
  122. * bits 4:7 - MIC CRC length
  123. * bits 8:12 - MAC header length
  124. * bit 13 - Padding indication
  125. * bit 14 - A-AMSDU indication
  126. * bit 15 - Offload enabled
  127. */
  128. enum iwl_csum_rx_assist_info {
  129. CSUM_RXA_RESERVED_MASK = 0x000f,
  130. CSUM_RXA_MICSIZE_MASK = 0x00f0,
  131. CSUM_RXA_HEADERLEN_MASK = 0x1f00,
  132. CSUM_RXA_PADD = BIT(13),
  133. CSUM_RXA_AMSDU = BIT(14),
  134. CSUM_RXA_ENA = BIT(15)
  135. };
  136. /**
  137. * struct iwl_rx_mpdu_res_start - phy info
  138. * @byte_count: byte count of the frame
  139. * @assist: see &enum iwl_csum_rx_assist_info
  140. */
  141. struct iwl_rx_mpdu_res_start {
  142. __le16 byte_count;
  143. __le16 assist;
  144. } __packed; /* _RX_MPDU_RES_START_API_S_VER_2 */
  145. /**
  146. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  147. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  148. * @RX_RES_PHY_FLAGS_MOD_CCK: modulation is CCK
  149. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  150. * @RX_RES_PHY_FLAGS_NARROW_BAND: narrow band (<20 MHz) receive
  151. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  152. * @RX_RES_PHY_FLAGS_ANTENNA_POS: antenna bit position
  153. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  154. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  155. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  156. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  157. */
  158. enum iwl_rx_phy_flags {
  159. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  160. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  161. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  162. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  163. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  164. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  165. RX_RES_PHY_FLAGS_AGG = BIT(7),
  166. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  167. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  168. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  169. };
  170. /**
  171. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  172. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  173. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  174. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND: station was found
  175. * @RX_MPDU_RES_STATUS_KEY_VALID: key was valid
  176. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK: key parameters were usable
  177. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  178. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  179. * in the driver.
  180. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  181. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  182. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  183. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  184. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  185. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  186. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  187. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  188. * @RX_MPDU_RES_STATUS_SEC_EXT_ENC: this frame is encrypted using extension
  189. * algorithm
  190. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  191. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  192. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  193. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  194. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP: extended IV (set with TKIP)
  195. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT: key ID comparison done
  196. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  197. * @RX_MPDU_RES_STATUS_CSUM_DONE: checksum was done by the hw
  198. * @RX_MPDU_RES_STATUS_CSUM_OK: checksum found no errors
  199. * @RX_MPDU_RES_STATUS_STA_ID_MSK: station ID mask
  200. * @RX_MDPU_RES_STATUS_STA_ID_SHIFT: station ID bit shift
  201. * @RX_MPDU_RES_STATUS_FILTERING_MSK: filter status
  202. * @RX_MPDU_RES_STATUS2_FILTERING_MSK: filter status 2
  203. */
  204. enum iwl_mvm_rx_status {
  205. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  206. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  207. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  208. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  209. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  210. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  211. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  212. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  213. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  214. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  215. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  216. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  217. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  218. RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
  219. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  220. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  221. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  222. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  223. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  224. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  225. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  226. RX_MPDU_RES_STATUS_CSUM_DONE = BIT(16),
  227. RX_MPDU_RES_STATUS_CSUM_OK = BIT(17),
  228. RX_MDPU_RES_STATUS_STA_ID_SHIFT = 24,
  229. RX_MPDU_RES_STATUS_STA_ID_MSK = 0x1f << RX_MDPU_RES_STATUS_STA_ID_SHIFT,
  230. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  231. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  232. };
  233. /* 9000 series API */
  234. enum iwl_rx_mpdu_mac_flags1 {
  235. IWL_RX_MDPU_MFLG1_ADDRTYPE_MASK = 0x03,
  236. IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0,
  237. /* shift should be 4, but the length is measured in 2-byte
  238. * words, so shifting only by 3 gives a byte result
  239. */
  240. IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3,
  241. };
  242. enum iwl_rx_mpdu_mac_flags2 {
  243. /* in 2-byte words */
  244. IWL_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f,
  245. IWL_RX_MPDU_MFLG2_PAD = 0x20,
  246. IWL_RX_MPDU_MFLG2_AMSDU = 0x40,
  247. };
  248. enum iwl_rx_mpdu_amsdu_info {
  249. IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK = 0x7f,
  250. IWL_RX_MPDU_AMSDU_LAST_SUBFRAME = 0x80,
  251. };
  252. enum iwl_rx_l3_proto_values {
  253. IWL_RX_L3_TYPE_NONE,
  254. IWL_RX_L3_TYPE_IPV4,
  255. IWL_RX_L3_TYPE_IPV4_FRAG,
  256. IWL_RX_L3_TYPE_IPV6_FRAG,
  257. IWL_RX_L3_TYPE_IPV6,
  258. IWL_RX_L3_TYPE_IPV6_IN_IPV4,
  259. IWL_RX_L3_TYPE_ARP,
  260. IWL_RX_L3_TYPE_EAPOL,
  261. };
  262. #define IWL_RX_L3_PROTO_POS 4
  263. enum iwl_rx_l3l4_flags {
  264. IWL_RX_L3L4_IP_HDR_CSUM_OK = BIT(0),
  265. IWL_RX_L3L4_TCP_UDP_CSUM_OK = BIT(1),
  266. IWL_RX_L3L4_TCP_FIN_SYN_RST_PSH = BIT(2),
  267. IWL_RX_L3L4_TCP_ACK = BIT(3),
  268. IWL_RX_L3L4_L3_PROTO_MASK = 0xf << IWL_RX_L3_PROTO_POS,
  269. IWL_RX_L3L4_L4_PROTO_MASK = 0xf << 8,
  270. IWL_RX_L3L4_RSS_HASH_MASK = 0xf << 12,
  271. };
  272. enum iwl_rx_mpdu_status {
  273. IWL_RX_MPDU_STATUS_CRC_OK = BIT(0),
  274. IWL_RX_MPDU_STATUS_OVERRUN_OK = BIT(1),
  275. IWL_RX_MPDU_STATUS_SRC_STA_FOUND = BIT(2),
  276. IWL_RX_MPDU_STATUS_KEY_VALID = BIT(3),
  277. IWL_RX_MPDU_STATUS_KEY_PARAM_OK = BIT(4),
  278. IWL_RX_MPDU_STATUS_ICV_OK = BIT(5),
  279. IWL_RX_MPDU_STATUS_MIC_OK = BIT(6),
  280. IWL_RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  281. IWL_RX_MPDU_STATUS_SEC_MASK = 0x7 << 8,
  282. IWL_RX_MPDU_STATUS_SEC_UNKNOWN = IWL_RX_MPDU_STATUS_SEC_MASK,
  283. IWL_RX_MPDU_STATUS_SEC_NONE = 0x0 << 8,
  284. IWL_RX_MPDU_STATUS_SEC_WEP = 0x1 << 8,
  285. IWL_RX_MPDU_STATUS_SEC_CCM = 0x2 << 8,
  286. IWL_RX_MPDU_STATUS_SEC_TKIP = 0x3 << 8,
  287. IWL_RX_MPDU_STATUS_SEC_EXT_ENC = 0x4 << 8,
  288. IWL_RX_MPDU_STATUS_SEC_GCM = 0x5 << 8,
  289. IWL_RX_MPDU_STATUS_DECRYPTED = BIT(11),
  290. IWL_RX_MPDU_STATUS_WEP_MATCH = BIT(12),
  291. IWL_RX_MPDU_STATUS_EXT_IV_MATCH = BIT(13),
  292. IWL_RX_MPDU_STATUS_KEY_ID_MATCH = BIT(14),
  293. IWL_RX_MPDU_STATUS_ROBUST_MNG_FRAME = BIT(15),
  294. };
  295. enum iwl_rx_mpdu_hash_filter {
  296. IWL_RX_MPDU_HF_A1_HASH_MASK = 0x3f,
  297. IWL_RX_MPDU_HF_FILTER_STATUS_MASK = 0xc0,
  298. };
  299. enum iwl_rx_mpdu_sta_id_flags {
  300. IWL_RX_MPDU_SIF_STA_ID_MASK = 0x1f,
  301. IWL_RX_MPDU_SIF_RRF_ABORT = 0x20,
  302. IWL_RX_MPDU_SIF_FILTER_STATUS_MASK = 0xc0,
  303. };
  304. #define IWL_RX_REORDER_DATA_INVALID_BAID 0x7f
  305. enum iwl_rx_mpdu_reorder_data {
  306. IWL_RX_MPDU_REORDER_NSSN_MASK = 0x00000fff,
  307. IWL_RX_MPDU_REORDER_SN_MASK = 0x00fff000,
  308. IWL_RX_MPDU_REORDER_SN_SHIFT = 12,
  309. IWL_RX_MPDU_REORDER_BAID_MASK = 0x7f000000,
  310. IWL_RX_MPDU_REORDER_BAID_SHIFT = 24,
  311. IWL_RX_MPDU_REORDER_BA_OLD_SN = 0x80000000,
  312. };
  313. enum iwl_rx_mpdu_phy_info {
  314. IWL_RX_MPDU_PHY_AMPDU = BIT(5),
  315. IWL_RX_MPDU_PHY_AMPDU_TOGGLE = BIT(6),
  316. IWL_RX_MPDU_PHY_SHORT_PREAMBLE = BIT(7),
  317. IWL_RX_MPDU_PHY_TSF_OVERLOAD = BIT(8),
  318. };
  319. enum iwl_rx_mpdu_mac_info {
  320. IWL_RX_MPDU_PHY_MAC_INDEX_MASK = 0x0f,
  321. IWL_RX_MPDU_PHY_PHY_INDEX_MASK = 0xf0,
  322. };
  323. /**
  324. * struct iwl_rx_mpdu_desc - RX MPDU descriptor
  325. */
  326. struct iwl_rx_mpdu_desc {
  327. /* DW2 */
  328. /**
  329. * @mpdu_len: MPDU length
  330. */
  331. __le16 mpdu_len;
  332. /**
  333. * @mac_flags1: &enum iwl_rx_mpdu_mac_flags1
  334. */
  335. u8 mac_flags1;
  336. /**
  337. * @mac_flags2: &enum iwl_rx_mpdu_mac_flags2
  338. */
  339. u8 mac_flags2;
  340. /* DW3 */
  341. /**
  342. * @amsdu_info: &enum iwl_rx_mpdu_amsdu_info
  343. */
  344. u8 amsdu_info;
  345. /**
  346. * @phy_info: &enum iwl_rx_mpdu_phy_info
  347. */
  348. __le16 phy_info;
  349. /**
  350. * @mac_phy_idx: MAC/PHY index
  351. */
  352. u8 mac_phy_idx;
  353. /* DW4 - carries csum data only when rpa_en == 1 */
  354. /**
  355. * @raw_csum: raw checksum (alledgedly unreliable)
  356. */
  357. __le16 raw_csum;
  358. /**
  359. * @l3l4_flags: &enum iwl_rx_l3l4_flags
  360. */
  361. __le16 l3l4_flags;
  362. /* DW5 */
  363. /**
  364. * @status: &enum iwl_rx_mpdu_status
  365. */
  366. __le16 status;
  367. /**
  368. * @hash_filter: hash filter value
  369. */
  370. u8 hash_filter;
  371. /**
  372. * @sta_id_flags: &enum iwl_rx_mpdu_sta_id_flags
  373. */
  374. u8 sta_id_flags;
  375. /* DW6 */
  376. /**
  377. * @reorder_data: &enum iwl_rx_mpdu_reorder_data
  378. */
  379. __le32 reorder_data;
  380. /* DW7 - carries rss_hash only when rpa_en == 1 */
  381. /**
  382. * @rss_hash: RSS hash value
  383. */
  384. __le32 rss_hash;
  385. /* DW8 - carries filter_match only when rpa_en == 1 */
  386. /**
  387. * @filter_match: filter match value
  388. */
  389. __le32 filter_match;
  390. /* DW9 */
  391. /**
  392. * @rate_n_flags: RX rate/flags encoding
  393. */
  394. __le32 rate_n_flags;
  395. /* DW10 */
  396. /**
  397. * @energy_a: energy chain A
  398. */
  399. u8 energy_a;
  400. /**
  401. * @energy_b: energy chain B
  402. */
  403. u8 energy_b;
  404. /**
  405. * @channel: channel number
  406. */
  407. u8 channel;
  408. /**
  409. * @mac_context: MAC context mask
  410. */
  411. u8 mac_context;
  412. /* DW11 */
  413. /**
  414. * @gp2_on_air_rise: GP2 timer value on air rise (INA)
  415. */
  416. __le32 gp2_on_air_rise;
  417. /* DW12 & DW13 */
  418. /**
  419. * @tsf_on_air_rise:
  420. * TSF value on air rise (INA), only valid if
  421. * %IWL_RX_MPDU_PHY_TSF_OVERLOAD isn't set
  422. */
  423. __le64 tsf_on_air_rise;
  424. } __packed;
  425. struct iwl_frame_release {
  426. u8 baid;
  427. u8 reserved;
  428. __le16 nssn;
  429. };
  430. enum iwl_rss_hash_func_en {
  431. IWL_RSS_HASH_TYPE_IPV4_TCP,
  432. IWL_RSS_HASH_TYPE_IPV4_UDP,
  433. IWL_RSS_HASH_TYPE_IPV4_PAYLOAD,
  434. IWL_RSS_HASH_TYPE_IPV6_TCP,
  435. IWL_RSS_HASH_TYPE_IPV6_UDP,
  436. IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
  437. };
  438. #define IWL_RSS_HASH_KEY_CNT 10
  439. #define IWL_RSS_INDIRECTION_TABLE_SIZE 128
  440. #define IWL_RSS_ENABLE 1
  441. /**
  442. * struct iwl_rss_config_cmd - RSS (Receive Side Scaling) configuration
  443. *
  444. * @flags: 1 - enable, 0 - disable
  445. * @hash_mask: Type of RSS to use. Values are from %iwl_rss_hash_func_en
  446. * @reserved: reserved
  447. * @secret_key: 320 bit input of random key configuration from driver
  448. * @indirection_table: indirection table
  449. */
  450. struct iwl_rss_config_cmd {
  451. __le32 flags;
  452. u8 hash_mask;
  453. u8 reserved[3];
  454. __le32 secret_key[IWL_RSS_HASH_KEY_CNT];
  455. u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE];
  456. } __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */
  457. #define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128
  458. #define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0
  459. #define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf
  460. /**
  461. * struct iwl_rxq_sync_cmd - RXQ notification trigger
  462. *
  463. * @flags: flags of the notification. bit 0:3 are the sender queue
  464. * @rxq_mask: rx queues to send the notification on
  465. * @count: number of bytes in payload, should be DWORD aligned
  466. * @payload: data to send to rx queues
  467. */
  468. struct iwl_rxq_sync_cmd {
  469. __le32 flags;
  470. __le32 rxq_mask;
  471. __le32 count;
  472. u8 payload[];
  473. } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */
  474. /**
  475. * struct iwl_rxq_sync_notification - Notification triggered by RXQ
  476. * sync command
  477. *
  478. * @count: number of bytes in payload
  479. * @payload: data to send to rx queues
  480. */
  481. struct iwl_rxq_sync_notification {
  482. __le32 count;
  483. u8 payload[];
  484. } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */
  485. /**
  486. * enum iwl_mvm_rxq_notif_type - Internal message identifier
  487. *
  488. * @IWL_MVM_RXQ_EMPTY: empty sync notification
  489. * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA
  490. */
  491. enum iwl_mvm_rxq_notif_type {
  492. IWL_MVM_RXQ_EMPTY,
  493. IWL_MVM_RXQ_NOTIF_DEL_BA,
  494. };
  495. /**
  496. * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent
  497. * in &iwl_rxq_sync_cmd. Should be DWORD aligned.
  498. * FW is agnostic to the payload, so there are no endianity requirements.
  499. *
  500. * @type: value from &iwl_mvm_rxq_notif_type
  501. * @sync: ctrl path is waiting for all notifications to be received
  502. * @cookie: internal cookie to identify old notifications
  503. * @data: payload
  504. */
  505. struct iwl_mvm_internal_rxq_notif {
  506. u16 type;
  507. u16 sync;
  508. u32 cookie;
  509. u8 data[];
  510. } __packed;
  511. /**
  512. * enum iwl_mvm_pm_event - type of station PM event
  513. * @IWL_MVM_PM_EVENT_AWAKE: station woke up
  514. * @IWL_MVM_PM_EVENT_ASLEEP: station went to sleep
  515. * @IWL_MVM_PM_EVENT_UAPSD: station sent uAPSD trigger
  516. * @IWL_MVM_PM_EVENT_PS_POLL: station sent PS-Poll
  517. */
  518. enum iwl_mvm_pm_event {
  519. IWL_MVM_PM_EVENT_AWAKE,
  520. IWL_MVM_PM_EVENT_ASLEEP,
  521. IWL_MVM_PM_EVENT_UAPSD,
  522. IWL_MVM_PM_EVENT_PS_POLL,
  523. }; /* PEER_PM_NTFY_API_E_VER_1 */
  524. /**
  525. * struct iwl_mvm_pm_state_notification - station PM state notification
  526. * @sta_id: station ID of the station changing state
  527. * @type: the new powersave state, see &enum iwl_mvm_pm_event
  528. */
  529. struct iwl_mvm_pm_state_notification {
  530. u8 sta_id;
  531. u8 type;
  532. /* private: */
  533. __le16 reserved;
  534. } __packed; /* PEER_PM_NTFY_API_S_VER_1 */
  535. #define BA_WINDOW_STREAMS_MAX 16
  536. #define BA_WINDOW_STATUS_TID_MSK 0x000F
  537. #define BA_WINDOW_STATUS_STA_ID_POS 4
  538. #define BA_WINDOW_STATUS_STA_ID_MSK 0x01F0
  539. #define BA_WINDOW_STATUS_VALID_MSK BIT(9)
  540. /**
  541. * struct iwl_ba_window_status_notif - reordering window's status notification
  542. * @bitmap: bitmap of received frames [start_seq_num + 0]..[start_seq_num + 63]
  543. * @ra_tid: bit 3:0 - TID, bit 8:4 - STA_ID, bit 9 - valid
  544. * @start_seq_num: the start sequence number of the bitmap
  545. * @mpdu_rx_count: the number of received MPDUs since entering D0i3
  546. */
  547. struct iwl_ba_window_status_notif {
  548. __le64 bitmap[BA_WINDOW_STREAMS_MAX];
  549. __le16 ra_tid[BA_WINDOW_STREAMS_MAX];
  550. __le32 start_seq_num[BA_WINDOW_STREAMS_MAX];
  551. __le16 mpdu_rx_count[BA_WINDOW_STREAMS_MAX];
  552. } __packed; /* BA_WINDOW_STATUS_NTFY_API_S_VER_1 */
  553. #endif /* __iwl_fw_api_rx_h__ */