rx.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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. * 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 - 2015 Intel Mobile Communications GmbH
  33. * Copyright(c) 2015 - 2017 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 __iwl_fw_api_rx_h__
  65. #define __iwl_fw_api_rx_h__
  66. /* API for pre-9000 hardware */
  67. #define IWL_RX_INFO_PHY_CNT 8
  68. #define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
  69. #define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
  70. #define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
  71. #define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
  72. #define IWL_RX_INFO_ENERGY_ANT_A_POS 0
  73. #define IWL_RX_INFO_ENERGY_ANT_B_POS 8
  74. #define IWL_RX_INFO_ENERGY_ANT_C_POS 16
  75. enum iwl_mac_context_info {
  76. MAC_CONTEXT_INFO_NONE,
  77. MAC_CONTEXT_INFO_GSCAN,
  78. };
  79. /**
  80. * struct iwl_rx_phy_info - phy info
  81. * (REPLY_RX_PHY_CMD = 0xc0)
  82. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  83. * @cfg_phy_cnt: configurable DSP phy data byte count
  84. * @stat_id: configurable DSP phy data set ID
  85. * @reserved1: reserved
  86. * @system_timestamp: GP2 at on air rise
  87. * @timestamp: TSF at on air rise
  88. * @beacon_time_stamp: beacon at on-air rise
  89. * @phy_flags: general phy flags: band, modulation, ...
  90. * @channel: channel number
  91. * @non_cfg_phy: for various implementations of non_cfg_phy
  92. * @rate_n_flags: RATE_MCS_*
  93. * @byte_count: frame's byte-count
  94. * @frame_time: frame's time on the air, based on byte count and frame rate
  95. * calculation
  96. * @mac_active_msk: what MACs were active when the frame was received
  97. * @mac_context_info: additional info on the context in which the frame was
  98. * received as defined in &enum iwl_mac_context_info
  99. *
  100. * Before each Rx, the device sends this data. It contains PHY information
  101. * about the reception of the packet.
  102. */
  103. struct iwl_rx_phy_info {
  104. u8 non_cfg_phy_cnt;
  105. u8 cfg_phy_cnt;
  106. u8 stat_id;
  107. u8 reserved1;
  108. __le32 system_timestamp;
  109. __le64 timestamp;
  110. __le32 beacon_time_stamp;
  111. __le16 phy_flags;
  112. __le16 channel;
  113. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  114. __le32 rate_n_flags;
  115. __le32 byte_count;
  116. u8 mac_active_msk;
  117. u8 mac_context_info;
  118. __le16 frame_time;
  119. } __packed;
  120. /*
  121. * TCP offload Rx assist info
  122. *
  123. * bits 0:3 - reserved
  124. * bits 4:7 - MIC CRC length
  125. * bits 8:12 - MAC header length
  126. * bit 13 - Padding indication
  127. * bit 14 - A-AMSDU indication
  128. * bit 15 - Offload enabled
  129. */
  130. enum iwl_csum_rx_assist_info {
  131. CSUM_RXA_RESERVED_MASK = 0x000f,
  132. CSUM_RXA_MICSIZE_MASK = 0x00f0,
  133. CSUM_RXA_HEADERLEN_MASK = 0x1f00,
  134. CSUM_RXA_PADD = BIT(13),
  135. CSUM_RXA_AMSDU = BIT(14),
  136. CSUM_RXA_ENA = BIT(15)
  137. };
  138. /**
  139. * struct iwl_rx_mpdu_res_start - phy info
  140. * @byte_count: byte count of the frame
  141. * @assist: see &enum iwl_csum_rx_assist_info
  142. */
  143. struct iwl_rx_mpdu_res_start {
  144. __le16 byte_count;
  145. __le16 assist;
  146. } __packed; /* _RX_MPDU_RES_START_API_S_VER_2 */
  147. /**
  148. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  149. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  150. * @RX_RES_PHY_FLAGS_MOD_CCK: modulation is CCK
  151. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  152. * @RX_RES_PHY_FLAGS_NARROW_BAND: narrow band (<20 MHz) receive
  153. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  154. * @RX_RES_PHY_FLAGS_ANTENNA_POS: antenna bit position
  155. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  156. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  157. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  158. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  159. */
  160. enum iwl_rx_phy_flags {
  161. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  162. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  163. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  164. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  165. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  166. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  167. RX_RES_PHY_FLAGS_AGG = BIT(7),
  168. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  169. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  170. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  171. };
  172. /**
  173. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  174. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  175. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  176. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND: station was found
  177. * @RX_MPDU_RES_STATUS_KEY_VALID: key was valid
  178. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK: key parameters were usable
  179. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  180. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  181. * in the driver.
  182. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  183. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  184. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  185. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  186. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  187. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  188. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  189. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  190. * @RX_MPDU_RES_STATUS_SEC_EXT_ENC: this frame is encrypted using extension
  191. * algorithm
  192. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  193. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  194. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  195. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  196. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP: extended IV (set with TKIP)
  197. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT: key ID comparison done
  198. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  199. * @RX_MPDU_RES_STATUS_CSUM_DONE: checksum was done by the hw
  200. * @RX_MPDU_RES_STATUS_CSUM_OK: checksum found no errors
  201. * @RX_MPDU_RES_STATUS_STA_ID_MSK: station ID mask
  202. * @RX_MDPU_RES_STATUS_STA_ID_SHIFT: station ID bit shift
  203. * @RX_MPDU_RES_STATUS_FILTERING_MSK: filter status
  204. * @RX_MPDU_RES_STATUS2_FILTERING_MSK: filter status 2
  205. */
  206. enum iwl_mvm_rx_status {
  207. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  208. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  209. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  210. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  211. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  212. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  213. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  214. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  215. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  216. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  217. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  218. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  219. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  220. RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
  221. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  222. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  223. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  224. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  225. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  226. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  227. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  228. RX_MPDU_RES_STATUS_CSUM_DONE = BIT(16),
  229. RX_MPDU_RES_STATUS_CSUM_OK = BIT(17),
  230. RX_MDPU_RES_STATUS_STA_ID_SHIFT = 24,
  231. RX_MPDU_RES_STATUS_STA_ID_MSK = 0x1f << RX_MDPU_RES_STATUS_STA_ID_SHIFT,
  232. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  233. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  234. };
  235. /* 9000 series API */
  236. enum iwl_rx_mpdu_mac_flags1 {
  237. IWL_RX_MDPU_MFLG1_ADDRTYPE_MASK = 0x03,
  238. IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0,
  239. /* shift should be 4, but the length is measured in 2-byte
  240. * words, so shifting only by 3 gives a byte result
  241. */
  242. IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3,
  243. };
  244. enum iwl_rx_mpdu_mac_flags2 {
  245. /* in 2-byte words */
  246. IWL_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f,
  247. IWL_RX_MPDU_MFLG2_PAD = 0x20,
  248. IWL_RX_MPDU_MFLG2_AMSDU = 0x40,
  249. };
  250. enum iwl_rx_mpdu_amsdu_info {
  251. IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK = 0x7f,
  252. IWL_RX_MPDU_AMSDU_LAST_SUBFRAME = 0x80,
  253. };
  254. enum iwl_rx_l3_proto_values {
  255. IWL_RX_L3_TYPE_NONE,
  256. IWL_RX_L3_TYPE_IPV4,
  257. IWL_RX_L3_TYPE_IPV4_FRAG,
  258. IWL_RX_L3_TYPE_IPV6_FRAG,
  259. IWL_RX_L3_TYPE_IPV6,
  260. IWL_RX_L3_TYPE_IPV6_IN_IPV4,
  261. IWL_RX_L3_TYPE_ARP,
  262. IWL_RX_L3_TYPE_EAPOL,
  263. };
  264. #define IWL_RX_L3_PROTO_POS 4
  265. enum iwl_rx_l3l4_flags {
  266. IWL_RX_L3L4_IP_HDR_CSUM_OK = BIT(0),
  267. IWL_RX_L3L4_TCP_UDP_CSUM_OK = BIT(1),
  268. IWL_RX_L3L4_TCP_FIN_SYN_RST_PSH = BIT(2),
  269. IWL_RX_L3L4_TCP_ACK = BIT(3),
  270. IWL_RX_L3L4_L3_PROTO_MASK = 0xf << IWL_RX_L3_PROTO_POS,
  271. IWL_RX_L3L4_L4_PROTO_MASK = 0xf << 8,
  272. IWL_RX_L3L4_RSS_HASH_MASK = 0xf << 12,
  273. };
  274. enum iwl_rx_mpdu_status {
  275. IWL_RX_MPDU_STATUS_CRC_OK = BIT(0),
  276. IWL_RX_MPDU_STATUS_OVERRUN_OK = BIT(1),
  277. IWL_RX_MPDU_STATUS_SRC_STA_FOUND = BIT(2),
  278. IWL_RX_MPDU_STATUS_KEY_VALID = BIT(3),
  279. IWL_RX_MPDU_STATUS_KEY_PARAM_OK = BIT(4),
  280. IWL_RX_MPDU_STATUS_ICV_OK = BIT(5),
  281. IWL_RX_MPDU_STATUS_MIC_OK = BIT(6),
  282. IWL_RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  283. IWL_RX_MPDU_STATUS_SEC_MASK = 0x7 << 8,
  284. IWL_RX_MPDU_STATUS_SEC_UNKNOWN = IWL_RX_MPDU_STATUS_SEC_MASK,
  285. IWL_RX_MPDU_STATUS_SEC_NONE = 0x0 << 8,
  286. IWL_RX_MPDU_STATUS_SEC_WEP = 0x1 << 8,
  287. IWL_RX_MPDU_STATUS_SEC_CCM = 0x2 << 8,
  288. IWL_RX_MPDU_STATUS_SEC_TKIP = 0x3 << 8,
  289. IWL_RX_MPDU_STATUS_SEC_EXT_ENC = 0x4 << 8,
  290. IWL_RX_MPDU_STATUS_SEC_GCM = 0x5 << 8,
  291. IWL_RX_MPDU_STATUS_DECRYPTED = BIT(11),
  292. IWL_RX_MPDU_STATUS_WEP_MATCH = BIT(12),
  293. IWL_RX_MPDU_STATUS_EXT_IV_MATCH = BIT(13),
  294. IWL_RX_MPDU_STATUS_KEY_ID_MATCH = BIT(14),
  295. IWL_RX_MPDU_STATUS_ROBUST_MNG_FRAME = BIT(15),
  296. };
  297. enum iwl_rx_mpdu_hash_filter {
  298. IWL_RX_MPDU_HF_A1_HASH_MASK = 0x3f,
  299. IWL_RX_MPDU_HF_FILTER_STATUS_MASK = 0xc0,
  300. };
  301. enum iwl_rx_mpdu_sta_id_flags {
  302. IWL_RX_MPDU_SIF_STA_ID_MASK = 0x1f,
  303. IWL_RX_MPDU_SIF_RRF_ABORT = 0x20,
  304. IWL_RX_MPDU_SIF_FILTER_STATUS_MASK = 0xc0,
  305. };
  306. #define IWL_RX_REORDER_DATA_INVALID_BAID 0x7f
  307. enum iwl_rx_mpdu_reorder_data {
  308. IWL_RX_MPDU_REORDER_NSSN_MASK = 0x00000fff,
  309. IWL_RX_MPDU_REORDER_SN_MASK = 0x00fff000,
  310. IWL_RX_MPDU_REORDER_SN_SHIFT = 12,
  311. IWL_RX_MPDU_REORDER_BAID_MASK = 0x7f000000,
  312. IWL_RX_MPDU_REORDER_BAID_SHIFT = 24,
  313. IWL_RX_MPDU_REORDER_BA_OLD_SN = 0x80000000,
  314. };
  315. enum iwl_rx_mpdu_phy_info {
  316. IWL_RX_MPDU_PHY_AMPDU = BIT(5),
  317. IWL_RX_MPDU_PHY_AMPDU_TOGGLE = BIT(6),
  318. IWL_RX_MPDU_PHY_SHORT_PREAMBLE = BIT(7),
  319. IWL_RX_MPDU_PHY_TSF_OVERLOAD = BIT(8),
  320. };
  321. enum iwl_rx_mpdu_mac_info {
  322. IWL_RX_MPDU_PHY_MAC_INDEX_MASK = 0x0f,
  323. IWL_RX_MPDU_PHY_PHY_INDEX_MASK = 0xf0,
  324. };
  325. /*
  326. * enum iwl_rx_he_phy - HE PHY data
  327. */
  328. enum iwl_rx_he_phy {
  329. IWL_RX_HE_PHY_BEAM_CHNG = BIT(0),
  330. IWL_RX_HE_PHY_UPLINK = BIT(1),
  331. IWL_RX_HE_PHY_BSS_COLOR_MASK = 0xfc,
  332. IWL_RX_HE_PHY_SPATIAL_REUSE_MASK = 0xf00,
  333. IWL_RX_HE_PHY_SU_EXT_BW10 = BIT(12),
  334. IWL_RX_HE_PHY_TXOP_DUR_MASK = 0xfe000,
  335. IWL_RX_HE_PHY_LDPC_EXT_SYM = BIT(20),
  336. IWL_RX_HE_PHY_PRE_FEC_PAD_MASK = 0x600000,
  337. IWL_RX_HE_PHY_PE_DISAMBIG = BIT(23),
  338. IWL_RX_HE_PHY_DOPPLER = BIT(24),
  339. /* 6 bits reserved */
  340. IWL_RX_HE_PHY_DELIM_EOF = BIT(31),
  341. /* second dword - MU data */
  342. IWL_RX_HE_PHY_SIGB_COMPRESSION = BIT_ULL(32 + 0),
  343. IWL_RX_HE_PHY_SIBG_SYM_OR_USER_NUM_MASK = 0x1e00000000ULL,
  344. IWL_RX_HE_PHY_HE_LTF_NUM_MASK = 0xe000000000ULL,
  345. IWL_RX_HE_PHY_RU_ALLOC_SEC80 = BIT_ULL(32 + 8),
  346. /* trigger encoded */
  347. IWL_RX_HE_PHY_RU_ALLOC_MASK = 0xfe0000000000ULL,
  348. IWL_RX_HE_PHY_SIGB_MCS_MASK = 0xf000000000000ULL,
  349. /* 1 bit reserved */
  350. IWL_RX_HE_PHY_SIGB_DCM = BIT_ULL(32 + 21),
  351. IWL_RX_HE_PHY_PREAMBLE_PUNC_TYPE_MASK = 0xc0000000000000ULL,
  352. /* 8 bits reserved */
  353. };
  354. /**
  355. * struct iwl_rx_mpdu_desc_v1 - RX MPDU descriptor
  356. */
  357. struct iwl_rx_mpdu_desc_v1 {
  358. /* DW7 - carries rss_hash only when rpa_en == 1 */
  359. /**
  360. * @rss_hash: RSS hash value
  361. */
  362. __le32 rss_hash;
  363. /* DW8 - carries filter_match only when rpa_en == 1 */
  364. /**
  365. * @filter_match: filter match value
  366. */
  367. __le32 filter_match;
  368. /* DW9 */
  369. /**
  370. * @rate_n_flags: RX rate/flags encoding
  371. */
  372. __le32 rate_n_flags;
  373. /* DW10 */
  374. /**
  375. * @energy_a: energy chain A
  376. */
  377. u8 energy_a;
  378. /**
  379. * @energy_b: energy chain B
  380. */
  381. u8 energy_b;
  382. /**
  383. * @channel: channel number
  384. */
  385. u8 channel;
  386. /**
  387. * @mac_context: MAC context mask
  388. */
  389. u8 mac_context;
  390. /* DW11 */
  391. /**
  392. * @gp2_on_air_rise: GP2 timer value on air rise (INA)
  393. */
  394. __le32 gp2_on_air_rise;
  395. /* DW12 & DW13 */
  396. union {
  397. /**
  398. * @tsf_on_air_rise:
  399. * TSF value on air rise (INA), only valid if
  400. * %IWL_RX_MPDU_PHY_TSF_OVERLOAD isn't set
  401. */
  402. __le64 tsf_on_air_rise;
  403. /**
  404. * @he_phy_data:
  405. * HE PHY data, see &enum iwl_rx_he_phy, valid
  406. * only if %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set
  407. */
  408. __le64 he_phy_data;
  409. };
  410. } __packed;
  411. /**
  412. * struct iwl_rx_mpdu_desc_v3 - RX MPDU descriptor
  413. */
  414. struct iwl_rx_mpdu_desc_v3 {
  415. /* DW7 - carries filter_match only when rpa_en == 1 */
  416. /**
  417. * @filter_match: filter match value
  418. */
  419. __le32 filter_match;
  420. /* DW8 - carries rss_hash only when rpa_en == 1 */
  421. /**
  422. * @rss_hash: RSS hash value
  423. */
  424. __le32 rss_hash;
  425. /* DW9 */
  426. /**
  427. * @partial_hash: 31:0 ip/tcp header hash
  428. * w/o some fields (such as IP SRC addr)
  429. */
  430. __le32 partial_hash;
  431. /* DW10 */
  432. /**
  433. * @raw_xsum: raw xsum value
  434. */
  435. __le32 raw_xsum;
  436. /* DW11 */
  437. /**
  438. * @rate_n_flags: RX rate/flags encoding
  439. */
  440. __le32 rate_n_flags;
  441. /* DW12 */
  442. /**
  443. * @energy_a: energy chain A
  444. */
  445. u8 energy_a;
  446. /**
  447. * @energy_b: energy chain B
  448. */
  449. u8 energy_b;
  450. /**
  451. * @channel: channel number
  452. */
  453. u8 channel;
  454. /**
  455. * @mac_context: MAC context mask
  456. */
  457. u8 mac_context;
  458. /* DW13 */
  459. /**
  460. * @gp2_on_air_rise: GP2 timer value on air rise (INA)
  461. */
  462. __le32 gp2_on_air_rise;
  463. /* DW14 & DW15 */
  464. union {
  465. /**
  466. * @tsf_on_air_rise:
  467. * TSF value on air rise (INA), only valid if
  468. * %IWL_RX_MPDU_PHY_TSF_OVERLOAD isn't set
  469. */
  470. __le64 tsf_on_air_rise;
  471. /**
  472. * @he_phy_data:
  473. * HE PHY data, see &enum iwl_rx_he_phy, valid
  474. * only if %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set
  475. */
  476. __le64 he_phy_data;
  477. };
  478. /* DW16 & DW17 */
  479. /**
  480. * @reserved: reserved
  481. */
  482. __le32 reserved[2];
  483. } __packed; /* RX_MPDU_RES_START_API_S_VER_3 */
  484. /**
  485. * struct iwl_rx_mpdu_desc - RX MPDU descriptor
  486. */
  487. struct iwl_rx_mpdu_desc {
  488. /* DW2 */
  489. /**
  490. * @mpdu_len: MPDU length
  491. */
  492. __le16 mpdu_len;
  493. /**
  494. * @mac_flags1: &enum iwl_rx_mpdu_mac_flags1
  495. */
  496. u8 mac_flags1;
  497. /**
  498. * @mac_flags2: &enum iwl_rx_mpdu_mac_flags2
  499. */
  500. u8 mac_flags2;
  501. /* DW3 */
  502. /**
  503. * @amsdu_info: &enum iwl_rx_mpdu_amsdu_info
  504. */
  505. u8 amsdu_info;
  506. /**
  507. * @phy_info: &enum iwl_rx_mpdu_phy_info
  508. */
  509. __le16 phy_info;
  510. /**
  511. * @mac_phy_idx: MAC/PHY index
  512. */
  513. u8 mac_phy_idx;
  514. /* DW4 - carries csum data only when rpa_en == 1 */
  515. /**
  516. * @raw_csum: raw checksum (alledgedly unreliable)
  517. */
  518. __le16 raw_csum;
  519. /**
  520. * @l3l4_flags: &enum iwl_rx_l3l4_flags
  521. */
  522. __le16 l3l4_flags;
  523. /* DW5 */
  524. /**
  525. * @status: &enum iwl_rx_mpdu_status
  526. */
  527. __le16 status;
  528. /**
  529. * @hash_filter: hash filter value
  530. */
  531. u8 hash_filter;
  532. /**
  533. * @sta_id_flags: &enum iwl_rx_mpdu_sta_id_flags
  534. */
  535. u8 sta_id_flags;
  536. /* DW6 */
  537. /**
  538. * @reorder_data: &enum iwl_rx_mpdu_reorder_data
  539. */
  540. __le32 reorder_data;
  541. union {
  542. struct iwl_rx_mpdu_desc_v1 v1;
  543. struct iwl_rx_mpdu_desc_v3 v3;
  544. };
  545. } __packed; /* RX_MPDU_RES_START_API_S_VER_3 */
  546. #define IWL_RX_DESC_SIZE_V1 offsetofend(struct iwl_rx_mpdu_desc, v1)
  547. struct iwl_frame_release {
  548. u8 baid;
  549. u8 reserved;
  550. __le16 nssn;
  551. };
  552. enum iwl_rss_hash_func_en {
  553. IWL_RSS_HASH_TYPE_IPV4_TCP,
  554. IWL_RSS_HASH_TYPE_IPV4_UDP,
  555. IWL_RSS_HASH_TYPE_IPV4_PAYLOAD,
  556. IWL_RSS_HASH_TYPE_IPV6_TCP,
  557. IWL_RSS_HASH_TYPE_IPV6_UDP,
  558. IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
  559. };
  560. #define IWL_RSS_HASH_KEY_CNT 10
  561. #define IWL_RSS_INDIRECTION_TABLE_SIZE 128
  562. #define IWL_RSS_ENABLE 1
  563. /**
  564. * struct iwl_rss_config_cmd - RSS (Receive Side Scaling) configuration
  565. *
  566. * @flags: 1 - enable, 0 - disable
  567. * @hash_mask: Type of RSS to use. Values are from %iwl_rss_hash_func_en
  568. * @reserved: reserved
  569. * @secret_key: 320 bit input of random key configuration from driver
  570. * @indirection_table: indirection table
  571. */
  572. struct iwl_rss_config_cmd {
  573. __le32 flags;
  574. u8 hash_mask;
  575. u8 reserved[3];
  576. __le32 secret_key[IWL_RSS_HASH_KEY_CNT];
  577. u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE];
  578. } __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */
  579. #define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128
  580. #define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0
  581. #define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf
  582. /**
  583. * struct iwl_rxq_sync_cmd - RXQ notification trigger
  584. *
  585. * @flags: flags of the notification. bit 0:3 are the sender queue
  586. * @rxq_mask: rx queues to send the notification on
  587. * @count: number of bytes in payload, should be DWORD aligned
  588. * @payload: data to send to rx queues
  589. */
  590. struct iwl_rxq_sync_cmd {
  591. __le32 flags;
  592. __le32 rxq_mask;
  593. __le32 count;
  594. u8 payload[];
  595. } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */
  596. /**
  597. * struct iwl_rxq_sync_notification - Notification triggered by RXQ
  598. * sync command
  599. *
  600. * @count: number of bytes in payload
  601. * @payload: data to send to rx queues
  602. */
  603. struct iwl_rxq_sync_notification {
  604. __le32 count;
  605. u8 payload[];
  606. } __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */
  607. /**
  608. * enum iwl_mvm_rxq_notif_type - Internal message identifier
  609. *
  610. * @IWL_MVM_RXQ_EMPTY: empty sync notification
  611. * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA
  612. */
  613. enum iwl_mvm_rxq_notif_type {
  614. IWL_MVM_RXQ_EMPTY,
  615. IWL_MVM_RXQ_NOTIF_DEL_BA,
  616. };
  617. /**
  618. * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent
  619. * in &iwl_rxq_sync_cmd. Should be DWORD aligned.
  620. * FW is agnostic to the payload, so there are no endianity requirements.
  621. *
  622. * @type: value from &iwl_mvm_rxq_notif_type
  623. * @sync: ctrl path is waiting for all notifications to be received
  624. * @cookie: internal cookie to identify old notifications
  625. * @data: payload
  626. */
  627. struct iwl_mvm_internal_rxq_notif {
  628. u16 type;
  629. u16 sync;
  630. u32 cookie;
  631. u8 data[];
  632. } __packed;
  633. /**
  634. * enum iwl_mvm_pm_event - type of station PM event
  635. * @IWL_MVM_PM_EVENT_AWAKE: station woke up
  636. * @IWL_MVM_PM_EVENT_ASLEEP: station went to sleep
  637. * @IWL_MVM_PM_EVENT_UAPSD: station sent uAPSD trigger
  638. * @IWL_MVM_PM_EVENT_PS_POLL: station sent PS-Poll
  639. */
  640. enum iwl_mvm_pm_event {
  641. IWL_MVM_PM_EVENT_AWAKE,
  642. IWL_MVM_PM_EVENT_ASLEEP,
  643. IWL_MVM_PM_EVENT_UAPSD,
  644. IWL_MVM_PM_EVENT_PS_POLL,
  645. }; /* PEER_PM_NTFY_API_E_VER_1 */
  646. /**
  647. * struct iwl_mvm_pm_state_notification - station PM state notification
  648. * @sta_id: station ID of the station changing state
  649. * @type: the new powersave state, see &enum iwl_mvm_pm_event
  650. */
  651. struct iwl_mvm_pm_state_notification {
  652. u8 sta_id;
  653. u8 type;
  654. /* private: */
  655. __le16 reserved;
  656. } __packed; /* PEER_PM_NTFY_API_S_VER_1 */
  657. #define BA_WINDOW_STREAMS_MAX 16
  658. #define BA_WINDOW_STATUS_TID_MSK 0x000F
  659. #define BA_WINDOW_STATUS_STA_ID_POS 4
  660. #define BA_WINDOW_STATUS_STA_ID_MSK 0x01F0
  661. #define BA_WINDOW_STATUS_VALID_MSK BIT(9)
  662. /**
  663. * struct iwl_ba_window_status_notif - reordering window's status notification
  664. * @bitmap: bitmap of received frames [start_seq_num + 0]..[start_seq_num + 63]
  665. * @ra_tid: bit 3:0 - TID, bit 8:4 - STA_ID, bit 9 - valid
  666. * @start_seq_num: the start sequence number of the bitmap
  667. * @mpdu_rx_count: the number of received MPDUs since entering D0i3
  668. */
  669. struct iwl_ba_window_status_notif {
  670. __le64 bitmap[BA_WINDOW_STREAMS_MAX];
  671. __le16 ra_tid[BA_WINDOW_STREAMS_MAX];
  672. __le32 start_seq_num[BA_WINDOW_STREAMS_MAX];
  673. __le16 mpdu_rx_count[BA_WINDOW_STREAMS_MAX];
  674. } __packed; /* BA_WINDOW_STATUS_NTFY_API_S_VER_1 */
  675. /**
  676. * struct iwl_rfh_queue_config - RX queue configuration
  677. * @q_num: Q num
  678. * @enable: enable queue
  679. * @reserved: alignment
  680. * @urbd_stts_wrptr: DMA address of urbd_stts_wrptr
  681. * @fr_bd_cb: DMA address of freeRB table
  682. * @ur_bd_cb: DMA address of used RB table
  683. * @fr_bd_wid: Initial index of the free table
  684. */
  685. struct iwl_rfh_queue_data {
  686. u8 q_num;
  687. u8 enable;
  688. __le16 reserved;
  689. __le64 urbd_stts_wrptr;
  690. __le64 fr_bd_cb;
  691. __le64 ur_bd_cb;
  692. __le32 fr_bd_wid;
  693. } __packed; /* RFH_QUEUE_CONFIG_S_VER_1 */
  694. /**
  695. * struct iwl_rfh_queue_config - RX queue configuration
  696. * @num_queues: number of queues configured
  697. * @reserved: alignment
  698. * @data: DMA addresses per-queue
  699. */
  700. struct iwl_rfh_queue_config {
  701. u8 num_queues;
  702. u8 reserved[3];
  703. struct iwl_rfh_queue_data data[];
  704. } __packed; /* RFH_QUEUE_CONFIG_API_S_VER_1 */
  705. #endif /* __iwl_fw_api_rx_h__ */