dp_internal.h 79 KB

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