hal_generic_api.h 67 KB

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