hal_api_mon.h 43 KB

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