dp_internal.h 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995
  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 _DP_INTERNAL_H_
  20. #define _DP_INTERNAL_H_
  21. #include "dp_types.h"
  22. #define RX_BUFFER_SIZE_PKTLOG_LITE 1024
  23. #define DP_PEER_WDS_COUNT_INVALID UINT_MAX
  24. /* Alignment for consistent memory for DP rings*/
  25. #define DP_RING_BASE_ALIGN 32
  26. #define DP_RSSI_INVAL 0x80
  27. #define DP_RSSI_AVG_WEIGHT 2
  28. /*
  29. * Formula to derive avg_rssi is taken from wifi2.o firmware
  30. */
  31. #define DP_GET_AVG_RSSI(avg_rssi, last_rssi) \
  32. (((avg_rssi) - (((uint8_t)(avg_rssi)) >> DP_RSSI_AVG_WEIGHT)) \
  33. + ((((uint8_t)(last_rssi)) >> DP_RSSI_AVG_WEIGHT)))
  34. /* Macro For NYSM value received in VHT TLV */
  35. #define VHT_SGI_NYSM 3
  36. /* struct htt_dbgfs_cfg - structure to maintain required htt data
  37. * @msg_word: htt msg sent to upper layer
  38. * @m: qdf debugfs file pointer
  39. */
  40. struct htt_dbgfs_cfg {
  41. uint32_t *msg_word;
  42. qdf_debugfs_file_t m;
  43. };
  44. /* Cookie MSB bits assigned for different use case.
  45. * Note: User can't use last 3 bits, as it is reserved for pdev_id.
  46. * If in future number of pdev are more than 3.
  47. */
  48. /* Reserve for default case */
  49. #define DBG_STATS_COOKIE_DEFAULT 0x0
  50. /* Reserve for DP Stats: 3rd bit */
  51. #define DBG_STATS_COOKIE_DP_STATS BIT(3)
  52. /* Reserve for HTT Stats debugfs support: 4th bit */
  53. #define DBG_STATS_COOKIE_HTT_DBGFS BIT(4)
  54. /*Reserve for HTT Stats debugfs support: 5th bit */
  55. #define DBG_SYSFS_STATS_COOKIE BIT(5)
  56. /**
  57. * Bitmap of HTT PPDU TLV types for Default mode
  58. */
  59. #define HTT_PPDU_DEFAULT_TLV_BITMAP \
  60. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  61. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  62. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  63. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  64. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  65. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  66. /* PPDU STATS CFG */
  67. #define DP_PPDU_STATS_CFG_ALL 0xFFFF
  68. /* PPDU stats mask sent to FW to enable enhanced stats */
  69. #define DP_PPDU_STATS_CFG_ENH_STATS \
  70. (HTT_PPDU_DEFAULT_TLV_BITMAP) | \
  71. (1 << HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV) | \
  72. (1 << HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV) | \
  73. (1 << HTT_PPDU_STATS_USERS_INFO_TLV)
  74. /* PPDU stats mask sent to FW to support debug sniffer feature */
  75. #define DP_PPDU_STATS_CFG_SNIFFER \
  76. (HTT_PPDU_DEFAULT_TLV_BITMAP) | \
  77. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV) | \
  78. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV) | \
  79. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV) | \
  80. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV) | \
  81. (1 << HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV) | \
  82. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV) | \
  83. (1 << HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV) | \
  84. (1 << HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV) | \
  85. (1 << HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV) | \
  86. (1 << HTT_PPDU_STATS_USERS_INFO_TLV)
  87. /* PPDU stats mask sent to FW to support BPR feature*/
  88. #define DP_PPDU_STATS_CFG_BPR \
  89. (1 << HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV) | \
  90. (1 << HTT_PPDU_STATS_USERS_INFO_TLV)
  91. /* PPDU stats mask sent to FW to support BPR and enhanced stats feature */
  92. #define DP_PPDU_STATS_CFG_BPR_ENH (DP_PPDU_STATS_CFG_BPR | \
  93. DP_PPDU_STATS_CFG_ENH_STATS)
  94. /* PPDU stats mask sent to FW to support BPR and pcktlog stats feature */
  95. #define DP_PPDU_STATS_CFG_BPR_PKTLOG (DP_PPDU_STATS_CFG_BPR | \
  96. DP_PPDU_TXLITE_STATS_BITMASK_CFG)
  97. /**
  98. * Bitmap of HTT PPDU delayed ba TLV types for Default mode
  99. */
  100. #define HTT_PPDU_DELAYED_BA_TLV_BITMAP \
  101. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  102. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  103. (1 << HTT_PPDU_STATS_USR_RATE_TLV)
  104. /**
  105. * Bitmap of HTT PPDU TLV types for Delayed BA
  106. */
  107. #define HTT_PPDU_STATUS_TLV_BITMAP \
  108. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  109. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  110. /**
  111. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 64
  112. */
  113. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_64 \
  114. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  115. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  116. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  117. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  118. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  119. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  120. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV) | \
  121. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV))
  122. /**
  123. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 256
  124. */
  125. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_256 \
  126. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  127. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  128. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  129. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  130. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  131. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  132. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV) | \
  133. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV))
  134. QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc);
  135. QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc);
  136. #ifdef MONITOR_MODULARIZED_ENABLE
  137. static inline bool dp_monitor_modularized_enable(void)
  138. {
  139. return TRUE;
  140. }
  141. static inline QDF_STATUS
  142. dp_mon_soc_attach_wrapper(struct dp_soc *soc) { return QDF_STATUS_SUCCESS; }
  143. static inline QDF_STATUS
  144. dp_mon_soc_detach_wrapper(struct dp_soc *soc) { return QDF_STATUS_SUCCESS; }
  145. #else
  146. static inline bool dp_monitor_modularized_enable(void)
  147. {
  148. return FALSE;
  149. }
  150. static inline QDF_STATUS dp_mon_soc_attach_wrapper(struct dp_soc *soc)
  151. {
  152. return dp_mon_soc_attach(soc);
  153. }
  154. static inline QDF_STATUS dp_mon_soc_detach_wrapper(struct dp_soc *soc)
  155. {
  156. return dp_mon_soc_detach(soc);
  157. }
  158. #endif
  159. #ifndef WIFI_MONITOR_SUPPORT
  160. #define MON_BUF_MIN_ENTRIES 64
  161. static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev)
  162. {
  163. return QDF_STATUS_SUCCESS;
  164. }
  165. static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev)
  166. {
  167. return QDF_STATUS_SUCCESS;
  168. }
  169. static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev)
  170. {
  171. return QDF_STATUS_E_FAILURE;
  172. }
  173. static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev)
  174. {
  175. return QDF_STATUS_E_FAILURE;
  176. }
  177. static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc,
  178. struct dp_peer *peer)
  179. {
  180. return QDF_STATUS_SUCCESS;
  181. }
  182. static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc,
  183. struct dp_peer *peer)
  184. {
  185. return QDF_STATUS_E_FAILURE;
  186. }
  187. static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev)
  188. {
  189. return QDF_STATUS_SUCCESS;
  190. }
  191. static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev)
  192. {
  193. return QDF_STATUS_SUCCESS;
  194. }
  195. static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc)
  196. {
  197. return QDF_STATUS_SUCCESS;
  198. }
  199. static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev,
  200. int val)
  201. {
  202. return QDF_STATUS_E_FAILURE;
  203. }
  204. static inline void dp_monitor_flush_rings(struct dp_soc *soc)
  205. {
  206. }
  207. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  208. struct dp_pdev *pdev,
  209. int mac_id,
  210. int mac_for_pdev)
  211. {
  212. return QDF_STATUS_SUCCESS;
  213. }
  214. static inline void dp_monitor_service_mon_rings(struct dp_soc *soc,
  215. uint32_t quota)
  216. {
  217. }
  218. static inline
  219. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  220. uint32_t mac_id, uint32_t quota)
  221. {
  222. return 0;
  223. }
  224. static inline
  225. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  226. uint32_t mac_id, uint32_t quota)
  227. {
  228. return 0;
  229. }
  230. static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev,
  231. struct dp_peer *peer)
  232. {
  233. }
  234. static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev,
  235. struct dp_peer *peer)
  236. {
  237. }
  238. static inline
  239. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  240. struct dp_peer *peer,
  241. uint16_t peer_id)
  242. {
  243. }
  244. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  245. {
  246. }
  247. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  248. {
  249. }
  250. static inline
  251. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  252. {
  253. return QDF_STATUS_SUCCESS;
  254. }
  255. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  256. struct dp_peer *peer)
  257. {
  258. }
  259. static inline
  260. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  261. struct dp_tx_desc_s *desc,
  262. struct hal_tx_completion_status *ts,
  263. struct dp_peer *peer)
  264. {
  265. return QDF_STATUS_E_FAILURE;
  266. }
  267. static inline
  268. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  269. struct dp_pdev *pdev,
  270. struct dp_peer *peer,
  271. struct hal_tx_completion_status *ts,
  272. qdf_nbuf_t netbuf)
  273. {
  274. return QDF_STATUS_E_FAILURE;
  275. }
  276. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  277. uint32_t *msg_word,
  278. qdf_nbuf_t htt_t2h_msg)
  279. {
  280. return true;
  281. }
  282. static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev)
  283. {
  284. return QDF_STATUS_SUCCESS;
  285. }
  286. static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev)
  287. {
  288. }
  289. static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
  290. {
  291. }
  292. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  293. uint32_t val)
  294. {
  295. return QDF_STATUS_E_INVAL;
  296. }
  297. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  298. uint32_t val)
  299. {
  300. return QDF_STATUS_E_INVAL;
  301. }
  302. static inline
  303. QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev, uint32_t val)
  304. {
  305. return QDF_STATUS_E_FAILURE;
  306. }
  307. static inline
  308. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  309. {
  310. return 0;
  311. }
  312. static inline
  313. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  314. {
  315. }
  316. static inline
  317. void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor)
  318. {
  319. }
  320. static inline
  321. bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
  322. {
  323. return false;
  324. }
  325. static inline
  326. bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle)
  327. {
  328. return false;
  329. }
  330. static inline
  331. bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
  332. {
  333. return false;
  334. }
  335. static inline
  336. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  337. bool enable)
  338. {
  339. return 0;
  340. }
  341. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev)
  342. {
  343. }
  344. static inline
  345. void dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  346. {
  347. }
  348. static inline
  349. void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev)
  350. {
  351. }
  352. static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
  353. uint8_t *rx_pkt_hdr)
  354. {
  355. return QDF_STATUS_E_FAILURE;
  356. }
  357. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  358. {
  359. }
  360. static inline
  361. void dp_monitor_reap_timer_init(struct dp_soc *soc)
  362. {
  363. }
  364. static inline
  365. void dp_monitor_reap_timer_deinit(struct dp_soc *soc)
  366. {
  367. }
  368. static inline
  369. void dp_monitor_reap_timer_start(struct dp_soc *soc)
  370. {
  371. }
  372. static inline
  373. bool dp_monitor_reap_timer_stop(struct dp_soc *soc)
  374. {
  375. return false;
  376. }
  377. static inline
  378. void dp_monitor_vdev_timer_init(struct dp_soc *soc)
  379. {
  380. }
  381. static inline
  382. void dp_monitor_vdev_timer_deinit(struct dp_soc *soc)
  383. {
  384. }
  385. static inline
  386. void dp_monitor_vdev_timer_start(struct dp_soc *soc)
  387. {
  388. }
  389. static inline
  390. bool dp_monitor_vdev_timer_stop(struct dp_soc *soc)
  391. {
  392. return false;
  393. }
  394. static inline struct qdf_mem_multi_page_t*
  395. dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id)
  396. {
  397. return NULL;
  398. }
  399. static inline uint32_t *
  400. dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id)
  401. {
  402. return NULL;
  403. }
  404. static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
  405. {
  406. return QDF_STATUS_E_FAILURE;
  407. }
  408. static inline bool dp_is_enable_reap_timer_non_pkt(struct dp_pdev *pdev)
  409. {
  410. return false;
  411. }
  412. static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev,
  413. struct ol_txrx_ops *txrx_ops)
  414. {
  415. }
  416. static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc)
  417. {
  418. return false;
  419. }
  420. static inline
  421. void dp_monitor_pdev_set_mon_vdev(struct dp_pdev *pdev)
  422. {
  423. }
  424. static inline void dp_monitor_vdev_delete(struct dp_soc *soc,
  425. struct dp_vdev *vdev)
  426. {
  427. }
  428. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  429. {
  430. }
  431. static inline void dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev,
  432. struct dp_peer *ta_peer,
  433. uint8_t *mac_addr,
  434. qdf_nbuf_t nbuf,
  435. uint32_t flags)
  436. {
  437. }
  438. static inline void
  439. dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band)
  440. {
  441. }
  442. static inline void
  443. dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq)
  444. {
  445. }
  446. static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num)
  447. {
  448. }
  449. static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev)
  450. {
  451. return false;
  452. }
  453. static inline
  454. void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev,
  455. struct dp_vdev *vdev,
  456. struct dp_neighbour_peer *peer)
  457. {
  458. }
  459. static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev)
  460. {
  461. return false;
  462. }
  463. static inline enum reg_wifi_band
  464. dp_monitor_get_chan_band(struct dp_pdev *pdev)
  465. {
  466. return 0;
  467. }
  468. static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev,
  469. struct dp_soc *soc,
  470. uint8_t *rx_tlv_hdr)
  471. {
  472. }
  473. static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev)
  474. {
  475. }
  476. static inline
  477. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  478. uint16_t peer_id, uint32_t ppdu_id,
  479. uint8_t first_msdu)
  480. {
  481. return QDF_STATUS_SUCCESS;
  482. }
  483. static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev)
  484. {
  485. return false;
  486. }
  487. static inline struct dp_vdev*
  488. dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev)
  489. {
  490. return NULL;
  491. }
  492. static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev,
  493. void *rx_desc)
  494. {
  495. return QDF_STATUS_E_FAILURE;
  496. }
  497. static inline struct mon_rx_status*
  498. dp_monitor_get_rx_status(struct dp_pdev *pdev)
  499. {
  500. return NULL;
  501. }
  502. static inline
  503. void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev)
  504. {
  505. }
  506. static inline
  507. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  508. bool val)
  509. {
  510. }
  511. static inline QDF_STATUS
  512. dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  513. struct cdp_peer_tx_capture_stats *stats)
  514. {
  515. return QDF_STATUS_E_FAILURE;
  516. }
  517. static inline QDF_STATUS
  518. dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  519. struct cdp_pdev_tx_capture_stats *stats)
  520. {
  521. return QDF_STATUS_E_FAILURE;
  522. }
  523. #endif
  524. /**
  525. * cdp_soc_t_to_dp_soc() - typecast cdp_soc_t to
  526. * dp soc handle
  527. * @psoc: CDP psoc handle
  528. *
  529. * Return: struct dp_soc pointer
  530. */
  531. static inline
  532. struct dp_soc *cdp_soc_t_to_dp_soc(struct cdp_soc_t *psoc)
  533. {
  534. return (struct dp_soc *)psoc;
  535. }
  536. #define DP_MAX_TIMER_EXEC_TIME_TICKS \
  537. (QDF_LOG_TIMESTAMP_CYCLES_PER_10_US * 100 * 20)
  538. /**
  539. * enum timer_yield_status - yield status code used in monitor mode timer.
  540. * @DP_TIMER_NO_YIELD: do not yield
  541. * @DP_TIMER_WORK_DONE: yield because work is done
  542. * @DP_TIMER_WORK_EXHAUST: yield because work quota is exhausted
  543. * @DP_TIMER_TIME_EXHAUST: yield due to time slot exhausted
  544. */
  545. enum timer_yield_status {
  546. DP_TIMER_NO_YIELD,
  547. DP_TIMER_WORK_DONE,
  548. DP_TIMER_WORK_EXHAUST,
  549. DP_TIMER_TIME_EXHAUST,
  550. };
  551. #if DP_PRINT_ENABLE
  552. #include <stdarg.h> /* va_list */
  553. #include <qdf_types.h> /* qdf_vprint */
  554. #include <cdp_txrx_handle.h>
  555. enum {
  556. /* FATAL_ERR - print only irrecoverable error messages */
  557. DP_PRINT_LEVEL_FATAL_ERR,
  558. /* ERR - include non-fatal err messages */
  559. DP_PRINT_LEVEL_ERR,
  560. /* WARN - include warnings */
  561. DP_PRINT_LEVEL_WARN,
  562. /* INFO1 - include fundamental, infrequent events */
  563. DP_PRINT_LEVEL_INFO1,
  564. /* INFO2 - include non-fundamental but infrequent events */
  565. DP_PRINT_LEVEL_INFO2,
  566. };
  567. #define dp_print(level, fmt, ...) do { \
  568. if (level <= g_txrx_print_level) \
  569. qdf_print(fmt, ## __VA_ARGS__); \
  570. while (0)
  571. #define DP_PRINT(level, fmt, ...) do { \
  572. dp_print(level, "DP: " fmt, ## __VA_ARGS__); \
  573. while (0)
  574. #else
  575. #define DP_PRINT(level, fmt, ...)
  576. #endif /* DP_PRINT_ENABLE */
  577. #define DP_TRACE(LVL, fmt, args ...) \
  578. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  579. fmt, ## args)
  580. #ifdef WLAN_SYSFS_DP_STATS
  581. void DP_PRINT_STATS(const char *fmt, ...);
  582. #else /* WLAN_SYSFS_DP_STATS */
  583. #ifdef DP_PRINT_NO_CONSOLE
  584. /* Stat prints should not go to console or kernel logs.*/
  585. #define DP_PRINT_STATS(fmt, args ...)\
  586. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, \
  587. fmt, ## args)
  588. #else
  589. #define DP_PRINT_STATS(fmt, args ...)\
  590. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,\
  591. fmt, ## args)
  592. #endif
  593. #endif /* WLAN_SYSFS_DP_STATS */
  594. #define DP_STATS_INIT(_handle) \
  595. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  596. #define DP_STATS_CLR(_handle) \
  597. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  598. #ifndef DISABLE_DP_STATS
  599. #define DP_STATS_INC(_handle, _field, _delta) \
  600. { \
  601. if (likely(_handle)) \
  602. _handle->stats._field += _delta; \
  603. }
  604. #define DP_STATS_INCC(_handle, _field, _delta, _cond) \
  605. { \
  606. if (_cond && likely(_handle)) \
  607. _handle->stats._field += _delta; \
  608. }
  609. #define DP_STATS_DEC(_handle, _field, _delta) \
  610. { \
  611. if (likely(_handle)) \
  612. _handle->stats._field -= _delta; \
  613. }
  614. #define DP_STATS_UPD(_handle, _field, _delta) \
  615. { \
  616. if (likely(_handle)) \
  617. _handle->stats._field = _delta; \
  618. }
  619. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \
  620. { \
  621. DP_STATS_INC(_handle, _field.num, _count); \
  622. DP_STATS_INC(_handle, _field.bytes, _bytes) \
  623. }
  624. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) \
  625. { \
  626. DP_STATS_INCC(_handle, _field.num, _count, _cond); \
  627. DP_STATS_INCC(_handle, _field.bytes, _bytes, _cond) \
  628. }
  629. #define DP_STATS_AGGR(_handle_a, _handle_b, _field) \
  630. { \
  631. _handle_a->stats._field += _handle_b->stats._field; \
  632. }
  633. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) \
  634. { \
  635. DP_STATS_AGGR(_handle_a, _handle_b, _field.num); \
  636. DP_STATS_AGGR(_handle_a, _handle_b, _field.bytes);\
  637. }
  638. #define DP_STATS_UPD_STRUCT(_handle_a, _handle_b, _field) \
  639. { \
  640. _handle_a->stats._field = _handle_b->stats._field; \
  641. }
  642. #else
  643. #define DP_STATS_INC(_handle, _field, _delta)
  644. #define DP_STATS_INCC(_handle, _field, _delta, _cond)
  645. #define DP_STATS_DEC(_handle, _field, _delta)
  646. #define DP_STATS_UPD(_handle, _field, _delta)
  647. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes)
  648. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond)
  649. #define DP_STATS_AGGR(_handle_a, _handle_b, _field)
  650. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field)
  651. #endif
  652. #if defined(QCA_VDEV_STATS_HW_OFFLOAD_SUPPORT) && \
  653. defined(QCA_ENHANCED_STATS_SUPPORT)
  654. #define DP_PEER_TO_STACK_INCC_PKT(_handle, _count, _bytes, _cond) \
  655. { \
  656. if (!(_handle->hw_txrx_stats_en) || _cond) \
  657. DP_STATS_INC_PKT(_handle, rx.to_stack, _count, _bytes); \
  658. }
  659. #define DP_PEER_TO_STACK_DECC(_handle, _count, _cond) \
  660. { \
  661. if (!(_handle->hw_txrx_stats_en) || _cond) \
  662. DP_STATS_DEC(_handle, rx.to_stack.num, _count); \
  663. }
  664. #define DP_PEER_MC_INCC_PKT(_handle, _count, _bytes, _cond) \
  665. { \
  666. if (!(_handle->hw_txrx_stats_en) || _cond) \
  667. DP_STATS_INC_PKT(_handle, rx.multicast, _count, _bytes); \
  668. }
  669. #define DP_PEER_BC_INCC_PKT(_handle, _count, _bytes, _cond) \
  670. { \
  671. if (!(_handle->hw_txrx_stats_en) || _cond) \
  672. DP_STATS_INC_PKT(_handle, rx.bcast, _count, _bytes); \
  673. }
  674. #elif defined(QCA_VDEV_STATS_HW_OFFLOAD_SUPPORT)
  675. #define DP_PEER_TO_STACK_INCC_PKT(_handle, _count, _bytes, _cond) \
  676. { \
  677. if (!(_handle->hw_txrx_stats_en)) \
  678. DP_STATS_INC_PKT(_handle, rx.to_stack, _count, _bytes); \
  679. }
  680. #define DP_PEER_TO_STACK_DECC(_handle, _count, _cond) \
  681. { \
  682. if (!(_handle->hw_txrx_stats_en)) \
  683. DP_STATS_DEC(_handle, rx.to_stack.num, _count); \
  684. }
  685. #define DP_PEER_MC_INCC_PKT(_handle, _count, _bytes, _cond) \
  686. { \
  687. if (!(_handle->hw_txrx_stats_en)) \
  688. DP_STATS_INC_PKT(_handle, rx.multicast, _count, _bytes); \
  689. }
  690. #define DP_PEER_BC_INCC_PKT(_handle, _count, _bytes, _cond) \
  691. { \
  692. if (!(_handle->hw_txrx_stats_en)) \
  693. DP_STATS_INC_PKT(_handle, rx.bcast, _count, _bytes); \
  694. }
  695. #else
  696. #define DP_PEER_TO_STACK_INCC_PKT(_handle, _count, _bytes, _cond) \
  697. DP_STATS_INC_PKT(_handle, rx.to_stack, _count, _bytes);
  698. #define DP_PEER_TO_STACK_DECC(_handle, _count, _cond) \
  699. DP_STATS_DEC(_handle, rx.to_stack.num, _count);
  700. #define DP_PEER_MC_INCC_PKT(_handle, _count, _bytes, _cond) \
  701. DP_STATS_INC_PKT(_handle, rx.multicast, _count, _bytes);
  702. #define DP_PEER_BC_INCC_PKT(_handle, _count, _bytes, _cond) \
  703. DP_STATS_INC_PKT(_handle, rx.bcast, _count, _bytes);
  704. #endif
  705. #ifdef ENABLE_DP_HIST_STATS
  706. #define DP_HIST_INIT() \
  707. uint32_t num_of_packets[MAX_PDEV_CNT] = {0};
  708. #define DP_HIST_PACKET_COUNT_INC(_pdev_id) \
  709. { \
  710. ++num_of_packets[_pdev_id]; \
  711. }
  712. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  713. do { \
  714. if (_p_cntrs == 1) { \
  715. DP_STATS_INC(_pdev, \
  716. tx_comp_histogram.pkts_1, 1); \
  717. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  718. DP_STATS_INC(_pdev, \
  719. tx_comp_histogram.pkts_2_20, 1); \
  720. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  721. DP_STATS_INC(_pdev, \
  722. tx_comp_histogram.pkts_21_40, 1); \
  723. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  724. DP_STATS_INC(_pdev, \
  725. tx_comp_histogram.pkts_41_60, 1); \
  726. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  727. DP_STATS_INC(_pdev, \
  728. tx_comp_histogram.pkts_61_80, 1); \
  729. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  730. DP_STATS_INC(_pdev, \
  731. tx_comp_histogram.pkts_81_100, 1); \
  732. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  733. DP_STATS_INC(_pdev, \
  734. tx_comp_histogram.pkts_101_200, 1); \
  735. } else if (_p_cntrs > 200) { \
  736. DP_STATS_INC(_pdev, \
  737. tx_comp_histogram.pkts_201_plus, 1); \
  738. } \
  739. } while (0)
  740. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  741. do { \
  742. if (_p_cntrs == 1) { \
  743. DP_STATS_INC(_pdev, \
  744. rx_ind_histogram.pkts_1, 1); \
  745. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  746. DP_STATS_INC(_pdev, \
  747. rx_ind_histogram.pkts_2_20, 1); \
  748. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  749. DP_STATS_INC(_pdev, \
  750. rx_ind_histogram.pkts_21_40, 1); \
  751. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  752. DP_STATS_INC(_pdev, \
  753. rx_ind_histogram.pkts_41_60, 1); \
  754. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  755. DP_STATS_INC(_pdev, \
  756. rx_ind_histogram.pkts_61_80, 1); \
  757. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  758. DP_STATS_INC(_pdev, \
  759. rx_ind_histogram.pkts_81_100, 1); \
  760. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  761. DP_STATS_INC(_pdev, \
  762. rx_ind_histogram.pkts_101_200, 1); \
  763. } else if (_p_cntrs > 200) { \
  764. DP_STATS_INC(_pdev, \
  765. rx_ind_histogram.pkts_201_plus, 1); \
  766. } \
  767. } while (0)
  768. #define DP_TX_HIST_STATS_PER_PDEV() \
  769. do { \
  770. uint8_t hist_stats = 0; \
  771. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  772. hist_stats++) { \
  773. DP_TX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  774. num_of_packets[hist_stats]); \
  775. } \
  776. } while (0)
  777. #define DP_RX_HIST_STATS_PER_PDEV() \
  778. do { \
  779. uint8_t hist_stats = 0; \
  780. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  781. hist_stats++) { \
  782. DP_RX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  783. num_of_packets[hist_stats]); \
  784. } \
  785. } while (0)
  786. #else
  787. #define DP_HIST_INIT()
  788. #define DP_HIST_PACKET_COUNT_INC(_pdev_id)
  789. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  790. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  791. #define DP_RX_HIST_STATS_PER_PDEV()
  792. #define DP_TX_HIST_STATS_PER_PDEV()
  793. #endif /* DISABLE_DP_STATS */
  794. #define FRAME_MASK_IPV4_ARP 1
  795. #define FRAME_MASK_IPV4_DHCP 2
  796. #define FRAME_MASK_IPV4_EAPOL 4
  797. #define FRAME_MASK_IPV6_DHCP 8
  798. static inline int dp_log2_ceil(unsigned int value)
  799. {
  800. unsigned int tmp = value;
  801. int log2 = -1;
  802. while (tmp) {
  803. log2++;
  804. tmp >>= 1;
  805. }
  806. if (1 << log2 != value)
  807. log2++;
  808. return log2;
  809. }
  810. #ifdef QCA_SUPPORT_PEER_ISOLATION
  811. #define dp_get_peer_isolation(_peer) ((_peer)->isolation)
  812. static inline void dp_set_peer_isolation(struct dp_peer *peer, bool val)
  813. {
  814. peer->isolation = val;
  815. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
  816. "peer:"QDF_MAC_ADDR_FMT" isolation:%d",
  817. QDF_MAC_ADDR_REF(peer->mac_addr.raw), peer->isolation);
  818. }
  819. #else
  820. #define dp_get_peer_isolation(_peer) (0)
  821. static inline void dp_set_peer_isolation(struct dp_peer *peer, bool val)
  822. {
  823. }
  824. #endif /* QCA_SUPPORT_PEER_ISOLATION */
  825. #ifdef QCA_SUPPORT_WDS_EXTENDED
  826. static inline void dp_wds_ext_peer_init(struct dp_peer *peer)
  827. {
  828. peer->wds_ext.init = 0;
  829. }
  830. #else
  831. static inline void dp_wds_ext_peer_init(struct dp_peer *peer)
  832. {
  833. }
  834. #endif /* QCA_SUPPORT_WDS_EXTENDED */
  835. #ifdef QCA_HOST2FW_RXBUF_RING
  836. static inline
  837. struct dp_srng *dp_get_rxdma_ring(struct dp_pdev *pdev, int lmac_id)
  838. {
  839. return &pdev->rx_mac_buf_ring[lmac_id];
  840. }
  841. #else
  842. static inline
  843. struct dp_srng *dp_get_rxdma_ring(struct dp_pdev *pdev, int lmac_id)
  844. {
  845. return &pdev->soc->rx_refill_buf_ring[lmac_id];
  846. }
  847. #endif
  848. /**
  849. * The lmac ID for a particular channel band is fixed.
  850. * 2.4GHz band uses lmac_id = 1
  851. * 5GHz/6GHz band uses lmac_id=0
  852. */
  853. #define DP_INVALID_LMAC_ID (-1)
  854. #define DP_MON_INVALID_LMAC_ID (-1)
  855. #define DP_MAC0_LMAC_ID 0
  856. #define DP_MAC1_LMAC_ID 1
  857. #ifdef FEATURE_TSO_STATS
  858. /**
  859. * dp_init_tso_stats() - Clear tso stats
  860. * @pdev: pdev handle
  861. *
  862. * Return: None
  863. */
  864. static inline
  865. void dp_init_tso_stats(struct dp_pdev *pdev)
  866. {
  867. if (pdev) {
  868. qdf_mem_zero(&((pdev)->stats.tso_stats),
  869. sizeof((pdev)->stats.tso_stats));
  870. qdf_atomic_init(&pdev->tso_idx);
  871. }
  872. }
  873. /**
  874. * dp_stats_tso_segment_histogram_update() - TSO Segment Histogram
  875. * @pdev: pdev handle
  876. * @_p_cntrs: number of tso segments for a tso packet
  877. *
  878. * Return: None
  879. */
  880. void dp_stats_tso_segment_histogram_update(struct dp_pdev *pdev,
  881. uint8_t _p_cntrs);
  882. /**
  883. * dp_tso_segment_update() - Collect tso segment information
  884. * @pdev: pdev handle
  885. * @stats_idx: tso packet number
  886. * @idx: tso segment number
  887. * @seg: tso segment
  888. *
  889. * Return: None
  890. */
  891. void dp_tso_segment_update(struct dp_pdev *pdev,
  892. uint32_t stats_idx,
  893. uint8_t idx,
  894. struct qdf_tso_seg_t seg);
  895. /**
  896. * dp_tso_packet_update() - TSO Packet information
  897. * @pdev: pdev handle
  898. * @stats_idx: tso packet number
  899. * @msdu: nbuf handle
  900. * @num_segs: tso segments
  901. *
  902. * Return: None
  903. */
  904. void dp_tso_packet_update(struct dp_pdev *pdev, uint32_t stats_idx,
  905. qdf_nbuf_t msdu, uint16_t num_segs);
  906. /**
  907. * dp_tso_segment_stats_update() - TSO Segment stats
  908. * @pdev: pdev handle
  909. * @stats_seg: tso segment list
  910. * @stats_idx: tso packet number
  911. *
  912. * Return: None
  913. */
  914. void dp_tso_segment_stats_update(struct dp_pdev *pdev,
  915. struct qdf_tso_seg_elem_t *stats_seg,
  916. uint32_t stats_idx);
  917. /**
  918. * dp_print_tso_stats() - dump tso statistics
  919. * @soc:soc handle
  920. * @level: verbosity level
  921. *
  922. * Return: None
  923. */
  924. void dp_print_tso_stats(struct dp_soc *soc,
  925. enum qdf_stats_verbosity_level level);
  926. /**
  927. * dp_txrx_clear_tso_stats() - clear tso stats
  928. * @soc: soc handle
  929. *
  930. * Return: None
  931. */
  932. void dp_txrx_clear_tso_stats(struct dp_soc *soc);
  933. #else
  934. static inline
  935. void dp_init_tso_stats(struct dp_pdev *pdev)
  936. {
  937. }
  938. static inline
  939. void dp_stats_tso_segment_histogram_update(struct dp_pdev *pdev,
  940. uint8_t _p_cntrs)
  941. {
  942. }
  943. static inline
  944. void dp_tso_segment_update(struct dp_pdev *pdev,
  945. uint32_t stats_idx,
  946. uint32_t idx,
  947. struct qdf_tso_seg_t seg)
  948. {
  949. }
  950. static inline
  951. void dp_tso_packet_update(struct dp_pdev *pdev, uint32_t stats_idx,
  952. qdf_nbuf_t msdu, uint16_t num_segs)
  953. {
  954. }
  955. static inline
  956. void dp_tso_segment_stats_update(struct dp_pdev *pdev,
  957. struct qdf_tso_seg_elem_t *stats_seg,
  958. uint32_t stats_idx)
  959. {
  960. }
  961. static inline
  962. void dp_print_tso_stats(struct dp_soc *soc,
  963. enum qdf_stats_verbosity_level level)
  964. {
  965. }
  966. static inline
  967. void dp_txrx_clear_tso_stats(struct dp_soc *soc)
  968. {
  969. }
  970. #endif /* FEATURE_TSO_STATS */
  971. #define DP_HTT_T2H_HP_PIPE 5
  972. /**
  973. * dp_update_pdev_stats(): Update the pdev stats
  974. * @tgtobj: pdev handle
  975. * @srcobj: vdev stats structure
  976. *
  977. * Update the pdev stats from the specified vdev stats
  978. *
  979. * return: None
  980. */
  981. void dp_update_pdev_stats(struct dp_pdev *tgtobj,
  982. struct cdp_vdev_stats *srcobj);
  983. /**
  984. * dp_update_vdev_ingress_stats(): Update the vdev ingress stats
  985. * @tgtobj: vdev handle
  986. *
  987. * Update the vdev ingress stats
  988. *
  989. * return: None
  990. */
  991. void dp_update_vdev_ingress_stats(struct dp_vdev *tgtobj);
  992. /**
  993. * dp_update_pdev_ingress_stats(): Update the pdev ingress stats
  994. * @tgtobj: pdev handle
  995. * @srcobj: vdev stats structure
  996. *
  997. * Update the pdev ingress stats from the specified vdev stats
  998. *
  999. * return: None
  1000. */
  1001. void dp_update_pdev_ingress_stats(struct dp_pdev *tgtobj,
  1002. struct dp_vdev *srcobj);
  1003. /**
  1004. * dp_update_vdev_stats(): Update the vdev stats
  1005. * @soc: soc handle
  1006. * @srcobj: DP_PEER object
  1007. * @arg: point to vdev stats structure
  1008. *
  1009. * Update the vdev stats from the specified peer stats
  1010. *
  1011. * return: None
  1012. */
  1013. void dp_update_vdev_stats(struct dp_soc *soc,
  1014. struct dp_peer *srcobj,
  1015. void *arg);
  1016. #define DP_UPDATE_STATS(_tgtobj, _srcobj) \
  1017. do { \
  1018. uint8_t i; \
  1019. uint8_t pream_type; \
  1020. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) { \
  1021. for (i = 0; i < MAX_MCS; i++) { \
  1022. DP_STATS_AGGR(_tgtobj, _srcobj, \
  1023. tx.pkt_type[pream_type].mcs_count[i]); \
  1024. DP_STATS_AGGR(_tgtobj, _srcobj, \
  1025. rx.pkt_type[pream_type].mcs_count[i]); \
  1026. } \
  1027. } \
  1028. \
  1029. for (i = 0; i < MAX_BW; i++) { \
  1030. DP_STATS_AGGR(_tgtobj, _srcobj, tx.bw[i]); \
  1031. DP_STATS_AGGR(_tgtobj, _srcobj, rx.bw[i]); \
  1032. } \
  1033. \
  1034. for (i = 0; i < SS_COUNT; i++) { \
  1035. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nss[i]); \
  1036. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nss[i]); \
  1037. } \
  1038. for (i = 0; i < WME_AC_MAX; i++) { \
  1039. DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \
  1040. DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \
  1041. DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \
  1042. \
  1043. } \
  1044. \
  1045. for (i = 0; i < MAX_GI; i++) { \
  1046. DP_STATS_AGGR(_tgtobj, _srcobj, tx.sgi_count[i]); \
  1047. DP_STATS_AGGR(_tgtobj, _srcobj, rx.sgi_count[i]); \
  1048. } \
  1049. \
  1050. for (i = 0; i < MAX_RECEPTION_TYPES; i++) \
  1051. DP_STATS_AGGR(_tgtobj, _srcobj, rx.reception_type[i]); \
  1052. \
  1053. if (!wlan_cfg_get_vdev_stats_hw_offload_config(soc->wlan_cfg_ctx)) { \
  1054. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \
  1055. DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \
  1056. } \
  1057. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \
  1058. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \
  1059. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \
  1060. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \
  1061. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.nawds_mcast); \
  1062. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nawds_mcast_drop); \
  1063. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \
  1064. DP_STATS_AGGR(_tgtobj, _srcobj, tx.stbc); \
  1065. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ldpc); \
  1066. DP_STATS_AGGR(_tgtobj, _srcobj, tx.retries); \
  1067. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_amsdu_cnt); \
  1068. DP_STATS_AGGR(_tgtobj, _srcobj, tx.amsdu_cnt); \
  1069. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_ampdu_cnt); \
  1070. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ampdu_cnt); \
  1071. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.dropped.fw_rem); \
  1072. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_tx); \
  1073. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_notx); \
  1074. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason1); \
  1075. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason2); \
  1076. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason3); \
  1077. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.age_out); \
  1078. \
  1079. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.mic_err); \
  1080. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.decrypt_err); \
  1081. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.fcserr); \
  1082. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.pn_err); \
  1083. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.oor_err); \
  1084. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.jump_2k_err); \
  1085. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.rxdma_wifi_parse_err); \
  1086. if (_srcobj->stats.rx.snr != 0) \
  1087. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.snr); \
  1088. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rx_rate); \
  1089. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_ampdu_cnt); \
  1090. DP_STATS_AGGR(_tgtobj, _srcobj, rx.ampdu_cnt); \
  1091. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \
  1092. DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \
  1093. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nawds_mcast_drop); \
  1094. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \
  1095. \
  1096. for (i = 0; i < CDP_MAX_RX_RINGS; i++) \
  1097. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \
  1098. \
  1099. _srcobj->stats.rx.unicast.num = \
  1100. _srcobj->stats.rx.to_stack.num - \
  1101. _srcobj->stats.rx.multicast.num; \
  1102. _srcobj->stats.rx.unicast.bytes = \
  1103. _srcobj->stats.rx.to_stack.bytes - \
  1104. _srcobj->stats.rx.multicast.bytes; \
  1105. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.unicast); \
  1106. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.multicast); \
  1107. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast); \
  1108. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.raw); \
  1109. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.pkts); \
  1110. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.fail); \
  1111. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.mec_drop); \
  1112. \
  1113. _tgtobj->stats.tx.last_ack_rssi = \
  1114. _srcobj->stats.tx.last_ack_rssi; \
  1115. DP_STATS_AGGR(_tgtobj, _srcobj, rx.multipass_rx_pkt_drop); \
  1116. DP_STATS_AGGR(_tgtobj, _srcobj, rx.peer_unauth_rx_pkt_drop); \
  1117. DP_STATS_AGGR(_tgtobj, _srcobj, rx.policy_check_drop); \
  1118. } while (0)
  1119. /**
  1120. * dp_peer_find_attach() - Allocates memory for peer objects
  1121. * @soc: SoC handle
  1122. *
  1123. * Return: QDF_STATUS
  1124. */
  1125. QDF_STATUS dp_peer_find_attach(struct dp_soc *soc);
  1126. extern void dp_peer_find_detach(struct dp_soc *soc);
  1127. extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer);
  1128. extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer);
  1129. extern void dp_peer_find_hash_erase(struct dp_soc *soc);
  1130. void dp_peer_vdev_list_add(struct dp_soc *soc, struct dp_vdev *vdev,
  1131. struct dp_peer *peer);
  1132. void dp_peer_vdev_list_remove(struct dp_soc *soc, struct dp_vdev *vdev,
  1133. struct dp_peer *peer);
  1134. void dp_peer_find_id_to_obj_add(struct dp_soc *soc,
  1135. struct dp_peer *peer,
  1136. uint16_t peer_id);
  1137. void dp_txrx_peer_attach_add(struct dp_soc *soc,
  1138. struct dp_peer *peer,
  1139. struct dp_txrx_peer *txrx_peer);
  1140. void dp_peer_find_id_to_obj_remove(struct dp_soc *soc,
  1141. uint16_t peer_id);
  1142. void dp_vdev_unref_delete(struct dp_soc *soc, struct dp_vdev *vdev,
  1143. enum dp_mod_id mod_id);
  1144. /*
  1145. * dp_peer_ppdu_delayed_ba_cleanup() free ppdu allocated in peer
  1146. * @peer: Datapath peer
  1147. *
  1148. * return: void
  1149. */
  1150. void dp_peer_ppdu_delayed_ba_cleanup(struct dp_peer *peer);
  1151. extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  1152. void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  1153. void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  1154. #ifdef DP_PEER_EXTENDED_API
  1155. /**
  1156. * dp_register_peer() - Register peer into physical device
  1157. * @soc_hdl - data path soc handle
  1158. * @pdev_id - device instance id
  1159. * @sta_desc - peer description
  1160. *
  1161. * Register peer into physical device
  1162. *
  1163. * Return: QDF_STATUS_SUCCESS registration success
  1164. * QDF_STATUS_E_FAULT peer not found
  1165. */
  1166. QDF_STATUS dp_register_peer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  1167. struct ol_txrx_desc_type *sta_desc);
  1168. /**
  1169. * dp_clear_peer() - remove peer from physical device
  1170. * @soc_hdl - data path soc handle
  1171. * @pdev_id - device instance id
  1172. * @peer_addr - peer mac address
  1173. *
  1174. * remove peer from physical device
  1175. *
  1176. * Return: QDF_STATUS_SUCCESS registration success
  1177. * QDF_STATUS_E_FAULT peer not found
  1178. */
  1179. QDF_STATUS dp_clear_peer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  1180. struct qdf_mac_addr peer_addr);
  1181. /*
  1182. * dp_find_peer_exist - find peer if already exists
  1183. * @soc: datapath soc handle
  1184. * @pdev_id: physical device instance id
  1185. * @peer_mac_addr: peer mac address
  1186. *
  1187. * Return: true or false
  1188. */
  1189. bool dp_find_peer_exist(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  1190. uint8_t *peer_addr);
  1191. /*
  1192. * dp_find_peer_exist_on_vdev - find if peer exists on the given vdev
  1193. * @soc: datapath soc handle
  1194. * @vdev_id: vdev instance id
  1195. * @peer_mac_addr: peer mac address
  1196. *
  1197. * Return: true or false
  1198. */
  1199. bool dp_find_peer_exist_on_vdev(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  1200. uint8_t *peer_addr);
  1201. /*
  1202. * dp_find_peer_exist_on_other_vdev - find if peer exists
  1203. * on other than the given vdev
  1204. * @soc: datapath soc handle
  1205. * @vdev_id: vdev instance id
  1206. * @peer_mac_addr: peer mac address
  1207. * @max_bssid: max number of bssids
  1208. *
  1209. * Return: true or false
  1210. */
  1211. bool dp_find_peer_exist_on_other_vdev(struct cdp_soc_t *soc_hdl,
  1212. uint8_t vdev_id, uint8_t *peer_addr,
  1213. uint16_t max_bssid);
  1214. /**
  1215. * dp_peer_state_update() - update peer local state
  1216. * @pdev - data path device instance
  1217. * @peer_addr - peer mac address
  1218. * @state - new peer local state
  1219. *
  1220. * update peer local state
  1221. *
  1222. * Return: QDF_STATUS_SUCCESS registration success
  1223. */
  1224. QDF_STATUS dp_peer_state_update(struct cdp_soc_t *soc, uint8_t *peer_mac,
  1225. enum ol_txrx_peer_state state);
  1226. /**
  1227. * dp_get_vdevid() - Get virtual interface id which peer registered
  1228. * @soc - datapath soc handle
  1229. * @peer_mac - peer mac address
  1230. * @vdev_id - virtual interface id which peer registered
  1231. *
  1232. * Get virtual interface id which peer registered
  1233. *
  1234. * Return: QDF_STATUS_SUCCESS registration success
  1235. */
  1236. QDF_STATUS dp_get_vdevid(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac,
  1237. uint8_t *vdev_id);
  1238. struct cdp_vdev *dp_get_vdev_by_peer_addr(struct cdp_pdev *pdev_handle,
  1239. struct qdf_mac_addr peer_addr);
  1240. struct cdp_vdev *dp_get_vdev_for_peer(void *peer);
  1241. uint8_t *dp_peer_get_peer_mac_addr(void *peer);
  1242. /**
  1243. * dp_get_peer_state() - Get local peer state
  1244. * @soc - datapath soc handle
  1245. * @vdev_id - vdev id
  1246. * @peer_mac - peer mac addr
  1247. *
  1248. * Get local peer state
  1249. *
  1250. * Return: peer status
  1251. */
  1252. int dp_get_peer_state(struct cdp_soc_t *soc, uint8_t vdev_id,
  1253. uint8_t *peer_mac);
  1254. void dp_local_peer_id_pool_init(struct dp_pdev *pdev);
  1255. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer);
  1256. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer);
  1257. #else
  1258. /**
  1259. * dp_get_vdevid() - Get virtual interface id which peer registered
  1260. * @soc - datapath soc handle
  1261. * @peer_mac - peer mac address
  1262. * @vdev_id - virtual interface id which peer registered
  1263. *
  1264. * Get virtual interface id which peer registered
  1265. *
  1266. * Return: QDF_STATUS_SUCCESS registration success
  1267. */
  1268. static inline
  1269. QDF_STATUS dp_get_vdevid(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac,
  1270. uint8_t *vdev_id)
  1271. {
  1272. return QDF_STATUS_E_NOSUPPORT;
  1273. }
  1274. static inline void dp_local_peer_id_pool_init(struct dp_pdev *pdev)
  1275. {
  1276. }
  1277. static inline
  1278. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer)
  1279. {
  1280. }
  1281. static inline
  1282. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer)
  1283. {
  1284. }
  1285. #endif
  1286. int dp_addba_resp_tx_completion_wifi3(struct cdp_soc_t *cdp_soc,
  1287. uint8_t *peer_mac, uint16_t vdev_id,
  1288. uint8_t tid,
  1289. int status);
  1290. int dp_addba_requestprocess_wifi3(struct cdp_soc_t *cdp_soc,
  1291. uint8_t *peer_mac, uint16_t vdev_id,
  1292. uint8_t dialogtoken, uint16_t tid,
  1293. uint16_t batimeout,
  1294. uint16_t buffersize,
  1295. uint16_t startseqnum);
  1296. QDF_STATUS dp_addba_responsesetup_wifi3(struct cdp_soc_t *cdp_soc,
  1297. uint8_t *peer_mac, uint16_t vdev_id,
  1298. uint8_t tid, uint8_t *dialogtoken,
  1299. uint16_t *statuscode,
  1300. uint16_t *buffersize,
  1301. uint16_t *batimeout);
  1302. QDF_STATUS dp_set_addba_response(struct cdp_soc_t *cdp_soc,
  1303. uint8_t *peer_mac,
  1304. uint16_t vdev_id, uint8_t tid,
  1305. uint16_t statuscode);
  1306. int dp_delba_process_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  1307. uint16_t vdev_id, int tid,
  1308. uint16_t reasoncode);
  1309. /*
  1310. * dp_delba_tx_completion_wifi3() - Handle delba tx completion
  1311. *
  1312. * @cdp_soc: soc handle
  1313. * @vdev_id: id of the vdev handle
  1314. * @peer_mac: peer mac address
  1315. * @tid: Tid number
  1316. * @status: Tx completion status
  1317. * Indicate status of delba Tx to DP for stats update and retry
  1318. * delba if tx failed.
  1319. *
  1320. */
  1321. int dp_delba_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  1322. uint16_t vdev_id, uint8_t tid,
  1323. int status);
  1324. extern QDF_STATUS dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  1325. uint32_t ba_window_size,
  1326. uint32_t start_seq);
  1327. extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc,
  1328. enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params,
  1329. void (*callback_fn), void *data);
  1330. extern void dp_reo_cmdlist_destroy(struct dp_soc *soc);
  1331. /**
  1332. * dp_reo_status_ring_handler - Handler for REO Status ring
  1333. * @int_ctx: pointer to DP interrupt context
  1334. * @soc: DP Soc handle
  1335. *
  1336. * Returns: Number of descriptors reaped
  1337. */
  1338. uint32_t dp_reo_status_ring_handler(struct dp_intr *int_ctx,
  1339. struct dp_soc *soc);
  1340. void dp_aggregate_vdev_stats(struct dp_vdev *vdev,
  1341. struct cdp_vdev_stats *vdev_stats);
  1342. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  1343. union hal_reo_status *reo_status);
  1344. void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  1345. union hal_reo_status *reo_status);
  1346. uint16_t dp_tx_me_send_convert_ucast(struct cdp_soc_t *soc, uint8_t vdev_id,
  1347. qdf_nbuf_t nbuf,
  1348. uint8_t newmac[][QDF_MAC_ADDR_SIZE],
  1349. uint8_t new_mac_cnt, uint8_t tid,
  1350. bool is_igmp, bool is_dms_pkt);
  1351. void dp_tx_me_alloc_descriptor(struct cdp_soc_t *soc, uint8_t pdev_id);
  1352. void dp_tx_me_free_descriptor(struct cdp_soc_t *soc, uint8_t pdev_id);
  1353. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  1354. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  1355. uint32_t config_param_1, uint32_t config_param_2,
  1356. uint32_t config_param_3, int cookie, int cookie_msb,
  1357. uint8_t mac_id);
  1358. void dp_htt_stats_print_tag(struct dp_pdev *pdev,
  1359. uint8_t tag_type, uint32_t *tag_buf);
  1360. void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
  1361. QDF_STATUS dp_h2t_3tuple_config_send(struct dp_pdev *pdev, uint32_t tuple_mask,
  1362. uint8_t mac_id);
  1363. /**
  1364. * dp_rxtid_stats_cmd_cb - function pointer for peer
  1365. * rx tid stats cmd call_back
  1366. */
  1367. typedef void (*dp_rxtid_stats_cmd_cb)(struct dp_soc *soc, void *cb_ctxt,
  1368. union hal_reo_status *reo_status);
  1369. int dp_peer_rxtid_stats(struct dp_peer *peer,
  1370. dp_rxtid_stats_cmd_cb dp_stats_cmd_cb,
  1371. void *cb_ctxt);
  1372. QDF_STATUS
  1373. dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
  1374. uint8_t *peer_mac, enum cdp_sec_type sec_type,
  1375. uint32_t *rx_pn);
  1376. QDF_STATUS
  1377. dp_set_key_sec_type_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
  1378. uint8_t *peer_mac, enum cdp_sec_type sec_type,
  1379. bool is_unicast);
  1380. void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
  1381. QDF_STATUS
  1382. dp_set_michael_key(struct cdp_soc_t *soc, uint8_t vdev_id,
  1383. uint8_t *peer_mac,
  1384. bool is_unicast, uint32_t *key);
  1385. /**
  1386. * dp_check_pdev_exists() - Validate pdev before use
  1387. * @soc - dp soc handle
  1388. * @data - pdev handle
  1389. *
  1390. * Return: 0 - success/invalid - failure
  1391. */
  1392. bool dp_check_pdev_exists(struct dp_soc *soc, struct dp_pdev *data);
  1393. /**
  1394. * dp_update_delay_stats() - Update delay statistics in structure
  1395. * and fill min, max and avg delay
  1396. * @pdev: pdev handle
  1397. * @delay: delay in ms
  1398. * @tid: tid value
  1399. * @mode: type of tx delay mode
  1400. * @ring id: ring number
  1401. *
  1402. * Return: none
  1403. */
  1404. void dp_update_delay_stats(struct dp_pdev *pdev, uint32_t delay,
  1405. uint8_t tid, uint8_t mode, uint8_t ring_id);
  1406. /**
  1407. * dp_print_ring_stats(): Print tail and head pointer
  1408. * @pdev: DP_PDEV handle
  1409. *
  1410. * Return:void
  1411. */
  1412. void dp_print_ring_stats(struct dp_pdev *pdev);
  1413. /**
  1414. * dp_print_pdev_cfg_params() - Print the pdev cfg parameters
  1415. * @pdev_handle: DP pdev handle
  1416. *
  1417. * Return - void
  1418. */
  1419. void dp_print_pdev_cfg_params(struct dp_pdev *pdev);
  1420. /**
  1421. * dp_print_soc_cfg_params()- Dump soc wlan config parameters
  1422. * @soc_handle: Soc handle
  1423. *
  1424. * Return: void
  1425. */
  1426. void dp_print_soc_cfg_params(struct dp_soc *soc);
  1427. /**
  1428. * dp_srng_get_str_from_ring_type() - Return string name for a ring
  1429. * @ring_type: Ring
  1430. *
  1431. * Return: char const pointer
  1432. */
  1433. const
  1434. char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type);
  1435. /*
  1436. * dp_txrx_path_stats() - Function to display dump stats
  1437. * @soc - soc handle
  1438. *
  1439. * return: none
  1440. */
  1441. void dp_txrx_path_stats(struct dp_soc *soc);
  1442. /*
  1443. * dp_print_per_ring_stats(): Packet count per ring
  1444. * @soc - soc handle
  1445. *
  1446. * Return - None
  1447. */
  1448. void dp_print_per_ring_stats(struct dp_soc *soc);
  1449. /**
  1450. * dp_aggregate_pdev_stats(): Consolidate stats at PDEV level
  1451. * @pdev: DP PDEV handle
  1452. *
  1453. * return: void
  1454. */
  1455. void dp_aggregate_pdev_stats(struct dp_pdev *pdev);
  1456. /**
  1457. * dp_print_rx_rates(): Print Rx rate stats
  1458. * @vdev: DP_VDEV handle
  1459. *
  1460. * Return:void
  1461. */
  1462. void dp_print_rx_rates(struct dp_vdev *vdev);
  1463. /**
  1464. * dp_print_tx_rates(): Print tx rates
  1465. * @vdev: DP_VDEV handle
  1466. *
  1467. * Return:void
  1468. */
  1469. void dp_print_tx_rates(struct dp_vdev *vdev);
  1470. /**
  1471. * dp_print_peer_stats():print peer stats
  1472. * @peer: DP_PEER handle
  1473. *
  1474. * return void
  1475. */
  1476. void dp_print_peer_stats(struct dp_peer *peer);
  1477. /**
  1478. * dp_print_pdev_tx_stats(): Print Pdev level TX stats
  1479. * @pdev: DP_PDEV Handle
  1480. *
  1481. * Return:void
  1482. */
  1483. void
  1484. dp_print_pdev_tx_stats(struct dp_pdev *pdev);
  1485. /**
  1486. * dp_print_pdev_rx_stats(): Print Pdev level RX stats
  1487. * @pdev: DP_PDEV Handle
  1488. *
  1489. * Return: void
  1490. */
  1491. void
  1492. dp_print_pdev_rx_stats(struct dp_pdev *pdev);
  1493. /**
  1494. * dp_print_soc_tx_stats(): Print SOC level stats
  1495. * @soc DP_SOC Handle
  1496. *
  1497. * Return: void
  1498. */
  1499. void dp_print_soc_tx_stats(struct dp_soc *soc);
  1500. /**
  1501. * dp_print_soc_interrupt_stats() - Print interrupt stats for the soc
  1502. * @soc: dp_soc handle
  1503. *
  1504. * Return: None
  1505. */
  1506. void dp_print_soc_interrupt_stats(struct dp_soc *soc);
  1507. /**
  1508. * dp_print_soc_rx_stats: Print SOC level Rx stats
  1509. * @soc: DP_SOC Handle
  1510. *
  1511. * Return:void
  1512. */
  1513. void dp_print_soc_rx_stats(struct dp_soc *soc);
  1514. /**
  1515. * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac
  1516. *
  1517. * @mac_id: MAC id
  1518. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  1519. *
  1520. * Single pdev using both MACs will operate on both MAC rings,
  1521. * which is the case for MCL.
  1522. * For WIN each PDEV will operate one ring, so index is zero.
  1523. *
  1524. */
  1525. static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id)
  1526. {
  1527. if (mac_id && pdev_id) {
  1528. qdf_print("Both mac_id and pdev_id cannot be non zero");
  1529. QDF_BUG(0);
  1530. return 0;
  1531. }
  1532. return (mac_id + pdev_id);
  1533. }
  1534. /**
  1535. * dp_get_lmac_id_for_pdev_id() - Return lmac id corresponding to host pdev id
  1536. * @soc: soc pointer
  1537. * @mac_id: MAC id
  1538. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  1539. *
  1540. * For MCL, Single pdev using both MACs will operate on both MAC rings.
  1541. *
  1542. * For WIN, each PDEV will operate one ring.
  1543. *
  1544. */
  1545. static inline int
  1546. dp_get_lmac_id_for_pdev_id
  1547. (struct dp_soc *soc, uint32_t mac_id, uint32_t pdev_id)
  1548. {
  1549. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) {
  1550. if (mac_id && pdev_id) {
  1551. qdf_print("Both mac_id and pdev_id cannot be non zero");
  1552. QDF_BUG(0);
  1553. return 0;
  1554. }
  1555. return (mac_id + pdev_id);
  1556. }
  1557. return soc->pdev_list[pdev_id]->lmac_id;
  1558. }
  1559. /**
  1560. * dp_get_pdev_for_lmac_id() - Return pdev pointer corresponding to lmac id
  1561. * @soc: soc pointer
  1562. * @lmac_id: LMAC id
  1563. *
  1564. * For MCL, Single pdev exists
  1565. *
  1566. * For WIN, each PDEV will operate one ring.
  1567. *
  1568. */
  1569. static inline struct dp_pdev *
  1570. dp_get_pdev_for_lmac_id(struct dp_soc *soc, uint32_t lmac_id)
  1571. {
  1572. uint8_t i = 0;
  1573. if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) {
  1574. i = wlan_cfg_get_pdev_idx(soc->wlan_cfg_ctx, lmac_id);
  1575. return ((i < MAX_PDEV_CNT) ? soc->pdev_list[i] : NULL);
  1576. }
  1577. /* Typically for MCL as there only 1 PDEV*/
  1578. return soc->pdev_list[0];
  1579. }
  1580. /**
  1581. * dp_calculate_target_pdev_id_from_host_pdev_id() - Return target pdev
  1582. * corresponding to host pdev id
  1583. * @soc: soc pointer
  1584. * @mac_for_pdev: pdev_id corresponding to host pdev for WIN, mac id for MCL
  1585. *
  1586. * returns target pdev_id for host pdev id. For WIN, this is derived through
  1587. * a two step process:
  1588. * 1. Get lmac_id corresponding to host pdev_id (lmac_id can change
  1589. * during mode switch)
  1590. * 2. Get target pdev_id (set up during WMI ready) from lmac_id
  1591. *
  1592. * For MCL, return the offset-1 translated mac_id
  1593. */
  1594. static inline int
  1595. dp_calculate_target_pdev_id_from_host_pdev_id
  1596. (struct dp_soc *soc, uint32_t mac_for_pdev)
  1597. {
  1598. struct dp_pdev *pdev;
  1599. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  1600. return DP_SW2HW_MACID(mac_for_pdev);
  1601. pdev = soc->pdev_list[mac_for_pdev];
  1602. /*non-MCL case, get original target_pdev mapping*/
  1603. return wlan_cfg_get_target_pdev_id(soc->wlan_cfg_ctx, pdev->lmac_id);
  1604. }
  1605. /**
  1606. * dp_get_target_pdev_id_for_host_pdev_id() - Return target pdev corresponding
  1607. * to host pdev id
  1608. * @soc: soc pointer
  1609. * @mac_for_pdev: pdev_id corresponding to host pdev for WIN, mac id for MCL
  1610. *
  1611. * returns target pdev_id for host pdev id.
  1612. * For WIN, return the value stored in pdev object.
  1613. * For MCL, return the offset-1 translated mac_id.
  1614. */
  1615. static inline int
  1616. dp_get_target_pdev_id_for_host_pdev_id
  1617. (struct dp_soc *soc, uint32_t mac_for_pdev)
  1618. {
  1619. struct dp_pdev *pdev;
  1620. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  1621. return DP_SW2HW_MACID(mac_for_pdev);
  1622. pdev = soc->pdev_list[mac_for_pdev];
  1623. return pdev->target_pdev_id;
  1624. }
  1625. /**
  1626. * dp_get_host_pdev_id_for_target_pdev_id() - Return host pdev corresponding
  1627. * to target pdev id
  1628. * @soc: soc pointer
  1629. * @pdev_id: pdev_id corresponding to target pdev
  1630. *
  1631. * returns host pdev_id for target pdev id. For WIN, this is derived through
  1632. * a two step process:
  1633. * 1. Get lmac_id corresponding to target pdev_id
  1634. * 2. Get host pdev_id (set up during WMI ready) from lmac_id
  1635. *
  1636. * For MCL, return the 0-offset pdev_id
  1637. */
  1638. static inline int
  1639. dp_get_host_pdev_id_for_target_pdev_id
  1640. (struct dp_soc *soc, uint32_t pdev_id)
  1641. {
  1642. struct dp_pdev *pdev;
  1643. int lmac_id;
  1644. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  1645. return DP_HW2SW_MACID(pdev_id);
  1646. /*non-MCL case, get original target_lmac mapping from target pdev*/
  1647. lmac_id = wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx,
  1648. DP_HW2SW_MACID(pdev_id));
  1649. /*Get host pdev from lmac*/
  1650. pdev = dp_get_pdev_for_lmac_id(soc, lmac_id);
  1651. return pdev ? pdev->pdev_id : INVALID_PDEV_ID;
  1652. }
  1653. /*
  1654. * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids
  1655. *
  1656. * @soc: handle to DP soc
  1657. * @mac_id: MAC id
  1658. *
  1659. * Single pdev using both MACs will operate on both MAC rings,
  1660. * which is the case for MCL.
  1661. * For WIN each PDEV will operate one ring, so index is zero.
  1662. *
  1663. */
  1664. static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
  1665. {
  1666. /*
  1667. * Single pdev using both MACs will operate on both MAC rings,
  1668. * which is the case for MCL.
  1669. */
  1670. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  1671. return mac_id;
  1672. /* For WIN each PDEV will operate one ring, so index is zero. */
  1673. return 0;
  1674. }
  1675. /*
  1676. * dp_is_subtype_data() - check if the frame subtype is data
  1677. *
  1678. * @frame_ctrl: Frame control field
  1679. *
  1680. * check the frame control field and verify if the packet
  1681. * is a data packet.
  1682. *
  1683. * Return: true or false
  1684. */
  1685. static inline bool dp_is_subtype_data(uint16_t frame_ctrl)
  1686. {
  1687. if (((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_TYPE_MASK) ==
  1688. QDF_IEEE80211_FC0_TYPE_DATA) &&
  1689. (((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1690. QDF_IEEE80211_FC0_SUBTYPE_DATA) ||
  1691. ((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1692. QDF_IEEE80211_FC0_SUBTYPE_QOS))) {
  1693. return true;
  1694. }
  1695. return false;
  1696. }
  1697. #ifdef WDI_EVENT_ENABLE
  1698. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  1699. uint32_t stats_type_upload_mask,
  1700. uint8_t mac_id);
  1701. int dp_wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
  1702. wdi_event_subscribe *event_cb_sub_handle,
  1703. uint32_t event);
  1704. int dp_wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
  1705. wdi_event_subscribe *event_cb_sub_handle,
  1706. uint32_t event);
  1707. void dp_wdi_event_handler(enum WDI_EVENT event, struct dp_soc *soc,
  1708. void *data, u_int16_t peer_id,
  1709. int status, u_int8_t pdev_id);
  1710. int dp_wdi_event_attach(struct dp_pdev *txrx_pdev);
  1711. int dp_wdi_event_detach(struct dp_pdev *txrx_pdev);
  1712. static inline void
  1713. dp_hif_update_pipe_callback(struct dp_soc *dp_soc,
  1714. void *cb_context,
  1715. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t),
  1716. uint8_t pipe_id)
  1717. {
  1718. struct hif_msg_callbacks hif_pipe_callbacks;
  1719. /* TODO: Temporary change to bypass HTC connection for this new
  1720. * HIF pipe, which will be used for packet log and other high-
  1721. * priority HTT messages. Proper HTC connection to be added
  1722. * later once required FW changes are available
  1723. */
  1724. hif_pipe_callbacks.rxCompletionHandler = callback;
  1725. hif_pipe_callbacks.Context = cb_context;
  1726. hif_update_pipe_callback(dp_soc->hif_handle,
  1727. DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
  1728. }
  1729. #else
  1730. static inline int dp_wdi_event_unsub(struct cdp_soc_t *soc, uint8_t pdev_id,
  1731. wdi_event_subscribe *event_cb_sub_handle,
  1732. uint32_t event)
  1733. {
  1734. return 0;
  1735. }
  1736. static inline int dp_wdi_event_sub(struct cdp_soc_t *soc, uint8_t pdev_id,
  1737. wdi_event_subscribe *event_cb_sub_handle,
  1738. uint32_t event)
  1739. {
  1740. return 0;
  1741. }
  1742. static inline
  1743. void dp_wdi_event_handler(enum WDI_EVENT event,
  1744. struct dp_soc *soc,
  1745. void *data, u_int16_t peer_id,
  1746. int status, u_int8_t pdev_id)
  1747. {
  1748. }
  1749. static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev)
  1750. {
  1751. return 0;
  1752. }
  1753. static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
  1754. {
  1755. return 0;
  1756. }
  1757. static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  1758. uint32_t stats_type_upload_mask, uint8_t mac_id)
  1759. {
  1760. return 0;
  1761. }
  1762. static inline void
  1763. dp_hif_update_pipe_callback(struct dp_soc *dp_soc, void *cb_context,
  1764. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t),
  1765. uint8_t pipe_id)
  1766. {
  1767. }
  1768. #endif /* CONFIG_WIN */
  1769. #ifdef VDEV_PEER_PROTOCOL_COUNT
  1770. /**
  1771. * dp_vdev_peer_stats_update_protocol_cnt() - update per-peer protocol counters
  1772. * @vdev: VDEV DP object
  1773. * @nbuf: data packet
  1774. * @peer: Peer DP object
  1775. * @is_egress: whether egress or ingress
  1776. * @is_rx: whether rx or tx
  1777. *
  1778. * This function updates the per-peer protocol counters
  1779. * Return: void
  1780. */
  1781. void dp_vdev_peer_stats_update_protocol_cnt(struct dp_vdev *vdev,
  1782. qdf_nbuf_t nbuf,
  1783. struct dp_peer *peer,
  1784. bool is_egress,
  1785. bool is_rx);
  1786. /**
  1787. * dp_vdev_peer_stats_update_protocol_cnt() - update per-peer protocol counters
  1788. * @soc: SOC DP object
  1789. * @vdev_id: vdev_id
  1790. * @nbuf: data packet
  1791. * @is_egress: whether egress or ingress
  1792. * @is_rx: whether rx or tx
  1793. *
  1794. * This function updates the per-peer protocol counters
  1795. * Return: void
  1796. */
  1797. void dp_peer_stats_update_protocol_cnt(struct cdp_soc_t *soc,
  1798. int8_t vdev_id,
  1799. qdf_nbuf_t nbuf,
  1800. bool is_egress,
  1801. bool is_rx);
  1802. void dp_vdev_peer_stats_update_protocol_cnt_tx(struct dp_vdev *vdev_hdl,
  1803. qdf_nbuf_t nbuf);
  1804. #else
  1805. #define dp_vdev_peer_stats_update_protocol_cnt(vdev, nbuf, peer, \
  1806. is_egress, is_rx)
  1807. static inline
  1808. void dp_vdev_peer_stats_update_protocol_cnt_tx(struct dp_vdev *vdev_hdl,
  1809. qdf_nbuf_t nbuf)
  1810. {
  1811. }
  1812. #endif
  1813. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  1814. void dp_tx_dump_flow_pool_info(struct cdp_soc_t *soc_hdl);
  1815. /**
  1816. * dp_tx_dump_flow_pool_info_compact() - dump flow pool info
  1817. * @soc: DP soc context
  1818. *
  1819. * Return: none
  1820. */
  1821. void dp_tx_dump_flow_pool_info_compact(struct dp_soc *soc);
  1822. int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
  1823. bool force);
  1824. #else
  1825. static inline void dp_tx_dump_flow_pool_info_compact(struct dp_soc *soc)
  1826. {
  1827. }
  1828. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1829. #ifdef QCA_OL_DP_SRNG_LOCK_LESS_ACCESS
  1830. static inline int
  1831. dp_hal_srng_access_start(hal_soc_handle_t soc, hal_ring_handle_t hal_ring_hdl)
  1832. {
  1833. return hal_srng_access_start_unlocked(soc, hal_ring_hdl);
  1834. }
  1835. static inline void
  1836. dp_hal_srng_access_end(hal_soc_handle_t soc, hal_ring_handle_t hal_ring_hdl)
  1837. {
  1838. hal_srng_access_end_unlocked(soc, hal_ring_hdl);
  1839. }
  1840. #else
  1841. static inline int
  1842. dp_hal_srng_access_start(hal_soc_handle_t soc, hal_ring_handle_t hal_ring_hdl)
  1843. {
  1844. return hal_srng_access_start(soc, hal_ring_hdl);
  1845. }
  1846. static inline void
  1847. dp_hal_srng_access_end(hal_soc_handle_t soc, hal_ring_handle_t hal_ring_hdl)
  1848. {
  1849. hal_srng_access_end(soc, hal_ring_hdl);
  1850. }
  1851. #endif
  1852. #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
  1853. /**
  1854. * dp_srng_access_start() - Wrapper function to log access start of a hal ring
  1855. * @int_ctx: pointer to DP interrupt context. This should not be NULL
  1856. * @soc: DP Soc handle
  1857. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  1858. *
  1859. * Return: 0 on success; error on failure
  1860. */
  1861. int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
  1862. hal_ring_handle_t hal_ring_hdl);
  1863. /**
  1864. * dp_srng_access_end() - Wrapper function to log access end of a hal ring
  1865. * @int_ctx: pointer to DP interrupt context. This should not be NULL
  1866. * @soc: DP Soc handle
  1867. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  1868. *
  1869. * Return: void
  1870. */
  1871. void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
  1872. hal_ring_handle_t hal_ring_hdl);
  1873. #else
  1874. static inline int dp_srng_access_start(struct dp_intr *int_ctx,
  1875. struct dp_soc *dp_soc,
  1876. hal_ring_handle_t hal_ring_hdl)
  1877. {
  1878. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1879. return dp_hal_srng_access_start(hal_soc, hal_ring_hdl);
  1880. }
  1881. static inline void dp_srng_access_end(struct dp_intr *int_ctx,
  1882. struct dp_soc *dp_soc,
  1883. hal_ring_handle_t hal_ring_hdl)
  1884. {
  1885. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1886. return dp_hal_srng_access_end(hal_soc, hal_ring_hdl);
  1887. }
  1888. #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
  1889. #ifdef QCA_CACHED_RING_DESC
  1890. /**
  1891. * dp_srng_dst_get_next() - Wrapper function to get next ring desc
  1892. * @dp_socsoc: DP Soc handle
  1893. * @hal_ring: opaque pointer to the HAL Destination Ring
  1894. *
  1895. * Return: HAL ring descriptor
  1896. */
  1897. static inline void *dp_srng_dst_get_next(struct dp_soc *dp_soc,
  1898. hal_ring_handle_t hal_ring_hdl)
  1899. {
  1900. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1901. return hal_srng_dst_get_next_cached(hal_soc, hal_ring_hdl);
  1902. }
  1903. /**
  1904. * dp_srng_dst_inv_cached_descs() - Wrapper function to invalidate cached
  1905. * descriptors
  1906. * @dp_socsoc: DP Soc handle
  1907. * @hal_ring: opaque pointer to the HAL Rx Destination ring
  1908. * @num_entries: Entry count
  1909. *
  1910. * Return: None
  1911. */
  1912. static inline void dp_srng_dst_inv_cached_descs(struct dp_soc *dp_soc,
  1913. hal_ring_handle_t hal_ring_hdl,
  1914. uint32_t num_entries)
  1915. {
  1916. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1917. hal_srng_dst_inv_cached_descs(hal_soc, hal_ring_hdl, num_entries);
  1918. }
  1919. #else
  1920. static inline void *dp_srng_dst_get_next(struct dp_soc *dp_soc,
  1921. hal_ring_handle_t hal_ring_hdl)
  1922. {
  1923. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1924. return hal_srng_dst_get_next(hal_soc, hal_ring_hdl);
  1925. }
  1926. static inline void dp_srng_dst_inv_cached_descs(struct dp_soc *dp_soc,
  1927. hal_ring_handle_t hal_ring_hdl,
  1928. uint32_t num_entries)
  1929. {
  1930. }
  1931. #endif /* QCA_CACHED_RING_DESC */
  1932. #if defined(QCA_CACHED_RING_DESC) && \
  1933. (defined(QCA_DP_RX_HW_SW_NBUF_DESC_PREFETCH) || \
  1934. defined(QCA_DP_TX_HW_SW_NBUF_DESC_PREFETCH))
  1935. /**
  1936. * dp_srng_dst_prefetch() - Wrapper function to prefetch descs from dest ring
  1937. * @hal_soc_hdl: HAL SOC handle
  1938. * @hal_ring: opaque pointer to the HAL Rx Destination ring
  1939. * @num_entries: Entry count
  1940. *
  1941. * Return: None
  1942. */
  1943. static inline void *dp_srng_dst_prefetch(hal_soc_handle_t hal_soc,
  1944. hal_ring_handle_t hal_ring_hdl,
  1945. uint32_t num_entries)
  1946. {
  1947. return hal_srng_dst_prefetch(hal_soc, hal_ring_hdl, num_entries);
  1948. }
  1949. #else
  1950. static inline void *dp_srng_dst_prefetch(hal_soc_handle_t hal_soc,
  1951. hal_ring_handle_t hal_ring_hdl,
  1952. uint32_t num_entries)
  1953. {
  1954. return NULL;
  1955. }
  1956. #endif
  1957. #ifdef QCA_ENH_V3_STATS_SUPPORT
  1958. /**
  1959. * dp_pdev_print_delay_stats(): Print pdev level delay stats
  1960. * @pdev: DP_PDEV handle
  1961. *
  1962. * Return:void
  1963. */
  1964. void dp_pdev_print_delay_stats(struct dp_pdev *pdev);
  1965. /**
  1966. * dp_pdev_print_tid_stats(): Print pdev level tid stats
  1967. * @pdev: DP_PDEV handle
  1968. *
  1969. * Return:void
  1970. */
  1971. void dp_pdev_print_tid_stats(struct dp_pdev *pdev);
  1972. /**
  1973. * dp_pdev_print_rx_error_stats(): Print pdev level rx error stats
  1974. * @pdev: DP_PDEV handle
  1975. *
  1976. * Return:void
  1977. */
  1978. void dp_pdev_print_rx_error_stats(struct dp_pdev *pdev);
  1979. #endif /* CONFIG_WIN */
  1980. void dp_soc_set_txrx_ring_map(struct dp_soc *soc);
  1981. /**
  1982. * dp_vdev_to_cdp_vdev() - typecast dp vdev to cdp vdev
  1983. * @vdev: DP vdev handle
  1984. *
  1985. * Return: struct cdp_vdev pointer
  1986. */
  1987. static inline
  1988. struct cdp_vdev *dp_vdev_to_cdp_vdev(struct dp_vdev *vdev)
  1989. {
  1990. return (struct cdp_vdev *)vdev;
  1991. }
  1992. /**
  1993. * dp_pdev_to_cdp_pdev() - typecast dp pdev to cdp pdev
  1994. * @pdev: DP pdev handle
  1995. *
  1996. * Return: struct cdp_pdev pointer
  1997. */
  1998. static inline
  1999. struct cdp_pdev *dp_pdev_to_cdp_pdev(struct dp_pdev *pdev)
  2000. {
  2001. return (struct cdp_pdev *)pdev;
  2002. }
  2003. /**
  2004. * dp_soc_to_cdp_soc() - typecast dp psoc to cdp psoc
  2005. * @psoc: DP psoc handle
  2006. *
  2007. * Return: struct cdp_soc pointer
  2008. */
  2009. static inline
  2010. struct cdp_soc *dp_soc_to_cdp_soc(struct dp_soc *psoc)
  2011. {
  2012. return (struct cdp_soc *)psoc;
  2013. }
  2014. /**
  2015. * dp_soc_to_cdp_soc_t() - typecast dp psoc to
  2016. * ol txrx soc handle
  2017. * @psoc: DP psoc handle
  2018. *
  2019. * Return: struct cdp_soc_t pointer
  2020. */
  2021. static inline
  2022. struct cdp_soc_t *dp_soc_to_cdp_soc_t(struct dp_soc *psoc)
  2023. {
  2024. return (struct cdp_soc_t *)psoc;
  2025. }
  2026. #if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)
  2027. /**
  2028. * dp_rx_flow_update_fse_stats() - Update a flow's statistics
  2029. * @pdev: pdev handle
  2030. * @flow_id: flow index (truncated hash) in the Rx FST
  2031. *
  2032. * Return: Success when flow statistcs is updated, error on failure
  2033. */
  2034. QDF_STATUS dp_rx_flow_get_fse_stats(struct dp_pdev *pdev,
  2035. struct cdp_rx_flow_info *rx_flow_info,
  2036. struct cdp_flow_stats *stats);
  2037. /**
  2038. * dp_rx_flow_delete_entry() - Delete a flow entry from flow search table
  2039. * @pdev: pdev handle
  2040. * @rx_flow_info: DP flow parameters
  2041. *
  2042. * Return: Success when flow is deleted, error on failure
  2043. */
  2044. QDF_STATUS dp_rx_flow_delete_entry(struct dp_pdev *pdev,
  2045. struct cdp_rx_flow_info *rx_flow_info);
  2046. /**
  2047. * dp_rx_flow_add_entry() - Add a flow entry to flow search table
  2048. * @pdev: DP pdev instance
  2049. * @rx_flow_info: DP flow paramaters
  2050. *
  2051. * Return: Success when flow is added, no-memory or already exists on error
  2052. */
  2053. QDF_STATUS dp_rx_flow_add_entry(struct dp_pdev *pdev,
  2054. struct cdp_rx_flow_info *rx_flow_info);
  2055. /**
  2056. * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
  2057. * @soc: SoC handle
  2058. * @pdev: Pdev handle
  2059. *
  2060. * Return: Handle to flow search table entry
  2061. */
  2062. QDF_STATUS dp_rx_fst_attach(struct dp_soc *soc, struct dp_pdev *pdev);
  2063. /**
  2064. * dp_rx_fst_detach() - De-initialize Rx FST
  2065. * @soc: SoC handle
  2066. * @pdev: Pdev handle
  2067. *
  2068. * Return: None
  2069. */
  2070. void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev);
  2071. /**
  2072. * dp_rx_flow_send_fst_fw_setup() - Program FST parameters in FW/HW post-attach
  2073. * @soc: SoC handle
  2074. * @pdev: Pdev handle
  2075. *
  2076. * Return: Success when fst parameters are programmed in FW, error otherwise
  2077. */
  2078. QDF_STATUS dp_rx_flow_send_fst_fw_setup(struct dp_soc *soc,
  2079. struct dp_pdev *pdev);
  2080. #else /* !((WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)) */
  2081. /**
  2082. * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
  2083. * @soc: SoC handle
  2084. * @pdev: Pdev handle
  2085. *
  2086. * Return: Handle to flow search table entry
  2087. */
  2088. static inline
  2089. QDF_STATUS dp_rx_fst_attach(struct dp_soc *soc, struct dp_pdev *pdev)
  2090. {
  2091. return QDF_STATUS_SUCCESS;
  2092. }
  2093. /**
  2094. * dp_rx_fst_detach() - De-initialize Rx FST
  2095. * @soc: SoC handle
  2096. * @pdev: Pdev handle
  2097. *
  2098. * Return: None
  2099. */
  2100. static inline
  2101. void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev)
  2102. {
  2103. }
  2104. #endif
  2105. /**
  2106. * dp_vdev_get_ref() - API to take a reference for VDEV object
  2107. *
  2108. * @soc : core DP soc context
  2109. * @vdev : DP vdev
  2110. * @mod_id : module id
  2111. *
  2112. * Return: QDF_STATUS_SUCCESS if reference held successfully
  2113. * else QDF_STATUS_E_INVAL
  2114. */
  2115. static inline
  2116. QDF_STATUS dp_vdev_get_ref(struct dp_soc *soc, struct dp_vdev *vdev,
  2117. enum dp_mod_id mod_id)
  2118. {
  2119. if (!qdf_atomic_inc_not_zero(&vdev->ref_cnt))
  2120. return QDF_STATUS_E_INVAL;
  2121. qdf_atomic_inc(&vdev->mod_refs[mod_id]);
  2122. return QDF_STATUS_SUCCESS;
  2123. }
  2124. /**
  2125. * dp_vdev_get_ref_by_id() - Returns vdev object given the vdev id
  2126. * @soc: core DP soc context
  2127. * @vdev_id: vdev id from vdev object can be retrieved
  2128. * @mod_id: module id which is requesting the reference
  2129. *
  2130. * Return: struct dp_vdev*: Pointer to DP vdev object
  2131. */
  2132. static inline struct dp_vdev *
  2133. dp_vdev_get_ref_by_id(struct dp_soc *soc, uint8_t vdev_id,
  2134. enum dp_mod_id mod_id)
  2135. {
  2136. struct dp_vdev *vdev = NULL;
  2137. if (qdf_unlikely(vdev_id >= MAX_VDEV_CNT))
  2138. return NULL;
  2139. qdf_spin_lock_bh(&soc->vdev_map_lock);
  2140. vdev = soc->vdev_id_map[vdev_id];
  2141. if (!vdev || dp_vdev_get_ref(soc, vdev, mod_id) != QDF_STATUS_SUCCESS) {
  2142. qdf_spin_unlock_bh(&soc->vdev_map_lock);
  2143. return NULL;
  2144. }
  2145. qdf_spin_unlock_bh(&soc->vdev_map_lock);
  2146. return vdev;
  2147. }
  2148. /**
  2149. * dp_get_pdev_from_soc_pdev_id_wifi3() - Returns pdev object given the pdev id
  2150. * @soc: core DP soc context
  2151. * @pdev_id: pdev id from pdev object can be retrieved
  2152. *
  2153. * Return: struct dp_pdev*: Pointer to DP pdev object
  2154. */
  2155. static inline struct dp_pdev *
  2156. dp_get_pdev_from_soc_pdev_id_wifi3(struct dp_soc *soc,
  2157. uint8_t pdev_id)
  2158. {
  2159. if (qdf_unlikely(pdev_id >= MAX_PDEV_CNT))
  2160. return NULL;
  2161. return soc->pdev_list[pdev_id];
  2162. }
  2163. /*
  2164. * dp_rx_tid_update_wifi3() – Update receive TID state
  2165. * @peer: Datapath peer handle
  2166. * @tid: TID
  2167. * @ba_window_size: BlockAck window size
  2168. * @start_seq: Starting sequence number
  2169. * @bar_update: BAR update triggered
  2170. *
  2171. * Return: QDF_STATUS code
  2172. */
  2173. QDF_STATUS dp_rx_tid_update_wifi3(struct dp_peer *peer, int tid, uint32_t
  2174. ba_window_size, uint32_t start_seq,
  2175. bool bar_update);
  2176. /**
  2177. * dp_get_peer_mac_list(): function to get peer mac list of vdev
  2178. * @soc: Datapath soc handle
  2179. * @vdev_id: vdev id
  2180. * @newmac: Table of the clients mac
  2181. * @mac_cnt: No. of MACs required
  2182. * @limit: Limit the number of clients
  2183. *
  2184. * return: no of clients
  2185. */
  2186. uint16_t dp_get_peer_mac_list(ol_txrx_soc_handle soc, uint8_t vdev_id,
  2187. u_int8_t newmac[][QDF_MAC_ADDR_SIZE],
  2188. u_int16_t mac_cnt, bool limit);
  2189. /*
  2190. * dp_is_hw_dbs_enable() - Procedure to check if DBS is supported
  2191. * @soc: DP SoC context
  2192. * @max_mac_rings: No of MAC rings
  2193. *
  2194. * Return: None
  2195. */
  2196. void dp_is_hw_dbs_enable(struct dp_soc *soc,
  2197. int *max_mac_rings);
  2198. #if defined(WLAN_SUPPORT_RX_FISA)
  2199. void dp_rx_dump_fisa_table(struct dp_soc *soc);
  2200. /*
  2201. * dp_rx_fst_update_cmem_params() - Update CMEM FST params
  2202. * @soc: DP SoC context
  2203. * @num_entries: Number of flow search entries
  2204. * @cmem_ba_lo: CMEM base address low
  2205. * @cmem_ba_hi: CMEM base address high
  2206. *
  2207. * Return: None
  2208. */
  2209. void dp_rx_fst_update_cmem_params(struct dp_soc *soc, uint16_t num_entries,
  2210. uint32_t cmem_ba_lo, uint32_t cmem_ba_hi);
  2211. void
  2212. dp_rx_fst_update_pm_suspend_status(struct dp_soc *soc, bool suspended);
  2213. #else
  2214. static inline void
  2215. dp_rx_fst_update_cmem_params(struct dp_soc *soc, uint16_t num_entries,
  2216. uint32_t cmem_ba_lo, uint32_t cmem_ba_hi)
  2217. {
  2218. }
  2219. static inline void
  2220. dp_rx_fst_update_pm_suspend_status(struct dp_soc *soc, bool suspended)
  2221. {
  2222. }
  2223. #endif /* WLAN_SUPPORT_RX_FISA */
  2224. #ifdef MAX_ALLOC_PAGE_SIZE
  2225. /**
  2226. * dp_set_page_size() - Set the max page size for hw link desc.
  2227. * For MCL the page size is set to OS defined value and for WIN
  2228. * the page size is set to the max_alloc_size cfg ini
  2229. * param.
  2230. * This is to ensure that WIN gets contiguous memory allocations
  2231. * as per requirement.
  2232. * @pages: link desc page handle
  2233. * @max_alloc_size: max_alloc_size
  2234. *
  2235. * Return: None
  2236. */
  2237. static inline
  2238. void dp_set_max_page_size(struct qdf_mem_multi_page_t *pages,
  2239. uint32_t max_alloc_size)
  2240. {
  2241. pages->page_size = qdf_page_size;
  2242. }
  2243. #else
  2244. static inline
  2245. void dp_set_max_page_size(struct qdf_mem_multi_page_t *pages,
  2246. uint32_t max_alloc_size)
  2247. {
  2248. pages->page_size = max_alloc_size;
  2249. }
  2250. #endif /* MAX_ALLOC_PAGE_SIZE */
  2251. /**
  2252. * dp_history_get_next_index() - get the next entry to record an entry
  2253. * in the history.
  2254. * @curr_idx: Current index where the last entry is written.
  2255. * @max_entries: Max number of entries in the history
  2256. *
  2257. * This function assumes that the max number os entries is a power of 2.
  2258. *
  2259. * Returns: The index where the next entry is to be written.
  2260. */
  2261. static inline uint32_t dp_history_get_next_index(qdf_atomic_t *curr_idx,
  2262. uint32_t max_entries)
  2263. {
  2264. uint32_t idx = qdf_atomic_inc_return(curr_idx);
  2265. return idx & (max_entries - 1);
  2266. }
  2267. /**
  2268. * dp_rx_skip_tlvs() - Skip TLVs len + L2 hdr_offset, save in nbuf->cb
  2269. * @nbuf: nbuf cb to be updated
  2270. * @l2_hdr_offset: l2_hdr_offset
  2271. *
  2272. * Return: None
  2273. */
  2274. void dp_rx_skip_tlvs(struct dp_soc *soc, qdf_nbuf_t nbuf, uint32_t l3_padding);
  2275. #ifndef FEATURE_WDS
  2276. static inline void
  2277. dp_hmwds_ast_add_notify(struct dp_peer *peer,
  2278. uint8_t *mac_addr,
  2279. enum cdp_txrx_ast_entry_type type,
  2280. QDF_STATUS err,
  2281. bool is_peer_map)
  2282. {
  2283. }
  2284. #endif
  2285. #ifdef HTT_STATS_DEBUGFS_SUPPORT
  2286. /* dp_pdev_htt_stats_dbgfs_init() - Function to allocate memory and initialize
  2287. * debugfs for HTT stats
  2288. * @pdev: dp pdev handle
  2289. *
  2290. * Return: QDF_STATUS
  2291. */
  2292. QDF_STATUS dp_pdev_htt_stats_dbgfs_init(struct dp_pdev *pdev);
  2293. /* dp_pdev_htt_stats_dbgfs_deinit() - Function to remove debugfs entry for
  2294. * HTT stats
  2295. * @pdev: dp pdev handle
  2296. *
  2297. * Return: none
  2298. */
  2299. void dp_pdev_htt_stats_dbgfs_deinit(struct dp_pdev *pdev);
  2300. #else
  2301. /* dp_pdev_htt_stats_dbgfs_init() - Function to allocate memory and initialize
  2302. * debugfs for HTT stats
  2303. * @pdev: dp pdev handle
  2304. *
  2305. * Return: QDF_STATUS
  2306. */
  2307. static inline QDF_STATUS
  2308. dp_pdev_htt_stats_dbgfs_init(struct dp_pdev *pdev)
  2309. {
  2310. return QDF_STATUS_SUCCESS;
  2311. }
  2312. /* dp_pdev_htt_stats_dbgfs_deinit() - Function to remove debugfs entry for
  2313. * HTT stats
  2314. * @pdev: dp pdev handle
  2315. *
  2316. * Return: none
  2317. */
  2318. static inline void
  2319. dp_pdev_htt_stats_dbgfs_deinit(struct dp_pdev *pdev)
  2320. {
  2321. }
  2322. #endif /* HTT_STATS_DEBUGFS_SUPPORT */
  2323. #ifndef WLAN_DP_FEATURE_SW_LATENCY_MGR
  2324. /**
  2325. * dp_soc_swlm_attach() - attach the software latency manager resources
  2326. * @soc: Datapath global soc handle
  2327. *
  2328. * Returns: QDF_STATUS
  2329. */
  2330. static inline QDF_STATUS dp_soc_swlm_attach(struct dp_soc *soc)
  2331. {
  2332. return QDF_STATUS_SUCCESS;
  2333. }
  2334. /**
  2335. * dp_soc_swlm_detach() - detach the software latency manager resources
  2336. * @soc: Datapath global soc handle
  2337. *
  2338. * Returns: QDF_STATUS
  2339. */
  2340. static inline QDF_STATUS dp_soc_swlm_detach(struct dp_soc *soc)
  2341. {
  2342. return QDF_STATUS_SUCCESS;
  2343. }
  2344. #endif /* !WLAN_DP_FEATURE_SW_LATENCY_MGR */
  2345. #ifdef QCA_SUPPORT_WDS_EXTENDED
  2346. /**
  2347. * dp_wds_ext_get_peer_id(): function to get peer id by mac
  2348. * This API is called from control path when wds extended
  2349. * device is created, hence it also updates wds extended
  2350. * peer state to up, which will be referred in rx processing.
  2351. * @soc: Datapath soc handle
  2352. * @vdev_id: vdev id
  2353. * @mac: Peer mac address
  2354. *
  2355. * return: valid peer id on success
  2356. * HTT_INVALID_PEER on failure
  2357. */
  2358. uint16_t dp_wds_ext_get_peer_id(ol_txrx_soc_handle soc,
  2359. uint8_t vdev_id,
  2360. uint8_t *mac);
  2361. /**
  2362. * dp_wds_ext_set_peer_state(): function to set peer state
  2363. * @soc: Datapath soc handle
  2364. * @vdev_id: vdev id
  2365. * @mac: Peer mac address
  2366. * @rx: rx function pointer
  2367. *
  2368. * return: QDF_STATUS_SUCCESS on success
  2369. * QDF_STATUS_E_INVAL if peer is not found
  2370. * QDF_STATUS_E_ALREADY if rx is already set/unset
  2371. */
  2372. QDF_STATUS dp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc,
  2373. uint8_t vdev_id,
  2374. uint8_t *mac,
  2375. ol_txrx_rx_fp rx,
  2376. ol_osif_peer_handle osif_peer);
  2377. #endif /* QCA_SUPPORT_WDS_EXTENDED */
  2378. #ifdef DP_MEM_PRE_ALLOC
  2379. /**
  2380. * dp_context_alloc_mem() - allocate memory for DP context
  2381. * @soc: datapath soc handle
  2382. * @ctxt_type: DP context type
  2383. * @ctxt_size: DP context size
  2384. *
  2385. * Return: DP context address
  2386. */
  2387. void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
  2388. size_t ctxt_size);
  2389. /**
  2390. * dp_context_free_mem() - Free memory of DP context
  2391. * @soc: datapath soc handle
  2392. * @ctxt_type: DP context type
  2393. * @vaddr: Address of context memory
  2394. *
  2395. * Return: None
  2396. */
  2397. void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
  2398. void *vaddr);
  2399. /**
  2400. * dp_desc_multi_pages_mem_alloc() - alloc memory over multiple pages
  2401. * @soc: datapath soc handle
  2402. * @desc_type: memory request source type
  2403. * @pages: multi page information storage
  2404. * @element_size: each element size
  2405. * @element_num: total number of elements should be allocated
  2406. * @memctxt: memory context
  2407. * @cacheable: coherent memory or cacheable memory
  2408. *
  2409. * This function is a wrapper for memory allocation over multiple
  2410. * pages, if dp prealloc method is registered, then will try prealloc
  2411. * firstly. if prealloc failed, fall back to regular way over
  2412. * qdf_mem_multi_pages_alloc().
  2413. *
  2414. * Return: None
  2415. */
  2416. void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
  2417. enum dp_desc_type desc_type,
  2418. struct qdf_mem_multi_page_t *pages,
  2419. size_t element_size,
  2420. uint16_t element_num,
  2421. qdf_dma_context_t memctxt,
  2422. bool cacheable);
  2423. /**
  2424. * dp_desc_multi_pages_mem_free() - free multiple pages memory
  2425. * @soc: datapath soc handle
  2426. * @desc_type: memory request source type
  2427. * @pages: multi page information storage
  2428. * @memctxt: memory context
  2429. * @cacheable: coherent memory or cacheable memory
  2430. *
  2431. * This function is a wrapper for multiple pages memory free,
  2432. * if memory is got from prealloc pool, put it back to pool.
  2433. * otherwise free by qdf_mem_multi_pages_free().
  2434. *
  2435. * Return: None
  2436. */
  2437. void dp_desc_multi_pages_mem_free(struct dp_soc *soc,
  2438. enum dp_desc_type desc_type,
  2439. struct qdf_mem_multi_page_t *pages,
  2440. qdf_dma_context_t memctxt,
  2441. bool cacheable);
  2442. #else
  2443. static inline
  2444. void *dp_context_alloc_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
  2445. size_t ctxt_size)
  2446. {
  2447. return qdf_mem_malloc(ctxt_size);
  2448. }
  2449. static inline
  2450. void dp_context_free_mem(struct dp_soc *soc, enum dp_ctxt_type ctxt_type,
  2451. void *vaddr)
  2452. {
  2453. qdf_mem_free(vaddr);
  2454. }
  2455. static inline
  2456. void dp_desc_multi_pages_mem_alloc(struct dp_soc *soc,
  2457. enum dp_desc_type desc_type,
  2458. struct qdf_mem_multi_page_t *pages,
  2459. size_t element_size,
  2460. uint16_t element_num,
  2461. qdf_dma_context_t memctxt,
  2462. bool cacheable)
  2463. {
  2464. qdf_mem_multi_pages_alloc(soc->osdev, pages, element_size,
  2465. element_num, memctxt, cacheable);
  2466. }
  2467. static inline
  2468. void dp_desc_multi_pages_mem_free(struct dp_soc *soc,
  2469. enum dp_desc_type desc_type,
  2470. struct qdf_mem_multi_page_t *pages,
  2471. qdf_dma_context_t memctxt,
  2472. bool cacheable)
  2473. {
  2474. qdf_mem_multi_pages_free(soc->osdev, pages,
  2475. memctxt, cacheable);
  2476. }
  2477. #endif
  2478. #ifdef FEATURE_RUNTIME_PM
  2479. /**
  2480. * dp_runtime_get() - Get dp runtime refcount
  2481. * @soc: Datapath soc handle
  2482. *
  2483. * Get dp runtime refcount by increment of an atomic variable, which can block
  2484. * dp runtime resume to wait to flush pending tx by runtime suspend.
  2485. *
  2486. * Return: Current refcount
  2487. */
  2488. static inline int32_t dp_runtime_get(struct dp_soc *soc)
  2489. {
  2490. return qdf_atomic_inc_return(&soc->dp_runtime_refcount);
  2491. }
  2492. /**
  2493. * dp_runtime_put() - Return dp runtime refcount
  2494. * @soc: Datapath soc handle
  2495. *
  2496. * Return dp runtime refcount by decrement of an atomic variable, allow dp
  2497. * runtime resume finish.
  2498. *
  2499. * Return: Current refcount
  2500. */
  2501. static inline int32_t dp_runtime_put(struct dp_soc *soc)
  2502. {
  2503. return qdf_atomic_dec_return(&soc->dp_runtime_refcount);
  2504. }
  2505. /**
  2506. * dp_runtime_get_refcount() - Get dp runtime refcount
  2507. * @soc: Datapath soc handle
  2508. *
  2509. * Get dp runtime refcount by returning an atomic variable
  2510. *
  2511. * Return: Current refcount
  2512. */
  2513. static inline int32_t dp_runtime_get_refcount(struct dp_soc *soc)
  2514. {
  2515. return qdf_atomic_read(&soc->dp_runtime_refcount);
  2516. }
  2517. /**
  2518. * dp_runtime_init() - Init dp runtime refcount when dp soc init
  2519. * @soc: Datapath soc handle
  2520. *
  2521. * Return: QDF_STATUS
  2522. */
  2523. static inline QDF_STATUS dp_runtime_init(struct dp_soc *soc)
  2524. {
  2525. return qdf_atomic_init(&soc->dp_runtime_refcount);
  2526. }
  2527. #else
  2528. static inline int32_t dp_runtime_get(struct dp_soc *soc)
  2529. {
  2530. return 0;
  2531. }
  2532. static inline int32_t dp_runtime_put(struct dp_soc *soc)
  2533. {
  2534. return 0;
  2535. }
  2536. static inline QDF_STATUS dp_runtime_init(struct dp_soc *soc)
  2537. {
  2538. return QDF_STATUS_SUCCESS;
  2539. }
  2540. #endif
  2541. static inline enum QDF_GLOBAL_MODE dp_soc_get_con_mode(struct dp_soc *soc)
  2542. {
  2543. if (soc->cdp_soc.ol_ops->get_con_mode)
  2544. return soc->cdp_soc.ol_ops->get_con_mode();
  2545. return QDF_GLOBAL_MAX_MODE;
  2546. }
  2547. /*
  2548. * dp_pdev_bkp_stats_detach() - detach resources for back pressure stats
  2549. * processing
  2550. * @pdev: Datapath PDEV handle
  2551. *
  2552. */
  2553. void dp_pdev_bkp_stats_detach(struct dp_pdev *pdev);
  2554. /*
  2555. * dp_pdev_bkp_stats_attach() - attach resources for back pressure stats
  2556. * processing
  2557. * @pdev: Datapath PDEV handle
  2558. *
  2559. * Return: QDF_STATUS_SUCCESS: Success
  2560. * QDF_STATUS_E_NOMEM: Error
  2561. */
  2562. QDF_STATUS dp_pdev_bkp_stats_attach(struct dp_pdev *pdev);
  2563. /**
  2564. * dp_peer_flush_frags() - Flush all fragments for a particular
  2565. * peer
  2566. * @soc_hdl - data path soc handle
  2567. * @vdev_id - vdev id
  2568. * @peer_addr - peer mac address
  2569. *
  2570. * Return: None
  2571. */
  2572. void dp_peer_flush_frags(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  2573. uint8_t *peer_mac);
  2574. /**
  2575. * dp_soc_reset_mon_intr_mask() - reset mon intr mask
  2576. * @soc: pointer to dp_soc handle
  2577. *
  2578. * Return:
  2579. */
  2580. void dp_soc_reset_mon_intr_mask(struct dp_soc *soc);
  2581. /**
  2582. * dp_txrx_get_soc_stats() - will return cdp_soc_stats
  2583. * @soc_hdl: soc handle
  2584. * @soc_stats: buffer to hold the values
  2585. *
  2586. * Return: QDF_STATUS_SUCCESS: Success
  2587. * QDF_STATUS_E_FAILURE: Error
  2588. */
  2589. QDF_STATUS dp_txrx_get_soc_stats(struct cdp_soc_t *soc_hdl,
  2590. struct cdp_soc_stats *soc_stats);
  2591. /**
  2592. * dp_txrx_get_peer_delay_stats() - to get peer delay stats per TIDs
  2593. * @soc: soc handle
  2594. * @vdev_id: id of vdev handle
  2595. * @peer_mac: mac of DP_PEER handle
  2596. * @delay_stats: pointer to delay stats array
  2597. *
  2598. * Return: QDF_STATUS_SUCCESS: Success
  2599. * QDF_STATUS_E_FAILURE: Error
  2600. */
  2601. QDF_STATUS
  2602. dp_txrx_get_peer_delay_stats(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  2603. uint8_t *peer_mac,
  2604. struct cdp_delay_tid_stats *delay_stats);
  2605. /**
  2606. * dp_txrx_get_peer_jitter_stats() - to get peer jitter stats per TIDs
  2607. * @soc: soc handle
  2608. * @pdev_id: id of pdev handle
  2609. * @vdev_id: id of vdev handle
  2610. * @peer_mac: mac of DP_PEER handle
  2611. * @tid_stats: pointer to jitter stats array
  2612. *
  2613. * Return: QDF_STATUS_SUCCESS: Success
  2614. * QDF_STATUS_E_FAILURE: Error
  2615. */
  2616. QDF_STATUS
  2617. dp_txrx_get_peer_jitter_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2618. uint8_t vdev_id, uint8_t *peer_mac,
  2619. struct cdp_peer_tid_stats *tid_stats);
  2620. /* dp_peer_get_tx_capture_stats - to get peer Tx Capture stats
  2621. * @soc_hdl: soc handle
  2622. * @vdev_id: id of vdev handle
  2623. * @peer_mac: mac of DP_PEER handle
  2624. * @stats: pointer to peer tx capture stats
  2625. *
  2626. * Return: QDF_STATUS_SUCCESS: Success
  2627. * QDF_STATUS_E_FAILURE: Error
  2628. */
  2629. QDF_STATUS
  2630. dp_peer_get_tx_capture_stats(struct cdp_soc_t *soc_hdl,
  2631. uint8_t vdev_id, uint8_t *peer_mac,
  2632. struct cdp_peer_tx_capture_stats *stats);
  2633. /* dp_pdev_get_tx_capture_stats - to get pdev Tx Capture stats
  2634. * @soc_hdl: soc handle
  2635. * @pdev_id: id of pdev handle
  2636. * @stats: pointer to pdev tx capture stats
  2637. *
  2638. * Return: QDF_STATUS_SUCCESS: Success
  2639. * QDF_STATUS_E_FAILURE: Error
  2640. */
  2641. QDF_STATUS
  2642. dp_pdev_get_tx_capture_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2643. struct cdp_pdev_tx_capture_stats *stats);
  2644. #endif /* #ifndef _DP_INTERNAL_H_ */