cdp_txrx_cmn.h 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493
  1. /*
  2. * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * @file cdp_txrx_cmn.h
  20. * @brief Define the host data path converged API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_CMN_H_
  24. #define _CDP_TXRX_CMN_H_
  25. #include "qdf_types.h"
  26. #include "qdf_nbuf.h"
  27. #include "cdp_txrx_ops.h"
  28. #include "cdp_txrx_handle.h"
  29. #include "cdp_txrx_cmn_struct.h"
  30. #ifdef ENABLE_VERBOSE_DEBUG
  31. extern bool is_dp_verbose_debug_enabled;
  32. #endif
  33. /******************************************************************************
  34. *
  35. * Common Data Path Header File
  36. *
  37. *****************************************************************************/
  38. #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
  39. #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
  40. #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
  41. #define dp_info(params...) \
  42. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  43. #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
  44. #ifdef DP_PRINT_NO_CONSOLE
  45. #define dp_err_log(params...) \
  46. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  47. #define dp_info_rl(params...) \
  48. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  49. #else
  50. #define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
  51. #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
  52. #endif /* DP_PRINT_NO_CONSOLE */
  53. #ifdef ENABLE_VERBOSE_DEBUG
  54. /**
  55. * @enum verbose_debug_module:
  56. * if INI "enable_verbose_debug" has to set following bit positions to enable
  57. * respective module's excessive logging,
  58. *
  59. * @hif_verbose_debug_mask: 1st bit [0th index] is for HIF module
  60. * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module
  61. * @dp_verbose_debug_mask: 3rd bit [2nd index] is for DP module
  62. */
  63. enum verbose_debug_module {
  64. hif_vebose_debug_mask = 1 << 0,
  65. hal_verbose_debug_mask = 1 << 1,
  66. dp_verbose_debug_mask = 1 << 2,
  67. };
  68. #define dp_verbose_debug(params...) \
  69. if (unlikely(is_dp_verbose_debug_enabled)) \
  70. do {\
  71. QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \
  72. } while (0)
  73. #else
  74. #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
  75. #endif
  76. #define dp_nofl_alert(params...) \
  77. QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP, params)
  78. #define dp_nofl_err(params...) \
  79. QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP, params)
  80. #define dp_nofl_warn(params...) \
  81. QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP, params)
  82. #define dp_nofl_info(params...) \
  83. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
  84. #define dp_nofl_debug(params...) \
  85. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
  86. #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
  87. #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
  88. #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
  89. #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
  90. /**
  91. * @enum vdev_host_stats_id:
  92. * host stats update from CDP have to set one of the following stats ID
  93. *
  94. * @DP_VDEV_STATS_PKT_CNT_ONLY: update Tx packet count only
  95. * @DP_VDEV_STATS_TX_ME: update Tx ingress stats
  96. */
  97. enum {
  98. DP_VDEV_STATS_PKT_CNT_ONLY,
  99. DP_VDEV_STATS_TX_ME,
  100. };
  101. static inline QDF_STATUS
  102. cdp_soc_attach_target(ol_txrx_soc_handle soc)
  103. {
  104. if (!soc || !soc->ops) {
  105. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  106. "%s: Invalid Instance:", __func__);
  107. QDF_BUG(0);
  108. return QDF_STATUS_E_INVAL;
  109. }
  110. if (!soc->ops->cmn_drv_ops ||
  111. !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
  112. return QDF_STATUS_SUCCESS;
  113. return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
  114. }
  115. static inline struct cdp_vdev *
  116. cdp_vdev_attach(ol_txrx_soc_handle soc, uint8_t pdev_id,
  117. uint8_t *vdev_mac_addr, uint8_t vdev_id,
  118. enum wlan_op_mode op_mode, enum wlan_op_subtype subtype)
  119. {
  120. if (!soc || !soc->ops) {
  121. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  122. "%s: Invalid Instance:", __func__);
  123. QDF_BUG(0);
  124. return NULL;
  125. }
  126. if (!soc->ops->cmn_drv_ops ||
  127. !soc->ops->cmn_drv_ops->txrx_vdev_attach)
  128. return NULL;
  129. return soc->ops->cmn_drv_ops->txrx_vdev_attach(soc, pdev_id,
  130. vdev_mac_addr, vdev_id,
  131. op_mode, subtype);
  132. }
  133. #ifdef DP_FLOW_CTL
  134. /**
  135. * cdp_flow_pool_map() - Create flow pool for vdev
  136. * @soc: data path soc handle
  137. * @pdev_id: id of dp pdev handle
  138. * @vdev_id: vdev_id corresponding to vdev start
  139. *
  140. * Create per vdev flow pool.
  141. *
  142. * return none
  143. */
  144. static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
  145. uint8_t pdev_id, uint8_t vdev_id)
  146. {
  147. if (!soc || !soc->ops) {
  148. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  149. "%s: Invalid Instance:", __func__);
  150. QDF_BUG(0);
  151. return QDF_STATUS_E_INVAL;
  152. }
  153. if (!soc->ops->flowctl_ops ||
  154. !soc->ops->flowctl_ops->flow_pool_map_handler)
  155. return QDF_STATUS_E_INVAL;
  156. return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev_id,
  157. vdev_id);
  158. }
  159. /**
  160. * cdp_flow_pool_unmap() - Delete flow pool
  161. * @soc: data path soc handle
  162. * @pdev_id: id of dp pdev handle
  163. * @vdev_id: vdev_id corresponding to vdev start
  164. *
  165. * Delete flow pool
  166. *
  167. * return none
  168. */
  169. static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
  170. uint8_t pdev_id, uint8_t vdev_id)
  171. {
  172. if (!soc || !soc->ops) {
  173. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  174. "%s: Invalid Instance:", __func__);
  175. QDF_BUG(0);
  176. return;
  177. }
  178. if (!soc->ops->flowctl_ops ||
  179. !soc->ops->flowctl_ops->flow_pool_unmap_handler)
  180. return;
  181. return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev_id,
  182. vdev_id);
  183. }
  184. #endif
  185. static inline QDF_STATUS
  186. cdp_vdev_detach(ol_txrx_soc_handle soc, uint8_t vdev_id,
  187. ol_txrx_vdev_delete_cb callback, void *cb_context)
  188. {
  189. if (!soc || !soc->ops) {
  190. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  191. "%s: Invalid Instance:", __func__);
  192. QDF_BUG(0);
  193. return QDF_STATUS_E_FAILURE;
  194. }
  195. if (!soc->ops->cmn_drv_ops ||
  196. !soc->ops->cmn_drv_ops->txrx_vdev_detach)
  197. return QDF_STATUS_E_FAILURE;
  198. return soc->ops->cmn_drv_ops->txrx_vdev_detach(soc, vdev_id,
  199. callback, cb_context);
  200. }
  201. static inline int
  202. cdp_pdev_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id)
  203. {
  204. if (!soc || !soc->ops) {
  205. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  206. "%s: Invalid Instance:", __func__);
  207. QDF_BUG(0);
  208. return 0;
  209. }
  210. if (!soc->ops->cmn_drv_ops ||
  211. !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
  212. return 0;
  213. return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(soc, pdev_id);
  214. }
  215. static inline struct cdp_pdev *cdp_pdev_attach
  216. (ol_txrx_soc_handle soc, HTC_HANDLE htc_pdev, qdf_device_t osdev,
  217. uint8_t pdev_id)
  218. {
  219. if (!soc || !soc->ops) {
  220. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  221. "%s: Invalid Instance:", __func__);
  222. QDF_BUG(0);
  223. return NULL;
  224. }
  225. if (!soc->ops->cmn_drv_ops ||
  226. !soc->ops->cmn_drv_ops->txrx_pdev_attach)
  227. return NULL;
  228. return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, htc_pdev, osdev,
  229. pdev_id);
  230. }
  231. /**
  232. * cdp_pdev_post_attach() - attach the data SW state
  233. * @soc: datapath soc handle
  234. * @pdev_id: the data physical device id being removed
  235. *
  236. * This function is used when the WLAN driver is being loaded to
  237. * attach the host data component within the driver.
  238. *
  239. * Return: 0 for success or error code
  240. */
  241. static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, uint8_t pdev_id)
  242. {
  243. if (!soc || !soc->ops) {
  244. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  245. "%s: Invalid Instance:", __func__);
  246. QDF_BUG(0);
  247. return 0;
  248. }
  249. if (!soc->ops->cmn_drv_ops ||
  250. !soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
  251. return 0;
  252. return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(soc, pdev_id);
  253. }
  254. /**
  255. * cdp_pdev_pre_detach() - detach the data SW state
  256. * @soc: datapath soc handle
  257. * @pdev_id: the data physical device id being removed
  258. * @force: delete the pdev (and its vdevs and peers) even if
  259. * there are outstanding references by the target to the vdevs
  260. * and peers within the pdev
  261. *
  262. * This function is used when the WLAN driver is being removed to
  263. * detach the host data component within the driver.
  264. *
  265. * Return: None
  266. */
  267. static inline void
  268. cdp_pdev_pre_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  269. {
  270. if (!soc || !soc->ops) {
  271. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  272. "%s: Invalid Instance:", __func__);
  273. QDF_BUG(0);
  274. return;
  275. }
  276. if (!soc->ops->cmn_drv_ops ||
  277. !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
  278. return;
  279. soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(soc, pdev_id, force);
  280. }
  281. static inline QDF_STATUS
  282. cdp_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  283. {
  284. if (!soc || !soc->ops) {
  285. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  286. "%s: Invalid Instance:", __func__);
  287. QDF_BUG(0);
  288. return QDF_STATUS_E_FAILURE;
  289. }
  290. if (!soc->ops->cmn_drv_ops ||
  291. !soc->ops->cmn_drv_ops->txrx_pdev_detach)
  292. return QDF_STATUS_E_FAILURE;
  293. return soc->ops->cmn_drv_ops->txrx_pdev_detach(soc, pdev_id, force);
  294. }
  295. static inline void
  296. cdp_pdev_deinit(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
  297. {
  298. if (!soc || !soc->ops) {
  299. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  300. "%s: Invalid Instance:", __func__);
  301. QDF_BUG(0);
  302. return;
  303. }
  304. if (!soc->ops->cmn_drv_ops ||
  305. !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
  306. return;
  307. soc->ops->cmn_drv_ops->txrx_pdev_deinit(soc, pdev_id, force);
  308. }
  309. static inline void *cdp_peer_create
  310. (ol_txrx_soc_handle soc, uint8_t vdev_id,
  311. uint8_t *peer_mac_addr)
  312. {
  313. if (!soc || !soc->ops) {
  314. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  315. "%s: Invalid Instance:", __func__);
  316. QDF_BUG(0);
  317. return NULL;
  318. }
  319. if (!soc->ops->cmn_drv_ops ||
  320. !soc->ops->cmn_drv_ops->txrx_peer_create)
  321. return NULL;
  322. return soc->ops->cmn_drv_ops->txrx_peer_create(soc, vdev_id,
  323. peer_mac_addr);
  324. }
  325. static inline void cdp_peer_setup
  326. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
  327. {
  328. if (!soc || !soc->ops) {
  329. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  330. "%s: Invalid Instance:", __func__);
  331. QDF_BUG(0);
  332. return;
  333. }
  334. if (!soc->ops->cmn_drv_ops ||
  335. !soc->ops->cmn_drv_ops->txrx_peer_setup)
  336. return;
  337. soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
  338. peer_mac);
  339. }
  340. /*
  341. * cdp_cp_peer_del_response - Call the peer delete response handler
  342. * @soc: Datapath SOC handle
  343. * @vdev_id: id of virtual device object
  344. * @peer_mac_addr: Mac address of the peer
  345. *
  346. * Return: void
  347. */
  348. static inline QDF_STATUS cdp_cp_peer_del_response
  349. (ol_txrx_soc_handle soc,
  350. uint8_t vdev_id,
  351. uint8_t *peer_mac_addr)
  352. {
  353. if (!soc || !soc->ops) {
  354. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  355. "%s: Invalid Instance:", __func__);
  356. QDF_BUG(0);
  357. return QDF_STATUS_E_FAILURE;
  358. }
  359. if (!soc->ops->cmn_drv_ops ||
  360. !soc->ops->cmn_drv_ops->txrx_cp_peer_del_response)
  361. return QDF_STATUS_E_FAILURE;
  362. return soc->ops->cmn_drv_ops->txrx_cp_peer_del_response(soc,
  363. vdev_id,
  364. peer_mac_addr);
  365. }
  366. /**
  367. * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table
  368. * and return ast entry information
  369. * of first ast entry found in the
  370. * table with given mac address
  371. *
  372. * @soc - data path soc handle
  373. * @ast_mac_addr - AST entry mac address
  374. * @ast_entry_info - ast entry information
  375. *
  376. * return - true if ast entry found with ast_mac_addr
  377. * false if ast entry not found
  378. */
  379. static inline bool cdp_peer_get_ast_info_by_soc
  380. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  381. struct cdp_ast_entry_info *ast_entry_info)
  382. {
  383. if (!soc || !soc->ops) {
  384. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  385. "%s: Invalid Instance:", __func__);
  386. QDF_BUG(0);
  387. return false;
  388. }
  389. if (!soc->ops->cmn_drv_ops ||
  390. !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc)
  391. return false;
  392. return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc
  393. (soc, ast_mac_addr,
  394. ast_entry_info);
  395. }
  396. /**
  397. * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table
  398. * and return ast entry information
  399. * if mac address and pdev_id matches
  400. *
  401. * @soc - data path soc handle
  402. * @ast_mac_addr - AST entry mac address
  403. * @pdev_id - pdev_id
  404. * @ast_entry_info - ast entry information
  405. *
  406. * return - true if ast entry found with ast_mac_addr
  407. * false if ast entry not found
  408. */
  409. static inline bool cdp_peer_get_ast_info_by_pdev
  410. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  411. uint8_t pdev_id,
  412. struct cdp_ast_entry_info *ast_entry_info)
  413. {
  414. if (!soc || !soc->ops) {
  415. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  416. "%s: Invalid Instance:", __func__);
  417. QDF_BUG(0);
  418. return false;
  419. }
  420. if (!soc->ops->cmn_drv_ops ||
  421. !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev)
  422. return false;
  423. return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev
  424. (soc,
  425. ast_mac_addr,
  426. pdev_id,
  427. ast_entry_info);
  428. }
  429. /**
  430. * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table
  431. * with given mac address
  432. *
  433. * @soc - data path soc handle
  434. * @ast_mac_addr - AST entry mac address
  435. * @callback - callback function to called on ast delete response from FW
  436. * @cookie - argument to be passed to callback
  437. *
  438. * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
  439. * is sent
  440. * QDF_STATUS_E_INVAL false if ast entry not found
  441. */
  442. static inline QDF_STATUS cdp_peer_ast_delete_by_soc
  443. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  444. txrx_ast_free_cb callback,
  445. void *cookie)
  446. {
  447. if (!soc || !soc->ops) {
  448. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  449. "%s: Invalid Instance:", __func__);
  450. QDF_BUG(0);
  451. return QDF_STATUS_E_INVAL;
  452. }
  453. if (!soc->ops->cmn_drv_ops ||
  454. !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc)
  455. return QDF_STATUS_E_INVAL;
  456. return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc
  457. (soc,
  458. ast_mac_addr,
  459. callback,
  460. cookie);
  461. }
  462. /**
  463. * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table
  464. * if mac address and pdev_id matches
  465. *
  466. * @soc - data path soc handle
  467. * @ast_mac_addr - AST entry mac address
  468. * @pdev_id - pdev id
  469. * @callback - callback function to called on ast delete response from FW
  470. * @cookie - argument to be passed to callback
  471. *
  472. * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
  473. * is sent
  474. * QDF_STATUS_E_INVAL false if ast entry not found
  475. */
  476. static inline QDF_STATUS cdp_peer_ast_delete_by_pdev
  477. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  478. uint8_t pdev_id, txrx_ast_free_cb callback,
  479. void *cookie)
  480. {
  481. if (!soc || !soc->ops) {
  482. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  483. "%s: Invalid Instance:", __func__);
  484. QDF_BUG(0);
  485. return QDF_STATUS_E_INVAL;
  486. }
  487. if (!soc->ops->cmn_drv_ops ||
  488. !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev)
  489. return QDF_STATUS_E_INVAL;
  490. return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev
  491. (soc,
  492. ast_mac_addr,
  493. pdev_id,
  494. callback,
  495. cookie);
  496. }
  497. static inline int cdp_peer_add_ast
  498. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  499. uint8_t *mac_addr,
  500. enum cdp_txrx_ast_entry_type type, uint32_t flags)
  501. {
  502. if (!soc || !soc->ops) {
  503. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  504. "%s: Invalid Instance:", __func__);
  505. QDF_BUG(0);
  506. return 0;
  507. }
  508. if (!soc->ops->cmn_drv_ops ||
  509. !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
  510. return 0;
  511. return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
  512. vdev_id,
  513. peer_mac,
  514. mac_addr,
  515. type,
  516. flags);
  517. }
  518. static inline QDF_STATUS cdp_peer_reset_ast
  519. (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr,
  520. uint8_t vdev_id)
  521. {
  522. if (!soc || !soc->ops) {
  523. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  524. "%s: Invalid Instance:", __func__);
  525. QDF_BUG(0);
  526. return QDF_STATUS_E_FAILURE;
  527. }
  528. if (!soc->ops->cmn_drv_ops ||
  529. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
  530. return QDF_STATUS_E_FAILURE;
  531. return soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr,
  532. peer_macaddr, vdev_id);
  533. }
  534. static inline QDF_STATUS cdp_peer_reset_ast_table
  535. (ol_txrx_soc_handle soc, uint8_t vdev_id)
  536. {
  537. if (!soc || !soc->ops) {
  538. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  539. "%s: Invalid Instance:", __func__);
  540. QDF_BUG(0);
  541. return QDF_STATUS_E_FAILURE;
  542. }
  543. if (!soc->ops->cmn_drv_ops ||
  544. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
  545. return QDF_STATUS_E_FAILURE;
  546. return soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_id);
  547. }
  548. static inline void cdp_peer_flush_ast_table
  549. (ol_txrx_soc_handle soc)
  550. {
  551. if (!soc || !soc->ops) {
  552. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  553. "%s: Invalid Instance:", __func__);
  554. QDF_BUG(0);
  555. return;
  556. }
  557. if (!soc->ops->cmn_drv_ops ||
  558. !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
  559. return;
  560. soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
  561. }
  562. static inline int cdp_peer_update_ast
  563. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  564. uint8_t *wds_macaddr, uint32_t flags)
  565. {
  566. if (!soc || !soc->ops) {
  567. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  568. "%s: Invalid Instance:", __func__);
  569. QDF_BUG(0);
  570. return 0;
  571. }
  572. if (!soc->ops->cmn_drv_ops ||
  573. !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
  574. return 0;
  575. return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
  576. vdev_id,
  577. peer_mac,
  578. wds_macaddr,
  579. flags);
  580. }
  581. static inline void cdp_peer_teardown
  582. (ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
  583. {
  584. if (!soc || !soc->ops) {
  585. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  586. "%s: Invalid Instance:", __func__);
  587. QDF_BUG(0);
  588. return;
  589. }
  590. if (!soc->ops->cmn_drv_ops ||
  591. !soc->ops->cmn_drv_ops->txrx_peer_teardown)
  592. return;
  593. soc->ops->cmn_drv_ops->txrx_peer_teardown(soc, vdev_id, peer_mac);
  594. }
  595. static inline void
  596. cdp_peer_delete(ol_txrx_soc_handle soc, uint8_t vdev_id,
  597. uint8_t *peer_mac, uint32_t bitmap)
  598. {
  599. if (!soc || !soc->ops) {
  600. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  601. "%s: Invalid Instance:", __func__);
  602. QDF_BUG(0);
  603. return;
  604. }
  605. if (!soc->ops->cmn_drv_ops ||
  606. !soc->ops->cmn_drv_ops->txrx_peer_delete)
  607. return;
  608. soc->ops->cmn_drv_ops->txrx_peer_delete(soc, vdev_id, peer_mac, bitmap);
  609. }
  610. /**
  611. * cdp_peer_detach_sync() - peer detach sync callback
  612. * @soc: datapath soc handle
  613. * @vdev_id: virtual device/interface id
  614. * @peer_mac: peer mac address
  615. * @peer_unmap_sync: peer unmap sync cb.
  616. * @bitmap: bitmap indicating special handling of request.
  617. *
  618. * Return: None
  619. */
  620. static inline void
  621. cdp_peer_delete_sync(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  622. QDF_STATUS(*delete_cb)(
  623. uint8_t vdev_id,
  624. uint32_t peerid_cnt,
  625. uint16_t *peerid_list),
  626. uint32_t bitmap)
  627. {
  628. if (!soc || !soc->ops) {
  629. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  630. "%s: Invalid Instance:", __func__);
  631. QDF_BUG(0);
  632. return;
  633. }
  634. if (!soc->ops->cmn_drv_ops ||
  635. !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
  636. return;
  637. soc->ops->cmn_drv_ops->txrx_peer_delete_sync(soc, vdev_id, peer_mac,
  638. delete_cb,
  639. bitmap);
  640. }
  641. static inline int
  642. cdp_set_monitor_mode(ol_txrx_soc_handle soc, uint8_t vdev_id,
  643. uint8_t smart_monitor)
  644. {
  645. if (!soc || !soc->ops) {
  646. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  647. "%s: Invalid Instance:", __func__);
  648. QDF_BUG(0);
  649. return 0;
  650. }
  651. if (!soc->ops->cmn_drv_ops ||
  652. !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
  653. return 0;
  654. return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(soc, vdev_id,
  655. smart_monitor);
  656. }
  657. static inline QDF_STATUS
  658. cdp_set_curchan(ol_txrx_soc_handle soc,
  659. uint8_t pdev_id,
  660. uint32_t chan_mhz)
  661. {
  662. if (!soc || !soc->ops) {
  663. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  664. "%s: Invalid Instance:", __func__);
  665. QDF_BUG(0);
  666. return QDF_STATUS_E_FAILURE;
  667. }
  668. if (!soc->ops->cmn_drv_ops ||
  669. !soc->ops->cmn_drv_ops->txrx_set_curchan)
  670. return QDF_STATUS_E_FAILURE;
  671. return soc->ops->cmn_drv_ops->txrx_set_curchan(soc, pdev_id, chan_mhz);
  672. }
  673. static inline QDF_STATUS
  674. cdp_set_privacy_filters(ol_txrx_soc_handle soc, uint8_t vdev_id,
  675. void *filter, uint32_t num)
  676. {
  677. if (!soc || !soc->ops) {
  678. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  679. "%s: Invalid Instance:", __func__);
  680. QDF_BUG(0);
  681. return QDF_STATUS_E_FAILURE;
  682. }
  683. if (!soc->ops->cmn_drv_ops ||
  684. !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
  685. return QDF_STATUS_E_FAILURE;
  686. return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(soc, vdev_id,
  687. filter, num);
  688. }
  689. static inline int
  690. cdp_set_monitor_filter(ol_txrx_soc_handle soc, uint8_t pdev_id,
  691. struct cdp_monitor_filter *filter_val)
  692. {
  693. if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
  694. return soc->ops->mon_ops->txrx_set_advance_monitor_filter(soc,
  695. pdev_id,
  696. filter_val);
  697. return 0;
  698. }
  699. /******************************************************************************
  700. * Data Interface (B Interface)
  701. *****************************************************************************/
  702. static inline void
  703. cdp_vdev_register(ol_txrx_soc_handle soc, uint8_t vdev_id,
  704. ol_osif_vdev_handle osif_vdev,
  705. struct ol_txrx_ops *txrx_ops)
  706. {
  707. if (!soc || !soc->ops) {
  708. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  709. "%s: Invalid Instance:", __func__);
  710. QDF_BUG(0);
  711. return;
  712. }
  713. if (!soc->ops->cmn_drv_ops ||
  714. !soc->ops->cmn_drv_ops->txrx_vdev_register)
  715. return;
  716. soc->ops->cmn_drv_ops->txrx_vdev_register(soc, vdev_id,
  717. osif_vdev, txrx_ops);
  718. }
  719. static inline int
  720. cdp_mgmt_send(ol_txrx_soc_handle soc, uint8_t vdev_id,
  721. qdf_nbuf_t tx_mgmt_frm, uint8_t type)
  722. {
  723. if (!soc || !soc->ops) {
  724. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  725. "%s: Invalid Instance:", __func__);
  726. QDF_BUG(0);
  727. return 0;
  728. }
  729. if (!soc->ops->cmn_drv_ops ||
  730. !soc->ops->cmn_drv_ops->txrx_mgmt_send)
  731. return 0;
  732. return soc->ops->cmn_drv_ops->txrx_mgmt_send(soc, vdev_id,
  733. tx_mgmt_frm, type);
  734. }
  735. static inline int
  736. cdp_mgmt_send_ext(ol_txrx_soc_handle soc, uint8_t vdev_id,
  737. qdf_nbuf_t tx_mgmt_frm, uint8_t type,
  738. uint8_t use_6mbps, uint16_t chanfreq)
  739. {
  740. if (!soc || !soc->ops) {
  741. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  742. "%s: Invalid Instance:", __func__);
  743. QDF_BUG(0);
  744. return 0;
  745. }
  746. if (!soc->ops->cmn_drv_ops ||
  747. !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
  748. return 0;
  749. return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
  750. (soc, vdev_id, tx_mgmt_frm, type, use_6mbps, chanfreq);
  751. }
  752. static inline QDF_STATUS
  753. cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, uint8_t pdev_id,
  754. uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
  755. ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
  756. {
  757. if (!soc || !soc->ops) {
  758. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  759. "%s: Invalid Instance:", __func__);
  760. QDF_BUG(0);
  761. return QDF_STATUS_E_FAILURE;
  762. }
  763. if (!soc->ops->cmn_drv_ops ||
  764. !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
  765. return QDF_STATUS_E_FAILURE;
  766. return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
  767. (soc, pdev_id, type, download_cb, ota_ack_cb, ctxt);
  768. }
  769. /**
  770. * cdp_peer_unmap_sync_cb_set() - set peer unmap sync callback
  771. * @soc: datapath soc handle
  772. * @pdev_id: physical device instance id
  773. * @peer_unmap_sync: peer unmap sync callback
  774. *
  775. * Return: None
  776. */
  777. static inline void
  778. cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,
  779. uint8_t pdev_id,
  780. QDF_STATUS(*unmap_resp_cb)(
  781. uint8_t vdev_id,
  782. uint32_t peerid_cnt,
  783. uint16_t *peerid_list))
  784. {
  785. if (!soc || !soc->ops) {
  786. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  787. "%s: Invalid Instance:", __func__);
  788. QDF_BUG(0);
  789. return;
  790. }
  791. if (!soc->ops->cmn_drv_ops ||
  792. !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set)
  793. return;
  794. soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(soc, pdev_id,
  795. unmap_resp_cb);
  796. }
  797. /*
  798. * cdp_data_tx_cb_set(): set the callback for non standard tx
  799. * @soc - datapath soc handle
  800. * @vdev_id - virtual device/interface id
  801. * @callback - callback function
  802. * @ctxt: callback context
  803. *
  804. */
  805. static inline void
  806. cdp_data_tx_cb_set(ol_txrx_soc_handle soc, uint8_t vdev_id,
  807. ol_txrx_data_tx_cb callback, void *ctxt)
  808. {
  809. if (!soc || !soc->ops) {
  810. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  811. "%s: Invalid Instance:", __func__);
  812. QDF_BUG(0);
  813. return;
  814. }
  815. if (!soc->ops->cmn_drv_ops ||
  816. !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
  817. return;
  818. soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(soc, vdev_id,
  819. callback, ctxt);
  820. }
  821. /******************************************************************************
  822. * Statistics and Debugging Interface (C Interface)
  823. *****************************************************************************/
  824. /**
  825. * External Device physical address types
  826. *
  827. * Currently, both MAC and IPA uController use the same size addresses
  828. * and descriptors are exchanged between these two depending on the mode.
  829. *
  830. * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
  831. * operations. However, external device physical address sizes
  832. * may be different from host-specific physical address sizes.
  833. * This calls for the following definitions for target devices
  834. * (MAC, IPA uc).
  835. */
  836. #if HTT_PADDR64
  837. typedef uint64_t target_paddr_t;
  838. #else
  839. typedef uint32_t target_paddr_t;
  840. #endif /*HTT_PADDR64 */
  841. static inline int
  842. cdp_aggr_cfg(ol_txrx_soc_handle soc, uint8_t vdev_id,
  843. int max_subfrms_ampdu,
  844. int max_subfrms_amsdu)
  845. {
  846. if (!soc || !soc->ops) {
  847. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  848. "%s: Invalid Instance:", __func__);
  849. QDF_BUG(0);
  850. return 0;
  851. }
  852. if (!soc->ops->cmn_drv_ops ||
  853. !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
  854. return 0;
  855. return soc->ops->cmn_drv_ops->txrx_aggr_cfg(soc, vdev_id,
  856. max_subfrms_ampdu, max_subfrms_amsdu);
  857. }
  858. static inline int
  859. cdp_fw_stats_get(ol_txrx_soc_handle soc, uint8_t vdev_id,
  860. struct ol_txrx_stats_req *req, bool per_vdev,
  861. bool response_expected)
  862. {
  863. if (!soc || !soc->ops) {
  864. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  865. "%s: Invalid Instance:", __func__);
  866. QDF_BUG(0);
  867. return 0;
  868. }
  869. if (!soc->ops->cmn_drv_ops ||
  870. !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
  871. return 0;
  872. return soc->ops->cmn_drv_ops->txrx_fw_stats_get(soc, vdev_id, req,
  873. per_vdev, response_expected);
  874. }
  875. static inline int
  876. cdp_debug(ol_txrx_soc_handle soc, uint8_t vdev_id, int debug_specs)
  877. {
  878. if (!soc || !soc->ops) {
  879. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  880. "%s: Invalid Instance:", __func__);
  881. QDF_BUG(0);
  882. return 0;
  883. }
  884. if (!soc->ops->cmn_drv_ops ||
  885. !soc->ops->cmn_drv_ops->txrx_debug)
  886. return 0;
  887. return soc->ops->cmn_drv_ops->txrx_debug(soc, vdev_id, debug_specs);
  888. }
  889. static inline QDF_STATUS
  890. cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
  891. uint8_t vdev_id, uint8_t cfg_stats_type, uint32_t cfg_val)
  892. {
  893. if (!soc || !soc->ops) {
  894. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  895. "%s: Invalid Instance:", __func__);
  896. QDF_BUG(0);
  897. return QDF_STATUS_E_FAILURE;
  898. }
  899. if (!soc->ops->cmn_drv_ops ||
  900. !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
  901. return QDF_STATUS_E_FAILURE;
  902. return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(soc, vdev_id,
  903. cfg_stats_type, cfg_val);
  904. }
  905. static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
  906. {
  907. if (!soc || !soc->ops) {
  908. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  909. "%s: Invalid Instance:", __func__);
  910. QDF_BUG(0);
  911. return;
  912. }
  913. if (!soc->ops->cmn_drv_ops ||
  914. !soc->ops->cmn_drv_ops->txrx_print_level_set)
  915. return;
  916. soc->ops->cmn_drv_ops->txrx_print_level_set(level);
  917. }
  918. /*
  919. * cdp_get_vdev_mac_addr() – Detach txrx peer
  920. * @soc_hdl: Datapath soc handle
  921. * @vdev_id: virtual device/interface id
  922. *
  923. * Return: MAC address on success, NULL on failure.
  924. *
  925. */
  926. static inline uint8_t *
  927. cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, uint8_t vdev_id)
  928. {
  929. if (!soc || !soc->ops) {
  930. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  931. "%s: Invalid Instance:", __func__);
  932. QDF_BUG(0);
  933. return NULL;
  934. }
  935. if (!soc->ops->cmn_drv_ops ||
  936. !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
  937. return NULL;
  938. return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(soc, vdev_id);
  939. }
  940. /**
  941. * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
  942. * @soc: ol_txrx_soc_handle handle
  943. * @vdev_id: vdev id for which os rx handles are needed
  944. * @stack_fn_p: pointer to stack function pointer
  945. * @osif_handle_p: pointer to ol_osif_vdev_handle
  946. *
  947. * Return: void
  948. */
  949. static inline
  950. void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
  951. uint8_t vdev_id,
  952. ol_txrx_rx_fp *stack_fn_p,
  953. ol_osif_vdev_handle *osif_handle_p)
  954. {
  955. if (!soc || !soc->ops) {
  956. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  957. "%s: Invalid Instance:", __func__);
  958. QDF_BUG(0);
  959. return;
  960. }
  961. if (!soc->ops->cmn_drv_ops ||
  962. !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
  963. return;
  964. soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(soc, vdev_id,
  965. stack_fn_p,
  966. osif_handle_p);
  967. }
  968. /**
  969. * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
  970. * @soc: datapath soc handle
  971. * @vdev_id: virtual device/interface id
  972. *
  973. * Return: Handle to control pdev
  974. */
  975. static inline struct cdp_cfg *
  976. cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id)
  977. {
  978. if (!soc || !soc->ops) {
  979. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  980. "%s: Invalid Instance:", __func__);
  981. QDF_BUG(0);
  982. return NULL;
  983. }
  984. if (!soc->ops->cmn_drv_ops ||
  985. !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
  986. return NULL;
  987. return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev(soc,
  988. vdev_id);
  989. }
  990. /*
  991. * cdp_get_mon_vdev_from_pdev() - Get vdev handle of monitor mode
  992. * @soc: datapath soc handle
  993. * @pdev_id: physical device instance id
  994. *
  995. * Return: virtual interface id
  996. */
  997. static inline uint8_t
  998. cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, uint8_t pdev_id)
  999. {
  1000. if (!soc || !soc->ops) {
  1001. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1002. "%s: Invalid Instance:", __func__);
  1003. QDF_BUG(0);
  1004. return -EINVAL;
  1005. }
  1006. if (!soc->ops->cmn_drv_ops ||
  1007. !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
  1008. return -EINVAL;
  1009. return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev(soc, pdev_id);
  1010. }
  1011. static inline void
  1012. cdp_soc_detach(ol_txrx_soc_handle soc)
  1013. {
  1014. if (!soc || !soc->ops) {
  1015. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1016. "%s: Invalid Instance:", __func__);
  1017. QDF_BUG(0);
  1018. return;
  1019. }
  1020. if (!soc->ops->cmn_drv_ops ||
  1021. !soc->ops->cmn_drv_ops->txrx_soc_detach)
  1022. return;
  1023. soc->ops->cmn_drv_ops->txrx_soc_detach(soc);
  1024. }
  1025. /**
  1026. * cdp_soc_init() - Initialize txrx SOC
  1027. * @soc: ol_txrx_soc_handle handle
  1028. * @devid: Device ID
  1029. * @hif_handle: Opaque HIF handle
  1030. * @psoc: Opaque Objmgr handle
  1031. * @htc_handle: Opaque HTC handle
  1032. * @qdf_dev: QDF device
  1033. * @dp_ol_if_ops: Offload Operations
  1034. *
  1035. * Return: DP SOC handle on success, NULL on failure
  1036. */
  1037. static inline ol_txrx_soc_handle
  1038. cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid,
  1039. void *hif_handle,
  1040. struct cdp_ctrl_objmgr_psoc *psoc,
  1041. HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
  1042. struct ol_if_ops *dp_ol_if_ops)
  1043. {
  1044. if (!soc || !soc->ops) {
  1045. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1046. "%s: Invalid Instance:", __func__);
  1047. QDF_BUG(0);
  1048. return NULL;
  1049. }
  1050. if (!soc->ops->cmn_drv_ops ||
  1051. !soc->ops->cmn_drv_ops->txrx_soc_init)
  1052. return NULL;
  1053. return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
  1054. hif_handle,
  1055. htc_handle, qdf_dev,
  1056. dp_ol_if_ops, devid);
  1057. }
  1058. /**
  1059. * cdp_soc_deinit() - Deinitialize txrx SOC
  1060. * @soc: Opaque DP SOC handle
  1061. *
  1062. * Return: None
  1063. */
  1064. static inline void
  1065. cdp_soc_deinit(ol_txrx_soc_handle soc)
  1066. {
  1067. if (!soc || !soc->ops) {
  1068. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1069. "%s: Invalid Instance:", __func__);
  1070. QDF_BUG(0);
  1071. return;
  1072. }
  1073. if (!soc->ops->cmn_drv_ops ||
  1074. !soc->ops->cmn_drv_ops->txrx_soc_deinit)
  1075. return;
  1076. soc->ops->cmn_drv_ops->txrx_soc_deinit(soc);
  1077. }
  1078. /**
  1079. * cdp_tso_soc_attach() - TSO attach function
  1080. * @soc: ol_txrx_soc_handle handle
  1081. *
  1082. * Reserve TSO descriptor buffers
  1083. *
  1084. * Return: QDF_STATUS_SUCCESS on Success or
  1085. * QDF_STATUS_E_FAILURE on failure
  1086. */
  1087. static inline QDF_STATUS
  1088. cdp_tso_soc_attach(ol_txrx_soc_handle soc)
  1089. {
  1090. if (!soc || !soc->ops) {
  1091. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1092. "%s: Invalid Instance:", __func__);
  1093. QDF_BUG(0);
  1094. return 0;
  1095. }
  1096. if (!soc->ops->cmn_drv_ops ||
  1097. !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
  1098. return 0;
  1099. return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc);
  1100. }
  1101. /**
  1102. * cdp_tso_soc_detach() - TSO detach function
  1103. * @soc: ol_txrx_soc_handle handle
  1104. *
  1105. * Release TSO descriptor buffers
  1106. *
  1107. * Return: QDF_STATUS_SUCCESS on Success or
  1108. * QDF_STATUS_E_FAILURE on failure
  1109. */
  1110. static inline QDF_STATUS
  1111. cdp_tso_soc_detach(ol_txrx_soc_handle soc)
  1112. {
  1113. if (!soc || !soc->ops) {
  1114. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1115. "%s: Invalid Instance:", __func__);
  1116. QDF_BUG(0);
  1117. return 0;
  1118. }
  1119. if (!soc->ops->cmn_drv_ops ||
  1120. !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
  1121. return 0;
  1122. return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc);
  1123. }
  1124. /**
  1125. * cdp_addba_resp_tx_completion() - Indicate addba response tx
  1126. * completion to dp to change tid state.
  1127. * @soc: soc handle
  1128. * @peer_mac: mac address of peer handle
  1129. * @vdev_id: id of vdev handle
  1130. * @tid: tid
  1131. * @status: Tx completion status
  1132. *
  1133. * Return: success/failure of tid update
  1134. */
  1135. static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
  1136. uint8_t *peer_mac,
  1137. uint16_t vdev_id,
  1138. uint8_t tid, int status)
  1139. {
  1140. if (!soc || !soc->ops) {
  1141. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1142. "%s: Invalid Instance:", __func__);
  1143. QDF_BUG(0);
  1144. return 0;
  1145. }
  1146. if (!soc->ops->cmn_drv_ops ||
  1147. !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
  1148. return 0;
  1149. return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac,
  1150. vdev_id, tid, status);
  1151. }
  1152. static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
  1153. uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid,
  1154. uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
  1155. {
  1156. if (!soc || !soc->ops) {
  1157. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1158. "%s: Invalid Instance:", __func__);
  1159. QDF_BUG(0);
  1160. return 0;
  1161. }
  1162. if (!soc->ops->cmn_drv_ops ||
  1163. !soc->ops->cmn_drv_ops->addba_requestprocess)
  1164. return 0;
  1165. return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac,
  1166. vdev_id, dialogtoken, tid, batimeout, buffersize,
  1167. startseqnum);
  1168. }
  1169. static inline QDF_STATUS
  1170. cdp_addba_responsesetup(ol_txrx_soc_handle soc,
  1171. uint8_t *peer_mac, uint16_t vdev_id,
  1172. uint8_t tid, uint8_t *dialogtoken,
  1173. uint16_t *statuscode, uint16_t *buffersize,
  1174. uint16_t *batimeout)
  1175. {
  1176. if (!soc || !soc->ops) {
  1177. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1178. "%s: Invalid Instance:", __func__);
  1179. QDF_BUG(0);
  1180. return QDF_STATUS_E_FAILURE;
  1181. }
  1182. if (!soc->ops->cmn_drv_ops ||
  1183. !soc->ops->cmn_drv_ops->addba_responsesetup)
  1184. return QDF_STATUS_E_FAILURE;
  1185. return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac,
  1186. vdev_id, tid, dialogtoken, statuscode, buffersize,
  1187. batimeout);
  1188. }
  1189. static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac,
  1190. uint16_t vdev_id, int tid,
  1191. uint16_t reasoncode)
  1192. {
  1193. if (!soc || !soc->ops) {
  1194. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1195. "%s: Invalid Instance:", __func__);
  1196. QDF_BUG(0);
  1197. return 0;
  1198. }
  1199. if (!soc->ops->cmn_drv_ops ||
  1200. !soc->ops->cmn_drv_ops->delba_process)
  1201. return 0;
  1202. return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac,
  1203. vdev_id, tid, reasoncode);
  1204. }
  1205. /**
  1206. * cdp_delba_tx_completion() - Handle delba tx completion
  1207. * to update stats and retry transmission if failed.
  1208. * @soc: soc handle
  1209. * @peer_mac: peer mac address
  1210. * @vdev_id: id of vdev handle
  1211. * @tid: Tid number
  1212. * @status: Tx completion status
  1213. *
  1214. * Return: 0 on Success, 1 on failure
  1215. */
  1216. static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
  1217. uint8_t *peer_mac,
  1218. uint16_t vdev_id,
  1219. uint8_t tid, int status)
  1220. {
  1221. if (!soc || !soc->ops) {
  1222. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1223. "%s: Invalid Instance:", __func__);
  1224. QDF_BUG(0);
  1225. return 0;
  1226. }
  1227. if (!soc->ops->cmn_drv_ops ||
  1228. !soc->ops->cmn_drv_ops->delba_tx_completion)
  1229. return 0;
  1230. return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac,
  1231. vdev_id,
  1232. tid, status);
  1233. }
  1234. static inline QDF_STATUS
  1235. cdp_set_addbaresponse(ol_txrx_soc_handle soc,
  1236. uint8_t *peer_mac, uint16_t vdev_id, int tid,
  1237. uint16_t statuscode)
  1238. {
  1239. if (!soc || !soc->ops) {
  1240. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1241. "%s: Invalid Instance:", __func__);
  1242. QDF_BUG(0);
  1243. return QDF_STATUS_E_FAILURE;
  1244. }
  1245. if (!soc->ops->cmn_drv_ops ||
  1246. !soc->ops->cmn_drv_ops->set_addba_response)
  1247. return QDF_STATUS_E_FAILURE;
  1248. return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id,
  1249. tid, statuscode);
  1250. }
  1251. /**
  1252. * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
  1253. * @soc : soc handle
  1254. * @vdev_id: id of vdev handle
  1255. * @map_id: id of the tid map
  1256. *
  1257. * Return: QDF_STATUS
  1258. */
  1259. static inline QDF_STATUS
  1260. cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1261. uint8_t vdev_id, uint8_t map_id)
  1262. {
  1263. if (!soc || !soc->ops) {
  1264. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1265. "%s: Invalid Instance:", __func__);
  1266. QDF_BUG(0);
  1267. return QDF_STATUS_E_FAILURE;
  1268. }
  1269. if (!soc->ops->cmn_drv_ops ||
  1270. !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
  1271. return QDF_STATUS_E_FAILURE;
  1272. return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id,
  1273. map_id);
  1274. }
  1275. #ifdef QCA_MULTIPASS_SUPPORT
  1276. /**
  1277. * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap
  1278. * @soc : soc handle
  1279. * @vdev_id: id of vdev handle
  1280. * @vlan_id: vlan id
  1281. * @group_key: corresponding group key to vlan ID
  1282. *
  1283. * Return: void
  1284. */
  1285. static inline
  1286. QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1287. uint16_t vlan_id, uint16_t group_key)
  1288. {
  1289. if (!soc || !soc->ops) {
  1290. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1291. "%s: Invalid Instance:", __func__);
  1292. QDF_BUG(0);
  1293. return 0;
  1294. }
  1295. if (!soc->ops->cmn_drv_ops ||
  1296. !soc->ops->cmn_drv_ops->set_vlan_groupkey)
  1297. return 0;
  1298. return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id,
  1299. group_key);
  1300. }
  1301. #endif
  1302. /**
  1303. * cdp_ath_get_total_per(): function to get hw retries
  1304. * @soc : soc handle
  1305. * @pdev_id: id of pdev handle
  1306. *
  1307. * Return: get hw retries
  1308. */
  1309. static inline
  1310. int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id)
  1311. {
  1312. if (!soc || !soc->ops) {
  1313. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1314. "%s: Invalid Instance:", __func__);
  1315. QDF_BUG(0);
  1316. return 0;
  1317. }
  1318. if (!soc->ops->cmn_drv_ops ||
  1319. !soc->ops->cmn_drv_ops->txrx_get_total_per)
  1320. return 0;
  1321. return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id);
  1322. }
  1323. /**
  1324. * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
  1325. * @pdev_id: id of pdev handle
  1326. * @map_id: id of the tid map
  1327. * @tos: index value in map that needs to be changed
  1328. * @tid: tid value passed by user
  1329. *
  1330. * Return: void
  1331. */
  1332. static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1333. uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid)
  1334. {
  1335. if (!soc || !soc->ops) {
  1336. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1337. "%s: Invalid Instance:", __func__);
  1338. QDF_BUG(0);
  1339. return;
  1340. }
  1341. if (!soc->ops->cmn_drv_ops ||
  1342. !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
  1343. return;
  1344. soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id,
  1345. map_id, tos, tid);
  1346. }
  1347. /**
  1348. * cdp_flush_cache_rx_queue() - flush cache rx queue frame
  1349. *
  1350. * Return: None
  1351. */
  1352. static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
  1353. {
  1354. if (!soc || !soc->ops) {
  1355. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1356. "%s: Invalid Instance:", __func__);
  1357. QDF_BUG(0);
  1358. return;
  1359. }
  1360. if (!soc->ops->cmn_drv_ops ||
  1361. !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
  1362. return;
  1363. soc->ops->cmn_drv_ops->flush_cache_rx_queue();
  1364. }
  1365. /**
  1366. * cdp_txrx_stats_request(): function to map to host and firmware statistics
  1367. * @soc: soc handle
  1368. * @vdev_id: virtual device ID
  1369. * @req: stats request container
  1370. *
  1371. * return: status
  1372. */
  1373. static inline
  1374. int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1375. struct cdp_txrx_stats_req *req)
  1376. {
  1377. if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
  1378. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1379. "%s: Invalid Instance:", __func__);
  1380. QDF_ASSERT(0);
  1381. return 0;
  1382. }
  1383. if (soc->ops->cmn_drv_ops->txrx_stats_request)
  1384. return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id,
  1385. req);
  1386. return 0;
  1387. }
  1388. /**
  1389. * cdp_txrx_intr_attach(): function to attach and configure interrupt
  1390. * @soc: soc handle
  1391. */
  1392. static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
  1393. {
  1394. if (!soc || !soc->ops) {
  1395. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1396. "%s: Invalid Instance:", __func__);
  1397. QDF_BUG(0);
  1398. return 0;
  1399. }
  1400. if (!soc->ops->cmn_drv_ops ||
  1401. !soc->ops->cmn_drv_ops->txrx_intr_attach)
  1402. return 0;
  1403. return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
  1404. }
  1405. /**
  1406. * cdp_txrx_intr_detach(): function to detach interrupt
  1407. * @soc: soc handle
  1408. */
  1409. static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
  1410. {
  1411. if (!soc || !soc->ops) {
  1412. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1413. "%s: Invalid Instance:", __func__);
  1414. QDF_BUG(0);
  1415. return;
  1416. }
  1417. if (!soc->ops->cmn_drv_ops ||
  1418. !soc->ops->cmn_drv_ops->txrx_intr_detach)
  1419. return;
  1420. soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
  1421. }
  1422. /**
  1423. * cdp_display_stats(): function to map to dump stats
  1424. * @soc: soc handle
  1425. * @value: statistics option
  1426. */
  1427. static inline QDF_STATUS
  1428. cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
  1429. enum qdf_stats_verbosity_level level)
  1430. {
  1431. if (!soc || !soc->ops) {
  1432. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1433. "%s: Invalid Instance:", __func__);
  1434. QDF_BUG(0);
  1435. return 0;
  1436. }
  1437. if (!soc->ops->cmn_drv_ops ||
  1438. !soc->ops->cmn_drv_ops->display_stats)
  1439. return 0;
  1440. return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
  1441. }
  1442. /**
  1443. * cdp_set_pn_check(): function to set pn check
  1444. * @soc: soc handle
  1445. * @vdev_id: id of virtual device
  1446. * @peer_mac: mac address of peer
  1447. * @sec_type: security type
  1448. * @rx_pn: receive pn
  1449. */
  1450. static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
  1451. uint8_t vdev_id, uint8_t *peer_mac,
  1452. enum cdp_sec_type sec_type, uint32_t *rx_pn)
  1453. {
  1454. if (!soc || !soc->ops) {
  1455. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1456. "%s: Invalid Instance:", __func__);
  1457. QDF_BUG(0);
  1458. return 0;
  1459. }
  1460. if (!soc->ops->cmn_drv_ops ||
  1461. !soc->ops->cmn_drv_ops->set_pn_check)
  1462. return 0;
  1463. soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac,
  1464. sec_type, rx_pn);
  1465. return 0;
  1466. }
  1467. static inline QDF_STATUS
  1468. cdp_set_key(ol_txrx_soc_handle soc,
  1469. uint8_t vdev_id,
  1470. uint8_t *mac,
  1471. bool is_unicast, uint32_t *key)
  1472. {
  1473. if (!soc || !soc->ops) {
  1474. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1475. "%s: Invalid Instance:", __func__);
  1476. QDF_BUG(0);
  1477. return QDF_STATUS_E_FAILURE;
  1478. }
  1479. if (!soc->ops->ctrl_ops ||
  1480. !soc->ops->ctrl_ops->set_key)
  1481. return QDF_STATUS_E_FAILURE;
  1482. return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
  1483. is_unicast, key);
  1484. }
  1485. /**
  1486. * cdp_update_config_parameters(): function to propagate configuration
  1487. * parameters to datapath
  1488. * @soc: opaque soc handle
  1489. * @cfg: configuration handle
  1490. *
  1491. * Return: status: 0 - Success, non-zero: Failure
  1492. */
  1493. static inline
  1494. QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
  1495. struct cdp_config_params *cfg)
  1496. {
  1497. struct cdp_soc *psoc = (struct cdp_soc *)soc;
  1498. if (!soc || !soc->ops) {
  1499. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1500. "%s: Invalid Instance:", __func__);
  1501. QDF_BUG(0);
  1502. return 0;
  1503. }
  1504. if (!soc->ops->cmn_drv_ops ||
  1505. !soc->ops->cmn_drv_ops->update_config_parameters)
  1506. return QDF_STATUS_SUCCESS;
  1507. return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
  1508. cfg);
  1509. }
  1510. /**
  1511. * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
  1512. * @soc: opaque soc handle
  1513. * @pdev_id: id of data path pdev handle
  1514. *
  1515. * Return: opaque dp handle
  1516. */
  1517. static inline void *
  1518. cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id)
  1519. {
  1520. if (!soc || !soc->ops) {
  1521. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1522. "%s: Invalid Instance:", __func__);
  1523. QDF_BUG(0);
  1524. return 0;
  1525. }
  1526. if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
  1527. return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id);
  1528. return 0;
  1529. }
  1530. /**
  1531. * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
  1532. * @soc: opaque soc handle
  1533. * @pdev_id: id of data path pdev handle
  1534. * @dp_hdl: opaque pointer for dp_txrx_handle
  1535. *
  1536. * Return: void
  1537. */
  1538. static inline void
  1539. cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1540. void *dp_hdl)
  1541. {
  1542. if (!soc || !soc->ops) {
  1543. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1544. "%s: Invalid Instance:", __func__);
  1545. QDF_BUG(0);
  1546. return;
  1547. }
  1548. if (!soc->ops->cmn_drv_ops ||
  1549. !soc->ops->cmn_drv_ops->set_dp_txrx_handle)
  1550. return;
  1551. soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl);
  1552. }
  1553. /**
  1554. * cdp_vdev_get_dp_ext_txrx_handle() - get extended dp handle from vdev
  1555. * @soc: opaque soc handle
  1556. * @vdev_id: vdev id
  1557. *
  1558. * Return: opaque dp handle
  1559. */
  1560. static inline void *
  1561. cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id)
  1562. {
  1563. if (!soc || !soc->ops) {
  1564. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1565. "%s: Invalid Instance:", __func__);
  1566. QDF_BUG(0);
  1567. return 0;
  1568. }
  1569. if (soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle)
  1570. return soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle(
  1571. soc, vdev_id);
  1572. return 0;
  1573. }
  1574. /**
  1575. * cdp_vdev_set_dp_ext_txrx_handle() - set extended dp handle in vdev
  1576. * @soc: opaque soc handle
  1577. * @vdev_id: vdev id
  1578. * @size: size of the advance dp handle
  1579. *
  1580. * Return: QDF_STATUS
  1581. */
  1582. static inline QDF_STATUS
  1583. cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1584. uint16_t size)
  1585. {
  1586. if (!soc || !soc->ops) {
  1587. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1588. "%s: Invalid Instance:", __func__);
  1589. QDF_BUG(0);
  1590. return QDF_STATUS_E_FAILURE;
  1591. }
  1592. if (!soc->ops->cmn_drv_ops ||
  1593. !soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle)
  1594. return QDF_STATUS_E_FAILURE;
  1595. return soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle(soc,
  1596. vdev_id,
  1597. size);
  1598. }
  1599. /*
  1600. * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
  1601. * @soc: opaque soc handle
  1602. *
  1603. * Return: opaque extended dp handle
  1604. */
  1605. static inline void *
  1606. cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
  1607. {
  1608. if (!soc || !soc->ops) {
  1609. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1610. "%s: Invalid Instance:", __func__);
  1611. QDF_BUG(0);
  1612. return NULL;
  1613. }
  1614. if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
  1615. return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
  1616. (struct cdp_soc *) soc);
  1617. return NULL;
  1618. }
  1619. /**
  1620. * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
  1621. * @soc: opaque soc handle
  1622. * @dp_hdl: opaque pointer for dp_txrx_handle
  1623. *
  1624. * Return: void
  1625. */
  1626. static inline void
  1627. cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
  1628. {
  1629. if (!soc || !soc->ops) {
  1630. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1631. "%s: Invalid Instance:", __func__);
  1632. QDF_BUG(0);
  1633. return;
  1634. }
  1635. if (!soc->ops->cmn_drv_ops ||
  1636. !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
  1637. return;
  1638. soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
  1639. dp_handle);
  1640. }
  1641. /**
  1642. * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping
  1643. * @soc: opaque soc handle
  1644. * @pdev_id: id of data path pdev handle
  1645. * @lmac_id: lmac id
  1646. * @mode_change: flag to indicate mode change (true) or init (false)
  1647. * Return: QDF_STATUS
  1648. */
  1649. static inline QDF_STATUS
  1650. cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1651. uint32_t lmac_id, bool mode_change)
  1652. {
  1653. if (!soc || !soc->ops) {
  1654. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1655. "%s: Invalid Instance:", __func__);
  1656. QDF_BUG(0);
  1657. return QDF_STATUS_E_FAILURE;
  1658. }
  1659. if (!soc->ops->cmn_drv_ops ||
  1660. !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
  1661. return QDF_STATUS_E_FAILURE;
  1662. return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id,
  1663. lmac_id, mode_change);
  1664. }
  1665. /**
  1666. * cdp_txrx_set_pdev_status_down() - set pdev down/up status
  1667. * @soc: soc opaque handle
  1668. * @pdev_id: id of data path pdev handle
  1669. * @is_pdev_down: pdev down/up status
  1670. *
  1671. * return: QDF_STATUS
  1672. */
  1673. static inline QDF_STATUS
  1674. cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,
  1675. uint8_t pdev_id,
  1676. bool is_pdev_down)
  1677. {
  1678. if (!soc || !soc->ops) {
  1679. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1680. "%s: Invalid Instance:", __func__);
  1681. QDF_BUG(0);
  1682. return QDF_STATUS_E_FAILURE;
  1683. }
  1684. if (!soc->ops->cmn_drv_ops ||
  1685. !soc->ops->cmn_drv_ops->set_pdev_status_down)
  1686. return QDF_STATUS_E_FAILURE;
  1687. return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id,
  1688. is_pdev_down);
  1689. }
  1690. /**
  1691. * cdp_tx_send() - enqueue frame for transmission
  1692. * @soc: soc opaque handle
  1693. * @vdev_id: id of VAP device
  1694. * @nbuf: nbuf to be enqueued
  1695. *
  1696. * This API is used by Extended Datapath modules to enqueue frame for
  1697. * transmission
  1698. *
  1699. * Return: void
  1700. */
  1701. static inline void
  1702. cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf)
  1703. {
  1704. if (!soc || !soc->ops) {
  1705. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1706. "%s: Invalid Instance:", __func__);
  1707. QDF_BUG(0);
  1708. return;
  1709. }
  1710. if (!soc->ops->cmn_drv_ops ||
  1711. !soc->ops->cmn_drv_ops->tx_send)
  1712. return;
  1713. soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf);
  1714. }
  1715. /**
  1716. * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
  1717. * @soc: opaque soc handle
  1718. * @pdev_id: id of data path pdev handle
  1719. * @pcp: pcp value
  1720. * @tid: tid value
  1721. *
  1722. * This API is used to configure the pcp-to-tid mapping for a pdev.
  1723. *
  1724. * Return: QDF_STATUS_SUCCESS if value set successfully
  1725. * QDF_STATUS_E_INVAL false if error
  1726. */
  1727. static inline
  1728. QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
  1729. uint8_t pdev_id,
  1730. uint32_t pcp, uint32_t tid)
  1731. {
  1732. if (!soc || !soc->ops) {
  1733. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1734. "%s: Invalid Instance", __func__);
  1735. return QDF_STATUS_E_INVAL;
  1736. }
  1737. if (!soc->ops->cmn_drv_ops ||
  1738. !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
  1739. return QDF_STATUS_E_INVAL;
  1740. return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id,
  1741. pcp, tid);
  1742. }
  1743. /**
  1744. * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
  1745. * @soc: opaque soc handle
  1746. * @pdev_id: id of data path pdev handle
  1747. * @peer_id: data path peer id
  1748. * @peer_mac: peer_mac
  1749. *
  1750. * Return: QDF_STATUS
  1751. */
  1752. static inline
  1753. QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
  1754. uint32_t peer_id, uint8_t *peer_mac)
  1755. {
  1756. if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
  1757. return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
  1758. soc, peer_id, peer_mac);
  1759. return QDF_STATUS_E_INVAL;
  1760. }
  1761. /**
  1762. * cdp_vdev_tx_lock() - acquire lock
  1763. * @soc: opaque soc handle
  1764. * @vdev: data path vdev handle
  1765. *
  1766. * Return: void
  1767. */
  1768. static inline
  1769. void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
  1770. uint8_t vdev_id)
  1771. {
  1772. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
  1773. soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id);
  1774. }
  1775. /**
  1776. * cdp_vdev_tx_unlock() - release lock
  1777. * @soc: opaque soc handle
  1778. * @vdev_id: id of data path vdev handle
  1779. *
  1780. * Return: void
  1781. */
  1782. static inline
  1783. void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
  1784. uint8_t vdev_id)
  1785. {
  1786. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
  1787. soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id);
  1788. }
  1789. /**
  1790. * cdp_ath_getstats() - get updated athstats
  1791. * @soc: opaque soc handle
  1792. * @id: vdev_id/pdev_id based on type
  1793. * @stats: cdp network device stats structure
  1794. * @type: device type pdev/vdev
  1795. *
  1796. * Return: QDF_STATUS
  1797. */
  1798. static inline QDF_STATUS
  1799. cdp_ath_getstats(ol_txrx_soc_handle soc,
  1800. uint8_t id, struct cdp_dev_stats *stats,
  1801. uint8_t type)
  1802. {
  1803. if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
  1804. return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id,
  1805. stats, type);
  1806. return QDF_STATUS_E_FAILURE;
  1807. }
  1808. /**
  1809. * cdp_set_gid_flag() - set groupid flag
  1810. * @soc: opaque soc handle
  1811. * @pdev_id: id of data path pdev handle
  1812. * @mem_status: member status from grp management frame
  1813. * @user_position: user position from grp management frame
  1814. *
  1815. * Return: QDF_STATUS
  1816. */
  1817. static inline QDF_STATUS
  1818. cdp_set_gid_flag(ol_txrx_soc_handle soc,
  1819. uint8_t pdev_id, u_int8_t *mem_status,
  1820. u_int8_t *user_position)
  1821. {
  1822. if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
  1823. return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id,
  1824. mem_status,
  1825. user_position);
  1826. return QDF_STATUS_E_FAILURE;
  1827. }
  1828. /**
  1829. * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
  1830. * @soc: opaque soc handle
  1831. * @pdev_id: id of data path pdev handle
  1832. *
  1833. */
  1834. static inline
  1835. uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
  1836. uint8_t pdev_id)
  1837. {
  1838. if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
  1839. return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id);
  1840. return 0;
  1841. }
  1842. /**
  1843. * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
  1844. * @soc: opaque soc handle
  1845. * @vdev_id: id of vdev device
  1846. * @force: number of frame in SW queue
  1847. * Return: void
  1848. */
  1849. static inline
  1850. void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
  1851. uint8_t vdev_id, int force)
  1852. {
  1853. if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
  1854. soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force);
  1855. }
  1856. /* cdp_peer_map_attach() - CDP API to allocate PEER map memory
  1857. * @soc: opaque soc handle
  1858. * @max_peers: number of peers created in FW
  1859. * @max_ast_index: max number of AST index supported in FW
  1860. * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
  1861. *
  1862. *
  1863. * Return: QDF_STATUS
  1864. */
  1865. static inline QDF_STATUS
  1866. cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
  1867. uint32_t max_ast_index, bool peer_map_unmap_v2)
  1868. {
  1869. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1870. soc->ops->cmn_drv_ops->txrx_peer_map_attach)
  1871. return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
  1872. max_peers,
  1873. max_ast_index,
  1874. peer_map_unmap_v2);
  1875. return QDF_STATUS_SUCCESS;
  1876. }
  1877. /* cdp_txrx_classify_and_update() - To classify the packet and update stats
  1878. * @soc: opaque soc handle
  1879. * @vdev: opaque dp vdev handle
  1880. * @skb: data
  1881. * @dir: rx or tx packet
  1882. * @nbuf_classify: packet classification object
  1883. *
  1884. * Return: 1 on success else return 0
  1885. */
  1886. static inline int
  1887. cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
  1888. uint8_t vdev_id, qdf_nbuf_t skb,
  1889. enum txrx_direction dir,
  1890. struct ol_txrx_nbuf_classify *nbuf_class)
  1891. {
  1892. if (!soc || !soc->ops) {
  1893. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1894. "%s: Invalid Instance", __func__);
  1895. QDF_BUG(0);
  1896. return 0;
  1897. }
  1898. if (!soc->ops->cmn_drv_ops ||
  1899. !soc->ops->cmn_drv_ops->txrx_classify_update)
  1900. return 0;
  1901. return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id,
  1902. skb,
  1903. dir, nbuf_class);
  1904. }
  1905. /**
  1906. * cdp_get_dp_capabilities() - get DP capabilities
  1907. * @soc: opaque soc handle
  1908. * @dp_cap: enum of DP capabilities
  1909. *
  1910. * Return: bool
  1911. */
  1912. static inline bool
  1913. cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
  1914. {
  1915. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1916. soc->ops->cmn_drv_ops->get_dp_capabilities)
  1917. return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
  1918. return false;
  1919. }
  1920. #ifdef RECEIVE_OFFLOAD
  1921. /**
  1922. * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
  1923. * @soc - data path soc handle
  1924. * @pdev - device instance pointer
  1925. *
  1926. * register rx offload flush callback function pointer
  1927. *
  1928. * return none
  1929. */
  1930. static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
  1931. void (rx_ol_flush_cb)(void *))
  1932. {
  1933. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  1934. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1935. "%s invalid instance", __func__);
  1936. return;
  1937. }
  1938. if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
  1939. return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
  1940. rx_ol_flush_cb);
  1941. }
  1942. /**
  1943. * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
  1944. * @soc - data path soc handle
  1945. *
  1946. * deregister rx offload flush callback function pointer
  1947. *
  1948. * return none
  1949. */
  1950. static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
  1951. {
  1952. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  1953. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1954. "%s invalid instance", __func__);
  1955. return;
  1956. }
  1957. if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
  1958. return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
  1959. }
  1960. #endif /* RECEIVE_OFFLOAD */
  1961. /**
  1962. * @cdp_set_ba_timeout() - set ba aging timeout per AC
  1963. *
  1964. * @soc - pointer to the soc
  1965. * @value - timeout value in millisec
  1966. * @ac - Access category
  1967. *
  1968. * @return - void
  1969. */
  1970. static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
  1971. uint8_t ac, uint32_t value)
  1972. {
  1973. if (!soc || !soc->ops) {
  1974. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1975. "%s: Invalid Instance", __func__);
  1976. QDF_BUG(0);
  1977. return;
  1978. }
  1979. if (!soc->ops->cmn_drv_ops ||
  1980. !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
  1981. return;
  1982. soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
  1983. }
  1984. /**
  1985. * @cdp_get_ba_timeout() - return ba aging timeout per AC
  1986. *
  1987. * @soc - pointer to the soc
  1988. * @ac - access category
  1989. * @value - timeout value in millisec
  1990. *
  1991. * @return - void
  1992. */
  1993. static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
  1994. uint8_t ac, uint32_t *value)
  1995. {
  1996. if (!soc || !soc->ops) {
  1997. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1998. "%s: Invalid Instance", __func__);
  1999. QDF_BUG(0);
  2000. return;
  2001. }
  2002. if (!soc->ops->cmn_drv_ops ||
  2003. !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
  2004. return;
  2005. soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
  2006. }
  2007. /**
  2008. * cdp_cfg_get() - get cfg for dp enum
  2009. *
  2010. * @soc: pointer to the soc
  2011. * @cfg: cfg enum
  2012. *
  2013. * Return - cfg value
  2014. */
  2015. static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
  2016. {
  2017. if (!soc || !soc->ops) {
  2018. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2019. "%s: Invalid Instance", __func__);
  2020. return 0;
  2021. }
  2022. if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
  2023. return 0;
  2024. return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
  2025. }
  2026. /**
  2027. * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
  2028. * @soc: opaque soc handle
  2029. * @ctx: rate stats context
  2030. *
  2031. * Return: void
  2032. */
  2033. static inline void
  2034. cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,
  2035. void *ctx)
  2036. {
  2037. if (!soc || !soc->ops) {
  2038. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2039. "%s: Invalid Instance:", __func__);
  2040. QDF_BUG(0);
  2041. return;
  2042. }
  2043. if (!soc->ops->cmn_drv_ops ||
  2044. !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
  2045. return;
  2046. soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
  2047. ctx);
  2048. }
  2049. /**
  2050. * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
  2051. * @soc: opaque soc handle
  2052. *
  2053. * Return: void
  2054. */
  2055. static inline void*
  2056. cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
  2057. {
  2058. if (!soc || !soc->ops) {
  2059. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2060. "%s: Invalid Instance:", __func__);
  2061. QDF_BUG(0);
  2062. return NULL;
  2063. }
  2064. if (!soc->ops->cmn_drv_ops ||
  2065. !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
  2066. return NULL;
  2067. return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
  2068. }
  2069. /**
  2070. * cdp_peer_flush_rate_stats() - flush peer rate statistics
  2071. * @soc: opaque soc handle
  2072. * @pdev_id: id of pdev handle
  2073. * @buf: stats buffer
  2074. */
  2075. static inline void
  2076. cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  2077. void *buf)
  2078. {
  2079. if (!soc || !soc->ops) {
  2080. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2081. "%s: Invalid Instance:", __func__);
  2082. QDF_BUG(0);
  2083. return;
  2084. }
  2085. if (!soc->ops->cmn_drv_ops ||
  2086. !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
  2087. return;
  2088. soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf);
  2089. }
  2090. /**
  2091. * cdp_flush_rate_stats_request() - request flush rate statistics
  2092. * @soc: opaque soc handle
  2093. * @pdev_id: id of pdev handle
  2094. */
  2095. static inline QDF_STATUS
  2096. cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id)
  2097. {
  2098. if (!soc || !soc->ops) {
  2099. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2100. "%s: Invalid Instance:", __func__);
  2101. QDF_BUG(0);
  2102. return QDF_STATUS_E_FAILURE;
  2103. }
  2104. if (!soc->ops->cmn_drv_ops ||
  2105. !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
  2106. return QDF_STATUS_E_FAILURE;
  2107. return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc,
  2108. pdev_id);
  2109. }
  2110. /**
  2111. * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
  2112. * @soc: opaque soc handle
  2113. * @vdev: id of data path vdev handle
  2114. * @pcp: pcp value
  2115. * @tid: tid value
  2116. *
  2117. * This API is used to configure the pcp-to-tid mapping for a pdev.
  2118. *
  2119. * Return: QDF_STATUS_SUCCESS if value set successfully
  2120. * QDF_STATUS_E_INVAL false if error
  2121. */
  2122. static inline
  2123. QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
  2124. uint8_t vdev_id,
  2125. uint8_t pcp, uint8_t tid)
  2126. {
  2127. if (!soc || !soc->ops) {
  2128. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2129. "%s: Invalid Instance", __func__);
  2130. return QDF_STATUS_E_INVAL;
  2131. }
  2132. if (!soc->ops->cmn_drv_ops ||
  2133. !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
  2134. return QDF_STATUS_E_INVAL;
  2135. return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id,
  2136. pcp, tid);
  2137. }
  2138. /**
  2139. * cdp_tx_send_exc() - Transmit a frame on a given vdev in exception path
  2140. *
  2141. * @soc: opaque soc handle
  2142. * @vdev_id: vdev id
  2143. * @nbuf: skb
  2144. * @tx_exc_metadata: Handle that holds exception path meta data
  2145. *
  2146. * Return: NULL on success
  2147. * nbuf when it fails to send
  2148. */
  2149. static inline qdf_nbuf_t
  2150. cdp_tx_send_exc(ol_txrx_soc_handle soc,
  2151. uint8_t vdev_id,
  2152. qdf_nbuf_t nbuf,
  2153. struct cdp_tx_exception_metadata *tx_exc_metadata)
  2154. {
  2155. if (!soc || !soc->ops) {
  2156. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2157. "%s: Invalid Instance", __func__);
  2158. QDF_BUG(0);
  2159. return 0;
  2160. }
  2161. if (!soc->ops->cmn_drv_ops ||
  2162. !soc->ops->cmn_drv_ops->tx_send_exc)
  2163. return 0;
  2164. return soc->ops->cmn_drv_ops->tx_send_exc
  2165. (soc, vdev_id, nbuf, tx_exc_metadata);
  2166. }
  2167. /**
  2168. * cdp_vdev_get_peer_mac_list(): function to get peer mac list of vdev
  2169. * @soc: Datapath soc handle
  2170. * @vdev_id: vdev id
  2171. * @newmac: Table of the clients mac
  2172. * @mac_cnt: No. of MACs required
  2173. *
  2174. * return: no of clients
  2175. */
  2176. static inline uint16_t
  2177. cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,
  2178. uint8_t vdev_id,
  2179. uint8_t newmac[][QDF_MAC_ADDR_SIZE],
  2180. uint16_t mac_cnt)
  2181. {
  2182. if (!soc || !soc->ops) {
  2183. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  2184. "%s: Invalid Instance", __func__);
  2185. QDF_BUG(0);
  2186. return 0;
  2187. }
  2188. if (!soc->ops->cmn_drv_ops ||
  2189. !soc->ops->cmn_drv_ops->get_peer_mac_list)
  2190. return 0;
  2191. return soc->ops->cmn_drv_ops->get_peer_mac_list
  2192. (soc, vdev_id, newmac, mac_cnt);
  2193. }
  2194. #endif /* _CDP_TXRX_CMN_H_ */