hal_api_mon.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491
  1. /*
  2. * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _HAL_API_MON_H_
  20. #define _HAL_API_MON_H_
  21. #include "qdf_types.h"
  22. #include "hal_internal.h"
  23. #include "hal_rx.h"
  24. #include "hal_hw_headers.h"
  25. #include <target_type.h>
  26. #define HAL_RX_PHY_DATA_RADAR 0x01
  27. #define HAL_SU_MU_CODING_LDPC 0x01
  28. #define HAL_RX_FCS_LEN (4)
  29. #define KEY_EXTIV 0x20
  30. #define HAL_ALIGN(x, a) HAL_ALIGN_MASK(x, (a)-1)
  31. #define HAL_ALIGN_MASK(x, mask) (typeof(x))(((uint32)(x) + (mask)) & ~(mask))
  32. #define HAL_RX_TLV32_HDR_SIZE 4
  33. #define HAL_RX_GET_USER_TLV32_TYPE(rx_status_tlv_ptr) \
  34. ((qdf_le32_to_cpu(*((uint32_t *)(rx_status_tlv_ptr))) & \
  35. HAL_RX_USER_TLV32_TYPE_MASK) >> \
  36. HAL_RX_USER_TLV32_TYPE_LSB)
  37. #define HAL_RX_GET_USER_TLV32_LEN(rx_status_tlv_ptr) \
  38. ((qdf_le32_to_cpu(*((uint32_t *)(rx_status_tlv_ptr))) & \
  39. HAL_RX_USER_TLV32_LEN_MASK) >> \
  40. HAL_RX_USER_TLV32_LEN_LSB)
  41. #define HAL_RX_GET_USER_TLV32_USERID(rx_status_tlv_ptr) \
  42. ((qdf_le32_to_cpu(*((uint32_t *)(rx_status_tlv_ptr))) & \
  43. HAL_RX_USER_TLV32_USERID_MASK) >> \
  44. HAL_RX_USER_TLV32_USERID_LSB)
  45. #define HAL_RX_TLV64_HDR_SIZE 8
  46. #ifdef CONFIG_4_BYTES_TLV_TAG
  47. #define HAL_RX_TLV_HDR_SIZE HAL_RX_TLV32_HDR_SIZE
  48. #else
  49. #define HAL_RX_TLV_HDR_SIZE HAL_RX_TLV64_HDR_SIZE
  50. #endif
  51. #define HAL_RX_GET_USER_TLV64_TYPE(rx_status_tlv_ptr) \
  52. ((qdf_le64_to_cpu(*((uint64_t *)(rx_status_tlv_ptr))) & \
  53. HAL_RX_USER_TLV64_TYPE_MASK) >> \
  54. HAL_RX_USER_TLV64_TYPE_LSB)
  55. #define HAL_RX_GET_USER_TLV64_LEN(rx_status_tlv_ptr) \
  56. ((qdf_le64_to_cpu(*((uint64_t *)(rx_status_tlv_ptr))) & \
  57. HAL_RX_USER_TLV64_LEN_MASK) >> \
  58. HAL_RX_USER_TLV64_LEN_LSB)
  59. #define HAL_RX_GET_USER_TLV64_USERID(rx_status_tlv_ptr) \
  60. ((qdf_le64_to_cpu(*((uint64_t *)(rx_status_tlv_ptr))) & \
  61. HAL_RX_USER_TLV64_USERID_MASK) >> \
  62. HAL_RX_USER_TLV64_USERID_LSB)
  63. #define HAL_TLV_STATUS_PPDU_NOT_DONE 0
  64. #define HAL_TLV_STATUS_PPDU_DONE 1
  65. #define HAL_TLV_STATUS_BUF_DONE 2
  66. #define HAL_TLV_STATUS_PPDU_NON_STD_DONE 3
  67. #define HAL_TLV_STATUS_PPDU_START 4
  68. #define HAL_TLV_STATUS_HEADER 5
  69. #define HAL_TLV_STATUS_MPDU_END 6
  70. #define HAL_TLV_STATUS_MSDU_START 7
  71. #define HAL_TLV_STATUS_MSDU_END 8
  72. #define HAL_TLV_STATUS_MON_BUF_ADDR 9
  73. #define HAL_TLV_STATUS_MPDU_START 10
  74. #define HAL_TLV_STATUS_MON_DROP 11
  75. #define HAL_MAX_UL_MU_USERS 37
  76. #define HAL_RX_PKT_TYPE_11A 0
  77. #define HAL_RX_PKT_TYPE_11B 1
  78. #define HAL_RX_PKT_TYPE_11N 2
  79. #define HAL_RX_PKT_TYPE_11AC 3
  80. #define HAL_RX_PKT_TYPE_11AX 4
  81. #ifdef WLAN_FEATURE_11BE
  82. #define HAL_RX_PKT_TYPE_11BE 6
  83. #endif
  84. #define HAL_RX_RECEPTION_TYPE_SU 0
  85. #define HAL_RX_RECEPTION_TYPE_MU_MIMO 1
  86. #define HAL_RX_RECEPTION_TYPE_OFDMA 2
  87. #define HAL_RX_RECEPTION_TYPE_MU_OFDMA 3
  88. /* Multiply rate by 2 to avoid float point
  89. * and get rate in units of 500kbps
  90. */
  91. #define HAL_11B_RATE_0MCS 11*2
  92. #define HAL_11B_RATE_1MCS 5.5*2
  93. #define HAL_11B_RATE_2MCS 2*2
  94. #define HAL_11B_RATE_3MCS 1*2
  95. #define HAL_11B_RATE_4MCS 11*2
  96. #define HAL_11B_RATE_5MCS 5.5*2
  97. #define HAL_11B_RATE_6MCS 2*2
  98. #define HAL_11A_RATE_0MCS 48*2
  99. #define HAL_11A_RATE_1MCS 24*2
  100. #define HAL_11A_RATE_2MCS 12*2
  101. #define HAL_11A_RATE_3MCS 6*2
  102. #define HAL_11A_RATE_4MCS 54*2
  103. #define HAL_11A_RATE_5MCS 36*2
  104. #define HAL_11A_RATE_6MCS 18*2
  105. #define HAL_11A_RATE_7MCS 9*2
  106. #define HAL_LEGACY_MCS0 0
  107. #define HAL_LEGACY_MCS1 1
  108. #define HAL_LEGACY_MCS2 2
  109. #define HAL_LEGACY_MCS3 3
  110. #define HAL_LEGACY_MCS4 4
  111. #define HAL_LEGACY_MCS5 5
  112. #define HAL_LEGACY_MCS6 6
  113. #define HAL_LEGACY_MCS7 7
  114. #define HE_GI_0_8 0
  115. #define HE_GI_0_4 1
  116. #define HE_GI_1_6 2
  117. #define HE_GI_3_2 3
  118. #define HE_GI_RADIOTAP_0_8 0
  119. #define HE_GI_RADIOTAP_1_6 1
  120. #define HE_GI_RADIOTAP_3_2 2
  121. #define HE_GI_RADIOTAP_RESERVED 3
  122. #define HE_LTF_RADIOTAP_UNKNOWN 0
  123. #define HE_LTF_RADIOTAP_1_X 1
  124. #define HE_LTF_RADIOTAP_2_X 2
  125. #define HE_LTF_RADIOTAP_4_X 3
  126. #define HT_SGI_PRESENT 0x80
  127. #define HE_LTF_1_X 0
  128. #define HE_LTF_2_X 1
  129. #define HE_LTF_4_X 2
  130. #define HE_LTF_UNKNOWN 3
  131. #define VHT_SIG_SU_NSS_MASK 0x7
  132. #define HT_SIG_SU_NSS_SHIFT 0x3
  133. #define HAL_TID_INVALID 31
  134. #define HAL_AST_IDX_INVALID 0xFFFF
  135. #ifdef GET_MSDU_AGGREGATION
  136. #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)\
  137. {\
  138. struct rx_msdu_end *rx_msdu_end;\
  139. bool first_msdu, last_msdu; \
  140. rx_msdu_end = &rx_desc->msdu_end_tlv.rx_msdu_end;\
  141. first_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_5, FIRST_MSDU);\
  142. last_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_5, LAST_MSDU);\
  143. if (first_msdu && last_msdu)\
  144. rs->rs_flags &= (~IEEE80211_AMSDU_FLAG);\
  145. else\
  146. rs->rs_flags |= (IEEE80211_AMSDU_FLAG); \
  147. } \
  148. #define HAL_RX_SET_MSDU_AGGREGATION((rs_mpdu), (rs_ppdu))\
  149. {\
  150. if (rs_mpdu->rs_flags & IEEE80211_AMSDU_FLAG)\
  151. rs_ppdu->rs_flags |= IEEE80211_AMSDU_FLAG;\
  152. } \
  153. #else
  154. #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)
  155. #define HAL_RX_SET_MSDU_AGGREGATION(rs_mpdu, rs_ppdu)
  156. #endif
  157. /* Max MPDUs per status buffer */
  158. #define HAL_RX_MAX_MPDU 256
  159. #define HAL_RX_NUM_WORDS_PER_PPDU_BITMAP (HAL_RX_MAX_MPDU >> 5)
  160. #define HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER 16
  161. /* Max pilot count */
  162. #ifdef QCA_MONITOR_2_0_SUPPORT
  163. #define HAL_RX_MAX_SU_EVM_COUNT 256
  164. #else
  165. #define HAL_RX_MAX_SU_EVM_COUNT 32
  166. #endif
  167. #define HAL_RX_FRAMECTRL_TYPE_MASK 0x0C
  168. #define HAL_RX_GET_FRAME_CTRL_TYPE(fc)\
  169. (((fc) & HAL_RX_FRAMECTRL_TYPE_MASK) >> 2)
  170. #define HAL_RX_FRAME_CTRL_TYPE_MGMT 0x0
  171. #define HAL_RX_FRAME_CTRL_TYPE_CTRL 0x1
  172. #define HAL_RX_FRAME_CTRL_TYPE_DATA 0x2
  173. /**
  174. * enum hal_dl_ul_flag - flag to indicate UL/DL
  175. * @dl_ul_flag_is_dl_or_tdls: DL
  176. * @dl_ul_flag_is_ul: UL
  177. */
  178. enum hal_dl_ul_flag {
  179. dl_ul_flag_is_dl_or_tdls,
  180. dl_ul_flag_is_ul,
  181. };
  182. /**
  183. * enum hal_eht_ppdu_sig_cmn_type - PPDU type
  184. * @eht_ppdu_sig_tb_or_dl_ofdma: TB/DL_OFDMA PPDU
  185. * @eht_ppdu_sig_su: SU PPDU
  186. * @eht_ppdu_sig_dl_mu_mimo: DL_MU_MIMO PPDU
  187. */
  188. enum hal_eht_ppdu_sig_cmn_type {
  189. eht_ppdu_sig_tb_or_dl_ofdma,
  190. eht_ppdu_sig_su,
  191. eht_ppdu_sig_dl_mu_mimo,
  192. };
  193. /**
  194. * struct hal_mon_packet_info - packet info
  195. * @sw_cookie: 64-bit SW desc virtual address
  196. * @dma_length: packet DMA length
  197. * @msdu_continuation: msdu continulation in next buffer
  198. * @truncated: packet is truncated
  199. */
  200. struct hal_mon_packet_info {
  201. uint64_t sw_cookie;
  202. uint32_t dma_length : 16,
  203. msdu_continuation : 1,
  204. truncated : 1;
  205. };
  206. /**
  207. * struct hal_rx_mon_msdu_info - msdu info
  208. * @first_buffer: first buffer of msdu
  209. * @last_buffer: last buffer of msdu
  210. * @first_mpdu: first MPDU
  211. * @mpdu_length_err: MPDU length error
  212. * @fcs_err: FCS error
  213. * @first_msdu: first msdu
  214. * @decap_type: decap type
  215. * @last_msdu: last msdu
  216. * @l3_header_padding: L3 padding header
  217. * @stbc: stbc enabled
  218. * @sgi: SGI value
  219. * @reception_type: reception type
  220. * @msdu_index: msdu index
  221. * @buffer_len: buffer len
  222. * @frag_len: frag len
  223. * @msdu_len: msdu len
  224. * @user_rssi: user rssi
  225. */
  226. struct hal_rx_mon_msdu_info {
  227. uint32_t first_buffer : 1,
  228. last_buffer : 1,
  229. first_mpdu : 1,
  230. mpdu_length_err : 1,
  231. fcs_err : 1,
  232. first_msdu : 1,
  233. decap_type : 3,
  234. last_msdu : 1,
  235. l3_header_padding : 3,
  236. stbc : 1,
  237. sgi : 2,
  238. reception_type : 3,
  239. msdu_index : 4;
  240. uint16_t buffer_len : 12;
  241. uint16_t frag_len : 12;
  242. uint16_t msdu_len;
  243. int16_t user_rssi;
  244. };
  245. /**
  246. * struct hal_rx_mon_mpdu_info - MPDU info
  247. * @decap_type: decap_type
  248. * @mpdu_length_err: MPDU length error
  249. * @fcs_err: FCS error
  250. * @overflow_err: overflow error
  251. * @decrypt_err: decrypt error
  252. * @mpdu_start_received: MPDU start received
  253. * @full_pkt: Full MPDU received
  254. * @first_rx_hdr_rcvd: First rx_hdr received
  255. * @truncated: truncated MPDU
  256. */
  257. struct hal_rx_mon_mpdu_info {
  258. uint32_t decap_type : 8,
  259. mpdu_length_err : 1,
  260. fcs_err : 1,
  261. overflow_err : 1,
  262. decrypt_err : 1,
  263. mpdu_start_received : 1,
  264. full_pkt : 1,
  265. first_rx_hdr_rcvd : 1,
  266. truncated : 1;
  267. };
  268. /**
  269. * struct hal_rx_mon_desc_info () - HAL Rx Monitor descriptor info
  270. *
  271. * @ppdu_id: PHY ppdu id
  272. * @status_ppdu_id: status PHY ppdu id
  273. * @status_buf_count: number of status buffer count
  274. * @rxdma_push_reason: rxdma push reason
  275. * @rxdma_error_code: rxdma error code
  276. * @msdu_count: msdu count
  277. * @end_of_ppdu: end of ppdu
  278. * @link_desc: msdu link descriptor address
  279. * @status_buf: for a PPDU, status buffers can span across
  280. * multiple buffers, status_buf points to first
  281. * status buffer address of PPDU
  282. * @drop_ppdu: flag to indicate current destination
  283. * ring ppdu drop
  284. */
  285. struct hal_rx_mon_desc_info {
  286. uint16_t ppdu_id;
  287. uint16_t status_ppdu_id;
  288. uint8_t status_buf_count;
  289. uint8_t rxdma_push_reason;
  290. uint8_t rxdma_error_code;
  291. uint8_t msdu_count;
  292. uint8_t end_of_ppdu;
  293. struct hal_buf_info link_desc;
  294. struct hal_buf_info status_buf;
  295. bool drop_ppdu;
  296. };
  297. /**
  298. * struct hal_rx_su_evm_info - SU evm info
  299. * @number_of_symbols: number of symbols
  300. * @nss_count: nss count
  301. * @pilot_count: pilot count
  302. * @pilot_evm: Array of pilot evm values
  303. */
  304. struct hal_rx_su_evm_info {
  305. uint32_t number_of_symbols;
  306. uint8_t nss_count;
  307. uint8_t pilot_count;
  308. uint32_t pilot_evm[HAL_RX_MAX_SU_EVM_COUNT];
  309. };
  310. enum {
  311. DP_PPDU_STATUS_START,
  312. DP_PPDU_STATUS_DONE,
  313. };
  314. /**
  315. * struct hal_rx_ppdu_drop_cnt - PPDU drop count
  316. * @ppdu_drop_cnt: PPDU drop count
  317. * @mpdu_drop_cnt: MPDU drop count
  318. * @end_of_ppdu_drop_cnt: End of PPDU drop count
  319. * @tlv_drop_cnt: TLV drop count
  320. */
  321. struct hal_rx_ppdu_drop_cnt {
  322. uint8_t ppdu_drop_cnt;
  323. uint16_t mpdu_drop_cnt;
  324. uint8_t end_of_ppdu_drop_cnt;
  325. uint16_t tlv_drop_cnt;
  326. };
  327. static inline QDF_STATUS
  328. hal_rx_reo_ent_get_src_link_id(hal_soc_handle_t hal_soc_hdl,
  329. hal_rxdma_desc_t rx_desc,
  330. uint8_t *src_link_id)
  331. {
  332. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  333. if (!hal_soc || !hal_soc->ops) {
  334. hal_err("hal handle is NULL");
  335. QDF_BUG(0);
  336. return QDF_STATUS_E_INVAL;
  337. }
  338. if (hal_soc->ops->hal_rx_reo_ent_get_src_link_id)
  339. return hal_soc->ops->hal_rx_reo_ent_get_src_link_id(rx_desc,
  340. src_link_id);
  341. return QDF_STATUS_E_INVAL;
  342. }
  343. /**
  344. * hal_rx_reo_ent_buf_paddr_get() - Gets the physical address and cookie from
  345. * the REO entrance ring element
  346. * @hal_soc_hdl: HAL version of the SOC pointer
  347. * @rx_desc: rx descriptor
  348. * @buf_info: structure to return the buffer information
  349. * @msdu_cnt: pointer to msdu count in MPDU
  350. *
  351. * CAUTION: This API calls a hal_soc ops, so be careful before calling this in
  352. * per packet path
  353. *
  354. * Return: void
  355. */
  356. static inline
  357. void hal_rx_reo_ent_buf_paddr_get(hal_soc_handle_t hal_soc_hdl,
  358. hal_rxdma_desc_t rx_desc,
  359. struct hal_buf_info *buf_info,
  360. uint32_t *msdu_cnt)
  361. {
  362. struct reo_entrance_ring *reo_ent_ring =
  363. (struct reo_entrance_ring *)rx_desc;
  364. struct buffer_addr_info *buf_addr_info;
  365. struct rx_mpdu_desc_info *rx_mpdu_desc_info_details;
  366. uint32_t loop_cnt;
  367. rx_mpdu_desc_info_details =
  368. &reo_ent_ring->reo_level_mpdu_frame_info.rx_mpdu_desc_info_details;
  369. *msdu_cnt = HAL_RX_GET(rx_mpdu_desc_info_details,
  370. HAL_RX_MPDU_DESC_INFO, MSDU_COUNT);
  371. loop_cnt = HAL_RX_GET(reo_ent_ring, HAL_REO_ENTRANCE_RING,
  372. LOOPING_COUNT);
  373. buf_addr_info =
  374. &reo_ent_ring->reo_level_mpdu_frame_info.msdu_link_desc_addr_info;
  375. hal_rx_buf_cookie_rbm_get(hal_soc_hdl, (uint32_t *)buf_addr_info,
  376. buf_info);
  377. buf_info->paddr =
  378. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  379. ((uint64_t)
  380. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  381. dp_nofl_debug("[%s][%d] ReoAddr=%pK, addrInfo=%pK, paddr=0x%llx, loopcnt=%d",
  382. __func__, __LINE__, reo_ent_ring, buf_addr_info,
  383. (unsigned long long)buf_info->paddr, loop_cnt);
  384. }
  385. static inline
  386. void hal_rx_mon_next_link_desc_get(hal_soc_handle_t hal_soc_hdl,
  387. void *rx_msdu_link_desc,
  388. struct hal_buf_info *buf_info)
  389. {
  390. struct rx_msdu_link *msdu_link =
  391. (struct rx_msdu_link *)rx_msdu_link_desc;
  392. struct buffer_addr_info *buf_addr_info;
  393. buf_addr_info = &msdu_link->next_msdu_link_desc_addr_info;
  394. hal_rx_buf_cookie_rbm_get(hal_soc_hdl, (uint32_t *)buf_addr_info,
  395. buf_info);
  396. buf_info->paddr =
  397. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  398. ((uint64_t)
  399. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  400. }
  401. static inline
  402. uint8_t *HAL_RX_MON_DEST_GET_DESC(uint8_t *data)
  403. {
  404. return data;
  405. }
  406. static inline uint32_t
  407. hal_rx_tlv_mpdu_len_err_get(hal_soc_handle_t hal_soc_hdl, void *hw_desc_addr)
  408. {
  409. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  410. if (!hal_soc || !hal_soc->ops) {
  411. hal_err("hal handle is NULL");
  412. QDF_BUG(0);
  413. return 0;
  414. }
  415. if (hal_soc->ops->hal_rx_tlv_mpdu_len_err_get)
  416. return hal_soc->ops->hal_rx_tlv_mpdu_len_err_get(hw_desc_addr);
  417. return 0;
  418. }
  419. static inline uint32_t
  420. hal_rx_tlv_mpdu_fcs_err_get(hal_soc_handle_t hal_soc_hdl, void *hw_desc_addr)
  421. {
  422. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  423. if (!hal_soc || !hal_soc->ops) {
  424. hal_err("hal handle is NULL");
  425. QDF_BUG(0);
  426. return 0;
  427. }
  428. if (hal_soc->ops->hal_rx_tlv_mpdu_fcs_err_get)
  429. return hal_soc->ops->hal_rx_tlv_mpdu_fcs_err_get(hw_desc_addr);
  430. return 0;
  431. }
  432. #ifdef notyet
  433. /*
  434. * HAL_RX_HW_DESC_MPDU_VALID() - check MPDU start TLV tag in MPDU
  435. * start TLV of Hardware TLV descriptor
  436. * @hw_desc_addr: Hardware descriptor address
  437. *
  438. * Return: bool: if TLV tag match
  439. */
  440. static inline
  441. bool HAL_RX_HW_DESC_MPDU_VALID(void *hw_desc_addr)
  442. {
  443. struct rx_mon_pkt_tlvs *rx_desc =
  444. (struct rx_mon_pkt_tlvs *)hw_desc_addr;
  445. uint32_t tlv_tag;
  446. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(&rx_desc->mpdu_start_tlv);
  447. return tlv_tag == WIFIRX_MPDU_START_E ? true : false;
  448. }
  449. #endif
  450. /*
  451. * HAL_RX_HW_DESC_MPDU_VALID() - check MPDU start TLV user id in MPDU
  452. * start TLV of Hardware TLV descriptor
  453. * @hw_desc_addr: Hardware descriptor address
  454. *
  455. * Return: unit32_t: user id
  456. */
  457. static inline uint32_t
  458. hal_rx_hw_desc_mpdu_user_id(hal_soc_handle_t hal_soc_hdl,
  459. void *hw_desc_addr)
  460. {
  461. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  462. if (!hal_soc || !hal_soc->ops) {
  463. hal_err("hal handle is NULL");
  464. QDF_BUG(0);
  465. return 0;
  466. }
  467. if (hal_soc->ops->hal_rx_hw_desc_mpdu_user_id)
  468. return hal_soc->ops->hal_rx_hw_desc_mpdu_user_id(hw_desc_addr);
  469. return 0;
  470. }
  471. /* TODO: Move all Rx descriptor functions to hal_rx.h to avoid duplication */
  472. /**
  473. * hal_rx_mon_msdu_link_desc_set() - Retrieves MSDU Link Descriptor to WBM
  474. * @hal_soc_hdl: HAL version of the SOC pointer
  475. * @src_srng_desc: void pointer to the WBM Release Ring descriptor
  476. * @buf_addr_info: void pointer to the buffer_addr_info
  477. *
  478. * Return: void
  479. */
  480. static inline
  481. void hal_rx_mon_msdu_link_desc_set(hal_soc_handle_t hal_soc_hdl,
  482. void *src_srng_desc,
  483. hal_buff_addrinfo_t buf_addr_info)
  484. {
  485. struct buffer_addr_info *wbm_srng_buffer_addr_info =
  486. (struct buffer_addr_info *)src_srng_desc;
  487. uint64_t paddr;
  488. struct buffer_addr_info *p_buffer_addr_info =
  489. (struct buffer_addr_info *)buf_addr_info;
  490. paddr =
  491. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  492. ((uint64_t)
  493. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  494. dp_nofl_debug("[%s][%d] src_srng_desc=%pK, buf_addr=0x%llx, cookie=0x%llx",
  495. __func__, __LINE__, src_srng_desc, (unsigned long long)paddr,
  496. (unsigned long long)p_buffer_addr_info->sw_buffer_cookie);
  497. /* Structure copy !!! */
  498. *wbm_srng_buffer_addr_info =
  499. *((struct buffer_addr_info *)buf_addr_info);
  500. }
  501. /**
  502. * hal_get_rx_msdu_link_desc_size() - Get msdu link descriptor size
  503. *
  504. * Return: size of rx_msdu_link
  505. */
  506. static inline
  507. uint32_t hal_get_rx_msdu_link_desc_size(void)
  508. {
  509. return sizeof(struct rx_msdu_link);
  510. }
  511. enum {
  512. HAL_PKT_TYPE_OFDM = 0,
  513. HAL_PKT_TYPE_CCK,
  514. HAL_PKT_TYPE_HT,
  515. HAL_PKT_TYPE_VHT,
  516. HAL_PKT_TYPE_HE,
  517. };
  518. enum {
  519. HAL_SGI_0_8_US,
  520. HAL_SGI_0_4_US,
  521. HAL_SGI_1_6_US,
  522. HAL_SGI_3_2_US,
  523. };
  524. #ifdef WLAN_FEATURE_11BE
  525. enum {
  526. HAL_FULL_RX_BW_20,
  527. HAL_FULL_RX_BW_40,
  528. HAL_FULL_RX_BW_80,
  529. HAL_FULL_RX_BW_160,
  530. HAL_FULL_RX_BW_320,
  531. };
  532. #else
  533. enum {
  534. HAL_FULL_RX_BW_20,
  535. HAL_FULL_RX_BW_40,
  536. HAL_FULL_RX_BW_80,
  537. HAL_FULL_RX_BW_160,
  538. };
  539. #endif
  540. enum {
  541. HAL_RX_TYPE_SU,
  542. HAL_RX_TYPE_MU_MIMO,
  543. HAL_RX_TYPE_MU_OFDMA,
  544. HAL_RX_TYPE_MU_OFDMA_MIMO,
  545. };
  546. enum {
  547. HAL_RX_TYPE_DL,
  548. HAL_RX_TYPE_UL,
  549. };
  550. /**
  551. * enum
  552. * @HAL_RECEPTION_TYPE_SU: Basic SU reception
  553. * @HAL_RECEPTION_TYPE_DL_MU_MIMO: DL MU_MIMO reception
  554. * @HAL_RECEPTION_TYPE_DL_MU_OFMA: DL MU_OFMA reception
  555. * @HAL_RECEPTION_TYPE_DL_MU_OFDMA_MIMO: DL MU_OFDMA_MIMO reception
  556. * @HAL_RECEPTION_TYPE_UL_MU_MIMO: UL MU_MIMO reception
  557. * @HAL_RECEPTION_TYPE_UL_MU_OFDMA: UL MU_OFMA reception
  558. * @HAL_RECEPTION_TYPE_UL_MU_OFDMA_MIMO: UL MU_OFDMA_MIMO reception
  559. */
  560. enum {
  561. HAL_RECEPTION_TYPE_SU,
  562. HAL_RECEPTION_TYPE_DL_MU_MIMO,
  563. HAL_RECEPTION_TYPE_DL_MU_OFMA,
  564. HAL_RECEPTION_TYPE_DL_MU_OFDMA_MIMO,
  565. HAL_RECEPTION_TYPE_UL_MU_MIMO,
  566. HAL_RECEPTION_TYPE_UL_MU_OFDMA,
  567. HAL_RECEPTION_TYPE_UL_MU_OFDMA_MIMO
  568. };
  569. /**
  570. * enum
  571. * @HAL_RX_MON_PPDU_START: PPDU start TLV is decoded in HAL
  572. * @HAL_RX_MON_PPDU_END: PPDU end TLV is decoded in HAL
  573. * @HAL_RX_MON_PPDU_RESET: Not PPDU start and end TLV
  574. */
  575. enum {
  576. HAL_RX_MON_PPDU_START = 0,
  577. HAL_RX_MON_PPDU_END,
  578. HAL_RX_MON_PPDU_RESET,
  579. };
  580. /**
  581. * struct hal_rx_ppdu_common_info - common ppdu info
  582. * @ppdu_id: ppdu id number
  583. * @ppdu_timestamp: timestamp at ppdu received
  584. * @mpdu_cnt_fcs_ok: mpdu count in ppdu with fcs ok
  585. * @mpdu_cnt_fcs_err: mpdu count in ppdu with fcs err
  586. * @num_users: num users
  587. * @mpdu_fcs_ok_bitmap: fcs ok mpdu count in ppdu bitmap
  588. * @last_ppdu_id: last received ppdu id
  589. * @mpdu_cnt: total mpdu count
  590. */
  591. struct hal_rx_ppdu_common_info {
  592. uint32_t ppdu_id;
  593. uint64_t ppdu_timestamp;
  594. uint16_t mpdu_cnt_fcs_ok;
  595. uint8_t mpdu_cnt_fcs_err;
  596. uint8_t num_users;
  597. uint32_t mpdu_fcs_ok_bitmap[HAL_RX_NUM_WORDS_PER_PPDU_BITMAP];
  598. uint32_t last_ppdu_id;
  599. uint16_t mpdu_cnt;
  600. };
  601. /**
  602. * struct hal_rx_msdu_payload_info - msdu payload info
  603. * @first_msdu_payload: pointer to first msdu payload
  604. * @payload_len: payload len
  605. */
  606. struct hal_rx_msdu_payload_info {
  607. uint8_t *first_msdu_payload;
  608. uint16_t payload_len;
  609. };
  610. /**
  611. * struct hal_rx_nac_info - struct for neighbour info
  612. * @fc_valid: flag indicate if it has valid frame control information
  613. * @frame_control: frame control from each MPDU
  614. * @to_ds_flag: flag indicate to_ds bit
  615. * @mac_addr2_valid: flag indicate if mac_addr2 is valid
  616. * @mcast_bcast: multicast/broadcast
  617. * @mac_addr2: mac address2 in wh
  618. */
  619. struct hal_rx_nac_info {
  620. uint32_t fc_valid : 1,
  621. frame_control : 16,
  622. to_ds_flag : 1,
  623. mac_addr2_valid : 1,
  624. mcast_bcast : 1;
  625. uint8_t mac_addr2[QDF_MAC_ADDR_SIZE];
  626. };
  627. /**
  628. * struct hal_rx_ppdu_msdu_info - struct for msdu info from HW TLVs
  629. * @fse_metadata: cached FSE metadata value received in the MSDU END TLV
  630. * @cce_metadata: cached CCE metadata value received in the MSDU_END TLV
  631. * @is_flow_idx_timeout: flag to indicate if flow search timeout occurred
  632. * @is_flow_idx_invalid: flag to indicate if flow idx is valid or not
  633. * @flow_idx: flow idx matched in FSE received in the MSDU END TLV
  634. */
  635. struct hal_rx_ppdu_msdu_info {
  636. uint32_t fse_metadata;
  637. uint32_t cce_metadata : 16,
  638. is_flow_idx_timeout : 1,
  639. is_flow_idx_invalid : 1;
  640. uint32_t flow_idx : 20;
  641. };
  642. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  643. /**
  644. * struct hal_rx_ppdu_cfr_user_info - struct for storing peer info extracted
  645. * from HW TLVs, this will be used for correlating CFR data with multiple peers
  646. * in MU PPDUs
  647. *
  648. * @peer_macaddr: macaddr of the peer
  649. * @ast_index: AST index of the peer
  650. */
  651. struct hal_rx_ppdu_cfr_user_info {
  652. uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
  653. uint16_t ast_index;
  654. };
  655. /**
  656. * struct hal_rx_ppdu_cfr_info - struct for storing ppdu info extracted from HW
  657. * TLVs, this will be used for CFR correlation
  658. *
  659. * @bb_captured_channel : Set by RXPCU when MACRX_FREEZE_CAPTURE_CHANNEL TLV is
  660. * sent to PHY, SW checks it to correlate current PPDU TLVs with uploaded
  661. * channel information.
  662. *
  663. * @bb_captured_timeout : Set by RxPCU to indicate channel capture condition is
  664. * met, but MACRX_FREEZE_CAPTURE_CHANNEL is not sent to PHY due to AST delay,
  665. * which means the rx_frame_falling edge to FREEZE TLV ready time exceeds
  666. * the threshold time defined by RXPCU register FREEZE_TLV_DELAY_CNT_THRESH.
  667. * Bb_captured_reason is still valid in this case.
  668. *
  669. * @rx_location_info_valid: Indicates whether CFR DMA address in the PPDU TLV
  670. * is valid
  671. * <enum 0 rx_location_info_is_not_valid>
  672. * <enum 1 rx_location_info_is_valid>
  673. * <legal all>
  674. *
  675. * @bb_captured_reason : Copy capture_reason of MACRX_FREEZE_CAPTURE_CHANNEL
  676. * TLV to here for FW usage. Valid when bb_captured_channel or
  677. * bb_captured_timeout is set.
  678. * <enum 0 freeze_reason_TM>
  679. * <enum 1 freeze_reason_FTM>
  680. * <enum 2 freeze_reason_ACK_resp_to_TM_FTM>
  681. * <enum 3 freeze_reason_TA_RA_TYPE_FILTER>
  682. * <enum 4 freeze_reason_NDPA_NDP>
  683. * <enum 5 freeze_reason_ALL_PACKET>
  684. * <legal 0-5>
  685. *
  686. * @rtt_che_buffer_pointer_low32 : The low 32 bits of the 40 bits pointer to
  687. * external RTT channel information buffer
  688. *
  689. * @rtt_che_buffer_pointer_high8 : The high 8 bits of the 40 bits pointer to
  690. * external RTT channel information buffer
  691. *
  692. * @chan_capture_status : capture status reported by ucode
  693. * a. CAPTURE_IDLE: FW has disabled "REPETITIVE_CHE_CAPTURE_CTRL"
  694. * b. CAPTURE_BUSY: previous PPDU’s channel capture upload DMA ongoing. (Note
  695. * that this upload is triggered after receiving freeze_channel_capture TLV
  696. * after last PPDU is rx)
  697. * c. CAPTURE_ACTIVE: channel capture is enabled and no previous channel
  698. * capture ongoing
  699. * d. CAPTURE_NO_BUFFER: next buffer in IPC ring not available
  700. *
  701. * @cfr_user_info: Peer mac for upto 4 MU users
  702. *
  703. * @rtt_cfo_measurement : raw cfo data extracted from hardware, which is 14 bit
  704. * signed number. The first bit used for sign representation and 13 bits for
  705. * fractional part.
  706. *
  707. * @agc_gain_info0: Chain 0 & chain 1 agc gain information reported by PHY
  708. *
  709. * @agc_gain_info1: Chain 2 & chain 3 agc gain information reported by PHY
  710. *
  711. * @agc_gain_info2: Chain 4 & chain 5 agc gain information reported by PHY
  712. *
  713. * @agc_gain_info3: Chain 6 & chain 7 agc gain information reported by PHY
  714. *
  715. * @rx_start_ts: Rx packet timestamp, the time the first L-STF ADC sample
  716. * arrived at Rx antenna.
  717. *
  718. * @mcs_rate: Indicates the mcs/rate in which packet is received.
  719. * If HT,
  720. * 0-7: MCS0-MCS7
  721. * If VHT,
  722. * 0-9: MCS0 to MCS9
  723. * If HE,
  724. * 0-11: MCS0 to MCS11,
  725. * 12-13: 4096QAM,
  726. * 14-15: reserved
  727. * If Legacy,
  728. * 0: 48 Mbps
  729. * 1: 24 Mbps
  730. * 2: 12 Mbps
  731. * 3: 6 Mbps
  732. * 4: 54 Mbps
  733. * 5: 36 Mbps
  734. * 6: 18 Mbps
  735. * 7: 9 Mbps
  736. *
  737. * @gi_type: Indicates the guard interval.
  738. * 0: 0.8 us
  739. * 1: 0.4 us
  740. * 2: 1.6 us
  741. * 3: 3.2 us
  742. */
  743. struct hal_rx_ppdu_cfr_info {
  744. bool bb_captured_channel;
  745. bool bb_captured_timeout;
  746. uint8_t bb_captured_reason;
  747. bool rx_location_info_valid;
  748. uint8_t chan_capture_status;
  749. uint8_t rtt_che_buffer_pointer_high8;
  750. uint32_t rtt_che_buffer_pointer_low32;
  751. int16_t rtt_cfo_measurement;
  752. uint32_t agc_gain_info0;
  753. uint32_t agc_gain_info1;
  754. uint32_t agc_gain_info2;
  755. uint32_t agc_gain_info3;
  756. uint32_t rx_start_ts;
  757. uint32_t mcs_rate;
  758. uint32_t gi_type;
  759. };
  760. #else
  761. struct hal_rx_ppdu_cfr_info {};
  762. #endif
  763. struct mon_rx_info {
  764. uint8_t qos_control_info_valid;
  765. uint16_t qos_control;
  766. uint8_t mac_addr1_valid;
  767. uint8_t mac_addr1[QDF_MAC_ADDR_SIZE];
  768. uint16_t user_id;
  769. };
  770. struct mon_rx_user_info {
  771. uint16_t qos_control;
  772. uint8_t qos_control_info_valid;
  773. };
  774. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  775. struct hal_rx_frm_type_info {
  776. uint8_t rx_mgmt_cnt;
  777. uint8_t rx_ctrl_cnt;
  778. uint8_t rx_data_cnt;
  779. };
  780. #else
  781. struct hal_rx_frm_type_info {};
  782. #endif
  783. struct hal_mon_usig_cmn {
  784. uint32_t phy_version : 3,
  785. bw : 3,
  786. ul_dl : 1,
  787. bss_color : 6,
  788. txop : 7,
  789. disregard : 5,
  790. validate_0 : 1,
  791. reserved : 6;
  792. };
  793. struct hal_mon_usig_tb {
  794. uint32_t ppdu_type_comp_mode : 2,
  795. validate_1 : 1,
  796. spatial_reuse_1 : 4,
  797. spatial_reuse_2 : 4,
  798. disregard_1 : 5,
  799. crc : 4,
  800. tail : 6,
  801. reserved : 5,
  802. rx_integrity_check_passed : 1;
  803. };
  804. struct hal_mon_usig_mu {
  805. uint32_t ppdu_type_comp_mode : 2,
  806. validate_1 : 1,
  807. punc_ch_info : 5,
  808. validate_2 : 1,
  809. eht_sig_mcs : 2,
  810. num_eht_sig_sym : 5,
  811. crc : 4,
  812. tail : 6,
  813. reserved : 5,
  814. rx_integrity_check_passed : 1;
  815. };
  816. /**
  817. * union hal_mon_usig_non_cmn: Version dependent USIG fields
  818. * @tb: trigger based frame USIG header
  819. * @mu: MU frame USIG header
  820. */
  821. union hal_mon_usig_non_cmn {
  822. struct hal_mon_usig_tb tb;
  823. struct hal_mon_usig_mu mu;
  824. };
  825. /**
  826. * struct hal_mon_usig_hdr: U-SIG header for EHT (and subsequent) frames
  827. * @usig_1: USIG common header fields
  828. * @usig_2: USIG version dependent fields
  829. */
  830. struct hal_mon_usig_hdr {
  831. struct hal_mon_usig_cmn usig_1;
  832. union hal_mon_usig_non_cmn usig_2;
  833. };
  834. #define HAL_RX_MON_USIG_PPDU_TYPE_N_COMP_MODE_MASK 0x0000000300000000
  835. #define HAL_RX_MON_USIG_PPDU_TYPE_N_COMP_MODE_LSB 32
  836. #define HAL_RX_MON_USIG_GET_PPDU_TYPE_N_COMP_MODE(usig_tlv_ptr) \
  837. ((*((uint64_t *)(usig_tlv_ptr)) & \
  838. HAL_RX_MON_USIG_PPDU_TYPE_N_COMP_MODE_MASK) >> \
  839. HAL_RX_MON_USIG_PPDU_TYPE_N_COMP_MODE_LSB)
  840. #define HAL_RX_MON_USIG_RX_INTEGRITY_CHECK_PASSED_MASK 0x8000000000000000
  841. #define HAL_RX_MON_USIG_RX_INTEGRITY_CHECK_PASSED_LSB 63
  842. #define HAL_RX_MON_USIG_GET_RX_INTEGRITY_CHECK_PASSED(usig_tlv_ptr) \
  843. ((*((uint64_t *)(usig_tlv_ptr)) & \
  844. HAL_RX_MON_USIG_RX_INTEGRITY_CHECK_PASSED_MASK) >> \
  845. HAL_RX_MON_USIG_RX_INTEGRITY_CHECK_PASSED_LSB)
  846. /**
  847. * enum hal_eht_bw - Reception bandwidth
  848. * @HAL_EHT_BW_20: 20Mhz
  849. * @HAL_EHT_BW_40: 40Mhz
  850. * @HAL_EHT_BW_80: 80Mhz
  851. * @HAL_EHT_BW_160: 160Mhz
  852. * @HAL_EHT_BW_320_1: 320_1 band
  853. * @HAL_EHT_BW_320_2: 320_2 band
  854. */
  855. enum hal_eht_bw {
  856. HAL_EHT_BW_20 = 0,
  857. HAL_EHT_BW_40,
  858. HAL_EHT_BW_80,
  859. HAL_EHT_BW_160,
  860. HAL_EHT_BW_320_1,
  861. HAL_EHT_BW_320_2,
  862. };
  863. struct hal_eht_sig_mu_mimo_user_info {
  864. uint32_t sta_id : 11,
  865. mcs : 4,
  866. coding : 1,
  867. spatial_coding : 6,
  868. crc : 4;
  869. };
  870. struct hal_eht_sig_non_mu_mimo_user_info {
  871. uint32_t sta_id : 11,
  872. mcs : 4,
  873. validate : 1,
  874. nss : 4,
  875. beamformed : 1,
  876. coding : 1,
  877. crc : 4;
  878. };
  879. /**
  880. * union hal_eht_sig_user_field - User field in EHTSIG
  881. * @mu_mimo_usr: MU-MIMO user field information in EHTSIG
  882. * @non_mu_mimo_usr: Non MU-MIMO user field information in EHTSIG
  883. */
  884. union hal_eht_sig_user_field {
  885. struct hal_eht_sig_mu_mimo_user_info mu_mimo_usr;
  886. struct hal_eht_sig_non_mu_mimo_user_info non_mu_mimo_usr;
  887. };
  888. struct hal_eht_sig_ofdma_cmn_eb1 {
  889. uint64_t spatial_reuse : 4,
  890. gi_ltf : 2,
  891. num_ltf_sym : 3,
  892. ldpc_extra_sym : 1,
  893. pre_fec_pad_factor : 2,
  894. pe_disambiguity : 1,
  895. disregard : 4,
  896. ru_allocation1_1 : 9,
  897. ru_allocation1_2 : 9,
  898. crc : 4;
  899. };
  900. struct hal_eht_sig_ofdma_cmn_eb2 {
  901. uint64_t ru_allocation2_1 : 9,
  902. ru_allocation2_2 : 9,
  903. ru_allocation2_3 : 9,
  904. ru_allocation2_4 : 9,
  905. ru_allocation2_5 : 9,
  906. ru_allocation2_6 : 9,
  907. crc : 4;
  908. };
  909. struct hal_eht_sig_cc_usig_overflow {
  910. uint32_t spatial_reuse : 4,
  911. gi_ltf : 2,
  912. num_ltf_sym : 3,
  913. ldpc_extra_sym : 1,
  914. pre_fec_pad_factor : 2,
  915. pe_disambiguity : 1,
  916. disregard : 4;
  917. };
  918. struct hal_eht_sig_non_ofdma_cmn_eb {
  919. uint32_t spatial_reuse : 4,
  920. gi_ltf : 2,
  921. num_ltf_sym : 3,
  922. ldpc_extra_sym : 1,
  923. pre_fec_pad_factor : 2,
  924. pe_disambiguity : 1,
  925. disregard : 4,
  926. num_users : 3;
  927. union hal_eht_sig_user_field user_field;
  928. };
  929. struct hal_eht_sig_ndp_cmn_eb {
  930. uint32_t spatial_reuse : 4,
  931. gi_ltf : 2,
  932. num_ltf_sym : 3,
  933. nss : 4,
  934. beamformed : 1,
  935. disregard : 2,
  936. crc : 4;
  937. };
  938. /* Different allowed RU in 11BE */
  939. #define HAL_EHT_RU_26 0ULL
  940. #define HAL_EHT_RU_52 1ULL
  941. #define HAL_EHT_RU_78 2ULL
  942. #define HAL_EHT_RU_106 3ULL
  943. #define HAL_EHT_RU_132 4ULL
  944. #define HAL_EHT_RU_242 5ULL
  945. #define HAL_EHT_RU_484 6ULL
  946. #define HAL_EHT_RU_726 7ULL
  947. #define HAL_EHT_RU_996 8ULL
  948. #define HAL_EHT_RU_996x2 9ULL
  949. #define HAL_EHT_RU_996x3 10ULL
  950. #define HAL_EHT_RU_996x4 11ULL
  951. #define HAL_EHT_RU_NONE 15ULL
  952. #define HAL_EHT_RU_INVALID 31ULL
  953. /*
  954. * MRUs spanning above 80Mhz
  955. * HAL_EHT_RU_996_484 = HAL_EHT_RU_484 + HAL_EHT_RU_996 + 4 (reserved)
  956. */
  957. #define HAL_EHT_RU_996_484 18ULL
  958. #define HAL_EHT_RU_996x2_484 28ULL
  959. #define HAL_EHT_RU_996x3_484 40ULL
  960. #define HAL_EHT_RU_996_484_242 23ULL
  961. /**
  962. * enum ieee80211_eht_ru_size: RU type id in EHTSIG radiotap header
  963. * @IEEE80211_EHT_RU_26: RU26
  964. * @IEEE80211_EHT_RU_52: RU52
  965. * @IEEE80211_EHT_RU_106: RU106
  966. * @IEEE80211_EHT_RU_242: RU242
  967. * @IEEE80211_EHT_RU_484: RU484
  968. * @IEEE80211_EHT_RU_996: RU996
  969. * @IEEE80211_EHT_RU_996x2: RU996x2
  970. * @IEEE80211_EHT_RU_996x4: RU996x4
  971. * @IEEE80211_EHT_RU_52_26: RU52+RU26
  972. * @IEEE80211_EHT_RU_106_26: RU106+RU26
  973. * @IEEE80211_EHT_RU_484_242: RU484+RU242
  974. * @IEEE80211_EHT_RU_996_484: RU996+RU484
  975. * @IEEE80211_EHT_RU_996_484_242: RU996+RU484+RU242
  976. * @IEEE80211_EHT_RU_996x2_484: RU996x2 + RU484
  977. * @IEEE80211_EHT_RU_996x3: RU996x3
  978. * @IEEE80211_EHT_RU_996x3_484: RU996x3 + RU484
  979. * @IEEE80211_EHT_RU_INVALID: Invalid/Max RU
  980. */
  981. enum ieee80211_eht_ru_size {
  982. IEEE80211_EHT_RU_26,
  983. IEEE80211_EHT_RU_52,
  984. IEEE80211_EHT_RU_106,
  985. IEEE80211_EHT_RU_242,
  986. IEEE80211_EHT_RU_484,
  987. IEEE80211_EHT_RU_996,
  988. IEEE80211_EHT_RU_996x2,
  989. IEEE80211_EHT_RU_996x4,
  990. IEEE80211_EHT_RU_52_26,
  991. IEEE80211_EHT_RU_106_26,
  992. IEEE80211_EHT_RU_484_242,
  993. IEEE80211_EHT_RU_996_484,
  994. IEEE80211_EHT_RU_996_484_242,
  995. IEEE80211_EHT_RU_996x2_484,
  996. IEEE80211_EHT_RU_996x3,
  997. IEEE80211_EHT_RU_996x3_484,
  998. IEEE80211_EHT_RU_INVALID,
  999. };
  1000. #define NUM_RU_BITS_PER80 16
  1001. #define NUM_RU_BITS_PER20 4
  1002. /* Different per_80Mhz band in 320Mhz bandwidth */
  1003. #define HAL_80_0 0
  1004. #define HAL_80_1 1
  1005. #define HAL_80_2 2
  1006. #define HAL_80_3 3
  1007. #define HAL_RU_SHIFT(num_80mhz_band, ru_index_per_80) \
  1008. ((NUM_RU_BITS_PER80 * (num_80mhz_band)) + \
  1009. (NUM_RU_BITS_PER20 * (ru_index_per_80)))
  1010. /* MRU-996+484 */
  1011. #define HAL_EHT_RU_996_484_0 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 1)) | \
  1012. (HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_1, 0)))
  1013. #define HAL_EHT_RU_996_484_1 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1014. (HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_1, 0)))
  1015. #define HAL_EHT_RU_996_484_2 ((HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1016. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 1)))
  1017. #define HAL_EHT_RU_996_484_3 ((HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1018. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 0)))
  1019. #define HAL_EHT_RU_996_484_4 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 1)) | \
  1020. (HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1021. #define HAL_EHT_RU_996_484_5 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1022. (HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1023. #define HAL_EHT_RU_996_484_6 ((HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1024. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 1)))
  1025. #define HAL_EHT_RU_996_484_7 ((HAL_EHT_RU_996 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1026. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1027. /* MRU-996x2+484 */
  1028. #define HAL_EHT_RU_996x2_484_0 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 1)) | \
  1029. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1030. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)))
  1031. #define HAL_EHT_RU_996x2_484_1 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1032. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1033. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)))
  1034. #define HAL_EHT_RU_996x2_484_2 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1035. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 1)) | \
  1036. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)))
  1037. #define HAL_EHT_RU_996x2_484_3 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1038. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1039. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)))
  1040. #define HAL_EHT_RU_996x2_484_4 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1041. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1042. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 1)))
  1043. #define HAL_EHT_RU_996x2_484_5 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1044. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1045. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 0)))
  1046. #define HAL_EHT_RU_996x2_484_6 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 1)) | \
  1047. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1048. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1049. #define HAL_EHT_RU_996x2_484_7 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1050. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1051. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1052. #define HAL_EHT_RU_996x2_484_8 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1053. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 1)) | \
  1054. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1055. #define HAL_EHT_RU_996x2_484_9 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1056. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1057. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1058. #define HAL_EHT_RU_996x2_484_10 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1059. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1060. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 1)))
  1061. #define HAL_EHT_RU_996x2_484_11 ((HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1062. (HAL_EHT_RU_996x2 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1063. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1064. /* MRU-996x3+484 */
  1065. #define HAL_EHT_RU_996x3_484_0 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 1)) | \
  1066. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1067. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1068. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1069. #define HAL_EHT_RU_996x3_484_1 ((HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1070. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1071. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1072. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1073. #define HAL_EHT_RU_996x3_484_2 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1074. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 1)) | \
  1075. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1076. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1077. #define HAL_EHT_RU_996x3_484_3 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1078. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1079. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1080. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1081. #define HAL_EHT_RU_996x3_484_4 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1082. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1083. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 1)) | \
  1084. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1085. #define HAL_EHT_RU_996x3_484_5 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1086. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1087. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1088. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1089. #define HAL_EHT_RU_996x3_484_6 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1090. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1091. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1092. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 1)))
  1093. #define HAL_EHT_RU_996x3_484_7 ((HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_0, 0)) | \
  1094. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_1, 0)) | \
  1095. (HAL_EHT_RU_996x3 << HAL_RU_SHIFT(HAL_80_2, 0)) | \
  1096. (HAL_EHT_RU_484 << HAL_RU_SHIFT(HAL_80_3, 0)))
  1097. #define HAL_RX_MON_MAX_AGGR_SIZE 128
  1098. /**
  1099. * struct hal_rx_tlv_aggr_info - Data structure to hold
  1100. * metadata for aggregatng repeated TLVs
  1101. * @in_progress: Flag to indicate if TLV aggregation is in progress
  1102. * @cur_len: Total length of currently aggregated TLV
  1103. * @tlv_tag: TLV tag which is currently being aggregated
  1104. * @buf: Buffer containing aggregated TLV data
  1105. */
  1106. struct hal_rx_tlv_aggr_info {
  1107. uint8_t in_progress;
  1108. uint16_t cur_len;
  1109. uint32_t tlv_tag;
  1110. uint8_t buf[HAL_RX_MON_MAX_AGGR_SIZE];
  1111. };
  1112. /**
  1113. * struct hal_rx_u_sig_info - Certain fields from U-SIG header which are used
  1114. * for other header field parsing.
  1115. * @ul_dl: UL or DL
  1116. * @bw: EHT BW
  1117. * @ppdu_type_comp_mode: PPDU TYPE
  1118. * @eht_sig_mcs: EHT SIG MCS
  1119. * @num_eht_sig_sym: Number of EHT SIG symbols
  1120. */
  1121. struct hal_rx_u_sig_info {
  1122. uint32_t ul_dl : 1,
  1123. bw : 3,
  1124. ppdu_type_comp_mode : 2,
  1125. eht_sig_mcs : 2,
  1126. num_eht_sig_sym : 5;
  1127. };
  1128. #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS
  1129. struct hal_rx_user_ctrl_frm_info {
  1130. uint8_t bar : 1,
  1131. ndpa : 1;
  1132. };
  1133. #else
  1134. struct hal_rx_user_ctrl_frm_info {};
  1135. #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */
  1136. #ifdef MONITOR_TLV_RECORDING_ENABLE
  1137. /**
  1138. * struct hal_rx_tlv_info - TLV info to pass to dp layer
  1139. * @tlv_tag: Tag of the TLV
  1140. * @tlv_category: Category of TLV
  1141. *
  1142. */
  1143. struct hal_rx_tlv_info {
  1144. uint32_t tlv_tag;
  1145. uint8_t tlv_category;
  1146. };
  1147. #endif
  1148. struct hal_rx_ppdu_info {
  1149. struct hal_rx_ppdu_common_info com_info;
  1150. struct hal_rx_u_sig_info u_sig_info;
  1151. struct mon_rx_status rx_status;
  1152. struct mon_rx_user_status rx_user_status[HAL_MAX_UL_MU_USERS];
  1153. struct mon_rx_info rx_info;
  1154. struct mon_rx_user_info rx_user_info[HAL_MAX_UL_MU_USERS];
  1155. struct hal_rx_msdu_payload_info msdu_info;
  1156. struct hal_rx_msdu_payload_info fcs_ok_msdu_info;
  1157. struct hal_rx_nac_info nac_info;
  1158. /* status ring PPDU start and end state */
  1159. uint8_t rx_state;
  1160. /* MU user id for status ring TLV */
  1161. uint8_t user_id;
  1162. /* MPDU/MSDU truncated to 128 bytes header start addr in status skb */
  1163. unsigned char *data;
  1164. /* MPDU/MSDU truncated to 128 bytes header real length */
  1165. uint32_t hdr_len;
  1166. /* MPDU FCS error */
  1167. bool fcs_err;
  1168. /* Id to indicate how to process mpdu */
  1169. uint8_t sw_frame_group_id;
  1170. struct hal_rx_ppdu_msdu_info rx_msdu_info[HAL_MAX_UL_MU_USERS];
  1171. /* fcs passed mpdu count in rx monitor status buffer */
  1172. uint8_t fcs_ok_cnt;
  1173. /* fcs error mpdu count in rx monitor status buffer */
  1174. uint8_t fcs_err_cnt;
  1175. /* MPDU FCS passed */
  1176. bool is_fcs_passed;
  1177. /* first msdu payload for all mpdus in rx monitor status buffer */
  1178. struct hal_rx_msdu_payload_info ppdu_msdu_info[HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER];
  1179. /* evm info */
  1180. struct hal_rx_su_evm_info evm_info;
  1181. /**
  1182. * Will be used to store ppdu info extracted from HW TLVs,
  1183. * and for CFR correlation as well
  1184. */
  1185. struct hal_rx_ppdu_cfr_info cfr_info;
  1186. /* per frame type counts */
  1187. struct hal_rx_frm_type_info frm_type_info;
  1188. /* TLV aggregation metadata context */
  1189. struct hal_rx_tlv_aggr_info tlv_aggr;
  1190. /* EHT SIG user info */
  1191. uint32_t eht_sig_user_info;
  1192. /*per user mpdu count */
  1193. uint8_t mpdu_count[HAL_MAX_UL_MU_USERS];
  1194. /*per user msdu count */
  1195. uint8_t msdu_count[HAL_MAX_UL_MU_USERS];
  1196. /* Placeholder to update per user last processed msdu’s info */
  1197. struct hal_rx_mon_msdu_info msdu[HAL_MAX_UL_MU_USERS];
  1198. /* Placeholder to update per user last processed mpdu’s info */
  1199. struct hal_rx_mon_mpdu_info mpdu_info[HAL_MAX_UL_MU_USERS];
  1200. /* placeholder to hold packet buffer info */
  1201. struct hal_mon_packet_info packet_info;
  1202. #ifdef WLAN_PKT_CAPTURE_RX_2_0
  1203. /* per user per MPDU queue */
  1204. qdf_nbuf_queue_t mpdu_q[HAL_MAX_UL_MU_USERS];
  1205. #endif
  1206. /* ppdu info list element */
  1207. TAILQ_ENTRY(hal_rx_ppdu_info) ppdu_list_elem;
  1208. /* ppdu info free list element */
  1209. TAILQ_ENTRY(hal_rx_ppdu_info) ppdu_free_list_elem;
  1210. /* placeholder to track if RX_HDR is received */
  1211. uint8_t rx_hdr_rcvd[HAL_MAX_UL_MU_USERS];
  1212. /* Per user BAR and NDPA bit flag */
  1213. struct hal_rx_user_ctrl_frm_info ctrl_frm_info[HAL_MAX_UL_MU_USERS];
  1214. /* PPDU end user stats count */
  1215. uint8_t end_user_stats_cnt;
  1216. /* PPDU start user info count */
  1217. uint8_t start_user_info_cnt;
  1218. /* PPDU drop cnt */
  1219. struct hal_rx_ppdu_drop_cnt drop_cnt;
  1220. #ifdef MONITOR_TLV_RECORDING_ENABLE
  1221. /*TLV Recording*/
  1222. struct hal_rx_tlv_info rx_tlv_info;
  1223. #endif
  1224. };
  1225. static inline uint32_t
  1226. hal_get_rx_status_buf_size(void) {
  1227. /* RX status buffer size is hard coded for now */
  1228. return 2048;
  1229. }
  1230. static inline uint8_t*
  1231. hal_rx_status_get_next_tlv(uint8_t *rx_tlv, bool is_tlv_hdr_64_bit) {
  1232. uint32_t tlv_len, tlv_tag, tlv_hdr_size;
  1233. if (is_tlv_hdr_64_bit) {
  1234. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv);
  1235. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
  1236. tlv_hdr_size = HAL_RX_TLV64_HDR_SIZE;
  1237. } else {
  1238. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv);
  1239. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
  1240. tlv_hdr_size = HAL_RX_TLV32_HDR_SIZE;
  1241. }
  1242. /* The actual length of PPDU_END is the combined length of many PHY
  1243. * TLVs that follow. Skip the TLV header and
  1244. * rx_rxpcu_classification_overview that follows the header to get to
  1245. * next TLV.
  1246. */
  1247. if (tlv_tag == WIFIRX_PPDU_END_E)
  1248. tlv_len = sizeof(struct rx_rxpcu_classification_overview);
  1249. return (uint8_t *)(uintptr_t)qdf_align((uint64_t)((uintptr_t)rx_tlv +
  1250. tlv_len +
  1251. tlv_hdr_size),
  1252. tlv_hdr_size);
  1253. }
  1254. /**
  1255. * hal_rx_proc_phyrx_other_receive_info_tlv()
  1256. * - process other receive info TLV
  1257. * @hal_soc: HAL soc object
  1258. * @rx_tlv_hdr: pointer to TLV header
  1259. * @ppdu_info: pointer to ppdu_info
  1260. *
  1261. * Return: None
  1262. */
  1263. static inline void
  1264. hal_rx_proc_phyrx_other_receive_info_tlv(struct hal_soc *hal_soc,
  1265. void *rx_tlv_hdr,
  1266. struct hal_rx_ppdu_info
  1267. *ppdu_info)
  1268. {
  1269. hal_soc->ops->hal_rx_proc_phyrx_other_receive_info_tlv(rx_tlv_hdr,
  1270. (void *)ppdu_info);
  1271. }
  1272. /**
  1273. * hal_rx_status_get_tlv_info() - process receive info TLV
  1274. * @rx_tlv_hdr: pointer to TLV header
  1275. * @ppdu_info: pointer to ppdu_info
  1276. * @hal_soc_hdl: HAL soc handle
  1277. * @nbuf: PPDU status network buffer
  1278. *
  1279. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE or HAL_TLV_STATUS_PPDU_DONE from tlv
  1280. */
  1281. static inline uint32_t
  1282. hal_rx_status_get_tlv_info(void *rx_tlv_hdr, void *ppdu_info,
  1283. hal_soc_handle_t hal_soc_hdl,
  1284. qdf_nbuf_t nbuf)
  1285. {
  1286. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1287. return hal_soc->ops->hal_rx_status_get_tlv_info(
  1288. rx_tlv_hdr,
  1289. ppdu_info,
  1290. hal_soc_hdl,
  1291. nbuf);
  1292. }
  1293. static inline
  1294. uint32_t hal_get_rx_status_done_tlv_size(hal_soc_handle_t hal_soc_hdl)
  1295. {
  1296. return HAL_RX_TLV32_HDR_SIZE;
  1297. }
  1298. static inline QDF_STATUS
  1299. hal_get_rx_status_done(uint8_t *rx_tlv)
  1300. {
  1301. uint32_t tlv_tag;
  1302. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
  1303. if (tlv_tag == WIFIRX_STATUS_BUFFER_DONE_E)
  1304. return QDF_STATUS_SUCCESS;
  1305. else
  1306. return QDF_STATUS_E_EMPTY;
  1307. }
  1308. static inline QDF_STATUS
  1309. hal_clear_rx_status_done(uint8_t *rx_tlv)
  1310. {
  1311. *(uint32_t *)rx_tlv = 0;
  1312. return QDF_STATUS_SUCCESS;
  1313. }
  1314. #ifdef WLAN_PKT_CAPTURE_TX_2_0
  1315. /**
  1316. * struct hal_txmon_word_mask_config - hal tx monitor word mask filter setting
  1317. * @pcu_ppdu_setup_init: PCU_PPDU_SETUP TLV word mask
  1318. * @tx_peer_entry: TX_PEER_ENTRY TLV word mask
  1319. * @tx_queue_ext: TX_QUEUE_EXTENSION TLV word mask
  1320. * @tx_fes_status_end: TX_FES_STATUS_END TLV word mask
  1321. * @response_end_status: RESPONSE_END_STATUS TLV word mask
  1322. * @tx_fes_status_prot: TX_FES_STATUS_PROT TLV word mask
  1323. * @tx_fes_setup: TX_FES_SETUP TLV word mask
  1324. * @tx_msdu_start: TX_MSDU_START TLV word mask
  1325. * @tx_mpdu_start: TX_MPDU_START TLV word mask
  1326. * @rxpcu_user_setup: RXPCU_USER_SETUP TLV word mask
  1327. * @compaction_enable: flag to enable word mask compaction
  1328. */
  1329. struct hal_txmon_word_mask_config {
  1330. uint32_t pcu_ppdu_setup_init;
  1331. uint16_t tx_peer_entry;
  1332. uint16_t tx_queue_ext;
  1333. uint16_t tx_fes_status_end;
  1334. uint16_t response_end_status;
  1335. uint16_t tx_fes_status_prot;
  1336. uint8_t tx_fes_setup;
  1337. uint8_t tx_msdu_start;
  1338. uint8_t tx_mpdu_start;
  1339. uint8_t rxpcu_user_setup;
  1340. uint8_t compaction_enable;
  1341. };
  1342. /*
  1343. * typedef hal_txmon_word_mask_config_t - handle for tx monitor word mask
  1344. */
  1345. typedef struct hal_txmon_word_mask_config hal_txmon_word_mask_config_t;
  1346. #endif /* WLAN_PKT_CAPTURE_TX_2_0 */
  1347. #endif