hal_generic_api.h 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945
  1. /*
  2. * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _HAL_GENERIC_API_H_
  19. #define _HAL_GENERIC_API_H_
  20. #define HAL_RX_MSDU_DESC_INFO_GET(msdu_details_ptr) \
  21. ((struct rx_msdu_desc_info *) \
  22. _OFFSET_TO_BYTE_PTR(msdu_details_ptr, \
  23. UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
  24. /**
  25. * hal_rx_msdu_desc_info_get_ptr_generic() - Get msdu desc info ptr
  26. * @msdu_details_ptr - Pointer to msdu_details_ptr
  27. * Return - Pointer to rx_msdu_desc_info structure.
  28. *
  29. */
  30. static void *hal_rx_msdu_desc_info_get_ptr_generic(void *msdu_details_ptr)
  31. {
  32. return HAL_RX_MSDU_DESC_INFO_GET(msdu_details_ptr);
  33. }
  34. #define HAL_RX_LINK_DESC_MSDU0_PTR(link_desc) \
  35. ((struct rx_msdu_details *) \
  36. _OFFSET_TO_BYTE_PTR((link_desc),\
  37. UNIFIED_RX_MSDU_LINK_8_RX_MSDU_DETAILS_MSDU_0_OFFSET))
  38. /**
  39. * hal_rx_link_desc_msdu0_ptr_generic - Get pointer to rx_msdu details
  40. * @link_desc - Pointer to link desc
  41. * Return - Pointer to rx_msdu_details structure
  42. *
  43. */
  44. static void *hal_rx_link_desc_msdu0_ptr_generic(void *link_desc)
  45. {
  46. return HAL_RX_LINK_DESC_MSDU0_PTR(link_desc);
  47. }
  48. /**
  49. * hal_tx_comp_get_status() - TQM Release reason
  50. * @hal_desc: completion ring Tx status
  51. *
  52. * This function will parse the WBM completion descriptor and populate in
  53. * HAL structure
  54. *
  55. * Return: none
  56. */
  57. #if defined(WCSS_VERSION) && \
  58. ((defined(CONFIG_WIN) && (WCSS_VERSION > 81)) || \
  59. (defined(CONFIG_MCL) && (WCSS_VERSION >= 72)))
  60. static inline void hal_tx_comp_get_status_generic(void *desc,
  61. void *ts1, void *hal)
  62. {
  63. uint8_t rate_stats_valid = 0;
  64. uint32_t rate_stats = 0;
  65. struct hal_tx_completion_status *ts =
  66. (struct hal_tx_completion_status *)ts1;
  67. ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_3,
  68. TQM_STATUS_NUMBER);
  69. ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4,
  70. ACK_FRAME_RSSI);
  71. ts->first_msdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4, FIRST_MSDU);
  72. ts->last_msdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4, LAST_MSDU);
  73. ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4,
  74. MSDU_PART_OF_AMSDU);
  75. ts->peer_id = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_7, SW_PEER_ID);
  76. ts->tid = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_7, TID);
  77. ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_3,
  78. TRANSMIT_COUNT);
  79. rate_stats = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_5,
  80. TX_RATE_STATS);
  81. rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO_0,
  82. TX_RATE_STATS_INFO_VALID, rate_stats);
  83. ts->valid = rate_stats_valid;
  84. if (rate_stats_valid) {
  85. ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO_0, TRANSMIT_BW,
  86. rate_stats);
  87. ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO_0,
  88. TRANSMIT_PKT_TYPE, rate_stats);
  89. ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO_0,
  90. TRANSMIT_STBC, rate_stats);
  91. ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO_0, TRANSMIT_LDPC,
  92. rate_stats);
  93. ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO_0, TRANSMIT_SGI,
  94. rate_stats);
  95. ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO_0, TRANSMIT_MCS,
  96. rate_stats);
  97. ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO_0, OFDMA_TRANSMISSION,
  98. rate_stats);
  99. ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO_0, TONES_IN_RU,
  100. rate_stats);
  101. }
  102. ts->release_src = hal_tx_comp_get_buffer_source(desc);
  103. ts->status = hal_tx_comp_get_release_reason(desc, hal);
  104. ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
  105. TX_RATE_STATS_INFO_TX_RATE_STATS);
  106. }
  107. #else
  108. static inline void hal_tx_comp_get_status_generic(void *desc,
  109. struct hal_tx_completion_status *ts, void *hal)
  110. {
  111. ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_3,
  112. TQM_STATUS_NUMBER);
  113. ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4,
  114. ACK_FRAME_RSSI);
  115. ts->first_msdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4, FIRST_MSDU);
  116. ts->last_msdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4, LAST_MSDU);
  117. ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc, WBM_RELEASE_RING_4,
  118. MSDU_PART_OF_AMSDU);
  119. ts->release_src = hal_tx_comp_get_buffer_source(desc);
  120. ts->status = hal_tx_comp_get_release_reason(desc, hal);
  121. }
  122. #endif
  123. /**
  124. * hal_tx_desc_set_buf_addr - Fill Buffer Address information in Tx Descriptor
  125. * @desc: Handle to Tx Descriptor
  126. * @paddr: Physical Address
  127. * @pool_id: Return Buffer Manager ID
  128. * @desc_id: Descriptor ID
  129. * @type: 0 - Address points to a MSDU buffer
  130. * 1 - Address points to MSDU extension descriptor
  131. *
  132. * Return: void
  133. */
  134. static inline void hal_tx_desc_set_buf_addr_generic(void *desc,
  135. dma_addr_t paddr, uint8_t pool_id,
  136. uint32_t desc_id, uint8_t type)
  137. {
  138. /* Set buffer_addr_info.buffer_addr_31_0 */
  139. HAL_SET_FLD(desc, UNIFIED_TCL_DATA_CMD_0, BUFFER_ADDR_INFO_BUF_ADDR_INFO) =
  140. HAL_TX_SM(UNIFIED_BUFFER_ADDR_INFO_0, BUFFER_ADDR_31_0, paddr);
  141. /* Set buffer_addr_info.buffer_addr_39_32 */
  142. HAL_SET_FLD(desc, UNIFIED_TCL_DATA_CMD_1,
  143. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  144. HAL_TX_SM(UNIFIED_BUFFER_ADDR_INFO_1, BUFFER_ADDR_39_32,
  145. (((uint64_t) paddr) >> 32));
  146. /* Set buffer_addr_info.return_buffer_manager = pool id */
  147. HAL_SET_FLD(desc, UNIFIED_TCL_DATA_CMD_1,
  148. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  149. HAL_TX_SM(UNIFIED_BUFFER_ADDR_INFO_1,
  150. RETURN_BUFFER_MANAGER, (pool_id + HAL_WBM_SW0_BM_ID));
  151. /* Set buffer_addr_info.sw_buffer_cookie = desc_id */
  152. HAL_SET_FLD(desc, UNIFIED_TCL_DATA_CMD_1,
  153. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  154. HAL_TX_SM(UNIFIED_BUFFER_ADDR_INFO_1, SW_BUFFER_COOKIE, desc_id);
  155. /* Set Buffer or Ext Descriptor Type */
  156. HAL_SET_FLD(desc, UNIFIED_TCL_DATA_CMD_2,
  157. BUF_OR_EXT_DESC_TYPE) |=
  158. HAL_TX_SM(UNIFIED_TCL_DATA_CMD_2, BUF_OR_EXT_DESC_TYPE, type);
  159. }
  160. #if defined(CONFIG_MCL) && defined(QCA_WIFI_QCA6290_11AX)
  161. /**
  162. * hal_rx_handle_other_tlvs() - handle special TLVs like MU_UL
  163. * tlv_tag: Taf of the TLVs
  164. * rx_tlv: the pointer to the TLVs
  165. * @ppdu_info: pointer to ppdu_info
  166. *
  167. * Return: true if the tlv is handled, false if not
  168. */
  169. static inline bool
  170. hal_rx_handle_other_tlvs(uint32_t tlv_tag, void *rx_tlv,
  171. struct hal_rx_ppdu_info *ppdu_info)
  172. {
  173. uint32_t value;
  174. switch (tlv_tag) {
  175. case WIFIPHYRX_HE_SIG_A_MU_UL_E:
  176. {
  177. uint8_t *he_sig_a_mu_ul_info =
  178. (uint8_t *)rx_tlv +
  179. HAL_RX_OFFSET(PHYRX_HE_SIG_A_MU_UL_0,
  180. HE_SIG_A_MU_UL_INFO_PHYRX_HE_SIG_A_MU_UL_INFO_DETAILS);
  181. ppdu_info->rx_status.he_flags = 1;
  182. value = HAL_RX_GET(he_sig_a_mu_ul_info, HE_SIG_A_MU_UL_INFO_0,
  183. FORMAT_INDICATION);
  184. if (value == 0) {
  185. ppdu_info->rx_status.he_data1 =
  186. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  187. } else {
  188. ppdu_info->rx_status.he_data1 =
  189. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  190. }
  191. /* data1 */
  192. ppdu_info->rx_status.he_data1 |=
  193. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  194. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  195. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  196. /* data2 */
  197. ppdu_info->rx_status.he_data2 |=
  198. QDF_MON_STATUS_TXOP_KNOWN;
  199. /*data3*/
  200. value = HAL_RX_GET(he_sig_a_mu_ul_info,
  201. HE_SIG_A_MU_UL_INFO_0, BSS_COLOR_ID);
  202. ppdu_info->rx_status.he_data3 = value;
  203. /* 1 for UL and 0 for DL */
  204. value = 1;
  205. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  206. ppdu_info->rx_status.he_data3 |= value;
  207. /*data4*/
  208. value = HAL_RX_GET(he_sig_a_mu_ul_info, HE_SIG_A_MU_UL_INFO_0,
  209. SPATIAL_REUSE);
  210. ppdu_info->rx_status.he_data4 = value;
  211. /*data5*/
  212. value = HAL_RX_GET(he_sig_a_mu_ul_info,
  213. HE_SIG_A_MU_UL_INFO_0, TRANSMIT_BW);
  214. ppdu_info->rx_status.he_data5 = value;
  215. ppdu_info->rx_status.bw = value;
  216. /*data6*/
  217. value = HAL_RX_GET(he_sig_a_mu_ul_info, HE_SIG_A_MU_UL_INFO_1,
  218. TXOP_DURATION);
  219. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  220. ppdu_info->rx_status.he_data6 |= value;
  221. return true;
  222. }
  223. default:
  224. return false;
  225. }
  226. }
  227. #else
  228. static inline bool
  229. hal_rx_handle_other_tlvs(uint32_t tlv_tag, void *rx_tlv,
  230. struct hal_rx_ppdu_info *ppdu_info)
  231. {
  232. return false;
  233. }
  234. #endif /* CONFIG_MCL && QCA_WIFI_QCA6290_11AX */
  235. /**
  236. * hal_rx_status_get_tlv_info() - process receive info TLV
  237. * @rx_tlv_hdr: pointer to TLV header
  238. * @ppdu_info: pointer to ppdu_info
  239. *
  240. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE or HAL_TLV_STATUS_PPDU_DONE from tlv
  241. */
  242. static inline uint32_t
  243. hal_rx_status_get_tlv_info_generic(void *rx_tlv_hdr, void *ppduinfo,
  244. void *halsoc)
  245. {
  246. struct hal_soc *hal = (struct hal_soc *)halsoc;
  247. uint32_t tlv_tag, user_id, tlv_len, value;
  248. uint8_t group_id = 0;
  249. uint8_t he_dcm = 0;
  250. uint8_t he_stbc = 0;
  251. uint16_t he_gi = 0;
  252. uint16_t he_ltf = 0;
  253. void *rx_tlv;
  254. bool unhandled = false;
  255. struct hal_rx_ppdu_info *ppdu_info =
  256. (struct hal_rx_ppdu_info *)ppduinfo;
  257. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  258. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  259. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  260. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV32_HDR_SIZE;
  261. switch (tlv_tag) {
  262. case WIFIRX_PPDU_START_E:
  263. ppdu_info->com_info.ppdu_id =
  264. HAL_RX_GET(rx_tlv, RX_PPDU_START_0,
  265. PHY_PPDU_ID);
  266. /* channel number is set in PHY meta data */
  267. ppdu_info->rx_status.chan_num =
  268. HAL_RX_GET(rx_tlv, RX_PPDU_START_1,
  269. SW_PHY_META_DATA);
  270. ppdu_info->com_info.ppdu_timestamp =
  271. HAL_RX_GET(rx_tlv, RX_PPDU_START_2,
  272. PPDU_START_TIMESTAMP);
  273. ppdu_info->rx_status.ppdu_timestamp =
  274. ppdu_info->com_info.ppdu_timestamp;
  275. ppdu_info->rx_state = HAL_RX_MON_PPDU_START;
  276. break;
  277. case WIFIRX_PPDU_START_USER_INFO_E:
  278. break;
  279. case WIFIRX_PPDU_END_E:
  280. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  281. "[%s][%d] ppdu_end_e len=%d",
  282. __func__, __LINE__, tlv_len);
  283. /* This is followed by sub-TLVs of PPDU_END */
  284. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  285. break;
  286. case WIFIRXPCU_PPDU_END_INFO_E:
  287. ppdu_info->rx_status.tsft =
  288. HAL_RX_GET(rx_tlv, RXPCU_PPDU_END_INFO_1,
  289. WB_TIMESTAMP_UPPER_32);
  290. ppdu_info->rx_status.tsft = (ppdu_info->rx_status.tsft << 32) |
  291. HAL_RX_GET(rx_tlv, RXPCU_PPDU_END_INFO_0,
  292. WB_TIMESTAMP_LOWER_32);
  293. ppdu_info->rx_status.duration =
  294. HAL_RX_GET(rx_tlv, UNIFIED_RXPCU_PPDU_END_INFO_8,
  295. RX_PPDU_DURATION);
  296. break;
  297. case WIFIRX_PPDU_END_USER_STATS_E:
  298. {
  299. unsigned long tid = 0;
  300. uint16_t seq = 0;
  301. ppdu_info->rx_status.ast_index =
  302. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_4,
  303. AST_INDEX);
  304. tid = HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_12,
  305. RECEIVED_QOS_DATA_TID_BITMAP);
  306. ppdu_info->rx_status.tid = qdf_find_first_bit(&tid, sizeof(tid)*8);
  307. if (ppdu_info->rx_status.tid == (sizeof(tid) * 8))
  308. ppdu_info->rx_status.tid = HAL_TID_INVALID;
  309. ppdu_info->rx_status.tcp_msdu_count =
  310. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_9,
  311. TCP_MSDU_COUNT) +
  312. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_10,
  313. TCP_ACK_MSDU_COUNT);
  314. ppdu_info->rx_status.udp_msdu_count =
  315. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_9,
  316. UDP_MSDU_COUNT);
  317. ppdu_info->rx_status.other_msdu_count =
  318. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_10,
  319. OTHER_MSDU_COUNT);
  320. ppdu_info->rx_status.frame_control_info_valid =
  321. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
  322. FRAME_CONTROL_INFO_VALID);
  323. if (ppdu_info->rx_status.frame_control_info_valid)
  324. ppdu_info->rx_status.frame_control =
  325. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_4,
  326. FRAME_CONTROL_FIELD);
  327. ppdu_info->rx_status.data_sequence_control_info_valid =
  328. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
  329. DATA_SEQUENCE_CONTROL_INFO_VALID);
  330. seq = HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_5,
  331. FIRST_DATA_SEQ_CTRL);
  332. if (ppdu_info->rx_status.data_sequence_control_info_valid)
  333. ppdu_info->rx_status.first_data_seq_ctrl = seq;
  334. ppdu_info->rx_status.preamble_type =
  335. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
  336. HT_CONTROL_FIELD_PKT_TYPE);
  337. switch (ppdu_info->rx_status.preamble_type) {
  338. case HAL_RX_PKT_TYPE_11N:
  339. ppdu_info->rx_status.ht_flags = 1;
  340. ppdu_info->rx_status.rtap_flags |= HT_SGI_PRESENT;
  341. break;
  342. case HAL_RX_PKT_TYPE_11AC:
  343. ppdu_info->rx_status.vht_flags = 1;
  344. break;
  345. case HAL_RX_PKT_TYPE_11AX:
  346. ppdu_info->rx_status.he_flags = 1;
  347. break;
  348. default:
  349. break;
  350. }
  351. ppdu_info->com_info.mpdu_cnt_fcs_ok =
  352. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
  353. MPDU_CNT_FCS_OK);
  354. ppdu_info->com_info.mpdu_cnt_fcs_err =
  355. HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_2,
  356. MPDU_CNT_FCS_ERR);
  357. if ((ppdu_info->com_info.mpdu_cnt_fcs_ok |
  358. ppdu_info->com_info.mpdu_cnt_fcs_err) > 1)
  359. ppdu_info->rx_status.rs_flags |= IEEE80211_AMPDU_FLAG;
  360. else
  361. ppdu_info->rx_status.rs_flags &=
  362. (~IEEE80211_AMPDU_FLAG);
  363. break;
  364. }
  365. case WIFIRX_PPDU_END_USER_STATS_EXT_E:
  366. break;
  367. case WIFIRX_PPDU_END_STATUS_DONE_E:
  368. return HAL_TLV_STATUS_PPDU_DONE;
  369. case WIFIDUMMY_E:
  370. return HAL_TLV_STATUS_BUF_DONE;
  371. case WIFIPHYRX_HT_SIG_E:
  372. {
  373. uint8_t *ht_sig_info = (uint8_t *)rx_tlv +
  374. HAL_RX_OFFSET(UNIFIED_PHYRX_HT_SIG_0,
  375. HT_SIG_INFO_PHYRX_HT_SIG_INFO_DETAILS);
  376. value = HAL_RX_GET(ht_sig_info, HT_SIG_INFO_1,
  377. FEC_CODING);
  378. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  379. 1 : 0;
  380. ppdu_info->rx_status.mcs = HAL_RX_GET(ht_sig_info,
  381. HT_SIG_INFO_0, MCS);
  382. ppdu_info->rx_status.bw = HAL_RX_GET(ht_sig_info,
  383. HT_SIG_INFO_0, CBW);
  384. ppdu_info->rx_status.sgi = HAL_RX_GET(ht_sig_info,
  385. HT_SIG_INFO_1, SHORT_GI);
  386. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  387. break;
  388. }
  389. case WIFIPHYRX_L_SIG_B_E:
  390. {
  391. uint8_t *l_sig_b_info = (uint8_t *)rx_tlv +
  392. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_B_0,
  393. L_SIG_B_INFO_PHYRX_L_SIG_B_INFO_DETAILS);
  394. value = HAL_RX_GET(l_sig_b_info, L_SIG_B_INFO_0, RATE);
  395. ppdu_info->rx_status.l_sig_b_info = *((uint32_t *)l_sig_b_info);
  396. switch (value) {
  397. case 1:
  398. ppdu_info->rx_status.rate = HAL_11B_RATE_3MCS;
  399. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  400. break;
  401. case 2:
  402. ppdu_info->rx_status.rate = HAL_11B_RATE_2MCS;
  403. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  404. break;
  405. case 3:
  406. ppdu_info->rx_status.rate = HAL_11B_RATE_1MCS;
  407. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  408. break;
  409. case 4:
  410. ppdu_info->rx_status.rate = HAL_11B_RATE_0MCS;
  411. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  412. break;
  413. case 5:
  414. ppdu_info->rx_status.rate = HAL_11B_RATE_6MCS;
  415. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  416. break;
  417. case 6:
  418. ppdu_info->rx_status.rate = HAL_11B_RATE_5MCS;
  419. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  420. break;
  421. case 7:
  422. ppdu_info->rx_status.rate = HAL_11B_RATE_4MCS;
  423. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  424. break;
  425. default:
  426. break;
  427. }
  428. ppdu_info->rx_status.cck_flag = 1;
  429. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  430. break;
  431. }
  432. case WIFIPHYRX_L_SIG_A_E:
  433. {
  434. uint8_t *l_sig_a_info = (uint8_t *)rx_tlv +
  435. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_A_0,
  436. L_SIG_A_INFO_PHYRX_L_SIG_A_INFO_DETAILS);
  437. value = HAL_RX_GET(l_sig_a_info, L_SIG_A_INFO_0, RATE);
  438. ppdu_info->rx_status.l_sig_a_info = *((uint32_t *)l_sig_a_info);
  439. switch (value) {
  440. case 8:
  441. ppdu_info->rx_status.rate = HAL_11A_RATE_0MCS;
  442. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  443. break;
  444. case 9:
  445. ppdu_info->rx_status.rate = HAL_11A_RATE_1MCS;
  446. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  447. break;
  448. case 10:
  449. ppdu_info->rx_status.rate = HAL_11A_RATE_2MCS;
  450. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  451. break;
  452. case 11:
  453. ppdu_info->rx_status.rate = HAL_11A_RATE_3MCS;
  454. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  455. break;
  456. case 12:
  457. ppdu_info->rx_status.rate = HAL_11A_RATE_4MCS;
  458. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  459. break;
  460. case 13:
  461. ppdu_info->rx_status.rate = HAL_11A_RATE_5MCS;
  462. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  463. break;
  464. case 14:
  465. ppdu_info->rx_status.rate = HAL_11A_RATE_6MCS;
  466. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  467. break;
  468. case 15:
  469. ppdu_info->rx_status.rate = HAL_11A_RATE_7MCS;
  470. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS7;
  471. break;
  472. default:
  473. break;
  474. }
  475. ppdu_info->rx_status.ofdm_flag = 1;
  476. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  477. break;
  478. }
  479. case WIFIPHYRX_VHT_SIG_A_E:
  480. {
  481. uint8_t *vht_sig_a_info = (uint8_t *)rx_tlv +
  482. HAL_RX_OFFSET(UNIFIED_PHYRX_VHT_SIG_A_0,
  483. VHT_SIG_A_INFO_PHYRX_VHT_SIG_A_INFO_DETAILS);
  484. value = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO_1,
  485. SU_MU_CODING);
  486. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  487. 1 : 0;
  488. group_id = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO_0, GROUP_ID);
  489. ppdu_info->rx_status.vht_flag_values5 = group_id;
  490. ppdu_info->rx_status.mcs = HAL_RX_GET(vht_sig_a_info,
  491. VHT_SIG_A_INFO_1, MCS);
  492. ppdu_info->rx_status.sgi = HAL_RX_GET(vht_sig_a_info,
  493. VHT_SIG_A_INFO_1, GI_SETTING);
  494. switch (hal->target_type) {
  495. case TARGET_TYPE_QCA8074:
  496. case TARGET_TYPE_QCA8074V2:
  497. case TARGET_TYPE_QCA6018:
  498. ppdu_info->rx_status.is_stbc =
  499. HAL_RX_GET(vht_sig_a_info,
  500. VHT_SIG_A_INFO_0, STBC);
  501. value = HAL_RX_GET(vht_sig_a_info,
  502. VHT_SIG_A_INFO_0, N_STS);
  503. if (ppdu_info->rx_status.is_stbc && (value > 0))
  504. value = ((value + 1) >> 1) - 1;
  505. ppdu_info->rx_status.nss =
  506. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  507. break;
  508. case TARGET_TYPE_QCA6290:
  509. #if !defined(QCA_WIFI_QCA6290_11AX)
  510. ppdu_info->rx_status.is_stbc =
  511. HAL_RX_GET(vht_sig_a_info,
  512. VHT_SIG_A_INFO_0, STBC);
  513. value = HAL_RX_GET(vht_sig_a_info,
  514. VHT_SIG_A_INFO_0, N_STS);
  515. if (ppdu_info->rx_status.is_stbc && (value > 0))
  516. value = ((value + 1) >> 1) - 1;
  517. ppdu_info->rx_status.nss =
  518. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  519. #else
  520. ppdu_info->rx_status.nss = 0;
  521. #endif
  522. break;
  523. #ifdef QCA_WIFI_QCA6390
  524. case TARGET_TYPE_QCA6390:
  525. ppdu_info->rx_status.nss = 0;
  526. break;
  527. #endif
  528. default:
  529. break;
  530. }
  531. ppdu_info->rx_status.vht_flag_values3[0] =
  532. (((ppdu_info->rx_status.mcs) << 4)
  533. | ppdu_info->rx_status.nss);
  534. ppdu_info->rx_status.bw = HAL_RX_GET(vht_sig_a_info,
  535. VHT_SIG_A_INFO_0, BANDWIDTH);
  536. ppdu_info->rx_status.vht_flag_values2 =
  537. ppdu_info->rx_status.bw;
  538. ppdu_info->rx_status.vht_flag_values4 =
  539. HAL_RX_GET(vht_sig_a_info,
  540. VHT_SIG_A_INFO_1, SU_MU_CODING);
  541. ppdu_info->rx_status.beamformed = HAL_RX_GET(vht_sig_a_info,
  542. VHT_SIG_A_INFO_1, BEAMFORMED);
  543. if (group_id == 0 || group_id == 63)
  544. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  545. else
  546. ppdu_info->rx_status.reception_type =
  547. HAL_RX_TYPE_MU_MIMO;
  548. break;
  549. }
  550. case WIFIPHYRX_HE_SIG_A_SU_E:
  551. {
  552. uint8_t *he_sig_a_su_info = (uint8_t *)rx_tlv +
  553. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_SU_0,
  554. HE_SIG_A_SU_INFO_PHYRX_HE_SIG_A_SU_INFO_DETAILS);
  555. ppdu_info->rx_status.he_flags = 1;
  556. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_0,
  557. FORMAT_INDICATION);
  558. if (value == 0) {
  559. ppdu_info->rx_status.he_data1 =
  560. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  561. } else {
  562. ppdu_info->rx_status.he_data1 =
  563. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  564. }
  565. /* data1 */
  566. ppdu_info->rx_status.he_data1 |=
  567. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  568. QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN |
  569. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  570. QDF_MON_STATUS_HE_MCS_KNOWN |
  571. QDF_MON_STATUS_HE_DCM_KNOWN |
  572. QDF_MON_STATUS_HE_CODING_KNOWN |
  573. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  574. QDF_MON_STATUS_HE_STBC_KNOWN |
  575. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  576. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  577. /* data2 */
  578. ppdu_info->rx_status.he_data2 =
  579. QDF_MON_STATUS_HE_GI_KNOWN;
  580. ppdu_info->rx_status.he_data2 |=
  581. QDF_MON_STATUS_TXBF_KNOWN |
  582. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  583. QDF_MON_STATUS_TXOP_KNOWN |
  584. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  585. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  586. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  587. /* data3 */
  588. value = HAL_RX_GET(he_sig_a_su_info,
  589. HE_SIG_A_SU_INFO_0, BSS_COLOR_ID);
  590. ppdu_info->rx_status.he_data3 = value;
  591. value = HAL_RX_GET(he_sig_a_su_info,
  592. HE_SIG_A_SU_INFO_0, BEAM_CHANGE);
  593. value = value << QDF_MON_STATUS_BEAM_CHANGE_SHIFT;
  594. ppdu_info->rx_status.he_data3 |= value;
  595. value = HAL_RX_GET(he_sig_a_su_info,
  596. HE_SIG_A_SU_INFO_0, DL_UL_FLAG);
  597. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  598. ppdu_info->rx_status.he_data3 |= value;
  599. value = HAL_RX_GET(he_sig_a_su_info,
  600. HE_SIG_A_SU_INFO_0, TRANSMIT_MCS);
  601. ppdu_info->rx_status.mcs = value;
  602. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  603. ppdu_info->rx_status.he_data3 |= value;
  604. value = HAL_RX_GET(he_sig_a_su_info,
  605. HE_SIG_A_SU_INFO_0, DCM);
  606. he_dcm = value;
  607. value = value << QDF_MON_STATUS_DCM_SHIFT;
  608. ppdu_info->rx_status.he_data3 |= value;
  609. value = HAL_RX_GET(he_sig_a_su_info,
  610. HE_SIG_A_SU_INFO_1, CODING);
  611. value = value << QDF_MON_STATUS_CODING_SHIFT;
  612. ppdu_info->rx_status.he_data3 |= value;
  613. value = HAL_RX_GET(he_sig_a_su_info,
  614. HE_SIG_A_SU_INFO_1,
  615. LDPC_EXTRA_SYMBOL);
  616. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  617. ppdu_info->rx_status.he_data3 |= value;
  618. value = HAL_RX_GET(he_sig_a_su_info,
  619. HE_SIG_A_SU_INFO_1, STBC);
  620. he_stbc = value;
  621. value = value << QDF_MON_STATUS_STBC_SHIFT;
  622. ppdu_info->rx_status.he_data3 |= value;
  623. /* data4 */
  624. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_0,
  625. SPATIAL_REUSE);
  626. ppdu_info->rx_status.he_data4 = value;
  627. /* data5 */
  628. value = HAL_RX_GET(he_sig_a_su_info,
  629. HE_SIG_A_SU_INFO_0, TRANSMIT_BW);
  630. ppdu_info->rx_status.he_data5 = value;
  631. ppdu_info->rx_status.bw = value;
  632. value = HAL_RX_GET(he_sig_a_su_info,
  633. HE_SIG_A_SU_INFO_0, CP_LTF_SIZE);
  634. switch (value) {
  635. case 0:
  636. he_gi = HE_GI_0_8;
  637. he_ltf = HE_LTF_1_X;
  638. break;
  639. case 1:
  640. he_gi = HE_GI_0_8;
  641. he_ltf = HE_LTF_2_X;
  642. break;
  643. case 2:
  644. he_gi = HE_GI_1_6;
  645. he_ltf = HE_LTF_2_X;
  646. break;
  647. case 3:
  648. if (he_dcm && he_stbc) {
  649. he_gi = HE_GI_0_8;
  650. he_ltf = HE_LTF_4_X;
  651. } else {
  652. he_gi = HE_GI_3_2;
  653. he_ltf = HE_LTF_4_X;
  654. }
  655. break;
  656. }
  657. ppdu_info->rx_status.sgi = he_gi;
  658. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  659. ppdu_info->rx_status.he_data5 |= value;
  660. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  661. ppdu_info->rx_status.he_data5 |= value;
  662. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_0, NSTS);
  663. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  664. ppdu_info->rx_status.he_data5 |= value;
  665. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_1,
  666. PACKET_EXTENSION_A_FACTOR);
  667. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  668. ppdu_info->rx_status.he_data5 |= value;
  669. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_1, TXBF);
  670. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  671. ppdu_info->rx_status.he_data5 |= value;
  672. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_1,
  673. PACKET_EXTENSION_PE_DISAMBIGUITY);
  674. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  675. ppdu_info->rx_status.he_data5 |= value;
  676. /* data6 */
  677. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_0, NSTS);
  678. value++;
  679. ppdu_info->rx_status.nss = value;
  680. ppdu_info->rx_status.he_data6 = value;
  681. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_1,
  682. DOPPLER_INDICATION);
  683. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  684. ppdu_info->rx_status.he_data6 |= value;
  685. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO_1,
  686. TXOP_DURATION);
  687. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  688. ppdu_info->rx_status.he_data6 |= value;
  689. ppdu_info->rx_status.beamformed = HAL_RX_GET(he_sig_a_su_info,
  690. HE_SIG_A_SU_INFO_1, TXBF);
  691. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  692. break;
  693. }
  694. case WIFIPHYRX_HE_SIG_A_MU_DL_E:
  695. {
  696. uint8_t *he_sig_a_mu_dl_info = (uint8_t *)rx_tlv +
  697. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_MU_DL_0,
  698. HE_SIG_A_MU_DL_INFO_PHYRX_HE_SIG_A_MU_DL_INFO_DETAILS);
  699. ppdu_info->rx_status.he_mu_flags = 1;
  700. /* HE Flags */
  701. /*data1*/
  702. ppdu_info->rx_status.he_data1 =
  703. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  704. ppdu_info->rx_status.he_data1 |=
  705. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  706. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  707. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  708. QDF_MON_STATUS_HE_STBC_KNOWN |
  709. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  710. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  711. /* data2 */
  712. ppdu_info->rx_status.he_data2 =
  713. QDF_MON_STATUS_HE_GI_KNOWN;
  714. ppdu_info->rx_status.he_data2 |=
  715. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  716. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  717. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  718. QDF_MON_STATUS_TXOP_KNOWN |
  719. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  720. /*data3*/
  721. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  722. HE_SIG_A_MU_DL_INFO_0, BSS_COLOR_ID);
  723. ppdu_info->rx_status.he_data3 = value;
  724. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  725. HE_SIG_A_MU_DL_INFO_0, DL_UL_FLAG);
  726. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  727. ppdu_info->rx_status.he_data3 |= value;
  728. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  729. HE_SIG_A_MU_DL_INFO_1,
  730. LDPC_EXTRA_SYMBOL);
  731. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  732. ppdu_info->rx_status.he_data3 |= value;
  733. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  734. HE_SIG_A_MU_DL_INFO_1, STBC);
  735. he_stbc = value;
  736. value = value << QDF_MON_STATUS_STBC_SHIFT;
  737. ppdu_info->rx_status.he_data3 |= value;
  738. /*data4*/
  739. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO_0,
  740. SPATIAL_REUSE);
  741. ppdu_info->rx_status.he_data4 = value;
  742. /*data5*/
  743. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  744. HE_SIG_A_MU_DL_INFO_0, TRANSMIT_BW);
  745. ppdu_info->rx_status.he_data5 = value;
  746. ppdu_info->rx_status.bw = value;
  747. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  748. HE_SIG_A_MU_DL_INFO_0, CP_LTF_SIZE);
  749. switch (value) {
  750. case 0:
  751. he_gi = HE_GI_0_8;
  752. he_ltf = HE_LTF_4_X;
  753. break;
  754. case 1:
  755. he_gi = HE_GI_0_8;
  756. he_ltf = HE_LTF_2_X;
  757. break;
  758. case 2:
  759. he_gi = HE_GI_1_6;
  760. he_ltf = HE_LTF_2_X;
  761. break;
  762. case 3:
  763. he_gi = HE_GI_3_2;
  764. he_ltf = HE_LTF_4_X;
  765. break;
  766. }
  767. ppdu_info->rx_status.sgi = he_gi;
  768. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  769. ppdu_info->rx_status.he_data5 |= value;
  770. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  771. ppdu_info->rx_status.he_data5 |= value;
  772. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  773. HE_SIG_A_MU_DL_INFO_1, NUM_LTF_SYMBOLS);
  774. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  775. ppdu_info->rx_status.he_data5 |= value;
  776. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO_1,
  777. PACKET_EXTENSION_A_FACTOR);
  778. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  779. ppdu_info->rx_status.he_data5 |= value;
  780. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO_1,
  781. PACKET_EXTENSION_PE_DISAMBIGUITY);
  782. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  783. ppdu_info->rx_status.he_data5 |= value;
  784. /*data6*/
  785. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO_0,
  786. DOPPLER_INDICATION);
  787. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  788. ppdu_info->rx_status.he_data6 |= value;
  789. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO_1,
  790. TXOP_DURATION);
  791. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  792. ppdu_info->rx_status.he_data6 |= value;
  793. /* HE-MU Flags */
  794. /* HE-MU-flags1 */
  795. ppdu_info->rx_status.he_flags1 =
  796. QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  797. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  798. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
  799. QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
  800. QDF_MON_STATUS_RU_0_KNOWN;
  801. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  802. HE_SIG_A_MU_DL_INFO_0, MCS_OF_SIG_B);
  803. ppdu_info->rx_status.he_flags1 |= value;
  804. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  805. HE_SIG_A_MU_DL_INFO_0, DCM_OF_SIG_B);
  806. value = value << QDF_MON_STATUS_DCM_FLAG_1_SHIFT;
  807. ppdu_info->rx_status.he_flags1 |= value;
  808. /* HE-MU-flags2 */
  809. ppdu_info->rx_status.he_flags2 =
  810. QDF_MON_STATUS_BW_KNOWN;
  811. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  812. HE_SIG_A_MU_DL_INFO_0, TRANSMIT_BW);
  813. ppdu_info->rx_status.he_flags2 |= value;
  814. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  815. HE_SIG_A_MU_DL_INFO_0, COMP_MODE_SIG_B);
  816. value = value << QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  817. ppdu_info->rx_status.he_flags2 |= value;
  818. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  819. HE_SIG_A_MU_DL_INFO_0, NUM_SIG_B_SYMBOLS);
  820. value = value - 1;
  821. value = value << QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
  822. ppdu_info->rx_status.he_flags2 |= value;
  823. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  824. break;
  825. }
  826. case WIFIPHYRX_HE_SIG_B1_MU_E:
  827. {
  828. uint8_t *he_sig_b1_mu_info = (uint8_t *)rx_tlv +
  829. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B1_MU_0,
  830. HE_SIG_B1_MU_INFO_PHYRX_HE_SIG_B1_MU_INFO_DETAILS);
  831. ppdu_info->rx_status.he_sig_b_common_known |=
  832. QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0;
  833. /* TODO: Check on the availability of other fields in
  834. * sig_b_common
  835. */
  836. value = HAL_RX_GET(he_sig_b1_mu_info,
  837. HE_SIG_B1_MU_INFO_0, RU_ALLOCATION);
  838. ppdu_info->rx_status.he_RU[0] = value;
  839. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  840. break;
  841. }
  842. case WIFIPHYRX_HE_SIG_B2_MU_E:
  843. {
  844. uint8_t *he_sig_b2_mu_info = (uint8_t *)rx_tlv +
  845. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_MU_0,
  846. HE_SIG_B2_MU_INFO_PHYRX_HE_SIG_B2_MU_INFO_DETAILS);
  847. /*
  848. * Not all "HE" fields can be updated from
  849. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  850. * to populate rest of the "HE" fields for MU scenarios.
  851. */
  852. /* HE-data1 */
  853. ppdu_info->rx_status.he_data1 |=
  854. QDF_MON_STATUS_HE_MCS_KNOWN |
  855. QDF_MON_STATUS_HE_CODING_KNOWN;
  856. /* HE-data2 */
  857. /* HE-data3 */
  858. value = HAL_RX_GET(he_sig_b2_mu_info,
  859. HE_SIG_B2_MU_INFO_0, STA_MCS);
  860. ppdu_info->rx_status.mcs = value;
  861. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  862. ppdu_info->rx_status.he_data3 |= value;
  863. value = HAL_RX_GET(he_sig_b2_mu_info,
  864. HE_SIG_B2_MU_INFO_0, STA_CODING);
  865. value = value << QDF_MON_STATUS_CODING_SHIFT;
  866. ppdu_info->rx_status.he_data3 |= value;
  867. /* HE-data4 */
  868. value = HAL_RX_GET(he_sig_b2_mu_info,
  869. HE_SIG_B2_MU_INFO_0, STA_ID);
  870. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  871. ppdu_info->rx_status.he_data4 |= value;
  872. /* HE-data5 */
  873. /* HE-data6 */
  874. value = HAL_RX_GET(he_sig_b2_mu_info,
  875. HE_SIG_B2_MU_INFO_0, NSTS);
  876. /* value n indicates n+1 spatial streams */
  877. value++;
  878. ppdu_info->rx_status.nss = value;
  879. ppdu_info->rx_status.he_data6 |= value;
  880. break;
  881. }
  882. case WIFIPHYRX_HE_SIG_B2_OFDMA_E:
  883. {
  884. uint8_t *he_sig_b2_ofdma_info =
  885. (uint8_t *)rx_tlv +
  886. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_OFDMA_0,
  887. HE_SIG_B2_OFDMA_INFO_PHYRX_HE_SIG_B2_OFDMA_INFO_DETAILS);
  888. /*
  889. * Not all "HE" fields can be updated from
  890. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  891. * to populate rest of "HE" fields for MU OFDMA scenarios.
  892. */
  893. /* HE-data1 */
  894. ppdu_info->rx_status.he_data1 |=
  895. QDF_MON_STATUS_HE_MCS_KNOWN |
  896. QDF_MON_STATUS_HE_DCM_KNOWN |
  897. QDF_MON_STATUS_HE_CODING_KNOWN;
  898. /* HE-data2 */
  899. ppdu_info->rx_status.he_data2 |=
  900. QDF_MON_STATUS_TXBF_KNOWN;
  901. /* HE-data3 */
  902. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  903. HE_SIG_B2_OFDMA_INFO_0, STA_MCS);
  904. ppdu_info->rx_status.mcs = value;
  905. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  906. ppdu_info->rx_status.he_data3 |= value;
  907. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  908. HE_SIG_B2_OFDMA_INFO_0, STA_DCM);
  909. he_dcm = value;
  910. value = value << QDF_MON_STATUS_DCM_SHIFT;
  911. ppdu_info->rx_status.he_data3 |= value;
  912. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  913. HE_SIG_B2_OFDMA_INFO_0, STA_CODING);
  914. value = value << QDF_MON_STATUS_CODING_SHIFT;
  915. ppdu_info->rx_status.he_data3 |= value;
  916. /* HE-data4 */
  917. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  918. HE_SIG_B2_OFDMA_INFO_0, STA_ID);
  919. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  920. ppdu_info->rx_status.he_data4 |= value;
  921. /* HE-data5 */
  922. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  923. HE_SIG_B2_OFDMA_INFO_0, TXBF);
  924. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  925. ppdu_info->rx_status.he_data5 |= value;
  926. /* HE-data6 */
  927. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  928. HE_SIG_B2_OFDMA_INFO_0, NSTS);
  929. /* value n indicates n+1 spatial streams */
  930. value++;
  931. ppdu_info->rx_status.nss = value;
  932. ppdu_info->rx_status.he_data6 |= value;
  933. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  934. break;
  935. }
  936. case WIFIPHYRX_RSSI_LEGACY_E:
  937. {
  938. uint8_t *rssi_info_tlv = (uint8_t *)rx_tlv +
  939. HAL_RX_OFFSET(UNIFIED_PHYRX_RSSI_LEGACY_3,
  940. RECEIVE_RSSI_INFO_PRE_RSSI_INFO_DETAILS);
  941. ppdu_info->rx_status.rssi_comb = HAL_RX_GET(rx_tlv,
  942. PHYRX_RSSI_LEGACY_35, RSSI_COMB);
  943. ppdu_info->rx_status.bw = hal->ops->hal_rx_get_tlv(rx_tlv);
  944. ppdu_info->rx_status.he_re = 0;
  945. value = HAL_RX_GET(rssi_info_tlv,
  946. RECEIVE_RSSI_INFO_0, RSSI_PRI20_CHAIN0);
  947. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  948. "RSSI_PRI20_CHAIN0: %d\n", value);
  949. value = HAL_RX_GET(rssi_info_tlv,
  950. RECEIVE_RSSI_INFO_0, RSSI_EXT20_CHAIN0);
  951. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  952. "RSSI_EXT20_CHAIN0: %d\n", value);
  953. value = HAL_RX_GET(rssi_info_tlv,
  954. RECEIVE_RSSI_INFO_0, RSSI_EXT40_LOW20_CHAIN0);
  955. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  956. "RSSI_EXT40_LOW20_CHAIN0: %d\n", value);
  957. value = HAL_RX_GET(rssi_info_tlv,
  958. RECEIVE_RSSI_INFO_0, RSSI_EXT40_HIGH20_CHAIN0);
  959. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  960. "RSSI_EXT40_HIGH20_CHAIN0: %d\n", value);
  961. value = HAL_RX_GET(rssi_info_tlv,
  962. RECEIVE_RSSI_INFO_1, RSSI_EXT80_LOW20_CHAIN0);
  963. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  964. "RSSI_EXT80_LOW20_CHAIN0: %d\n", value);
  965. value = HAL_RX_GET(rssi_info_tlv,
  966. RECEIVE_RSSI_INFO_1, RSSI_EXT80_LOW_HIGH20_CHAIN0);
  967. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  968. "RSSI_EXT80_LOW_HIGH20_CHAIN0: %d\n", value);
  969. value = HAL_RX_GET(rssi_info_tlv,
  970. RECEIVE_RSSI_INFO_1, RSSI_EXT80_HIGH_LOW20_CHAIN0);
  971. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  972. "RSSI_EXT80_HIGH_LOW20_CHAIN0: %d\n", value);
  973. value = HAL_RX_GET(rssi_info_tlv,
  974. RECEIVE_RSSI_INFO_1,
  975. RSSI_EXT80_HIGH20_CHAIN0);
  976. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  977. "RSSI_EXT80_HIGH20_CHAIN0: %d\n", value);
  978. break;
  979. }
  980. case WIFIPHYRX_OTHER_RECEIVE_INFO_E:
  981. hal_rx_proc_phyrx_other_receive_info_tlv(hal, rx_tlv_hdr,
  982. ppdu_info);
  983. break;
  984. case WIFIRX_HEADER_E:
  985. ppdu_info->msdu_info.first_msdu_payload = rx_tlv;
  986. ppdu_info->msdu_info.payload_len = tlv_len;
  987. break;
  988. case WIFIRX_MPDU_START_E:
  989. {
  990. uint8_t *rx_mpdu_start =
  991. (uint8_t *)rx_tlv + HAL_RX_OFFSET(UNIFIED_RX_MPDU_START_0,
  992. RX_MPDU_INFO_RX_MPDU_INFO_DETAILS);
  993. uint32_t ppdu_id = HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_0,
  994. PHY_PPDU_ID);
  995. uint8_t filter_category = 0;
  996. ppdu_info->nac_info.fc_valid =
  997. HAL_RX_GET(rx_mpdu_start,
  998. RX_MPDU_INFO_2,
  999. MPDU_FRAME_CONTROL_VALID);
  1000. ppdu_info->nac_info.to_ds_flag =
  1001. HAL_RX_GET(rx_mpdu_start,
  1002. RX_MPDU_INFO_2,
  1003. TO_DS);
  1004. ppdu_info->nac_info.mac_addr2_valid =
  1005. HAL_RX_GET(rx_mpdu_start,
  1006. RX_MPDU_INFO_2,
  1007. MAC_ADDR_AD2_VALID);
  1008. *(uint16_t *)&ppdu_info->nac_info.mac_addr2[0] =
  1009. HAL_RX_GET(rx_mpdu_start,
  1010. RX_MPDU_INFO_16,
  1011. MAC_ADDR_AD2_15_0);
  1012. *(uint32_t *)&ppdu_info->nac_info.mac_addr2[2] =
  1013. HAL_RX_GET(rx_mpdu_start,
  1014. RX_MPDU_INFO_17,
  1015. MAC_ADDR_AD2_47_16);
  1016. if (ppdu_info->rx_status.prev_ppdu_id != ppdu_id) {
  1017. ppdu_info->rx_status.prev_ppdu_id = ppdu_id;
  1018. ppdu_info->rx_status.ppdu_len =
  1019. HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_13,
  1020. MPDU_LENGTH);
  1021. } else {
  1022. ppdu_info->rx_status.ppdu_len +=
  1023. HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_13,
  1024. MPDU_LENGTH);
  1025. }
  1026. filter_category = HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_0,
  1027. RXPCU_MPDU_FILTER_IN_CATEGORY);
  1028. if (filter_category == 1)
  1029. ppdu_info->rx_status.monitor_direct_used = 1;
  1030. break;
  1031. }
  1032. case 0:
  1033. return HAL_TLV_STATUS_PPDU_DONE;
  1034. default:
  1035. if (hal_rx_handle_other_tlvs(tlv_tag, rx_tlv, ppdu_info))
  1036. unhandled = false;
  1037. else
  1038. unhandled = true;
  1039. break;
  1040. }
  1041. if (!unhandled)
  1042. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1043. "%s TLV type: %d, TLV len:%d %s",
  1044. __func__, tlv_tag, tlv_len,
  1045. unhandled == true ? "unhandled" : "");
  1046. qdf_trace_hex_dump(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1047. rx_tlv, tlv_len);
  1048. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1049. }
  1050. /**
  1051. * hal_reo_status_get_header_generic - Process reo desc info
  1052. * @d - Pointer to reo descriptior
  1053. * @b - tlv type info
  1054. * @h1 - Pointer to hal_reo_status_header where info to be stored
  1055. *
  1056. * Return - none.
  1057. *
  1058. */
  1059. static void hal_reo_status_get_header_generic(uint32_t *d, int b, void *h1)
  1060. {
  1061. uint32_t val1 = 0;
  1062. struct hal_reo_status_header *h =
  1063. (struct hal_reo_status_header *)h1;
  1064. switch (b) {
  1065. case HAL_REO_QUEUE_STATS_STATUS_TLV:
  1066. val1 = d[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_0,
  1067. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1068. break;
  1069. case HAL_REO_FLUSH_QUEUE_STATUS_TLV:
  1070. val1 = d[HAL_OFFSET_DW(REO_FLUSH_QUEUE_STATUS_0,
  1071. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1072. break;
  1073. case HAL_REO_FLUSH_CACHE_STATUS_TLV:
  1074. val1 = d[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_0,
  1075. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1076. break;
  1077. case HAL_REO_UNBLK_CACHE_STATUS_TLV:
  1078. val1 = d[HAL_OFFSET_DW(REO_UNBLOCK_CACHE_STATUS_0,
  1079. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1080. break;
  1081. case HAL_REO_TIMOUT_LIST_STATUS_TLV:
  1082. val1 = d[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_0,
  1083. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1084. break;
  1085. case HAL_REO_DESC_THRES_STATUS_TLV:
  1086. val1 = d[HAL_OFFSET_DW(REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_0,
  1087. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1088. break;
  1089. case HAL_REO_UPDATE_RX_QUEUE_STATUS_TLV:
  1090. val1 = d[HAL_OFFSET_DW(REO_UPDATE_RX_REO_QUEUE_STATUS_0,
  1091. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER)];
  1092. break;
  1093. default:
  1094. pr_err("ERROR: Unknown tlv\n");
  1095. break;
  1096. }
  1097. h->cmd_num =
  1098. HAL_GET_FIELD(
  1099. UNIFORM_REO_STATUS_HEADER_0, REO_STATUS_NUMBER,
  1100. val1);
  1101. h->exec_time =
  1102. HAL_GET_FIELD(UNIFORM_REO_STATUS_HEADER_0,
  1103. CMD_EXECUTION_TIME, val1);
  1104. h->status =
  1105. HAL_GET_FIELD(UNIFORM_REO_STATUS_HEADER_0,
  1106. REO_CMD_EXECUTION_STATUS, val1);
  1107. switch (b) {
  1108. case HAL_REO_QUEUE_STATS_STATUS_TLV:
  1109. val1 = d[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_1,
  1110. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1111. break;
  1112. case HAL_REO_FLUSH_QUEUE_STATUS_TLV:
  1113. val1 = d[HAL_OFFSET_DW(REO_FLUSH_QUEUE_STATUS_1,
  1114. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1115. break;
  1116. case HAL_REO_FLUSH_CACHE_STATUS_TLV:
  1117. val1 = d[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_1,
  1118. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1119. break;
  1120. case HAL_REO_UNBLK_CACHE_STATUS_TLV:
  1121. val1 = d[HAL_OFFSET_DW(REO_UNBLOCK_CACHE_STATUS_1,
  1122. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1123. break;
  1124. case HAL_REO_TIMOUT_LIST_STATUS_TLV:
  1125. val1 = d[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_1,
  1126. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1127. break;
  1128. case HAL_REO_DESC_THRES_STATUS_TLV:
  1129. val1 = d[HAL_OFFSET_DW(REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_1,
  1130. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1131. break;
  1132. case HAL_REO_UPDATE_RX_QUEUE_STATUS_TLV:
  1133. val1 = d[HAL_OFFSET_DW(REO_UPDATE_RX_REO_QUEUE_STATUS_1,
  1134. UNIFORM_REO_STATUS_HEADER_STATUS_HEADER_GENERIC)];
  1135. break;
  1136. default:
  1137. pr_err("ERROR: Unknown tlv\n");
  1138. break;
  1139. }
  1140. h->tstamp =
  1141. HAL_GET_FIELD(UNIFORM_REO_STATUS_HEADER_1, TIMESTAMP, val1);
  1142. }
  1143. /**
  1144. * hal_reo_setup - Initialize HW REO block
  1145. *
  1146. * @hal_soc: Opaque HAL SOC handle
  1147. * @reo_params: parameters needed by HAL for REO config
  1148. */
  1149. static void hal_reo_setup_generic(void *hal_soc,
  1150. void *reoparams)
  1151. {
  1152. struct hal_soc *soc = (struct hal_soc *)hal_soc;
  1153. uint32_t reg_val;
  1154. struct hal_reo_params *reo_params = (struct hal_reo_params *)reoparams;
  1155. reg_val = HAL_REG_READ(soc, HWIO_REO_R0_GENERAL_ENABLE_ADDR(
  1156. SEQ_WCSS_UMAC_REO_REG_OFFSET));
  1157. reg_val &= ~(HWIO_REO_R0_GENERAL_ENABLE_FRAGMENT_DEST_RING_BMSK |
  1158. HWIO_REO_R0_GENERAL_ENABLE_AGING_LIST_ENABLE_BMSK |
  1159. HWIO_REO_R0_GENERAL_ENABLE_AGING_FLUSH_ENABLE_BMSK);
  1160. reg_val |= HAL_SM(HWIO_REO_R0_GENERAL_ENABLE,
  1161. FRAGMENT_DEST_RING, reo_params->frag_dst_ring) |
  1162. HAL_SM(HWIO_REO_R0_GENERAL_ENABLE, AGING_LIST_ENABLE, 1) |
  1163. HAL_SM(HWIO_REO_R0_GENERAL_ENABLE, AGING_FLUSH_ENABLE, 1);
  1164. HAL_REG_WRITE(soc, HWIO_REO_R0_GENERAL_ENABLE_ADDR(
  1165. SEQ_WCSS_UMAC_REO_REG_OFFSET), reg_val);
  1166. /* Other ring enable bits and REO_ENABLE will be set by FW */
  1167. /* TODO: Setup destination ring mapping if enabled */
  1168. /* TODO: Error destination ring setting is left to default.
  1169. * Default setting is to send all errors to release ring.
  1170. */
  1171. HAL_REG_WRITE(soc,
  1172. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  1173. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1174. HAL_DEFAULT_REO_TIMEOUT_MS * 1000);
  1175. HAL_REG_WRITE(soc,
  1176. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  1177. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1178. (HAL_DEFAULT_REO_TIMEOUT_MS * 1000));
  1179. HAL_REG_WRITE(soc,
  1180. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  1181. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1182. (HAL_DEFAULT_REO_TIMEOUT_MS * 1000));
  1183. HAL_REG_WRITE(soc,
  1184. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  1185. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1186. (HAL_DEFAULT_REO_TIMEOUT_MS * 1000));
  1187. /*
  1188. * When hash based routing is enabled, routing of the rx packet
  1189. * is done based on the following value: 1 _ _ _ _ The last 4
  1190. * bits are based on hash[3:0]. This means the possible values
  1191. * are 0x10 to 0x1f. This value is used to look-up the
  1192. * ring ID configured in Destination_Ring_Ctrl_IX_* register.
  1193. * The Destination_Ring_Ctrl_IX_2 and Destination_Ring_Ctrl_IX_3
  1194. * registers need to be configured to set-up the 16 entries to
  1195. * map the hash values to a ring number. There are 3 bits per
  1196. * hash entry – which are mapped as follows:
  1197. * 0: TCL, 1:SW1, 2:SW2, * 3:SW3, 4:SW4, 5:Release, 6:FW(WIFI),
  1198. * 7: NOT_USED.
  1199. */
  1200. if (reo_params->rx_hash_enabled) {
  1201. HAL_REG_WRITE(soc,
  1202. HWIO_REO_R0_DESTINATION_RING_CTRL_IX_2_ADDR(
  1203. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1204. reo_params->remap1);
  1205. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  1206. FL("HWIO_REO_R0_DESTINATION_RING_CTRL_IX_2_ADDR 0x%x"),
  1207. HAL_REG_READ(soc,
  1208. HWIO_REO_R0_DESTINATION_RING_CTRL_IX_2_ADDR(
  1209. SEQ_WCSS_UMAC_REO_REG_OFFSET)));
  1210. HAL_REG_WRITE(soc,
  1211. HWIO_REO_R0_DESTINATION_RING_CTRL_IX_3_ADDR(
  1212. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  1213. reo_params->remap2);
  1214. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  1215. FL("HWIO_REO_R0_DESTINATION_RING_CTRL_IX_3_ADDR 0x%x"),
  1216. HAL_REG_READ(soc,
  1217. HWIO_REO_R0_DESTINATION_RING_CTRL_IX_3_ADDR(
  1218. SEQ_WCSS_UMAC_REO_REG_OFFSET)));
  1219. }
  1220. /* TODO: Check if the following registers shoould be setup by host:
  1221. * AGING_CONTROL
  1222. * HIGH_MEMORY_THRESHOLD
  1223. * GLOBAL_LINK_DESC_COUNT_THRESH_IX_0[1,2]
  1224. * GLOBAL_LINK_DESC_COUNT_CTRL
  1225. */
  1226. }
  1227. /**
  1228. * hal_get_hw_hptp_generic() - Get HW head and tail pointer value for any ring
  1229. * @hal_soc: Opaque HAL SOC handle
  1230. * @hal_ring: Source ring pointer
  1231. * @headp: Head Pointer
  1232. * @tailp: Tail Pointer
  1233. * @ring: Ring type
  1234. *
  1235. * Return: Update tail pointer and head pointer in arguments.
  1236. */
  1237. static inline
  1238. void hal_get_hw_hptp_generic(struct hal_soc *soc, void *hal_ring,
  1239. uint32_t *headp, uint32_t *tailp,
  1240. uint8_t ring)
  1241. {
  1242. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  1243. struct hal_hw_srng_config *ring_config;
  1244. enum hal_ring_type ring_type = (enum hal_ring_type)ring;
  1245. if (!soc || !srng) {
  1246. QDF_TRACE(QDF_MODULE_ID_HAL, QDF_TRACE_LEVEL_ERROR,
  1247. "%s: Context is Null", __func__);
  1248. return;
  1249. }
  1250. ring_config = HAL_SRNG_CONFIG(soc, ring_type);
  1251. if (!ring_config->lmac_ring) {
  1252. if (srng->ring_dir == HAL_SRNG_SRC_RING) {
  1253. *headp =
  1254. (SRNG_SRC_REG_READ(srng, HP)) / srng->entry_size;
  1255. *tailp =
  1256. (SRNG_SRC_REG_READ(srng, TP)) / srng->entry_size;
  1257. } else {
  1258. *headp =
  1259. (SRNG_DST_REG_READ(srng, HP)) / srng->entry_size;
  1260. *tailp =
  1261. (SRNG_DST_REG_READ(srng, TP)) / srng->entry_size;
  1262. }
  1263. }
  1264. }
  1265. /**
  1266. * hal_srng_src_hw_init - Private function to initialize SRNG
  1267. * source ring HW
  1268. * @hal_soc: HAL SOC handle
  1269. * @srng: SRNG ring pointer
  1270. */
  1271. static inline void hal_srng_src_hw_init_generic(void *halsoc,
  1272. struct hal_srng *srng)
  1273. {
  1274. struct hal_soc *hal = (struct hal_soc *)halsoc;
  1275. uint32_t reg_val = 0;
  1276. uint64_t tp_addr = 0;
  1277. HIF_DBG("%s: hw_init srng %d", __func__, srng->ring_id);
  1278. if (srng->flags & HAL_SRNG_MSI_INTR) {
  1279. SRNG_SRC_REG_WRITE(srng, MSI1_BASE_LSB,
  1280. srng->msi_addr & 0xffffffff);
  1281. reg_val = SRNG_SM(SRNG_SRC_FLD(MSI1_BASE_MSB, ADDR),
  1282. (uint64_t)(srng->msi_addr) >> 32) |
  1283. SRNG_SM(SRNG_SRC_FLD(MSI1_BASE_MSB,
  1284. MSI1_ENABLE), 1);
  1285. SRNG_SRC_REG_WRITE(srng, MSI1_BASE_MSB, reg_val);
  1286. SRNG_SRC_REG_WRITE(srng, MSI1_DATA, srng->msi_data);
  1287. }
  1288. SRNG_SRC_REG_WRITE(srng, BASE_LSB, srng->ring_base_paddr & 0xffffffff);
  1289. reg_val = SRNG_SM(SRNG_SRC_FLD(BASE_MSB, RING_BASE_ADDR_MSB),
  1290. ((uint64_t)(srng->ring_base_paddr) >> 32)) |
  1291. SRNG_SM(SRNG_SRC_FLD(BASE_MSB, RING_SIZE),
  1292. srng->entry_size * srng->num_entries);
  1293. SRNG_SRC_REG_WRITE(srng, BASE_MSB, reg_val);
  1294. #if defined(WCSS_VERSION) && \
  1295. ((defined(CONFIG_WIN) && (WCSS_VERSION > 81)) || \
  1296. (defined(CONFIG_MCL) && (WCSS_VERSION >= 72)))
  1297. reg_val = SRNG_SM(SRNG_SRC_FLD(ID, ENTRY_SIZE), srng->entry_size);
  1298. #else
  1299. reg_val = SRNG_SM(SRNG_SRC_FLD(ID, RING_ID), srng->ring_id) |
  1300. SRNG_SM(SRNG_SRC_FLD(ID, ENTRY_SIZE), srng->entry_size);
  1301. #endif
  1302. SRNG_SRC_REG_WRITE(srng, ID, reg_val);
  1303. /**
  1304. * Interrupt setup:
  1305. * Default interrupt mode is 'pulse'. Need to setup SW_INTERRUPT_MODE
  1306. * if level mode is required
  1307. */
  1308. reg_val = 0;
  1309. /*
  1310. * WAR - Hawkeye v1 has a hardware bug which requires timer value to be
  1311. * programmed in terms of 1us resolution instead of 8us resolution as
  1312. * given in MLD.
  1313. */
  1314. if (srng->intr_timer_thres_us) {
  1315. reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX0,
  1316. INTERRUPT_TIMER_THRESHOLD),
  1317. srng->intr_timer_thres_us);
  1318. /* For HK v2 this should be (srng->intr_timer_thres_us >> 3) */
  1319. }
  1320. if (srng->intr_batch_cntr_thres_entries) {
  1321. reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX0,
  1322. BATCH_COUNTER_THRESHOLD),
  1323. srng->intr_batch_cntr_thres_entries *
  1324. srng->entry_size);
  1325. }
  1326. SRNG_SRC_REG_WRITE(srng, CONSUMER_INT_SETUP_IX0, reg_val);
  1327. reg_val = 0;
  1328. if (srng->flags & HAL_SRNG_LOW_THRES_INTR_ENABLE) {
  1329. reg_val |= SRNG_SM(SRNG_SRC_FLD(CONSUMER_INT_SETUP_IX1,
  1330. LOW_THRESHOLD), srng->u.src_ring.low_threshold);
  1331. }
  1332. SRNG_SRC_REG_WRITE(srng, CONSUMER_INT_SETUP_IX1, reg_val);
  1333. /* As per HW team, TP_ADDR and HP_ADDR for Idle link ring should
  1334. * remain 0 to avoid some WBM stability issues. Remote head/tail
  1335. * pointers are not required since this ring is completely managed
  1336. * by WBM HW
  1337. */
  1338. if (srng->ring_id != HAL_SRNG_WBM_IDLE_LINK) {
  1339. tp_addr = (uint64_t)(hal->shadow_rdptr_mem_paddr +
  1340. ((unsigned long)(srng->u.src_ring.tp_addr) -
  1341. (unsigned long)(hal->shadow_rdptr_mem_vaddr)));
  1342. SRNG_SRC_REG_WRITE(srng, TP_ADDR_LSB, tp_addr & 0xffffffff);
  1343. SRNG_SRC_REG_WRITE(srng, TP_ADDR_MSB, tp_addr >> 32);
  1344. }
  1345. /* Initilaize head and tail pointers to indicate ring is empty */
  1346. SRNG_SRC_REG_WRITE(srng, HP, 0);
  1347. SRNG_SRC_REG_WRITE(srng, TP, 0);
  1348. *(srng->u.src_ring.tp_addr) = 0;
  1349. reg_val = ((srng->flags & HAL_SRNG_DATA_TLV_SWAP) ?
  1350. SRNG_SM(SRNG_SRC_FLD(MISC, DATA_TLV_SWAP_BIT), 1) : 0) |
  1351. ((srng->flags & HAL_SRNG_RING_PTR_SWAP) ?
  1352. SRNG_SM(SRNG_SRC_FLD(MISC, HOST_FW_SWAP_BIT), 1) : 0) |
  1353. ((srng->flags & HAL_SRNG_MSI_SWAP) ?
  1354. SRNG_SM(SRNG_SRC_FLD(MISC, MSI_SWAP_BIT), 1) : 0);
  1355. /* Loop count is not used for SRC rings */
  1356. reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, LOOPCNT_DISABLE), 1);
  1357. /*
  1358. * reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, SRNG_ENABLE), 1);
  1359. * todo: update fw_api and replace with above line
  1360. * (when SRNG_ENABLE field for the MISC register is available in fw_api)
  1361. * (WCSS_UMAC_CE_0_SRC_WFSS_CE_CHANNEL_SRC_R0_SRC_RING_MISC)
  1362. */
  1363. reg_val |= 0x40;
  1364. SRNG_SRC_REG_WRITE(srng, MISC, reg_val);
  1365. }
  1366. /**
  1367. * hal_srng_dst_hw_init - Private function to initialize SRNG
  1368. * destination ring HW
  1369. * @hal_soc: HAL SOC handle
  1370. * @srng: SRNG ring pointer
  1371. */
  1372. static inline void hal_srng_dst_hw_init_generic(void *halsoc,
  1373. struct hal_srng *srng)
  1374. {
  1375. struct hal_soc *hal = (struct hal_soc *)halsoc;
  1376. uint32_t reg_val = 0;
  1377. uint64_t hp_addr = 0;
  1378. HIF_DBG("%s: hw_init srng %d", __func__, srng->ring_id);
  1379. if (srng->flags & HAL_SRNG_MSI_INTR) {
  1380. SRNG_DST_REG_WRITE(srng, MSI1_BASE_LSB,
  1381. srng->msi_addr & 0xffffffff);
  1382. reg_val = SRNG_SM(SRNG_DST_FLD(MSI1_BASE_MSB, ADDR),
  1383. (uint64_t)(srng->msi_addr) >> 32) |
  1384. SRNG_SM(SRNG_DST_FLD(MSI1_BASE_MSB,
  1385. MSI1_ENABLE), 1);
  1386. SRNG_DST_REG_WRITE(srng, MSI1_BASE_MSB, reg_val);
  1387. SRNG_DST_REG_WRITE(srng, MSI1_DATA, srng->msi_data);
  1388. }
  1389. SRNG_DST_REG_WRITE(srng, BASE_LSB, srng->ring_base_paddr & 0xffffffff);
  1390. reg_val = SRNG_SM(SRNG_DST_FLD(BASE_MSB, RING_BASE_ADDR_MSB),
  1391. ((uint64_t)(srng->ring_base_paddr) >> 32)) |
  1392. SRNG_SM(SRNG_DST_FLD(BASE_MSB, RING_SIZE),
  1393. srng->entry_size * srng->num_entries);
  1394. SRNG_DST_REG_WRITE(srng, BASE_MSB, reg_val);
  1395. reg_val = SRNG_SM(SRNG_DST_FLD(ID, RING_ID), srng->ring_id) |
  1396. SRNG_SM(SRNG_DST_FLD(ID, ENTRY_SIZE), srng->entry_size);
  1397. SRNG_DST_REG_WRITE(srng, ID, reg_val);
  1398. /**
  1399. * Interrupt setup:
  1400. * Default interrupt mode is 'pulse'. Need to setup SW_INTERRUPT_MODE
  1401. * if level mode is required
  1402. */
  1403. reg_val = 0;
  1404. if (srng->intr_timer_thres_us) {
  1405. reg_val |= SRNG_SM(SRNG_DST_FLD(PRODUCER_INT_SETUP,
  1406. INTERRUPT_TIMER_THRESHOLD),
  1407. srng->intr_timer_thres_us >> 3);
  1408. }
  1409. if (srng->intr_batch_cntr_thres_entries) {
  1410. reg_val |= SRNG_SM(SRNG_DST_FLD(PRODUCER_INT_SETUP,
  1411. BATCH_COUNTER_THRESHOLD),
  1412. srng->intr_batch_cntr_thres_entries *
  1413. srng->entry_size);
  1414. }
  1415. SRNG_DST_REG_WRITE(srng, PRODUCER_INT_SETUP, reg_val);
  1416. hp_addr = (uint64_t)(hal->shadow_rdptr_mem_paddr +
  1417. ((unsigned long)(srng->u.dst_ring.hp_addr) -
  1418. (unsigned long)(hal->shadow_rdptr_mem_vaddr)));
  1419. SRNG_DST_REG_WRITE(srng, HP_ADDR_LSB, hp_addr & 0xffffffff);
  1420. SRNG_DST_REG_WRITE(srng, HP_ADDR_MSB, hp_addr >> 32);
  1421. /* Initilaize head and tail pointers to indicate ring is empty */
  1422. SRNG_DST_REG_WRITE(srng, HP, 0);
  1423. SRNG_DST_REG_WRITE(srng, TP, 0);
  1424. *(srng->u.dst_ring.hp_addr) = 0;
  1425. reg_val = ((srng->flags & HAL_SRNG_DATA_TLV_SWAP) ?
  1426. SRNG_SM(SRNG_DST_FLD(MISC, DATA_TLV_SWAP_BIT), 1) : 0) |
  1427. ((srng->flags & HAL_SRNG_RING_PTR_SWAP) ?
  1428. SRNG_SM(SRNG_DST_FLD(MISC, HOST_FW_SWAP_BIT), 1) : 0) |
  1429. ((srng->flags & HAL_SRNG_MSI_SWAP) ?
  1430. SRNG_SM(SRNG_DST_FLD(MISC, MSI_SWAP_BIT), 1) : 0);
  1431. /*
  1432. * reg_val |= SRNG_SM(SRNG_SRC_FLD(MISC, SRNG_ENABLE), 1);
  1433. * todo: update fw_api and replace with above line
  1434. * (when SRNG_ENABLE field for the MISC register is available in fw_api)
  1435. * (WCSS_UMAC_CE_0_SRC_WFSS_CE_CHANNEL_SRC_R0_SRC_RING_MISC)
  1436. */
  1437. reg_val |= 0x40;
  1438. SRNG_DST_REG_WRITE(srng, MISC, reg_val);
  1439. }
  1440. #define HAL_RX_WBM_ERR_SRC_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
  1441. (WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_OFFSET >> 2))) & \
  1442. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_MASK) >> \
  1443. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_LSB)
  1444. #define HAL_RX_WBM_REO_PUSH_REASON_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
  1445. (WBM_RELEASE_RING_2_REO_PUSH_REASON_OFFSET >> 2))) & \
  1446. WBM_RELEASE_RING_2_REO_PUSH_REASON_MASK) >> \
  1447. WBM_RELEASE_RING_2_REO_PUSH_REASON_LSB)
  1448. #define HAL_RX_WBM_REO_ERROR_CODE_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
  1449. (WBM_RELEASE_RING_2_REO_ERROR_CODE_OFFSET >> 2))) & \
  1450. WBM_RELEASE_RING_2_REO_ERROR_CODE_MASK) >> \
  1451. WBM_RELEASE_RING_2_REO_ERROR_CODE_LSB)
  1452. #define HAL_RX_WBM_RXDMA_PUSH_REASON_GET(wbm_desc) \
  1453. (((*(((uint32_t *) wbm_desc) + \
  1454. (WBM_RELEASE_RING_2_RXDMA_PUSH_REASON_OFFSET >> 2))) & \
  1455. WBM_RELEASE_RING_2_RXDMA_PUSH_REASON_MASK) >> \
  1456. WBM_RELEASE_RING_2_RXDMA_PUSH_REASON_LSB)
  1457. #define HAL_RX_WBM_RXDMA_ERROR_CODE_GET(wbm_desc) \
  1458. (((*(((uint32_t *) wbm_desc) + \
  1459. (WBM_RELEASE_RING_2_RXDMA_ERROR_CODE_OFFSET >> 2))) & \
  1460. WBM_RELEASE_RING_2_RXDMA_ERROR_CODE_MASK) >> \
  1461. WBM_RELEASE_RING_2_RXDMA_ERROR_CODE_LSB)
  1462. /**
  1463. * hal_rx_wbm_err_info_get_generic(): Retrieves WBM error code and reason and
  1464. * save it to hal_wbm_err_desc_info structure passed by caller
  1465. * @wbm_desc: wbm ring descriptor
  1466. * @wbm_er_info1: hal_wbm_err_desc_info structure, output parameter.
  1467. * Return: void
  1468. */
  1469. static inline void hal_rx_wbm_err_info_get_generic(void *wbm_desc,
  1470. void *wbm_er_info1)
  1471. {
  1472. struct hal_wbm_err_desc_info *wbm_er_info =
  1473. (struct hal_wbm_err_desc_info *)wbm_er_info1;
  1474. wbm_er_info->wbm_err_src = HAL_RX_WBM_ERR_SRC_GET(wbm_desc);
  1475. wbm_er_info->reo_psh_rsn = HAL_RX_WBM_REO_PUSH_REASON_GET(wbm_desc);
  1476. wbm_er_info->reo_err_code = HAL_RX_WBM_REO_ERROR_CODE_GET(wbm_desc);
  1477. wbm_er_info->rxdma_psh_rsn = HAL_RX_WBM_RXDMA_PUSH_REASON_GET(wbm_desc);
  1478. wbm_er_info->rxdma_err_code = HAL_RX_WBM_RXDMA_ERROR_CODE_GET(wbm_desc);
  1479. }
  1480. /**
  1481. * hal_tx_comp_get_release_reason_generic() - TQM Release reason
  1482. * @hal_desc: completion ring descriptor pointer
  1483. *
  1484. * This function will return the type of pointer - buffer or descriptor
  1485. *
  1486. * Return: buffer type
  1487. */
  1488. static inline uint8_t hal_tx_comp_get_release_reason_generic(void *hal_desc)
  1489. {
  1490. uint32_t comp_desc =
  1491. *(uint32_t *) (((uint8_t *) hal_desc) +
  1492. WBM_RELEASE_RING_2_TQM_RELEASE_REASON_OFFSET);
  1493. return (comp_desc & WBM_RELEASE_RING_2_TQM_RELEASE_REASON_MASK) >>
  1494. WBM_RELEASE_RING_2_TQM_RELEASE_REASON_LSB;
  1495. }
  1496. /**
  1497. * hal_rx_dump_mpdu_start_tlv_generic: dump RX mpdu_start TLV in structured
  1498. * human readable format.
  1499. * @mpdu_start: pointer the rx_attention TLV in pkt.
  1500. * @dbg_level: log level.
  1501. *
  1502. * Return: void
  1503. */
  1504. static inline void hal_rx_dump_mpdu_start_tlv_generic(void *mpdustart,
  1505. uint8_t dbg_level)
  1506. {
  1507. struct rx_mpdu_start *mpdu_start = (struct rx_mpdu_start *)mpdustart;
  1508. struct rx_mpdu_info *mpdu_info =
  1509. (struct rx_mpdu_info *)&mpdu_start->rx_mpdu_info_details;
  1510. QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
  1511. "rx_mpdu_start tlv (1/5) - "
  1512. "rxpcu_mpdu_filter_in_category: %x "
  1513. "sw_frame_group_id: %x "
  1514. "ndp_frame: %x "
  1515. "phy_err: %x "
  1516. "phy_err_during_mpdu_header: %x "
  1517. "protocol_version_err: %x "
  1518. "ast_based_lookup_valid: %x "
  1519. "phy_ppdu_id: %x "
  1520. "ast_index: %x "
  1521. "sw_peer_id: %x "
  1522. "mpdu_frame_control_valid: %x "
  1523. "mpdu_duration_valid: %x "
  1524. "mac_addr_ad1_valid: %x "
  1525. "mac_addr_ad2_valid: %x "
  1526. "mac_addr_ad3_valid: %x "
  1527. "mac_addr_ad4_valid: %x "
  1528. "mpdu_sequence_control_valid: %x "
  1529. "mpdu_qos_control_valid: %x "
  1530. "mpdu_ht_control_valid: %x "
  1531. "frame_encryption_info_valid: %x ",
  1532. mpdu_info->rxpcu_mpdu_filter_in_category,
  1533. mpdu_info->sw_frame_group_id,
  1534. mpdu_info->ndp_frame,
  1535. mpdu_info->phy_err,
  1536. mpdu_info->phy_err_during_mpdu_header,
  1537. mpdu_info->protocol_version_err,
  1538. mpdu_info->ast_based_lookup_valid,
  1539. mpdu_info->phy_ppdu_id,
  1540. mpdu_info->ast_index,
  1541. mpdu_info->sw_peer_id,
  1542. mpdu_info->mpdu_frame_control_valid,
  1543. mpdu_info->mpdu_duration_valid,
  1544. mpdu_info->mac_addr_ad1_valid,
  1545. mpdu_info->mac_addr_ad2_valid,
  1546. mpdu_info->mac_addr_ad3_valid,
  1547. mpdu_info->mac_addr_ad4_valid,
  1548. mpdu_info->mpdu_sequence_control_valid,
  1549. mpdu_info->mpdu_qos_control_valid,
  1550. mpdu_info->mpdu_ht_control_valid,
  1551. mpdu_info->frame_encryption_info_valid);
  1552. QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
  1553. "rx_mpdu_start tlv (2/5) - "
  1554. "fr_ds: %x "
  1555. "to_ds: %x "
  1556. "encrypted: %x "
  1557. "mpdu_retry: %x "
  1558. "mpdu_sequence_number: %x "
  1559. "epd_en: %x "
  1560. "all_frames_shall_be_encrypted: %x "
  1561. "encrypt_type: %x "
  1562. "mesh_sta: %x "
  1563. "bssid_hit: %x "
  1564. "bssid_number: %x "
  1565. "tid: %x "
  1566. "pn_31_0: %x "
  1567. "pn_63_32: %x "
  1568. "pn_95_64: %x "
  1569. "pn_127_96: %x "
  1570. "peer_meta_data: %x "
  1571. "rxpt_classify_info.reo_destination_indication: %x "
  1572. "rxpt_classify_info.use_flow_id_toeplitz_clfy: %x "
  1573. "rx_reo_queue_desc_addr_31_0: %x ",
  1574. mpdu_info->fr_ds,
  1575. mpdu_info->to_ds,
  1576. mpdu_info->encrypted,
  1577. mpdu_info->mpdu_retry,
  1578. mpdu_info->mpdu_sequence_number,
  1579. mpdu_info->epd_en,
  1580. mpdu_info->all_frames_shall_be_encrypted,
  1581. mpdu_info->encrypt_type,
  1582. mpdu_info->mesh_sta,
  1583. mpdu_info->bssid_hit,
  1584. mpdu_info->bssid_number,
  1585. mpdu_info->tid,
  1586. mpdu_info->pn_31_0,
  1587. mpdu_info->pn_63_32,
  1588. mpdu_info->pn_95_64,
  1589. mpdu_info->pn_127_96,
  1590. mpdu_info->peer_meta_data,
  1591. mpdu_info->rxpt_classify_info_details.reo_destination_indication,
  1592. mpdu_info->rxpt_classify_info_details.use_flow_id_toeplitz_clfy,
  1593. mpdu_info->rx_reo_queue_desc_addr_31_0);
  1594. QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
  1595. "rx_mpdu_start tlv (3/5) - "
  1596. "rx_reo_queue_desc_addr_39_32: %x "
  1597. "receive_queue_number: %x "
  1598. "pre_delim_err_warning: %x "
  1599. "first_delim_err: %x "
  1600. "key_id_octet: %x "
  1601. "new_peer_entry: %x "
  1602. "decrypt_needed: %x "
  1603. "decap_type: %x "
  1604. "rx_insert_vlan_c_tag_padding: %x "
  1605. "rx_insert_vlan_s_tag_padding: %x "
  1606. "strip_vlan_c_tag_decap: %x "
  1607. "strip_vlan_s_tag_decap: %x "
  1608. "pre_delim_count: %x "
  1609. "ampdu_flag: %x "
  1610. "bar_frame: %x "
  1611. "mpdu_length: %x "
  1612. "first_mpdu: %x "
  1613. "mcast_bcast: %x "
  1614. "ast_index_not_found: %x "
  1615. "ast_index_timeout: %x ",
  1616. mpdu_info->rx_reo_queue_desc_addr_39_32,
  1617. mpdu_info->receive_queue_number,
  1618. mpdu_info->pre_delim_err_warning,
  1619. mpdu_info->first_delim_err,
  1620. mpdu_info->key_id_octet,
  1621. mpdu_info->new_peer_entry,
  1622. mpdu_info->decrypt_needed,
  1623. mpdu_info->decap_type,
  1624. mpdu_info->rx_insert_vlan_c_tag_padding,
  1625. mpdu_info->rx_insert_vlan_s_tag_padding,
  1626. mpdu_info->strip_vlan_c_tag_decap,
  1627. mpdu_info->strip_vlan_s_tag_decap,
  1628. mpdu_info->pre_delim_count,
  1629. mpdu_info->ampdu_flag,
  1630. mpdu_info->bar_frame,
  1631. mpdu_info->mpdu_length,
  1632. mpdu_info->first_mpdu,
  1633. mpdu_info->mcast_bcast,
  1634. mpdu_info->ast_index_not_found,
  1635. mpdu_info->ast_index_timeout);
  1636. QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
  1637. "rx_mpdu_start tlv (4/5) - "
  1638. "power_mgmt: %x "
  1639. "non_qos: %x "
  1640. "null_data: %x "
  1641. "mgmt_type: %x "
  1642. "ctrl_type: %x "
  1643. "more_data: %x "
  1644. "eosp: %x "
  1645. "fragment_flag: %x "
  1646. "order: %x "
  1647. "u_apsd_trigger: %x "
  1648. "encrypt_required: %x "
  1649. "directed: %x "
  1650. "mpdu_frame_control_field: %x "
  1651. "mpdu_duration_field: %x "
  1652. "mac_addr_ad1_31_0: %x "
  1653. "mac_addr_ad1_47_32: %x "
  1654. "mac_addr_ad2_15_0: %x "
  1655. "mac_addr_ad2_47_16: %x "
  1656. "mac_addr_ad3_31_0: %x "
  1657. "mac_addr_ad3_47_32: %x ",
  1658. mpdu_info->power_mgmt,
  1659. mpdu_info->non_qos,
  1660. mpdu_info->null_data,
  1661. mpdu_info->mgmt_type,
  1662. mpdu_info->ctrl_type,
  1663. mpdu_info->more_data,
  1664. mpdu_info->eosp,
  1665. mpdu_info->fragment_flag,
  1666. mpdu_info->order,
  1667. mpdu_info->u_apsd_trigger,
  1668. mpdu_info->encrypt_required,
  1669. mpdu_info->directed,
  1670. mpdu_info->mpdu_frame_control_field,
  1671. mpdu_info->mpdu_duration_field,
  1672. mpdu_info->mac_addr_ad1_31_0,
  1673. mpdu_info->mac_addr_ad1_47_32,
  1674. mpdu_info->mac_addr_ad2_15_0,
  1675. mpdu_info->mac_addr_ad2_47_16,
  1676. mpdu_info->mac_addr_ad3_31_0,
  1677. mpdu_info->mac_addr_ad3_47_32);
  1678. QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
  1679. "rx_mpdu_start tlv (5/5) - "
  1680. "mpdu_sequence_control_field: %x "
  1681. "mac_addr_ad4_31_0: %x "
  1682. "mac_addr_ad4_47_32: %x "
  1683. "mpdu_qos_control_field: %x "
  1684. "mpdu_ht_control_field: %x ",
  1685. mpdu_info->mpdu_sequence_control_field,
  1686. mpdu_info->mac_addr_ad4_31_0,
  1687. mpdu_info->mac_addr_ad4_47_32,
  1688. mpdu_info->mpdu_qos_control_field,
  1689. mpdu_info->mpdu_ht_control_field);
  1690. }
  1691. #endif
  1692. /**
  1693. * hal_tx_desc_set_search_type - Set the search type value
  1694. * @desc: Handle to Tx Descriptor
  1695. * @search_type: search type
  1696. * 0 – Normal search
  1697. * 1 – Index based address search
  1698. * 2 – Index based flow search
  1699. *
  1700. * Return: void
  1701. */
  1702. #ifdef TCL_DATA_CMD_2_SEARCH_TYPE_OFFSET
  1703. static void hal_tx_desc_set_search_type_generic(void *desc,
  1704. uint8_t search_type)
  1705. {
  1706. HAL_SET_FLD(desc, TCL_DATA_CMD_2, SEARCH_TYPE) |=
  1707. HAL_TX_SM(TCL_DATA_CMD_2, SEARCH_TYPE, search_type);
  1708. }
  1709. #else
  1710. static void hal_tx_desc_set_search_type_generic(void *desc,
  1711. uint8_t search_type)
  1712. {
  1713. }
  1714. #endif
  1715. /**
  1716. * hal_tx_desc_set_search_index - Set the search index value
  1717. * @desc: Handle to Tx Descriptor
  1718. * @search_index: The index that will be used for index based address or
  1719. * flow search. The field is valid when 'search_type' is
  1720. * 1 0r 2
  1721. *
  1722. * Return: void
  1723. */
  1724. #ifdef TCL_DATA_CMD_5_SEARCH_INDEX_OFFSET
  1725. static void hal_tx_desc_set_search_index_generic(void *desc,
  1726. uint32_t search_index)
  1727. {
  1728. HAL_SET_FLD(desc, TCL_DATA_CMD_5, SEARCH_INDEX) |=
  1729. HAL_TX_SM(TCL_DATA_CMD_5, SEARCH_INDEX, search_index);
  1730. }
  1731. #else
  1732. static void hal_tx_desc_set_search_index_generic(void *desc,
  1733. uint32_t search_index)
  1734. {
  1735. }
  1736. #endif