cdp_txrx_cmn.h 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297
  1. /*
  2. * Copyright (c) 2011-2018 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. /******************************************************************************
  31. *
  32. * Common Data Path Header File
  33. *
  34. *****************************************************************************/
  35. #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
  36. #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
  37. #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
  38. #define dp_info(params...) \
  39. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
  40. #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
  41. #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
  42. #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
  43. #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
  44. #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
  45. #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
  46. static inline QDF_STATUS
  47. cdp_soc_attach_target(ol_txrx_soc_handle soc)
  48. {
  49. if (!soc || !soc->ops) {
  50. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  51. "%s: Invalid Instance:", __func__);
  52. QDF_BUG(0);
  53. return QDF_STATUS_E_INVAL;
  54. }
  55. if (!soc->ops->cmn_drv_ops ||
  56. !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
  57. return QDF_STATUS_SUCCESS;
  58. return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
  59. }
  60. static inline int
  61. cdp_soc_get_nss_cfg(ol_txrx_soc_handle soc)
  62. {
  63. if (!soc || !soc->ops) {
  64. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  65. "%s: Invalid Instance:", __func__);
  66. QDF_BUG(0);
  67. return 0;
  68. }
  69. if (!soc->ops->cmn_drv_ops ||
  70. !soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg)
  71. return 0;
  72. return soc->ops->cmn_drv_ops->txrx_soc_get_nss_cfg(soc);
  73. }
  74. static inline void
  75. cdp_soc_set_nss_cfg(ol_txrx_soc_handle soc, uint32_t config)
  76. {
  77. if (!soc || !soc->ops) {
  78. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  79. "%s: Invalid Instance:", __func__);
  80. QDF_BUG(0);
  81. return;
  82. }
  83. if (!soc->ops->cmn_drv_ops ||
  84. !soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg)
  85. return;
  86. soc->ops->cmn_drv_ops->txrx_soc_set_nss_cfg(soc, config);
  87. }
  88. static inline struct cdp_vdev *
  89. cdp_vdev_attach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  90. uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode)
  91. {
  92. if (!soc || !soc->ops) {
  93. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  94. "%s: Invalid Instance:", __func__);
  95. QDF_BUG(0);
  96. return NULL;
  97. }
  98. if (!soc->ops->cmn_drv_ops ||
  99. !soc->ops->cmn_drv_ops->txrx_vdev_attach)
  100. return NULL;
  101. return soc->ops->cmn_drv_ops->txrx_vdev_attach(pdev,
  102. vdev_mac_addr, vdev_id, op_mode);
  103. }
  104. #ifndef CONFIG_WIN
  105. /**
  106. * cdp_flow_pool_map() - Create flow pool for vdev
  107. * @soc - data path soc handle
  108. * @pdev
  109. * @vdev_id - vdev_id corresponding to vdev start
  110. *
  111. * Create per vdev flow pool.
  112. *
  113. * return none
  114. */
  115. static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
  116. struct cdp_pdev *pdev, uint8_t vdev_id)
  117. {
  118. if (!soc || !soc->ops) {
  119. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  120. "%s: Invalid Instance:", __func__);
  121. QDF_BUG(0);
  122. return QDF_STATUS_E_INVAL;
  123. }
  124. if (!soc->ops->flowctl_ops ||
  125. !soc->ops->flowctl_ops->flow_pool_map_handler)
  126. return QDF_STATUS_E_INVAL;
  127. return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev, vdev_id);
  128. }
  129. /**
  130. * cdp_flow_pool_unmap() - Delete flow pool
  131. * @soc - data path soc handle
  132. * @pdev
  133. * @vdev_id - vdev_id corresponding to vdev start
  134. *
  135. * Delete flow pool
  136. *
  137. * return none
  138. */
  139. static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
  140. struct cdp_pdev *pdev, uint8_t vdev_id)
  141. {
  142. if (!soc || !soc->ops) {
  143. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  144. "%s: Invalid Instance:", __func__);
  145. QDF_BUG(0);
  146. return;
  147. }
  148. if (!soc->ops->flowctl_ops ||
  149. !soc->ops->flowctl_ops->flow_pool_unmap_handler)
  150. return;
  151. return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev,
  152. vdev_id);
  153. }
  154. #endif
  155. static inline void
  156. cdp_vdev_detach(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  157. ol_txrx_vdev_delete_cb callback, void *cb_context)
  158. {
  159. if (!soc || !soc->ops) {
  160. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  161. "%s: Invalid Instance:", __func__);
  162. QDF_BUG(0);
  163. return;
  164. }
  165. if (!soc->ops->cmn_drv_ops ||
  166. !soc->ops->cmn_drv_ops->txrx_vdev_detach)
  167. return;
  168. soc->ops->cmn_drv_ops->txrx_vdev_detach(vdev,
  169. callback, cb_context);
  170. }
  171. static inline int
  172. cdp_pdev_attach_target(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  173. {
  174. if (!soc || !soc->ops) {
  175. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  176. "%s: Invalid Instance:", __func__);
  177. QDF_BUG(0);
  178. return 0;
  179. }
  180. if (!soc->ops->cmn_drv_ops ||
  181. !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
  182. return 0;
  183. return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(pdev);
  184. }
  185. static inline struct cdp_pdev *cdp_pdev_attach
  186. (ol_txrx_soc_handle soc, struct cdp_ctrl_objmgr_pdev *ctrl_pdev,
  187. HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id)
  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 NULL;
  194. }
  195. if (!soc->ops->cmn_drv_ops ||
  196. !soc->ops->cmn_drv_ops->txrx_pdev_attach)
  197. return NULL;
  198. return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev,
  199. htc_pdev, osdev, pdev_id);
  200. }
  201. static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc,
  202. struct cdp_pdev *pdev)
  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_post_attach)
  212. return 0;
  213. return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(pdev);
  214. }
  215. static inline void
  216. cdp_pdev_pre_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
  217. {
  218. if (!soc || !soc->ops) {
  219. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  220. "%s: Invalid Instance:", __func__);
  221. QDF_BUG(0);
  222. return;
  223. }
  224. if (!soc->ops->cmn_drv_ops ||
  225. !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
  226. return;
  227. soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(pdev, force);
  228. }
  229. static inline void
  230. cdp_pdev_detach(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
  231. {
  232. if (!soc || !soc->ops) {
  233. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  234. "%s: Invalid Instance:", __func__);
  235. QDF_BUG(0);
  236. return;
  237. }
  238. if (!soc->ops->cmn_drv_ops ||
  239. !soc->ops->cmn_drv_ops->txrx_pdev_detach)
  240. return;
  241. soc->ops->cmn_drv_ops->txrx_pdev_detach(pdev, force);
  242. }
  243. static inline void
  244. cdp_pdev_deinit(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int force)
  245. {
  246. if (!soc || !soc->ops) {
  247. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  248. "%s: Invalid Instance:", __func__);
  249. QDF_BUG(0);
  250. return;
  251. }
  252. if (!soc->ops->cmn_drv_ops ||
  253. !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
  254. return;
  255. soc->ops->cmn_drv_ops->txrx_pdev_deinit(pdev, force);
  256. }
  257. static inline void *cdp_peer_create
  258. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  259. uint8_t *peer_mac_addr, struct cdp_ctrl_objmgr_peer *ctrl_peer)
  260. {
  261. if (!soc || !soc->ops) {
  262. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  263. "%s: Invalid Instance:", __func__);
  264. QDF_BUG(0);
  265. return NULL;
  266. }
  267. if (!soc->ops->cmn_drv_ops ||
  268. !soc->ops->cmn_drv_ops->txrx_peer_create)
  269. return NULL;
  270. return soc->ops->cmn_drv_ops->txrx_peer_create(vdev,
  271. peer_mac_addr, ctrl_peer);
  272. }
  273. static inline void cdp_peer_setup
  274. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer)
  275. {
  276. if (!soc || !soc->ops) {
  277. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  278. "%s: Invalid Instance:", __func__);
  279. QDF_BUG(0);
  280. return;
  281. }
  282. if (!soc->ops->cmn_drv_ops ||
  283. !soc->ops->cmn_drv_ops->txrx_peer_setup)
  284. return;
  285. soc->ops->cmn_drv_ops->txrx_peer_setup(vdev,
  286. peer);
  287. }
  288. static inline void *cdp_peer_ast_hash_find_soc
  289. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr)
  290. {
  291. if (!soc || !soc->ops) {
  292. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  293. "%s: Invalid Instance:", __func__);
  294. QDF_BUG(0);
  295. return NULL;
  296. }
  297. if (!soc->ops->cmn_drv_ops ||
  298. !soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find_soc)
  299. return NULL;
  300. return soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find_soc(soc,
  301. ast_mac_addr);
  302. }
  303. static inline void *cdp_peer_ast_hash_find_by_pdevid
  304. (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
  305. uint8_t pdev_id)
  306. {
  307. if (!soc || !soc->ops) {
  308. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  309. "%s: Invalid Instance:", __func__);
  310. QDF_BUG(0);
  311. return NULL;
  312. }
  313. if (!soc->ops->cmn_drv_ops ||
  314. !soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find_by_pdevid)
  315. return NULL;
  316. return soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find_by_pdevid
  317. (soc,
  318. ast_mac_addr,
  319. pdev_id);
  320. }
  321. static inline int cdp_peer_add_ast
  322. (ol_txrx_soc_handle soc, struct cdp_peer *peer_handle,
  323. uint8_t *mac_addr, enum cdp_txrx_ast_entry_type type, uint32_t flags)
  324. {
  325. if (!soc || !soc->ops) {
  326. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  327. "%s: Invalid Instance:", __func__);
  328. QDF_BUG(0);
  329. return 0;
  330. }
  331. if (!soc->ops->cmn_drv_ops ||
  332. !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
  333. return 0;
  334. return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
  335. peer_handle,
  336. mac_addr,
  337. type,
  338. flags);
  339. }
  340. static inline void cdp_peer_reset_ast
  341. (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, void *vdev_hdl)
  342. {
  343. if (!soc || !soc->ops) {
  344. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  345. "%s: Invalid Instance:", __func__);
  346. QDF_BUG(0);
  347. return;
  348. }
  349. if (!soc->ops->cmn_drv_ops ||
  350. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
  351. return;
  352. soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr, vdev_hdl);
  353. }
  354. static inline void cdp_peer_reset_ast_table
  355. (ol_txrx_soc_handle soc, void *vdev_hdl)
  356. {
  357. if (!soc || !soc->ops) {
  358. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  359. "%s: Invalid Instance:", __func__);
  360. QDF_BUG(0);
  361. return;
  362. }
  363. if (!soc->ops->cmn_drv_ops ||
  364. !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
  365. return;
  366. soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_hdl);
  367. }
  368. static inline void cdp_peer_flush_ast_table
  369. (ol_txrx_soc_handle soc)
  370. {
  371. if (!soc || !soc->ops) {
  372. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  373. "%s: Invalid Instance:", __func__);
  374. QDF_BUG(0);
  375. return;
  376. }
  377. if (!soc->ops->cmn_drv_ops ||
  378. !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
  379. return;
  380. soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
  381. }
  382. static inline int cdp_peer_update_ast
  383. (ol_txrx_soc_handle soc, uint8_t *wds_macaddr,
  384. struct cdp_peer *peer_handle, uint32_t flags)
  385. {
  386. if (!soc || !soc->ops) {
  387. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  388. "%s: Invalid Instance:", __func__);
  389. QDF_BUG(0);
  390. return 0;
  391. }
  392. if (!soc->ops->cmn_drv_ops ||
  393. !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
  394. return 0;
  395. return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
  396. peer_handle,
  397. wds_macaddr,
  398. flags);
  399. }
  400. static inline void cdp_peer_del_ast
  401. (ol_txrx_soc_handle soc, void *ast_handle)
  402. {
  403. if (!soc || !soc->ops) {
  404. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  405. "%s: Invalid Instance:", __func__);
  406. QDF_BUG(0);
  407. return;
  408. }
  409. if (!soc->ops->cmn_drv_ops ||
  410. !soc->ops->cmn_drv_ops->txrx_peer_del_ast)
  411. return;
  412. soc->ops->cmn_drv_ops->txrx_peer_del_ast(soc, ast_handle);
  413. }
  414. static inline uint8_t cdp_peer_ast_get_pdev_id
  415. (ol_txrx_soc_handle soc, void *ast_handle)
  416. {
  417. if (!soc || !soc->ops) {
  418. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  419. "%s: Invalid Instance:", __func__);
  420. QDF_BUG(0);
  421. return 0xff;
  422. }
  423. if (!soc->ops->cmn_drv_ops ||
  424. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_pdev_id)
  425. return 0xff;
  426. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_pdev_id(soc,
  427. ast_handle);
  428. }
  429. static inline uint8_t cdp_peer_ast_get_next_hop
  430. (ol_txrx_soc_handle soc, void *ast_handle)
  431. {
  432. if (!soc || !soc->ops) {
  433. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  434. "%s: Invalid Instance:", __func__);
  435. QDF_BUG(0);
  436. return 0xff;
  437. }
  438. if (!soc->ops->cmn_drv_ops ||
  439. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_next_hop)
  440. return 0xff;
  441. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_next_hop(soc,
  442. ast_handle);
  443. }
  444. /**
  445. * cdp_peer_ast_get_type() - Return type (Static, WDS, MEC) of AST entry
  446. * @soc: DP SoC handle
  447. * @ast_handle: Opaque handle to AST entry
  448. *
  449. * Return: AST entry type (Static/WDS/MEC)
  450. */
  451. static inline enum cdp_txrx_ast_entry_type cdp_peer_ast_get_type
  452. (ol_txrx_soc_handle soc, void *ast_handle)
  453. {
  454. if (!soc || !soc->ops) {
  455. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  456. "%s: Invalid Instance:", __func__);
  457. QDF_BUG(0);
  458. return 0;
  459. }
  460. if (!soc->ops->cmn_drv_ops ||
  461. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_type)
  462. return 0;
  463. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_type(soc, ast_handle);
  464. }
  465. static inline void cdp_peer_ast_set_type
  466. (ol_txrx_soc_handle soc, void *ast_handle,
  467. enum cdp_txrx_ast_entry_type type)
  468. {
  469. if (!soc || !soc->ops) {
  470. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  471. "%s: Invalid Instance:", __func__);
  472. QDF_BUG(0);
  473. return;
  474. }
  475. if (!soc->ops->cmn_drv_ops ||
  476. !soc->ops->cmn_drv_ops->txrx_peer_ast_set_type)
  477. return;
  478. soc->ops->cmn_drv_ops->txrx_peer_ast_set_type(soc, ast_handle, type);
  479. }
  480. #if defined(FEATURE_AST) && defined(AST_HKV1_WORKAROUND)
  481. static inline void cdp_peer_ast_set_cp_ctx(struct cdp_soc_t *soc,
  482. void *ast_handle,
  483. void *cp_ctx)
  484. {
  485. if (!soc || !soc->ops) {
  486. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  487. "Invalid Instance:");
  488. QDF_BUG(0);
  489. return;
  490. }
  491. if (!soc->ops->cmn_drv_ops ||
  492. !soc->ops->cmn_drv_ops->txrx_peer_ast_set_cp_ctx)
  493. return;
  494. soc->ops->cmn_drv_ops->txrx_peer_ast_set_cp_ctx(soc, ast_handle,
  495. cp_ctx);
  496. }
  497. static inline void *cdp_peer_ast_get_cp_ctx(struct cdp_soc_t *soc,
  498. void *ast_handle)
  499. {
  500. if (!soc || !soc->ops) {
  501. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  502. "Invalid Instance:");
  503. QDF_BUG(0);
  504. return NULL;
  505. }
  506. if (!soc->ops->cmn_drv_ops ||
  507. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_cp_ctx)
  508. return NULL;
  509. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_cp_ctx(soc, ast_handle);
  510. }
  511. static inline bool cdp_peer_ast_get_wmi_sent(struct cdp_soc_t *soc,
  512. void *ast_handle)
  513. {
  514. if (!soc || !soc->ops) {
  515. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  516. "Invalid Instance:");
  517. QDF_BUG(0);
  518. return false;
  519. }
  520. if (!soc->ops->cmn_drv_ops ||
  521. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_wmi_sent)
  522. return false;
  523. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_wmi_sent(soc,
  524. ast_handle);
  525. }
  526. static inline
  527. void cdp_peer_ast_free_entry(struct cdp_soc_t *soc,
  528. void *ast_handle)
  529. {
  530. if (!soc || !soc->ops) {
  531. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  532. "Invalid Instance:");
  533. QDF_BUG(0);
  534. return;
  535. }
  536. if (!soc->ops->cmn_drv_ops ||
  537. !soc->ops->cmn_drv_ops->txrx_peer_ast_free_entry)
  538. return;
  539. soc->ops->cmn_drv_ops->txrx_peer_ast_free_entry(soc, ast_handle);
  540. }
  541. #endif
  542. static inline struct cdp_peer *cdp_peer_ast_get_peer
  543. (ol_txrx_soc_handle soc, void *ast_handle)
  544. {
  545. if (!soc || !soc->ops) {
  546. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  547. "%s: Invalid Instance:", __func__);
  548. QDF_BUG(0);
  549. return NULL;
  550. }
  551. if (!soc->ops->cmn_drv_ops ||
  552. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_peer)
  553. return NULL;
  554. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_peer(soc, ast_handle);
  555. }
  556. static inline uint32_t cdp_peer_ast_get_nexthop_peer_id
  557. (ol_txrx_soc_handle soc, void *ast_handle)
  558. {
  559. if (!soc || !soc->ops) {
  560. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  561. "%s: Invalid Instance:", __func__);
  562. QDF_BUG(0);
  563. return CDP_INVALID_PEER;
  564. }
  565. if (!soc->ops->cmn_drv_ops ||
  566. !soc->ops->cmn_drv_ops->txrx_peer_ast_get_nexthop_peer_id)
  567. return CDP_INVALID_PEER;
  568. return soc->ops->cmn_drv_ops->txrx_peer_ast_get_nexthop_peer_id
  569. (soc,
  570. ast_handle);
  571. }
  572. static inline void cdp_peer_teardown
  573. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, void *peer)
  574. {
  575. if (!soc || !soc->ops) {
  576. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  577. "%s: Invalid Instance:", __func__);
  578. QDF_BUG(0);
  579. return;
  580. }
  581. if (!soc->ops->cmn_drv_ops ||
  582. !soc->ops->cmn_drv_ops->txrx_peer_teardown)
  583. return;
  584. soc->ops->cmn_drv_ops->txrx_peer_teardown(vdev, peer);
  585. }
  586. static inline void
  587. cdp_peer_delete(ol_txrx_soc_handle soc, void *peer, uint32_t bitmap)
  588. {
  589. if (!soc || !soc->ops) {
  590. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  591. "%s: Invalid Instance:", __func__);
  592. QDF_BUG(0);
  593. return;
  594. }
  595. if (!soc->ops->cmn_drv_ops ||
  596. !soc->ops->cmn_drv_ops->txrx_peer_delete)
  597. return;
  598. soc->ops->cmn_drv_ops->txrx_peer_delete(peer, bitmap);
  599. }
  600. static inline void
  601. cdp_peer_delete_sync(ol_txrx_soc_handle soc, void *peer,
  602. QDF_STATUS(*delete_cb)(
  603. uint8_t vdev_id,
  604. uint32_t peerid_cnt,
  605. uint16_t *peerid_list),
  606. uint32_t bitmap)
  607. {
  608. if (!soc || !soc->ops) {
  609. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  610. "%s: Invalid Instance:", __func__);
  611. QDF_BUG(0);
  612. return;
  613. }
  614. if (!soc->ops->cmn_drv_ops ||
  615. !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
  616. return;
  617. soc->ops->cmn_drv_ops->txrx_peer_delete_sync(peer,
  618. delete_cb,
  619. bitmap);
  620. }
  621. static inline int
  622. cdp_set_monitor_mode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  623. uint8_t smart_monitor)
  624. {
  625. if (!soc || !soc->ops) {
  626. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  627. "%s: Invalid Instance:", __func__);
  628. QDF_BUG(0);
  629. return 0;
  630. }
  631. if (!soc->ops->cmn_drv_ops ||
  632. !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
  633. return 0;
  634. return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(vdev,
  635. smart_monitor);
  636. }
  637. static inline void
  638. cdp_set_curchan(ol_txrx_soc_handle soc,
  639. struct cdp_pdev *pdev,
  640. uint32_t chan_mhz)
  641. {
  642. if (!soc || !soc->ops) {
  643. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  644. "%s: Invalid Instance:", __func__);
  645. QDF_BUG(0);
  646. return;
  647. }
  648. if (!soc->ops->cmn_drv_ops ||
  649. !soc->ops->cmn_drv_ops->txrx_set_curchan)
  650. return;
  651. soc->ops->cmn_drv_ops->txrx_set_curchan(pdev, chan_mhz);
  652. }
  653. static inline void
  654. cdp_set_privacy_filters(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  655. void *filter, uint32_t num)
  656. {
  657. if (!soc || !soc->ops) {
  658. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  659. "%s: Invalid Instance:", __func__);
  660. QDF_BUG(0);
  661. return;
  662. }
  663. if (!soc->ops->cmn_drv_ops ||
  664. !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
  665. return;
  666. soc->ops->cmn_drv_ops->txrx_set_privacy_filters(vdev,
  667. filter, num);
  668. }
  669. static inline int
  670. cdp_set_monitor_filter(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  671. struct cdp_monitor_filter *filter_val)
  672. {
  673. if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
  674. return soc->ops->mon_ops->txrx_set_advance_monitor_filter(pdev,
  675. filter_val);
  676. return 0;
  677. }
  678. /******************************************************************************
  679. * Data Interface (B Interface)
  680. *****************************************************************************/
  681. static inline void
  682. cdp_vdev_register(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  683. void *osif_vdev, struct cdp_ctrl_objmgr_vdev *ctrl_vdev,
  684. struct ol_txrx_ops *txrx_ops)
  685. {
  686. if (!soc || !soc->ops) {
  687. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  688. "%s: Invalid Instance:", __func__);
  689. QDF_BUG(0);
  690. return;
  691. }
  692. if (!soc->ops->cmn_drv_ops ||
  693. !soc->ops->cmn_drv_ops->txrx_vdev_register)
  694. return;
  695. soc->ops->cmn_drv_ops->txrx_vdev_register(vdev,
  696. osif_vdev, ctrl_vdev, txrx_ops);
  697. }
  698. static inline int
  699. cdp_mgmt_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  700. qdf_nbuf_t tx_mgmt_frm, uint8_t type)
  701. {
  702. if (!soc || !soc->ops) {
  703. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  704. "%s: Invalid Instance:", __func__);
  705. QDF_BUG(0);
  706. return 0;
  707. }
  708. if (!soc->ops->cmn_drv_ops ||
  709. !soc->ops->cmn_drv_ops->txrx_mgmt_send)
  710. return 0;
  711. return soc->ops->cmn_drv_ops->txrx_mgmt_send(vdev,
  712. tx_mgmt_frm, type);
  713. }
  714. static inline int
  715. cdp_mgmt_send_ext(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  716. qdf_nbuf_t tx_mgmt_frm, uint8_t type,
  717. uint8_t use_6mbps, uint16_t chanfreq)
  718. {
  719. if (!soc || !soc->ops) {
  720. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  721. "%s: Invalid Instance:", __func__);
  722. QDF_BUG(0);
  723. return 0;
  724. }
  725. if (!soc->ops->cmn_drv_ops ||
  726. !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
  727. return 0;
  728. return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
  729. (vdev, tx_mgmt_frm, type, use_6mbps, chanfreq);
  730. }
  731. static inline void
  732. cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  733. uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
  734. ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
  735. {
  736. if (!soc || !soc->ops) {
  737. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  738. "%s: Invalid Instance:", __func__);
  739. QDF_BUG(0);
  740. return;
  741. }
  742. if (!soc->ops->cmn_drv_ops ||
  743. !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
  744. return;
  745. soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
  746. (pdev, type, download_cb, ota_ack_cb, ctxt);
  747. }
  748. static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc,
  749. struct cdp_pdev *pdev)
  750. {
  751. if (!soc || !soc->ops) {
  752. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  753. "%s: Invalid Instance:", __func__);
  754. QDF_BUG(0);
  755. return 0;
  756. }
  757. if (!soc->ops->cmn_drv_ops ||
  758. !soc->ops->cmn_drv_ops->txrx_get_tx_pending)
  759. return 0;
  760. return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev);
  761. }
  762. static inline void
  763. cdp_data_tx_cb_set(ol_txrx_soc_handle soc, struct cdp_vdev *data_vdev,
  764. ol_txrx_data_tx_cb callback, void *ctxt)
  765. {
  766. if (!soc || !soc->ops) {
  767. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  768. "%s: Invalid Instance:", __func__);
  769. QDF_BUG(0);
  770. return;
  771. }
  772. if (!soc->ops->cmn_drv_ops ||
  773. !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
  774. return;
  775. soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(data_vdev,
  776. callback, ctxt);
  777. }
  778. /******************************************************************************
  779. * Statistics and Debugging Interface (C Interface)
  780. *****************************************************************************/
  781. /**
  782. * External Device physical address types
  783. *
  784. * Currently, both MAC and IPA uController use the same size addresses
  785. * and descriptors are exchanged between these two depending on the mode.
  786. *
  787. * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
  788. * operations. However, external device physical address sizes
  789. * may be different from host-specific physical address sizes.
  790. * This calls for the following definitions for target devices
  791. * (MAC, IPA uc).
  792. */
  793. #if HTT_PADDR64
  794. typedef uint64_t target_paddr_t;
  795. #else
  796. typedef uint32_t target_paddr_t;
  797. #endif /*HTT_PADDR64 */
  798. static inline int
  799. cdp_aggr_cfg(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  800. int max_subfrms_ampdu,
  801. int max_subfrms_amsdu)
  802. {
  803. if (!soc || !soc->ops) {
  804. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  805. "%s: Invalid Instance:", __func__);
  806. QDF_BUG(0);
  807. return 0;
  808. }
  809. if (!soc->ops->cmn_drv_ops ||
  810. !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
  811. return 0;
  812. return soc->ops->cmn_drv_ops->txrx_aggr_cfg(vdev,
  813. max_subfrms_ampdu, max_subfrms_amsdu);
  814. }
  815. static inline int
  816. cdp_fw_stats_get(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  817. struct ol_txrx_stats_req *req, bool per_vdev,
  818. bool response_expected)
  819. {
  820. if (!soc || !soc->ops) {
  821. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  822. "%s: Invalid Instance:", __func__);
  823. QDF_BUG(0);
  824. return 0;
  825. }
  826. if (!soc->ops->cmn_drv_ops ||
  827. !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
  828. return 0;
  829. return soc->ops->cmn_drv_ops->txrx_fw_stats_get(vdev, req,
  830. per_vdev, response_expected);
  831. }
  832. static inline int
  833. cdp_debug(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, int debug_specs)
  834. {
  835. if (!soc || !soc->ops) {
  836. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  837. "%s: Invalid Instance:", __func__);
  838. QDF_BUG(0);
  839. return 0;
  840. }
  841. if (!soc->ops->cmn_drv_ops ||
  842. !soc->ops->cmn_drv_ops->txrx_debug)
  843. return 0;
  844. return soc->ops->cmn_drv_ops->txrx_debug(vdev, debug_specs);
  845. }
  846. static inline void cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
  847. struct cdp_vdev *vdev, uint8_t cfg_stats_type, uint32_t cfg_val)
  848. {
  849. if (!soc || !soc->ops) {
  850. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  851. "%s: Invalid Instance:", __func__);
  852. QDF_BUG(0);
  853. return;
  854. }
  855. if (!soc->ops->cmn_drv_ops ||
  856. !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
  857. return;
  858. soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(vdev,
  859. cfg_stats_type, cfg_val);
  860. }
  861. static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
  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;
  868. }
  869. if (!soc->ops->cmn_drv_ops ||
  870. !soc->ops->cmn_drv_ops->txrx_print_level_set)
  871. return;
  872. soc->ops->cmn_drv_ops->txrx_print_level_set(level);
  873. }
  874. static inline uint8_t *
  875. cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  876. {
  877. if (!soc || !soc->ops) {
  878. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  879. "%s: Invalid Instance:", __func__);
  880. QDF_BUG(0);
  881. return NULL;
  882. }
  883. if (!soc->ops->cmn_drv_ops ||
  884. !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
  885. return NULL;
  886. return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(vdev);
  887. }
  888. /**
  889. * cdp_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of
  890. * vdev
  891. * @vdev: vdev handle
  892. *
  893. * Return: Handle to struct qdf_mac_addr
  894. */
  895. static inline struct qdf_mac_addr *cdp_get_vdev_struct_mac_addr
  896. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  897. {
  898. if (!soc || !soc->ops) {
  899. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  900. "%s: Invalid Instance:", __func__);
  901. QDF_BUG(0);
  902. return NULL;
  903. }
  904. if (!soc->ops->cmn_drv_ops ||
  905. !soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr)
  906. return NULL;
  907. return soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr
  908. (vdev);
  909. }
  910. /**
  911. * cdp_get_pdev_from_vdev() - Return handle to pdev of vdev
  912. * @vdev: vdev handle
  913. *
  914. * Return: Handle to pdev
  915. */
  916. static inline struct cdp_pdev *cdp_get_pdev_from_vdev
  917. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  918. {
  919. if (!soc || !soc->ops) {
  920. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  921. "%s: Invalid Instance:", __func__);
  922. QDF_BUG(0);
  923. return NULL;
  924. }
  925. if (!soc->ops->cmn_drv_ops ||
  926. !soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev)
  927. return NULL;
  928. return soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev(vdev);
  929. }
  930. /**
  931. * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
  932. * @soc: ol_txrx_soc_handle handle
  933. * @vdev: vdev for which os rx handles are needed
  934. * @stack_fn_p: pointer to stack function pointer
  935. * @osif_handle_p: pointer to ol_osif_vdev_handle
  936. *
  937. * Return: void
  938. */
  939. static inline
  940. void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
  941. struct cdp_vdev *vdev,
  942. ol_txrx_rx_fp *stack_fn_p,
  943. ol_osif_vdev_handle *osif_handle_p)
  944. {
  945. if (!soc || !soc->ops) {
  946. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  947. "%s: Invalid Instance:", __func__);
  948. QDF_BUG(0);
  949. return;
  950. }
  951. if (!soc->ops->cmn_drv_ops ||
  952. !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
  953. return;
  954. soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(vdev,
  955. stack_fn_p,
  956. osif_handle_p);
  957. }
  958. /**
  959. * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
  960. * @vdev: vdev handle
  961. *
  962. * Return: Handle to control pdev
  963. */
  964. static inline struct cdp_cfg *
  965. cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  966. {
  967. if (!soc || !soc->ops) {
  968. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  969. "%s: Invalid Instance:", __func__);
  970. QDF_BUG(0);
  971. return NULL;
  972. }
  973. if (!soc->ops->cmn_drv_ops ||
  974. !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
  975. return NULL;
  976. return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev
  977. (vdev);
  978. }
  979. static inline struct cdp_vdev *
  980. cdp_get_vdev_from_vdev_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  981. uint8_t vdev_id)
  982. {
  983. if (!soc || !soc->ops) {
  984. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  985. "%s: Invalid Instance:", __func__);
  986. QDF_BUG(0);
  987. return NULL;
  988. }
  989. if (!soc->ops->cmn_drv_ops ||
  990. !soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id)
  991. return NULL;
  992. return soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id
  993. (pdev, vdev_id);
  994. }
  995. static inline struct cdp_vdev *
  996. cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  997. {
  998. if (!soc || !soc->ops) {
  999. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1000. "%s: Invalid Instance:", __func__);
  1001. QDF_BUG(0);
  1002. return NULL;
  1003. }
  1004. if (!soc->ops->cmn_drv_ops ||
  1005. !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
  1006. return NULL;
  1007. return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev
  1008. (pdev);
  1009. }
  1010. static inline void
  1011. cdp_soc_detach(ol_txrx_soc_handle soc)
  1012. {
  1013. if (!soc || !soc->ops) {
  1014. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1015. "%s: Invalid Instance:", __func__);
  1016. QDF_BUG(0);
  1017. return;
  1018. }
  1019. if (!soc->ops->cmn_drv_ops ||
  1020. !soc->ops->cmn_drv_ops->txrx_soc_detach)
  1021. return;
  1022. soc->ops->cmn_drv_ops->txrx_soc_detach((void *)soc);
  1023. }
  1024. /**
  1025. * cdp_soc_init() - Initialize txrx SOC
  1026. * @soc: ol_txrx_soc_handle handle
  1027. * @devid: Device ID
  1028. * @hif_handle: Opaque HIF handle
  1029. * @psoc: Opaque Objmgr handle
  1030. * @htc_handle: Opaque HTC handle
  1031. * @qdf_dev: QDF device
  1032. * @dp_ol_if_ops: Offload Operations
  1033. *
  1034. * Return: DP SOC handle on success, NULL on failure
  1035. */
  1036. static inline ol_txrx_soc_handle
  1037. cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid, void *hif_handle,
  1038. void *psoc, void *htc_handle, qdf_device_t qdf_dev,
  1039. struct ol_if_ops *dp_ol_if_ops)
  1040. {
  1041. if (!soc || !soc->ops) {
  1042. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1043. "%s: Invalid Instance:", __func__);
  1044. QDF_BUG(0);
  1045. return NULL;
  1046. }
  1047. if (!soc->ops->cmn_drv_ops ||
  1048. !soc->ops->cmn_drv_ops->txrx_soc_init)
  1049. return NULL;
  1050. return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
  1051. hif_handle,
  1052. htc_handle, qdf_dev,
  1053. dp_ol_if_ops, devid);
  1054. }
  1055. /**
  1056. * cdp_soc_deinit() - Deinitialize txrx SOC
  1057. * @soc: Opaque DP SOC handle
  1058. *
  1059. * Return: None
  1060. */
  1061. static inline void
  1062. cdp_soc_deinit(ol_txrx_soc_handle soc)
  1063. {
  1064. if (!soc || !soc->ops) {
  1065. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1066. "%s: Invalid Instance:", __func__);
  1067. QDF_BUG(0);
  1068. return;
  1069. }
  1070. if (!soc->ops->cmn_drv_ops ||
  1071. !soc->ops->cmn_drv_ops->txrx_soc_deinit)
  1072. return;
  1073. soc->ops->cmn_drv_ops->txrx_soc_deinit((void *)soc);
  1074. }
  1075. /**
  1076. * cdp_tso_soc_attach() - TSO attach function
  1077. * @soc: ol_txrx_soc_handle handle
  1078. *
  1079. * Reserve TSO descriptor buffers
  1080. *
  1081. * Return: QDF_STATUS_SUCCESS on Success or
  1082. * QDF_STATUS_E_FAILURE on failure
  1083. */
  1084. static inline QDF_STATUS
  1085. cdp_tso_soc_attach(ol_txrx_soc_handle soc)
  1086. {
  1087. if (!soc || !soc->ops) {
  1088. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1089. "%s: Invalid Instance:", __func__);
  1090. QDF_BUG(0);
  1091. return 0;
  1092. }
  1093. if (!soc->ops->cmn_drv_ops ||
  1094. !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
  1095. return 0;
  1096. return soc->ops->cmn_drv_ops->txrx_tso_soc_attach((void *)soc);
  1097. }
  1098. /**
  1099. * cdp_tso_soc_detach() - TSO detach function
  1100. * @soc: ol_txrx_soc_handle handle
  1101. *
  1102. * Release TSO descriptor buffers
  1103. *
  1104. * Return: QDF_STATUS_SUCCESS on Success or
  1105. * QDF_STATUS_E_FAILURE on failure
  1106. */
  1107. static inline QDF_STATUS
  1108. cdp_tso_soc_detach(ol_txrx_soc_handle soc)
  1109. {
  1110. if (!soc || !soc->ops) {
  1111. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1112. "%s: Invalid Instance:", __func__);
  1113. QDF_BUG(0);
  1114. return 0;
  1115. }
  1116. if (!soc->ops->cmn_drv_ops ||
  1117. !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
  1118. return 0;
  1119. return soc->ops->cmn_drv_ops->txrx_tso_soc_detach((void *)soc);
  1120. }
  1121. /**
  1122. * cdp_addba_resp_tx_completion() - Indicate addba response tx
  1123. * completion to dp to change tid state.
  1124. * @soc: soc handle
  1125. * @peer_handle: peer handle
  1126. * @tid: tid
  1127. * @status: Tx completion status
  1128. *
  1129. * Return: success/failure of tid update
  1130. */
  1131. static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
  1132. void *peer_handle,
  1133. uint8_t tid, int status)
  1134. {
  1135. if (!soc || !soc->ops) {
  1136. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1137. "%s: Invalid Instance:", __func__);
  1138. QDF_BUG(0);
  1139. return 0;
  1140. }
  1141. if (!soc->ops->cmn_drv_ops ||
  1142. !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
  1143. return 0;
  1144. return soc->ops->cmn_drv_ops->addba_resp_tx_completion(peer_handle, tid,
  1145. status);
  1146. }
  1147. static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
  1148. void *peer_handle, uint8_t dialogtoken, uint16_t tid,
  1149. uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
  1150. {
  1151. if (!soc || !soc->ops) {
  1152. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1153. "%s: Invalid Instance:", __func__);
  1154. QDF_BUG(0);
  1155. return 0;
  1156. }
  1157. if (!soc->ops->cmn_drv_ops ||
  1158. !soc->ops->cmn_drv_ops->addba_requestprocess)
  1159. return 0;
  1160. return soc->ops->cmn_drv_ops->addba_requestprocess(peer_handle,
  1161. dialogtoken, tid, batimeout, buffersize, startseqnum);
  1162. }
  1163. static inline void cdp_addba_responsesetup(ol_txrx_soc_handle soc,
  1164. void *peer_handle, uint8_t tid, uint8_t *dialogtoken,
  1165. uint16_t *statuscode, uint16_t *buffersize, uint16_t *batimeout)
  1166. {
  1167. if (!soc || !soc->ops) {
  1168. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1169. "%s: Invalid Instance:", __func__);
  1170. QDF_BUG(0);
  1171. return;
  1172. }
  1173. if (!soc->ops->cmn_drv_ops ||
  1174. !soc->ops->cmn_drv_ops->addba_responsesetup)
  1175. return;
  1176. soc->ops->cmn_drv_ops->addba_responsesetup(peer_handle, tid,
  1177. dialogtoken, statuscode, buffersize, batimeout);
  1178. }
  1179. static inline int cdp_delba_process(ol_txrx_soc_handle soc,
  1180. void *peer_handle, int tid, uint16_t reasoncode)
  1181. {
  1182. if (!soc || !soc->ops) {
  1183. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1184. "%s: Invalid Instance:", __func__);
  1185. QDF_BUG(0);
  1186. return 0;
  1187. }
  1188. if (!soc->ops->cmn_drv_ops ||
  1189. !soc->ops->cmn_drv_ops->delba_process)
  1190. return 0;
  1191. return soc->ops->cmn_drv_ops->delba_process(peer_handle,
  1192. tid, reasoncode);
  1193. }
  1194. /**
  1195. * cdp_delba_tx_completion() - Handle delba tx completion
  1196. * to update stats and retry transmission if failed.
  1197. * @soc: soc handle
  1198. * @peer_handle: peer handle
  1199. * @tid: Tid number
  1200. * @status: Tx completion status
  1201. *
  1202. * Return: 0 on Success, 1 on failure
  1203. */
  1204. static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
  1205. void *peer_handle,
  1206. uint8_t tid, int status)
  1207. {
  1208. if (!soc || !soc->ops) {
  1209. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1210. "%s: Invalid Instance:", __func__);
  1211. QDF_BUG(0);
  1212. return 0;
  1213. }
  1214. if (!soc->ops->cmn_drv_ops ||
  1215. !soc->ops->cmn_drv_ops->delba_tx_completion)
  1216. return 0;
  1217. return soc->ops->cmn_drv_ops->delba_tx_completion(peer_handle,
  1218. tid, status);
  1219. }
  1220. static inline void cdp_set_addbaresponse(ol_txrx_soc_handle soc,
  1221. void *peer_handle, int tid, uint16_t statuscode)
  1222. {
  1223. if (!soc || !soc->ops) {
  1224. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1225. "%s: Invalid Instance:", __func__);
  1226. QDF_BUG(0);
  1227. return;
  1228. }
  1229. if (!soc->ops->cmn_drv_ops ||
  1230. !soc->ops->cmn_drv_ops->set_addba_response)
  1231. return;
  1232. soc->ops->cmn_drv_ops->set_addba_response(peer_handle, tid, statuscode);
  1233. }
  1234. /**
  1235. * cdp_get_peer_mac_addr_frm_id: function to return vdev id and and peer
  1236. * mac address
  1237. * @soc: SOC handle
  1238. * @peer_id: peer id of the peer for which mac_address is required
  1239. * @mac_addr: reference to mac address
  1240. *
  1241. * reutm: vdev_id of the vap
  1242. */
  1243. static inline uint8_t
  1244. cdp_get_peer_mac_addr_frm_id(ol_txrx_soc_handle soc, uint16_t peer_id,
  1245. uint8_t *mac_addr)
  1246. {
  1247. if (!soc || !soc->ops) {
  1248. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1249. "%s: Invalid Instance:", __func__);
  1250. QDF_BUG(0);
  1251. return CDP_INVALID_VDEV_ID;
  1252. }
  1253. if (!soc->ops->cmn_drv_ops ||
  1254. !soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id)
  1255. return CDP_INVALID_VDEV_ID;
  1256. return soc->ops->cmn_drv_ops->get_peer_mac_addr_frm_id(soc,
  1257. peer_id, mac_addr);
  1258. }
  1259. /**
  1260. * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
  1261. * @vdev: vdev handle
  1262. * @map_id: id of the tid map
  1263. *
  1264. * Return: void
  1265. */
  1266. static inline void cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1267. struct cdp_vdev *vdev, uint8_t map_id)
  1268. {
  1269. if (!soc || !soc->ops) {
  1270. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1271. "%s: Invalid Instance:", __func__);
  1272. QDF_BUG(0);
  1273. return;
  1274. }
  1275. if (!soc->ops->cmn_drv_ops ||
  1276. !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
  1277. return;
  1278. soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(vdev,
  1279. map_id);
  1280. }
  1281. /**
  1282. * cdp_ath_get_total_per(): function to get hw retries
  1283. * @soc : soc handle
  1284. * @pdev: pdev handle
  1285. *
  1286. * Return: get hw retries
  1287. */
  1288. static inline
  1289. int cdp_ath_get_total_per(ol_txrx_soc_handle soc,
  1290. struct cdp_pdev *pdev)
  1291. {
  1292. if (!soc || !soc->ops) {
  1293. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1294. "%s: Invalid Instance:", __func__);
  1295. QDF_BUG(0);
  1296. return 0;
  1297. }
  1298. if (!soc->ops->cmn_drv_ops ||
  1299. !soc->ops->cmn_drv_ops->txrx_get_total_per)
  1300. return 0;
  1301. return soc->ops->cmn_drv_ops->txrx_get_total_per(pdev);
  1302. }
  1303. /**
  1304. * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
  1305. * @pdev: pdev handle
  1306. * @map_id: id of the tid map
  1307. * @tos: index value in map that needs to be changed
  1308. * @tid: tid value passed by user
  1309. *
  1310. * Return: void
  1311. */
  1312. static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
  1313. struct cdp_pdev *pdev, uint8_t map_id, uint8_t tos, uint8_t tid)
  1314. {
  1315. if (!soc || !soc->ops) {
  1316. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1317. "%s: Invalid Instance:", __func__);
  1318. QDF_BUG(0);
  1319. return;
  1320. }
  1321. if (!soc->ops->cmn_drv_ops ||
  1322. !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
  1323. return;
  1324. soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(pdev,
  1325. map_id, tos, tid);
  1326. }
  1327. /**
  1328. * cdp_hmmc_tid_override_en(): Function to enable hmmc tid override.
  1329. * @soc : soc handle
  1330. * @pdev: pdev handle
  1331. * @val: hmmc-dscp flag value
  1332. *
  1333. * Return: void
  1334. */
  1335. static inline void cdp_hmmc_tid_override_en(ol_txrx_soc_handle soc,
  1336. struct cdp_pdev *pdev, bool val)
  1337. {
  1338. if (!soc || !soc->ops) {
  1339. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1340. "%s: Invalid Instance:", __func__);
  1341. QDF_BUG(0);
  1342. return;
  1343. }
  1344. if (!soc->ops->cmn_drv_ops ||
  1345. !soc->ops->cmn_drv_ops->hmmc_tid_override_en)
  1346. return;
  1347. soc->ops->cmn_drv_ops->hmmc_tid_override_en(pdev, val);
  1348. }
  1349. /**
  1350. * cdp_set_hmmc_tid_val(): Function to set hmmc tid value.
  1351. * @soc : soc handle
  1352. * @pdev: pdev handle
  1353. * @tid: tid value
  1354. *
  1355. * Return: void
  1356. */
  1357. static inline void cdp_set_hmmc_tid_val(ol_txrx_soc_handle soc,
  1358. struct cdp_pdev *pdev, uint8_t tid)
  1359. {
  1360. if (!soc || !soc->ops) {
  1361. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1362. "%s: Invalid Instance:", __func__);
  1363. QDF_BUG(0);
  1364. return;
  1365. }
  1366. if (!soc->ops->cmn_drv_ops ||
  1367. !soc->ops->cmn_drv_ops->set_hmmc_tid_val)
  1368. return;
  1369. soc->ops->cmn_drv_ops->set_hmmc_tid_val(pdev, tid);
  1370. }
  1371. /**
  1372. * cdp_flush_cache_rx_queue() - flush cache rx queue frame
  1373. *
  1374. * Return: None
  1375. */
  1376. static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
  1377. {
  1378. if (!soc || !soc->ops) {
  1379. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1380. "%s: Invalid Instance:", __func__);
  1381. QDF_BUG(0);
  1382. return;
  1383. }
  1384. if (!soc->ops->cmn_drv_ops ||
  1385. !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
  1386. return;
  1387. soc->ops->cmn_drv_ops->flush_cache_rx_queue();
  1388. }
  1389. /**
  1390. * cdp_txrx_stats_request(): function to map to host and firmware statistics
  1391. * @soc: soc handle
  1392. * @vdev: virtual device
  1393. * @req: stats request container
  1394. *
  1395. * return: status
  1396. */
  1397. static inline
  1398. int cdp_txrx_stats_request(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  1399. struct cdp_txrx_stats_req *req)
  1400. {
  1401. if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
  1402. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1403. "%s: Invalid Instance:", __func__);
  1404. QDF_ASSERT(0);
  1405. return 0;
  1406. }
  1407. if (soc->ops->cmn_drv_ops->txrx_stats_request)
  1408. return soc->ops->cmn_drv_ops->txrx_stats_request(vdev, req);
  1409. return 0;
  1410. }
  1411. /**
  1412. * cdp_txrx_intr_attach(): function to attach and configure interrupt
  1413. * @soc: soc handle
  1414. */
  1415. static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
  1416. {
  1417. if (!soc || !soc->ops) {
  1418. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1419. "%s: Invalid Instance:", __func__);
  1420. QDF_BUG(0);
  1421. return 0;
  1422. }
  1423. if (!soc->ops->cmn_drv_ops ||
  1424. !soc->ops->cmn_drv_ops->txrx_intr_attach)
  1425. return 0;
  1426. return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
  1427. }
  1428. /**
  1429. * cdp_txrx_intr_detach(): function to detach interrupt
  1430. * @soc: soc handle
  1431. */
  1432. static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
  1433. {
  1434. if (!soc || !soc->ops) {
  1435. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1436. "%s: Invalid Instance:", __func__);
  1437. QDF_BUG(0);
  1438. return;
  1439. }
  1440. if (!soc->ops->cmn_drv_ops ||
  1441. !soc->ops->cmn_drv_ops->txrx_intr_detach)
  1442. return;
  1443. soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
  1444. }
  1445. /**
  1446. * cdp_display_stats(): function to map to dump stats
  1447. * @soc: soc handle
  1448. * @value: statistics option
  1449. */
  1450. static inline QDF_STATUS
  1451. cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
  1452. enum qdf_stats_verbosity_level level)
  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->display_stats)
  1462. return 0;
  1463. return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
  1464. }
  1465. /**
  1466. * cdp_set_pn_check(): function to set pn check
  1467. * @soc: soc handle
  1468. * @sec_type: security type
  1469. * #rx_pn: receive pn
  1470. */
  1471. static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
  1472. struct cdp_vdev *vdev, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn)
  1473. {
  1474. if (!soc || !soc->ops) {
  1475. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1476. "%s: Invalid Instance:", __func__);
  1477. QDF_BUG(0);
  1478. return 0;
  1479. }
  1480. if (!soc->ops->cmn_drv_ops ||
  1481. !soc->ops->cmn_drv_ops->set_pn_check)
  1482. return 0;
  1483. soc->ops->cmn_drv_ops->set_pn_check(vdev, peer_handle,
  1484. sec_type, rx_pn);
  1485. return 0;
  1486. }
  1487. static inline int cdp_set_key(ol_txrx_soc_handle soc,
  1488. struct cdp_peer *peer_handle,
  1489. bool is_unicast, uint32_t *key)
  1490. {
  1491. if (!soc || !soc->ops) {
  1492. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1493. "%s: Invalid Instance:", __func__);
  1494. QDF_BUG(0);
  1495. return 0;
  1496. }
  1497. if (!soc->ops->ctrl_ops ||
  1498. !soc->ops->ctrl_ops->set_key)
  1499. return 0;
  1500. soc->ops->ctrl_ops->set_key(peer_handle,
  1501. is_unicast, key);
  1502. return 0;
  1503. }
  1504. /**
  1505. * cdp_update_config_parameters(): function to propagate configuration
  1506. * parameters to datapath
  1507. * @soc: opaque soc handle
  1508. * @cfg: configuration handle
  1509. *
  1510. * Return: status: 0 - Success, non-zero: Failure
  1511. */
  1512. static inline
  1513. QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
  1514. struct cdp_config_params *cfg)
  1515. {
  1516. struct cdp_soc *psoc = (struct cdp_soc *)soc;
  1517. if (!soc || !soc->ops) {
  1518. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1519. "%s: Invalid Instance:", __func__);
  1520. QDF_BUG(0);
  1521. return 0;
  1522. }
  1523. if (!soc->ops->cmn_drv_ops ||
  1524. !soc->ops->cmn_drv_ops->update_config_parameters)
  1525. return QDF_STATUS_SUCCESS;
  1526. return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
  1527. cfg);
  1528. }
  1529. /**
  1530. * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
  1531. * @soc: opaque soc handle
  1532. * @pdev: data path pdev handle
  1533. *
  1534. * Return: opaque dp handle
  1535. */
  1536. static inline void *
  1537. cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev)
  1538. {
  1539. if (!soc || !soc->ops) {
  1540. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1541. "%s: Invalid Instance:", __func__);
  1542. QDF_BUG(0);
  1543. return 0;
  1544. }
  1545. if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
  1546. return soc->ops->cmn_drv_ops->get_dp_txrx_handle(pdev);
  1547. return 0;
  1548. }
  1549. /**
  1550. * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
  1551. * @soc: opaque soc handle
  1552. * @pdev: data path pdev handle
  1553. * @dp_hdl: opaque pointer for dp_txrx_handle
  1554. *
  1555. * Return: void
  1556. */
  1557. static inline void
  1558. cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *pdev, void *dp_hdl)
  1559. {
  1560. if (!soc || !soc->ops) {
  1561. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1562. "%s: Invalid Instance:", __func__);
  1563. QDF_BUG(0);
  1564. return;
  1565. }
  1566. if (!soc->ops->cmn_drv_ops ||
  1567. !soc->ops->cmn_drv_ops->set_dp_txrx_handle)
  1568. return;
  1569. soc->ops->cmn_drv_ops->set_dp_txrx_handle(pdev, dp_hdl);
  1570. }
  1571. /*
  1572. * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
  1573. * @soc: opaque soc handle
  1574. *
  1575. * Return: opaque extended dp handle
  1576. */
  1577. static inline void *
  1578. cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
  1579. {
  1580. if (!soc || !soc->ops) {
  1581. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1582. "%s: Invalid Instance:", __func__);
  1583. QDF_BUG(0);
  1584. return NULL;
  1585. }
  1586. if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
  1587. return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
  1588. (struct cdp_soc *) soc);
  1589. return NULL;
  1590. }
  1591. /**
  1592. * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
  1593. * @soc: opaque soc handle
  1594. * @dp_hdl: opaque pointer for dp_txrx_handle
  1595. *
  1596. * Return: void
  1597. */
  1598. static inline void
  1599. cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
  1600. {
  1601. if (!soc || !soc->ops) {
  1602. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1603. "%s: Invalid Instance:", __func__);
  1604. QDF_BUG(0);
  1605. return;
  1606. }
  1607. if (!soc->ops->cmn_drv_ops ||
  1608. !soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
  1609. return;
  1610. soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
  1611. dp_handle);
  1612. }
  1613. /**
  1614. * cdp_tx_send() - enqueue frame for transmission
  1615. * @soc: soc opaque handle
  1616. * @vdev: VAP device
  1617. * @nbuf: nbuf to be enqueued
  1618. *
  1619. * This API is used by Extended Datapath modules to enqueue frame for
  1620. * transmission
  1621. *
  1622. * Return: void
  1623. */
  1624. static inline void
  1625. cdp_tx_send(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t nbuf)
  1626. {
  1627. if (!soc || !soc->ops) {
  1628. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1629. "%s: Invalid Instance:", __func__);
  1630. QDF_BUG(0);
  1631. return;
  1632. }
  1633. if (!soc->ops->cmn_drv_ops ||
  1634. !soc->ops->cmn_drv_ops->tx_send)
  1635. return;
  1636. soc->ops->cmn_drv_ops->tx_send(vdev, nbuf);
  1637. }
  1638. /*
  1639. * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
  1640. * @soc: opaque soc handle
  1641. * @pdev: data path pdev handle
  1642. *
  1643. * Return: pdev_id
  1644. */
  1645. static inline
  1646. uint8_t cdp_get_pdev_id_frm_pdev(ol_txrx_soc_handle soc,
  1647. struct cdp_pdev *pdev)
  1648. {
  1649. if (soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev)
  1650. return soc->ops->cmn_drv_ops->txrx_get_pdev_id_frm_pdev(pdev);
  1651. return 0;
  1652. }
  1653. /**
  1654. * cdp_pdev_set_chan_noise_floor() - Set channel noise floor to DP layer
  1655. * @soc: opaque soc handle
  1656. * @pdev: data path pdev handle
  1657. * @chan_noise_floor: Channel Noise Floor (in dbM) obtained from control path
  1658. *
  1659. * Return: None
  1660. */
  1661. static inline
  1662. void cdp_pdev_set_chan_noise_floor(ol_txrx_soc_handle soc,
  1663. struct cdp_pdev *pdev,
  1664. int16_t chan_noise_floor)
  1665. {
  1666. if (soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor)
  1667. return soc->ops->cmn_drv_ops->txrx_pdev_set_chan_noise_floor(
  1668. pdev, chan_noise_floor);
  1669. }
  1670. /**
  1671. * cdp_set_nac() - set nac
  1672. * @soc: opaque soc handle
  1673. * @peer: data path peer handle
  1674. *
  1675. */
  1676. static inline
  1677. void cdp_set_nac(ol_txrx_soc_handle soc,
  1678. struct cdp_peer *peer)
  1679. {
  1680. if (soc->ops->cmn_drv_ops->txrx_set_nac)
  1681. soc->ops->cmn_drv_ops->txrx_set_nac(peer);
  1682. }
  1683. /**
  1684. * cdp_set_pdev_tx_capture() - set pdev tx_capture
  1685. * @soc: opaque soc handle
  1686. * @pdev: data path pdev handle
  1687. * @val: value of pdev_tx_capture
  1688. *
  1689. * Return: status: 0 - Success, non-zero: Failure
  1690. */
  1691. static inline
  1692. QDF_STATUS cdp_set_pdev_tx_capture(ol_txrx_soc_handle soc,
  1693. struct cdp_pdev *pdev, int val)
  1694. {
  1695. if (soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture)
  1696. return soc->ops->cmn_drv_ops->txrx_set_pdev_tx_capture(pdev,
  1697. val);
  1698. return QDF_STATUS_SUCCESS;
  1699. }
  1700. /**
  1701. * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
  1702. * @soc: opaque soc handle
  1703. * @pdev: data path pdev handle
  1704. * @peer_id: data path peer id
  1705. * @peer_mac: peer_mac
  1706. *
  1707. * Return: void
  1708. */
  1709. static inline
  1710. void cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
  1711. struct cdp_pdev *pdev_handle,
  1712. uint32_t peer_id, uint8_t *peer_mac)
  1713. {
  1714. if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
  1715. soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
  1716. pdev_handle, peer_id, peer_mac);
  1717. }
  1718. /**
  1719. * cdp_vdev_tx_lock() - acquire lock
  1720. * @soc: opaque soc handle
  1721. * @vdev: data path vdev handle
  1722. *
  1723. * Return: void
  1724. */
  1725. static inline
  1726. void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
  1727. struct cdp_vdev *vdev)
  1728. {
  1729. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
  1730. soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(vdev);
  1731. }
  1732. /**
  1733. * cdp_vdev_tx_unlock() - release lock
  1734. * @soc: opaque soc handle
  1735. * @vdev: data path vdev handle
  1736. *
  1737. * Return: void
  1738. */
  1739. static inline
  1740. void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
  1741. struct cdp_vdev *vdev)
  1742. {
  1743. if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
  1744. soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(vdev);
  1745. }
  1746. /**
  1747. * cdp_ath_getstats() - get updated athstats
  1748. * @soc: opaque soc handle
  1749. * @dev: dp interface handle
  1750. * @stats: cdp network device stats structure
  1751. * @type: device type pdev/vdev
  1752. *
  1753. * Return: void
  1754. */
  1755. static inline void cdp_ath_getstats(ol_txrx_soc_handle soc,
  1756. void *dev, struct cdp_dev_stats *stats,
  1757. uint8_t type)
  1758. {
  1759. if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
  1760. soc->ops->cmn_drv_ops->txrx_ath_getstats(dev, stats, type);
  1761. }
  1762. /**
  1763. * cdp_set_gid_flag() - set groupid flag
  1764. * @soc: opaque soc handle
  1765. * @pdev: data path pdev handle
  1766. * @mem_status: member status from grp management frame
  1767. * @user_position: user position from grp management frame
  1768. *
  1769. * Return: void
  1770. */
  1771. static inline
  1772. void cdp_set_gid_flag(ol_txrx_soc_handle soc,
  1773. struct cdp_pdev *pdev, u_int8_t *mem_status,
  1774. u_int8_t *user_position)
  1775. {
  1776. if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
  1777. soc->ops->cmn_drv_ops->txrx_set_gid_flag(pdev, mem_status, user_position);
  1778. }
  1779. /**
  1780. * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
  1781. * @soc: opaque soc handle
  1782. * @pdev: data path pdev handle
  1783. *
  1784. */
  1785. static inline
  1786. uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
  1787. struct cdp_pdev *pdev)
  1788. {
  1789. if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
  1790. return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(pdev);
  1791. return 0;
  1792. }
  1793. /**
  1794. * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
  1795. * @soc: opaque soc handle
  1796. * @ni: associated node
  1797. * @force: number of frame in SW queue
  1798. * Return: void
  1799. */
  1800. static inline
  1801. void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
  1802. void *ni, int force)
  1803. {
  1804. if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
  1805. soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(ni, force);
  1806. }
  1807. /* cdp_peer_map_attach() - CDP API to allocate PEER map memory
  1808. * @soc: opaque soc handle
  1809. * @max_peers: number of peers created in FW
  1810. * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
  1811. *
  1812. *
  1813. * Return: void
  1814. */
  1815. static inline void
  1816. cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
  1817. bool peer_map_unmap_v2)
  1818. {
  1819. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1820. soc->ops->cmn_drv_ops->txrx_peer_map_attach)
  1821. soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc, max_peers,
  1822. peer_map_unmap_v2);
  1823. }
  1824. /**
  1825. * cdp_pdev_set_ctrl_pdev() - set UMAC ctrl pdev to dp pdev
  1826. * @soc: opaque soc handle
  1827. * @pdev: opaque dp pdev handle
  1828. * @ctrl_pdev: opaque ctrl pdev handle
  1829. *
  1830. * Return: void
  1831. */
  1832. static inline void
  1833. cdp_pdev_set_ctrl_pdev(ol_txrx_soc_handle soc, struct cdp_pdev *dp_pdev,
  1834. struct cdp_ctrl_objmgr_pdev *ctrl_pdev)
  1835. {
  1836. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1837. soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev)
  1838. soc->ops->cmn_drv_ops->txrx_pdev_set_ctrl_pdev(dp_pdev,
  1839. ctrl_pdev);
  1840. }
  1841. /* cdp_txrx_classify_and_update() - To classify the packet and update stats
  1842. * @soc: opaque soc handle
  1843. * @vdev: opaque dp vdev handle
  1844. * @skb: data
  1845. * @dir: rx or tx packet
  1846. * @nbuf_classify: packet classification object
  1847. *
  1848. * Return: 1 on success else return 0
  1849. */
  1850. static inline int
  1851. cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
  1852. struct cdp_vdev *vdev, qdf_nbuf_t skb,
  1853. enum txrx_direction dir,
  1854. struct ol_txrx_nbuf_classify *nbuf_class)
  1855. {
  1856. if (!soc || !soc->ops) {
  1857. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1858. "%s: Invalid Instance", __func__);
  1859. QDF_BUG(0);
  1860. return 0;
  1861. }
  1862. if (!soc->ops->cmn_drv_ops ||
  1863. !soc->ops->cmn_drv_ops->txrx_classify_update)
  1864. return 0;
  1865. return soc->ops->cmn_drv_ops->txrx_classify_update(vdev,
  1866. skb,
  1867. dir, nbuf_class);
  1868. }
  1869. /**
  1870. * cdp_get_dp_capabilities() - get DP capabilities
  1871. * @soc: opaque soc handle
  1872. * @dp_cap: enum of DP capabilities
  1873. *
  1874. * Return: bool
  1875. */
  1876. static inline bool
  1877. cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
  1878. {
  1879. if (soc && soc->ops && soc->ops->cmn_drv_ops &&
  1880. soc->ops->cmn_drv_ops->get_dp_capabilities)
  1881. return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
  1882. return false;
  1883. }
  1884. #ifdef RECEIVE_OFFLOAD
  1885. /**
  1886. * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
  1887. * @soc - data path soc handle
  1888. * @pdev - device instance pointer
  1889. *
  1890. * register rx offload flush callback function pointer
  1891. *
  1892. * return none
  1893. */
  1894. static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
  1895. void (rx_ol_flush_cb)(void *))
  1896. {
  1897. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  1898. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1899. "%s invalid instance", __func__);
  1900. return;
  1901. }
  1902. if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
  1903. return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
  1904. rx_ol_flush_cb);
  1905. }
  1906. /**
  1907. * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
  1908. * @soc - data path soc handle
  1909. *
  1910. * deregister rx offload flush callback function pointer
  1911. *
  1912. * return none
  1913. */
  1914. static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
  1915. {
  1916. if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
  1917. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1918. "%s invalid instance", __func__);
  1919. return;
  1920. }
  1921. if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
  1922. return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
  1923. }
  1924. #endif /* RECEIVE_OFFLOAD */
  1925. /**
  1926. * @cdp_set_ba_timeout() - set ba aging timeout per AC
  1927. *
  1928. * @soc - pointer to the soc
  1929. * @value - timeout value in millisec
  1930. * @ac - Access category
  1931. *
  1932. * @return - void
  1933. */
  1934. static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
  1935. uint8_t ac, uint32_t value)
  1936. {
  1937. if (!soc || !soc->ops) {
  1938. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1939. "%s: Invalid Instance", __func__);
  1940. QDF_BUG(0);
  1941. return;
  1942. }
  1943. if (!soc->ops->cmn_drv_ops ||
  1944. !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
  1945. return;
  1946. soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
  1947. }
  1948. /**
  1949. * @cdp_get_ba_timeout() - return ba aging timeout per AC
  1950. *
  1951. * @soc - pointer to the soc
  1952. * @ac - access category
  1953. * @value - timeout value in millisec
  1954. *
  1955. * @return - void
  1956. */
  1957. static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
  1958. uint8_t ac, uint32_t *value)
  1959. {
  1960. if (!soc || !soc->ops) {
  1961. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1962. "%s: Invalid Instance", __func__);
  1963. QDF_BUG(0);
  1964. return;
  1965. }
  1966. if (!soc->ops->cmn_drv_ops ||
  1967. !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
  1968. return;
  1969. soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
  1970. }
  1971. /**
  1972. * cdp_cfg_get() - get cfg for dp enum
  1973. *
  1974. * @soc: pointer to the soc
  1975. * @cfg: cfg enum
  1976. *
  1977. * Return - cfg value
  1978. */
  1979. static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
  1980. {
  1981. if (!soc || !soc->ops) {
  1982. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  1983. "%s: Invalid Instance", __func__);
  1984. return 0;
  1985. }
  1986. if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
  1987. return 0;
  1988. return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
  1989. }
  1990. #endif /* _CDP_TXRX_CMN_H_ */