hal_api_mon.h 41 KB

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