hal_rx.h 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _HAL_RX_H_
  20. #define _HAL_RX_H_
  21. #include <hal_api.h>
  22. #include "hal_rx_hw_defines.h"
  23. #include "hal_hw_headers.h"
  24. /*************************************
  25. * Ring desc offset/shift/masks
  26. *************************************/
  27. #define HAL_INVALID_PPDU_ID 0xFFFFFFFF
  28. #define HAL_RX_OFFSET(block, field) block##_##field##_OFFSET
  29. #define HAL_RX_LSB(block, field) block##_##field##_LSB
  30. #define HAL_RX_MASK(block, field) block##_##field##_MASK
  31. #define HAL_RX_GET(_ptr, block, field) \
  32. (((*((volatile uint32_t *)_ptr + (HAL_RX_OFFSET(block, field)>>2))) & \
  33. HAL_RX_MASK(block, field)) >> \
  34. HAL_RX_LSB(block, field))
  35. #define HAL_RX_GET_64(_ptr, block, field) \
  36. (((*((volatile uint64_t *)(_ptr) + \
  37. (HAL_RX_OFFSET(block, field) >> 3))) & \
  38. HAL_RX_MASK(block, field)) >> \
  39. HAL_RX_LSB(block, field))
  40. #define HAL_RX_FLD_SET(_ptr, _wrd, _field, _val) \
  41. (*(uint32_t *)(((uint8_t *)_ptr) + \
  42. _wrd ## _ ## _field ## _OFFSET) |= \
  43. (((_val) << _wrd ## _ ## _field ## _LSB) & \
  44. _wrd ## _ ## _field ## _MASK))
  45. /* BUFFER_SIZE = 1536 data bytes + 384 RX TLV bytes + some spare bytes */
  46. #ifndef RX_DATA_BUFFER_SIZE
  47. #define RX_DATA_BUFFER_SIZE 2048
  48. #endif
  49. #ifndef RX_MONITOR_BUFFER_SIZE
  50. #define RX_MONITOR_BUFFER_SIZE 2048
  51. #endif
  52. #define RXDMA_OPTIMIZATION
  53. /* MONITOR STATUS BUFFER SIZE = 1408 data bytes, buffer allocation of 2k bytes
  54. * including buffer reservation, buffer alignment and skb shared info size.
  55. */
  56. #define RX_MON_STATUS_BASE_BUF_SIZE 2048
  57. #define RX_MON_STATUS_BUF_ALIGN 128
  58. #define RX_MON_STATUS_BUF_RESERVATION 128
  59. #define RX_MON_STATUS_BUF_SIZE (RX_MON_STATUS_BASE_BUF_SIZE - \
  60. (RX_MON_STATUS_BUF_RESERVATION + \
  61. RX_MON_STATUS_BUF_ALIGN + QDF_SHINFO_SIZE))
  62. #define NUM_OF_DWORDS_BUFFER_ADDR_INFO 2
  63. /* HAL_RX_NON_QOS_TID = NON_QOS_TID which is 16 */
  64. #define HAL_RX_NON_QOS_TID 16
  65. enum {
  66. HAL_HW_RX_DECAP_FORMAT_RAW = 0,
  67. HAL_HW_RX_DECAP_FORMAT_NWIFI,
  68. HAL_HW_RX_DECAP_FORMAT_ETH2,
  69. HAL_HW_RX_DECAP_FORMAT_8023,
  70. };
  71. /**
  72. * struct hal_wbm_err_desc_info: structure to hold wbm error codes and reasons
  73. *
  74. * @reo_psh_rsn: REO push reason
  75. * @reo_err_code: REO Error code
  76. * @rxdma_psh_rsn: RXDMA push reason
  77. * @rxdma_err_code: RXDMA Error code
  78. * @reserved_1: Reserved bits
  79. * @wbm_err_src: WBM error source
  80. * @pool_id: pool ID, indicates which rxdma pool
  81. * @reserved_2: Reserved bits
  82. */
  83. struct hal_wbm_err_desc_info {
  84. uint16_t reo_psh_rsn:2,
  85. reo_err_code:5,
  86. rxdma_psh_rsn:2,
  87. rxdma_err_code:5,
  88. reserved_1:2;
  89. uint8_t wbm_err_src:3,
  90. pool_id:2,
  91. msdu_continued:1,
  92. reserved_2:2;
  93. };
  94. /**
  95. * hal_rx_mon_dest_buf_info: Structure to hold rx mon dest buffer info
  96. * @first_buffer: First buffer of MSDU
  97. * @last_buffer: Last buffer of MSDU
  98. * @is_decap_raw: Is RAW Frame
  99. * @reserved_1: Reserved
  100. *
  101. * MSDU with continuation:
  102. * -----------------------------------------------------------
  103. * | first_buffer:1 | first_buffer: 0 | ... | first_buffer: 0 |
  104. * | last_buffer :0 | last_buffer : 0 | ... | last_buffer : 0 |
  105. * | is_decap_raw:1/0 | Same as earlier | Same as earlier|
  106. * -----------------------------------------------------------
  107. *
  108. * Single buffer MSDU:
  109. * ------------------
  110. * | first_buffer:1 |
  111. * | last_buffer :1 |
  112. * | is_decap_raw:1/0 |
  113. * ------------------
  114. */
  115. struct hal_rx_mon_dest_buf_info {
  116. uint8_t first_buffer:1,
  117. last_buffer:1,
  118. is_decap_raw:1,
  119. reserved_1:5;
  120. };
  121. /**
  122. * struct hal_rx_msdu_metadata:Structure to hold rx fast path information.
  123. *
  124. * @l3_hdr_pad: l3 header padding
  125. * @reserved: Reserved bits
  126. * @sa_sw_peer_id: sa sw peer id
  127. * @sa_idx: sa index
  128. * @da_idx: da index
  129. */
  130. struct hal_rx_msdu_metadata {
  131. uint32_t l3_hdr_pad:16,
  132. sa_sw_peer_id:16;
  133. uint32_t sa_idx:16,
  134. da_idx:16;
  135. };
  136. struct hal_proto_params {
  137. uint8_t tcp_proto;
  138. uint8_t udp_proto;
  139. uint8_t ipv6_proto;
  140. };
  141. /**
  142. * enum hal_reo_error_code: Enum which encapsulates "reo_push_reason"
  143. *
  144. * @ HAL_REO_ERROR_DETECTED: Packets arrived because of an error detected
  145. * @ HAL_REO_ROUTING_INSTRUCTION: Packets arrived because of REO routing
  146. */
  147. enum hal_reo_error_status {
  148. HAL_REO_ERROR_DETECTED = 0,
  149. HAL_REO_ROUTING_INSTRUCTION = 1,
  150. };
  151. /**
  152. * @msdu_flags: [0] first_msdu_in_mpdu
  153. * [1] last_msdu_in_mpdu
  154. * [2] msdu_continuation - MSDU spread across buffers
  155. * [23] sa_is_valid - SA match in peer table
  156. * [24] sa_idx_timeout - Timeout while searching for SA match
  157. * [25] da_is_valid - Used to identtify intra-bss forwarding
  158. * [26] da_is_MCBC
  159. * [27] da_idx_timeout - Timeout while searching for DA match
  160. *
  161. */
  162. struct hal_rx_msdu_desc_info {
  163. uint32_t msdu_flags;
  164. uint16_t msdu_len; /* 14 bits for length */
  165. };
  166. /**
  167. * enum hal_rx_msdu_desc_flags: Enum for flags in MSDU_DESC_INFO
  168. *
  169. * @ HAL_MSDU_F_FIRST_MSDU_IN_MPDU: First MSDU in MPDU
  170. * @ HAL_MSDU_F_LAST_MSDU_IN_MPDU: Last MSDU in MPDU
  171. * @ HAL_MSDU_F_MSDU_CONTINUATION: MSDU continuation
  172. * @ HAL_MSDU_F_SA_IS_VALID: Found match for SA in AST
  173. * @ HAL_MSDU_F_SA_IDX_TIMEOUT: AST search for SA timed out
  174. * @ HAL_MSDU_F_DA_IS_VALID: Found match for DA in AST
  175. * @ HAL_MSDU_F_DA_IS_MCBC: DA is MC/BC address
  176. * @ HAL_MSDU_F_DA_IDX_TIMEOUT: AST search for DA timed out
  177. * @ HAL_MSDU_F_INTRA_BSS: This is an intrabss packet
  178. */
  179. enum hal_rx_msdu_desc_flags {
  180. HAL_MSDU_F_FIRST_MSDU_IN_MPDU = (0x1 << 0),
  181. HAL_MSDU_F_LAST_MSDU_IN_MPDU = (0x1 << 1),
  182. HAL_MSDU_F_MSDU_CONTINUATION = (0x1 << 2),
  183. HAL_MSDU_F_SA_IS_VALID = (0x1 << 23),
  184. HAL_MSDU_F_SA_IDX_TIMEOUT = (0x1 << 24),
  185. HAL_MSDU_F_DA_IS_VALID = (0x1 << 25),
  186. HAL_MSDU_F_DA_IS_MCBC = (0x1 << 26),
  187. HAL_MSDU_F_DA_IDX_TIMEOUT = (0x1 << 27),
  188. HAL_MSDU_F_INTRA_BSS = (0x1 << 28),
  189. };
  190. /*
  191. * @msdu_count: no. of msdus in the MPDU
  192. * @mpdu_seq: MPDU sequence number
  193. * @mpdu_flags [0] Fragment flag
  194. * [1] MPDU_retry_bit
  195. * [2] AMPDU flag
  196. * [3] raw_ampdu
  197. * @peer_meta_data: Upper bits containing peer id, vdev id
  198. * @bar_frame: indicates if received frame is a bar frame
  199. * @tid: tid value of received MPDU
  200. */
  201. struct hal_rx_mpdu_desc_info {
  202. uint16_t msdu_count;
  203. uint16_t mpdu_seq; /* 12 bits for length */
  204. uint32_t mpdu_flags;
  205. uint32_t peer_meta_data; /* sw progamed meta-data:MAC Id & peer Id */
  206. uint16_t bar_frame;
  207. uint8_t tid:4,
  208. reserved:4;
  209. };
  210. /**
  211. * enum hal_rx_mpdu_desc_flags: Enum for flags in MPDU_DESC_INFO
  212. *
  213. * @ HAL_MPDU_F_FRAGMENT: Fragmented MPDU (802.11 fragemtation)
  214. * @ HAL_MPDU_F_RETRY_BIT: Retry bit is set in FC of MPDU
  215. * @ HAL_MPDU_F_AMPDU_FLAG: MPDU received as part of A-MPDU
  216. * @ HAL_MPDU_F_RAW_AMPDU: MPDU is a Raw MDPU
  217. * @ HAL_MPDU_F_QOS_CONTROL_VALID: MPDU has a QoS control field
  218. */
  219. enum hal_rx_mpdu_desc_flags {
  220. HAL_MPDU_F_FRAGMENT = (0x1 << 20),
  221. HAL_MPDU_F_RETRY_BIT = (0x1 << 21),
  222. HAL_MPDU_F_AMPDU_FLAG = (0x1 << 22),
  223. HAL_MPDU_F_RAW_AMPDU = (0x1 << 30),
  224. HAL_MPDU_F_QOS_CONTROL_VALID = (0x1 << 31)
  225. };
  226. /* Return Buffer manager ID */
  227. #define HAL_RX_BUF_RBM_WBM_IDLE_BUF_LIST 0
  228. #define HAL_RX_BUF_RBM_WBM_CHIP0_IDLE_DESC_LIST 1
  229. #define HAL_RX_BUF_RBM_WBM_CHIP1_IDLE_DESC_LIST 2
  230. #define HAL_RX_BUF_RBM_WBM_CHIP2_IDLE_DESC_LIST 3
  231. #define HAL_RX_BUF_RBM_SW0_BM(sw0_bm_id) (sw0_bm_id)
  232. #define HAL_RX_BUF_RBM_SW1_BM(sw0_bm_id) (sw0_bm_id + 1)
  233. #define HAL_RX_BUF_RBM_SW2_BM(sw0_bm_id) (sw0_bm_id + 2)
  234. #define HAL_RX_BUF_RBM_SW3_BM(sw0_bm_id) (sw0_bm_id + 3)
  235. #define HAL_RX_BUF_RBM_SW4_BM(sw0_bm_id) (sw0_bm_id + 4)
  236. #define HAL_RX_BUF_RBM_SW5_BM(sw0_bm_id) (sw0_bm_id + 5)
  237. #define HAL_RX_BUF_RBM_SW6_BM(sw0_bm_id) (sw0_bm_id + 6)
  238. #define HAL_RX_BUF_RBM_SW_BM(sw0_bm_id, wbm2sw_id) (sw0_bm_id + wbm2sw_id)
  239. #define HAL_REO_DESTINATION_RING_MSDU_COUNT_OFFSET 0x8
  240. #define HAL_REO_DESTINATION_RING_MSDU_COUNT_LSB 0
  241. #define HAL_REO_DESTINATION_RING_MSDU_COUNT_MASK 0x000000ff
  242. #define HAL_RX_REO_DESC_MSDU_COUNT_GET(reo_desc) \
  243. (_HAL_MS((*_OFFSET_TO_WORD_PTR(reo_desc, \
  244. HAL_REO_DESTINATION_RING_MSDU_COUNT_OFFSET)), \
  245. HAL_REO_DESTINATION_RING_MSDU_COUNT_MASK, \
  246. HAL_REO_DESTINATION_RING_MSDU_COUNT_LSB))
  247. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET 0x0
  248. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_LSB 0
  249. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_MASK 0xffffffff
  250. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET 0x4
  251. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_LSB 0
  252. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_MASK 0x000000ff
  253. /*
  254. * macro to set the LSW of the nbuf data physical address
  255. * to the rxdma ring entry
  256. */
  257. #define HAL_RXDMA_PADDR_LO_SET(buff_addr_info, paddr_lo) \
  258. ((*(((unsigned int *) buff_addr_info) + \
  259. (HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET >> 2))) = \
  260. (paddr_lo << HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_LSB) & \
  261. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_MASK)
  262. /*
  263. * macro to set the LSB of MSW of the nbuf data physical address
  264. * to the rxdma ring entry
  265. */
  266. #define HAL_RXDMA_PADDR_HI_SET(buff_addr_info, paddr_hi) \
  267. ((*(((unsigned int *) buff_addr_info) + \
  268. (HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET >> 2))) = \
  269. (paddr_hi << HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_LSB) & \
  270. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_MASK)
  271. #ifdef DP_RX_DESC_COOKIE_INVALIDATE
  272. #define HAL_RX_COOKIE_INVALID_MASK 0x80000000
  273. /*
  274. * macro to get the invalid bit for sw cookie
  275. */
  276. #define HAL_RX_BUF_COOKIE_INVALID_GET(buff_addr_info) \
  277. ((*(((unsigned int *)buff_addr_info) + \
  278. (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) & \
  279. HAL_RX_COOKIE_INVALID_MASK)
  280. /*
  281. * macro to set the invalid bit for sw cookie
  282. */
  283. #define HAL_RX_BUF_COOKIE_INVALID_SET(buff_addr_info) \
  284. ((*(((unsigned int *)buff_addr_info) + \
  285. (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) |= \
  286. HAL_RX_COOKIE_INVALID_MASK)
  287. /*
  288. * macro to reset the invalid bit for sw cookie
  289. */
  290. #define HAL_RX_BUF_COOKIE_INVALID_RESET(buff_addr_info) \
  291. ((*(((unsigned int *)buff_addr_info) + \
  292. (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) &= \
  293. ~HAL_RX_COOKIE_INVALID_MASK)
  294. #define HAL_RX_REO_BUF_COOKIE_INVALID_GET(reo_desc) \
  295. (HAL_RX_BUF_COOKIE_INVALID_GET(& \
  296. (((struct reo_destination_ring *) \
  297. reo_desc)->buf_or_link_desc_addr_info)))
  298. #define HAL_RX_REO_BUF_COOKIE_INVALID_SET(reo_desc) \
  299. (HAL_RX_BUF_COOKIE_INVALID_SET(& \
  300. (((struct reo_destination_ring *) \
  301. reo_desc)->buf_or_link_desc_addr_info)))
  302. #define HAL_RX_LINK_COOKIE_INVALID_MASK 0x40000000
  303. #define HAL_RX_BUF_LINK_COOKIE_INVALID_GET(buff_addr_info) \
  304. ((*(((unsigned int *)buff_addr_info) + \
  305. (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) & \
  306. HAL_RX_LINK_COOKIE_INVALID_MASK)
  307. #define HAL_RX_BUF_LINK_COOKIE_INVALID_SET(buff_addr_info) \
  308. ((*(((unsigned int *)buff_addr_info) + \
  309. (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) |= \
  310. HAL_RX_LINK_COOKIE_INVALID_MASK)
  311. #define HAL_RX_REO_BUF_LINK_COOKIE_INVALID_GET(reo_desc) \
  312. (HAL_RX_BUF_LINK_COOKIE_INVALID_GET(& \
  313. (((struct reo_destination_ring *) \
  314. reo_desc)->buf_or_link_desc_addr_info)))
  315. #define HAL_RX_REO_BUF_LINK_COOKIE_INVALID_SET(reo_desc) \
  316. (HAL_RX_BUF_LINK_COOKIE_INVALID_SET(& \
  317. (((struct reo_destination_ring *) \
  318. reo_desc)->buf_or_link_desc_addr_info)))
  319. #endif
  320. /* TODO: Convert the following structure fields accesseses to offsets */
  321. #define HAL_RX_REO_BUFFER_ADDR_39_32_GET(reo_desc) \
  322. (HAL_RX_BUFFER_ADDR_39_32_GET(& \
  323. (((struct reo_destination_ring *) \
  324. reo_desc)->buf_or_link_desc_addr_info)))
  325. #define HAL_RX_REO_BUFFER_ADDR_31_0_GET(reo_desc) \
  326. (HAL_RX_BUFFER_ADDR_31_0_GET(& \
  327. (((struct reo_destination_ring *) \
  328. reo_desc)->buf_or_link_desc_addr_info)))
  329. #define HAL_RX_REO_BUF_COOKIE_INVALID_RESET(reo_desc) \
  330. (HAL_RX_BUF_COOKIE_INVALID_RESET(& \
  331. (((struct reo_destination_ring *) \
  332. reo_desc)->buf_or_link_desc_addr_info)))
  333. #define HAL_RX_UNIFORM_HDR_SET(_rx_msdu_link, _field, _val) \
  334. HAL_RX_FLD_SET(_rx_msdu_link, HAL_UNIFORM_DESCRIPTOR_HEADER, \
  335. _field, _val)
  336. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET 0x0
  337. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_LSB 0
  338. #define HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_MASK 0xffffffff
  339. #define HAL_RX_BUFFER_ADDR_31_0_GET(buff_addr_info) \
  340. (_HAL_MS((*_OFFSET_TO_WORD_PTR(buff_addr_info, \
  341. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET)), \
  342. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_MASK, \
  343. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_LSB))
  344. #define HAL_RX_BUFFER_ADDR_39_32_GET(buff_addr_info) \
  345. (_HAL_MS((*_OFFSET_TO_WORD_PTR(buff_addr_info, \
  346. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET)), \
  347. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_MASK, \
  348. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_LSB))
  349. #define HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_OFFSET 0x0
  350. #define HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_LSB 0
  351. #define HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_MASK 0x00000001
  352. #define HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_OFFSET 0x0
  353. #define HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_LSB 1
  354. #define HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_MASK 0x00000002
  355. #define HAL_RX_FIRST_MSDU_IN_MPDU_FLAG_SET(msdu_info_ptr, val) \
  356. ((*_OFFSET_TO_WORD_PTR(msdu_info_ptr, \
  357. HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_OFFSET)) |= \
  358. (val << HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_LSB) & \
  359. HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_MASK)
  360. #define HAL_RX_LAST_MSDU_IN_MPDU_FLAG_SET(msdu_info_ptr, val) \
  361. ((*_OFFSET_TO_WORD_PTR(msdu_info_ptr, \
  362. HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_OFFSET)) |= \
  363. (val << HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_LSB) & \
  364. HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_MASK)
  365. #define HAL_RX_FIRST_MSDU_IN_MPDU_FLAG_GET(msdu_info_ptr) \
  366. ((*_OFFSET_TO_WORD_PTR(msdu_info_ptr, \
  367. HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_OFFSET)) & \
  368. HAL_RX_MSDU_DESC_INFO_FIRST_MSDU_IN_MPDU_FLAG_MASK)
  369. #define HAL_RX_LAST_MSDU_IN_MPDU_FLAG_GET(msdu_info_ptr) \
  370. ((*_OFFSET_TO_WORD_PTR(msdu_info_ptr, \
  371. HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_OFFSET)) & \
  372. HAL_RX_MSDU_DESC_INFO_LAST_MSDU_IN_MPDU_FLAG_MASK)
  373. #define HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_OFFSET 0x0
  374. #define HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_LSB 3
  375. #define HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_MASK 0x0001fff8
  376. #define HAL_RX_MSDU_PKT_LENGTH_GET(msdu_info_ptr) \
  377. (_HAL_MS((*_OFFSET_TO_WORD_PTR(msdu_info_ptr, \
  378. HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_OFFSET)), \
  379. HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_MASK, \
  380. HAL_RX_MSDU_DESC_INFO_MSDU_LENGTH_LSB))
  381. static inline uint32_t
  382. hal_rx_msdu_flags_get(hal_soc_handle_t hal_soc_hdl,
  383. rx_msdu_desc_info_t msdu_desc_info_hdl)
  384. {
  385. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  386. return hal_soc->ops->hal_rx_msdu_flags_get(msdu_desc_info_hdl);
  387. }
  388. /*
  389. * Structures & Macros to obtain fields from the TLV's in the Rx packet
  390. * pre-header.
  391. */
  392. static inline uint8_t *hal_rx_desc_get_80211_hdr(hal_soc_handle_t hal_soc_hdl,
  393. void *hw_desc_addr)
  394. {
  395. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  396. return hal_soc->ops->hal_rx_desc_get_80211_hdr(hw_desc_addr);
  397. }
  398. /**
  399. * hal_rx_mpdu_desc_info_get() - Get MDPU desc info params
  400. * @hal_soc_hdl: hal soc handle
  401. * @desc_addr: ring descriptor
  402. * @mpdu_desc_info: Buffer to fill the mpdu desc info params
  403. *
  404. * Return: None
  405. */
  406. static inline void
  407. hal_rx_mpdu_desc_info_get(hal_soc_handle_t hal_soc_hdl, void *desc_addr,
  408. struct hal_rx_mpdu_desc_info *mpdu_desc_info)
  409. {
  410. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  411. return hal_soc->ops->hal_rx_mpdu_desc_info_get(desc_addr,
  412. mpdu_desc_info);
  413. }
  414. #define HAL_RX_NUM_MSDU_DESC 6
  415. #define HAL_RX_MAX_SAVED_RING_DESC 16
  416. /* TODO: rework the structure */
  417. struct hal_rx_msdu_list {
  418. struct hal_rx_msdu_desc_info msdu_info[HAL_RX_NUM_MSDU_DESC];
  419. uint32_t sw_cookie[HAL_RX_NUM_MSDU_DESC];
  420. uint8_t rbm[HAL_RX_NUM_MSDU_DESC];
  421. /* physical address of the msdu */
  422. uint64_t paddr[HAL_RX_NUM_MSDU_DESC];
  423. };
  424. struct hal_buf_info {
  425. uint64_t paddr;
  426. uint32_t sw_cookie;
  427. uint8_t rbm;
  428. };
  429. /* This special cookie value will be used to indicate FW allocated buffers
  430. * received through RXDMA2SW ring for RXDMA WARs
  431. */
  432. #define HAL_RX_COOKIE_SPECIAL 0x1fffff
  433. /**
  434. * enum hal_reo_error_code: Indicates that type of buffer or descriptor
  435. *
  436. * @ HAL_RX_MSDU_BUF_ADDR_TYPE : Reo buffer address points to the MSDU buffer
  437. * @ HAL_RX_MSDU_LINK_DESC_TYPE: Reo buffer address points to the link
  438. * descriptor
  439. */
  440. enum hal_rx_reo_buf_type {
  441. HAL_RX_REO_MSDU_BUF_ADDR_TYPE = 0,
  442. HAL_RX_REO_MSDU_LINK_DESC_TYPE,
  443. };
  444. /**
  445. * enum hal_reo_error_code: Error code describing the type of error detected
  446. *
  447. * @ HAL_REO_ERR_QUEUE_DESC_ADDR_0 : Reo queue descriptor provided in the
  448. * REO_ENTRANCE ring is set to 0
  449. * @ HAL_REO_ERR_QUEUE_DESC_INVALID: Reo queue descriptor valid bit is NOT set
  450. * @ HAL_REO_ERR_AMPDU_IN_NON_BA : AMPDU frame received without BA session
  451. * having been setup
  452. * @ HAL_REO_ERR_NON_BA_DUPLICATE : Non-BA session, SN equal to SSN,
  453. * Retry bit set: duplicate frame
  454. * @ HAL_REO_ERR_BA_DUPLICATE : BA session, duplicate frame
  455. * @ HAL_REO_ERR_REGULAR_FRAME_2K_JUMP : A normal (management/data frame)
  456. * received with 2K jump in SN
  457. * @ HAL_REO_ERR_BAR_FRAME_2K_JUMP : A bar received with 2K jump in SSN
  458. * @ HAL_REO_ERR_REGULAR_FRAME_OOR : A normal (management/data frame) received
  459. * with SN falling within the OOR window
  460. * @ HAL_REO_ERR_BAR_FRAME_OOR : A bar received with SSN falling within the
  461. * OOR window
  462. * @ HAL_REO_ERR_BAR_FRAME_NO_BA_SESSION : A bar received without a BA session
  463. * @ HAL_REO_ERR_BAR_FRAME_SN_EQUALS_SSN : A bar received with SSN equal to SN
  464. * @ HAL_REO_ERR_PN_CHECK_FAILED : PN Check Failed packet
  465. * @ HAL_REO_ERR_2K_ERROR_HANDLING_FLAG_SET : Frame is forwarded as a result
  466. * of the Seq_2k_error_detected_flag been set in the REO Queue descriptor
  467. * @ HAL_REO_ERR_PN_ERROR_HANDLING_FLAG_SET : Frame is forwarded as a result
  468. * of the pn_error_detected_flag been set in the REO Queue descriptor
  469. * @ HAL_REO_ERR_QUEUE_DESC_BLOCKED_SET : Frame is forwarded as a result of
  470. * the queue descriptor(address) being blocked as SW/FW seems to be currently
  471. * in the process of making updates to this descriptor
  472. */
  473. enum hal_reo_error_code {
  474. HAL_REO_ERR_QUEUE_DESC_ADDR_0 = 0,
  475. HAL_REO_ERR_QUEUE_DESC_INVALID,
  476. HAL_REO_ERR_AMPDU_IN_NON_BA,
  477. HAL_REO_ERR_NON_BA_DUPLICATE,
  478. HAL_REO_ERR_BA_DUPLICATE,
  479. HAL_REO_ERR_REGULAR_FRAME_2K_JUMP,
  480. HAL_REO_ERR_BAR_FRAME_2K_JUMP,
  481. HAL_REO_ERR_REGULAR_FRAME_OOR,
  482. HAL_REO_ERR_BAR_FRAME_OOR,
  483. HAL_REO_ERR_BAR_FRAME_NO_BA_SESSION,
  484. HAL_REO_ERR_BAR_FRAME_SN_EQUALS_SSN,
  485. HAL_REO_ERR_PN_CHECK_FAILED,
  486. HAL_REO_ERR_2K_ERROR_HANDLING_FLAG_SET,
  487. HAL_REO_ERR_PN_ERROR_HANDLING_FLAG_SET,
  488. HAL_REO_ERR_QUEUE_DESC_BLOCKED_SET,
  489. HAL_REO_ERR_MAX
  490. };
  491. /**
  492. * enum hal_rxdma_error_code: Code describing the type of RxDMA error detected
  493. *
  494. * @HAL_RXDMA_ERR_OVERFLOW: MPDU frame is not complete due to a FIFO overflow
  495. * @ HAL_RXDMA_ERR_OVERFLOW : MPDU frame is not complete due to a FIFO
  496. * overflow
  497. * @ HAL_RXDMA_ERR_MPDU_LENGTH : MPDU frame is not complete due to receiving
  498. * incomplete
  499. * MPDU from the PHY
  500. * @ HAL_RXDMA_ERR_FCS : FCS check on the MPDU frame failed
  501. * @ HAL_RXDMA_ERR_DECRYPT : Decryption error
  502. * @ HAL_RXDMA_ERR_TKIP_MIC : TKIP MIC error
  503. * @ HAL_RXDMA_ERR_UNENCRYPTED : Received a frame that was expected to be
  504. * encrypted but wasn’t
  505. * @ HAL_RXDMA_ERR_MSDU_LEN : MSDU related length error
  506. * @ HAL_RXDMA_ERR_MSDU_LIMIT : Number of MSDUs in the MPDUs exceeded
  507. * the max allowed
  508. * @ HAL_RXDMA_ERR_WIFI_PARSE : wifi parsing error
  509. * @ HAL_RXDMA_ERR_AMSDU_PARSE : Amsdu parsing error
  510. * @ HAL_RXDMA_ERR_SA_TIMEOUT : Source Address search timeout
  511. * @ HAL_RXDMA_ERR_DA_TIMEOUT : Destination Address search timeout
  512. * @ HAL_RXDMA_ERR_FLOW_TIMEOUT : Flow Search Timeout
  513. * @ HAL_RXDMA_ERR_FLUSH_REQUEST : RxDMA FIFO Flush request
  514. * @ HAL_RXDMA_AMSDU_FRAGMENT : Rx PCU reported A-MSDU
  515. * present as well as a fragmented MPDU
  516. * @ HAL_RXDMA_MULTICAST_ECHO : RX OLE reported a multicast echo
  517. * @ HAL_RXDMA_AMSDU_ADDR_MISMATCH : RX OLE reported AMSDU address mismatch
  518. * @ HAL_RXDMA_UNAUTHORIZED_WDS : RX PCU reported unauthorized wds
  519. * @ HAL_RXDMA_GROUPCAST_AMSDU_OR_WDS :RX PCU reported group cast AMSDU or WDS
  520. * @ HAL_RXDMA_ERR_WAR : RxDMA WAR dummy errors
  521. */
  522. enum hal_rxdma_error_code {
  523. HAL_RXDMA_ERR_OVERFLOW = 0,
  524. HAL_RXDMA_ERR_MPDU_LENGTH,
  525. HAL_RXDMA_ERR_FCS,
  526. HAL_RXDMA_ERR_DECRYPT,
  527. HAL_RXDMA_ERR_TKIP_MIC,
  528. HAL_RXDMA_ERR_UNENCRYPTED,
  529. HAL_RXDMA_ERR_MSDU_LEN,
  530. HAL_RXDMA_ERR_MSDU_LIMIT,
  531. HAL_RXDMA_ERR_WIFI_PARSE,
  532. HAL_RXDMA_ERR_AMSDU_PARSE,
  533. HAL_RXDMA_ERR_SA_TIMEOUT,
  534. HAL_RXDMA_ERR_DA_TIMEOUT,
  535. HAL_RXDMA_ERR_FLOW_TIMEOUT,
  536. HAL_RXDMA_ERR_FLUSH_REQUEST,
  537. HAL_RXDMA_AMSDU_FRAGMENT,
  538. HAL_RXDMA_MULTICAST_ECHO,
  539. HAL_RXDMA_AMSDU_ADDR_MISMATCH,
  540. HAL_RXDMA_UNAUTHORIZED_WDS,
  541. HAL_RXDMA_GROUPCAST_AMSDU_OR_WDS,
  542. HAL_RXDMA_ERR_WAR = 31,
  543. HAL_RXDMA_ERR_MAX
  544. };
  545. /**
  546. * HW BM action settings in WBM release ring
  547. */
  548. #define HAL_BM_ACTION_PUT_IN_IDLE_LIST 0
  549. #define HAL_BM_ACTION_RELEASE_MSDU_LIST 1
  550. /**
  551. * enum hal_rx_wbm_error_source: Indicates which module initiated the
  552. * release of this buffer or descriptor
  553. *
  554. * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
  555. * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
  556. * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
  557. * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
  558. * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
  559. */
  560. enum hal_rx_wbm_error_source {
  561. HAL_RX_WBM_ERR_SRC_TQM = 0,
  562. HAL_RX_WBM_ERR_SRC_RXDMA,
  563. HAL_RX_WBM_ERR_SRC_REO,
  564. HAL_RX_WBM_ERR_SRC_FW,
  565. HAL_RX_WBM_ERR_SRC_SW,
  566. };
  567. /**
  568. * enum hal_rx_wbm_buf_type: Indicates that type of buffer or descriptor
  569. * released
  570. *
  571. * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
  572. * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
  573. * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
  574. * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
  575. * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
  576. */
  577. enum hal_rx_wbm_buf_type {
  578. HAL_RX_WBM_BUF_TYPE_REL_BUF = 0,
  579. HAL_RX_WBM_BUF_TYPE_MSDU_LINK_DESC,
  580. HAL_RX_WBM_BUF_TYPE_MPDU_LINK_DESC,
  581. HAL_RX_WBM_BUF_TYPE_MSDU_EXT_DESC,
  582. HAL_RX_WBM_BUF_TYPE_Q_EXT_DESC,
  583. };
  584. #define HAL_WBM_RELEASE_RING_DESC_LEN_DWORDS (NUM_OF_DWORDS_WBM_RELEASE_RING)
  585. //#include "hal_rx_be.h"
  586. /*
  587. * hal_rx_msdu_is_wlan_mcast(): Check if the buffer is for multicast address
  588. *
  589. * @nbuf: Network buffer
  590. * Returns: flag to indicate whether the nbuf has MC/BC address
  591. */
  592. static inline uint32_t
  593. hal_rx_msdu_is_wlan_mcast(hal_soc_handle_t hal_soc_hdl,
  594. qdf_nbuf_t nbuf)
  595. {
  596. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  597. return hal_soc->ops->hal_rx_msdu_is_wlan_mcast(nbuf);
  598. }
  599. /**
  600. * hal_rx_priv_info_set_in_tlv(): Save the private info to
  601. * the reserved bytes of rx_tlv_hdr
  602. * @buf: start of rx_tlv_hdr
  603. * @wbm_er_info: hal_wbm_err_desc_info structure
  604. * Return: void
  605. */
  606. static inline void
  607. hal_rx_priv_info_set_in_tlv(hal_soc_handle_t hal_soc_hdl,
  608. uint8_t *buf, uint8_t *priv_data,
  609. uint32_t len)
  610. {
  611. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  612. return hal_soc->ops->hal_rx_priv_info_set_in_tlv(buf,
  613. priv_data,
  614. len);
  615. }
  616. /*
  617. * hal_rx_reo_ent_rxdma_push_reason_get(): Retrieves RXDMA push reason from
  618. * reo_entrance_ring descriptor
  619. *
  620. * @reo_ent_desc: reo_entrance_ring descriptor
  621. * Returns: value of rxdma_push_reason
  622. */
  623. static inline
  624. uint8_t hal_rx_reo_ent_rxdma_push_reason_get(hal_rxdma_desc_t reo_ent_desc)
  625. {
  626. return _HAL_MS((*_OFFSET_TO_WORD_PTR(reo_ent_desc,
  627. HAL_REO_ENTRANCE_RING_RXDMA_PUSH_REASON_OFFSET)),
  628. HAL_REO_ENTRANCE_RING_RXDMA_PUSH_REASON_MASK,
  629. HAL_REO_ENTRANCE_RING_RXDMA_PUSH_REASON_LSB);
  630. }
  631. /**
  632. * hal_rx_reo_ent_rxdma_error_code_get(): Retrieves RXDMA error code from
  633. * reo_entrance_ring descriptor
  634. * @reo_ent_desc: reo_entrance_ring descriptor
  635. * Return: value of rxdma_error_code
  636. */
  637. static inline
  638. uint8_t hal_rx_reo_ent_rxdma_error_code_get(hal_rxdma_desc_t reo_ent_desc)
  639. {
  640. return _HAL_MS((*_OFFSET_TO_WORD_PTR(reo_ent_desc,
  641. HAL_REO_ENTRANCE_RING_RXDMA_ERROR_CODE_OFFSET)),
  642. HAL_REO_ENTRANCE_RING_RXDMA_ERROR_CODE_MASK,
  643. HAL_REO_ENTRANCE_RING_RXDMA_ERROR_CODE_LSB);
  644. }
  645. /**
  646. * hal_rx_priv_info_get_from_tlv(): retrieve the private data from
  647. * the reserved bytes of rx_tlv_hdr.
  648. * @buf: start of rx_tlv_hdr
  649. * @wbm_er_info: hal_wbm_err_desc_info structure, output parameter.
  650. * Return: void
  651. */
  652. static inline void
  653. hal_rx_priv_info_get_from_tlv(hal_soc_handle_t hal_soc_hdl,
  654. uint8_t *buf, uint8_t *wbm_er_info,
  655. uint32_t len)
  656. {
  657. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  658. return hal_soc->ops->hal_rx_priv_info_get_from_tlv(buf,
  659. wbm_er_info,
  660. len);
  661. }
  662. static inline void
  663. hal_rx_get_tlv_size(hal_soc_handle_t hal_soc_hdl, uint16_t *rx_pkt_tlv_size,
  664. uint16_t *rx_mon_pkt_tlv_size)
  665. {
  666. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  667. return hal_soc->ops->hal_rx_get_tlv_size(rx_pkt_tlv_size,
  668. rx_mon_pkt_tlv_size);
  669. }
  670. /*
  671. * hal_rx_encryption_info_valid(): Returns encryption type.
  672. *
  673. * @hal_soc_hdl: hal soc handle
  674. * @buf: rx_tlv_hdr of the received packet
  675. *
  676. * Return: encryption type
  677. */
  678. static inline uint32_t
  679. hal_rx_encryption_info_valid(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  680. {
  681. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  682. return hal_soc->ops->hal_rx_encryption_info_valid(buf);
  683. }
  684. /*
  685. * hal_rx_print_pn: Prints the PN of rx packet.
  686. * @hal_soc_hdl: hal soc handle
  687. * @buf: rx_tlv_hdr of the received packet
  688. *
  689. * Return: void
  690. */
  691. static inline void
  692. hal_rx_print_pn(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  693. {
  694. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  695. hal_soc->ops->hal_rx_print_pn(buf);
  696. }
  697. /**
  698. * hal_rx_msdu_end_l3_hdr_padding_get(): API to get the
  699. * l3_header padding from rx_msdu_end TLV
  700. *
  701. * @buf: pointer to the start of RX PKT TLV headers
  702. * Return: number of l3 header padding bytes
  703. */
  704. static inline uint32_t
  705. hal_rx_msdu_end_l3_hdr_padding_get(hal_soc_handle_t hal_soc_hdl,
  706. uint8_t *buf)
  707. {
  708. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  709. return hal_soc->ops->hal_rx_msdu_end_l3_hdr_padding_get(buf);
  710. }
  711. /**
  712. * hal_rx_msdu_end_sa_idx_get(): API to get the
  713. * sa_idx from rx_msdu_end TLV
  714. *
  715. * @ buf: pointer to the start of RX PKT TLV headers
  716. * Return: sa_idx (SA AST index)
  717. */
  718. static inline uint16_t
  719. hal_rx_msdu_end_sa_idx_get(hal_soc_handle_t hal_soc_hdl,
  720. uint8_t *buf)
  721. {
  722. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  723. return hal_soc->ops->hal_rx_msdu_end_sa_idx_get(buf);
  724. }
  725. /**
  726. * hal_rx_msdu_end_sa_is_valid_get(): API to get the
  727. * sa_is_valid bit from rx_msdu_end TLV
  728. *
  729. * @ buf: pointer to the start of RX PKT TLV headers
  730. * Return: sa_is_valid bit
  731. */
  732. static inline uint8_t
  733. hal_rx_msdu_end_sa_is_valid_get(hal_soc_handle_t hal_soc_hdl,
  734. uint8_t *buf)
  735. {
  736. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  737. return hal_soc->ops->hal_rx_msdu_end_sa_is_valid_get(buf);
  738. }
  739. /**
  740. * hal_rx_msdu_start_msdu_len_set(): API to set the MSDU length
  741. * from rx_msdu_start TLV
  742. *
  743. * @buf: pointer to the start of RX PKT TLV headers
  744. * @len: msdu length
  745. *
  746. * Return: none
  747. */
  748. static inline void
  749. hal_rx_tlv_msdu_len_set(hal_soc_handle_t hal_soc_hdl, uint8_t *buf,
  750. uint32_t len)
  751. {
  752. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  753. return hal_soc->ops->hal_rx_tlv_msdu_len_set(buf, len);
  754. }
  755. /**
  756. * enum hal_rx_mpdu_info_sw_frame_group_id_type: Enum for group id in MPDU_INFO
  757. *
  758. * @ HAL_MPDU_SW_FRAME_GROUP_NDP_FRAME: NDP frame
  759. * @ HAL_MPDU_SW_FRAME_GROUP_MULTICAST_DATA: multicast data frame
  760. * @ HAL_MPDU_SW_FRAME_GROUP_UNICAST_DATA: unicast data frame
  761. * @ HAL_MPDU_SW_FRAME_GROUP_NULL_DATA: NULL data frame
  762. * @ HAL_MPDU_SW_FRAME_GROUP_MGMT: management frame
  763. * @ HAL_MPDU_SW_FRAME_GROUP_MGMT_PROBE_REQ: probe req frame
  764. * @ HAL_MPDU_SW_FRAME_GROUP_CTRL: control frame
  765. * @ HAL_MPDU_SW_FRAME_GROUP_CTRL_NDPA: NDPA frame
  766. * @ HAL_MPDU_SW_FRAME_GROUP_CTRL_BAR: BAR frame
  767. * @ HAL_MPDU_SW_FRAME_GROUP_CTRL_RTS: RTS frame
  768. * @ HAL_MPDU_SW_FRAME_GROUP_UNSUPPORTED: unsupported
  769. * @ HAL_MPDU_SW_FRAME_GROUP_MAX: max limit
  770. */
  771. enum hal_rx_mpdu_info_sw_frame_group_id_type {
  772. HAL_MPDU_SW_FRAME_GROUP_NDP_FRAME = 0,
  773. HAL_MPDU_SW_FRAME_GROUP_MULTICAST_DATA,
  774. HAL_MPDU_SW_FRAME_GROUP_UNICAST_DATA,
  775. HAL_MPDU_SW_FRAME_GROUP_NULL_DATA,
  776. HAL_MPDU_SW_FRAME_GROUP_MGMT,
  777. HAL_MPDU_SW_FRAME_GROUP_MGMT_PROBE_REQ = 8,
  778. HAL_MPDU_SW_FRAME_GROUP_MGMT_BEACON = 12,
  779. HAL_MPDU_SW_FRAME_GROUP_CTRL = 20,
  780. HAL_MPDU_SW_FRAME_GROUP_CTRL_NDPA = 25,
  781. HAL_MPDU_SW_FRAME_GROUP_CTRL_BAR = 28,
  782. HAL_MPDU_SW_FRAME_GROUP_CTRL_RTS = 31,
  783. HAL_MPDU_SW_FRAME_GROUP_UNSUPPORTED = 36,
  784. HAL_MPDU_SW_FRAME_GROUP_MAX = 37,
  785. };
  786. /**
  787. * hal_rx_mpdu_start_mpdu_qos_control_valid_get():
  788. * Retrieve qos control valid bit from the tlv.
  789. * @hal_soc_hdl: hal_soc handle
  790. * @buf: pointer to rx pkt TLV.
  791. *
  792. * Return: qos control value.
  793. */
  794. static inline uint32_t
  795. hal_rx_mpdu_start_mpdu_qos_control_valid_get(
  796. hal_soc_handle_t hal_soc_hdl,
  797. uint8_t *buf)
  798. {
  799. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  800. if ((!hal_soc) || (!hal_soc->ops)) {
  801. hal_err("hal handle is NULL");
  802. QDF_BUG(0);
  803. return QDF_STATUS_E_INVAL;
  804. }
  805. if (hal_soc->ops->hal_rx_mpdu_start_mpdu_qos_control_valid_get)
  806. return hal_soc->ops->
  807. hal_rx_mpdu_start_mpdu_qos_control_valid_get(buf);
  808. return QDF_STATUS_E_INVAL;
  809. }
  810. /**
  811. * hal_rx_is_unicast: check packet is unicast frame or not.
  812. * @hal_soc_hdl: hal_soc handle
  813. * @buf: pointer to rx pkt TLV.
  814. *
  815. * Return: true on unicast.
  816. */
  817. static inline bool
  818. hal_rx_is_unicast(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  819. {
  820. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  821. return hal_soc->ops->hal_rx_is_unicast(buf);
  822. }
  823. /**
  824. * hal_rx_tid_get: get tid based on qos control valid.
  825. * @hal_soc_hdl: hal soc handle
  826. * @buf: pointer to rx pkt TLV.
  827. *
  828. * Return: tid
  829. */
  830. static inline uint32_t
  831. hal_rx_tid_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  832. {
  833. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  834. return hal_soc->ops->hal_rx_tid_get(hal_soc_hdl, buf);
  835. }
  836. /**
  837. * hal_rx_mpdu_start_sw_peer_id_get() - Retrieve sw peer id
  838. * @hal_soc_hdl: hal soc handle
  839. * @buf: pointer to rx pkt TLV.
  840. *
  841. * Return: sw peer_id
  842. */
  843. static inline uint32_t
  844. hal_rx_mpdu_start_sw_peer_id_get(hal_soc_handle_t hal_soc_hdl,
  845. uint8_t *buf)
  846. {
  847. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  848. return hal_soc->ops->hal_rx_mpdu_start_sw_peer_id_get(buf);
  849. }
  850. /**
  851. * hal_rx_mpdu_peer_meta_data_get() - Retrieve PEER_META_DATA
  852. * @hal_soc_hdl: hal soc handle
  853. * @buf: pointer to rx pkt TLV.
  854. *
  855. * Return: peer meta data
  856. */
  857. static inline uint32_t
  858. hal_rx_mpdu_peer_meta_data_get(hal_soc_handle_t hal_soc_hdl,
  859. uint8_t *buf)
  860. {
  861. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  862. return hal_soc->ops->hal_rx_mpdu_peer_meta_data_get(buf);
  863. }
  864. /*
  865. * hal_rx_mpdu_get_tods(): API to get the tods info
  866. * from rx_mpdu_start
  867. *
  868. * @buf: pointer to the start of RX PKT TLV header
  869. * Return: uint32_t(to_ds)
  870. */
  871. static inline uint32_t
  872. hal_rx_mpdu_get_to_ds(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  873. {
  874. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  875. return hal_soc->ops->hal_rx_mpdu_get_to_ds(buf);
  876. }
  877. /*
  878. * hal_rx_mpdu_get_fr_ds(): API to get the from ds info
  879. * from rx_mpdu_start
  880. * @hal_soc_hdl: hal soc handle
  881. * @buf: pointer to the start of RX PKT TLV header
  882. *
  883. * Return: uint32_t(fr_ds)
  884. */
  885. static inline uint32_t
  886. hal_rx_mpdu_get_fr_ds(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  887. {
  888. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  889. return hal_soc->ops->hal_rx_mpdu_get_fr_ds(buf);
  890. }
  891. /*
  892. * hal_rx_mpdu_get_addr1(): API to check get address1 of the mpdu
  893. * @hal_soc_hdl: hal soc handle
  894. * @buf: pointer to the start of RX PKT TLV headera
  895. * @mac_addr: pointer to mac address
  896. *
  897. * Return: success/failure
  898. */
  899. static inline
  900. QDF_STATUS hal_rx_mpdu_get_addr1(hal_soc_handle_t hal_soc_hdl,
  901. uint8_t *buf, uint8_t *mac_addr)
  902. {
  903. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  904. return hal_soc->ops->hal_rx_mpdu_get_addr1(buf, mac_addr);
  905. }
  906. /*
  907. * hal_rx_mpdu_get_addr2(): API to check get address2 of the mpdu
  908. * in the packet
  909. * @hal_soc_hdl: hal soc handle
  910. * @buf: pointer to the start of RX PKT TLV header
  911. * @mac_addr: pointer to mac address
  912. *
  913. * Return: success/failure
  914. */
  915. static inline
  916. QDF_STATUS hal_rx_mpdu_get_addr2(hal_soc_handle_t hal_soc_hdl,
  917. uint8_t *buf, uint8_t *mac_addr)
  918. {
  919. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  920. return hal_soc->ops->hal_rx_mpdu_get_addr2(buf, mac_addr);
  921. }
  922. /*
  923. * hal_rx_mpdu_get_addr3(): API to get address3 of the mpdu
  924. * in the packet
  925. * @hal_soc_hdl: hal soc handle
  926. * @buf: pointer to the start of RX PKT TLV header
  927. * @mac_addr: pointer to mac address
  928. *
  929. * Return: success/failure
  930. */
  931. static inline
  932. QDF_STATUS hal_rx_mpdu_get_addr3(hal_soc_handle_t hal_soc_hdl,
  933. uint8_t *buf, uint8_t *mac_addr)
  934. {
  935. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  936. return hal_soc->ops->hal_rx_mpdu_get_addr3(buf, mac_addr);
  937. }
  938. /*
  939. * hal_rx_mpdu_get_addr4(): API to get address4 of the mpdu
  940. * in the packet
  941. * @hal_soc_hdl: hal_soc handle
  942. * @buf: pointer to the start of RX PKT TLV header
  943. * @mac_addr: pointer to mac address
  944. * Return: success/failure
  945. */
  946. static inline
  947. QDF_STATUS hal_rx_mpdu_get_addr4(hal_soc_handle_t hal_soc_hdl,
  948. uint8_t *buf, uint8_t *mac_addr)
  949. {
  950. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  951. return hal_soc->ops->hal_rx_mpdu_get_addr4(buf, mac_addr);
  952. }
  953. /**
  954. * hal_rx_msdu_end_da_idx_get: API to get da_idx
  955. * from rx_msdu_end TLV
  956. *
  957. * @ buf: pointer to the start of RX PKT TLV headers
  958. * Return: da index
  959. */
  960. static inline uint16_t
  961. hal_rx_msdu_end_da_idx_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  962. {
  963. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  964. return hal_soc->ops->hal_rx_msdu_end_da_idx_get(buf);
  965. }
  966. /**
  967. * hal_rx_msdu_end_da_is_valid_get: API to check if da is valid
  968. * from rx_msdu_end TLV
  969. * @hal_soc_hdl: hal soc handle
  970. * @ buf: pointer to the start of RX PKT TLV headers
  971. *
  972. * Return: da_is_valid
  973. */
  974. static inline uint8_t
  975. hal_rx_msdu_end_da_is_valid_get(hal_soc_handle_t hal_soc_hdl,
  976. uint8_t *buf)
  977. {
  978. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  979. return hal_soc->ops->hal_rx_msdu_end_da_is_valid_get(buf);
  980. }
  981. /**
  982. * hal_rx_msdu_end_da_is_mcbc_get: API to check if pkt is MCBC
  983. * from rx_msdu_end TLV
  984. *
  985. * @buf: pointer to the start of RX PKT TLV headers
  986. *
  987. * Return: da_is_mcbc
  988. */
  989. static inline uint8_t
  990. hal_rx_msdu_end_da_is_mcbc_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  991. {
  992. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  993. return hal_soc->ops->hal_rx_msdu_end_da_is_mcbc_get(buf);
  994. }
  995. /**
  996. * hal_rx_msdu_end_is_tkip_mic_err: API to check if pkt has mic error
  997. * from rx_msdu_end TLV
  998. *
  999. * @buf: pointer to the start of RX PKT TLV headers
  1000. *
  1001. * Return: tkip_mic_err
  1002. */
  1003. static inline uint8_t
  1004. hal_rx_msdu_end_is_tkip_mic_err(hal_soc_handle_t hal_soc_hdl,
  1005. uint8_t *buf)
  1006. {
  1007. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1008. if (hal_soc->ops->hal_rx_msdu_end_is_tkip_mic_err)
  1009. return hal_soc->ops->hal_rx_msdu_end_is_tkip_mic_err(buf);
  1010. else
  1011. return 0;
  1012. }
  1013. /**
  1014. * hal_rx_msdu_end_first_msdu_get: API to get first msdu status
  1015. * from rx_msdu_end TLV
  1016. * @hal_soc_hdl: hal soc handle
  1017. * @buf: pointer to the start of RX PKT TLV headers
  1018. *
  1019. * Return: first_msdu
  1020. */
  1021. static inline uint8_t
  1022. hal_rx_msdu_end_first_msdu_get(hal_soc_handle_t hal_soc_hdl,
  1023. uint8_t *buf)
  1024. {
  1025. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1026. return hal_soc->ops->hal_rx_msdu_end_first_msdu_get(buf);
  1027. }
  1028. /**
  1029. * hal_rx_msdu_end_last_msdu_get: API to get last msdu status
  1030. * from rx_msdu_end TLV
  1031. * @hal_soc_hdl: hal soc handle
  1032. * @buf: pointer to the start of RX PKT TLV headers
  1033. *
  1034. * Return: last_msdu
  1035. */
  1036. static inline uint8_t
  1037. hal_rx_msdu_end_last_msdu_get(hal_soc_handle_t hal_soc_hdl,
  1038. uint8_t *buf)
  1039. {
  1040. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1041. return hal_soc->ops->hal_rx_msdu_end_last_msdu_get(buf);
  1042. }
  1043. /**
  1044. * hal_rx_msdu_cce_match_get: API to get CCE match
  1045. * from rx_msdu_end TLV
  1046. * @buf: pointer to the start of RX PKT TLV headers
  1047. * Return: cce_meta_data
  1048. */
  1049. static inline bool
  1050. hal_rx_msdu_cce_match_get(hal_soc_handle_t hal_soc_hdl,
  1051. uint8_t *buf)
  1052. {
  1053. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1054. return hal_soc->ops->hal_rx_msdu_cce_match_get(buf);
  1055. }
  1056. /**
  1057. * hal_rx_msdu_cce_metadata_get: API to get CCE metadata
  1058. * from rx_msdu_end TLV
  1059. * @buf: pointer to the start of RX PKT TLV headers
  1060. * Return: cce_meta_data
  1061. */
  1062. static inline uint16_t
  1063. hal_rx_msdu_cce_metadata_get(hal_soc_handle_t hal_soc_hdl,
  1064. uint8_t *buf)
  1065. {
  1066. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1067. return hal_soc->ops->hal_rx_msdu_cce_metadata_get(buf);
  1068. }
  1069. /*******************************************************************************
  1070. * RX REO ERROR APIS
  1071. ******************************************************************************/
  1072. /**
  1073. * hal_rx_link_desc_msdu0_ptr - Get pointer to rx_msdu details
  1074. * @msdu_link_ptr - msdu link ptr
  1075. * @hal - pointer to hal_soc
  1076. * Return - Pointer to rx_msdu_details structure
  1077. *
  1078. */
  1079. static inline
  1080. void *hal_rx_link_desc_msdu0_ptr(void *msdu_link_ptr,
  1081. struct hal_soc *hal_soc)
  1082. {
  1083. return hal_soc->ops->hal_rx_link_desc_msdu0_ptr(msdu_link_ptr);
  1084. }
  1085. /**
  1086. * hal_rx_msdu_desc_info_get_ptr() - Get msdu desc info ptr
  1087. * @msdu_details_ptr - Pointer to msdu_details_ptr
  1088. * @hal - pointer to hal_soc
  1089. * Return - Pointer to rx_msdu_desc_info structure.
  1090. *
  1091. */
  1092. static inline
  1093. void *hal_rx_msdu_desc_info_get_ptr(void *msdu_details_ptr,
  1094. struct hal_soc *hal_soc)
  1095. {
  1096. return hal_soc->ops->hal_rx_msdu_desc_info_get_ptr(msdu_details_ptr);
  1097. }
  1098. /**
  1099. * hal_rx_reo_buf_paddr_get: Gets the physical address and
  1100. * cookie from the REO destination ring element
  1101. *
  1102. * @ hal_rx_desc_cookie: Opaque cookie pointer used by HAL to get to
  1103. * the current descriptor
  1104. * @ buf_info: structure to return the buffer information
  1105. * Return: void
  1106. */
  1107. static inline
  1108. void hal_rx_reo_buf_paddr_get(hal_soc_handle_t hal_soc_hdl,
  1109. hal_ring_desc_t rx_desc,
  1110. struct hal_buf_info *buf_info)
  1111. {
  1112. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1113. if (hal_soc->ops->hal_rx_reo_buf_paddr_get)
  1114. return hal_soc->ops->hal_rx_reo_buf_paddr_get(
  1115. rx_desc,
  1116. buf_info);
  1117. }
  1118. /**
  1119. * hal_rx_wbm_rel_buf_paddr_get: Gets the physical address and
  1120. * cookie from the WBM release ring element
  1121. *
  1122. * @ hal_rx_desc_cookie: Opaque cookie pointer used by HAL to get to
  1123. * the current descriptor
  1124. * @ buf_info: structure to return the buffer information
  1125. * Return: void
  1126. */
  1127. static inline
  1128. void hal_rx_wbm_rel_buf_paddr_get(hal_soc_handle_t hal_soc_hdl,
  1129. hal_ring_desc_t rx_desc,
  1130. struct hal_buf_info *buf_info)
  1131. {
  1132. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1133. if (hal_soc->ops->hal_rx_wbm_rel_buf_paddr_get)
  1134. return hal_soc->ops->hal_rx_wbm_rel_buf_paddr_get(rx_desc,
  1135. buf_info);
  1136. }
  1137. /**
  1138. * hal_rx_buf_cookie_rbm_get: Gets the physical address and
  1139. * cookie from the REO entrance ring element
  1140. *
  1141. * @ hal_rx_desc_cookie: Opaque cookie pointer used by HAL to get to
  1142. * the current descriptor
  1143. * @ buf_info: structure to return the buffer information
  1144. * @ msdu_cnt: pointer to msdu count in MPDU
  1145. * Return: void
  1146. */
  1147. static inline
  1148. void hal_rx_buf_cookie_rbm_get(hal_soc_handle_t hal_soc_hdl,
  1149. uint32_t *buf_addr_info,
  1150. struct hal_buf_info *buf_info)
  1151. {
  1152. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1153. return hal_soc->ops->hal_rx_buf_cookie_rbm_get(
  1154. buf_addr_info,
  1155. buf_info);
  1156. }
  1157. /**
  1158. * hal_rx_msdu_link_desc_get(): API to get the MSDU information
  1159. * from the MSDU link descriptor
  1160. *
  1161. * @msdu_link_desc: Opaque pointer used by HAL to get to the
  1162. * MSDU link descriptor (struct rx_msdu_link)
  1163. *
  1164. * @msdu_list: Return the list of MSDUs contained in this link descriptor
  1165. *
  1166. * @num_msdus: Number of MSDUs in the MPDU
  1167. *
  1168. * Return: void
  1169. */
  1170. static inline void hal_rx_msdu_list_get(hal_soc_handle_t hal_soc_hdl,
  1171. void *msdu_link_desc,
  1172. struct hal_rx_msdu_list *msdu_list,
  1173. uint16_t *num_msdus)
  1174. {
  1175. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1176. struct rx_msdu_details *msdu_details;
  1177. struct rx_msdu_desc_info *msdu_desc_info;
  1178. struct rx_msdu_link *msdu_link = (struct rx_msdu_link *)msdu_link_desc;
  1179. int i;
  1180. struct hal_buf_info buf_info;
  1181. msdu_details = hal_rx_link_desc_msdu0_ptr(msdu_link, hal_soc);
  1182. dp_nofl_debug("[%s][%d] msdu_link=%pK msdu_details=%pK",
  1183. __func__, __LINE__, msdu_link, msdu_details);
  1184. for (i = 0; i < HAL_RX_NUM_MSDU_DESC; i++) {
  1185. /* num_msdus received in mpdu descriptor may be incorrect
  1186. * sometimes due to HW issue. Check msdu buffer address also
  1187. */
  1188. if (!i && (HAL_RX_BUFFER_ADDR_31_0_GET(
  1189. &msdu_details[i].buffer_addr_info_details) == 0))
  1190. break;
  1191. if (HAL_RX_BUFFER_ADDR_31_0_GET(
  1192. &msdu_details[i].buffer_addr_info_details) == 0) {
  1193. /* set the last msdu bit in the prev msdu_desc_info */
  1194. msdu_desc_info =
  1195. hal_rx_msdu_desc_info_get_ptr(&msdu_details[i - 1], hal_soc);
  1196. HAL_RX_LAST_MSDU_IN_MPDU_FLAG_SET(msdu_desc_info, 1);
  1197. break;
  1198. }
  1199. msdu_desc_info = hal_rx_msdu_desc_info_get_ptr(&msdu_details[i],
  1200. hal_soc);
  1201. /* set first MSDU bit or the last MSDU bit */
  1202. if (!i)
  1203. HAL_RX_FIRST_MSDU_IN_MPDU_FLAG_SET(msdu_desc_info, 1);
  1204. else if (i == (HAL_RX_NUM_MSDU_DESC - 1))
  1205. HAL_RX_LAST_MSDU_IN_MPDU_FLAG_SET(msdu_desc_info, 1);
  1206. msdu_list->msdu_info[i].msdu_flags =
  1207. hal_rx_msdu_flags_get(hal_soc_hdl, msdu_desc_info);
  1208. msdu_list->msdu_info[i].msdu_len =
  1209. HAL_RX_MSDU_PKT_LENGTH_GET(msdu_desc_info);
  1210. /* addr field in buf_info will not be valid */
  1211. hal_rx_buf_cookie_rbm_get(
  1212. hal_soc_hdl,
  1213. (uint32_t *)&msdu_details[i].buffer_addr_info_details,
  1214. &buf_info);
  1215. msdu_list->sw_cookie[i] = buf_info.sw_cookie;
  1216. msdu_list->rbm[i] = buf_info.rbm;
  1217. msdu_list->paddr[i] = HAL_RX_BUFFER_ADDR_31_0_GET(
  1218. &msdu_details[i].buffer_addr_info_details) |
  1219. (uint64_t)HAL_RX_BUFFER_ADDR_39_32_GET(
  1220. &msdu_details[i].buffer_addr_info_details) << 32;
  1221. dp_nofl_debug("[%s][%d] i=%d sw_cookie=%d",
  1222. __func__, __LINE__, i, msdu_list->sw_cookie[i]);
  1223. }
  1224. *num_msdus = i;
  1225. }
  1226. /**
  1227. * hal_rx_is_pn_error() - Indicate if this error was caused by a
  1228. * PN check failure
  1229. *
  1230. * @reo_desc: opaque pointer used by HAL to get the REO destination entry
  1231. *
  1232. * Return: true: error caused by PN check, false: other error
  1233. */
  1234. static inline bool hal_rx_reo_is_pn_error(uint32_t error_code)
  1235. {
  1236. return ((error_code == HAL_REO_ERR_PN_CHECK_FAILED) ||
  1237. (error_code == HAL_REO_ERR_PN_ERROR_HANDLING_FLAG_SET)) ?
  1238. true : false;
  1239. }
  1240. /**
  1241. * hal_rx_is_2k_jump() - Indicate if this error was caused by a 2K jump in
  1242. * the sequence number
  1243. *
  1244. * @ring_desc: opaque pointer used by HAL to get the REO destination entry
  1245. *
  1246. * Return: true: error caused by 2K jump, false: other error
  1247. */
  1248. static inline bool hal_rx_reo_is_2k_jump(uint32_t error_code)
  1249. {
  1250. return ((error_code == HAL_REO_ERR_REGULAR_FRAME_2K_JUMP) ||
  1251. (error_code == HAL_REO_ERR_2K_ERROR_HANDLING_FLAG_SET)) ?
  1252. true : false;
  1253. }
  1254. /**
  1255. * hal_rx_reo_is_oor_error() - Indicate if this error was caused by OOR
  1256. *
  1257. * @ring_desc: opaque pointer used by HAL to get the REO destination entry
  1258. *
  1259. * Return: true: error caused by OOR, false: other error
  1260. */
  1261. static inline bool hal_rx_reo_is_oor_error(uint32_t error_code)
  1262. {
  1263. return (error_code == HAL_REO_ERR_REGULAR_FRAME_OOR) ?
  1264. true : false;
  1265. }
  1266. /**
  1267. * hal_rx_reo_is_bar_oor_2k_jump() - Check if the error is 2k-jump or OOR error
  1268. * @error_code: error code obtained from ring descriptor.
  1269. *
  1270. * Return: true, if the error code is 2k-jump or OOR
  1271. * false, for other error codes.
  1272. */
  1273. static inline bool hal_rx_reo_is_bar_oor_2k_jump(uint32_t error_code)
  1274. {
  1275. return ((error_code == HAL_REO_ERR_BAR_FRAME_2K_JUMP) ||
  1276. (error_code == HAL_REO_ERR_BAR_FRAME_OOR)) ?
  1277. true : false;
  1278. }
  1279. /**
  1280. * hal_dump_wbm_rel_desc() - dump wbm release descriptor
  1281. * @hal_desc: hardware descriptor pointer
  1282. *
  1283. * This function will print wbm release descriptor
  1284. *
  1285. * Return: none
  1286. */
  1287. static inline void hal_dump_wbm_rel_desc(void *src_srng_desc)
  1288. {
  1289. uint32_t *wbm_comp = (uint32_t *)src_srng_desc;
  1290. uint32_t i;
  1291. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  1292. "Current Rx wbm release descriptor is");
  1293. for (i = 0; i < HAL_WBM_RELEASE_RING_DESC_LEN_DWORDS; i++) {
  1294. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  1295. "DWORD[i] = 0x%x", wbm_comp[i]);
  1296. }
  1297. }
  1298. /**
  1299. * hal_rx_msdu_link_desc_set: Retrieves MSDU Link Descriptor to WBM
  1300. *
  1301. * @ hal_soc_hdl : HAL version of the SOC pointer
  1302. * @ src_srng_desc : void pointer to the WBM Release Ring descriptor
  1303. * @ buf_addr_info : void pointer to the buffer_addr_info
  1304. * @ bm_action : put in IDLE list or release to MSDU_LIST
  1305. *
  1306. * Return: void
  1307. */
  1308. /* look at implementation at dp_hw_link_desc_pool_setup()*/
  1309. static inline
  1310. void hal_rx_msdu_link_desc_set(hal_soc_handle_t hal_soc_hdl,
  1311. void *src_srng_desc,
  1312. hal_buff_addrinfo_t buf_addr_info,
  1313. uint8_t bm_action)
  1314. {
  1315. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1316. if (hal_soc->ops->hal_rx_msdu_link_desc_set)
  1317. return hal_soc->ops->hal_rx_msdu_link_desc_set(hal_soc_hdl,
  1318. src_srng_desc,
  1319. buf_addr_info,
  1320. bm_action);
  1321. }
  1322. /**
  1323. * HAL_RX_BUF_ADDR_INFO_GET: Returns the address of the
  1324. * BUFFER_ADDR_INFO, give the RX descriptor
  1325. * (Assumption -- BUFFER_ADDR_INFO is the
  1326. * first field in the descriptor structure)
  1327. */
  1328. #define HAL_RX_BUF_ADDR_INFO_GET(ring_desc) \
  1329. ((hal_link_desc_t)(ring_desc))
  1330. #define HAL_RX_REO_BUF_ADDR_INFO_GET HAL_RX_BUF_ADDR_INFO_GET
  1331. #define HAL_RX_WBM_BUF_ADDR_INFO_GET HAL_RX_BUF_ADDR_INFO_GET
  1332. /*******************************************************************************
  1333. * RX WBM ERROR APIS
  1334. ******************************************************************************/
  1335. #define HAL_RX_WBM_BUF_TYPE_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
  1336. (WBM_ERR_RING_BUFFER_OR_DESC_TYPE_OFFSET >> 2))) & \
  1337. WBM_ERR_RING_BUFFER_OR_DESC_TYPE_MASK) >> \
  1338. WBM_ERR_RING_BUFFER_OR_DESC_TYPE_LSB)
  1339. /**
  1340. * enum - hal_rx_wbm_reo_push_reason: Indicates why REO pushed
  1341. * the frame to this release ring
  1342. *
  1343. * @ HAL_RX_WBM_REO_PSH_RSN_ERROR : Reo detected an error and pushed this
  1344. * frame to this queue
  1345. * @ HAL_RX_WBM_REO_PSH_RSN_ROUTE: Reo pushed the frame to this queue per
  1346. * received routing instructions. No error within REO was detected
  1347. */
  1348. enum hal_rx_wbm_reo_push_reason {
  1349. HAL_RX_WBM_REO_PSH_RSN_ERROR = 0,
  1350. HAL_RX_WBM_REO_PSH_RSN_ROUTE,
  1351. };
  1352. /**
  1353. * enum hal_rx_wbm_rxdma_push_reason: Indicates why REO pushed the frame to
  1354. * this release ring
  1355. *
  1356. * @ HAL_RX_WBM_RXDMA_PSH_RSN_ERROR : RXDMA detected an error and pushed
  1357. * this frame to this queue
  1358. * @ HAL_RX_WBM_RXDMA_PSH_RSN_ROUTE: RXDMA pushed the frame to this queue
  1359. * per received routing instructions. No error within RXDMA was detected
  1360. */
  1361. enum hal_rx_wbm_rxdma_push_reason {
  1362. HAL_RX_WBM_RXDMA_PSH_RSN_ERROR = 0,
  1363. HAL_RX_WBM_RXDMA_PSH_RSN_ROUTE,
  1364. HAL_RX_WBM_RXDMA_PSH_RSN_FLUSH,
  1365. };
  1366. static inline void hal_rx_dump_mpdu_start_tlv(struct rx_mpdu_start *mpdu_start,
  1367. uint8_t dbg_level,
  1368. struct hal_soc *hal)
  1369. {
  1370. hal->ops->hal_rx_dump_mpdu_start_tlv(mpdu_start, dbg_level);
  1371. }
  1372. /**
  1373. * hal_rx_dump_msdu_end_tlv: dump RX msdu_end TLV in structured
  1374. * human readable format.
  1375. * @ msdu_end: pointer the msdu_end TLV in pkt.
  1376. * @ dbg_level: log level.
  1377. *
  1378. * Return: void
  1379. */
  1380. static inline void hal_rx_dump_msdu_end_tlv(struct hal_soc *hal_soc,
  1381. struct rx_msdu_end *msdu_end,
  1382. uint8_t dbg_level)
  1383. {
  1384. hal_soc->ops->hal_rx_dump_msdu_end_tlv(msdu_end, dbg_level);
  1385. }
  1386. /**
  1387. * hal_srng_ring_id_get: API to retrieve ring id from hal ring
  1388. * structure
  1389. * @hal_ring: pointer to hal_srng structure
  1390. *
  1391. * Return: ring_id
  1392. */
  1393. static inline uint8_t hal_srng_ring_id_get(hal_ring_handle_t hal_ring_hdl)
  1394. {
  1395. return ((struct hal_srng *)hal_ring_hdl)->ring_id;
  1396. }
  1397. #define DOT11_SEQ_FRAG_MASK 0x000f
  1398. #define DOT11_FC1_MORE_FRAG_OFFSET 0x04
  1399. /**
  1400. * hal_rx_get_rx_fragment_number(): Function to retrieve rx fragment number
  1401. *
  1402. * @nbuf: Network buffer
  1403. * Returns: rx fragment number
  1404. */
  1405. static inline
  1406. uint8_t hal_rx_get_rx_fragment_number(struct hal_soc *hal_soc,
  1407. uint8_t *buf)
  1408. {
  1409. return hal_soc->ops->hal_rx_get_rx_fragment_number(buf);
  1410. }
  1411. /*
  1412. * hal_rx_get_mpdu_sequence_control_valid(): Get mpdu sequence control valid
  1413. * @hal_soc_hdl: hal soc handle
  1414. * @nbuf: Network buffer
  1415. *
  1416. * Return: value of sequence control valid field
  1417. */
  1418. static inline
  1419. uint8_t hal_rx_get_mpdu_sequence_control_valid(hal_soc_handle_t hal_soc_hdl,
  1420. uint8_t *buf)
  1421. {
  1422. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1423. return hal_soc->ops->hal_rx_get_mpdu_sequence_control_valid(buf);
  1424. }
  1425. /*
  1426. * hal_rx_get_mpdu_frame_control_valid(): Retrieves mpdu frame control valid
  1427. * @hal_soc_hdl: hal soc handle
  1428. * @nbuf: Network buffer
  1429. *
  1430. * Returns: value of frame control valid field
  1431. */
  1432. static inline
  1433. uint8_t hal_rx_get_mpdu_frame_control_valid(hal_soc_handle_t hal_soc_hdl,
  1434. uint8_t *buf)
  1435. {
  1436. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1437. return hal_soc->ops->hal_rx_get_mpdu_frame_control_valid(buf);
  1438. }
  1439. /**
  1440. * hal_rx_get_mpdu_mac_ad4_valid(): Retrieves if mpdu 4th addr is valid
  1441. * @hal_soc_hdl: hal soc handle
  1442. * @nbuf: Network buffer
  1443. * Returns: value of mpdu 4th address valid field
  1444. */
  1445. static inline
  1446. bool hal_rx_get_mpdu_mac_ad4_valid(hal_soc_handle_t hal_soc_hdl,
  1447. uint8_t *buf)
  1448. {
  1449. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1450. return hal_soc->ops->hal_rx_get_mpdu_mac_ad4_valid(buf);
  1451. }
  1452. /*
  1453. * hal_rx_clear_mpdu_desc_info(): Clears mpdu_desc_info
  1454. *
  1455. * @rx_mpdu_desc_info: HAL view of rx mpdu desc info
  1456. * Returns: None
  1457. */
  1458. static inline void
  1459. hal_rx_clear_mpdu_desc_info(struct hal_rx_mpdu_desc_info *rx_mpdu_desc_info)
  1460. {
  1461. qdf_mem_zero(rx_mpdu_desc_info, sizeof(*rx_mpdu_desc_info));
  1462. }
  1463. /**
  1464. * hal_rx_wbm_err_info_get(): Retrieves WBM error code and reason and
  1465. * save it to hal_wbm_err_desc_info structure passed by caller
  1466. * @wbm_desc: wbm ring descriptor
  1467. * @wbm_er_info: hal_wbm_err_desc_info structure, output parameter.
  1468. * Return: void
  1469. */
  1470. static inline
  1471. void hal_rx_wbm_err_info_get(void *wbm_desc,
  1472. struct hal_wbm_err_desc_info *wbm_er_info,
  1473. hal_soc_handle_t hal_soc_hdl)
  1474. {
  1475. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1476. hal_soc->ops->hal_rx_wbm_err_info_get(wbm_desc, (void *)wbm_er_info);
  1477. }
  1478. /**
  1479. * hal_rx_wbm_err_msdu_continuation_get(): Get wbm msdu continuation
  1480. * bit from wbm release ring descriptor
  1481. * @wbm_desc: wbm ring descriptor
  1482. * Return: uint8_t
  1483. */
  1484. static inline
  1485. uint8_t hal_rx_wbm_err_msdu_continuation_get(hal_soc_handle_t hal_soc_hdl,
  1486. void *wbm_desc)
  1487. {
  1488. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1489. return hal_soc->ops->hal_rx_wbm_err_msdu_continuation_get(wbm_desc);
  1490. }
  1491. /**
  1492. * hal_rx_mon_hw_desc_get_mpdu_status: Retrieve MPDU status
  1493. *
  1494. * @ hal_soc: HAL version of the SOC pointer
  1495. * @ hw_desc_addr: Start address of Rx HW TLVs
  1496. * @ rs: Status for monitor mode
  1497. *
  1498. * Return: void
  1499. */
  1500. static inline
  1501. void hal_rx_mon_hw_desc_get_mpdu_status(hal_soc_handle_t hal_soc_hdl,
  1502. void *hw_desc_addr,
  1503. struct mon_rx_status *rs)
  1504. {
  1505. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1506. hal_soc->ops->hal_rx_mon_hw_desc_get_mpdu_status(hw_desc_addr, rs);
  1507. }
  1508. /*
  1509. * hal_rx_get_tlv(): API to get the tlv
  1510. *
  1511. * @hal_soc: HAL version of the SOC pointer
  1512. * @rx_tlv: TLV data extracted from the rx packet
  1513. * Return: uint8_t
  1514. */
  1515. static inline uint8_t hal_rx_get_tlv(struct hal_soc *hal_soc, void *rx_tlv)
  1516. {
  1517. return hal_soc->ops->hal_rx_get_tlv(rx_tlv);
  1518. }
  1519. /*
  1520. * hal_rx_msdu_start_nss_get(): API to get the NSS
  1521. * Interval from rx_msdu_start
  1522. *
  1523. * @hal_soc: HAL version of the SOC pointer
  1524. * @buf: pointer to the start of RX PKT TLV header
  1525. * Return: uint32_t(nss)
  1526. */
  1527. static inline
  1528. uint32_t hal_rx_msdu_start_nss_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  1529. {
  1530. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1531. return hal_soc->ops->hal_rx_msdu_start_nss_get(buf);
  1532. }
  1533. /**
  1534. * hal_rx_dump_msdu_start_tlv: dump RX msdu_start TLV in structured
  1535. * human readable format.
  1536. * @ msdu_start: pointer the msdu_start TLV in pkt.
  1537. * @ dbg_level: log level.
  1538. *
  1539. * Return: void
  1540. */
  1541. static inline void hal_rx_dump_msdu_start_tlv(struct hal_soc *hal_soc,
  1542. struct rx_msdu_start *msdu_start,
  1543. uint8_t dbg_level)
  1544. {
  1545. hal_soc->ops->hal_rx_dump_msdu_start_tlv(msdu_start, dbg_level);
  1546. }
  1547. /**
  1548. * hal_rx_mpdu_start_tid_get - Return tid info from the rx mpdu start
  1549. * info details
  1550. *
  1551. * @ buf - Pointer to buffer containing rx pkt tlvs.
  1552. *
  1553. *
  1554. */
  1555. static inline uint32_t hal_rx_mpdu_start_tid_get(hal_soc_handle_t hal_soc_hdl,
  1556. uint8_t *buf)
  1557. {
  1558. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1559. return hal_soc->ops->hal_rx_mpdu_start_tid_get(buf);
  1560. }
  1561. /*
  1562. * hal_rx_msdu_start_reception_type_get(): API to get the reception type
  1563. * Interval from rx_msdu_start
  1564. *
  1565. * @buf: pointer to the start of RX PKT TLV header
  1566. * Return: uint32_t(reception_type)
  1567. */
  1568. static inline
  1569. uint32_t hal_rx_msdu_start_reception_type_get(hal_soc_handle_t hal_soc_hdl,
  1570. uint8_t *buf)
  1571. {
  1572. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1573. return hal_soc->ops->hal_rx_msdu_start_reception_type_get(buf);
  1574. }
  1575. /**
  1576. * hal_reo_status_get_header_generic - Process reo desc info
  1577. * @d - Pointer to reo descriptior
  1578. * @b - tlv type info
  1579. * @h - Pointer to hal_reo_status_header where info to be stored
  1580. * @hal- pointer to hal_soc structure
  1581. * Return - none.
  1582. *
  1583. */
  1584. static inline
  1585. void hal_reo_status_get_header(hal_ring_desc_t ring_desc, int b,
  1586. void *h, struct hal_soc *hal_soc)
  1587. {
  1588. hal_soc->ops->hal_reo_status_get_header(ring_desc, b, h);
  1589. }
  1590. /**
  1591. * hal_rx_desc_is_first_msdu() - Check if first msdu
  1592. *
  1593. * @hal_soc_hdl: hal_soc handle
  1594. * @hw_desc_addr: hardware descriptor address
  1595. *
  1596. * Return: 0 - success/ non-zero failure
  1597. */
  1598. static inline
  1599. uint32_t hal_rx_desc_is_first_msdu(hal_soc_handle_t hal_soc_hdl,
  1600. void *hw_desc_addr)
  1601. {
  1602. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1603. return hal_soc->ops->hal_rx_desc_is_first_msdu(hw_desc_addr);
  1604. }
  1605. /**
  1606. * hal_rx_tlv_populate_mpdu_desc_info() - Populate mpdu_desc_info fields from
  1607. * the rx tlv fields.
  1608. * @hal_soc_hdl: HAL SoC handle
  1609. * @buf: rx tlv start address [To be validated by caller]
  1610. * @mpdu_desc_info_hdl: Buffer where the mpdu_desc_info is to be populated.
  1611. *
  1612. * Return: None
  1613. */
  1614. static inline void
  1615. hal_rx_tlv_populate_mpdu_desc_info(hal_soc_handle_t hal_soc_hdl,
  1616. uint8_t *buf,
  1617. void *mpdu_desc_info_hdl)
  1618. {
  1619. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1620. if (hal_soc->ops->hal_rx_tlv_populate_mpdu_desc_info)
  1621. return hal_soc->ops->hal_rx_tlv_populate_mpdu_desc_info(buf,
  1622. mpdu_desc_info_hdl);
  1623. }
  1624. static inline uint32_t
  1625. hal_rx_tlv_decap_format_get(hal_soc_handle_t hal_soc_hdl, void *hw_desc_addr)
  1626. {
  1627. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1628. return hal_soc->ops->hal_rx_tlv_decap_format_get(hw_desc_addr);
  1629. }
  1630. static inline
  1631. bool HAL_IS_DECAP_FORMAT_RAW(hal_soc_handle_t hal_soc_hdl,
  1632. uint8_t *rx_tlv_hdr)
  1633. {
  1634. uint8_t decap_format;
  1635. if (hal_rx_desc_is_first_msdu(hal_soc_hdl, rx_tlv_hdr)) {
  1636. decap_format = hal_rx_tlv_decap_format_get(hal_soc_hdl,
  1637. rx_tlv_hdr);
  1638. if (decap_format == HAL_HW_RX_DECAP_FORMAT_RAW)
  1639. return true;
  1640. }
  1641. return false;
  1642. }
  1643. /**
  1644. * hal_rx_msdu_fse_metadata_get: API to get FSE metadata
  1645. * from rx_msdu_end TLV
  1646. * @buf: pointer to the start of RX PKT TLV headers
  1647. *
  1648. * Return: fse metadata value from MSDU END TLV
  1649. */
  1650. static inline uint32_t
  1651. hal_rx_msdu_fse_metadata_get(hal_soc_handle_t hal_soc_hdl,
  1652. uint8_t *buf)
  1653. {
  1654. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1655. return hal_soc->ops->hal_rx_msdu_fse_metadata_get(buf);
  1656. }
  1657. /**
  1658. * hal_rx_buffer_addr_info_get_paddr(): get paddr/sw_cookie from
  1659. * <struct buffer_addr_info> structure
  1660. * @buf_addr_info: pointer to <struct buffer_addr_info> structure
  1661. * @buf_info: structure to return the buffer information including
  1662. * paddr/cookie
  1663. *
  1664. * return: None
  1665. */
  1666. static inline
  1667. void hal_rx_buffer_addr_info_get_paddr(void *buf_addr_info,
  1668. struct hal_buf_info *buf_info)
  1669. {
  1670. buf_info->paddr =
  1671. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  1672. ((uint64_t)(HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  1673. }
  1674. /**
  1675. * hal_rx_msdu_flow_idx_get: API to get flow index
  1676. * from rx_msdu_end TLV
  1677. * @buf: pointer to the start of RX PKT TLV headers
  1678. *
  1679. * Return: flow index value from MSDU END TLV
  1680. */
  1681. static inline uint32_t
  1682. hal_rx_msdu_flow_idx_get(hal_soc_handle_t hal_soc_hdl,
  1683. uint8_t *buf)
  1684. {
  1685. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1686. return hal_soc->ops->hal_rx_msdu_flow_idx_get(buf);
  1687. }
  1688. /**
  1689. * hal_rx_msdu_get_reo_destination_indication: API to get reo
  1690. * destination index from rx_msdu_end TLV
  1691. * @buf: pointer to the start of RX PKT TLV headers
  1692. * @reo_destination_indication: pointer to return value of
  1693. * reo_destination_indication
  1694. *
  1695. * Return: reo_destination_indication value from MSDU END TLV
  1696. */
  1697. static inline void
  1698. hal_rx_msdu_get_reo_destination_indication(hal_soc_handle_t hal_soc_hdl,
  1699. uint8_t *buf,
  1700. uint32_t *reo_destination_indication)
  1701. {
  1702. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1703. hal_soc->ops->hal_rx_msdu_get_reo_destination_indication(buf,
  1704. reo_destination_indication);
  1705. }
  1706. /**
  1707. * hal_rx_msdu_flow_idx_timeout: API to get flow index timeout
  1708. * from rx_msdu_end TLV
  1709. * @buf: pointer to the start of RX PKT TLV headers
  1710. *
  1711. * Return: flow index timeout value from MSDU END TLV
  1712. */
  1713. static inline bool
  1714. hal_rx_msdu_flow_idx_timeout(hal_soc_handle_t hal_soc_hdl,
  1715. uint8_t *buf)
  1716. {
  1717. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1718. return hal_soc->ops->hal_rx_msdu_flow_idx_timeout(buf);
  1719. }
  1720. /**
  1721. * hal_rx_msdu_flow_idx_invalid: API to get flow index invalid
  1722. * from rx_msdu_end TLV
  1723. * @buf: pointer to the start of RX PKT TLV headers
  1724. *
  1725. * Return: flow index invalid value from MSDU END TLV
  1726. */
  1727. static inline bool
  1728. hal_rx_msdu_flow_idx_invalid(hal_soc_handle_t hal_soc_hdl,
  1729. uint8_t *buf)
  1730. {
  1731. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1732. return hal_soc->ops->hal_rx_msdu_flow_idx_invalid(buf);
  1733. }
  1734. /**
  1735. * hal_rx_hw_desc_get_ppduid_get() - Retrieve ppdu id
  1736. * @hal_soc_hdl: hal_soc handle
  1737. * @rx_tlv_hdr: Rx_tlv_hdr
  1738. * @rxdma_dst_ring_desc: Rx HW descriptor
  1739. *
  1740. * Return: ppdu id
  1741. */
  1742. static inline
  1743. uint32_t hal_rx_hw_desc_get_ppduid_get(hal_soc_handle_t hal_soc_hdl,
  1744. void *rx_tlv_hdr,
  1745. void *rxdma_dst_ring_desc)
  1746. {
  1747. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1748. return hal_soc->ops->hal_rx_hw_desc_get_ppduid_get(rx_tlv_hdr,
  1749. rxdma_dst_ring_desc);
  1750. }
  1751. /**
  1752. * hal_rx_msdu_end_sa_sw_peer_id_get() - get sw peer id
  1753. * @hal_soc_hdl: hal_soc handle
  1754. * @buf: rx tlv address
  1755. *
  1756. * Return: sw peer id
  1757. */
  1758. static inline
  1759. uint32_t hal_rx_msdu_end_sa_sw_peer_id_get(hal_soc_handle_t hal_soc_hdl,
  1760. uint8_t *buf)
  1761. {
  1762. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1763. return hal_soc->ops->hal_rx_msdu_end_sa_sw_peer_id_get(buf);
  1764. }
  1765. static inline
  1766. void *hal_rx_msdu0_buffer_addr_lsb(hal_soc_handle_t hal_soc_hdl,
  1767. void *link_desc_addr)
  1768. {
  1769. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1770. return hal_soc->ops->hal_rx_msdu0_buffer_addr_lsb(link_desc_addr);
  1771. }
  1772. static inline
  1773. void *hal_rx_msdu_desc_info_ptr_get(hal_soc_handle_t hal_soc_hdl,
  1774. void *msdu_addr)
  1775. {
  1776. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1777. return hal_soc->ops->hal_rx_msdu_desc_info_ptr_get(msdu_addr);
  1778. }
  1779. static inline
  1780. void *hal_ent_mpdu_desc_info(hal_soc_handle_t hal_soc_hdl,
  1781. void *hw_addr)
  1782. {
  1783. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1784. return hal_soc->ops->hal_ent_mpdu_desc_info(hw_addr);
  1785. }
  1786. static inline
  1787. void *hal_dst_mpdu_desc_info(hal_soc_handle_t hal_soc_hdl,
  1788. void *hw_addr)
  1789. {
  1790. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1791. return hal_soc->ops->hal_dst_mpdu_desc_info(hw_addr);
  1792. }
  1793. static inline
  1794. uint8_t hal_rx_get_fc_valid(hal_soc_handle_t hal_soc_hdl,
  1795. uint8_t *buf)
  1796. {
  1797. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1798. return hal_soc->ops->hal_rx_get_fc_valid(buf);
  1799. }
  1800. static inline
  1801. uint8_t hal_rx_get_to_ds_flag(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  1802. {
  1803. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1804. return hal_soc->ops->hal_rx_get_to_ds_flag(buf);
  1805. }
  1806. static inline
  1807. uint8_t hal_rx_get_mac_addr2_valid(hal_soc_handle_t hal_soc_hdl,
  1808. uint8_t *buf)
  1809. {
  1810. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1811. return hal_soc->ops->hal_rx_get_mac_addr2_valid(buf);
  1812. }
  1813. static inline
  1814. uint8_t hal_rx_get_filter_category(hal_soc_handle_t hal_soc_hdl,
  1815. uint8_t *buf)
  1816. {
  1817. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1818. return hal_soc->ops->hal_rx_get_filter_category(buf);
  1819. }
  1820. static inline
  1821. uint32_t hal_rx_get_ppdu_id(hal_soc_handle_t hal_soc_hdl,
  1822. uint8_t *buf)
  1823. {
  1824. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1825. return hal_soc->ops->hal_rx_get_ppdu_id(buf);
  1826. }
  1827. /**
  1828. * hal_reo_config(): Set reo config parameters
  1829. * @soc: hal soc handle
  1830. * @reg_val: value to be set
  1831. * @reo_params: reo parameters
  1832. *
  1833. * Return: void
  1834. */
  1835. static inline
  1836. void hal_reo_config(struct hal_soc *hal_soc,
  1837. uint32_t reg_val,
  1838. struct hal_reo_params *reo_params)
  1839. {
  1840. hal_soc->ops->hal_reo_config(hal_soc,
  1841. reg_val,
  1842. reo_params);
  1843. }
  1844. /**
  1845. * hal_rx_msdu_get_flow_params: API to get flow index,
  1846. * flow index invalid and flow index timeout from rx_msdu_end TLV
  1847. * @buf: pointer to the start of RX PKT TLV headers
  1848. * @flow_invalid: pointer to return value of flow_idx_valid
  1849. * @flow_timeout: pointer to return value of flow_idx_timeout
  1850. * @flow_index: pointer to return value of flow_idx
  1851. *
  1852. * Return: none
  1853. */
  1854. static inline void
  1855. hal_rx_msdu_get_flow_params(hal_soc_handle_t hal_soc_hdl,
  1856. uint8_t *buf,
  1857. bool *flow_invalid,
  1858. bool *flow_timeout,
  1859. uint32_t *flow_index)
  1860. {
  1861. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1862. hal_soc->ops->hal_rx_msdu_get_flow_params(buf,
  1863. flow_invalid,
  1864. flow_timeout,
  1865. flow_index);
  1866. }
  1867. static inline
  1868. uint16_t hal_rx_tlv_get_tcp_chksum(hal_soc_handle_t hal_soc_hdl,
  1869. uint8_t *buf)
  1870. {
  1871. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1872. return hal_soc->ops->hal_rx_tlv_get_tcp_chksum(buf);
  1873. }
  1874. static inline
  1875. uint16_t hal_rx_get_rx_sequence(hal_soc_handle_t hal_soc_hdl,
  1876. uint8_t *buf)
  1877. {
  1878. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1879. return hal_soc->ops->hal_rx_get_rx_sequence(buf);
  1880. }
  1881. static inline void
  1882. hal_rx_get_bb_info(hal_soc_handle_t hal_soc_hdl,
  1883. void *rx_tlv,
  1884. void *ppdu_info)
  1885. {
  1886. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1887. if (hal_soc->ops->hal_rx_get_bb_info)
  1888. hal_soc->ops->hal_rx_get_bb_info(rx_tlv, ppdu_info);
  1889. }
  1890. static inline void
  1891. hal_rx_get_rtt_info(hal_soc_handle_t hal_soc_hdl,
  1892. void *rx_tlv,
  1893. void *ppdu_info)
  1894. {
  1895. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1896. if (hal_soc->ops->hal_rx_get_rtt_info)
  1897. hal_soc->ops->hal_rx_get_rtt_info(rx_tlv, ppdu_info);
  1898. }
  1899. /**
  1900. * hal_rx_msdu_metadata_get(): API to get the
  1901. * fast path information from rx_msdu_end TLV
  1902. *
  1903. * @ hal_soc_hdl: DP soc handle
  1904. * @ buf: pointer to the start of RX PKT TLV headers
  1905. * @ msdu_metadata: Structure to hold msdu end information
  1906. * Return: none
  1907. */
  1908. static inline void
  1909. hal_rx_msdu_metadata_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf,
  1910. struct hal_rx_msdu_metadata *msdu_md)
  1911. {
  1912. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1913. return hal_soc->ops->hal_rx_msdu_packet_metadata_get(buf, msdu_md);
  1914. }
  1915. /**
  1916. * hal_rx_get_fisa_cumulative_l4_checksum: API to get cumulative_l4_checksum
  1917. * from rx_msdu_end TLV
  1918. * @buf: pointer to the start of RX PKT TLV headers
  1919. *
  1920. * Return: cumulative_l4_checksum
  1921. */
  1922. static inline uint16_t
  1923. hal_rx_get_fisa_cumulative_l4_checksum(hal_soc_handle_t hal_soc_hdl,
  1924. uint8_t *buf)
  1925. {
  1926. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1927. if (!hal_soc || !hal_soc->ops) {
  1928. hal_err("hal handle is NULL");
  1929. QDF_BUG(0);
  1930. return 0;
  1931. }
  1932. if (!hal_soc->ops->hal_rx_get_fisa_cumulative_l4_checksum)
  1933. return 0;
  1934. return hal_soc->ops->hal_rx_get_fisa_cumulative_l4_checksum(buf);
  1935. }
  1936. /**
  1937. * hal_rx_get_fisa_cumulative_ip_length: API to get cumulative_ip_length
  1938. * from rx_msdu_end TLV
  1939. * @buf: pointer to the start of RX PKT TLV headers
  1940. *
  1941. * Return: cumulative_ip_length
  1942. */
  1943. static inline uint16_t
  1944. hal_rx_get_fisa_cumulative_ip_length(hal_soc_handle_t hal_soc_hdl,
  1945. uint8_t *buf)
  1946. {
  1947. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1948. if (!hal_soc || !hal_soc->ops) {
  1949. hal_err("hal handle is NULL");
  1950. QDF_BUG(0);
  1951. return 0;
  1952. }
  1953. if (hal_soc->ops->hal_rx_get_fisa_cumulative_ip_length)
  1954. return hal_soc->ops->hal_rx_get_fisa_cumulative_ip_length(buf);
  1955. return 0;
  1956. }
  1957. /**
  1958. * hal_rx_get_udp_proto: API to get UDP proto field
  1959. * from rx_msdu_start TLV
  1960. * @buf: pointer to the start of RX PKT TLV headers
  1961. *
  1962. * Return: UDP proto field value
  1963. */
  1964. static inline bool
  1965. hal_rx_get_udp_proto(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  1966. {
  1967. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1968. if (!hal_soc || !hal_soc->ops) {
  1969. hal_err("hal handle is NULL");
  1970. QDF_BUG(0);
  1971. return 0;
  1972. }
  1973. if (hal_soc->ops->hal_rx_get_udp_proto)
  1974. return hal_soc->ops->hal_rx_get_udp_proto(buf);
  1975. return 0;
  1976. }
  1977. /**
  1978. * hal_rx_get_fisa_flow_agg_continuation: API to get fisa flow_agg_continuation
  1979. * from rx_msdu_end TLV
  1980. * @buf: pointer to the start of RX PKT TLV headers
  1981. *
  1982. * Return: flow_agg_continuation bit field value
  1983. */
  1984. static inline bool
  1985. hal_rx_get_fisa_flow_agg_continuation(hal_soc_handle_t hal_soc_hdl,
  1986. uint8_t *buf)
  1987. {
  1988. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1989. if (!hal_soc || !hal_soc->ops) {
  1990. hal_err("hal handle is NULL");
  1991. QDF_BUG(0);
  1992. return 0;
  1993. }
  1994. if (hal_soc->ops->hal_rx_get_fisa_flow_agg_continuation)
  1995. return hal_soc->ops->hal_rx_get_fisa_flow_agg_continuation(buf);
  1996. return 0;
  1997. }
  1998. /**
  1999. * hal_rx_get_fisa_flow_agg_count: API to get fisa flow_agg count from
  2000. * rx_msdu_end TLV
  2001. * @buf: pointer to the start of RX PKT TLV headers
  2002. *
  2003. * Return: flow_agg count value
  2004. */
  2005. static inline uint8_t
  2006. hal_rx_get_fisa_flow_agg_count(hal_soc_handle_t hal_soc_hdl,
  2007. uint8_t *buf)
  2008. {
  2009. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2010. if (!hal_soc || !hal_soc->ops) {
  2011. hal_err("hal handle is NULL");
  2012. QDF_BUG(0);
  2013. return 0;
  2014. }
  2015. if (hal_soc->ops->hal_rx_get_fisa_flow_agg_count)
  2016. return hal_soc->ops->hal_rx_get_fisa_flow_agg_count(buf);
  2017. return 0;
  2018. }
  2019. /**
  2020. * hal_rx_get_fisa_timeout: API to get fisa time out from rx_msdu_end TLV
  2021. * @buf: pointer to the start of RX PKT TLV headers
  2022. *
  2023. * Return: fisa flow_agg timeout bit value
  2024. */
  2025. static inline bool
  2026. hal_rx_get_fisa_timeout(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2027. {
  2028. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2029. if (!hal_soc || !hal_soc->ops) {
  2030. hal_err("hal handle is NULL");
  2031. QDF_BUG(0);
  2032. return 0;
  2033. }
  2034. if (hal_soc->ops->hal_rx_get_fisa_timeout)
  2035. return hal_soc->ops->hal_rx_get_fisa_timeout(buf);
  2036. return 0;
  2037. }
  2038. /**
  2039. * hal_rx_mpdu_start_tlv_tag_valid - API to check if RX_MPDU_START tlv
  2040. * tag is valid
  2041. *
  2042. * @hal_soc_hdl: HAL SOC handle
  2043. * @rx_tlv_hdr: start address of rx_pkt_tlvs
  2044. *
  2045. * Return: true if RX_MPDU_START tlv tag is valid, else false
  2046. */
  2047. static inline uint8_t
  2048. hal_rx_mpdu_start_tlv_tag_valid(hal_soc_handle_t hal_soc_hdl,
  2049. void *rx_tlv_hdr)
  2050. {
  2051. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2052. if (hal->ops->hal_rx_mpdu_start_tlv_tag_valid)
  2053. return hal->ops->hal_rx_mpdu_start_tlv_tag_valid(rx_tlv_hdr);
  2054. return 0;
  2055. }
  2056. /**
  2057. * hal_rx_get_next_msdu_link_desc_buf_addr_info(): get next msdu link desc
  2058. * buffer addr info
  2059. * @link_desc_va: pointer to current msdu link Desc
  2060. * @next_addr_info: buffer to save next msdu link Desc buffer addr info
  2061. *
  2062. * return: None
  2063. */
  2064. static inline void hal_rx_get_next_msdu_link_desc_buf_addr_info(
  2065. void *link_desc_va,
  2066. struct buffer_addr_info *next_addr_info)
  2067. {
  2068. struct rx_msdu_link *msdu_link = link_desc_va;
  2069. if (!msdu_link) {
  2070. qdf_mem_zero(next_addr_info, sizeof(struct buffer_addr_info));
  2071. return;
  2072. }
  2073. *next_addr_info = msdu_link->next_msdu_link_desc_addr_info;
  2074. }
  2075. /**
  2076. * hal_rx_clear_next_msdu_link_desc_buf_addr_info(): clear next msdu link desc
  2077. * buffer addr info
  2078. * @link_desc_va: pointer to current msdu link Desc
  2079. *
  2080. * return: None
  2081. */
  2082. static inline
  2083. void hal_rx_clear_next_msdu_link_desc_buf_addr_info(void *link_desc_va)
  2084. {
  2085. struct rx_msdu_link *msdu_link = link_desc_va;
  2086. if (msdu_link)
  2087. qdf_mem_zero(&msdu_link->next_msdu_link_desc_addr_info,
  2088. sizeof(msdu_link->next_msdu_link_desc_addr_info));
  2089. }
  2090. /**
  2091. * hal_rx_is_buf_addr_info_valid(): check is the buf_addr_info valid
  2092. *
  2093. * @buf_addr_info: pointer to buf_addr_info structure
  2094. *
  2095. * return: true: has valid paddr, false: not.
  2096. */
  2097. static inline
  2098. bool hal_rx_is_buf_addr_info_valid(struct buffer_addr_info *buf_addr_info)
  2099. {
  2100. return (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) == 0) ?
  2101. false : true;
  2102. }
  2103. /**
  2104. * hal_rx_msdu_end_offset_get(): Get the MSDU end offset from
  2105. * rx_pkt_tlvs structure
  2106. *
  2107. * @hal_soc_hdl: HAL SOC handle
  2108. * return: msdu_end_tlv offset value
  2109. */
  2110. static inline
  2111. uint32_t hal_rx_msdu_end_offset_get(hal_soc_handle_t hal_soc_hdl)
  2112. {
  2113. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2114. if (!hal_soc || !hal_soc->ops) {
  2115. hal_err("hal handle is NULL");
  2116. QDF_BUG(0);
  2117. return 0;
  2118. }
  2119. return hal_soc->ops->hal_rx_msdu_end_offset_get();
  2120. }
  2121. /**
  2122. * hal_rx_msdu_start_offset_get(): Get the MSDU start offset from
  2123. * rx_pkt_tlvs structure
  2124. *
  2125. * @hal_soc_hdl: HAL SOC handle
  2126. * return: msdu_start_tlv offset value
  2127. */
  2128. static inline
  2129. uint32_t hal_rx_msdu_start_offset_get(hal_soc_handle_t hal_soc_hdl)
  2130. {
  2131. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2132. if (!hal_soc || !hal_soc->ops) {
  2133. hal_err("hal handle is NULL");
  2134. QDF_BUG(0);
  2135. return 0;
  2136. }
  2137. return hal_soc->ops->hal_rx_msdu_start_offset_get();
  2138. }
  2139. /**
  2140. * hal_rx_mpdu_start_offset_get(): Get the MPDU start offset from
  2141. * rx_pkt_tlvs structure
  2142. *
  2143. * @hal_soc_hdl: HAL SOC handle
  2144. * return: mpdu_start_tlv offset value
  2145. */
  2146. static inline
  2147. uint32_t hal_rx_mpdu_start_offset_get(hal_soc_handle_t hal_soc_hdl)
  2148. {
  2149. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2150. if (!hal_soc || !hal_soc->ops) {
  2151. hal_err("hal handle is NULL");
  2152. QDF_BUG(0);
  2153. return 0;
  2154. }
  2155. return hal_soc->ops->hal_rx_mpdu_start_offset_get();
  2156. }
  2157. static inline
  2158. uint32_t hal_rx_pkt_tlv_offset_get(hal_soc_handle_t hal_soc_hdl)
  2159. {
  2160. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2161. if (!hal_soc || !hal_soc->ops) {
  2162. hal_err("hal handle is NULL");
  2163. QDF_BUG(0);
  2164. return 0;
  2165. }
  2166. return hal_soc->ops->hal_rx_pkt_tlv_offset_get();
  2167. }
  2168. /**
  2169. * hal_rx_mpdu_end_offset_get(): Get the MPDU end offset from
  2170. * rx_pkt_tlvs structure
  2171. *
  2172. * @hal_soc_hdl: HAL SOC handle
  2173. * return: mpdu_end_tlv offset value
  2174. */
  2175. static inline
  2176. uint32_t hal_rx_mpdu_end_offset_get(hal_soc_handle_t hal_soc_hdl)
  2177. {
  2178. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2179. if (!hal_soc || !hal_soc->ops) {
  2180. hal_err("hal handle is NULL");
  2181. QDF_BUG(0);
  2182. return 0;
  2183. }
  2184. return hal_soc->ops->hal_rx_mpdu_end_offset_get();
  2185. }
  2186. /**
  2187. * hal_rx_attn_offset_get(): Get the ATTENTION offset from
  2188. * rx_pkt_tlvs structure
  2189. *
  2190. * @hal_soc_hdl: HAL SOC handle
  2191. * return: attn_tlv offset value
  2192. */
  2193. static inline
  2194. uint32_t hal_rx_attn_offset_get(hal_soc_handle_t hal_soc_hdl)
  2195. {
  2196. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2197. if (!hal_soc || !hal_soc->ops) {
  2198. hal_err("hal handle is NULL");
  2199. QDF_BUG(0);
  2200. return 0;
  2201. }
  2202. return hal_soc->ops->hal_rx_attn_offset_get();
  2203. }
  2204. /**
  2205. * hal_rx_msdu_desc_info_get_ptr() - Get msdu desc info ptr
  2206. * @msdu_details_ptr - Pointer to msdu_details_ptr
  2207. * @hal - pointer to hal_soc
  2208. * Return - Pointer to rx_msdu_desc_info structure.
  2209. *
  2210. */
  2211. static inline
  2212. void *hal_rx_msdu_ext_desc_info_get_ptr(void *msdu_details_ptr,
  2213. struct hal_soc *hal_soc)
  2214. {
  2215. return hal_soc->ops->hal_rx_msdu_ext_desc_info_get_ptr(
  2216. msdu_details_ptr);
  2217. }
  2218. static inline void
  2219. hal_rx_dump_pkt_tlvs(hal_soc_handle_t hal_soc_hdl,
  2220. uint8_t *buf, uint8_t dbg_level)
  2221. {
  2222. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2223. hal_soc->ops->hal_rx_dump_pkt_tlvs(hal_soc_hdl, buf, dbg_level);
  2224. }
  2225. //TODO - Change the names to not include tlv names
  2226. static inline uint16_t
  2227. hal_rx_attn_phy_ppdu_id_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2228. {
  2229. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2230. return hal_soc->ops->hal_rx_tlv_phy_ppdu_id_get(buf);
  2231. }
  2232. static inline uint32_t
  2233. hal_rx_attn_msdu_done_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2234. {
  2235. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2236. return hal_soc->ops->hal_rx_tlv_msdu_done_get(buf);
  2237. }
  2238. static inline uint32_t
  2239. hal_rx_msdu_start_msdu_len_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2240. {
  2241. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2242. return hal_soc->ops->hal_rx_tlv_msdu_len_get(buf);
  2243. }
  2244. static inline uint16_t
  2245. hal_rx_get_frame_ctrl_field(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2246. {
  2247. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2248. return hal_soc->ops->hal_rx_get_frame_ctrl_field(buf);
  2249. }
  2250. static inline int
  2251. hal_rx_tlv_get_offload_info(hal_soc_handle_t hal_soc_hdl,
  2252. uint8_t *rx_pkt_tlv,
  2253. struct hal_offload_info *offload_info)
  2254. {
  2255. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2256. return hal_soc->ops->hal_rx_tlv_get_offload_info(rx_pkt_tlv,
  2257. offload_info);
  2258. }
  2259. static inline int
  2260. hal_rx_get_proto_params(hal_soc_handle_t hal_soc_hdl, uint8_t *buf,
  2261. void *proto_params)
  2262. {
  2263. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2264. return hal_soc->ops->hal_rx_get_proto_params(buf, proto_params);
  2265. }
  2266. static inline int
  2267. hal_rx_get_l3_l4_offsets(hal_soc_handle_t hal_soc_hdl, uint8_t *buf,
  2268. uint32_t *l3_hdr_offset, uint32_t *l4_hdr_offset)
  2269. {
  2270. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2271. return hal_soc->ops->hal_rx_get_l3_l4_offsets(buf,
  2272. l3_hdr_offset,
  2273. l4_hdr_offset);
  2274. }
  2275. static inline uint32_t
  2276. hal_rx_tlv_mic_err_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2277. {
  2278. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2279. return hal_soc->ops->hal_rx_tlv_mic_err_get(buf);
  2280. }
  2281. /*
  2282. * hal_rx_tlv_get_pkt_type(): API to get the pkt type
  2283. * from rx_msdu_start
  2284. *
  2285. * @buf: pointer to the start of RX PKT TLV header
  2286. * Return: uint32_t(pkt type)
  2287. */
  2288. static inline uint32_t
  2289. hal_rx_tlv_get_pkt_type(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2290. {
  2291. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2292. return hal_soc->ops->hal_rx_tlv_get_pkt_type(buf);
  2293. }
  2294. static inline void
  2295. hal_rx_tlv_get_pn_num(hal_soc_handle_t hal_soc_hdl,
  2296. uint8_t *buf, uint64_t *pn_num)
  2297. {
  2298. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2299. hal_soc->ops->hal_rx_tlv_get_pn_num(buf, pn_num);
  2300. }
  2301. static inline uint8_t *
  2302. hal_get_reo_ent_desc_qdesc_addr(hal_soc_handle_t hal_soc_hdl, uint8_t *desc)
  2303. {
  2304. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2305. if (hal_soc->ops->hal_get_reo_ent_desc_qdesc_addr)
  2306. return hal_soc->ops->hal_get_reo_ent_desc_qdesc_addr(desc);
  2307. return NULL;
  2308. }
  2309. static inline uint64_t
  2310. hal_rx_get_qdesc_addr(hal_soc_handle_t hal_soc_hdl, uint8_t *dst_ring_desc,
  2311. uint8_t *buf)
  2312. {
  2313. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2314. if (hal_soc->ops->hal_rx_get_qdesc_addr)
  2315. return hal_soc->ops->hal_rx_get_qdesc_addr(dst_ring_desc, buf);
  2316. return 0;
  2317. }
  2318. static inline void
  2319. hal_set_reo_ent_desc_reo_dest_ind(hal_soc_handle_t hal_soc_hdl,
  2320. uint8_t *desc, uint32_t dst_ind)
  2321. {
  2322. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2323. if (hal_soc->ops->hal_set_reo_ent_desc_reo_dest_ind)
  2324. hal_soc->ops->hal_set_reo_ent_desc_reo_dest_ind(desc, dst_ind);
  2325. }
  2326. static inline uint32_t
  2327. hal_rx_tlv_get_is_decrypted(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2328. {
  2329. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2330. if (hal_soc->ops->hal_rx_tlv_get_is_decrypted)
  2331. return hal_soc->ops->hal_rx_tlv_get_is_decrypted(buf);
  2332. return 0;
  2333. }
  2334. static inline uint8_t *
  2335. hal_rx_pkt_hdr_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2336. {
  2337. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2338. return hal_soc->ops->hal_rx_pkt_hdr_get(buf);
  2339. }
  2340. static inline uint8_t
  2341. hal_rx_msdu_get_keyid(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2342. {
  2343. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2344. if (hal_soc->ops->hal_rx_msdu_get_keyid)
  2345. return hal_soc->ops->hal_rx_msdu_get_keyid(buf);
  2346. return 0;
  2347. }
  2348. static inline uint32_t
  2349. hal_rx_tlv_get_freq(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2350. {
  2351. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2352. if (hal_soc->ops->hal_rx_tlv_get_freq)
  2353. return hal_soc->ops->hal_rx_tlv_get_freq(buf);
  2354. return 0;
  2355. }
  2356. static inline void hal_mpdu_desc_info_set(hal_soc_handle_t hal_soc_hdl,
  2357. void *mpdu_desc_info, uint32_t val)
  2358. {
  2359. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2360. if (hal_soc->ops->hal_mpdu_desc_info_set)
  2361. return hal_soc->ops->hal_mpdu_desc_info_set(
  2362. hal_soc_hdl, mpdu_desc_info, val);
  2363. }
  2364. static inline void hal_msdu_desc_info_set(hal_soc_handle_t hal_soc_hdl,
  2365. void *msdu_desc_info,
  2366. uint32_t val, uint32_t nbuf_len)
  2367. {
  2368. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2369. if (hal_soc->ops->hal_msdu_desc_info_set)
  2370. return hal_soc->ops->hal_msdu_desc_info_set(
  2371. hal_soc_hdl, msdu_desc_info, val, nbuf_len);
  2372. }
  2373. static inline uint32_t
  2374. hal_rx_msdu_reo_dst_ind_get(hal_soc_handle_t hal_soc_hdl, void *msdu_link_desc)
  2375. {
  2376. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2377. if (hal_soc->ops->hal_rx_msdu_reo_dst_ind_get)
  2378. return hal_soc->ops->hal_rx_msdu_reo_dst_ind_get(
  2379. hal_soc_hdl, msdu_link_desc);
  2380. return 0;
  2381. }
  2382. static inline uint32_t
  2383. hal_rx_tlv_sgi_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2384. {
  2385. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2386. return hal_soc->ops->hal_rx_tlv_sgi_get(buf);
  2387. }
  2388. static inline uint32_t
  2389. hal_rx_tlv_rate_mcs_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2390. {
  2391. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2392. return hal_soc->ops->hal_rx_tlv_rate_mcs_get(buf);
  2393. }
  2394. static inline uint32_t
  2395. hal_rx_tlv_decrypt_err_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2396. {
  2397. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2398. return hal_soc->ops->hal_rx_tlv_decrypt_err_get(buf);
  2399. }
  2400. static inline uint32_t
  2401. hal_rx_tlv_first_mpdu_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2402. {
  2403. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2404. return hal_soc->ops->hal_rx_tlv_first_mpdu_get(buf);
  2405. }
  2406. static inline uint32_t
  2407. hal_rx_tlv_bw_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2408. {
  2409. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2410. return hal_soc->ops->hal_rx_tlv_bw_get(buf);
  2411. }
  2412. static inline uint32_t
  2413. hal_rx_wbm_err_src_get(hal_soc_handle_t hal_soc_hdl,
  2414. hal_ring_desc_t ring_desc)
  2415. {
  2416. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2417. return hal_soc->ops->hal_rx_wbm_err_src_get(ring_desc);
  2418. }
  2419. /**
  2420. * hal_rx_ret_buf_manager_get: Returns the "return_buffer_manager"
  2421. * from the BUFFER_ADDR_INFO structure
  2422. * given a REO destination ring descriptor.
  2423. * @ ring_desc: RX(REO/WBM release) destination ring descriptor
  2424. *
  2425. * Return: uint8_t (value of the return_buffer_manager)
  2426. */
  2427. static inline uint8_t
  2428. hal_rx_ret_buf_manager_get(hal_soc_handle_t hal_soc_hdl,
  2429. hal_ring_desc_t ring_desc)
  2430. {
  2431. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2432. return hal_soc->ops->hal_rx_ret_buf_manager_get(ring_desc);
  2433. }
  2434. /*
  2435. * hal_rxdma_buff_addr_info_set() - set the buffer_addr_info of the
  2436. * rxdma ring entry.
  2437. * @rxdma_entry: descriptor entry
  2438. * @paddr: physical address of nbuf data pointer.
  2439. * @cookie: SW cookie used as a index to SW rx desc.
  2440. * @manager: who owns the nbuf (host, NSS, etc...).
  2441. *
  2442. */
  2443. static inline void hal_rxdma_buff_addr_info_set(hal_soc_handle_t hal_soc_hdl,
  2444. void *rxdma_entry,
  2445. qdf_dma_addr_t paddr,
  2446. uint32_t cookie,
  2447. uint8_t manager)
  2448. {
  2449. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2450. return hal_soc->ops->hal_rxdma_buff_addr_info_set(rxdma_entry,
  2451. paddr,
  2452. cookie,
  2453. manager);
  2454. }
  2455. static inline uint32_t
  2456. hal_rx_get_reo_error_code(hal_soc_handle_t hal_soc_hdl, hal_ring_desc_t rx_desc)
  2457. {
  2458. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2459. return hal_soc->ops->hal_rx_get_reo_error_code(rx_desc);
  2460. }
  2461. static inline void
  2462. hal_rx_tlv_csum_err_get(hal_soc_handle_t hal_soc_hdl, uint8_t *rx_tlv_hdr,
  2463. uint32_t *ip_csum_err, uint32_t *tcp_udp_csum_err)
  2464. {
  2465. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2466. return hal_soc->ops->hal_rx_tlv_csum_err_get(rx_tlv_hdr,
  2467. ip_csum_err,
  2468. tcp_udp_csum_err);
  2469. }
  2470. static inline void
  2471. hal_rx_tlv_get_pkt_capture_flags(hal_soc_handle_t hal_soc_hdl,
  2472. uint8_t *rx_tlv_hdr,
  2473. struct hal_rx_pkt_capture_flags *flags)
  2474. {
  2475. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2476. return hal_soc->ops->hal_rx_tlv_get_pkt_capture_flags(rx_tlv_hdr,
  2477. flags);
  2478. }
  2479. static inline uint8_t
  2480. hal_rx_err_status_get(hal_soc_handle_t hal_soc_hdl, hal_ring_desc_t rx_desc)
  2481. {
  2482. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2483. return hal_soc->ops->hal_rx_err_status_get(rx_desc);
  2484. }
  2485. static inline uint8_t
  2486. hal_rx_reo_buf_type_get(hal_soc_handle_t hal_soc_hdl, hal_ring_desc_t rx_desc)
  2487. {
  2488. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2489. return hal_soc->ops->hal_rx_reo_buf_type_get(rx_desc);
  2490. }
  2491. /**
  2492. * hal_rx_reo_prev_pn_get() - Get the previous pn from ring descriptor.
  2493. * @hal_soc_hdl: HAL SoC handle
  2494. * @ring_desc: REO ring descriptor
  2495. * @prev_pn: Buffer to populate the previos PN
  2496. *
  2497. * Return: None
  2498. */
  2499. static inline void
  2500. hal_rx_reo_prev_pn_get(hal_soc_handle_t hal_soc_hdl, hal_ring_desc_t ring_desc,
  2501. uint64_t *prev_pn)
  2502. {
  2503. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2504. if (hal_soc->ops->hal_rx_reo_prev_pn_get)
  2505. return hal_soc->ops->hal_rx_reo_prev_pn_get(ring_desc, prev_pn);
  2506. }
  2507. /**
  2508. * hal_rx_mpdu_info_ampdu_flag_get(): get ampdu flag bit
  2509. * from rx mpdu info
  2510. * @buf: pointer to rx_pkt_tlvs
  2511. *
  2512. * No input validdataion, since this function is supposed to be
  2513. * called from fastpath.
  2514. *
  2515. * Return: ampdu flag
  2516. */
  2517. static inline bool
  2518. hal_rx_mpdu_info_ampdu_flag_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2519. {
  2520. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2521. return hal_soc->ops->hal_rx_mpdu_info_ampdu_flag_get(buf);
  2522. }
  2523. #ifdef REO_SHARED_QREF_TABLE_EN
  2524. /**
  2525. * hal_reo_shared_qaddr_write(): Write REo tid queue addr
  2526. * LUT shared by SW and HW at the index given by peer id
  2527. * and tid.
  2528. *
  2529. * @hal_soc: hal soc pointer
  2530. * @reo_qref_addr: pointer to index pointed to be peer_id
  2531. * and tid
  2532. * @tid: tid queue number
  2533. * @hw_qdesc_paddr: reo queue addr
  2534. */
  2535. static inline void
  2536. hal_reo_shared_qaddr_write(hal_soc_handle_t hal_soc_hdl,
  2537. uint16_t peer_id,
  2538. int tid,
  2539. qdf_dma_addr_t hw_qdesc_paddr)
  2540. {
  2541. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2542. if (hal_soc->ops->hal_reo_shared_qaddr_write)
  2543. return hal_soc->ops->hal_reo_shared_qaddr_write(hal_soc_hdl,
  2544. peer_id, tid, hw_qdesc_paddr);
  2545. }
  2546. /**
  2547. * hal_reo_shared_qaddr_init(): Initialize reo qref LUT
  2548. * @hal_soc: Hal soc pointer
  2549. *
  2550. * Write MLO and Non MLO table start addr to HW reg
  2551. *
  2552. * Return: void
  2553. */
  2554. static inline void
  2555. hal_reo_shared_qaddr_init(hal_soc_handle_t hal_soc_hdl)
  2556. {
  2557. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2558. if (hal_soc->ops->hal_reo_shared_qaddr_init)
  2559. return hal_soc->ops->hal_reo_shared_qaddr_init(hal_soc_hdl);
  2560. }
  2561. /**
  2562. * hal_reo_shared_qaddr_cache_clear(): Set and unset 'clear_qdesc_array'
  2563. * bit in reo reg for shared qref feature. This is done for every MLO
  2564. * connection to clear HW reo internal storage for clearing stale entry
  2565. * of prev peer having same peer id
  2566. *
  2567. * @hal_soc: Hal soc pointer
  2568. *
  2569. * Write MLO and Non MLO table start addr to HW reg
  2570. *
  2571. * Return: void
  2572. */
  2573. static inline void hal_reo_shared_qaddr_cache_clear(hal_soc_handle_t hal_soc_hdl)
  2574. {
  2575. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2576. if (hal_soc->ops->hal_reo_shared_qaddr_cache_clear)
  2577. return hal_soc->ops->hal_reo_shared_qaddr_cache_clear(hal_soc_hdl);
  2578. }
  2579. #else
  2580. static inline void
  2581. hal_reo_shared_qaddr_write(hal_soc_handle_t hal_soc_hdl,
  2582. uint16_t peer_id,
  2583. int tid,
  2584. qdf_dma_addr_t hw_qdesc_paddr) {}
  2585. static inline void
  2586. hal_reo_shared_qaddr_init(hal_soc_handle_t hal_soc_hdl) {}
  2587. static inline void
  2588. hal_reo_shared_qaddr_cache_clear(hal_soc_handle_t hal_soc_hdl) {}
  2589. #endif /* REO_SHARED_QREF_TABLE_EN */
  2590. static inline uint8_t
  2591. hal_reo_shared_qaddr_is_enable(hal_soc_handle_t hal_soc_hdl)
  2592. {
  2593. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2594. return hal->reo_qref.reo_qref_table_en;
  2595. }
  2596. #ifdef WLAN_FEATURE_MARK_FIRST_WAKEUP_PACKET
  2597. static inline uint8_t
  2598. hal_get_first_wow_wakeup_packet(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2599. {
  2600. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2601. return hal_soc->ops->hal_get_first_wow_wakeup_packet(buf);
  2602. }
  2603. #endif
  2604. static inline uint32_t
  2605. hal_rx_tlv_l3_type_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
  2606. {
  2607. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2608. return hal_soc->ops->hal_rx_tlv_l3_type_get(buf);
  2609. }
  2610. #endif /* _HAL_RX_H */