hal_rx.h 86 KB

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